CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Validation/MuonCSCDigis/src/CSCCLCTDigiValidation.cc

Go to the documentation of this file.
00001 #include "Validation/MuonCSCDigis/src/CSCCLCTDigiValidation.h"
00002 #include "DataFormats/Common/interface/Handle.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.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 CSCCLCTDigiValidation::CSCCLCTDigiValidation(DQMStore* dbe, const edm::InputTag & inputTag)
00013 : CSCBaseValidation(dbe, inputTag),
00014   theTimeBinPlots(),
00015   theNDigisPerLayerPlots(),
00016   theNDigisPerEventPlot( dbe_->book1D("CSCCLCTDigisPerEvent", "CSC CLCT 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, "CSCCLCTDigiTimeType%d", i+1);
00022     sprintf(title2, "CSCCLCTDigisPerLayerType%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 CSCCLCTDigiValidation::~CSCCLCTDigiValidation()
00031 {
00032 
00033 //   for(int i = 0; i < 10; ++i)
00034 //   {
00035 //     edm::LogInfo("CSCDigiValidation") << "Mean of " << theTimeBinPlots[i]->getName() 
00036 //       << " is " << theTimeBinPlots[i]->getMean() 
00037 //       << " +/- " << theTimeBinPlots[i]->getRMS();
00038 //   }
00039 
00040 }
00041 
00042 
00043 void CSCCLCTDigiValidation::analyze(const edm::Event&e, const edm::EventSetup&)
00044 {
00045   edm::Handle<CSCCLCTDigiCollection> clcts;
00046 
00047   e.getByLabel(theInputTag, clcts);
00048   if (!clcts.isValid()) {
00049     edm::LogError("CSCDigiDump") << "Cannot get clcts by label " << theInputTag.encode();
00050   }
00051 
00052   unsigned nDigisPerEvent = 0;
00053 
00054   for (CSCCLCTDigiCollection::DigiRangeIterator j=clcts->begin(); j!=clcts->end(); j++) {
00055     std::vector<CSCCLCTDigi>::const_iterator beginDigi = (*j).second.first;
00056     std::vector<CSCCLCTDigi>::const_iterator endDigi = (*j).second.second;
00057     CSCDetId detId((*j).first.rawId());
00058     int chamberType = detId.iChamberType();
00059  
00060     int nDigis = endDigi-beginDigi;
00061     nDigisPerEvent += nDigis;
00062     theNDigisPerLayerPlots[chamberType-1]->Fill(nDigis);
00063 
00064     for( std::vector<CSCCLCTDigi>::const_iterator digiItr = beginDigi;
00065          digiItr != endDigi; ++digiItr) 
00066     {
00067       theTimeBinPlots[chamberType-1]->Fill(digiItr->getBX());
00068     }
00069 
00070   }
00071 }