CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCWireDigiValidation Class Reference

#include <CSCWireDigiValidation.h>

Inheritance diagram for CSCWireDigiValidation:
CSCBaseValidation

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &)
 
 CSCWireDigiValidation (const edm::InputTag &inputTag, edm::ConsumesCollector &&iC, bool doSim)
 
void plotResolution (const PSimHit &hit, const CSCWireDigi &digi, const CSCLayer *layer, int chamberType)
 
 ~CSCWireDigiValidation () override
 
- Public Member Functions inherited from CSCBaseValidation
 CSCBaseValidation (const edm::InputTag &inputTag)
 
void setGeometry (const CSCGeometry *geom)
 
void setSimHitMap (const PSimHitMap *simHitMap)
 
virtual ~CSCBaseValidation ()
 

Private Attributes

bool doSim_
 
MonitorElementtheNDigisPerEventPlot
 
MonitorElementtheNDigisPerLayerPlots [10]
 
MonitorElementtheResolutionPlots [10]
 
MonitorElementtheTimeBinPlots [10]
 
edm::EDGetTokenT< CSCWireDigiCollectionwires_Token_
 

Additional Inherited Members

- Protected Member Functions inherited from CSCBaseValidation
const CSCLayerfindLayer (int detId) const
 
- Protected Attributes inherited from CSCBaseValidation
const CSCGeometrytheCSCGeometry
 
edm::InputTag theInputTag
 
const PSimHitMaptheSimHitMap
 

Detailed Description

Definition at line 12 of file CSCWireDigiValidation.h.

Constructor & Destructor Documentation

CSCWireDigiValidation::CSCWireDigiValidation ( const edm::InputTag inputTag,
edm::ConsumesCollector &&  iC,
bool  doSim 
)

Definition at line 9 of file CSCWireDigiValidation.cc.

References HiClusterCompatibility_cfi::inputTag, and wires_Token_.

11  :
12  CSCBaseValidation(inputTag),
13  doSim_(doSim),
16 {
18 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
CSCBaseValidation(const edm::InputTag &inputTag)
edm::EDGetTokenT< CSCWireDigiCollection > wires_Token_
MonitorElement * theNDigisPerLayerPlots[10]
MonitorElement * theTimeBinPlots[10]
CSCWireDigiValidation::~CSCWireDigiValidation ( )
override

Definition at line 20 of file CSCWireDigiValidation.cc.

21 {
22 }

Member Function Documentation

void CSCWireDigiValidation::analyze ( const edm::Event e,
const edm::EventSetup  
)
overridevirtual

Implements CSCBaseValidation.

Definition at line 39 of file CSCWireDigiValidation.cc.

References CSCLayer::chamber(), CSCChamberSpecs::chamberType(), doSim_, edm::InputTag::encode(), MonitorElement::Fill(), CSCBaseValidation::findLayer(), edm::Event::getByToken(), PSimHitMap::hits(), edm::HandleBase::isValid(), plotResolution(), trackerHits::simHits, CSCChamber::specs(), CSCBaseValidation::theInputTag, theNDigisPerEventPlot, theNDigisPerLayerPlots, CSCBaseValidation::theSimHitMap, theTimeBinPlots, muonCSCDigis_cfi::wires, and wires_Token_.

Referenced by CSCDigiValidation::analyze().

40 {
42 
43  e.getByToken(wires_Token_, wires);
44 
45  if (!wires.isValid()) {
46  edm::LogError("CSCDigiDump") << "Cannot get wires by label " << theInputTag.encode();
47  }
48 
49  unsigned nDigisPerEvent = 0;
50 
51  for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
52  std::vector<CSCWireDigi>::const_iterator beginDigi = (*j).second.first;
53  std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
54  int detId = (*j).first.rawId();
55 
56  const CSCLayer * layer = findLayer(detId);
57  int chamberType = layer->chamber()->specs()->chamberType();
58  int nDigis = endDigi-beginDigi;
59  nDigisPerEvent += nDigis;
60  theNDigisPerLayerPlots[chamberType-1]->Fill(nDigis);
61 
62  for( std::vector<CSCWireDigi>::const_iterator digiItr = beginDigi;
63  digiItr != endDigi; ++digiItr)
64  {
65  theTimeBinPlots[chamberType-1]->Fill(digiItr->getTimeBin());
66  }
67 
68  if(doSim_)
69  {
71  if(nDigis == 1 && simHits.size() == 1)
72  {
73  plotResolution(simHits[0], *beginDigi, layer, chamberType);
74  }
75  }
76  }
77 
78  theNDigisPerEventPlot->Fill(nDigisPerEvent);
79 }
edm::InputTag theInputTag
MonitorElement * theNDigisPerEventPlot
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::string encode() const
Definition: InputTag.cc:166
void Fill(long long x)
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
const PSimHitMap * theSimHitMap
edm::EDGetTokenT< CSCWireDigiCollection > wires_Token_
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:22
MonitorElement * theNDigisPerLayerPlots[10]
bool isValid() const
Definition: HandleBase.h:74
void plotResolution(const PSimHit &hit, const CSCWireDigi &digi, const CSCLayer *layer, int chamberType)
MonitorElement * theTimeBinPlots[10]
int chamberType() const
std::vector< PSimHit > PSimHitContainer
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const CSCLayer * findLayer(int detId) const
void CSCWireDigiValidation::bookHistograms ( DQMStore::IBooker iBooker)

Definition at line 24 of file CSCWireDigiValidation.cc.

References DQMStore::IBooker::book1D(), mps_fire::i, theNDigisPerEventPlot, theNDigisPerLayerPlots, theResolutionPlots, and theTimeBinPlots.

Referenced by CSCDigiValidation::bookHistograms().

25 {
26  theNDigisPerEventPlot = iBooker.book1D("CSCWireDigisPerEvent", "CSC Wire Digis per event", 100, 0, 100);
27  for(int i = 0; i < 10; ++i)
28  {
29  char title1[200], title2[200], title3[200];
30  sprintf(title1, "CSCWireDigiTimeType%d", i+1);
31  sprintf(title2, "CSCWireDigisPerLayerType%d", i+1);
32  sprintf(title3, "CSCWireDigiResolution%d", i+1);
33  theTimeBinPlots[i] = iBooker.book1D(title1, title1, 9, 0, 8);
34  theNDigisPerLayerPlots[i] = iBooker.book1D(title2, title2, 100, 0, 20);
35  theResolutionPlots[i] = iBooker.book1D(title3, title3, 100, -10, 10);
36  }
37 }
MonitorElement * theNDigisPerEventPlot
MonitorElement * theResolutionPlots[10]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * theNDigisPerLayerPlots[10]
MonitorElement * theTimeBinPlots[10]
void CSCWireDigiValidation::plotResolution ( const PSimHit hit,
const CSCWireDigi digi,
const CSCLayer layer,
int  chamberType 
)

Definition at line 82 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().

86 {
87  double hitX = hit.localPosition().x();
88  double hitY = hit.localPosition().y();
89  double digiY = layer->geometry()->yOfWireGroup(digi.getWireGroup(), hitX);
90  theResolutionPlots[chamberType-1]->Fill(digiY - hitY);
91 }
MonitorElement * theResolutionPlots[10]
T y() const
Definition: PV3DBase.h:63
float yOfWireGroup(int wireGroup, float x=0.) const
void Fill(long long x)
Local3DPoint localPosition() const
Definition: PSimHit.h:44
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
T x() const
Definition: PV3DBase.h:62
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47

Member Data Documentation

bool CSCWireDigiValidation::doSim_
private

Definition at line 26 of file CSCWireDigiValidation.h.

Referenced by analyze().

MonitorElement* CSCWireDigiValidation::theNDigisPerEventPlot
private

Definition at line 30 of file CSCWireDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCWireDigiValidation::theNDigisPerLayerPlots[10]
private

Definition at line 28 of file CSCWireDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* CSCWireDigiValidation::theResolutionPlots[10]
private

Definition at line 29 of file CSCWireDigiValidation.h.

Referenced by bookHistograms(), and plotResolution().

MonitorElement* CSCWireDigiValidation::theTimeBinPlots[10]
private

Definition at line 27 of file CSCWireDigiValidation.h.

Referenced by analyze(), and bookHistograms().

edm::EDGetTokenT<CSCWireDigiCollection> CSCWireDigiValidation::wires_Token_
private

Definition at line 25 of file CSCWireDigiValidation.h.

Referenced by analyze(), and CSCWireDigiValidation().