CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCWireDigiValidation.cc
Go to the documentation of this file.
4 
8 
9 
10 
12  const edm::InputTag & inputTag,
14  bool doSim)
15 : CSCBaseValidation(dbe, inputTag),
16  theDoSimFlag(doSim),
17  theTimeBinPlots(),
18  theNDigisPerLayerPlots(),
19  theNDigisPerEventPlot( dbe_->book1D("CSCWireDigisPerEvent", "CSC Wire Digis per event", 100, 0, 100) )
20 {
21  wires_Token_ = iC.consumes<CSCWireDigiCollection>(inputTag);
22 
23  for(int i = 0; i < 10; ++i)
24  {
25  char title1[200], title2[200], title3[200];
26  sprintf(title1, "CSCWireDigiTimeType%d", i+1);
27  sprintf(title2, "CSCWireDigisPerLayerType%d", i+1);
28  sprintf(title3, "CSCWireDigiResolution%d", i+1);
29  theTimeBinPlots[i] = dbe_->book1D(title1, title1, 9, 0, 8);
30  theNDigisPerLayerPlots[i] = dbe_->book1D(title2, title2, 100, 0, 20);
31  theResolutionPlots[i] = dbe_->book1D(title3, title3, 100, -10, 10);
32  }
33 }
34 
35 
36 
38 {
39 // for(int i = 0; i < 10; ++i)
40 // {
41 // edm::LogInfo("CSCDigiValidation") << "Mean of " << theTimeBinPlots[i]->getName()
42 // << " is " << theTimeBinPlots[i]->getMean()
43 // << " +/- " << theTimeBinPlots[i]->getRMS();
44 // edm::LogInfo("CSCDigiValidation") << "RMS of " << theResolutionPlots[i]->getName()
45 // << " is " << theResolutionPlots[i]->getRMS();
46 // }
47 }
48 
49 
51 {
53 
54  e.getByToken(wires_Token_, wires);
55 
56  if (!wires.isValid()) {
57  edm::LogError("CSCDigiDump") << "Cannot get wires by label " << theInputTag.encode();
58  }
59 
60  unsigned nDigisPerEvent = 0;
61 
62  for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
63  std::vector<CSCWireDigi>::const_iterator beginDigi = (*j).second.first;
64  std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
65  int detId = (*j).first.rawId();
66 
67  const CSCLayer * layer = findLayer(detId);
68  int chamberType = layer->chamber()->specs()->chamberType();
69  int nDigis = endDigi-beginDigi;
70  nDigisPerEvent += nDigis;
71  theNDigisPerLayerPlots[chamberType-1]->Fill(nDigis);
72 
73  for( std::vector<CSCWireDigi>::const_iterator digiItr = beginDigi;
74  digiItr != endDigi; ++digiItr)
75  {
76  theTimeBinPlots[chamberType-1]->Fill(digiItr->getTimeBin());
77  }
78 
79  if(theDoSimFlag)
80  {
82  if(nDigis == 1 && simHits.size() == 1)
83  {
84  plotResolution(simHits[0], *beginDigi, layer, chamberType);
85  }
86  }
87  }
88 
89  theNDigisPerEventPlot->Fill(nDigisPerEvent);
90 }
91 
92 
94  const CSCWireDigi & digi,
95  const CSCLayer * layer,
96  int chamberType)
97 {
98  double hitX = hit.localPosition().x();
99  double hitY = hit.localPosition().y();
100  double digiY = layer->geometry()->yOfWireGroup(digi.getWireGroup(), hitX);
101  theResolutionPlots[chamberType-1]->Fill(digiY - hitY);
102 }
103 
int i
Definition: DBlmapReader.cc:9
edm::InputTag theInputTag
CSCWireDigiValidation(DQMStore *dbe, const edm::InputTag &inputTag, edm::ConsumesCollector &&iC, bool doSim)
MonitorElement * theNDigisPerEventPlot
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
MonitorElement * theResolutionPlots[10]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
T y() const
Definition: PV3DBase.h:63
std::string encode() const
Definition: InputTag.cc:164
float yOfWireGroup(int wireGroup, float x=0.) const
void Fill(long long x)
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
Local3DPoint localPosition() const
Definition: PSimHit.h:44
const PSimHitMap * theSimHitMap
edm::EDGetTokenT< CSCWireDigiCollection > wires_Token_
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:22
MonitorElement * theNDigisPerLayerPlots[10]
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
DQMStore * dbe_
void plotResolution(const PSimHit &hit, const CSCWireDigi &digi, const CSCLayer *layer, int chamberType)
MonitorElement * theTimeBinPlots[10]
int chamberType() const
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
tuple simHits
Definition: trackerHits.py:16
std::vector< PSimHit > PSimHitContainer
void analyze(const edm::Event &, const edm::EventSetup &)
T x() const
Definition: PV3DBase.h:62
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
const CSCLayer * findLayer(int detId) const