#include <Validation/Mixing/interface/TestSuite.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (edm::EventSetup const &iSetup) |
virtual void | endJob () |
TestSuite (const edm::ParameterSet &) | |
~TestSuite () | |
Private Attributes | |
int | bunchcr_ |
DQMStore * | dbe_ |
std::string | filename_ |
int | maxbunch_ |
int | minbunch_ |
Description: global physics test for Mixing Module.
Definition at line 37 of file TestSuite.h.
TestSuite::TestSuite | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 41 of file TestSuite.cc.
References bunchcr_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and filename_.
00041 : filename_(iConfig.getParameter<std::string>("fileName")), bunchcr_(iConfig.getParameter<int>("BunchNr")), minbunch_(iConfig.getParameter<int>("minBunch")),maxbunch_(iConfig.getParameter<int>("maxBunch")), dbe_(0) 00042 { 00043 std::cout << "Constructed testSuite , bunchcr "<<bunchcr_<<" filename: "<<filename_<<std::endl; 00044 00045 }
TestSuite::~TestSuite | ( | ) |
Definition at line 48 of file TestSuite.cc.
00049 { 00050 00051 // do anything here that needs to be done at desctruction time 00052 // (e.g. close files, deallocate resources etc.) 00053 }
void TestSuite::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 71 of file TestSuite.cc.
References MixCollection< T >::begin(), DQMStore::book1D(), bunchcr_, dbe_, MixCollection< T >::end(), MonitorElement::Fill(), edm::Event::getByLabel(), edm::Event::getByType(), maxbunch_, minbunch_, and edm::Handle< T >::product().
00072 { 00073 using namespace edm; 00074 00075 // Get input 00076 edm::Handle<CrossingFrame<SimTrack> > cf_track; 00077 edm::Handle<CrossingFrame<SimVertex> > cf_vertex; 00078 edm::Handle<CrossingFrame<PSimHit> > cf_simhit; 00079 edm::Handle<CrossingFrame<PCaloHit> > cf_calohitEcal; 00080 edm::Handle<CrossingFrame<PCaloHit> > cf_calohitHcal; 00081 std::string subdetTracker("TrackerHitsTECLowTof"); 00082 std::string ecalsubdet("EcalHitsEB"); 00083 std::string hcalsubdet("HcalHits"); 00084 iEvent.getByType(cf_track); 00085 iEvent.getByType(cf_vertex); 00086 iEvent.getByLabel("mix",subdetTracker,cf_simhit); 00087 iEvent.getByLabel("mix",ecalsubdet,cf_calohitEcal); 00088 iEvent.getByLabel("mix",hcalsubdet,cf_calohitHcal); 00089 00090 // use MixCollection and its iterator 00091 // Please note that bunch() and getTrigger() are methods of the iterator itself 00092 // while operator-> points to the templated objects!!!! 00093 00094 //track histo 00095 char histotracks[30],sighistotracks[30],histotracksindsig[30],histotracksind[30]; 00096 sprintf(histotracks,"Tracks_bcr_%d",bunchcr_); 00097 sprintf(sighistotracks,"SignalTracks_bcr_%d",bunchcr_); 00098 sprintf(histotracksind,"VtxPointers_%d",bunchcr_); 00099 sprintf(histotracksindsig,"VtxPointers_signal_%d",bunchcr_); 00100 MonitorElement * trhist = dbe_->book1D(histotracks,"Bunchcrossings",maxbunch_-minbunch_+1,minbunch_,maxbunch_+1); 00101 MonitorElement * trhistsig = dbe_->book1D(sighistotracks,"Bunchcrossings",maxbunch_-minbunch_+1,minbunch_,maxbunch_+1); 00102 MonitorElement * trindhist = dbe_->book1D(histotracksind,"Track to Vertex indices",100,0,500); 00103 MonitorElement * trindhistsig = dbe_->book1D(histotracksindsig,"Signal Track to Vertex indices",100,0,500); 00104 std::auto_ptr<MixCollection<SimTrack> > col1(new MixCollection<SimTrack>(cf_track.product())); 00105 MixCollection<SimTrack>::iterator cfi1; 00106 for (cfi1=col1->begin(); cfi1!=col1->end();cfi1++) { 00107 if (cfi1.getTrigger()==0) { 00108 trhist->Fill(cfi1.bunch()); 00109 trindhist->Fill(cfi1->vertIndex()); 00110 } else { 00111 trindhistsig->Fill(cfi1->vertIndex()); 00112 trhistsig->Fill(cfi1.bunch()); 00113 } 00114 } 00115 00116 00117 //vertex histo 00118 char histovertices[30], sighistovertices[30],histovertexindices[30],histovertexindicessig[30]; 00119 sprintf(histovertices,"Vertices_bcr_%d",bunchcr_); 00120 sprintf(sighistovertices,"SignalVertices_bcr_%d",bunchcr_); 00121 sprintf(histovertexindices,"TrackPointers_%d",bunchcr_); 00122 sprintf(histovertexindicessig,"TrackPointers_signal_%d",bunchcr_); 00123 MonitorElement * vtxhist = dbe_->book1D(histovertices,"Bunchcrossings",maxbunch_-minbunch_+1,minbunch_,maxbunch_+1); 00124 MonitorElement * vtxhistsig = dbe_->book1D(sighistovertices,"Bunchcrossings",maxbunch_-minbunch_+1,minbunch_,maxbunch_+1); 00125 MonitorElement * vtxindhist = dbe_->book1D(histovertexindices,"Vertex to Track Indices",100,0,300); 00126 MonitorElement * vtxindhistsig = dbe_->book1D(histovertexindicessig,"Signal Vertex to Track Indices",100,0,300); 00127 std::auto_ptr<MixCollection<SimVertex> > col2(new MixCollection<SimVertex>(cf_vertex.product())); 00128 MixCollection<SimVertex>::iterator cfi2; 00129 for (cfi2=col2->begin(); cfi2!=col2->end();cfi2++) { 00130 if (cfi2.getTrigger()==0) { 00131 vtxhist->Fill(cfi2.bunch()); 00132 if (!cfi2->noParent()) vtxindhist->Fill(cfi2->parentIndex()); 00133 } else { 00134 vtxhistsig->Fill(cfi2.bunch()); 00135 if (!cfi2->noParent()) vtxindhistsig->Fill(cfi2->parentIndex()); 00136 } 00137 } 00138 00139 //tracker 00140 int bsp=cf_simhit->getBunchSpace(); 00141 char tof[30]; 00142 00143 sprintf(tof,"TrackerHit_Tof_bcr_%d",bunchcr_); 00144 MonitorElement * tofhist = dbe_->book1D(tof,"TrackerHit_ToF",100,float(bsp*minbunch_),float(bsp*maxbunch_)+50.); 00145 sprintf(tof,"SignalTrackerHit_Tof_bcr_%d",bunchcr_); 00146 MonitorElement * tofhist_sig = dbe_->book1D(tof,"TrackerHit_ToF",100,float(bsp*minbunch_),float(bsp*maxbunch_)+50.); 00147 std::auto_ptr<MixCollection<PSimHit> > colsh(new MixCollection<PSimHit>(cf_simhit.product())); 00148 MixCollection<PSimHit>::iterator cfish; 00149 for (cfish=colsh->begin(); cfish!=colsh->end();cfish++) { 00150 if (cfish.getTrigger()) { 00151 tofhist_sig->Fill(cfish->timeOfFlight()); 00152 } 00153 else { 00154 tofhist->Fill(cfish->timeOfFlight()); 00155 } 00156 } 00157 00158 //Ecal 00159 sprintf(tof,"EcalEBHit_Tof_bcr_%d",bunchcr_); 00160 MonitorElement * tofecalhist = dbe_->book1D(tof,"EcalEBHit_ToF",100,float(bsp*minbunch_),float(bsp*maxbunch_)+50.); 00161 sprintf(tof,"SignalEcalEBHit_Tof_bcr_%d",bunchcr_); 00162 MonitorElement * tofecalhist_sig = dbe_->book1D(tof,"EcalEBHit_ToF",100,float(bsp*minbunch_),float(bsp*maxbunch_)+50.); 00163 // std::string ecalsubdet("EcalHitsEB"); 00164 std::auto_ptr<MixCollection<PCaloHit> > colecal(new MixCollection<PCaloHit>(cf_calohitEcal.product())); 00165 MixCollection<PCaloHit>::iterator cfiecal; 00166 for (cfiecal=colecal->begin(); cfiecal!=colecal->end();cfiecal++) { 00167 if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time()); 00168 else tofecalhist->Fill(cfiecal->time()); 00169 } 00170 00171 // Hcal 00172 sprintf(tof,"HcalHit_Tof_bcr_%d",bunchcr_); 00173 MonitorElement * tofhcalhist = dbe_->book1D(tof,"HcalHit_ToF",100,float(bsp*minbunch_),float(bsp*maxbunch_)+50.); 00174 sprintf(tof,"SignalHcalHit_Tof_bcr_%d",bunchcr_); 00175 MonitorElement * tofhcalhist_sig = dbe_->book1D(tof,"HcalHit_ToF",100,float(bsp*minbunch_),float(bsp*maxbunch_)+50.); 00176 // std::string hcalsubdet("HcalHits"); 00177 std::auto_ptr<MixCollection<PCaloHit> > colhcal(new MixCollection<PCaloHit>(cf_calohitHcal.product())); 00178 MixCollection<PCaloHit>::iterator cfihcal; 00179 for (cfihcal=colhcal->begin(); cfihcal!=colhcal->end();cfihcal++) { 00180 if (cfihcal.getTrigger()) tofhcalhist_sig->Fill(cfihcal->time()); 00181 else tofhcalhist->Fill(cfihcal->time()); 00182 } 00183 }
void TestSuite::beginJob | ( | edm::EventSetup const & | iSetup | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 55 of file TestSuite.cc.
References dbe_, DQMStore::setCurrentFolder(), and DQMStore::showDirStructure().
00055 { 00056 00057 // get hold of back-end interface 00058 dbe_ = Service<DQMStore>().operator->(); 00059 dbe_->showDirStructure(); 00060 dbe_->setCurrentFolder("MixingV/Mixing"); 00061 }
Reimplemented from edm::EDAnalyzer.
Definition at line 63 of file TestSuite.cc.
References dbe_, filename_, and DQMStore::save().
int TestSuite::bunchcr_ [private] |
DQMStore* TestSuite::dbe_ [private] |
std::string TestSuite::filename_ [private] |
int TestSuite::maxbunch_ [private] |
int TestSuite::minbunch_ [private] |