CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/Validation/MuonCSCDigis/src/CSCALCTDigiValidation.cc

Go to the documentation of this file.
00001 #include "Validation/MuonCSCDigis/src/CSCALCTDigiValidation.h"
00002 #include "DataFormats/Common/interface/Handle.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
00005 
00006 #include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h"
00007 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00008 #include "DQMServices/Core/interface/DQMStore.h"
00009 
00010 
00011 
00012 CSCALCTDigiValidation::CSCALCTDigiValidation(DQMStore* dbe, const edm::InputTag & inputTag)
00013 : CSCBaseValidation(dbe, inputTag),
00014   theTimeBinPlots(),
00015   theNDigisPerLayerPlots(),
00016   theNDigisPerEventPlot( dbe_->book1D("CSCALCTDigisPerEvent", "CSC ALCT Digis per event", 100, 0, 100) )
00017 {
00018   for(int i = 0; i < 10; ++i)
00019   {
00020     char title1[200], title2[200];
00021     sprintf(title1, "CSCALCTDigiTimeType%d", i+1);
00022     sprintf(title2, "CSCALCTDigisPerLayerType%d", i+1);
00023     theTimeBinPlots[i] = dbe_->book1D(title1, title1, 20, 0, 20);
00024     theNDigisPerLayerPlots[i] = dbe_->book1D(title2, title2, 100, 0, 20);
00025   }
00026 }
00027 
00028 
00029 
00030 CSCALCTDigiValidation::~CSCALCTDigiValidation()
00031 {
00032 //   for(int i = 0; i < 10; ++i)
00033 //   {
00034 //     edm::LogInfo("CSCDigiValidation") << "Mean of " << theTimeBinPlots[i]->getName() 
00035 //       << " is " << theTimeBinPlots[i]->getMean() 
00036 //       << " +/- " << theTimeBinPlots[i]->getRMS();
00037 //   }
00038 }
00039 
00040 
00041 void CSCALCTDigiValidation::analyze(const edm::Event&e, const edm::EventSetup&)
00042 {
00043   edm::Handle<CSCALCTDigiCollection> alcts;
00044 
00045   e.getByLabel(theInputTag, alcts);
00046   if (!alcts.isValid()) {
00047     edm::LogError("CSCDigiDump") << "Cannot get alcts by label " << theInputTag.encode();
00048   }
00049   unsigned nDigisPerEvent = 0;
00050 
00051   for (CSCALCTDigiCollection::DigiRangeIterator j=alcts->begin(); j!=alcts->end(); j++) {
00052     std::vector<CSCALCTDigi>::const_iterator beginDigi = (*j).second.first;
00053     std::vector<CSCALCTDigi>::const_iterator endDigi = (*j).second.second;
00054     CSCDetId detId((*j).first.rawId());
00055     int chamberType = detId.iChamberType();
00056     int nDigis = endDigi-beginDigi;
00057     nDigisPerEvent += nDigis;
00058     theNDigisPerLayerPlots[chamberType-1]->Fill(nDigis);
00059 
00060     for( std::vector<CSCALCTDigi>::const_iterator digiItr = beginDigi;
00061          digiItr != endDigi; ++digiItr) 
00062     {
00063       theTimeBinPlots[chamberType-1]->Fill(digiItr->getBX());
00064     }
00065   }
00066 }