CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCComparatorDigiValidation.cc
Go to the documentation of this file.
5 
6 
8  const edm::InputTag & inputTag,
9  const edm::InputTag & stripDigiInputTag,
11 : CSCBaseValidation(dbe, inputTag),
12  theStripDigi_Token_(iC.consumes<CSCStripDigiCollection>(stripDigiInputTag)),
13  theTimeBinPlots(),
14  theNDigisPerLayerPlots(),
15  theStripDigiPlots(),
16  the3StripPlots(),
17  theNDigisPerEventPlot( dbe_->book1D("CSCComparatorDigisPerEvent", "CSC Comparator Digis per event", 100, 0, 100) )
18 {
19  comparators_Token_ = iC.consumes<CSCComparatorDigiCollection>(inputTag);
20 
21  for(int i = 0; i < 10; ++i)
22  {
23  char title1[200], title2[200], title3[200], title4[200];
24  sprintf(title1, "CSCComparatorDigiTimeType%d", i+1);
25  sprintf(title2, "CSCComparatorDigisPerLayerType%d", i+1);
26  sprintf(title3, "CSCComparatorStripAmplitudeType%d", i+1);
27  sprintf(title4, "CSCComparator3StripAmplitudeType%d", i+1);
28  theTimeBinPlots[i] = dbe_->book1D(title1, title1, 9, 0, 8);
29  theNDigisPerLayerPlots[i] = dbe_->book1D(title2, title2, 100, 0, 20);
30  theStripDigiPlots[i] = dbe_->book1D(title3, title3, 100, 0, 1000);
31  the3StripPlots[i] = dbe_->book1D(title4, title4, 100, 0, 1000);
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") << "Mean charge of " << the3StripPlots[i]->getName()
45 // << " is " << the3StripPlots[i]->getMean();
46 // }
47 }
48 
49 
51 {
54 
55  e.getByToken(comparators_Token_, comparators);
56  if (!comparators.isValid()) {
57  edm::LogError("CSCDigiDump") << "Cannot get comparators by label " << theInputTag.encode();
58  }
59  e.getByToken(theStripDigi_Token_, stripDigis);
60  if (!stripDigis.isValid()) {
61  edm::LogError("CSCDigiDump") << "Cannot get comparators by label " << theInputTag.encode();
62  }
63 
64  unsigned nDigisPerEvent = 0;
65 
66  for (CSCComparatorDigiCollection::DigiRangeIterator j=comparators->begin(); j!=comparators->end(); j++) {
67  std::vector<CSCComparatorDigi>::const_iterator digiItr = (*j).second.first;
68  std::vector<CSCComparatorDigi>::const_iterator last = (*j).second.second;
69 
70  CSCDetId detId((*j).first);
71  const CSCLayer * layer = findLayer(detId.rawId());
72  int chamberType = layer->chamber()->specs()->chamberType();
73 
74  CSCStripDigiCollection::Range stripRange = stripDigis->get(detId);
75 
76  theNDigisPerLayerPlots[chamberType-1]->Fill(last-digiItr);
77 
78  for( ; digiItr != last; ++digiItr) {
79  ++nDigisPerEvent;
80  theTimeBinPlots[chamberType-1]->Fill(digiItr->getTimeBin());
81 
82  int strip = digiItr->getStrip();
83  for(std::vector<CSCStripDigi>::const_iterator stripItr = stripRange.first;
84  stripItr != stripRange.second; ++stripItr)
85  {
86  if(stripItr->getStrip() == strip)
87  {
88  std::vector<int> adc = stripItr->getADCCounts();
89  float pedc = 0.5*(adc[0]+adc[1]);
90  float amp = adc[4] - pedc;
91  theStripDigiPlots[chamberType-1]->Fill(amp);
92  // check neighbors
93  if(stripItr != stripRange.first && stripItr != stripRange.second-1)
94  {
95  std::vector<int> adcl = (stripItr-1)->getADCCounts();
96  std::vector<int> adcr = (stripItr+1)->getADCCounts();
97  float pedl = 0.5*(adcl[0]+adcl[1]);
98  float pedr = 0.5*(adcr[0]+adcr[1]);
99  float three = adcl[4]-pedl
100  + adcr[4]-pedr
101  + amp;
102  the3StripPlots[chamberType-1]->Fill(three);
103  }
104  }
105  }
106  }
107 
108  }
109 
110  theNDigisPerEventPlot->Fill(nDigisPerEvent);
111 }
112 
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
edm::InputTag theInputTag
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
edm::EDGetTokenT< CSCStripDigiCollection > theStripDigi_Token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
void analyze(const edm::Event &, const edm::EventSetup &)
CSCComparatorDigiValidation(DQMStore *dbe, const edm::InputTag &inputTag, const edm::InputTag &stripDigiInputTag, edm::ConsumesCollector &&iC)
std::string encode() const
Definition: InputTag.cc:164
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
edm::EDGetTokenT< CSCComparatorDigiCollection > comparators_Token_
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
DQMStore * dbe_
int chamberType() const
std::pair< const_iterator, const_iterator > Range
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const CSCLayer * findLayer(int detId) const