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.
5 
9 
10 
11 
13 : CSCBaseValidation(dbe, inputTag),
14  theDoSimFlag(doSim),
15  theTimeBinPlots(),
16  theNDigisPerLayerPlots(),
17  theNDigisPerEventPlot( dbe_->book1D("CSCWireDigisPerEvent", "CSC Wire Digis per event", 100, 0, 100) )
18 {
19  for(int i = 0; i < 10; ++i)
20  {
21  char title1[200], title2[200], title3[200];
22  sprintf(title1, "CSCWireDigiTimeType%d", i+1);
23  sprintf(title2, "CSCWireDigisPerLayerType%d", i+1);
24  sprintf(title3, "CSCWireDigiResolution%d", i+1);
25  theTimeBinPlots[i] = dbe_->book1D(title1, title1, 9, 0, 8);
26  theNDigisPerLayerPlots[i] = dbe_->book1D(title2, title2, 100, 0, 20);
27  theResolutionPlots[i] = dbe_->book1D(title3, title3, 100, -10, 10);
28  }
29 }
30 
31 
32 
34 {
35 // for(int i = 0; i < 10; ++i)
36 // {
37 // edm::LogInfo("CSCDigiValidation") << "Mean of " << theTimeBinPlots[i]->getName()
38 // << " is " << theTimeBinPlots[i]->getMean()
39 // << " +/- " << theTimeBinPlots[i]->getRMS();
40 // edm::LogInfo("CSCDigiValidation") << "RMS of " << theResolutionPlots[i]->getName()
41 // << " is " << theResolutionPlots[i]->getRMS();
42 // }
43 }
44 
45 
47 {
49 
50  e.getByLabel(theInputTag, wires);
51  if (!wires.isValid()) {
52  edm::LogError("CSCDigiDump") << "Cannot get wires by label " << theInputTag.encode();
53  }
54 
55  unsigned nDigisPerEvent = 0;
56 
57  for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
58  std::vector<CSCWireDigi>::const_iterator beginDigi = (*j).second.first;
59  std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
60  int detId = (*j).first.rawId();
61 
62  const CSCLayer * layer = findLayer(detId);
63  int chamberType = layer->chamber()->specs()->chamberType();
64  int nDigis = endDigi-beginDigi;
65  nDigisPerEvent += nDigis;
66  theNDigisPerLayerPlots[chamberType-1]->Fill(nDigis);
67 
68  for( std::vector<CSCWireDigi>::const_iterator digiItr = beginDigi;
69  digiItr != endDigi; ++digiItr)
70  {
71  theTimeBinPlots[chamberType-1]->Fill(digiItr->getTimeBin());
72  }
73 
74  if(theDoSimFlag)
75  {
77  if(nDigis == 1 && simHits.size() == 1)
78  {
79  plotResolution(simHits[0], *beginDigi, layer, chamberType);
80  }
81  }
82  }
83 
84  theNDigisPerEventPlot->Fill(nDigisPerEvent);
85 }
86 
87 
89  const CSCWireDigi & digi,
90  const CSCLayer * layer,
91  int chamberType)
92 {
93  double hitX = hit.localPosition().x();
94  double hitY = hit.localPosition().y();
95  double digiY = layer->geometry()->yOfWireGroup(digi.getWireGroup(), hitX);
96  theResolutionPlots[chamberType-1]->Fill(digiY - hitY);
97 }
98 
int i
Definition: DBlmapReader.cc:9
edm::InputTag theInputTag
MonitorElement * theNDigisPerEventPlot
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * theResolutionPlots[10]
T y() const
Definition: PV3DBase.h:62
std::string encode() const
Definition: InputTag.cc:72
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
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:32
MonitorElement * theNDigisPerLayerPlots[10]
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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 &)
CSCWireDigiValidation(DQMStore *dbe, const edm::InputTag &inputTag, bool doSim)
T x() const
Definition: PV3DBase.h:61
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
const CSCLayer * findLayer(int detId) const