CMS 3D CMS Logo

OuterTrackerMonitorTTCluster.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiOuterTracker
4 // Class: SiOuterTracker
5 //
14 //
15 // Original Author: Isabelle Helena J De Bruyn
16 // Created: Mon, 10 Feb 2014 13:57:08 GMT
17 //
18 
19 // system include files
20 #include <fstream>
21 #include <iostream>
22 #include <memory>
23 #include <numeric>
24 #include <vector>
25 
26 // user include files
36 
38 
39 //
40 // constructors and destructor
41 //
43  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
44  tagTTClustersToken_ = consumes<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>>(
45  conf_.getParameter<edm::InputTag>("TTClusters"));
46 }
47 
49  // do anything here that needs to be done at desctruction time
50  // (e.g. close files, deallocate resources etc.)
51 }
52 
53 //
54 // member functions
55 //
56 
57 // ------------ method called for each event ------------
61  iEvent.getByToken(tagTTClustersToken_, Phase2TrackerDigiTTClusterHandle);
62 
65  const TrackerTopology *tTopo;
66  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
67  tTopo = tTopoHandle.product();
68 
69  edm::ESHandle<TrackerGeometry> tGeometryHandle;
70  const TrackerGeometry *theTrackerGeometry;
71  iSetup.get<TrackerDigiGeometryRecord>().get(tGeometryHandle);
72  theTrackerGeometry = tGeometryHandle.product();
73 
75  typename edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::const_iterator inputIter;
76  typename edmNew::DetSet<TTCluster<Ref_Phase2TrackerDigi_>>::const_iterator contentIter;
77 
78  // Adding protection
79  if (!Phase2TrackerDigiTTClusterHandle.isValid())
80  return;
81 
82  for (inputIter = Phase2TrackerDigiTTClusterHandle->begin(); inputIter != Phase2TrackerDigiTTClusterHandle->end();
83  ++inputIter) {
84  for (contentIter = inputIter->begin(); contentIter != inputIter->end(); ++contentIter) {
85  // Make reference cluster
87  edmNew::makeRefTo(Phase2TrackerDigiTTClusterHandle, contentIter);
88 
89  DetId detIdClu = theTrackerGeometry->idToDet(tempCluRef->getDetId())->geographicalId();
90  unsigned int memberClu = tempCluRef->getStackMember();
91  unsigned int widClu = tempCluRef->findWidth();
92 
93  MeasurementPoint mp = tempCluRef->findAverageLocalCoordinates();
94  const GeomDet *theGeomDet = theTrackerGeometry->idToDet(detIdClu);
95  Global3DPoint posClu = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(mp));
96 
97  double r = posClu.perp();
98  double z = posClu.z();
99 
100  Cluster_W->Fill(widClu, memberClu);
101  Cluster_Eta->Fill(posClu.eta());
102  Cluster_Phi->Fill(posClu.phi());
103  Cluster_R->Fill(r);
104  Cluster_RZ->Fill(z, r);
105 
106  if (detIdClu.subdetId() == static_cast<int>(StripSubdetector::TOB)) // Phase 2 Outer Tracker Barrel
107  {
108  if (memberClu == 0)
109  Cluster_IMem_Barrel->Fill(tTopo->layer(detIdClu));
110  else
111  Cluster_OMem_Barrel->Fill(tTopo->layer(detIdClu));
112 
113  Cluster_Barrel_XY->Fill(posClu.x(), posClu.y());
114 
115  } // end if isBarrel
116  else if (detIdClu.subdetId() == static_cast<int>(StripSubdetector::TID)) // Phase 2 Outer Tracker Endcap
117  {
118  if (memberClu == 0) {
119  Cluster_IMem_Endcap_Disc->Fill(tTopo->layer(detIdClu)); // returns wheel
120  Cluster_IMem_Endcap_Ring->Fill(tTopo->tidRing(detIdClu));
121  } else {
122  Cluster_OMem_Endcap_Disc->Fill(tTopo->layer(detIdClu)); // returns wheel
123  Cluster_OMem_Endcap_Ring->Fill(tTopo->tidRing(detIdClu));
124  }
125 
126  if (posClu.z() > 0) {
127  Cluster_Endcap_Fw_XY->Fill(posClu.x(), posClu.y());
128  if (memberClu == 0)
129  Cluster_IMem_Endcap_Ring_Fw[tTopo->layer(detIdClu) - 1]->Fill(tTopo->tidRing(detIdClu));
130  else
131  Cluster_OMem_Endcap_Ring_Fw[tTopo->layer(detIdClu) - 1]->Fill(tTopo->tidRing(detIdClu));
132  } else {
133  Cluster_Endcap_Bw_XY->Fill(posClu.x(), posClu.y());
134  if (memberClu == 0)
135  Cluster_IMem_Endcap_Ring_Bw[tTopo->layer(detIdClu) - 1]->Fill(tTopo->tidRing(detIdClu));
136  else
137  Cluster_OMem_Endcap_Ring_Bw[tTopo->layer(detIdClu) - 1]->Fill(tTopo->tidRing(detIdClu));
138  }
139 
140  } // end if isEndcap
141  } // end loop contentIter
142  } // end loop inputIter
143 } // end of method
144 
145 // ------------ method called once each job just before starting event loop
146 // ------------
148  edm::Run const &run,
149  edm::EventSetup const &es) {
151  const int numDiscs = 5;
152 
153  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/NClusters");
154 
155  // NClusters
156  edm::ParameterSet psTTCluster_Barrel = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Barrel");
157  HistoName = "NClusters_IMem_Barrel";
158  Cluster_IMem_Barrel = iBooker.book1D(HistoName,
159  HistoName,
160  psTTCluster_Barrel.getParameter<int32_t>("Nbinsx"),
161  psTTCluster_Barrel.getParameter<double>("xmin"),
162  psTTCluster_Barrel.getParameter<double>("xmax"));
163  Cluster_IMem_Barrel->setAxisTitle("Barrel Layer", 1);
164  Cluster_IMem_Barrel->setAxisTitle("# L1 Clusters", 2);
165 
166  HistoName = "NClusters_OMem_Barrel";
167  Cluster_OMem_Barrel = iBooker.book1D(HistoName,
168  HistoName,
169  psTTCluster_Barrel.getParameter<int32_t>("Nbinsx"),
170  psTTCluster_Barrel.getParameter<double>("xmin"),
171  psTTCluster_Barrel.getParameter<double>("xmax"));
172  Cluster_OMem_Barrel->setAxisTitle("Barrel Layer", 1);
173  Cluster_OMem_Barrel->setAxisTitle("# L1 Clusters", 2);
174 
175  edm::ParameterSet psTTCluster_ECDisc = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_ECDiscs");
176  HistoName = "NClusters_IMem_Endcap_Disc";
177  Cluster_IMem_Endcap_Disc = iBooker.book1D(HistoName,
178  HistoName,
179  psTTCluster_ECDisc.getParameter<int32_t>("Nbinsx"),
180  psTTCluster_ECDisc.getParameter<double>("xmin"),
181  psTTCluster_ECDisc.getParameter<double>("xmax"));
182  Cluster_IMem_Endcap_Disc->setAxisTitle("Endcap Disc", 1);
183  Cluster_IMem_Endcap_Disc->setAxisTitle("# L1 Clusters", 2);
184 
185  HistoName = "NClusters_OMem_Endcap_Disc";
186  Cluster_OMem_Endcap_Disc = iBooker.book1D(HistoName,
187  HistoName,
188  psTTCluster_ECDisc.getParameter<int32_t>("Nbinsx"),
189  psTTCluster_ECDisc.getParameter<double>("xmin"),
190  psTTCluster_ECDisc.getParameter<double>("xmax"));
191  Cluster_OMem_Endcap_Disc->setAxisTitle("Endcap Disc", 1);
192  Cluster_OMem_Endcap_Disc->setAxisTitle("# L1 Clusters", 2);
193 
194  edm::ParameterSet psTTCluster_ECRing = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_ECRings");
195  HistoName = "NClusters_IMem_Endcap_Ring";
196  Cluster_IMem_Endcap_Ring = iBooker.book1D(HistoName,
197  HistoName,
198  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
199  psTTCluster_ECRing.getParameter<double>("xmin"),
200  psTTCluster_ECRing.getParameter<double>("xmax"));
201  Cluster_IMem_Endcap_Ring->setAxisTitle("Endcap Ring", 1);
202  Cluster_IMem_Endcap_Ring->setAxisTitle("# L1 Clusters", 2);
203 
204  HistoName = "NClusters_OMem_Endcap_Ring";
205  Cluster_OMem_Endcap_Ring = iBooker.book1D(HistoName,
206  HistoName,
207  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
208  psTTCluster_ECRing.getParameter<double>("xmin"),
209  psTTCluster_ECRing.getParameter<double>("xmax"));
210  Cluster_OMem_Endcap_Ring->setAxisTitle("Endcap Ring", 1);
211  Cluster_OMem_Endcap_Ring->setAxisTitle("# L1 Clusters", 2);
212 
213  for (int i = 0; i < numDiscs; i++) {
214  HistoName = "NClusters_IMem_Disc+" + std::to_string(i + 1);
215  Cluster_IMem_Endcap_Ring_Fw[i] = iBooker.book1D(HistoName,
216  HistoName,
217  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
218  psTTCluster_ECRing.getParameter<double>("xmin"),
219  psTTCluster_ECRing.getParameter<double>("xmax"));
220  Cluster_IMem_Endcap_Ring_Fw[i]->setAxisTitle("Endcap Ring", 1);
221  Cluster_IMem_Endcap_Ring_Fw[i]->setAxisTitle("# L1 Clusters ", 2);
222  }
223 
224  for (int i = 0; i < numDiscs; i++) {
225  HistoName = "NClusters_IMem_Disc-" + std::to_string(i + 1);
226  Cluster_IMem_Endcap_Ring_Bw[i] = iBooker.book1D(HistoName,
227  HistoName,
228  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
229  psTTCluster_ECRing.getParameter<double>("xmin"),
230  psTTCluster_ECRing.getParameter<double>("xmax"));
231  Cluster_IMem_Endcap_Ring_Bw[i]->setAxisTitle("Endcap Ring", 1);
232  Cluster_IMem_Endcap_Ring_Bw[i]->setAxisTitle("# L1 Clusters ", 2);
233  }
234 
235  for (int i = 0; i < numDiscs; i++) {
236  HistoName = "NClusters_OMem_Disc+" + std::to_string(i + 1);
237  Cluster_OMem_Endcap_Ring_Fw[i] = iBooker.book1D(HistoName,
238  HistoName,
239  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
240  psTTCluster_ECRing.getParameter<double>("xmin"),
241  psTTCluster_ECRing.getParameter<double>("xmax"));
242  Cluster_OMem_Endcap_Ring_Fw[i]->setAxisTitle("Endcap Ring", 1);
243  Cluster_OMem_Endcap_Ring_Fw[i]->setAxisTitle("# L1 Clusters ", 2);
244  }
245 
246  for (int i = 0; i < numDiscs; i++) {
247  HistoName = "NClusters_OMem_Disc-" + std::to_string(i + 1);
248  Cluster_OMem_Endcap_Ring_Bw[i] = iBooker.book1D(HistoName,
249  HistoName,
250  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
251  psTTCluster_ECRing.getParameter<double>("xmin"),
252  psTTCluster_ECRing.getParameter<double>("xmax"));
253  Cluster_OMem_Endcap_Ring_Bw[i]->setAxisTitle("Endcap Ring", 1);
254  Cluster_OMem_Endcap_Ring_Bw[i]->setAxisTitle("# L1 Clusters ", 2);
255  }
256 
257  iBooker.setCurrentFolder(topFolderName_ + "/Clusters");
258 
259  // Cluster Width
260  edm::ParameterSet psTTClusterWidth = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Width");
261  HistoName = "Cluster_W";
262  Cluster_W = iBooker.book2D(HistoName,
263  HistoName,
264  psTTClusterWidth.getParameter<int32_t>("Nbinsx"),
265  psTTClusterWidth.getParameter<double>("xmin"),
266  psTTClusterWidth.getParameter<double>("xmax"),
267  psTTClusterWidth.getParameter<int32_t>("Nbinsy"),
268  psTTClusterWidth.getParameter<double>("ymin"),
269  psTTClusterWidth.getParameter<double>("ymax"));
270  Cluster_W->setAxisTitle("L1 Cluster Width", 1);
271  Cluster_W->setAxisTitle("Stack Member", 2);
272 
273  // Cluster eta distribution
274  edm::ParameterSet psTTClusterEta = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Eta");
275  HistoName = "Cluster_Eta";
276  Cluster_Eta = iBooker.book1D(HistoName,
277  HistoName,
278  psTTClusterEta.getParameter<int32_t>("Nbinsx"),
279  psTTClusterEta.getParameter<double>("xmin"),
280  psTTClusterEta.getParameter<double>("xmax"));
281  Cluster_Eta->setAxisTitle("#eta", 1);
282  Cluster_Eta->setAxisTitle("# L1 Clusters ", 2);
283 
284  // Cluster phi distribution
285  edm::ParameterSet psTTClusterPhi = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Phi");
286  HistoName = "Cluster_Phi";
287  Cluster_Phi = iBooker.book1D(HistoName,
288  HistoName,
289  psTTClusterPhi.getParameter<int32_t>("Nbinsx"),
290  psTTClusterPhi.getParameter<double>("xmin"),
291  psTTClusterPhi.getParameter<double>("xmax"));
292  Cluster_Phi->setAxisTitle("#phi", 1);
293  Cluster_Phi->setAxisTitle("# L1 Clusters", 2);
294 
295  // Cluster R distribution
296  edm::ParameterSet psTTClusterR = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_R");
297  HistoName = "Cluster_R";
298  Cluster_R = iBooker.book1D(HistoName,
299  HistoName,
300  psTTClusterR.getParameter<int32_t>("Nbinsx"),
301  psTTClusterR.getParameter<double>("xmin"),
302  psTTClusterR.getParameter<double>("xmax"));
303  Cluster_R->setAxisTitle("R [cm]", 1);
304  Cluster_R->setAxisTitle("# L1 Clusters", 2);
305 
306  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/Position");
307 
308  // Position plots
309  edm::ParameterSet psTTCluster_Barrel_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
310  HistoName = "Cluster_Barrel_XY";
311  Cluster_Barrel_XY = iBooker.book2D(HistoName,
312  HistoName,
313  psTTCluster_Barrel_XY.getParameter<int32_t>("Nbinsx"),
314  psTTCluster_Barrel_XY.getParameter<double>("xmin"),
315  psTTCluster_Barrel_XY.getParameter<double>("xmax"),
316  psTTCluster_Barrel_XY.getParameter<int32_t>("Nbinsy"),
317  psTTCluster_Barrel_XY.getParameter<double>("ymin"),
318  psTTCluster_Barrel_XY.getParameter<double>("ymax"));
319  Cluster_Barrel_XY->setAxisTitle("L1 Cluster Barrel position x [cm]", 1);
320  Cluster_Barrel_XY->setAxisTitle("L1 Cluster Barrel position y [cm]", 2);
321 
322  edm::ParameterSet psTTCluster_Endcap_Fw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
323  HistoName = "Cluster_Endcap_Fw_XY";
324  Cluster_Endcap_Fw_XY = iBooker.book2D(HistoName,
325  HistoName,
326  psTTCluster_Endcap_Fw_XY.getParameter<int32_t>("Nbinsx"),
327  psTTCluster_Endcap_Fw_XY.getParameter<double>("xmin"),
328  psTTCluster_Endcap_Fw_XY.getParameter<double>("xmax"),
329  psTTCluster_Endcap_Fw_XY.getParameter<int32_t>("Nbinsy"),
330  psTTCluster_Endcap_Fw_XY.getParameter<double>("ymin"),
331  psTTCluster_Endcap_Fw_XY.getParameter<double>("ymax"));
332  Cluster_Endcap_Fw_XY->setAxisTitle("L1 Cluster Forward Endcap position x [cm]", 1);
333  Cluster_Endcap_Fw_XY->setAxisTitle("L1 Cluster Forward Endcap position y [cm]", 2);
334 
335  edm::ParameterSet psTTCluster_Endcap_Bw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
336  HistoName = "Cluster_Endcap_Bw_XY";
337  Cluster_Endcap_Bw_XY = iBooker.book2D(HistoName,
338  HistoName,
339  psTTCluster_Endcap_Bw_XY.getParameter<int32_t>("Nbinsx"),
340  psTTCluster_Endcap_Bw_XY.getParameter<double>("xmin"),
341  psTTCluster_Endcap_Bw_XY.getParameter<double>("xmax"),
342  psTTCluster_Endcap_Bw_XY.getParameter<int32_t>("Nbinsy"),
343  psTTCluster_Endcap_Bw_XY.getParameter<double>("ymin"),
344  psTTCluster_Endcap_Bw_XY.getParameter<double>("ymax"));
345  Cluster_Endcap_Bw_XY->setAxisTitle("L1 Cluster Backward Endcap position x [cm]", 1);
346  Cluster_Endcap_Bw_XY->setAxisTitle("L1 Cluster Backward Endcap position y [cm]", 2);
347 
348  // TTCluster #rho vs. z
349  edm::ParameterSet psTTCluster_RZ = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_RZ");
350  HistoName = "Cluster_RZ";
351  Cluster_RZ = iBooker.book2D(HistoName,
352  HistoName,
353  psTTCluster_RZ.getParameter<int32_t>("Nbinsx"),
354  psTTCluster_RZ.getParameter<double>("xmin"),
355  psTTCluster_RZ.getParameter<double>("xmax"),
356  psTTCluster_RZ.getParameter<int32_t>("Nbinsy"),
357  psTTCluster_RZ.getParameter<double>("ymin"),
358  psTTCluster_RZ.getParameter<double>("ymax"));
359  Cluster_RZ->setAxisTitle("L1 Cluster position z [cm]", 1);
360  Cluster_RZ->setAxisTitle("L1 Cluster position #rho [cm]", 2);
361 
362 } // end of method
363 
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T getParameter(std::string const &) const
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
const_iterator end(bool update=false) const
T perp() const
Definition: PV3DBase.h:72
unsigned int tidRing(const DetId &id) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
virtual const Topology & topology() const
Definition: GeomDet.cc:81
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
OuterTrackerMonitorTTCluster(const edm::ParameterSet &)
T z() const
Definition: PV3DBase.h:64
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > > > tagTTClustersToken_
Definition: DetId.h:18
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
void analyze(const edm::Event &, const edm::EventSetup &) override
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
std::string HistoName
unsigned int layer(const DetId &id) const
T eta() const
Definition: PV3DBase.h:76
T get() const
Definition: EventSetup.h:71
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const TrackerGeomDet * idToDet(DetId) const override
T x() const
Definition: PV3DBase.h:62
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
Definition: ESHandle.h:86
const_iterator begin(bool update=false) const
Definition: Run.h:45