CMS 3D CMS Logo

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