CMS 3D CMS Logo

PerfomanceAnalyzer.cc
Go to the documentation of this file.
1 
3 
6 
10 
12 
13 #include <iostream>
15 
17  : fOutputFile( ps.getUntrackedParameter<std::string>("outputFile", "") )
18 {
19  eventTime_Token_ = consumes<edm::EventTime> (edm::InputTag("cputest"));
20 }
21 
23 {
24  // don't try to delete any pointers - they're handled by DQM machinery
25 }
26 
27 void PerformanceAnalyzer::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const & iRun, edm::EventSetup const & /* iSetup */)
28 {
29  iBooker.setCurrentFolder("PerformanceV/CPUPerformanceTask");
30 
31  fVtxSmeared = iBooker.book1D("VtxSmeared", "VtxSmeared", 100, 0., 0.1 );
32  fg4SimHits = iBooker.book1D("g4SimHits", "g4SimHits", 100, 0., 500.);
33  fMixing = iBooker.book1D("Mixing", "Mixing", 100, 0., 0.5 );
34  fSiPixelDigis = iBooker.book1D("SiPixelDigis", "SiPixelDigis", 100, 0., 0.5 );
35  fSiStripDigis = iBooker.book1D("SiStripDigis", "SiStripDigis", 100, 0., 2. );
36  fEcalUnsuppDigis = iBooker.book1D("EcalUnsuppDigis", "EcalUnsuppDigis", 100, 0., 2. );
37  fEcalZeroSuppDigis = iBooker.book1D("EcalZeroSuppDigis", "EcalZeroSuppDigis", 100, 0., 2. );
38  fPreShwZeroSuppDigis = iBooker.book1D("PreShwZeroSuppDigis", "PreShwZeroSuppDigis", 100, 0., 0.1 );
39  fHcalUnsuppDigis = iBooker.book1D("HcalUnsuppDigis", "HcalUnsuppDigis", 100, 0., 0.5 );
40  fMuonCSCDigis = iBooker.book1D("MuonCSCDigis", "MuonCSCDigis", 100, 0., 0.1 );
41  fMuonDTDigis = iBooker.book1D("MuonDTDigis", "MuonDTDigis", 100, 0., 0.1 );
42  fMuonRPCDigis = iBooker.book1D("MuonRPCDigis", "MuonRPCDigis", 100, 0., 0.1 );
43 }
44 
46 {
47  if ( e.id().event() == 1) return ; // skip 1st event
48 
50  e.getByToken(eventTime_Token_, EvtTime ) ;
51 
52  for ( unsigned int i=0; i<EvtTime->size(); ++i )
53  {
54  if ( EvtTime->name(i) == "VtxSmeared" ) fVtxSmeared->Fill( EvtTime->time(i) ) ;
55  if ( EvtTime->name(i) == "g4SimHits" ) fg4SimHits->Fill( EvtTime->time(i) ) ;
56  if ( EvtTime->name(i) == "mix" ) fMixing->Fill( EvtTime->time(i) ) ;
57  if ( EvtTime->name(i) == "siPixelDigis" ) fSiPixelDigis->Fill( EvtTime->time(i) ) ;
58  if ( EvtTime->name(i) == "siStripDigis" ) fSiStripDigis->Fill( EvtTime->time(i) ) ;
59  if ( EvtTime->name(i) == "ecalUnsuppressedDigis" ) fEcalUnsuppDigis->Fill( EvtTime->time(i) ) ;
60  if ( EvtTime->name(i) == "ecalDigis") fEcalZeroSuppDigis->Fill( EvtTime->time(i) ) ;
61  if ( EvtTime->name(i) == "ecalPreshowerDigis") fPreShwZeroSuppDigis->Fill( EvtTime->time(i) ) ;
62  if ( EvtTime->name(i) == "hcalDigis" ) fHcalUnsuppDigis->Fill( EvtTime->time(i) ) ;
63  if ( EvtTime->name(i) == "muonCSCDigis" ) fMuonCSCDigis->Fill( EvtTime->time(i) ) ;
64  if ( EvtTime->name(i) == "muonDTDigis" ) fMuonDTDigis->Fill( EvtTime->time(i) ) ;
65  if ( EvtTime->name(i) == "muonRPCDigis" ) fMuonRPCDigis->Fill( EvtTime->time(i) ) ;
66  }
67  return ;
68 }
69 
EventNumber_t event() const
Definition: EventID.h:41
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
unsigned size() const
Definition: ModuleTiming.h:39
MonitorElement * fHcalUnsuppDigis
double time(unsigned i) const
Definition: ModuleTiming.h:53
void Fill(long long x)
MonitorElement * fMuonRPCDigis
MonitorElement * fEcalUnsuppDigis
MonitorElement * fg4SimHits
edm::EDGetTokenT< edm::EventTime > eventTime_Token_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * fSiStripDigis
MonitorElement * fSiPixelDigis
MonitorElement * fMuonCSCDigis
MonitorElement * fVtxSmeared
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * fEcalZeroSuppDigis
PerformanceAnalyzer(const edm::ParameterSet &)
return(e1-e2)*(e1-e2)+dp *dp
edm::EventID id() const
Definition: EventBase.h:60
MonitorElement * fMuonDTDigis
std::string name(unsigned i) const
Definition: ModuleTiming.h:48
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * fMixing
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * fPreShwZeroSuppDigis
Definition: Run.h:42