CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PerfomanceAnalyzer.cc
Go to the documentation of this file.
1 
3 
5 // #include "DataFormats/Common/interface/Handle.h"
7 
9 //#include "DataFormats/Common/interface/ModuleDescription.h"
12 
14 
15 #include <iostream>
17 
19  : fDBE( edm::Service<DQMStore>().operator->() ),
20  fOutputFile( ps.getUntrackedParameter<std::string>("outputFile", "") )
21 {
22  eventTime_Token_ = consumes<edm::EventTime> (
23  edm::InputTag("cputest"));
24 
25  if ( fDBE != NULL )
26  {
27  fDBE->setCurrentFolder("PerformanceV/CPUPerformanceTask");
28 
29  // is there any way to record CPU Info ???
30  // if so, it can be done once - via beginJob()
31 
32  fVtxSmeared = fDBE->book1D( "VtxSmeared", "VtxSmeared", 100, 0., 0.1 ) ;
33  fg4SimHits = fDBE->book1D( "g4SimHits", "g4SimHits", 100, 0., 500. ) ;
34  fMixing = fDBE->book1D( "Mixing", "Mixing", 100, 0., 0.5 ) ;
35  fSiPixelDigis = fDBE->book1D( "SiPixelDigis","SiPixelDigis", 100, 0., 0.5 ) ;
36  fSiStripDigis = fDBE->book1D( "SiStripDigis","SiStripDigis", 100, 0., 2. ) ;
37  fEcalUnsuppDigis = fDBE->book1D( "EcalUnsuppDigis","EcalUnsuppDigis", 100, 0., 2. ) ;
38  fEcalZeroSuppDigis = fDBE->book1D( "EcalZeroSuppDigis","EcalZeroSuppDigis", 100, 0., 2. ) ;
39  fPreShwZeroSuppDigis = fDBE->book1D( "PreShwZeroSuppDigis","PreShwZeroSuppDigis", 100, 0., 0.1 ) ;
40  fHcalUnsuppDigis = fDBE->book1D( "HcalUnsuppDigis","HcalUnsuppDigis", 100, 0., 0.5 ) ;
41  fMuonCSCDigis = fDBE->book1D( "MuonCSCDigis", "MuonCSCDigis", 100, 0., 0.1 ) ;
42  fMuonDTDigis = fDBE->book1D( "MuonDTDigis", "MuonDTDigis", 100, 0., 0.1 ) ;
43  fMuonRPCDigis = fDBE->book1D( "MuonRPCDigis", "MuonRPCDigis", 100, 0., 0.1 ) ;
44  }
45 }
46 
47 
49 {
50  // don't try to delete any pointers - they're handled by DQM machinery
51 }
52 
53 
55 {
56 
57  if ( fOutputFile.size() != 0 && fDBE ) fDBE->save(fOutputFile);
58 
59  return ;
60 
61 }
62 
63 
65 {
66 
67  if ( e.id().event() == 1) return ; // skip 1st event
68 
70  e.getByToken(eventTime_Token_, EvtTime ) ;
71 
72  for ( unsigned int i=0; i<EvtTime->size(); ++i )
73  {
74  if ( EvtTime->name(i) == "VtxSmeared" ) fVtxSmeared->Fill( EvtTime->time(i) ) ;
75  if ( EvtTime->name(i) == "g4SimHits" ) fg4SimHits->Fill( EvtTime->time(i) ) ;
76  if ( EvtTime->name(i) == "mix" ) fMixing->Fill( EvtTime->time(i) ) ;
77  if ( EvtTime->name(i) == "siPixelDigis" ) fSiPixelDigis->Fill( EvtTime->time(i) ) ;
78  if ( EvtTime->name(i) == "siStripDigis" ) fSiStripDigis->Fill( EvtTime->time(i) ) ;
79  if ( EvtTime->name(i) == "ecalUnsuppressedDigis" ) fEcalUnsuppDigis->Fill( EvtTime->time(i) ) ;
80  if ( EvtTime->name(i) == "ecalDigis") fEcalZeroSuppDigis->Fill( EvtTime->time(i) ) ;
81  if ( EvtTime->name(i) == "ecalPreshowerDigis") fPreShwZeroSuppDigis->Fill( EvtTime->time(i) ) ;
82  if ( EvtTime->name(i) == "hcalDigis" ) fHcalUnsuppDigis->Fill( EvtTime->time(i) ) ;
83  if ( EvtTime->name(i) == "muonCSCDigis" ) fMuonCSCDigis->Fill( EvtTime->time(i) ) ;
84  if ( EvtTime->name(i) == "muonDTDigis" ) fMuonDTDigis->Fill( EvtTime->time(i) ) ;
85  if ( EvtTime->name(i) == "muonRPCDigis" ) fMuonRPCDigis->Fill( EvtTime->time(i) ) ;
86 
87  }
88 
89  return ;
90 
91 }
92 
94 
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
#define NULL
Definition: scimark2.h:8
MonitorElement * fHcalUnsuppDigis
void Fill(long long x)
MonitorElement * fMuonRPCDigis
MonitorElement * fEcalUnsuppDigis
MonitorElement * fg4SimHits
edm::EDGetTokenT< edm::EventTime > eventTime_Token_
MonitorElement * fSiStripDigis
MonitorElement * fSiPixelDigis
MonitorElement * fMuonCSCDigis
MonitorElement * fVtxSmeared
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * fEcalZeroSuppDigis
PerformanceAnalyzer(const edm::ParameterSet &)
return(e1-e2)*(e1-e2)+dp *dp
edm::EventID id() const
Definition: EventBase.h:56
MonitorElement * fMuonDTDigis
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2485
MonitorElement * fMixing
MonitorElement * fPreShwZeroSuppDigis
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655