ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FastOpenGlDisplayer/src/Frog_Analyzer.cc
(Generate patch)

Comparing UserCode/FastOpenGlDisplayer/src/Frog_Analyzer.cc (file contents):
Revision 1.23 by querten, Fri Jul 11 04:38:40 2008 UTC vs.
Revision 1.27 by querten, Tue Aug 19 14:38:38 2008 UTC

# Line 126 | Line 126
126   #include "Visualisation/Frog/soft/Includes/FROG/FROG_DetId.h"
127   #include "Visualisation/Frog/soft/Includes/FROG/FROG_ReadCards.cpp"
128  
129 + #include "DataFormats/VertexReco/interface/NuclearInteraction.h"
130 +
131 + #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Event_NuclInt.h"
132 +
133  
134   using namespace edm;
135   using namespace std;
# Line 152 | Line 156 | class Frog_Analyzer : public edm::EDAnal
156        std::vector<InputTag> SimTrackProducers;
157        std::vector<InputTag> SimVertexProducers;
158        std::vector<InputTag> SimHitProducers;
159 +      std::vector<InputTag> SimCaloHitProducers;
160 +
161 +      std::vector<InputTag> NIProducers;
162  
163        std::vector<InputTag> TrackProducers;
164        std::vector<InputTag> TrajectoryProducers;
# Line 184 | Line 191 | Frog_Analyzer::Frog_Analyzer(const edm::
191      SimTrackProducers       = iConfig.getParameter<std::vector<InputTag> >("SimTrackProducers");
192      SimVertexProducers      = iConfig.getParameter<std::vector<InputTag> >("SimVertexProducers");
193      SimHitProducers         = iConfig.getParameter<std::vector<InputTag> >("SimHitProducers");
194 +    SimCaloHitProducers     = iConfig.getParameter<std::vector<InputTag> >("SimCaloHitProducers");
195 +
196  
197      TrackProducers          = iConfig.getParameter<std::vector<InputTag> >("TrackProducers");
198      TrajectoryProducers     = iConfig.getParameter<std::vector<InputTag> >("TrajectoryProducers");
# Line 192 | Line 201 | Frog_Analyzer::Frog_Analyzer(const edm::
201      HcalHORecHitProducers   = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers");
202      HcalHFRecHitProducers   = iConfig.getParameter<std::vector<InputTag> >("HcalHFRecHitProducers");
203  
204 +    NIProducers             = iConfig.getParameter<std::vector<InputTag> >("NIProducers");
205 +
206      DTSegmentProducers      = iConfig.getParameter<std::vector<InputTag> >("DTSegmentProducers");
207      CSCSegmentProducers     = iConfig.getParameter<std::vector<InputTag> >("CSCSegmentProducers");
208  
# Line 733 | Line 744 | Frog_Analyzer::analyze(const edm::Event&
744          }
745  
746  
747 <        FROG_Element_Event* event =  new FROG_Element_Event(iEvent.id().run(), iEvent.id().event() );
747 >        FROG_Element_Event* event =  new FROG_Element_Event(iEvent.id().run(), iEvent.id().event(), iEvent.time().value() );
748          events_prim->addDaughter(event);
749  
750          // access the tracker
# Line 749 | Line 760 | Frog_Analyzer::analyze(const edm::Event&
760          edm::ESHandle<RPCGeometry> RpcGeom;
761          iSetup.get<MuonGeometryRecord>().get( RpcGeom );
762  
763 +        edm::ESHandle<CaloGeometry> CaloGeom;
764 +        iSetup.get<IdealGeometryRecord>().get( CaloGeom );
765 +
766 +
767          // ### SIMTRACK ###
768 +        FROG_Element_Base_With_DetId* frogSimTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMTRK);
769 +        event->addDaughter(frogSimTrkColl);
770 +
771          for(unsigned int i=0;i<SimTrackProducers.size();i++){
772             edm::Handle<std::vector< SimTrack > > h_SimTracks;
773             iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
774             std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
775  
758           FROG_Element_Base_With_DetId* frogSimTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMTRK + i);
759           event->addDaughter(frogSimTrkColl);
760
776             for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
777                  SimTrack    simTrack    =SimTrackColl[a];
778  
# Line 770 | Line 785 | Frog_Analyzer::analyze(const edm::Event&
785          }
786  
787          // ### SIMVERTEX ###
788 +        FROG_Element_Base_With_DetId* frogSimVtx = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMVTX);
789 +        event->addDaughter(frogSimVtx);
790 +
791          for(unsigned int i=0;i<SimVertexProducers.size();i++){
792             edm::Handle<std::vector< SimVertex > > h_Vertex;
793             iEvent.getByLabel(SimVertexProducers[i], h_Vertex);
794             std::vector< SimVertex > VertexColl = *h_Vertex.product();
795  
778           FROG_Element_Base_With_DetId* frogSimVtxColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMVTX + i);
779           event->addDaughter(frogSimVtxColl);
780
796             for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
797                  SimVertex       Vertex  =  VertexColl[b];
798  
799 <                FROG_Element_Event_Sim_Vertex* frogSimVtx = new FROG_Element_Event_Sim_Vertex(
799 >                FROG_Element_Event_Sim_Vertex* frogSimVertex = new FROG_Element_Event_Sim_Vertex(
800                          Vertex.position().x(),  Vertex.position().y(),  Vertex.position().z(),
801                          Vertex.parentIndex());
802  
803 <                frogSimVtxColl->addDaughter(frogSimVtx);
803 >                frogSimVtx->addDaughter(frogSimVertex);
804             }
805          }
806  
807  
808          // ### SIMHIT ###
809  
810 +        FROG_Element_Base_With_DetId* frogSimHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT);
811 +        event->addDaughter(frogSimHit);
812          for(unsigned int i=0;i<SimHitProducers.size();i++){
813             edm::Handle<std::vector< PSimHit > > h_Hits;
814             iEvent.getByLabel(SimHitProducers[i], h_Hits);
815             std::vector< PSimHit > Hits = *h_Hits.product();
816  
817 <           FROG_Element_Base_With_DetId* frogSimHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT + i);
818 <           event->addDaughter(frogSimHitColl);
817 >           FROG_Element_Base_With_DetId* frogSimHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT + i + 1);
818 >           frogSimHit->addDaughter(frogSimHitColl);
819  
820             for(unsigned int h=0; h<Hits.size(); h++)
821             {
822                  DetId theDetUnitId(Hits[h].detUnitId());
823 <                const GeomDet* theDet = tkGeom->idToDet(theDetUnitId);
823 >                const GeomDet* theDet = NULL;
824 >                if(theDetUnitId.det() == DetId::Tracker)theDet = tkGeom->idToDet(theDetUnitId);
825 >                if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::DT) theDet = DtGeom->idToDet(theDetUnitId);
826 >                if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::CSC)theDet = CscGeom->idToDet(theDetUnitId);
827 >                if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::RPC)theDet = RpcGeom->idToDet(theDetUnitId);
828  
829                  
830                  FROG_Element_Event_Sim_Hit* frogSimHit = new FROG_Element_Event_Sim_Hit(
# Line 813 | Line 834 | Frog_Analyzer::analyze(const edm::Event&
834             }
835          }
836  
837 +        // ### SIMCALOHIT ###
838 +
839 +        for(unsigned int i=0;i<SimCaloHitProducers.size();i++){
840 +           edm::Handle<std::vector< PCaloHit > > h_CaloHits;
841 +           iEvent.getByLabel(SimCaloHitProducers[i], h_CaloHits);
842 +           std::vector< PCaloHit > CaloHits = *h_CaloHits.product();
843 +
844 +           FROG_Element_Base_With_DetId* frogSimHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT + SimHitProducers.size() + i + 1);
845 +           frogSimHit->addDaughter(frogSimHitColl);
846 +
847 +           for(unsigned int h=0; h<CaloHits.size(); h++)
848 +           {
849 +                DetId theDetUnitId(CaloHits[h].id());
850 +                const CaloCellGeometry* CellGeom = NULL;
851 +                if(theDetUnitId.det() == DetId::Ecal || theDetUnitId.det() == DetId::Hcal)CellGeom = CaloGeom->getGeometry(theDetUnitId);
852 +                if(CellGeom==NULL)continue;
853 +
854 +
855 +                FROG_Element_Event_Sim_Hit* frogSimCaloHit = new FROG_Element_Event_Sim_Hit(
856 +                        CellGeom->getPosition().x(),CellGeom->getPosition().y(),CellGeom->getPosition().z(),
857 +                        CaloHits[h].energy(), CaloHits[h].depth() );
858 +                frogSimHitColl->addDaughter(frogSimCaloHit);
859 +           }
860 +        }
861 +
862 +        // NUCLEAR INTERACTIONS
863 +        for(unsigned int i=0;i<NIProducers.size();i++) {
864 +          edm::Handle<std::vector<reco::NuclearInteraction> > h_NIs;
865 +          iEvent.getByLabel(NIProducers[i], h_NIs);
866 +          std::vector<reco::NuclearInteraction> NIs = *h_NIs.product();
867 +          FROG_Element_Base_With_DetId* frogNIColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_NUCLINT + i);
868 +          event->addDaughter(frogNIColl);
869 +
870 +          for(unsigned int h=0; h<NIs.size();h++){
871 +             reco::NuclearInteraction ni = NIs[i];
872 +             float vtx_x = ni.vertex().x();
873 +             float vtx_y = ni.vertex().y();
874 +             float vtx_z = ni.vertex().z();
875 +             float like  = ni.likelihood();
876 +             FROG_Element_Event_NuclInt*  frogNI = new FROG_Element_Event_NuclInt(vtx_x, vtx_y, vtx_z, like );
877 +             frogNIColl->addDaughter(frogNI);
878 +          }
879 +        }
880 +
881  
882  
883          // ### TRAJECTORY ###
884 +        FROG_Element_Base_With_DetId* frogTrk = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK);
885 +        event->addDaughter(frogTrk);
886 +
887          for(unsigned int i=0;i<TrajectoryProducers.size();i++){
888               Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
889               iEvent.getByLabel(TrajectoryProducers[i], trajTrackAssociationHandle);
890               const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product();
891  
892 <             FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + i);
893 <             event->addDaughter(frogTrkColl);
892 >             FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + i + 1);
893 >             frogTrk->addDaughter(frogTrkColl);
894  
895               for(TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it!=TrajToTrackMap.end(); ++it) {
896                  Trajectory  recoTraj     = *it->key;
# Line 850 | Line 918 | Frog_Analyzer::analyze(const edm::Event&
918             iEvent.getByLabel(TrackProducers[i], h_Tracks);
919             std::vector< reco::Track > TrackColl = *h_Tracks.product();
920  
921 <           FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + TrajectoryProducers.size()+i);
922 <           event->addDaughter(frogTrkColl);
921 >           FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + TrajectoryProducers.size() + i + 1);
922 >           frogTrk->addDaughter(frogTrkColl);
923  
924             //printf("Size of the TrackCOllection : %i = %i\n",i,TrackColl.size());
925             for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
# Line 885 | Line 953 | Frog_Analyzer::analyze(const edm::Event&
953          }
954  
955  
888
956          // ### ECALRecHits ###
957 +        FROG_Element_Base_With_DetId* frogEcalHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_ECALHIT);
958 +        event->addDaughter(frogEcalHit);
959          for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
960             edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
961             iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits);
962             EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
963  
964 <           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_ECALHIT + i);
965 <           event->addDaughter(frogHitColl);
964 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_ECALHIT + i + 1);
965 >           frogEcalHit->addDaughter(frogHitColl);
966  
967             for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
968                  FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((Ecal_RecHits[eh].detid()).rawId(),
# Line 904 | Line 973 | Frog_Analyzer::analyze(const edm::Event&
973  
974  
975          // ### HCALRecHits ###
976 +        FROG_Element_Base_With_DetId* frogHcalHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT);
977 +        event->addDaughter(frogHcalHit);
978          for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){
979             edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
980             iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits);
981             HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
982  
983 <           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + i);
984 <           event->addDaughter(frogHitColl);
983 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + i + 1);
984 >           frogHcalHit->addDaughter(frogHitColl);
985  
986             for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
987                  FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHBHE_RecHits[hh].detid()).rawId(),
# Line 924 | Line 995 | Frog_Analyzer::analyze(const edm::Event&
995             iEvent.getByLabel(HcalHORecHitProducers[i], h_HcalHO_RecHits);
996             HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
997  
998 <           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + i);
999 <           event->addDaughter(frogHitColl);
998 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + i + 1);
999 >           frogHcalHit->addDaughter(frogHitColl);
1000  
1001             for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
1002                  FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHO_RecHits[hh].detid()).rawId(),
# Line 939 | Line 1010 | Frog_Analyzer::analyze(const edm::Event&
1010             iEvent.getByLabel(HcalHFRecHitProducers[i], h_HcalHF_RecHits);
1011             HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
1012  
1013 <           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + HcalHORecHitProducers.size() + i);
1014 <           event->addDaughter(frogHitColl);
1013 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + HcalHORecHitProducers.size() + i + 1);
1014 >           frogHcalHit->addDaughter(frogHitColl);
1015  
1016             for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
1017                  FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHF_RecHits[hh].detid()).rawId(),
# Line 949 | Line 1020 | Frog_Analyzer::analyze(const edm::Event&
1020             }
1021          }
1022  
1023 +
1024          // ### Muon Segments ###
1025 +        FROG_Element_Base_With_DetId* frogMuonSeg = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG);
1026 +        event->addDaughter(frogMuonSeg);
1027 +
1028          for(unsigned int i=0;i<CSCSegmentProducers.size();i++){
1029             edm::Handle<CSCSegmentCollection > h_CSC_Segments;
1030             iEvent.getByLabel(CSCSegmentProducers[i], h_CSC_Segments);
1031             CSCSegmentCollection CSC_Segments = *h_CSC_Segments.product();
1032  
1033 <           FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + i);
1034 <           event->addDaughter(frogSegColl);
1033 >           FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + i + 1);
1034 >           frogMuonSeg->addDaughter(frogSegColl);
1035  
1036             for(unsigned int s=0;s<CSC_Segments.size();s++){
1037                  DetId theDetUnitId = CSC_Segments[s].geographicalId();
# Line 974 | Line 1049 | Frog_Analyzer::analyze(const edm::Event&
1049             iEvent.getByLabel(DTSegmentProducers[i], h_DT_Segments);
1050             DTRecSegment4DCollection DT_Segments = *h_DT_Segments.product();
1051  
1052 <           FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + CSCSegmentProducers.size() + i);
1053 <           event->addDaughter(frogSegColl);
1052 >           FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + CSCSegmentProducers.size() + i + 1);
1053 >           frogMuonSeg->addDaughter(frogSegColl);
1054  
1055             for(unsigned int s=0;s<DT_Segments.size();s++){
1056                  DetId theDetUnitId = DT_Segments[s].geographicalId();
# Line 989 | Line 1064 | Frog_Analyzer::analyze(const edm::Event&
1064          }
1065  
1066          // ### Muon Hits ###
1067 +        FROG_Element_Base_With_DetId* frogMuonHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONHIT);
1068 +        event->addDaughter(frogMuonHit);
1069          for(unsigned int i=0;i<RPCHitsProducers.size();i++){
1070             edm::Handle<RPCRecHitCollection > h_RPC_Hits;
1071             iEvent.getByLabel(RPCHitsProducers[i], h_RPC_Hits);
1072             RPCRecHitCollection RPC_Hits = *h_RPC_Hits.product();
1073  
1074 <           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONHIT + i);
1075 <           event->addDaughter(frogHitColl);
1074 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONHIT + i + 1);
1075 >           frogMuonHit->addDaughter(frogHitColl);
1076  
1077             for(unsigned int h=0;h<RPC_Hits.size();h++){
1078                  DetId theDetUnitId = RPC_Hits[h].geographicalId();
# Line 1007 | Line 1084 | Frog_Analyzer::analyze(const edm::Event&
1084             }
1085          }
1086  
1087 +
1088     NEvents++;
1089     if(NEvents == NEventsInVisFile){
1090        char OutputFileName[1024];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines