CMS 3D CMS Logo

CSCWireDigiValidation.cc
Go to the documentation of this file.
4 
8 
10  : CSCBaseValidation(ps), theTimeBinPlots(), theNDigisPerLayerPlots() {
11  const auto &pset = ps.getParameterSet("cscWireDigi");
12  inputTag_ = pset.getParameter<edm::InputTag>("inputTag");
14 }
15 
17 
19  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/Wire/Occupancy/");
21  iBooker.book1D("CSCWireDigisPerEvent", "CSC Wire Digis per event;CSC Wire Digis per event;Entries", 100, 0, 100);
22  for (int i = 1; i <= 10; ++i) {
23  const std::string t1("CSCWireDigiTime_" + CSCDetId::chamberName(i));
24  const std::string t2("CSCWireDigisPerLayer_" + CSCDetId::chamberName(i));
25  theTimeBinPlots[i - 1] =
26  iBooker.book1D(t1, "Wire Time Bin " + CSCDetId::chamberName(i) + ";Wire Time Bin; Entries", 16, 0, 16);
27  theNDigisPerLayerPlots[i - 1] = iBooker.book1D(
28  t2, "Number of Wire Digis " + CSCDetId::chamberName(i) + ";Number of Wire Digis; Entries", 100, 0, 20);
29  }
30 
31  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/Wire/Resolution/");
32  for (int i = 1; i <= 10; ++i) {
33  const std::string t3("CSCWireDigiResolution_" + CSCDetId::chamberName(i));
34  theResolutionPlots[i - 1] = iBooker.book1D(
35  t3,
36  "Wire Y Position Resolution " + CSCDetId::chamberName(i) + ";Wire Y Position Resolution [cm]; Entries",
37  100,
38  -10,
39  10);
40  }
41 }
42 
45 
46  e.getByToken(wires_Token_, wires);
47 
48  if (!wires.isValid()) {
49  edm::LogError("CSCWireDigiValidation") << "Cannot get wires by label " << inputTag_.encode();
50  }
51 
52  unsigned nDigisPerEvent = 0;
53 
54  for (auto j = wires->begin(); j != wires->end(); j++) {
55  auto beginDigi = (*j).second.first;
56  auto endDigi = (*j).second.second;
57  int detId = (*j).first.rawId();
58 
59  const CSCLayer *layer = findLayer(detId);
60  int chamberType = layer->chamber()->specs()->chamberType();
61  int nDigis = endDigi - beginDigi;
62  nDigisPerEvent += nDigis;
63  theNDigisPerLayerPlots[chamberType - 1]->Fill(nDigis);
64 
65  for (auto digiItr = beginDigi; digiItr != endDigi; ++digiItr) {
66  theTimeBinPlots[chamberType - 1]->Fill(digiItr->getTimeBin());
67  }
68 
69  if (doSim_) {
71  if (nDigis == 1 && simHits.size() == 1) {
72  plotResolution(simHits[0], *beginDigi, layer, chamberType);
73  }
74  }
75  }
76 
77  theNDigisPerEventPlot->Fill(nDigisPerEvent);
78 }
79 
81  const CSCWireDigi &digi,
82  const CSCLayer *layer,
83  int chamberType) {
84  double hitX = hit.localPosition().x();
85  double hitY = hit.localPosition().y();
86  double digiY = layer->geometry()->yOfWireGroup(digi.getWireGroup(), hitX);
87  theResolutionPlots[chamberType - 1]->Fill(digiY - hitY);
88 }
MonitorElement * theNDigisPerEventPlot
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * theResolutionPlots[10]
std::string encode() const
Definition: InputTag.cc:159
ParameterSet const & getParameterSet(std::string const &) const
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize > layer
void Fill(long long x)
std::string chamberName() const
Definition: CSCDetId.cc:92
const PSimHitMap * theSimHitMap
edm::EDGetTokenT< CSCWireDigiCollection > wires_Token_
const CSCLayer * findLayer(int detId) const
MonitorElement * theNDigisPerLayerPlots[10]
const edm::PSimHitContainer & hits(int detId) const
Definition: PSimHitMap.cc:20
void plotResolution(const PSimHit &hit, const CSCWireDigi &digi, const CSCLayer *layer, int chamberType)
MonitorElement * theTimeBinPlots[10]
void bookHistograms(DQMStore::IBooker &)
void analyze(const edm::Event &, const edm::EventSetup &) override
CSCWireDigiValidation(const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
std::vector< PSimHit > PSimHitContainer
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
int getWireGroup() const
default
Definition: CSCWireDigi.h:22