CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Alignment/LaserDQM/plugins/LaserDQM.cc

Go to the documentation of this file.
00001 
00009 #include "Alignment/LaserDQM/plugins/LaserDQM.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h" 
00011 
00012 #include "FWCore/Framework/interface/MakerMacros.h"
00013 #include "FWCore/ServiceRegistry/interface/Service.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 
00016 
00017 
00018 LaserDQM::LaserDQM(edm::ParameterSet const& theConf) 
00019   : theDebugLevel(theConf.getUntrackedParameter<int>("DebugLevel",0)),
00020     theSearchPhiTIB(theConf.getUntrackedParameter<double>("SearchWindowPhiTIB",0.05)),
00021     theSearchPhiTOB(theConf.getUntrackedParameter<double>("SearchWindowPhiTOB",0.05)),
00022     theSearchPhiTEC(theConf.getUntrackedParameter<double>("SearchWindowPhiTEC",0.05)),
00023     theSearchZTIB(theConf.getUntrackedParameter<double>("SearchWindowZTIB",1.0)),
00024     theSearchZTOB(theConf.getUntrackedParameter<double>("SearchWindowZTOB",1.0)),
00025     theDigiProducersList(theConf.getParameter<Parameters>("DigiProducersList")),
00026     theDQMFileName(theConf.getUntrackedParameter<std::string>("DQMFileName","testDQM.root")),
00027     theDaqMonitorBEI()
00028 {
00029   // load the configuration from the ParameterSet  
00030   edm::LogInfo("LaserDQM") << "==========================================================="
00031                            << "\n===                Start configuration                  ==="
00032                            << "\n    theDebugLevel              = " << theDebugLevel
00033                            << "\n    theSearchPhiTIB            = " << theSearchPhiTIB
00034                            << "\n    theSearchPhiTOB            = " << theSearchPhiTOB
00035                            << "\n    theSearchPhiTEC            = " << theSearchPhiTEC
00036                            << "\n    theSearchZTIB              = " << theSearchZTIB
00037                            << "\n    theSearchZTOB              = " << theSearchZTOB
00038                            << "\n    DQM filename               = " << theDQMFileName
00039                            << "\n===========================================================";
00040 
00041 }
00042 
00043 LaserDQM::~LaserDQM() {}
00044 
00045 void LaserDQM::analyze(edm::Event const& theEvent, edm::EventSetup const& theSetup) 
00046 {
00047   // do the Tracker Statistics
00048   trackerStatistics(theEvent, theSetup);
00049 }
00050 
00051 void LaserDQM::beginJob()
00052 {
00053   // get hold of DQM Backend interface
00054   theDaqMonitorBEI = edm::Service<DQMStore>().operator->();
00055       
00056   // initialize the Monitor Elements
00057   initMonitors();
00058 }
00059 
00060 void LaserDQM::endJob(void)
00061 {
00062   theDaqMonitorBEI->save(theDQMFileName.c_str());
00063 }
00064 
00065 void LaserDQM::fillAdcCounts(MonitorElement * theMonitor, 
00066                              edm::DetSet<SiStripDigi>::const_iterator digiRangeIterator,
00067                              edm::DetSet<SiStripDigi>::const_iterator digiRangeIteratorEnd)
00068 {
00069   // get the ROOT object from the MonitorElement
00070   TH1F * theMEHistogram = theMonitor->getTH1F();
00071 
00072   // loop over all the digis in this det
00073   for (; digiRangeIterator != digiRangeIteratorEnd; ++digiRangeIterator) 
00074     {
00075       const SiStripDigi *digi = &*digiRangeIterator;
00076       
00077       if ( theDebugLevel > 4 ) 
00078         { std::cout << " Channel " << digi->channel() << " has " << digi->adc() << " adc counts " << std::endl; }
00079 
00080       // fill the number of adc counts in the histogram
00081       if (digi->channel() < 512)
00082         {
00083           Double_t theBinContent = theMEHistogram->GetBinContent(digi->channel()) + digi->adc();
00084           theMEHistogram->SetBinContent(digi->channel(), theBinContent);
00085         }
00086     }
00087 }
00088 
00089 // define the SEAL module
00090 
00091 DEFINE_FWK_MODULE(LaserDQM);