CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 <memory>
21 #include <numeric>
22 #include <vector>
23 
24 // user include files
33 
39 
45 
48 
50 public:
53  void analyze(const edm::Event &, const edm::EventSetup &) override;
54  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
55  void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override;
56  // TTCluster stacks
60  MonitorElement *Cluster_IMem_Endcap_Ring_Fw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
61  MonitorElement *Cluster_IMem_Endcap_Ring_Bw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
65  MonitorElement *Cluster_OMem_Endcap_Ring_Fw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
66  MonitorElement *Cluster_OMem_Endcap_Ring_Bw[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
71 
76 
77 private:
83  const TrackerGeometry *tkGeom_ = nullptr;
84  const TrackerTopology *tTopo_ = nullptr;
85 };
86 
87 //
88 // constructors and destructor
89 //
91  : conf_(iConfig),
92  geomToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>()),
93  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()) {
94  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
95  tagTTClustersToken_ = consumes<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>>(
96  conf_.getParameter<edm::InputTag>("TTClusters"));
97 }
98 
100  // do anything here that needs to be done at desctruction time
101  // (e.g. close files, deallocate resources etc.)
102 }
103 
104 //
105 // member functions
106 //
108  tkGeom_ = &(iSetup.getData(geomToken_));
109  tTopo_ = &(iSetup.getData(topoToken_));
110 }
111 
112 // ------------ method called for each event ------------
116  iEvent.getByToken(tagTTClustersToken_, Phase2TrackerDigiTTClusterHandle);
117 
119  typename edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::const_iterator inputIter;
120  typename edmNew::DetSet<TTCluster<Ref_Phase2TrackerDigi_>>::const_iterator contentIter;
121 
122  // Adding protection
123  if (!Phase2TrackerDigiTTClusterHandle.isValid())
124  return;
125 
126  for (inputIter = Phase2TrackerDigiTTClusterHandle->begin(); inputIter != Phase2TrackerDigiTTClusterHandle->end();
127  ++inputIter) {
128  for (contentIter = inputIter->begin(); contentIter != inputIter->end(); ++contentIter) {
129  // Make reference cluster
131  edmNew::makeRefTo(Phase2TrackerDigiTTClusterHandle, contentIter);
132 
133  DetId detIdClu = tkGeom_->idToDet(tempCluRef->getDetId())->geographicalId();
134  unsigned int memberClu = tempCluRef->getStackMember();
135  unsigned int widClu = tempCluRef->findWidth();
136 
137  MeasurementPoint mp = tempCluRef->findAverageLocalCoordinates();
138  const GeomDet *theGeomDet = tkGeom_->idToDet(detIdClu);
139  Global3DPoint posClu = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(mp));
140 
141  double r = posClu.perp();
142  double z = posClu.z();
143 
144  Cluster_W->Fill(widClu, memberClu);
145  Cluster_Eta->Fill(posClu.eta());
146  Cluster_Phi->Fill(posClu.phi());
147  Cluster_R->Fill(r);
148  Cluster_RZ->Fill(z, r);
149 
150  if (detIdClu.subdetId() == static_cast<int>(StripSubdetector::TOB)) // Phase 2 Outer Tracker Barrel
151  {
152  if (memberClu == 0)
153  Cluster_IMem_Barrel->Fill(tTopo_->layer(detIdClu));
154  else
155  Cluster_OMem_Barrel->Fill(tTopo_->layer(detIdClu));
156 
157  Cluster_Barrel_XY->Fill(posClu.x(), posClu.y());
158 
159  } // end if isBarrel
160  else if (detIdClu.subdetId() == static_cast<int>(StripSubdetector::TID)) // Phase 2 Outer Tracker Endcap
161  {
162  if (memberClu == 0) {
163  Cluster_IMem_Endcap_Disc->Fill(tTopo_->layer(detIdClu)); // returns wheel
165  } else {
166  Cluster_OMem_Endcap_Disc->Fill(tTopo_->layer(detIdClu)); // returns wheel
168  }
169 
170  if (posClu.z() > 0) {
171  Cluster_Endcap_Fw_XY->Fill(posClu.x(), posClu.y());
172  if (memberClu == 0)
173  Cluster_IMem_Endcap_Ring_Fw[tTopo_->layer(detIdClu) - 1]->Fill(tTopo_->tidRing(detIdClu));
174  else
175  Cluster_OMem_Endcap_Ring_Fw[tTopo_->layer(detIdClu) - 1]->Fill(tTopo_->tidRing(detIdClu));
176  } else {
177  Cluster_Endcap_Bw_XY->Fill(posClu.x(), posClu.y());
178  if (memberClu == 0)
179  Cluster_IMem_Endcap_Ring_Bw[tTopo_->layer(detIdClu) - 1]->Fill(tTopo_->tidRing(detIdClu));
180  else
181  Cluster_OMem_Endcap_Ring_Bw[tTopo_->layer(detIdClu) - 1]->Fill(tTopo_->tidRing(detIdClu));
182  }
183 
184  } // end if isEndcap
185  } // end loop contentIter
186  } // end loop inputIter
187 } // end of method
188 
189 // ------------ method called once each job just before starting event loop
190 // ------------
192  edm::Run const &run,
193  edm::EventSetup const &es) {
195  const int numDiscs = 5;
196 
197  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/NClusters");
198 
199  // NClusters
200  edm::ParameterSet psTTCluster_Barrel = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Barrel");
201  HistoName = "NClusters_IMem_Barrel";
202  Cluster_IMem_Barrel = iBooker.book1D(HistoName,
203  HistoName,
204  psTTCluster_Barrel.getParameter<int32_t>("Nbinsx"),
205  psTTCluster_Barrel.getParameter<double>("xmin"),
206  psTTCluster_Barrel.getParameter<double>("xmax"));
207  Cluster_IMem_Barrel->setAxisTitle("Barrel Layer", 1);
208  Cluster_IMem_Barrel->setAxisTitle("# L1 Clusters", 2);
209 
210  HistoName = "NClusters_OMem_Barrel";
211  Cluster_OMem_Barrel = iBooker.book1D(HistoName,
212  HistoName,
213  psTTCluster_Barrel.getParameter<int32_t>("Nbinsx"),
214  psTTCluster_Barrel.getParameter<double>("xmin"),
215  psTTCluster_Barrel.getParameter<double>("xmax"));
216  Cluster_OMem_Barrel->setAxisTitle("Barrel Layer", 1);
217  Cluster_OMem_Barrel->setAxisTitle("# L1 Clusters", 2);
218 
219  edm::ParameterSet psTTCluster_ECDisc = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_ECDiscs");
220  HistoName = "NClusters_IMem_Endcap_Disc";
221  Cluster_IMem_Endcap_Disc = iBooker.book1D(HistoName,
222  HistoName,
223  psTTCluster_ECDisc.getParameter<int32_t>("Nbinsx"),
224  psTTCluster_ECDisc.getParameter<double>("xmin"),
225  psTTCluster_ECDisc.getParameter<double>("xmax"));
226  Cluster_IMem_Endcap_Disc->setAxisTitle("Endcap Disc", 1);
227  Cluster_IMem_Endcap_Disc->setAxisTitle("# L1 Clusters", 2);
228 
229  HistoName = "NClusters_OMem_Endcap_Disc";
230  Cluster_OMem_Endcap_Disc = iBooker.book1D(HistoName,
231  HistoName,
232  psTTCluster_ECDisc.getParameter<int32_t>("Nbinsx"),
233  psTTCluster_ECDisc.getParameter<double>("xmin"),
234  psTTCluster_ECDisc.getParameter<double>("xmax"));
235  Cluster_OMem_Endcap_Disc->setAxisTitle("Endcap Disc", 1);
236  Cluster_OMem_Endcap_Disc->setAxisTitle("# L1 Clusters", 2);
237 
238  edm::ParameterSet psTTCluster_ECRing = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_ECRings");
239  HistoName = "NClusters_IMem_Endcap_Ring";
240  Cluster_IMem_Endcap_Ring = iBooker.book1D(HistoName,
241  HistoName,
242  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
243  psTTCluster_ECRing.getParameter<double>("xmin"),
244  psTTCluster_ECRing.getParameter<double>("xmax"));
245  Cluster_IMem_Endcap_Ring->setAxisTitle("Endcap Ring", 1);
246  Cluster_IMem_Endcap_Ring->setAxisTitle("# L1 Clusters", 2);
247 
248  HistoName = "NClusters_OMem_Endcap_Ring";
249  Cluster_OMem_Endcap_Ring = iBooker.book1D(HistoName,
250  HistoName,
251  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
252  psTTCluster_ECRing.getParameter<double>("xmin"),
253  psTTCluster_ECRing.getParameter<double>("xmax"));
254  Cluster_OMem_Endcap_Ring->setAxisTitle("Endcap Ring", 1);
255  Cluster_OMem_Endcap_Ring->setAxisTitle("# L1 Clusters", 2);
256 
257  for (int i = 0; i < numDiscs; i++) {
258  HistoName = "NClusters_IMem_Disc+" + std::to_string(i + 1);
259  Cluster_IMem_Endcap_Ring_Fw[i] = iBooker.book1D(HistoName,
260  HistoName,
261  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
262  psTTCluster_ECRing.getParameter<double>("xmin"),
263  psTTCluster_ECRing.getParameter<double>("xmax"));
264  Cluster_IMem_Endcap_Ring_Fw[i]->setAxisTitle("Endcap Ring", 1);
265  Cluster_IMem_Endcap_Ring_Fw[i]->setAxisTitle("# L1 Clusters ", 2);
266  }
267 
268  for (int i = 0; i < numDiscs; i++) {
269  HistoName = "NClusters_IMem_Disc-" + std::to_string(i + 1);
270  Cluster_IMem_Endcap_Ring_Bw[i] = iBooker.book1D(HistoName,
271  HistoName,
272  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
273  psTTCluster_ECRing.getParameter<double>("xmin"),
274  psTTCluster_ECRing.getParameter<double>("xmax"));
275  Cluster_IMem_Endcap_Ring_Bw[i]->setAxisTitle("Endcap Ring", 1);
276  Cluster_IMem_Endcap_Ring_Bw[i]->setAxisTitle("# L1 Clusters ", 2);
277  }
278 
279  for (int i = 0; i < numDiscs; i++) {
280  HistoName = "NClusters_OMem_Disc+" + std::to_string(i + 1);
281  Cluster_OMem_Endcap_Ring_Fw[i] = iBooker.book1D(HistoName,
282  HistoName,
283  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
284  psTTCluster_ECRing.getParameter<double>("xmin"),
285  psTTCluster_ECRing.getParameter<double>("xmax"));
286  Cluster_OMem_Endcap_Ring_Fw[i]->setAxisTitle("Endcap Ring", 1);
287  Cluster_OMem_Endcap_Ring_Fw[i]->setAxisTitle("# L1 Clusters ", 2);
288  }
289 
290  for (int i = 0; i < numDiscs; i++) {
291  HistoName = "NClusters_OMem_Disc-" + std::to_string(i + 1);
292  Cluster_OMem_Endcap_Ring_Bw[i] = iBooker.book1D(HistoName,
293  HistoName,
294  psTTCluster_ECRing.getParameter<int32_t>("Nbinsx"),
295  psTTCluster_ECRing.getParameter<double>("xmin"),
296  psTTCluster_ECRing.getParameter<double>("xmax"));
297  Cluster_OMem_Endcap_Ring_Bw[i]->setAxisTitle("Endcap Ring", 1);
298  Cluster_OMem_Endcap_Ring_Bw[i]->setAxisTitle("# L1 Clusters ", 2);
299  }
300 
301  iBooker.setCurrentFolder(topFolderName_ + "/Clusters");
302 
303  // Cluster Width
304  edm::ParameterSet psTTClusterWidth = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Width");
305  HistoName = "Cluster_W";
306  Cluster_W = iBooker.book2D(HistoName,
307  HistoName,
308  psTTClusterWidth.getParameter<int32_t>("Nbinsx"),
309  psTTClusterWidth.getParameter<double>("xmin"),
310  psTTClusterWidth.getParameter<double>("xmax"),
311  psTTClusterWidth.getParameter<int32_t>("Nbinsy"),
312  psTTClusterWidth.getParameter<double>("ymin"),
313  psTTClusterWidth.getParameter<double>("ymax"));
314  Cluster_W->setAxisTitle("L1 Cluster Width", 1);
315  Cluster_W->setAxisTitle("Stack Member", 2);
316 
317  // Cluster eta distribution
318  edm::ParameterSet psTTClusterEta = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Eta");
319  HistoName = "Cluster_Eta";
320  Cluster_Eta = iBooker.book1D(HistoName,
321  HistoName,
322  psTTClusterEta.getParameter<int32_t>("Nbinsx"),
323  psTTClusterEta.getParameter<double>("xmin"),
324  psTTClusterEta.getParameter<double>("xmax"));
325  Cluster_Eta->setAxisTitle("#eta", 1);
326  Cluster_Eta->setAxisTitle("# L1 Clusters ", 2);
327 
328  // Cluster phi distribution
329  edm::ParameterSet psTTClusterPhi = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_Phi");
330  HistoName = "Cluster_Phi";
331  Cluster_Phi = iBooker.book1D(HistoName,
332  HistoName,
333  psTTClusterPhi.getParameter<int32_t>("Nbinsx"),
334  psTTClusterPhi.getParameter<double>("xmin"),
335  psTTClusterPhi.getParameter<double>("xmax"));
336  Cluster_Phi->setAxisTitle("#phi", 1);
337  Cluster_Phi->setAxisTitle("# L1 Clusters", 2);
338 
339  // Cluster R distribution
340  edm::ParameterSet psTTClusterR = conf_.getParameter<edm::ParameterSet>("TH1TTCluster_R");
341  HistoName = "Cluster_R";
342  Cluster_R = iBooker.book1D(HistoName,
343  HistoName,
344  psTTClusterR.getParameter<int32_t>("Nbinsx"),
345  psTTClusterR.getParameter<double>("xmin"),
346  psTTClusterR.getParameter<double>("xmax"));
347  Cluster_R->setAxisTitle("R [cm]", 1);
348  Cluster_R->setAxisTitle("# L1 Clusters", 2);
349 
350  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/Position");
351 
352  // Position plots
353  edm::ParameterSet psTTCluster_Barrel_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
354  HistoName = "Cluster_Barrel_XY";
355  Cluster_Barrel_XY = iBooker.book2D(HistoName,
356  HistoName,
357  psTTCluster_Barrel_XY.getParameter<int32_t>("Nbinsx"),
358  psTTCluster_Barrel_XY.getParameter<double>("xmin"),
359  psTTCluster_Barrel_XY.getParameter<double>("xmax"),
360  psTTCluster_Barrel_XY.getParameter<int32_t>("Nbinsy"),
361  psTTCluster_Barrel_XY.getParameter<double>("ymin"),
362  psTTCluster_Barrel_XY.getParameter<double>("ymax"));
363  Cluster_Barrel_XY->setAxisTitle("L1 Cluster Barrel position x [cm]", 1);
364  Cluster_Barrel_XY->setAxisTitle("L1 Cluster Barrel position y [cm]", 2);
365 
366  edm::ParameterSet psTTCluster_Endcap_Fw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
367  HistoName = "Cluster_Endcap_Fw_XY";
368  Cluster_Endcap_Fw_XY = iBooker.book2D(HistoName,
369  HistoName,
370  psTTCluster_Endcap_Fw_XY.getParameter<int32_t>("Nbinsx"),
371  psTTCluster_Endcap_Fw_XY.getParameter<double>("xmin"),
372  psTTCluster_Endcap_Fw_XY.getParameter<double>("xmax"),
373  psTTCluster_Endcap_Fw_XY.getParameter<int32_t>("Nbinsy"),
374  psTTCluster_Endcap_Fw_XY.getParameter<double>("ymin"),
375  psTTCluster_Endcap_Fw_XY.getParameter<double>("ymax"));
376  Cluster_Endcap_Fw_XY->setAxisTitle("L1 Cluster Forward Endcap position x [cm]", 1);
377  Cluster_Endcap_Fw_XY->setAxisTitle("L1 Cluster Forward Endcap position y [cm]", 2);
378 
379  edm::ParameterSet psTTCluster_Endcap_Bw_XY = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_Position");
380  HistoName = "Cluster_Endcap_Bw_XY";
381  Cluster_Endcap_Bw_XY = iBooker.book2D(HistoName,
382  HistoName,
383  psTTCluster_Endcap_Bw_XY.getParameter<int32_t>("Nbinsx"),
384  psTTCluster_Endcap_Bw_XY.getParameter<double>("xmin"),
385  psTTCluster_Endcap_Bw_XY.getParameter<double>("xmax"),
386  psTTCluster_Endcap_Bw_XY.getParameter<int32_t>("Nbinsy"),
387  psTTCluster_Endcap_Bw_XY.getParameter<double>("ymin"),
388  psTTCluster_Endcap_Bw_XY.getParameter<double>("ymax"));
389  Cluster_Endcap_Bw_XY->setAxisTitle("L1 Cluster Backward Endcap position x [cm]", 1);
390  Cluster_Endcap_Bw_XY->setAxisTitle("L1 Cluster Backward Endcap position y [cm]", 2);
391 
392  // TTCluster #rho vs. z
393  edm::ParameterSet psTTCluster_RZ = conf_.getParameter<edm::ParameterSet>("TH2TTCluster_RZ");
394  HistoName = "Cluster_RZ";
395  Cluster_RZ = iBooker.book2D(HistoName,
396  HistoName,
397  psTTCluster_RZ.getParameter<int32_t>("Nbinsx"),
398  psTTCluster_RZ.getParameter<double>("xmin"),
399  psTTCluster_RZ.getParameter<double>("xmax"),
400  psTTCluster_RZ.getParameter<int32_t>("Nbinsy"),
401  psTTCluster_RZ.getParameter<double>("ymin"),
402  psTTCluster_RZ.getParameter<double>("ymax"));
403  Cluster_RZ->setAxisTitle("L1 Cluster position z [cm]", 1);
404  Cluster_RZ->setAxisTitle("L1 Cluster position #rho [cm]", 2);
405 
406 } // end of method
407 
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
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:69
void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
unsigned int tidRing(const DetId &id) const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
virtual const Topology & topology() const
Definition: GeomDet.cc:67
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T y() const
Definition: PV3DBase.h:60
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
void Fill(long long x)
bool getData(T &iHolder) const
Definition: EventSetup.h:128
int iEvent
Definition: GenABIO.cc:224
OuterTrackerMonitorTTCluster(const edm::ParameterSet &)
T z() const
Definition: PV3DBase.h:61
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Transition
Definition: Transition.h:12
static constexpr auto TOB
bool isValid() const
Definition: HandleBase.h:70
const TrackerGeomDet * idToDet(DetId) const override
edm::EDGetTokenT< edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > > > tagTTClustersToken_
Definition: DetId.h:17
void analyze(const edm::Event &, const edm::EventSetup &) override
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
std::string HistoName
unsigned int layer(const DetId &id) const
T eta() const
Definition: PV3DBase.h:73
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
T x() const
Definition: PV3DBase.h:59
static constexpr auto TID
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const_iterator begin(bool update=false) const
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)