CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/Validation/Performance/src/PerfomanceAnalyzer.cc

Go to the documentation of this file.
00001 
00002 #include "Validation/Performance/interface/PerformanceAnalyzer.h"
00003 
00004 #include "FWCore/Framework/interface/Event.h"
00005 // #include "DataFormats/Common/interface/Handle.h"
00006 #include "DataFormats/Common/interface/Handle.h"
00007 
00008 #include "DataFormats/HLTReco/interface/ModuleTiming.h"
00009 //#include "DataFormats/Common/interface/ModuleDescription.h"
00010 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00011 #include "FWCore/ServiceRegistry/interface/Service.h"
00012 
00013 #include "FWCore/Framework/interface/MakerMacros.h"
00014 
00015 #include <iostream>
00016 #include "DQMServices/Core/interface/DQMStore.h"
00017 
00018 PerformanceAnalyzer::PerformanceAnalyzer(const edm::ParameterSet& ps)
00019    : fDBE( edm::Service<DQMStore>().operator->() ),
00020      fOutputFile( ps.getUntrackedParameter<std::string>("outputFile", "") )
00021 {
00022    
00023    if ( fDBE != NULL )
00024    {
00025       fDBE->setCurrentFolder("PerformanceV/CPUPerformanceTask");
00026       
00027       // is there any way to record CPU Info ???
00028       // if so, it can be done once - via beginJob() 
00029       
00030       fVtxSmeared   = fDBE->book1D( "VtxSmeared",  "VtxSmeared",   100, 0., 0.1 ) ;
00031       fg4SimHits    = fDBE->book1D( "g4SimHits",   "g4SimHits",    100, 0., 500. ) ;
00032       fMixing       = fDBE->book1D( "Mixing",      "Mixing",       100, 0., 0.5 ) ;
00033       fSiPixelDigis = fDBE->book1D( "SiPixelDigis","SiPixelDigis", 100, 0., 0.5 ) ;
00034       fSiStripDigis = fDBE->book1D( "SiStripDigis","SiStripDigis", 100, 0., 2. ) ;
00035       fEcalUnsuppDigis = fDBE->book1D( "EcalUnsuppDigis","EcalUnsuppDigis", 100, 0., 2. ) ;
00036       fEcalZeroSuppDigis = fDBE->book1D( "EcalZeroSuppDigis","EcalZeroSuppDigis", 100, 0., 2. ) ;
00037       fPreShwZeroSuppDigis = fDBE->book1D( "PreShwZeroSuppDigis","PreShwZeroSuppDigis", 100, 0., 0.1 ) ; 
00038       fHcalUnsuppDigis = fDBE->book1D( "HcalUnsuppDigis","HcalUnsuppDigis", 100, 0., 0.5 ) ;
00039       fMuonCSCDigis = fDBE->book1D( "MuonCSCDigis", "MuonCSCDigis", 100, 0., 0.1 ) ;
00040       fMuonDTDigis  = fDBE->book1D( "MuonDTDigis",  "MuonDTDigis",  100, 0., 0.1 ) ;
00041       fMuonRPCDigis = fDBE->book1D( "MuonRPCDigis", "MuonRPCDigis", 100, 0., 0.1 ) ;
00042    }
00043 }
00044 
00045 
00046 PerformanceAnalyzer::~PerformanceAnalyzer()
00047 {
00048    // don't try to delete any pointers - they're handled by DQM machinery
00049 }
00050 
00051 
00052 void PerformanceAnalyzer::endJob() 
00053 {
00054 
00055   if ( fOutputFile.size() != 0 && fDBE ) fDBE->save(fOutputFile);
00056 
00057   return ;
00058 
00059 }
00060 
00061 
00062 void PerformanceAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& eventSetup)
00063 {
00064 
00065    if ( e.id().event() == 1) return ; // skip 1st event
00066    
00067    edm::Handle<edm::EventTime> EvtTime;
00068    e.getByLabel( "cputest", EvtTime ) ;
00069    
00070    for ( unsigned int i=0; i<EvtTime->size(); ++i )
00071    {
00072       if ( EvtTime->name(i) == "VtxSmeared" )   fVtxSmeared->Fill( EvtTime->time(i) ) ;
00073       if ( EvtTime->name(i) == "g4SimHits"  )   fg4SimHits->Fill( EvtTime->time(i) ) ;
00074       if ( EvtTime->name(i) == "mix" )          fMixing->Fill( EvtTime->time(i) ) ;
00075       if ( EvtTime->name(i) == "siPixelDigis" ) fSiPixelDigis->Fill( EvtTime->time(i) ) ;
00076       if ( EvtTime->name(i) == "siStripDigis" ) fSiStripDigis->Fill( EvtTime->time(i) ) ;
00077       if ( EvtTime->name(i) == "ecalUnsuppressedDigis" ) fEcalUnsuppDigis->Fill( EvtTime->time(i) ) ;
00078       if ( EvtTime->name(i) == "ecalDigis")     fEcalZeroSuppDigis->Fill( EvtTime->time(i) ) ;
00079       if ( EvtTime->name(i) == "ecalPreshowerDigis") fPreShwZeroSuppDigis->Fill( EvtTime->time(i) ) ;
00080       if ( EvtTime->name(i) == "hcalDigis" )    fHcalUnsuppDigis->Fill( EvtTime->time(i) ) ;
00081       if ( EvtTime->name(i) == "muonCSCDigis" ) fMuonCSCDigis->Fill( EvtTime->time(i) ) ;
00082       if ( EvtTime->name(i) == "muonDTDigis" )  fMuonDTDigis->Fill( EvtTime->time(i) ) ;
00083       if ( EvtTime->name(i) == "muonRPCDigis" ) fMuonRPCDigis->Fill( EvtTime->time(i) ) ;
00084       
00085    }
00086       
00087    return ;
00088    
00089 }
00090 
00091 DEFINE_FWK_MODULE(PerformanceAnalyzer);
00092