#include <Validation/Mixing/interface/GlobalTest.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
void | beginJob (edm::EventSetup const &iSetup) |
void | endJob () |
GlobalTest (const edm::ParameterSet &) | |
~GlobalTest () | |
Private Attributes | |
MonitorElement * | caloEnergyEBH_ [nMaxH] |
MonitorElement * | caloEnergyEEH_ [nMaxH] |
DQMStore * | dbe_ |
std::string | filename_ |
TFile * | histfile_ |
int | maxbunch_ |
int | minbunch_ |
MonitorElement * | nrPileupsH_ [nMaxH] |
MonitorElement * | nrTracksH_ [nMaxH] |
MonitorElement * | nrVerticesH_ [nMaxH] |
MonitorElement * | trackPartIdH_ [nMaxH] |
Static Private Attributes | |
static const int | nMaxH = 10 |
Definition at line 38 of file GlobalTest.h.
GlobalTest::GlobalTest | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 45 of file GlobalTest.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), filename_, maxbunch_, and minbunch_.
00045 : filename_(iConfig.getParameter<std::string>("fileName")), minbunch_(iConfig.getParameter<int>("minBunch")),maxbunch_(iConfig.getParameter<int>("maxBunch")), dbe_(0) 00046 { 00047 std::cout << "Constructed GlobalTest, filename: "<<filename_<<" minbunch: "<<minbunch_<<", maxbunch: "<<maxbunch_<<std::endl; 00048 00049 }
GlobalTest::~GlobalTest | ( | ) |
Definition at line 51 of file GlobalTest.cc.
00052 { 00053 00054 // do anything here that needs to be done at desctruction time 00055 // (e.g. close files, deallocate resources etc.) 00056 }
void GlobalTest::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 105 of file GlobalTest.cc.
References MixCollection< T >::begin(), caloEnergyEBH_, caloEnergyEEH_, MixCollection< T >::end(), MonitorElement::Fill(), edm::Event::getByLabel(), edm::Event::getByType(), i, maxbunch_, minbunch_, nrTracksH_, nrVerticesH_, edm::Handle< T >::product(), and trackPartIdH_.
00106 { 00107 using namespace edm; 00108 00109 // Get input 00110 edm::Handle<CrossingFrame<SimTrack> > cf_track; 00111 edm::Handle<CrossingFrame<SimTrack> > cf_vertex; 00112 edm::Handle<CrossingFrame<PCaloHit> > cf_calohitE; 00113 edm::Handle<CrossingFrame<PCaloHit> > cf_calohitB; 00114 std::string ecalsubdetb("EcalHitsEB"); 00115 std::string ecalsubdete("EcalHitsEE"); 00116 iEvent.getByType(cf_track); 00117 iEvent.getByType(cf_vertex); 00118 iEvent.getByLabel("mix",ecalsubdetb,cf_calohitB); 00119 iEvent.getByLabel("mix",ecalsubdete,cf_calohitE); 00120 00121 // number of events/bcr ?? 00122 00123 // number of tracks 00124 for (int i=minbunch_;i<=maxbunch_;++i) { 00125 nrTracksH_[i-minbunch_]->Fill(cf_track->getNrPileups(i)); 00126 } 00127 00128 // number of vertices 00129 for (int i=minbunch_;i<=maxbunch_;++i) { 00130 nrVerticesH_[i-minbunch_]->Fill(cf_vertex->getNrPileups(i)); 00131 } 00132 00133 // part id for each track 00134 std::auto_ptr<MixCollection<SimTrack> > coltr(new MixCollection<SimTrack>(cf_track.product())); 00135 MixCollection<SimTrack>::iterator cfitr; 00136 for (cfitr=coltr->begin(); cfitr!=coltr->end();cfitr++) { 00137 trackPartIdH_[cfitr.bunch()-minbunch_]->Fill(cfitr->type()); 00138 } 00139 00140 // energy sum 00141 double sumE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; 00142 std::auto_ptr<MixCollection<PCaloHit> > colecalb(new MixCollection<PCaloHit>(cf_calohitB.product())); 00143 MixCollection<PCaloHit>::iterator cfiecalb; 00144 for (cfiecalb=colecalb->begin(); cfiecalb!=colecalb->end();cfiecalb++) { 00145 sumE[cfiecalb.bunch()-minbunch_]+=cfiecalb->energy(); 00146 // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time()); 00147 // else tofecalhist->Fill(cfiecal->time()); 00148 } 00149 for (int i=minbunch_;i<=maxbunch_;++i) { 00150 caloEnergyEBH_[i-minbunch_]->Fill(sumE[i-minbunch_]); 00151 } 00152 double sumEE[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; 00153 std::auto_ptr<MixCollection<PCaloHit> > colecale(new MixCollection<PCaloHit>(cf_calohitE.product())); 00154 MixCollection<PCaloHit>::iterator cfiecale; 00155 for (cfiecale=colecale->begin(); cfiecale!=colecale->end();cfiecale++) { 00156 sumEE[cfiecale.bunch()-minbunch_]+=cfiecale->energy(); 00157 // if (cfiecal.getTrigger()) tofecalhist_sig->Fill(cfiecal->time()); 00158 // else tofecalhist->Fill(cfiecal->time()); 00159 } 00160 for (int i=minbunch_;i<=maxbunch_;++i) { 00161 caloEnergyEEH_[i-minbunch_]->Fill(sumEE[i-minbunch_]); 00162 } 00163 }
void GlobalTest::beginJob | ( | edm::EventSetup const & | iSetup | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 58 of file GlobalTest.cc.
References DQMStore::book1D(), caloEnergyEBH_, caloEnergyEEH_, dbe_, i, label, hlt_scaler_cfg::labels, maxbunch_, minbunch_, nrPileupsH_, nrTracksH_, nrVerticesH_, DQMStore::setCurrentFolder(), DQMStore::showDirStructure(), and trackPartIdH_.
00058 { 00059 00060 // get hold of back-end interface 00061 dbe_ = Service<DQMStore>().operator->(); 00062 dbe_->showDirStructure(); 00063 dbe_->setCurrentFolder("MixingV/Mixing"); 00064 //book histos 00065 const int nrHistos=6; 00066 char * labels[nrHistos]; 00067 labels[0]="NrPileupEvts"; 00068 labels[1]="NrVertices"; 00069 labels[2]="NrTracks"; 00070 labels[3]="TrackPartId"; 00071 labels[4]="CaloEnergyEB"; 00072 labels[5]="CaloEnergyEE"; 00073 00075 //FIXME: test for max nr of histos 00076 for (int i=minbunch_;i<=maxbunch_;++i) { 00077 int ii=i-minbunch_; 00078 char label[50]; 00079 sprintf(label,"%s_%d",labels[0],i); 00080 nrPileupsH_[ii] = dbe_->book1D(label,label,100,0,100); 00081 sprintf(label,"%s_%d",labels[1],i); 00082 nrVerticesH_[ii] = dbe_->book1D(label,label,100,0,5000); 00083 sprintf(label,"%s_%d",labels[2],i); 00084 nrTracksH_[ii] = dbe_->book1D(label,label,100,0,10000); 00085 sprintf(label,"%s_%d",labels[3],i); 00086 trackPartIdH_[ii] = dbe_->book1D(label,label,100,0,100); 00087 sprintf(label,"%s_%d",labels[4],i); 00088 caloEnergyEBH_ [ii] = dbe_->book1D(label,label,100,0.,1000.); 00089 sprintf(label,"%s_%d",labels[5],i); 00090 caloEnergyEEH_ [ii] = dbe_->book1D(label,label,100,0.,1000.); 00091 } 00092 }
Reimplemented from edm::EDAnalyzer.
Definition at line 95 of file GlobalTest.cc.
References dbe_, filename_, and DQMStore::save().
MonitorElement* GlobalTest::caloEnergyEBH_[nMaxH] [private] |
MonitorElement* GlobalTest::caloEnergyEEH_[nMaxH] [private] |
DQMStore* GlobalTest::dbe_ [private] |
std::string GlobalTest::filename_ [private] |
TFile* GlobalTest::histfile_ [private] |
Definition at line 52 of file GlobalTest.h.
int GlobalTest::maxbunch_ [private] |
int GlobalTest::minbunch_ [private] |
const int GlobalTest::nMaxH = 10 [static, private] |
Definition at line 54 of file GlobalTest.h.
MonitorElement* GlobalTest::nrPileupsH_[nMaxH] [private] |
MonitorElement* GlobalTest::nrTracksH_[nMaxH] [private] |
MonitorElement* GlobalTest::nrVerticesH_[nMaxH] [private] |
MonitorElement* GlobalTest::trackPartIdH_[nMaxH] [private] |