CMS 3D CMS Logo

OuterTrackerMonitorTTCluster.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiOuterTracker
4 // Class: SiOuterTracker
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 //
40 // constructors and destructor
41 //
43 : conf_(iConfig)
44 {
45  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
46  tagTTClustersToken_ = consumes<edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > > > (conf_.getParameter<edm::InputTag>("TTClusters") );
47 }
48 
50 {
51  // do anything here that needs to be done at desctruction time
52  // (e.g. close files, deallocate resources etc.)
53 }
54 
55 //
56 // member functions
57 //
58 
59 // ------------ method called for each event ------------
61 {
64  iEvent.getByToken( tagTTClustersToken_, Phase2TrackerDigiTTClusterHandle );
65 
68  const TrackerTopology* tTopo;
69  iSetup.get< TrackerTopologyRcd >().get(tTopoHandle);
70  tTopo = tTopoHandle.product();
71 
72  edm::ESHandle< TrackerGeometry > tGeometryHandle;
73  const TrackerGeometry* theTrackerGeometry;
74  iSetup.get< TrackerDigiGeometryRecord >().get( tGeometryHandle );
75  theTrackerGeometry = tGeometryHandle.product();
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 
102  double r = posClu.perp();
103  double z = posClu.z();
104 
105  Cluster_W->Fill(widClu, memberClu);
106  Cluster_Eta->Fill(posClu.eta());
107  Cluster_Phi->Fill(posClu.phi());
108  Cluster_R->Fill(r);
109  Cluster_RZ->Fill( z , r );
110 
111  if ( detIdClu.subdetId() == static_cast<int>(StripSubdetector::TOB) ) // Phase 2 Outer Tracker Barrel
112  {
113 
114  if ( memberClu == 0 ) Cluster_IMem_Barrel->Fill(tTopo->layer(detIdClu));
115  else Cluster_OMem_Barrel->Fill(tTopo->layer(detIdClu));
116 
117  Cluster_Barrel_XY->Fill( posClu.x(), posClu.y() );
118 
119  } // end if isBarrel
120  else if ( detIdClu.subdetId() == static_cast<int>(StripSubdetector::TID) ) // Phase 2 Outer Tracker Endcap
121  {
122 
123  if ( memberClu == 0 )
124  {
125  Cluster_IMem_Endcap_Disc->Fill(tTopo->layer(detIdClu)); // returns wheel
126  Cluster_IMem_Endcap_Ring->Fill(tTopo->tidRing(detIdClu));
127  }
128  else
129  {
130  Cluster_OMem_Endcap_Disc->Fill(tTopo->layer(detIdClu)); // returns wheel
131  Cluster_OMem_Endcap_Ring->Fill(tTopo->tidRing(detIdClu));
132  }
133 
134  if ( posClu.z() > 0 )
135  {
136  Cluster_Endcap_Fw_XY->Fill( posClu.x(), posClu.y() );
137  if (memberClu == 0) Cluster_IMem_Endcap_Ring_Fw[tTopo->layer(detIdClu)-1]->Fill(tTopo->tidRing(detIdClu));
138  else Cluster_OMem_Endcap_Ring_Fw[tTopo->layer(detIdClu)-1]->Fill(tTopo->tidRing(detIdClu));
139  }
140  else
141  {
142  Cluster_Endcap_Bw_XY->Fill( posClu.x(), posClu.y() );
143  if (memberClu == 0) Cluster_IMem_Endcap_Ring_Bw[tTopo->layer(detIdClu)-1]->Fill(tTopo->tidRing(detIdClu));
144  else Cluster_OMem_Endcap_Ring_Bw[tTopo->layer(detIdClu)-1]->Fill(tTopo->tidRing(detIdClu));
145  }
146 
147  } // end if isEndcap
148  } // end loop contentIter
149  } // end loop inputIter
150 } // end of method
151 
152 // ------------ method called once each job just before starting event loop ------------
155  const int numDiscs = 5;
156 
157  iBooker.setCurrentFolder(topFolderName_+"/Clusters/NClusters");
158 
159  // NClusters
160  edm::ParameterSet psTTCluster_Barrel = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Barrel");
161  HistoName = "NClusters_IMem_Barrel";
162  Cluster_IMem_Barrel = iBooker.book1D(HistoName, HistoName,
163  psTTCluster_Barrel.getParameter<int32_t>("Nbinsx"),
164  psTTCluster_Barrel.getParameter<double>("xmin"),
165  psTTCluster_Barrel.getParameter<double>("xmax"));
166  Cluster_IMem_Barrel->setAxisTitle("Barrel Layer", 1);
167  Cluster_IMem_Barrel->setAxisTitle("# L1 Clusters", 2);
168 
169  HistoName = "NClusters_OMem_Barrel";
170  Cluster_OMem_Barrel = iBooker.book1D(HistoName, HistoName,
171  psTTCluster_Barrel.getParameter<int32_t>("Nbinsx"),
172  psTTCluster_Barrel.getParameter<double>("xmin"),
173  psTTCluster_Barrel.getParameter<double>("xmax"));
174  Cluster_OMem_Barrel->setAxisTitle("Barrel Layer", 1);
175  Cluster_OMem_Barrel->setAxisTitle("# L1 Clusters", 2);
176 
177  edm::ParameterSet psTTCluster_ECDisc = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_ECDiscs");
178  HistoName = "NClusters_IMem_Endcap_Disc";
179  Cluster_IMem_Endcap_Disc = iBooker.book1D(HistoName, HistoName,
180  psTTCluster_ECDisc.getParameter<int32_t>("Nbinsx"),
181  psTTCluster_ECDisc.getParameter<double>("xmin"),
182  psTTCluster_ECDisc.getParameter<double>("xmax"));
183  Cluster_IMem_Endcap_Disc->setAxisTitle("Endcap Disc", 1);
184  Cluster_IMem_Endcap_Disc->setAxisTitle("# L1 Clusters", 2);
185 
186  HistoName = "NClusters_OMem_Endcap_Disc";
187  Cluster_OMem_Endcap_Disc = iBooker.book1D(HistoName, 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, HistoName,
197  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
198  psTTCluster_ECRing.getParameter<double>("xmin"),
199  psTTCluster_ECRing.getParameter<double>("xmax"));
200  Cluster_IMem_Endcap_Ring->setAxisTitle("Endcap Ring", 1);
201  Cluster_IMem_Endcap_Ring->setAxisTitle("# L1 Clusters", 2);
202 
203  HistoName = "NClusters_OMem_Endcap_Ring";
204  Cluster_OMem_Endcap_Ring = iBooker.book1D(HistoName, HistoName,
205  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
206  psTTCluster_ECRing.getParameter<double>("xmin"),
207  psTTCluster_ECRing.getParameter<double>("xmax"));
208  Cluster_OMem_Endcap_Ring->setAxisTitle("Endcap Ring", 1);
209  Cluster_OMem_Endcap_Ring->setAxisTitle("# L1 Clusters", 2);
210 
211  for (int i = 0; i < numDiscs; i++)
212  {
213  HistoName = "NClusters_IMem_Disc+"+std::to_string(i+1);
214  Cluster_IMem_Endcap_Ring_Fw[i] = iBooker.book1D(HistoName, HistoName,
215  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
216  psTTCluster_ECRing.getParameter<double>("xmin"),
217  psTTCluster_ECRing.getParameter<double>("xmax"));
218  Cluster_IMem_Endcap_Ring_Fw[i]->setAxisTitle("Endcap Ring",1);
219  Cluster_IMem_Endcap_Ring_Fw[i]->setAxisTitle("# L1 Clusters ",2);
220  }
221 
222  for (int i = 0; i < numDiscs; i++)
223  {
224  HistoName = "NClusters_IMem_Disc-"+std::to_string(i+1);
225  Cluster_IMem_Endcap_Ring_Bw[i] = iBooker.book1D(HistoName, HistoName,
226  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
227  psTTCluster_ECRing.getParameter<double>("xmin"),
228  psTTCluster_ECRing.getParameter<double>("xmax"));
229  Cluster_IMem_Endcap_Ring_Bw[i]->setAxisTitle("Endcap Ring",1);
230  Cluster_IMem_Endcap_Ring_Bw[i]->setAxisTitle("# L1 Clusters ",2);
231  }
232 
233  for (int i = 0; i < numDiscs; i++)
234  {
235  HistoName = "NClusters_OMem_Disc+"+std::to_string(i+1);
236  Cluster_OMem_Endcap_Ring_Fw[i] = iBooker.book1D(HistoName, HistoName,
237  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
238  psTTCluster_ECRing.getParameter<double>("xmin"),
239  psTTCluster_ECRing.getParameter<double>("xmax"));
240  Cluster_OMem_Endcap_Ring_Fw[i]->setAxisTitle("Endcap Ring",1);
241  Cluster_OMem_Endcap_Ring_Fw[i]->setAxisTitle("# L1 Clusters ",2);
242  }
243 
244  for (int i = 0; i < numDiscs; i++)
245  {
246  HistoName = "NClusters_OMem_Disc-"+std::to_string(i+1);
247  Cluster_OMem_Endcap_Ring_Bw[i] = iBooker.book1D(HistoName, HistoName,
248  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
249  psTTCluster_ECRing.getParameter<double>("xmin"),
250  psTTCluster_ECRing.getParameter<double>("xmax"));
251  Cluster_OMem_Endcap_Ring_Bw[i]->setAxisTitle("Endcap Ring",1);
252  Cluster_OMem_Endcap_Ring_Bw[i]->setAxisTitle("# L1 Clusters ",2);
253  }
254 
255 
256  iBooker.setCurrentFolder(topFolderName_+"/Clusters");
257 
258  //Cluster Width
259  edm::ParameterSet psTTClusterWidth = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Width");
260  HistoName = "Cluster_W";
261  Cluster_W = iBooker.book2D(HistoName, HistoName,
262  psTTClusterWidth.getParameter<int32_t>("Nbinsx"),
263  psTTClusterWidth.getParameter<double>("xmin"),
264  psTTClusterWidth.getParameter<double>("xmax"),
265  psTTClusterWidth.getParameter<int32_t>("Nbinsy"),
266  psTTClusterWidth.getParameter<double>("ymin"),
267  psTTClusterWidth.getParameter<double>("ymax"));
268  Cluster_W->setAxisTitle("L1 Cluster Width", 1);
269  Cluster_W->setAxisTitle("Stack Member", 2);
270 
271  //Cluster eta distribution
272  edm::ParameterSet psTTClusterEta = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Eta");
273  HistoName = "Cluster_Eta";
274  Cluster_Eta = iBooker.book1D(HistoName, HistoName,
275  psTTClusterEta.getParameter<int32_t>("Nbinsx"),
276  psTTClusterEta.getParameter<double>("xmin"),
277  psTTClusterEta.getParameter<double>("xmax"));
278  Cluster_Eta->setAxisTitle("#eta", 1);
279  Cluster_Eta->setAxisTitle("# L1 Clusters ", 2);
280 
281  //Cluster phi distribution
282  edm::ParameterSet psTTClusterPhi = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Phi");
283  HistoName = "Cluster_Phi";
284  Cluster_Phi = iBooker.book1D(HistoName, HistoName,
285  psTTClusterPhi.getParameter<int32_t>("Nbinsx"),
286  psTTClusterPhi.getParameter<double>("xmin"),
287  psTTClusterPhi.getParameter<double>("xmax"));
288  Cluster_Phi->setAxisTitle("#phi", 1);
289  Cluster_Phi->setAxisTitle("# L1 Clusters", 2);
290 
291  //Cluster R distribution
292  edm::ParameterSet psTTClusterR = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_R");
293  HistoName = "Cluster_R";
294  Cluster_R = iBooker.book1D(HistoName, HistoName,
295  psTTClusterR.getParameter<int32_t>("Nbinsx"),
296  psTTClusterR.getParameter<double>("xmin"),
297  psTTClusterR.getParameter<double>("xmax"));
298  Cluster_R->setAxisTitle("R [cm]", 1);
299  Cluster_R->setAxisTitle("# L1 Clusters", 2);
300 
301  iBooker.setCurrentFolder(topFolderName_+"/Clusters/Position");
302 
303  //Position plots
304  edm::ParameterSet psTTCluster_Barrel_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
305  HistoName = "Cluster_Barrel_XY";
306  Cluster_Barrel_XY = iBooker.book2D(HistoName, HistoName,
307  psTTCluster_Barrel_XY.getParameter<int32_t>("Nbinsx"),
308  psTTCluster_Barrel_XY.getParameter<double>("xmin"),
309  psTTCluster_Barrel_XY.getParameter<double>("xmax"),
310  psTTCluster_Barrel_XY.getParameter<int32_t>("Nbinsy"),
311  psTTCluster_Barrel_XY.getParameter<double>("ymin"),
312  psTTCluster_Barrel_XY.getParameter<double>("ymax"));
313  Cluster_Barrel_XY->setAxisTitle("L1 Cluster Barrel position x [cm]", 1);
314  Cluster_Barrel_XY->setAxisTitle("L1 Cluster Barrel position y [cm]", 2);
315 
316  edm::ParameterSet psTTCluster_Endcap_Fw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
317  HistoName = "Cluster_Endcap_Fw_XY";
318  Cluster_Endcap_Fw_XY = iBooker.book2D(HistoName, HistoName,
319  psTTCluster_Endcap_Fw_XY.getParameter<int32_t>("Nbinsx"),
320  psTTCluster_Endcap_Fw_XY.getParameter<double>("xmin"),
321  psTTCluster_Endcap_Fw_XY.getParameter<double>("xmax"),
322  psTTCluster_Endcap_Fw_XY.getParameter<int32_t>("Nbinsy"),
323  psTTCluster_Endcap_Fw_XY.getParameter<double>("ymin"),
324  psTTCluster_Endcap_Fw_XY.getParameter<double>("ymax"));
325  Cluster_Endcap_Fw_XY->setAxisTitle("L1 Cluster Forward Endcap position x [cm]", 1);
326  Cluster_Endcap_Fw_XY->setAxisTitle("L1 Cluster Forward Endcap position y [cm]", 2);
327 
328  edm::ParameterSet psTTCluster_Endcap_Bw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
329  HistoName = "Cluster_Endcap_Bw_XY";
330  Cluster_Endcap_Bw_XY = iBooker.book2D(HistoName, HistoName,
331  psTTCluster_Endcap_Bw_XY.getParameter<int32_t>("Nbinsx"),
332  psTTCluster_Endcap_Bw_XY.getParameter<double>("xmin"),
333  psTTCluster_Endcap_Bw_XY.getParameter<double>("xmax"),
334  psTTCluster_Endcap_Bw_XY.getParameter<int32_t>("Nbinsy"),
335  psTTCluster_Endcap_Bw_XY.getParameter<double>("ymin"),
336  psTTCluster_Endcap_Bw_XY.getParameter<double>("ymax"));
337  Cluster_Endcap_Bw_XY->setAxisTitle("L1 Cluster Backward Endcap position x [cm]", 1);
338  Cluster_Endcap_Bw_XY->setAxisTitle("L1 Cluster Backward Endcap position y [cm]", 2);
339 
340  //TTCluster #rho vs. z
341  edm::ParameterSet psTTCluster_RZ = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_RZ");
342  HistoName = "Cluster_RZ";
343  Cluster_RZ = iBooker.book2D(HistoName, HistoName,
344  psTTCluster_RZ.getParameter<int32_t>("Nbinsx"),
345  psTTCluster_RZ.getParameter<double>("xmin"),
346  psTTCluster_RZ.getParameter<double>("xmax"),
347  psTTCluster_RZ.getParameter<int32_t>("Nbinsy"),
348  psTTCluster_RZ.getParameter<double>("ymin"),
349  psTTCluster_RZ.getParameter<double>("ymax"));
350  Cluster_RZ->setAxisTitle("L1 Cluster position z [cm]", 1);
351  Cluster_RZ->setAxisTitle("L1 Cluster position #rho [cm]", 2);
352 
353 } //end of method
354 
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:579
virtual const Topology & topology() const
Definition: GeomDet.cc:81
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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:230
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:118
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > > > tagTTClustersToken_
Definition: DetId.h:18
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
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
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:63
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:44