CMS 3D CMS Logo

DTOccupancyEfficiency.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  */
5 
7 
8 // Framework
14 
16 
17 #include <iterator>
18 
19 using namespace edm;
20 using namespace std;
21 
23  debug = pset.getUntrackedParameter<bool>("debug", false);
24  // label for dtDigis
25  dtDigiToken_ = consumes<DTDigiCollection>(edm::InputTag(pset.getParameter<string>("digiLabel")));
26  // the name of the 4D rec hits collection
27  recHits4DToken_ = consumes<DTRecSegment4DCollection>(edm::InputTag(pset.getParameter<string>("recHits4DLabel")));
28  // the name of the rechits collection
29  recHitToken_ = consumes<DTRecHitCollection>(edm::InputTag(pset.getParameter<string>("recHitLabel")));
30 
31  parameters = pset;
32 }
33 
35 
37  edm::Run const& iRun,
38  edm::EventSetup const& context) {
39  ibooker.setCurrentFolder("DT/04-OccupancyEfficiency/digisPerRing");
40  // Digis per ring
41  for (int station = 1; station < 5; station++) {
42  string station_s = to_string(station);
43  for (int wheel = -2; wheel < 3; wheel++) {
44  string wheel_s = to_string(wheel);
45  if (wheel > 0)
46  wheel_s = "+" + wheel_s;
47  string histoName = "digisPerMB" + station_s + "W" + wheel_s;
48  string histoTitle = "Number of digis in MB" + station_s + "YB" + wheel_s;
49  (digisPerRing[station])[wheel] = ibooker.book1D(histoName, histoTitle, 100, 0, 150);
50  }
51  }
52 
53  ibooker.setCurrentFolder("DT/04-OccupancyEfficiency/timeBoxesPerRing");
54  // TimeBoxes per ring
55  for (int station = 1; station < 5; station++) {
56  string station_s = to_string(station);
57  for (int wheel = -2; wheel < 3; wheel++) {
58  string wheel_s = to_string(wheel);
59  if (wheel > 0)
60  wheel_s = "+" + wheel_s;
61  string histoName = "timeBoxesPerMB" + station_s + "W" + wheel_s;
62  string histoTitle = "Number of TDC counts in MB" + station_s + "YB" + wheel_s;
63  (timeBoxesPerRing[station])[wheel] = ibooker.book1D(histoName, histoTitle, 400, 0, 1600);
64  }
65  }
66 
67  ibooker.setCurrentFolder("DT/04-OccupancyEfficiency");
68 
69  // TimeBoxes
70  timeBoxesPerEvent = ibooker.book1D("timeBoxesPerEvent", "TDC counts per event", 400, 0, 1600);
71 
72  // Digis
73  digisPerEvent = ibooker.book1D("digisPerEvent", "Number of digis per event", 100, 0, 900);
74 
75  // RecHits
76  recHitsPerEvent = ibooker.book1D("recHitsPerEvent", "Number of RecHits per event", 100, 0, 250);
77 
78  // 4D segments
79  segments4DPerEvent = ibooker.book1D("segments4DPerEvent", "Number of 4D Segments per event", 50, 0, 50);
80 
81  recHitsPer4DSegment = ibooker.book1D("recHitsPer4DSegment", "Number of RecHits per segment", 16, 0.5, 16.5);
82 
83  // T0 from segements
84  t0From4DPhiSegment = ibooker.book1D("t0From4DPhiSegment", "T0 from 4D Phi segments", 100, -150, 150);
85  t0From4DZSegment = ibooker.book1D("t0From4DZSegment", "T0 from 4D Z segments", 100, -150, 150);
86 }
87 
89  if (debug)
90  cout << "[DTOccupancyEfficiency] Analyze #Run: " << event.id().run() << " #Event: " << event.id().event() << endl;
91 
92  // Digi collection
94  event.getByToken(dtDigiToken_, dtdigis);
95 
96  int numberOfDigis = 0;
97  std::map<int, std::map<int, int>> numberOfDigisPerRing;
98 
100  for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); ++dtLayerId_It) { // Loop over layers
101  for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
102  digiIt != ((*dtLayerId_It).second).second;
103  ++digiIt) {
104  numberOfDigis++;
105  int wheelId = ((*dtLayerId_It).first).wheel();
106  int stationId = ((*dtLayerId_It).first).station();
107  (numberOfDigisPerRing[stationId])[wheelId] += 1;
108 
109  timeBoxesPerEvent->Fill((*digiIt).countsTDC());
110  (timeBoxesPerRing[stationId])[wheelId]->Fill((*digiIt).countsTDC());
111  }
112  }
113 
114  // Total number of Digis per Event
115  digisPerEvent->Fill(numberOfDigis);
116 
117  // Digis per Ring in every wheel
118  for (int station = 1; station < 5; station++)
119  for (int wheel = -2; wheel < 3; wheel++)
120  (digisPerRing[station])[wheel]->Fill((numberOfDigisPerRing[station])[wheel]);
121 
122  // Get the 4D segment collection from the event
124  event.getByToken(recHits4DToken_, all4DSegments);
125 
126  segments4DPerEvent->Fill(all4DSegments->size());
127 
128  // Get the rechit collection from the event
129  Handle<DTRecHitCollection> dtRecHits;
130  event.getByToken(recHitToken_, dtRecHits);
131 
132  recHitsPerEvent->Fill(dtRecHits->size());
133 
134  // Number of RecHits per segment and t0 from Segment
135  // Loop on all segments
136  for (DTRecSegment4DCollection::const_iterator segment = all4DSegments->begin(); segment != all4DSegments->end();
137  ++segment) {
138  unsigned int nHits = (segment->hasPhi() ? (segment->phiSegment())->recHits().size() : 0);
139  nHits += (segment->hasZed() ? (segment->zSegment())->recHits().size() : 0);
140  recHitsPer4DSegment->Fill(nHits);
141 
142  if (segment->hasPhi()) {
143  double segmentPhiT0 = segment->phiSegment()->t0();
144  if (segment->phiSegment()->ist0Valid())
145  t0From4DPhiSegment->Fill(segmentPhiT0);
146  }
147  if (segment->hasZed()) {
148  double segmentZT0 = segment->zSegment()->t0();
149  if (segment->zSegment()->ist0Valid())
150  t0From4DZSegment->Fill(segmentZT0);
151  }
152  }
153 }
154 
155 // Local Variables:
156 // show-trailing-whitespace: t
157 // truncate-lines: t
158 // End:
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
DTOccupancyEfficiency::DTOccupancyEfficiency
DTOccupancyEfficiency(const edm::ParameterSet &pset)
Constructor.
Definition: DTOccupancyEfficiency.cc:22
ESHandle.h
edm::Run
Definition: Run.h:45
relativeConstraints.station
station
Definition: relativeConstraints.py:67
edm
HLT enums.
Definition: AlignableModifier.h:19
DTOccupancyEfficiency.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DTOccupancyEfficiency::~DTOccupancyEfficiency
~DTOccupancyEfficiency() override
Destructor.
Definition: DTOccupancyEfficiency.cc:34
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DQMStore.h
edm::Handle< DTDigiCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
MuonDigiCollection::const_iterator
std::vector< DigiType >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
DTOccupancyEfficiency::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DTOccupancyEfficiency.cc:36
debug
#define debug
Definition: HDRShower.cc:19
nHits
const caConstants::TupleMultiplicity *__restrict__ const HitsOnGPU *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t nHits
Definition: BrokenLineFitOnGPU.h:27
Service.h
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
edm::EventSetup
Definition: EventSetup.h:58
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
std
Definition: JetResolutionObject.h:76
DTOccupancyEfficiency::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
Definition: DTOccupancyEfficiency.cc:88
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
ParameterSet.h
event
Definition: event.py:1
DigiContainerIterator
Definition: MuonDigiCollection.h:30
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98