CMS 3D CMS Logo

CSCWireDigiValidation Class Reference

#include <Validation/MuonCSCDigis/src/CSCWireDigiValidation.h>

Inheritance diagram for CSCWireDigiValidation:

CSCBaseValidation

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
void beginJob (const edm::EventSetup &)
 CSCWireDigiValidation (DQMStore *dbe, const edm::InputTag &inputTag, bool doSim)
void endJob ()
void plotResolution (const PSimHit &hit, const CSCWireDigi &digi, const CSCLayer *layer, int chamberType)
 ~CSCWireDigiValidation ()

Private Attributes

bool theDoSimFlag
MonitorElementtheNDigisPerEventPlot
MonitorElementtheNDigisPerLayerPlots [10]
MonitorElementtheResolutionPlots [10]
MonitorElementtheTimeBinPlots [10]


Detailed Description

Definition at line 9 of file CSCWireDigiValidation.h.


Constructor & Destructor Documentation

CSCWireDigiValidation::CSCWireDigiValidation ( DQMStore dbe,
const edm::InputTag inputTag,
bool  doSim 
)

Definition at line 12 of file CSCWireDigiValidation.cc.

References DQMStore::book1D(), CSCBaseValidation::dbe_, i, theNDigisPerLayerPlots, theResolutionPlots, and theTimeBinPlots.

00013 : CSCBaseValidation(dbe, inputTag),
00014   theDoSimFlag(doSim),
00015   theTimeBinPlots(),
00016   theNDigisPerLayerPlots(),
00017   theNDigisPerEventPlot( dbe_->book1D("CSCWireDigisPerEvent", "CSC Wire Digis per event", 100, 0, 100) )
00018 {
00019   for(int i = 0; i < 10; ++i)
00020   {
00021     char title1[200], title2[200], title3[200];
00022     sprintf(title1, "CSCWireDigiTimeType%d", i+1);
00023     sprintf(title2, "CSCWireDigisPerLayerType%d", i+1);
00024     sprintf(title3, "CSCWireDigiResolution%d", i+1);
00025     theTimeBinPlots[i] = dbe_->book1D(title1, title1, 9, 0, 8);
00026     theNDigisPerLayerPlots[i] = dbe_->book1D(title2, title2, 100, 0, 20);
00027     theResolutionPlots[i] = dbe_->book1D(title3, title3, 100, -10, 10);
00028   }
00029 }

CSCWireDigiValidation::~CSCWireDigiValidation (  ) 

Definition at line 33 of file CSCWireDigiValidation.cc.

00034 {
00035   /*
00036   for(int i = 0; i < 10; ++i)
00037   {
00038     std::cout << "Mean of " << theTimeBinPlots[i]->getName() 
00039       << " is " << theTimeBinPlots[i]->getMean() 
00040       << " +/- " << theTimeBinPlots[i]->getRMS() << std::endl;
00041     std::cout << "RMS of " << theResolutionPlots[i]->getName() 
00042       << " is " << theResolutionPlots[i]->getRMS() << std::endl;
00043   }
00044   */
00045 }


Member Function Documentation

void CSCWireDigiValidation::analyze ( const edm::Event e,
const edm::EventSetup  
) [virtual]

Implements CSCBaseValidation.

Definition at line 48 of file CSCWireDigiValidation.cc.

References CSCLayer::chamber(), CSCChamberSpecs::chamberType(), detId, edm::InputTag::encode(), MonitorElement::Fill(), CSCBaseValidation::findLayer(), edm::Event::getByLabel(), PSimHitMap::hits(), edm::Handle< T >::isValid(), j, plotResolution(), DetId::rawId(), trackerHits::simHits, CSCChamber::specs(), theDoSimFlag, CSCBaseValidation::theInputTag, theNDigisPerEventPlot, theNDigisPerLayerPlots, CSCBaseValidation::theSimHitMap, and theTimeBinPlots.

Referenced by CSCDigiValidation::analyze().

00049 {
00050   edm::Handle<CSCWireDigiCollection> wires;
00051 
00052   e.getByLabel(theInputTag, wires);
00053   if (!wires.isValid()) {
00054     edm::LogError("CSCDigiDump") << "Cannot get wires by label " << theInputTag.encode();
00055   }
00056 
00057   unsigned nDigisPerEvent = 0;
00058 
00059   for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
00060     std::vector<CSCWireDigi>::const_iterator beginDigi = (*j).second.first;
00061     std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
00062     int detId = (*j).first.rawId();
00063     
00064     const CSCLayer * layer = findLayer(detId);
00065     int chamberType = layer->chamber()->specs()->chamberType();
00066     int nDigis = endDigi-beginDigi;
00067     nDigisPerEvent += nDigis;
00068     theNDigisPerLayerPlots[chamberType-1]->Fill(nDigis);
00069 
00070     for( std::vector<CSCWireDigi>::const_iterator digiItr = beginDigi;
00071          digiItr != endDigi; ++digiItr) 
00072     {
00073       theTimeBinPlots[chamberType-1]->Fill(digiItr->getTimeBin());
00074     }
00075 
00076     if(theDoSimFlag) 
00077     {
00078       const edm::PSimHitContainer simHits = theSimHitMap->hits(detId);
00079       if(nDigis == 1 && simHits.size() == 1)
00080       {
00081         plotResolution(simHits[0], *beginDigi, layer, chamberType);
00082       }
00083     }
00084   }
00085 
00086   theNDigisPerEventPlot->Fill(nDigisPerEvent);
00087 }

void CSCWireDigiValidation::beginJob ( const edm::EventSetup  )  [inline]

Definition at line 17 of file CSCWireDigiValidation.h.

00017 {}

void CSCWireDigiValidation::endJob ( void   )  [inline]

Definition at line 18 of file CSCWireDigiValidation.h.

00018 {}

void CSCWireDigiValidation::plotResolution ( const PSimHit hit,
const CSCWireDigi digi,
const CSCLayer layer,
int  chamberType 
)

Definition at line 90 of file CSCWireDigiValidation.cc.

References MonitorElement::Fill(), CSCLayer::geometry(), CSCWireDigi::getWireGroup(), PSimHit::localPosition(), theResolutionPlots, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and CSCLayerGeometry::yOfWireGroup().

Referenced by analyze().

00094 {
00095   double hitX = hit.localPosition().x();
00096   double hitY = hit.localPosition().y();
00097   double digiY = layer->geometry()->yOfWireGroup(digi.getWireGroup(), hitX);
00098   theResolutionPlots[chamberType-1]->Fill(digiY - hitY);
00099 }


Member Data Documentation

bool CSCWireDigiValidation::theDoSimFlag [private]

Definition at line 24 of file CSCWireDigiValidation.h.

Referenced by analyze().

MonitorElement* CSCWireDigiValidation::theNDigisPerEventPlot [private]

Definition at line 28 of file CSCWireDigiValidation.h.

Referenced by analyze().

MonitorElement* CSCWireDigiValidation::theNDigisPerLayerPlots[10] [private]

Definition at line 26 of file CSCWireDigiValidation.h.

Referenced by analyze(), and CSCWireDigiValidation().

MonitorElement* CSCWireDigiValidation::theResolutionPlots[10] [private]

Definition at line 27 of file CSCWireDigiValidation.h.

Referenced by CSCWireDigiValidation(), and plotResolution().

MonitorElement* CSCWireDigiValidation::theTimeBinPlots[10] [private]

Definition at line 25 of file CSCWireDigiValidation.h.

Referenced by analyze(), and CSCWireDigiValidation().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:33 2009 for CMSSW by  doxygen 1.5.4