CMS 3D CMS Logo

SiPixelTrackResidualSource.cc
Go to the documentation of this file.
1 // Package: SiPixelMonitorTrack
2 // Class: SiPixelTrackResidualSource
3 //
4 // class SiPixelTrackResidualSource SiPixelTrackResidualSource.cc
5 // DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualSource.cc
6 //
7 // Description: SiPixel hit-to-track residual data quality monitoring modules
8 // Implementation: prototype -> improved -> never final - end of the 1st step
9 //
10 // Original Author: Shan-Huei Chuang
11 // Created: Fri Mar 23 18:41:42 CET 2007
12 // Updated by Lukas Wehrli (plots for clusters on/off track added)
13 
14 #include <iostream>
15 #include <map>
16 #include <string>
17 #include <utility>
18 #include <vector>
19 
22 
25 
29 //#include "DataFormats/SiPixelDetId/interface/PixelBarrelNameWrapper.h"
33 
36 
38 
44 
48 
49 // Claudia new libraries
59 
60 using namespace std;
61 using namespace edm;
62 
64  : pSet_(pSet),
65  modOn(pSet.getUntrackedParameter<bool>("modOn", true)),
66  reducedSet(pSet.getUntrackedParameter<bool>("reducedSet", true)),
67  ladOn(pSet.getUntrackedParameter<bool>("ladOn", false)),
68  layOn(pSet.getUntrackedParameter<bool>("layOn", false)),
69  phiOn(pSet.getUntrackedParameter<bool>("phiOn", false)),
70  ringOn(pSet.getUntrackedParameter<bool>("ringOn", false)),
71  bladeOn(pSet.getUntrackedParameter<bool>("bladeOn", false)),
72  diskOn(pSet.getUntrackedParameter<bool>("diskOn", false)),
73  isUpgrade(pSet.getUntrackedParameter<bool>("isUpgrade", false)),
74  noOfLayers(0),
75  noOfDisks(0) {
76  pSet_ = pSet;
77  debug_ = pSet_.getUntrackedParameter<bool>("debug", false);
80  tracksrc_ = pSet_.getParameter<edm::InputTag>("trajectoryInput");
81  ttrhbuilder_ = pSet_.getParameter<std::string>("TTRHBuilder");
82  ptminres_ = pSet.getUntrackedParameter<double>("PtMinRes", 4.0);
83  beamSpotToken_ = consumes<reco::BeamSpot>(std::string("offlineBeamSpot"));
84  vtxsrc_ = pSet_.getUntrackedParameter<std::string>("vtxsrc", "offlinePrimaryVertices");
86  consumes<reco::VertexCollection>(vtxsrc_); // consumes<reco::VertexCollection>(std::string("hiSelectedVertex"));
87  // //"offlinePrimaryVertices"));
88  generalTracksToken_ = consumes<reco::TrackCollection>(pSet_.getParameter<edm::InputTag>("tracksrc"));
89  tracksrcToken_ = consumes<std::vector<Trajectory>>(pSet_.getParameter<edm::InputTag>("trajectoryInput"));
90  trackToken_ = consumes<std::vector<reco::Track>>(pSet_.getParameter<edm::InputTag>("trajectoryInput"));
92  consumes<TrajTrackAssociationCollection>(pSet_.getParameter<edm::InputTag>("trajectoryInput"));
93  clustersrcToken_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(pSet_.getParameter<edm::InputTag>("clustersrc"));
95  digisrcToken_ = consumes<edm::DetSetVector<PixelDigi>>(pSet_.getParameter<edm::InputTag>("digisrc"));
96 
97  LogInfo("PixelDQM") << "SiPixelTrackResidualSource constructor" << endl;
98  LogInfo("PixelDQM") << "Mod/Lad/Lay/Phi " << modOn << "/" << ladOn << "/" << layOn << "/" << phiOn << std::endl;
99  LogInfo("PixelDQM") << "Blade/Disk/Ring" << bladeOn << "/" << diskOn << "/" << ringOn << std::endl;
100 
101  topFolderName_ = pSet_.getParameter<std::string>("TopFolderName");
102 
103  firstRun = true;
104  NTotal = 0;
105  NLowProb = 0;
106 }
107 
109  LogInfo("PixelDQM") << "SiPixelTrackResidualSource destructor" << endl;
110 
111  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator struct_iter;
112  for (struct_iter = theSiPixelStructure.begin(); struct_iter != theSiPixelStructure.end(); struct_iter++) {
113  delete struct_iter->second;
114  struct_iter->second = nullptr;
115  }
116 }
117 
119  LogInfo("PixelDQM") << "SiPixelTrackResidualSource beginRun()" << endl;
120  // retrieve TrackerGeometry for pixel dets
122  iSetup.get<TrackerDigiGeometryRecord>().get(TG);
123  if (debug_)
124  LogVerbatim("PixelDQM") << "TrackerGeometry " << &(*TG) << " size is " << TG->dets().size() << endl;
125  edm::ESHandle<TrackerTopology> tTopoHandle;
126  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
127  const TrackerTopology *pTT = tTopoHandle.product();
128 
129  // build theSiPixelStructure with the pixel barrel and endcap dets from
130  // TrackerGeometry
131  for (TrackerGeometry::DetContainer::const_iterator pxb = TG->detsPXB().begin(); pxb != TG->detsPXB().end(); pxb++) {
132  if (dynamic_cast<PixelGeomDetUnit const *>((*pxb)) != nullptr) {
133  SiPixelTrackResidualModule *module = new SiPixelTrackResidualModule((*pxb)->geographicalId().rawId());
134  theSiPixelStructure.insert(
135  pair<uint32_t, SiPixelTrackResidualModule *>((*pxb)->geographicalId().rawId(), module));
136  // int DBlayer = PixelBarrelNameWrapper(pSet_,
137  // DetId((*pxb)->geographicalId())).layerName();
138  int DBlayer = PixelBarrelName(DetId((*pxb)->geographicalId()), pTT, isUpgrade).layerName();
139  if (noOfLayers < DBlayer)
140  noOfLayers = DBlayer;
141  }
142  }
143  for (TrackerGeometry::DetContainer::const_iterator pxf = TG->detsPXF().begin(); pxf != TG->detsPXF().end(); pxf++) {
144  if (dynamic_cast<PixelGeomDetUnit const *>((*pxf)) != nullptr) {
145  SiPixelTrackResidualModule *module = new SiPixelTrackResidualModule((*pxf)->geographicalId().rawId());
146  theSiPixelStructure.insert(
147  pair<uint32_t, SiPixelTrackResidualModule *>((*pxf)->geographicalId().rawId(), module));
148  int DBdisk;
149  DBdisk = PixelEndcapName(DetId((*pxf)->geographicalId()), pTT, isUpgrade).diskName();
150  if (noOfDisks < DBdisk)
151  noOfDisks = DBdisk;
152  }
153  }
154  LogInfo("PixelDQM") << "SiPixelStructure size is " << theSiPixelStructure.size() << endl;
155 }
156 
158  edm::Run const &,
159  edm::EventSetup const &iSetup) {
160  // book residual histograms in theSiPixelFolder - one (x,y) pair of histograms
161  // per det
162  SiPixelFolderOrganizer theSiPixelFolder(false);
163  std::stringstream nameX, titleX, nameY, titleY;
164 
165  if (ladOn) {
166  iBooker.setCurrentFolder(topFolderName_ + "/Barrel");
167  for (int i = 1; i <= noOfLayers; i++) {
168  nameX.str(std::string());
169  nameX << "siPixelTrackResidualsX_SummedLayer_" << i;
170  titleX.str(std::string());
171  titleX << "Layer" << i << "Hit-to-Track Residual in r-phi";
172  meResidualXSummedLay.push_back(iBooker.book1D(nameX.str(), titleX.str(), 100, -150, 150));
173  meResidualXSummedLay.at(i - 1)->setAxisTitle("hit-to-track residual in r-phi (um)", 1);
174  nameY.str(std::string());
175  nameY << "siPixelTrackResidualsY_SummedLayer_" << i;
176  titleY.str(std::string());
177  titleY << "Layer" << i << "Hit-to-Track Residual in Z";
178  meResidualYSummedLay.push_back(iBooker.book1D(nameY.str(), titleY.str(), 100, -300, 300));
179  meResidualYSummedLay.at(i - 1)->setAxisTitle("hit-to-track residual in z (um)", 1);
180  }
181  }
182 
183  for (std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd = theSiPixelStructure.begin();
184  pxd != theSiPixelStructure.end();
185  pxd++) {
186  if (modOn) {
187  if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 0, isUpgrade))
188  (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 0, isUpgrade);
189  else
190  throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Folder Creation Failed! ";
191  }
192  if (ladOn) {
193  if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 1, isUpgrade)) {
194  (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 1, isUpgrade);
195  } else
196  throw cms::Exception("LogicError") << "SiPixelTrackResidualSource ladder Folder Creation Failed! ";
197  }
198  if (layOn) {
199  if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 2, isUpgrade))
200  (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 2, isUpgrade);
201  else
202  throw cms::Exception("LogicError") << "SiPixelTrackResidualSource layer Folder Creation Failed! ";
203  }
204  if (phiOn) {
205  if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 3, isUpgrade))
206  (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 3, isUpgrade);
207  else
208  throw cms::Exception("LogicError") << "SiPixelTrackResidualSource phi Folder Creation Failed! ";
209  }
210  if (bladeOn) {
211  if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 4, isUpgrade))
212  (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 4, isUpgrade);
213  else
214  throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Blade Folder Creation Failed! ";
215  }
216  if (diskOn) {
217  if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 5, isUpgrade))
218  (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 5, isUpgrade);
219  else
220  throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Disk Folder Creation Failed! ";
221  }
222  if (ringOn) {
223  if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 6, isUpgrade))
224  (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 6, isUpgrade);
225  else
226  throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Ring Folder Creation Failed! ";
227  }
228  }
229 
230  // edm::InputTag tracksrc =
231  // pSet_.getParameter<edm::InputTag>("trajectoryInput"); edm::InputTag
232  // clustersrc = pSet_.getParameter<edm::InputTag>("clustersrc");
233 
234  // number of tracks
235  iBooker.setCurrentFolder(topFolderName_ + "/Tracks");
236  meNofTracks_ = iBooker.book1D("ntracks_" + tracksrc_.label(), "Number of Tracks", 4, 0, 4);
237  meNofTracks_->setAxisTitle("Number of Tracks", 1);
238  meNofTracks_->setBinLabel(1, "All");
239  meNofTracks_->setBinLabel(2, "Pixel");
240  meNofTracks_->setBinLabel(3, "BPix");
241  meNofTracks_->setBinLabel(4, "FPix");
242 
243  // number of tracks in pixel fiducial volume
244  iBooker.setCurrentFolder(topFolderName_ + "/Tracks");
245  meNofTracksInPixVol_ = iBooker.book1D(
246  "ntracksInPixVol_" + tracksrc_.label(), "Number of Tracks crossing Pixel fiducial Volume", 2, 0, 2);
247  meNofTracksInPixVol_->setAxisTitle("Number of Tracks", 1);
248  meNofTracksInPixVol_->setBinLabel(1, "With Hits");
249  meNofTracksInPixVol_->setBinLabel(2, "Without Hits");
250 
251  // number of clusters (associated to track / not associated)
252  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OnTrack");
254  iBooker.book1D("nclusters_" + clustersrc_.label() + "_tot", "Number of Clusters (on track)", 3, 0, 3);
255  meNofClustersOnTrack_->setAxisTitle("Number of Clusters on Track", 1);
259  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OffTrack");
261  iBooker.book1D("nclusters_" + clustersrc_.label() + "_tot", "Number of Clusters (off track)", 3, 0, 3);
262  meNofClustersNotOnTrack_->setAxisTitle("Number of Clusters off Track", 1);
266 
267  // cluster charge and size
268  // charge
269  // on track
270  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OnTrack");
271  std::stringstream ss1, ss2;
272  meClChargeOnTrack_all = iBooker.book1D("charge_" + clustersrc_.label(), "Charge (on track)", 500, 0., 500.);
273  meClChargeOnTrack_all->setAxisTitle("Charge size (in ke)", 1);
275  iBooker.book1D("charge_" + clustersrc_.label() + "_Barrel", "Charge (on track, barrel)", 500, 0., 500.);
276  meClChargeOnTrack_bpix->setAxisTitle("Charge size (in ke)", 1);
278  iBooker.book1D("charge_" + clustersrc_.label() + "_Endcap", "Charge (on track, endcap)", 500, 0., 500.);
279  meClChargeOnTrack_fpix->setAxisTitle("Charge size (in ke)", 1);
280  for (int i = 1; i <= noOfLayers; i++) {
281  ss1.str(std::string());
282  ss1 << "charge_" + clustersrc_.label() + "_Layer_" << i;
283  ss2.str(std::string());
284  ss2 << "Charge (on track, layer" << i << ")";
285  meClChargeOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
286  meClChargeOnTrack_layers.at(i - 1)->setAxisTitle("Charge size (in ke)", 1);
287  }
288  for (int i = 1; i <= noOfDisks; i++) {
289  ss1.str(std::string());
290  ss1 << "charge_" + clustersrc_.label() + "_Disk_p" << i;
291  ss2.str(std::string());
292  ss2 << "Charge (on track, diskp" << i << ")";
293  meClChargeOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
294  meClChargeOnTrack_diskps.at(i - 1)->setAxisTitle("Charge size (in ke)", 1);
295  }
296  for (int i = 1; i <= noOfDisks; i++) {
297  ss1.str(std::string());
298  ss1 << "charge_" + clustersrc_.label() + "_Disk_m" << i;
299  ss2.str(std::string());
300  ss2 << "Charge (on track, diskm" << i << ")";
301  meClChargeOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
302  meClChargeOnTrack_diskms.at(i - 1)->setAxisTitle("Charge size (in ke)", 1);
303  }
304  // off track
305  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OffTrack");
306  meClChargeNotOnTrack_all = iBooker.book1D("charge_" + clustersrc_.label(), "Charge (off track)", 500, 0., 500.);
307  meClChargeNotOnTrack_all->setAxisTitle("Charge size (in ke)", 1);
309  iBooker.book1D("charge_" + clustersrc_.label() + "_Barrel", "Charge (off track, barrel)", 500, 0., 500.);
310  meClChargeNotOnTrack_bpix->setAxisTitle("Charge size (in ke)", 1);
312  iBooker.book1D("charge_" + clustersrc_.label() + "_Endcap", "Charge (off track, endcap)", 500, 0., 500.);
313  meClChargeNotOnTrack_fpix->setAxisTitle("Charge size (in ke)", 1);
314  for (int i = 1; i <= noOfLayers; i++) {
315  ss1.str(std::string());
316  ss1 << "charge_" + clustersrc_.label() + "_Layer_" << i;
317  ss2.str(std::string());
318  ss2 << "Charge (off track, layer" << i << ")";
319  meClChargeNotOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
320  meClChargeNotOnTrack_layers.at(i - 1)->setAxisTitle("Charge size (in ke)", 1);
321  }
322  for (int i = 1; i <= noOfDisks; i++) {
323  ss1.str(std::string());
324  ss1 << "charge_" + clustersrc_.label() + "_Disk_p" << i;
325  ss2.str(std::string());
326  ss2 << "Charge (off track, diskp" << i << ")";
327  meClChargeNotOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
328  meClChargeNotOnTrack_diskps.at(i - 1)->setAxisTitle("Charge size (in ke)", 1);
329  }
330  for (int i = 1; i <= noOfDisks; i++) {
331  ss1.str(std::string());
332  ss1 << "charge_" + clustersrc_.label() + "_Disk_m" << i;
333  ss2.str(std::string());
334  ss2 << "Charge (off track, diskm" << i << ")";
335  meClChargeNotOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
336  meClChargeNotOnTrack_diskms.at(i - 1)->setAxisTitle("Charge size (in ke)", 1);
337  }
338 
339  // size
340  // on track
341  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OnTrack");
342  meClSizeOnTrack_all = iBooker.book1D("size_" + clustersrc_.label(), "Size (on track)", 100, 0., 100.);
343  meClSizeOnTrack_all->setAxisTitle("Cluster size (in pixels)", 1);
345  iBooker.book1D("size_" + clustersrc_.label() + "_Barrel", "Size (on track, barrel)", 100, 0., 100.);
346  meClSizeOnTrack_bpix->setAxisTitle("Cluster size (in pixels)", 1);
348  iBooker.book1D("size_" + clustersrc_.label() + "_Endcap", "Size (on track, endcap)", 100, 0., 100.);
349  meClSizeOnTrack_fpix->setAxisTitle("Cluster size (in pixels)", 1);
350  for (int i = 1; i <= noOfLayers; i++) {
351  ss1.str(std::string());
352  ss1 << "size_" + clustersrc_.label() + "_Layer_" << i;
353  ss2.str(std::string());
354  ss2 << "Size (on track, layer" << i << ")";
355  meClSizeOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
356  meClSizeOnTrack_layers.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
357  }
358  for (int i = 1; i <= noOfDisks; i++) {
359  ss1.str(std::string());
360  ss1 << "size_" + clustersrc_.label() + "_Disk_p" << i;
361  ss2.str(std::string());
362  ss2 << "Size (on track, diskp" << i << ")";
363  meClSizeOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
364  meClSizeOnTrack_diskps.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
365  }
366  for (int i = 1; i <= noOfDisks; i++) {
367  ss1.str(std::string());
368  ss1 << "size_" + clustersrc_.label() + "_Disk_m1" << i;
369  ss2.str(std::string());
370  ss2 << "Size (on track, diskm" << i << ")";
371  meClSizeOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
372  meClSizeOnTrack_diskms.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
373  }
374  meClSizeXOnTrack_all = iBooker.book1D("sizeX_" + clustersrc_.label(), "SizeX (on track)", 100, 0., 100.);
375  meClSizeXOnTrack_all->setAxisTitle("Cluster sizeX (in pixels)", 1);
377  iBooker.book1D("sizeX_" + clustersrc_.label() + "_Barrel", "SizeX (on track, barrel)", 100, 0., 100.);
378  meClSizeXOnTrack_bpix->setAxisTitle("Cluster sizeX (in pixels)", 1);
380  iBooker.book1D("sizeX_" + clustersrc_.label() + "_Endcap", "SizeX (on track, endcap)", 100, 0., 100.);
381  meClSizeXOnTrack_fpix->setAxisTitle("Cluster sizeX (in pixels)", 1);
382  for (int i = 1; i <= noOfLayers; i++) {
383  ss1.str(std::string());
384  ss1 << "sizeX_" + clustersrc_.label() + "_Layer_" << i;
385  ss2.str(std::string());
386  ss2 << "SizeX (on track, layer" << i << ")";
387  meClSizeXOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
388  meClSizeXOnTrack_layers.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
389  }
390  for (int i = 1; i <= noOfDisks; i++) {
391  ss1.str(std::string());
392  ss1 << "sizeX_" + clustersrc_.label() + "_Disk_p" << i;
393  ss2.str(std::string());
394  ss2 << "SizeX (on track, diskp" << i << ")";
395  meClSizeXOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
396  meClSizeXOnTrack_diskps.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
397  }
398  for (int i = 1; i <= noOfDisks; i++) {
399  ss1.str(std::string());
400  ss1 << "sizeX_" + clustersrc_.label() + "_Disk_m" << i;
401  ss2.str(std::string());
402  ss2 << "SizeX (on track, diskm" << i << ")";
403  meClSizeXOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
404  meClSizeXOnTrack_diskms.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
405  }
406  meClSizeYOnTrack_all = iBooker.book1D("sizeY_" + clustersrc_.label(), "SizeY (on track)", 100, 0., 100.);
407  meClSizeYOnTrack_all->setAxisTitle("Cluster sizeY (in pixels)", 1);
409  iBooker.book1D("sizeY_" + clustersrc_.label() + "_Barrel", "SizeY (on track, barrel)", 100, 0., 100.);
410  meClSizeYOnTrack_bpix->setAxisTitle("Cluster sizeY (in pixels)", 1);
412  iBooker.book1D("sizeY_" + clustersrc_.label() + "_Endcap", "SizeY (on track, endcap)", 100, 0., 100.);
413  meClSizeYOnTrack_fpix->setAxisTitle("Cluster sizeY (in pixels)", 1);
414  for (int i = 1; i <= noOfLayers; i++) {
415  ss1.str(std::string());
416  ss1 << "sizeY_" + clustersrc_.label() + "_Layer_" << i;
417  ss2.str(std::string());
418  ss2 << "SizeY (on track, layer" << i << ")";
419  meClSizeYOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
420  meClSizeYOnTrack_layers.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
421  }
422  for (int i = 1; i <= noOfDisks; i++) {
423  ss1.str(std::string());
424  ss1 << "sizeY_" + clustersrc_.label() + "_Disk_p" << i;
425  ss2.str(std::string());
426  ss2 << "SizeY (on track, diskp" << i << ")";
427  meClSizeYOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
428  meClSizeYOnTrack_diskps.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
429  }
430  for (int i = 1; i <= noOfDisks; i++) {
431  ss1.str(std::string());
432  ss1 << "sizeY_" + clustersrc_.label() + "_Disk_m" << i;
433  ss2.str(std::string());
434  ss2 << "SizeY (on track, diskm" << i << ")";
435  meClSizeYOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
436  meClSizeYOnTrack_diskms.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
437  }
438  // off track
439  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OffTrack");
440  meClSizeNotOnTrack_all = iBooker.book1D("size_" + clustersrc_.label(), "Size (off track)", 100, 0., 100.);
441  meClSizeNotOnTrack_all->setAxisTitle("Cluster size (in pixels)", 1);
443  iBooker.book1D("size_" + clustersrc_.label() + "_Barrel", "Size (off track, barrel)", 100, 0., 100.);
444  meClSizeNotOnTrack_bpix->setAxisTitle("Cluster size (in pixels)", 1);
446  iBooker.book1D("size_" + clustersrc_.label() + "_Endcap", "Size (off track, endcap)", 100, 0., 100.);
447  meClSizeNotOnTrack_fpix->setAxisTitle("Cluster size (in pixels)", 1);
448  for (int i = 1; i <= noOfLayers; i++) {
449  ss1.str(std::string());
450  ss1 << "size_" + clustersrc_.label() + "_Layer_" << i;
451  ss2.str(std::string());
452  ss2 << "Size (off track, layer" << i << ")";
453  meClSizeNotOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
454  meClSizeNotOnTrack_layers.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
455  }
456 
457  for (int i = 1; i <= noOfLayers; i++) {
458  int ybins = -1;
459  float ymin = 0.;
460  float ymax = 0.;
461  if (i == 1) {
462  ybins = 42;
463  ymin = -10.5;
464  ymax = 10.5;
465  }
466  if (i == 2) {
467  ybins = 66;
468  ymin = -16.5;
469  ymax = 16.5;
470  }
471  if (i == 3) {
472  ybins = 90;
473  ymin = -22.5;
474  ymax = 22.5;
475  }
476  ss1.str(std::string());
477  ss1 << "pix_bar Occ_roc_offtrack" + digisrc_.label() + "_layer_" << i;
478  ss2.str(std::string());
479  ss2 << "Pixel Barrel Occupancy, ROC level (Off Track): Layer " << i;
480  meZeroRocLadvsModOffTrackBarrel.push_back(iBooker.book2D(ss1.str(), ss2.str(), 72, -4.5, 4.5, ybins, ymin, ymax));
481  meZeroRocLadvsModOffTrackBarrel.at(i - 1)->setAxisTitle("ROC / Module", 1);
482  meZeroRocLadvsModOffTrackBarrel.at(i - 1)->setAxisTitle("ROC / Ladder", 2);
483  }
484 
485  for (int i = 1; i <= noOfDisks; i++) {
486  ss1.str(std::string());
487  ss1 << "size_" + clustersrc_.label() + "_Disk_p" << i;
488  ss2.str(std::string());
489  ss2 << "Size (off track, diskp" << i << ")";
490  meClSizeNotOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
491  meClSizeNotOnTrack_diskps.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
492  }
493  for (int i = 1; i <= noOfDisks; i++) {
494  ss1.str(std::string());
495  ss1 << "size_" + clustersrc_.label() + "_Disk_m" << i;
496  ss2.str(std::string());
497  ss2 << "Size (off track, diskm" << i << ")";
498  meClSizeNotOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
499  meClSizeNotOnTrack_diskms.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
500  }
501  meClSizeXNotOnTrack_all = iBooker.book1D("sizeX_" + clustersrc_.label(), "SizeX (off track)", 100, 0., 100.);
502  meClSizeXNotOnTrack_all->setAxisTitle("Cluster sizeX (in pixels)", 1);
504  iBooker.book1D("sizeX_" + clustersrc_.label() + "_Barrel", "SizeX (off track, barrel)", 100, 0., 100.);
505  meClSizeXNotOnTrack_bpix->setAxisTitle("Cluster sizeX (in pixels)", 1);
507  iBooker.book1D("sizeX_" + clustersrc_.label() + "_Endcap", "SizeX (off track, endcap)", 100, 0., 100.);
508  meClSizeXNotOnTrack_fpix->setAxisTitle("Cluster sizeX (in pixels)", 1);
509  for (int i = 1; i <= noOfLayers; i++) {
510  ss1.str(std::string());
511  ss1 << "sizeX_" + clustersrc_.label() + "_Layer_" << i;
512  ss2.str(std::string());
513  ss2 << "SizeX (off track, layer" << i << ")";
514  meClSizeXNotOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
515  meClSizeXNotOnTrack_layers.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
516  }
517  for (int i = 1; i <= noOfDisks; i++) {
518  ss1.str(std::string());
519  ss1 << "sizeX_" + clustersrc_.label() + "_Disk_p" << i;
520  ss2.str(std::string());
521  ss2 << "SizeX (off track, diskp" << i << ")";
522  meClSizeXNotOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
523  meClSizeXNotOnTrack_diskps.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
524  }
525  for (int i = 1; i <= noOfDisks; i++) {
526  ss1.str(std::string());
527  ss1 << "sizeX_" + clustersrc_.label() + "_Disk_m" << i;
528  ss2.str(std::string());
529  ss2 << "SizeX (off track, diskm" << i << ")";
530  meClSizeXNotOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
531  meClSizeXNotOnTrack_diskms.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
532  }
533  meClSizeYNotOnTrack_all = iBooker.book1D("sizeY_" + clustersrc_.label(), "SizeY (off track)", 100, 0., 100.);
534  meClSizeYNotOnTrack_all->setAxisTitle("Cluster sizeY (in pixels)", 1);
536  iBooker.book1D("sizeY_" + clustersrc_.label() + "_Barrel", "SizeY (off track, barrel)", 100, 0., 100.);
537  meClSizeYNotOnTrack_bpix->setAxisTitle("Cluster sizeY (in pixels)", 1);
539  iBooker.book1D("sizeY_" + clustersrc_.label() + "_Endcap", "SizeY (off track, endcap)", 100, 0., 100.);
540  meClSizeYNotOnTrack_fpix->setAxisTitle("Cluster sizeY (in pixels)", 1);
541  for (int i = 1; i <= noOfLayers; i++) {
542  ss1.str(std::string());
543  ss1 << "sizeY_" + clustersrc_.label() + "_Layer_" << i;
544  ss2.str(std::string());
545  ss2 << "SizeY (off track, layer" << i << ")";
546  meClSizeYNotOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
547  meClSizeYNotOnTrack_layers.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
548  }
549  for (int i = 1; i <= noOfDisks; i++) {
550  ss1.str(std::string());
551  ss1 << "sizeY_" + clustersrc_.label() + "_Disk_p" << i;
552  ss2.str(std::string());
553  ss2 << "SizeY (off track, diskp" << i << ")";
554  meClSizeYNotOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
555  meClSizeYNotOnTrack_diskps.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
556  }
557  for (int i = 1; i <= noOfDisks; i++) {
558  ss1.str(std::string());
559  ss1 << "sizeY_" + clustersrc_.label() + "_Disk_m" << i;
560  ss2.str(std::string());
561  ss2 << "SizeY (off track, diskm" << i << ")";
562  meClSizeYNotOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
563  meClSizeYNotOnTrack_diskms.at(i - 1)->setAxisTitle("Cluster size (in pixels)", 1);
564  }
565 
566  // cluster global position
567  // on track
568  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OnTrack");
569  // bpix
570  for (int i = 1; i <= noOfLayers; i++) {
571  ss1.str(std::string());
572  ss1 << "position_" + clustersrc_.label() + "_Layer_" << i;
573  ss2.str(std::string());
574  ss2 << "Clusters Layer" << i << " (on track)";
575  meClPosLayersOnTrack.push_back(iBooker.book2D(ss1.str(), ss2.str(), 200, -30., 30., 128, -3.2, 3.2));
576  meClPosLayersOnTrack.at(i - 1)->setAxisTitle("Global Z (cm)", 1);
577  meClPosLayersOnTrack.at(i - 1)->setAxisTitle("Global #phi", 2);
578 
579  int ybins = -1;
580  float ymin = 0.;
581  float ymax = 0.;
582  if (i == 1) {
583  ybins = 23;
584  ymin = -11.5;
585  ymax = 11.5;
586  }
587  if (i == 2) {
588  ybins = 33;
589  ymin = -17.5;
590  ymax = 17.5;
591  }
592  if (i == 3) {
593  ybins = 45;
594  ymin = -24.5;
595  ymax = 24.5;
596  }
597  ss1.str(std::string());
598  ss1 << "position_" + clustersrc_.label() + "_LadvsMod_Layer_" << i;
599  ss2.str(std::string());
600  ss2 << "Clusters Layer" << i << "_LadvsMod (on track)";
601  meClPosLayersLadVsModOnTrack.push_back(iBooker.book2D(ss1.str(), ss2.str(), 11, -5.5, 5.5, ybins, ymin, ymax));
602  meClPosLayersLadVsModOnTrack.at(i - 1)->setAxisTitle("z-module", 1);
603  meClPosLayersLadVsModOnTrack.at(i - 1)->setAxisTitle("Ladder", 2);
604  }
605 
606  for (int i = 1; i <= noOfLayers; i++) {
607  int ybins = -1;
608  float ymin = 0.;
609  float ymax = 0.;
610  if (i == 1) {
611  ybins = 42;
612  ymin = -10.5;
613  ymax = 10.5;
614  }
615  if (i == 2) {
616  ybins = 66;
617  ymin = -16.5;
618  ymax = 16.5;
619  }
620  if (i == 3) {
621  ybins = 90;
622  ymin = -22.5;
623  ymax = 22.5;
624  }
625  ss1.str(std::string());
626  ss1 << "pix_bar Occ_roc_ontrack" + digisrc_.label() + "_layer_" << i;
627  ss2.str(std::string());
628  ss2 << "Pixel Barrel Occupancy, ROC level (On Track): Layer " << i;
629  meZeroRocLadvsModOnTrackBarrel.push_back(iBooker.book2D(ss1.str(), ss2.str(), 72, -4.5, 4.5, ybins, ymin, ymax));
630  meZeroRocLadvsModOnTrackBarrel.at(i - 1)->setAxisTitle("ROC / Module", 1);
631  meZeroRocLadvsModOnTrackBarrel.at(i - 1)->setAxisTitle("ROC / Ladder", 2);
632  }
633 
634  for (int i = 1; i <= noOfLayers; i++) {
635  ss1.str(std::string());
636  ss1 << "nclustersvsPhi_" + clustersrc_.label() + "_Layer_" << i;
637  ss2.str(std::string());
638  ss2 << "nclusters (on track, layer" << i << ")";
639  meNofClustersvsPhiOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 1400., -3.5, 3.5));
640  meNofClustersvsPhiOnTrack_layers.at(i - 1)->setAxisTitle("Global #Phi", 1);
641  meNofClustersvsPhiOnTrack_layers.at(i - 1)->setAxisTitle("Number of Clusters/Layer on Track", 2);
642  }
643 
644  // fpix
645  for (int i = 1; i <= noOfDisks; i++) {
646  ss1.str(std::string());
647  ss1 << "position_" + clustersrc_.label() + "_pz_Disk_" << i;
648  ss2.str(std::string());
649  ss2 << "Clusters +Z Disk" << i << " (on track)";
650  meClPosDiskspzOnTrack.push_back(iBooker.book2D(ss1.str(), ss2.str(), 80, -20., 20., 80, -20., 20.));
651  meClPosDiskspzOnTrack.at(i - 1)->setAxisTitle("Global X (cm)", 1);
652  meClPosDiskspzOnTrack.at(i - 1)->setAxisTitle("Global Y (cm)", 2);
653  }
654  for (int i = 1; i <= noOfDisks; i++) {
655  ss1.str(std::string());
656  ss1 << "position_" + clustersrc_.label() + "_mz_Disk_" << i;
657  ss2.str(std::string());
658  ss2 << "Clusters -Z Disk" << i << " (on track)";
659  meClPosDisksmzOnTrack.push_back(iBooker.book2D(ss1.str(), ss2.str(), 80, -20., 20., 80, -20., 20.));
660  meClPosDisksmzOnTrack.at(i - 1)->setAxisTitle("Global X (cm)", 1);
661  meClPosDisksmzOnTrack.at(i - 1)->setAxisTitle("Global Y (cm)", 2);
662  }
664  iBooker.book1D("nclusters_" + clustersrc_.label(), "Number of Clusters (on Track)", 50, 0., 50.);
665  meNClustersOnTrack_all->setAxisTitle("Number of Clusters", 1);
667  "nclusters_" + clustersrc_.label() + "_Barrel", "Number of Clusters (on track, barrel)", 50, 0., 50.);
668  meNClustersOnTrack_bpix->setAxisTitle("Number of Clusters", 1);
670  "nclusters_" + clustersrc_.label() + "_Endcap", "Number of Clusters (on track, endcap)", 50, 0., 50.);
671  meNClustersOnTrack_fpix->setAxisTitle("Number of Clusters", 1);
672  for (int i = 1; i <= noOfLayers; i++) {
673  ss1.str(std::string());
674  ss1 << "nclusters_" + clustersrc_.label() + "_Layer_" << i;
675  ss2.str(std::string());
676  ss2 << "Number of Clusters (on track, layer" << i << ")";
677  meNClustersOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
678  meNClustersOnTrack_layers.at(i - 1)->setAxisTitle("Number of Clusters", 1);
679  }
680  for (int i = 1; i <= noOfDisks; i++) {
681  ss1.str(std::string());
682  ss1 << "nclusters_" + clustersrc_.label() + "_Disk_p" << i;
683  ss2.str(std::string());
684  ss2 << "Number of Clusters (on track, diskp" << i << ")";
685  meNClustersOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 50, 0., 50.));
686  meNClustersOnTrack_diskps.at(i - 1)->setAxisTitle("Number of Clusters", 1);
687 
688  ss1.str(std::string());
689  ss1 << "nclustersvsPhi_" + clustersrc_.label() + "_Disk_p" << i;
690  ss2.str(std::string());
691  ss2 << "nclusters (on track, diskp" << i << ")";
692  meNofClustersvsPhiOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 1400., -3.5, 3.5));
693  meNofClustersvsPhiOnTrack_diskps.at(i - 1)->setAxisTitle("Global #Phi", 1);
694  meNofClustersvsPhiOnTrack_diskps.at(i - 1)->setAxisTitle("Number of Clusters/Disk on Track", 2);
695  }
696  for (int i = 1; i <= noOfDisks; i++) {
697  ss1.str(std::string());
698  ss1 << "nclusters_" + clustersrc_.label() + "_Disk_m" << i;
699  ss2.str(std::string());
700  ss2 << "Number of Clusters (on track, diskm" << i << ")";
701  meNClustersOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
702  meNClustersOnTrack_diskms.at(i - 1)->setAxisTitle("Number of Clusters", 1);
703 
704  ss1.str(std::string());
705  ss1 << "nclustersvsPhi_" + clustersrc_.label() + "_Disk_m" << i;
706  ss2.str(std::string());
707  ss2 << "nclusters (on track, diskm" << i << ")";
708  meNofClustersvsPhiOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 1400., -3.5, 3.5));
709  meNofClustersvsPhiOnTrack_diskms.at(i - 1)->setAxisTitle("Global #Phi", 1);
710  meNofClustersvsPhiOnTrack_diskms.at(i - 1)->setAxisTitle("Number of Clusters/Disk on Track", 2);
711  }
712 
714  "ROC_endcap_occupancy_ontrk", "Pixel Endcap Occupancy, ROC level (On Track)", 72, -4.5, 4.5, 288, -12.5, 12.5);
715  meRocBladevsDiskEndcapOnTrk->setBinLabel(1, "Disk-2 Pnl2", 1);
716  meRocBladevsDiskEndcapOnTrk->setBinLabel(9, "Disk-2 Pnl1", 1);
717  meRocBladevsDiskEndcapOnTrk->setBinLabel(19, "Disk-1 Pnl2", 1);
718  meRocBladevsDiskEndcapOnTrk->setBinLabel(27, "Disk-1 Pnl1", 1);
719  meRocBladevsDiskEndcapOnTrk->setBinLabel(41, "Disk+1 Pnl1", 1);
720  meRocBladevsDiskEndcapOnTrk->setBinLabel(49, "Disk+1 Pnl2", 1);
721  meRocBladevsDiskEndcapOnTrk->setBinLabel(59, "Disk+2 Pnl1", 1);
722  meRocBladevsDiskEndcapOnTrk->setBinLabel(67, "Disk+2 Pnl2", 1);
723  meRocBladevsDiskEndcapOnTrk->setAxisTitle("Blades in Inner (>0) / Outer(<) Halves", 2);
724  meRocBladevsDiskEndcapOnTrk->setAxisTitle("ROC occupancy", 3);
725 
726  // not on track
727  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OffTrack");
728  // bpix
729  for (int i = 1; i <= noOfLayers; i++) {
730  ss1.str(std::string());
731  ss1 << "position_" + clustersrc_.label() + "_Layer_" << i;
732  ss2.str(std::string());
733  ss2 << "Clusters Layer" << i << " (off track)";
734  meClPosLayersNotOnTrack.push_back(iBooker.book2D(ss1.str(), ss2.str(), 200, -30., 30., 128, -3.2, 3.2));
735  meClPosLayersNotOnTrack.at(i - 1)->setAxisTitle("Global Z (cm)", 1);
736  meClPosLayersNotOnTrack.at(i - 1)->setAxisTitle("Global #phi", 2);
737  }
738  // fpix
739  for (int i = 1; i <= noOfDisks; i++) {
740  ss1.str(std::string());
741  ss1 << "position_" + clustersrc_.label() + "_pz_Disk_" << i;
742  ss2.str(std::string());
743  ss2 << "Clusters +Z Disk" << i << " (off track)";
744  meClPosDiskspzNotOnTrack.push_back(iBooker.book2D(ss1.str(), ss2.str(), 80, -20., 20., 80, -20., 20.));
745  meClPosDiskspzNotOnTrack.at(i - 1)->setAxisTitle("Global X (cm)", 1);
746  meClPosDiskspzNotOnTrack.at(i - 1)->setAxisTitle("Global Y (cm)", 2);
747  }
748  for (int i = 1; i <= noOfDisks; i++) {
749  ss1.str(std::string());
750  ss1 << "position_" + clustersrc_.label() + "_mz_Disk_" << i;
751  ss2.str(std::string());
752  ss2 << "Clusters -Z Disk" << i << " (off track)";
753  meClPosDisksmzNotOnTrack.push_back(iBooker.book2D(ss1.str(), ss2.str(), 80, -20., 20., 80, -20., 20.));
754  meClPosDisksmzNotOnTrack.at(i - 1)->setAxisTitle("Global X (cm)", 1);
755  meClPosDisksmzNotOnTrack.at(i - 1)->setAxisTitle("Global Y (cm)", 2);
756  }
758  iBooker.book1D("nclusters_" + clustersrc_.label(), "Number of Clusters (off Track)", 50, 0., 50.);
759  meNClustersNotOnTrack_all->setAxisTitle("Number of Clusters", 1);
761  "nclusters_" + clustersrc_.label() + "_Barrel", "Number of Clusters (off track, barrel)", 50, 0., 50.);
762  meNClustersNotOnTrack_bpix->setAxisTitle("Number of Clusters", 1);
764  "nclusters_" + clustersrc_.label() + "_Endcap", "Number of Clusters (off track, endcap)", 50, 0., 50.);
765  meNClustersNotOnTrack_fpix->setAxisTitle("Number of Clusters", 1);
766  for (int i = 1; i <= noOfLayers; i++) {
767  ss1.str(std::string());
768  ss1 << "nclusters_" + clustersrc_.label() + "_Layer_" << i;
769  ss2.str(std::string());
770  ss2 << "Number of Clusters (off track, layer" << i << ")";
771  meNClustersNotOnTrack_layers.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
772  meNClustersNotOnTrack_layers.at(i - 1)->setAxisTitle("Number of Clusters", 1);
773  }
774  for (int i = 1; i <= noOfDisks; i++) {
775  ss1.str(std::string());
776  ss1 << "nclusters_" + clustersrc_.label() + "_Disk_p" << i;
777  ss2.str(std::string());
778  ss2 << "Number of Clusters (off track, diskp" << i << ")";
779  meNClustersNotOnTrack_diskps.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
780  meNClustersNotOnTrack_diskps.at(i - 1)->setAxisTitle("Number of Clusters", 1);
781  }
782  for (int i = 1; i <= noOfDisks; i++) {
783  ss1.str(std::string());
784  ss1 << "nclusters_" + clustersrc_.label() + "_Disk_m" << i;
785  ss2.str(std::string());
786  ss2 << "Number of Clusters (off track, diskm" << i << ")";
787  meNClustersNotOnTrack_diskms.push_back(iBooker.book1D(ss1.str(), ss2.str(), 500, 0., 500.));
788  meNClustersNotOnTrack_diskms.at(i - 1)->setAxisTitle("Number of Clusters", 1);
789  }
790 
792  "ROC_endcap_occupancy_offtrk", "Pixel Endcap Occupancy, ROC level (Off Track)", 72, -4.5, 4.5, 288, -12.5, 12.5);
793  meRocBladevsDiskEndcapOffTrk->setBinLabel(1, "Disk-2 Pnl2", 1);
794  meRocBladevsDiskEndcapOffTrk->setBinLabel(9, "Disk-2 Pnl1", 1);
795  meRocBladevsDiskEndcapOffTrk->setBinLabel(19, "Disk-1 Pnl2", 1);
796  meRocBladevsDiskEndcapOffTrk->setBinLabel(27, "Disk-1 Pnl1", 1);
797  meRocBladevsDiskEndcapOffTrk->setBinLabel(41, "Disk+1 Pnl1", 1);
798  meRocBladevsDiskEndcapOffTrk->setBinLabel(49, "Disk+1 Pnl2", 1);
799  meRocBladevsDiskEndcapOffTrk->setBinLabel(59, "Disk+2 Pnl1", 1);
800  meRocBladevsDiskEndcapOffTrk->setBinLabel(67, "Disk+2 Pnl2", 1);
801  meRocBladevsDiskEndcapOffTrk->setAxisTitle("Blades in Inner (>0) / Outer(<) Halves", 2);
802  meRocBladevsDiskEndcapOffTrk->setAxisTitle("ROC occupancy", 3);
803 
804  // HitProbability
805  // on track
806  iBooker.setCurrentFolder(topFolderName_ + "/Clusters/OnTrack");
807  meHitProbability = iBooker.book1D(
808  "FractionLowProb", "Fraction of hits with low probability;FractionLowProb;#HitsOnTrack", 100, 0., 1.);
809 
810  if (debug_) {
811  // book summary residual histograms in a debugging folder - one (x,y) pair
812  // of histograms per subdetector
813  iBooker.setCurrentFolder("debugging");
814  char hisID[80];
815  for (int s = 0; s < 3; s++) {
816  sprintf(hisID, "residual_x_subdet_%i", s);
817  meSubdetResidualX[s] = iBooker.book1D(hisID, "Pixel Hit-to-Track Residual in X", 500, -5., 5.);
818 
819  sprintf(hisID, "residual_y_subdet_%i", s);
820  meSubdetResidualY[s] = iBooker.book1D(hisID, "Pixel Hit-to-Track Residual in Y", 500, -5., 5.);
821  }
822  }
823 
824  firstRun = false;
825 }
826 
828  // Retrieve tracker topology from geometry
829  edm::ESHandle<TrackerTopology> tTopoHandle;
830  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
831  const TrackerTopology *tTopo = tTopoHandle.product();
832 
833  // retrieve TrackerGeometry again and MagneticField for use in transforming
834  // a TrackCandidate's P(ersistent)TrajectoryStateoOnDet (PTSoD) to a
835  // TrajectoryStateOnSurface (TSoS)
837  iSetup.get<TrackerDigiGeometryRecord>().get(TG);
838  const TrackerGeometry *theTrackerGeometry = TG.product();
839 
840  // analytic triplet method to calculate the track residuals in the pixe barrel
841  // detector
842 
843  //--------------------------------------------------------------------
844  // beam spot:
845  //
847  // iEvent.getByLabel( "offlineBeamSpot", rbs );
848  iEvent.getByToken(beamSpotToken_, rbs);
849  math::XYZPoint bsP = math::XYZPoint(0, 0, 0);
850  if (!rbs.failedToGet() && rbs.isValid()) {
851  bsP = math::XYZPoint(rbs->x0(), rbs->y0(), rbs->z0());
852  }
853 
854  //--------------------------------------------------------------------
855  // primary vertices:
856  //
858  // iEvent.getByLabel("offlinePrimaryVertices", vertices );
859  iEvent.getByToken(offlinePrimaryVerticesToken_, vertices);
860 
861  if (vertices.failedToGet())
862  return;
863  if (!vertices.isValid())
864  return;
865 
866  math::XYZPoint vtxN = math::XYZPoint(0, 0, 0);
867  math::XYZPoint vtxP = math::XYZPoint(0, 0, 0);
868 
869  double bestNdof = 0.0;
870  double maxSumPt = 0.0;
871  reco::Vertex bestPvx;
872  for (reco::VertexCollection::const_iterator iVertex = vertices->begin(); iVertex != vertices->end(); ++iVertex) {
873  if (iVertex->ndof() > bestNdof) {
874  bestNdof = iVertex->ndof();
875  vtxN = math::XYZPoint(iVertex->x(), iVertex->y(), iVertex->z());
876  } // ndof
877  if (iVertex->p4().pt() > maxSumPt) {
878  maxSumPt = iVertex->p4().pt();
879  vtxP = math::XYZPoint(iVertex->x(), iVertex->y(), iVertex->z());
880  bestPvx = *iVertex;
881  } // sumpt
882 
883  } // vertex
884 
885  if (maxSumPt < 1.0)
886  vtxP = vtxN;
887 
888  //---------------------------------------------
889  // get Tracks
890  //
892  // iEvent.getByLabel( "generalTracks", TracksForRes );
893  iEvent.getByToken(generalTracksToken_, TracksForRes);
894 
895  if (debug_) {
898  std::cout << "Track for Res from " << labels.module << std::endl;
899  }
900 
901  //
902  // transient track builder, needs B-field from data base (global tag in .py)
903  //
905  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", theB);
906 
907  // get the TransienTrackingRecHitBuilder needed for extracting the global
908  // position of the hits in the pixel
909  edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
910  iSetup.get<TransientRecHitRecord>().get(ttrhbuilder_, theTrackerRecHitBuilder);
911 
912  // check that tracks are valid
913  if (TracksForRes.failedToGet())
914  return;
915  if (!TracksForRes.isValid())
916  return;
917 
918  // get tracker geometry
920  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
921 
922  if (!pDD.isValid()) {
923  cout << "Unable to find TrackerDigiGeometry. Return\n";
924  return;
925  }
926 
927  int kk = -1;
928  //----------------------------------------------------------------------------
929  // Residuals:
930  //
931  for (reco::TrackCollection::const_iterator iTrack = TracksForRes->begin(); iTrack != TracksForRes->end(); ++iTrack) {
932  // count
933  kk++;
934  // Calculate minimal track pt before curling
935  // cpt = cqRB = 0.3*R[m]*B[T] = 1.14*R[m] for B=3.8T
936  // D = 2R = 2*pt/1.14
937  // calo: D = 1.3 m => pt = 0.74 GeV/c
938  double pt = iTrack->pt();
939  if (pt < 0.75)
940  continue; // curls up
941  if (abs(iTrack->dxy(vtxP)) > 5 * iTrack->dxyError())
942  continue; // not prompt
943 
944  double charge = iTrack->charge();
945 
946  reco::TransientTrack tTrack = theB->build(*iTrack);
947  // get curvature of the track, needed for the residuals
948  double kap = tTrack.initialFreeState().transverseCurvature();
949  // needed for the TransienTrackingRecHitBuilder
951  if (iTrack->extra().isNonnull() && iTrack->extra().isAvailable()) {
952  double x1 = 0;
953  double y1 = 0;
954  double z1 = 0;
955  double x2 = 0;
956  double y2 = 0;
957  double z2 = 0;
958  double x3 = 0;
959  double y3 = 0;
960  double z3 = 0;
961  int n1 = 0;
962  int n2 = 0;
963  int n3 = 0;
964 
965  // for saving the pixel barrel hits
966  vector<TransientTrackingRecHit::RecHitPointer> GoodPixBarrelHits;
967  // looping through the RecHits of the track
968  for (trackingRecHit_iterator irecHit = iTrack->recHitsBegin(); irecHit != iTrack->recHitsEnd(); ++irecHit) {
969  if ((*irecHit)->isValid()) {
970  DetId detId = (*irecHit)->geographicalId();
971  // enum Detector { Tracker=1, Muon=2, Ecal=3, Hcal=4, Calo=5 };
972  if (detId.det() != 1) {
973  if (debug_) {
974  cout << "rec hit ID = " << detId.det() << " not in tracker!?!?\n";
975  }
976  continue;
977  }
978  uint32_t subDet = detId.subdetId();
979 
980  // enum SubDetector{ PixelBarrel=1, PixelEndcap=2 };
981  // enum SubDetector{ TIB=3, TID=4, TOB=5, TEC=6 };
982 
983  TransientTrackingRecHit::RecHitPointer trecHit = theTrackerRecHitBuilder->build(&*(*irecHit), initialTSOS);
984 
985  double gX = trecHit->globalPosition().x();
986  double gY = trecHit->globalPosition().y();
987  double gZ = trecHit->globalPosition().z();
988 
989  if (subDet == PixelSubdetector::PixelBarrel) {
990  int ilay = tTopo->pxbLayer(detId);
991 
992  if (ilay == 1) {
993  n1++;
994  x1 = gX;
995  y1 = gY;
996  z1 = gZ;
997 
998  GoodPixBarrelHits.push_back((trecHit));
999  } // PXB1
1000  if (ilay == 2) {
1001  n2++;
1002  x2 = gX;
1003  y2 = gY;
1004  z2 = gZ;
1005 
1006  GoodPixBarrelHits.push_back((trecHit));
1007 
1008  } // PXB2
1009  if (ilay == 3) {
1010  n3++;
1011  x3 = gX;
1012  y3 = gY;
1013  z3 = gZ;
1014  GoodPixBarrelHits.push_back((trecHit));
1015  }
1016  } // PXB
1017 
1018  } // valid
1019  } // loop rechits
1020 
1021  // CS extra plots
1022 
1023  if (n1 + n2 + n3 == 3 && n1 * n2 * n3 > 0) {
1024  for (unsigned int i = 0; i < GoodPixBarrelHits.size(); i++) {
1025  if (GoodPixBarrelHits[i]->isValid()) {
1026  DetId detId = GoodPixBarrelHits[i]->geographicalId().rawId();
1027  int ilay = tTopo->pxbLayer(detId);
1028  if (pt > ptminres_) {
1029  double dca2 = 0.0, dz2 = 0.0;
1030  double ptsig = pt;
1031  if (charge < 0.)
1032  ptsig = -pt;
1033  // Filling the histograms in modules
1034 
1035  MeasurementPoint Test;
1036  MeasurementPoint Test2;
1037  Test = MeasurementPoint(0, 0);
1038  Test2 = MeasurementPoint(0, 0);
1039  Measurement2DVector residual;
1040 
1041  if (ilay == 1) {
1042  triplets(x2, y2, z2, x1, y1, z1, x3, y3, z3, ptsig, dca2, dz2, kap);
1043 
1044  Test = MeasurementPoint(dca2 * 1E4, dz2 * 1E4);
1045  residual = Test - Test2;
1046  }
1047 
1048  if (ilay == 2) {
1049  triplets(x1, y1, z1, x2, y2, z2, x3, y3, z3, ptsig, dca2, dz2, kap);
1050 
1051  Test = MeasurementPoint(dca2 * 1E4, dz2 * 1E4);
1052  residual = Test - Test2;
1053  }
1054 
1055  if (ilay == 3) {
1056  triplets(x1, y1, z1, x3, y3, z3, x2, y2, z2, ptsig, dca2, dz2, kap);
1057 
1058  Test = MeasurementPoint(dca2 * 1E4, dz2 * 1E4);
1059  residual = Test - Test2;
1060  }
1061  // fill the residual histograms
1062 
1063  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd = theSiPixelStructure.find(detId);
1064  if (pxd != theSiPixelStructure.end())
1065  (*pxd).second->fill(residual, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1066 
1067  if (ladOn && pxd != theSiPixelStructure.end()) {
1068  meResidualXSummedLay.at(PixelBarrelNameUpgrade((*pxd).first).layerName() - 1)->Fill(residual.x());
1069  meResidualYSummedLay.at(PixelBarrelNameUpgrade((*pxd).first).layerName() - 1)->Fill(residual.y());
1070  }
1071 
1072  } // three hits
1073  } // is valid
1074  } // rechits loop
1075  } // pt 4
1076  }
1077 
1078  } //-----Tracks
1080  // get tracks
1081  edm::Handle<std::vector<reco::Track>> trackCollectionHandle;
1082  // iEvent.getByLabel(tracksrc_,trackCollectionHandle);
1083  iEvent.getByToken(trackToken_, trackCollectionHandle);
1084  auto const &trackColl = *(trackCollectionHandle.product());
1085 
1086  // get clusters
1088  // iEvent.getByLabel( clustersrc_, clusterColl );
1089  iEvent.getByToken(clustersrcToken_, clusterColl);
1090  auto const &clustColl = *(clusterColl.product());
1091 
1092  // get digis
1094  iEvent.getByToken(digisrcToken_, digiinput);
1095  edm::DetSetVector<PixelDigi> const &diginp = *(digiinput.product());
1096 
1097  std::set<SiPixelCluster> clusterSet;
1098  TrajectoryStateCombiner tsoscomb;
1099  int tracks = 0, pixeltracks = 0, bpixtracks = 0, fpixtracks = 0;
1100  int trackclusters = 0, barreltrackclusters = 0, endcaptrackclusters = 0;
1101  int otherclusters = 0, barrelotherclusters = 0, endcapotherclusters = 0;
1102 
1103  // get trajectories
1104  edm::Handle<std::vector<Trajectory>> trajCollectionHandle;
1105  iEvent.getByToken(tracksrcToken_, trajCollectionHandle);
1106 
1107  if (debug_) {
1109  labelsForToken(tracksrcToken_, labels);
1110  std::cout << "Trajectories for Res from " << labels.module << std::endl;
1111  }
1112 
1113  if (trajCollectionHandle.isValid()) {
1114  auto const &trajColl = *(trajCollectionHandle.product());
1115  // get the map
1117  iEvent.getByToken(trackAssociationToken_, match);
1118  auto const &ttac = *(match.product());
1119 
1120  if (debug_) {
1121  std::cout << "Trajectories\t : " << trajColl.size() << std::endl;
1122  std::cout << "recoTracks \t : " << trackColl.size() << std::endl;
1123  std::cout << "Map entries \t : " << ttac.size() << std::endl;
1124  }
1125 
1126  // Loop over map entries
1127  for (TrajTrackAssociationCollection::const_iterator it = ttac.begin(); it != ttac.end(); ++it) {
1128  const edm::Ref<std::vector<Trajectory>> traj_iterator = it->key;
1129  // Trajectory Map, extract Trajectory for this track
1130  reco::TrackRef trackref = it->val;
1131  tracks++;
1132 
1133  bool isBpixtrack = false, isFpixtrack = false, crossesPixVol = false;
1134 
1135  // find out whether track crosses pixel fiducial volume (for cosmic
1136  // tracks)
1137 
1138  double d0 = (*trackref).d0(), dz = (*trackref).dz();
1139 
1140  if (abs(d0) < 15 && abs(dz) < 50)
1141  crossesPixVol = true;
1142 
1143  const std::vector<TrajectoryMeasurement> &tmeasColl = traj_iterator->measurements();
1144  std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
1145  // loop on measurements to find out whether there are bpix and/or fpix
1146  // hits
1147  for (tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end(); tmeasIt++) {
1148  if (!tmeasIt->updatedState().isValid())
1149  continue;
1150  TransientTrackingRecHit::ConstRecHitPointer testhit = tmeasIt->recHit();
1151  if (!testhit->isValid() || testhit->geographicalId().det() != DetId::Tracker)
1152  continue;
1153  uint testSubDetID = (testhit->geographicalId().subdetId());
1154  if (testSubDetID == PixelSubdetector::PixelBarrel)
1155  isBpixtrack = true;
1156  if (testSubDetID == PixelSubdetector::PixelEndcap)
1157  isFpixtrack = true;
1158  } // end loop on measurements
1159  if (isBpixtrack) {
1160  bpixtracks++;
1161  if (debug_)
1162  std::cout << "bpixtrack\n";
1163  }
1164  if (isFpixtrack) {
1165  fpixtracks++;
1166  if (debug_)
1167  std::cout << "fpixtrack\n";
1168  }
1169  if (isBpixtrack || isFpixtrack) {
1170  pixeltracks++;
1171 
1172  if (crossesPixVol)
1173  meNofTracksInPixVol_->Fill(0, 1);
1174 
1175  const std::vector<TrajectoryMeasurement> &tmeasColl = traj_iterator->measurements();
1176  for (std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end();
1177  tmeasIt++) {
1178  if (!tmeasIt->updatedState().isValid())
1179  continue;
1180 
1181  TrajectoryStateOnSurface tsos = tsoscomb(tmeasIt->forwardPredictedState(), tmeasIt->backwardPredictedState());
1182  if (!tsos.isValid())
1183  continue; // Happens rarely, due to singular matrix or similar
1184 
1186  if (!hit->isValid() || hit->geographicalId().det() != DetId::Tracker) {
1187  continue;
1188  } else {
1189  // //residual
1190  const DetId &hit_detId = hit->geographicalId();
1191  // uint IntRawDetID = (hit_detId.rawId());
1192  uint IntSubDetID = (hit_detId.subdetId());
1193 
1194  if (IntSubDetID == 0)
1195  continue; // don't look at SiStrip hits!
1196 
1197  // get the enclosed persistent hit
1198  const TrackingRecHit *persistentHit = hit->hit();
1199  // check if it's not null, and if it's a valid pixel hit
1200  if ((persistentHit != nullptr) && (typeid(*persistentHit) == typeid(SiPixelRecHit))) {
1201  // tell the C++ compiler that the hit is a pixel hit
1202  const SiPixelRecHit *pixhit = static_cast<const SiPixelRecHit *>(hit->hit());
1203  // Hit probability:
1204  float hit_prob = -1.;
1205  if (pixhit->hasFilledProb()) {
1206  hit_prob = pixhit->clusterProbability(0);
1207  // std::cout<<"HITPROB= "<<hit_prob<<std::endl;
1208  if (hit_prob < pow(10., -15.))
1209  NLowProb++;
1210  NTotal++;
1211  if (NTotal > 0)
1212  meHitProbability->Fill(float(NLowProb / NTotal));
1213  }
1214 
1215  // get the edm::Ref to the cluster
1216  edm::Ref<edmNew::DetSetVector<SiPixelCluster>, SiPixelCluster> const &clust = (*pixhit).cluster();
1217 
1218  // check if the ref is not null
1219  if (clust.isNonnull()) {
1220  // define tracker and pixel geometry and topology
1221  const TrackerGeometry &theTracker(*theTrackerGeometry);
1222  const PixelGeomDetUnit *theGeomDet =
1223  static_cast<const PixelGeomDetUnit *>(theTracker.idToDet(hit_detId));
1224 
1225  // test if PixelGeomDetUnit exists
1226  if (theGeomDet == nullptr) {
1227  if (debug_)
1228  std::cout << "NO THEGEOMDET\n";
1229  continue;
1230  }
1231 
1232  const PixelTopology *topol = &(theGeomDet->specificTopology());
1233  // fill histograms for clusters on tracks
1234  // correct SiPixelTrackResidualModule
1235  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd =
1236  theSiPixelStructure.find((*hit).geographicalId().rawId());
1237 
1238  // CHARGE CORRECTION (for track impact angle)
1239  // calculate alpha and beta from cluster position
1241  LocalVector localDir = ltp.momentum() / ltp.momentum().mag();
1242 
1243  float clust_alpha = atan2(localDir.z(), localDir.x());
1244  float clust_beta = atan2(localDir.z(), localDir.y());
1245  double corrCharge = clust->charge() *
1246  sqrt(1.0 / (1.0 / pow(tan(clust_alpha), 2) + 1.0 / pow(tan(clust_beta), 2) + 1.0)) /
1247  1000.;
1248 
1249  if (pxd != theSiPixelStructure.end())
1250  (*pxd).second->fill(
1251  (*clust), true, corrCharge, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1252 
1253  trackclusters++;
1254  // CORR CHARGE
1255  meClChargeOnTrack_all->Fill(corrCharge);
1256  meClSizeOnTrack_all->Fill((*clust).size());
1257  meClSizeXOnTrack_all->Fill((*clust).sizeX());
1258  meClSizeYOnTrack_all->Fill((*clust).sizeY());
1259  clusterSet.insert(*clust);
1260 
1261  // find cluster global position (rphi, z)
1262  // get cluster center of gravity (of charge)
1263  float xcenter = clust->x();
1264  float ycenter = clust->y();
1265  // get the cluster position in local coordinates (cm)
1266  LocalPoint clustlp = topol->localPosition(MeasurementPoint(xcenter, ycenter));
1267  // get the cluster position in global coordinates (cm)
1268  GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
1269 
1270  // find location of hit (barrel or endcap, same for cluster)
1271  bool barrel =
1272  DetId((*hit).geographicalId()).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
1273  bool endcap =
1274  DetId((*hit).geographicalId()).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
1275  if (barrel) {
1276  barreltrackclusters++;
1277 
1278  DetId detId = (*hit).geographicalId();
1279  if (detId >= 302055684 && detId <= 352477708) {
1280  getrococcupancy(detId, diginp, tTopo, meZeroRocLadvsModOnTrackBarrel);
1281  }
1282 
1283  // CORR CHARGE
1284  meClChargeOnTrack_bpix->Fill(corrCharge);
1285  meClSizeOnTrack_bpix->Fill((*clust).size());
1286  meClSizeXOnTrack_bpix->Fill((*clust).sizeX());
1287  meClSizeYOnTrack_bpix->Fill((*clust).sizeY());
1288  int DBlayer;
1289  DBlayer = PixelBarrelName(DetId((*hit).geographicalId()), tTopo, isUpgrade).layerName();
1290  float phi = clustgp.phi();
1291  float z = clustgp.z();
1292 
1293  PixelBarrelName pbn(DetId((*hit).geographicalId()), tTopo, isUpgrade);
1294  int ladder = pbn.ladderName();
1295  int module = pbn.moduleName();
1296 
1297  PixelBarrelName::Shell sh = pbn.shell(); // enum
1298  int ladderSigned = ladder;
1299  int moduleSigned = module;
1300  // Shell { mO = 1, mI = 2 , pO =3 , pI =4 };
1301  int shell = int(sh);
1302  // change the module sign for z<0
1303  if (shell == 1 || shell == 2) {
1304  moduleSigned = -module;
1305  }
1306  // change ladeer sign for Outer )x<0)
1307  if (shell == 1 || shell == 3) {
1308  ladderSigned = -ladder;
1309  }
1310 
1311  for (int i = 0; i < noOfLayers; i++) {
1312  if (DBlayer == i + 1) {
1313  meClPosLayersOnTrack.at(i)->Fill(z, phi);
1314  meClPosLayersLadVsModOnTrack.at(i)->Fill(moduleSigned, ladderSigned);
1315  meClChargeOnTrack_layers.at(i)->Fill(corrCharge);
1316  meClSizeOnTrack_layers.at(i)->Fill((*clust).size());
1317  meClSizeXOnTrack_layers.at(i)->Fill((*clust).sizeX());
1318  meClSizeYOnTrack_layers.at(i)->Fill((*clust).sizeY());
1319  meNofClustersvsPhiOnTrack_layers.at(i)->Fill(phi);
1320  }
1321  }
1322  }
1323  if (endcap) {
1324  endcaptrackclusters++;
1325  // CORR CHARGE
1326  meClChargeOnTrack_fpix->Fill(corrCharge);
1327  meClSizeOnTrack_fpix->Fill((*clust).size());
1328  meClSizeXOnTrack_fpix->Fill((*clust).sizeX());
1329  meClSizeYOnTrack_fpix->Fill((*clust).sizeY());
1330  int DBdisk = 0;
1331  DBdisk = PixelEndcapName(DetId((*hit).geographicalId()), tTopo, isUpgrade).diskName();
1332  float x = clustgp.x();
1333  float y = clustgp.y();
1334  float z = clustgp.z();
1335  float phi = clustgp.phi();
1336 
1337  float xclust = clust->x();
1338  float yclust = clust->y();
1339 
1340  getepixrococcupancyontrk(tTopo, hit, xclust, yclust, z, meRocBladevsDiskEndcapOnTrk);
1341 
1342  if (z > 0) {
1343  for (int i = 0; i < noOfDisks; i++) {
1344  if (DBdisk == i + 1) {
1345  meClPosDiskspzOnTrack.at(i)->Fill(x, y);
1346  meClChargeOnTrack_diskps.at(i)->Fill(corrCharge);
1347  meClSizeOnTrack_diskps.at(i)->Fill((*clust).size());
1348  meClSizeXOnTrack_diskps.at(i)->Fill((*clust).sizeX());
1349  meClSizeYOnTrack_diskps.at(i)->Fill((*clust).sizeY());
1350  meNofClustersvsPhiOnTrack_diskps.at(i)->Fill(phi);
1351  }
1352  }
1353  } else {
1354  for (int i = 0; i < noOfDisks; i++) {
1355  if (DBdisk == i + 1) {
1356  meClPosDisksmzOnTrack.at(i)->Fill(x, y);
1357  meClChargeOnTrack_diskms.at(i)->Fill(corrCharge);
1358  meClSizeOnTrack_diskms.at(i)->Fill((*clust).size());
1359  meClSizeXOnTrack_diskms.at(i)->Fill((*clust).sizeX());
1360  meClSizeYOnTrack_diskms.at(i)->Fill((*clust).sizeY());
1361  meNofClustersvsPhiOnTrack_diskms.at(i)->Fill(phi);
1362  }
1363  }
1364  }
1365  }
1366 
1367  } // end if (cluster exists)
1368 
1369  } // end if (persistent hit exists and is pixel hit)
1370 
1371  } // end of else
1372 
1373  } // end for (all traj measurements of pixeltrack)
1374  } // end if (is pixeltrack)
1375  else {
1376  if (debug_)
1377  std::cout << "no pixeltrack:\n";
1378  if (crossesPixVol)
1379  meNofTracksInPixVol_->Fill(1, 1);
1380  }
1381 
1382  } // end loop on map entries
1383 
1384  } // end valid trajectory:
1385 
1386  // find clusters that are NOT on track
1387  // edmNew::DetSet<SiPixelCluster>::const_iterator di;
1388  if (debug_)
1389  std::cout << "clusters not on track: (size " << clustColl.size() << ") ";
1390 
1391  for (TrackerGeometry::DetContainer::const_iterator it = TG->dets().begin(); it != TG->dets().end(); it++) {
1392  // if(dynamic_cast<PixelGeomDetUnit const *>((*it))!=0){
1393  DetId detId = (*it)->geographicalId();
1394  if (detId >= 302055684 && detId <= 352477708) { // make sure it's a Pixel module WITHOUT using
1395  // dynamic_cast!
1396  int nofclOnTrack = 0, nofclOffTrack = 0;
1397  float z = 0.;
1398  edmNew::DetSetVector<SiPixelCluster>::const_iterator isearch = clustColl.find(detId);
1399  if (isearch != clustColl.end()) { // Not an empty iterator
1401  for (di = isearch->begin(); di != isearch->end(); di++) {
1402  unsigned int temp = clusterSet.size();
1403  clusterSet.insert(*di);
1404  // check if cluster is off track
1405  if (clusterSet.size() > temp) {
1406  otherclusters++;
1407  nofclOffTrack++;
1408  // fill histograms for clusters off tracks
1409  // correct SiPixelTrackResidualModule
1410  bool barrel = DetId(detId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
1411  if (barrel) {
1412  getrococcupancy(detId, diginp, tTopo, meZeroRocLadvsModOffTrackBarrel);
1413  }
1414 
1415  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd =
1416  theSiPixelStructure.find((*it)->geographicalId().rawId());
1417 
1418  if (pxd != theSiPixelStructure.end())
1419  (*pxd).second->fill((*di), false, -1., reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1420 
1421  meClSizeNotOnTrack_all->Fill((*di).size());
1422  meClSizeXNotOnTrack_all->Fill((*di).sizeX());
1423  meClSizeYNotOnTrack_all->Fill((*di).sizeY());
1424  meClChargeNotOnTrack_all->Fill((*di).charge() / 1000);
1425 
1427  // find cluster global position (rphi, z) get cluster
1428  // define tracker and pixel geometry and topology
1429  const TrackerGeometry &theTracker(*theTrackerGeometry);
1430  const PixelGeomDetUnit *theGeomDet = static_cast<const PixelGeomDetUnit *>(theTracker.idToDet(detId));
1431  // test if PixelGeomDetUnit exists
1432  if (theGeomDet == nullptr) {
1433  if (debug_)
1434  std::cout << "NO THEGEOMDET\n";
1435  continue;
1436  }
1437  const PixelTopology *topol = &(theGeomDet->specificTopology());
1438 
1439  // center of gravity (of charge)
1440  float xcenter = di->x();
1441  float ycenter = di->y();
1442  // get the cluster position in local coordinates (cm)
1443  LocalPoint clustlp = topol->localPosition(MeasurementPoint(xcenter, ycenter));
1444  // get the cluster position in global coordinates (cm)
1445  GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
1446 
1448 
1449  // barrel
1450  if (DetId(detId).subdetId() == 1) {
1451  meClSizeNotOnTrack_bpix->Fill((*di).size());
1452  meClSizeXNotOnTrack_bpix->Fill((*di).sizeX());
1453  meClSizeYNotOnTrack_bpix->Fill((*di).sizeY());
1454  meClChargeNotOnTrack_bpix->Fill((*di).charge() / 1000);
1455  barrelotherclusters++;
1456  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1457  float phi = clustgp.phi();
1458  // float r = clustgp.perp();
1459  z = clustgp.z();
1460  for (int i = 0; i < noOfLayers; i++) {
1461  if (DBlayer == i + 1) {
1462  meClPosLayersNotOnTrack.at(i)->Fill(z, phi);
1463  meClSizeNotOnTrack_layers.at(i)->Fill((*di).size());
1464  meClSizeXNotOnTrack_layers.at(i)->Fill((*di).sizeX());
1465  meClSizeYNotOnTrack_layers.at(i)->Fill((*di).sizeY());
1466  meClChargeNotOnTrack_layers.at(i)->Fill((*di).charge() / 1000);
1467  }
1468  }
1469  }
1470  // endcap
1471  if (DetId(detId).subdetId() == 2) {
1472  meClSizeNotOnTrack_fpix->Fill((*di).size());
1473  meClSizeXNotOnTrack_fpix->Fill((*di).sizeX());
1474  meClSizeYNotOnTrack_fpix->Fill((*di).sizeY());
1475  meClChargeNotOnTrack_fpix->Fill((*di).charge() / 1000);
1476  endcapotherclusters++;
1477  int DBdisk = PixelEndcapName(DetId(detId), tTopo, isUpgrade).diskName();
1478  float x = clustgp.x();
1479  float y = clustgp.y();
1480  z = clustgp.z();
1481 
1482  getepixrococcupancyofftrk(DetId(detId), tTopo, xcenter, ycenter, z, meRocBladevsDiskEndcapOffTrk);
1483 
1484  if (z > 0) {
1485  for (int i = 0; i < noOfDisks; i++) {
1486  if (DBdisk == i + 1) {
1487  meClPosDiskspzNotOnTrack.at(i)->Fill(x, y);
1488  meClSizeNotOnTrack_diskps.at(i)->Fill((*di).size());
1489  meClSizeXNotOnTrack_diskps.at(i)->Fill((*di).sizeX());
1490  meClSizeYNotOnTrack_diskps.at(i)->Fill((*di).sizeY());
1491  meClChargeNotOnTrack_diskps.at(i)->Fill((*di).charge() / 1000);
1492  }
1493  }
1494  } else {
1495  for (int i = 0; i < noOfDisks; i++) {
1496  if (DBdisk == i + 1) {
1497  meClPosDisksmzNotOnTrack.at(i)->Fill(x, y);
1498  meClSizeNotOnTrack_diskms.at(i)->Fill((*di).size());
1499  meClSizeXNotOnTrack_diskms.at(i)->Fill((*di).sizeX());
1500  meClSizeYNotOnTrack_diskms.at(i)->Fill((*di).sizeY());
1501  meClChargeNotOnTrack_diskms.at(i)->Fill((*di).charge() / 1000);
1502  }
1503  }
1504  }
1505  }
1506  } // end "if cluster off track"
1507  else {
1508  nofclOnTrack++;
1509  if (z == 0) {
1510  // find cluster global position (rphi, z) get cluster
1511  // define tracker and pixel geometry and topology
1512  const TrackerGeometry &theTracker(*theTrackerGeometry);
1513  const PixelGeomDetUnit *theGeomDet = static_cast<const PixelGeomDetUnit *>(theTracker.idToDet(detId));
1514  // test if PixelGeomDetUnit exists
1515  if (theGeomDet == nullptr) {
1516  if (debug_)
1517  std::cout << "NO THEGEOMDET\n";
1518  continue;
1519  }
1520  const PixelTopology *topol = &(theGeomDet->specificTopology());
1521  // center of gravity (of charge)
1522  float xcenter = di->x();
1523  float ycenter = di->y();
1524  // get the cluster position in local coordinates (cm)
1525  LocalPoint clustlp = topol->localPosition(MeasurementPoint(xcenter, ycenter));
1526  // get the cluster position in global coordinates (cm)
1527  GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
1528  z = clustgp.z();
1529  }
1530  }
1531  }
1532  }
1533  //++ fill the number of clusters on a module
1534  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd =
1535  theSiPixelStructure.find((*it)->geographicalId().rawId());
1536  if (pxd != theSiPixelStructure.end())
1537  (*pxd).second->nfill(
1538  nofclOnTrack, nofclOffTrack, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1539  if (nofclOnTrack != 0)
1540  meNClustersOnTrack_all->Fill(nofclOnTrack);
1541  if (nofclOffTrack != 0)
1542  meNClustersNotOnTrack_all->Fill(nofclOffTrack);
1543  // barrel
1544  if (DetId(detId).subdetId() == 1) {
1545  if (nofclOnTrack != 0)
1546  meNClustersOnTrack_bpix->Fill(nofclOnTrack);
1547  if (nofclOffTrack != 0)
1548  meNClustersNotOnTrack_bpix->Fill(nofclOffTrack);
1549  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1550  for (int i = 0; i < noOfLayers; i++) {
1551  if (DBlayer == i + 1) {
1552  if (nofclOnTrack != 0)
1553  meNClustersOnTrack_layers.at(i)->Fill(nofclOnTrack);
1554  if (nofclOffTrack != 0)
1555  meNClustersNotOnTrack_layers.at(i)->Fill(nofclOffTrack);
1556  }
1557  }
1558  } // end barrel
1559  // endcap
1560  if (DetId(detId).subdetId() == 2) {
1561  int DBdisk = PixelEndcapName(DetId(detId)).diskName();
1562  // z = clustgp.z();
1563  if (nofclOnTrack != 0)
1564  meNClustersOnTrack_fpix->Fill(nofclOnTrack);
1565  if (nofclOffTrack != 0)
1566  meNClustersNotOnTrack_fpix->Fill(nofclOffTrack);
1567  if (z > 0) {
1568  for (int i = 0; i < noOfDisks; i++) {
1569  if (DBdisk == i + 1) {
1570  if (nofclOnTrack != 0)
1571  meNClustersOnTrack_diskps.at(i)->Fill(nofclOnTrack);
1572  if (nofclOffTrack != 0)
1573  meNClustersNotOnTrack_diskps.at(i)->Fill(nofclOffTrack);
1574  }
1575  }
1576  }
1577  if (z < 0) {
1578  for (int i = 0; i < noOfDisks; i++) {
1579  if (DBdisk == i + 1) {
1580  if (nofclOnTrack != 0)
1581  meNClustersOnTrack_diskms.at(i)->Fill(nofclOnTrack);
1582  if (nofclOffTrack != 0)
1583  meNClustersNotOnTrack_diskms.at(i)->Fill(nofclOffTrack);
1584  }
1585  }
1586  }
1587  }
1588 
1589  } // end if it's a Pixel module
1590  } // end for loop over tracker detector geometry modules
1591 
1592  if (trackclusters > 0)
1593  (meNofClustersOnTrack_)->Fill(0, trackclusters);
1594  if (barreltrackclusters > 0)
1595  (meNofClustersOnTrack_)->Fill(1, barreltrackclusters);
1596  if (endcaptrackclusters > 0)
1597  (meNofClustersOnTrack_)->Fill(2, endcaptrackclusters);
1598  if (otherclusters > 0)
1599  (meNofClustersNotOnTrack_)->Fill(0, otherclusters);
1600  if (barrelotherclusters > 0)
1601  (meNofClustersNotOnTrack_)->Fill(1, barrelotherclusters);
1602  if (endcapotherclusters > 0)
1603  (meNofClustersNotOnTrack_)->Fill(2, endcapotherclusters);
1604  if (tracks > 0)
1605  (meNofTracks_)->Fill(0, tracks);
1606  if (pixeltracks > 0)
1607  (meNofTracks_)->Fill(1, pixeltracks);
1608  if (bpixtracks > 0)
1609  (meNofTracks_)->Fill(2, bpixtracks);
1610  if (fpixtracks > 0)
1611  (meNofTracks_)->Fill(3, fpixtracks);
1612 }
1613 
1615  const edm::DetSetVector<PixelDigi> &diginp,
1616  const TrackerTopology *tTopo,
1617  std::vector<MonitorElement *> meinput) {
1618  edm::DetSetVector<PixelDigi>::const_iterator ipxsearch = diginp.find(detId);
1619  if (ipxsearch != diginp.end()) {
1620  // Look at digis now
1622  for (pxdi = ipxsearch->begin(); pxdi != ipxsearch->end(); pxdi++) {
1623  bool isHalfModule = PixelBarrelName(DetId(detId), tTopo, isUpgrade).isHalfModule();
1624  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1625  int DBmodule = PixelBarrelName(DetId(detId), tTopo, isUpgrade).moduleName();
1626  int DBladder = PixelBarrelName(DetId(detId), tTopo, isUpgrade).ladderName();
1627  int DBshell = PixelBarrelName(DetId(detId), tTopo, isUpgrade).shell();
1628 
1629  // add sign to the modules
1630  if (DBshell == 1 || DBshell == 2) {
1631  DBmodule = -DBmodule;
1632  }
1633  if (DBshell == 1 || DBshell == 3) {
1634  DBladder = -DBladder;
1635  }
1636 
1637  int col = pxdi->column();
1638  int row = pxdi->row();
1639 
1640  float modsign = (float)DBmodule / (abs((float)DBmodule));
1641  float ladsign = (float)DBladder / (abs((float)DBladder));
1642  float rocx = ((float)col / (52. * 8.)) * modsign + ((float)DBmodule - (modsign)*0.5);
1643  float rocy = ((float)row / (80. * 2.)) * ladsign + ((float)DBladder - (ladsign)*0.5);
1644 
1645  // do the flip where need
1646  bool flip = false;
1647  if ((DBladder % 2 == 0) && (!isHalfModule)) {
1648  flip = true;
1649  }
1650  if ((flip) && (DBladder > 0)) {
1651  if ((((float)DBladder - (ladsign)*0.5) <= rocy) && (rocy < (float)DBladder)) {
1652  rocy = rocy + ladsign * 0.5;
1653  } else if ((((float)DBladder) <= rocy) && (rocy < ((float)DBladder + (ladsign)*0.5))) {
1654  rocy = rocy - ladsign * 0.5;
1655  }
1656  }
1657 
1658  // tweak border effect for negative modules/ladders
1659  if (modsign < 0) {
1660  rocx = rocx - 0.0001;
1661  }
1662  if (ladsign < 0) {
1663  rocy = rocy - 0.0001;
1664  } else {
1665  rocy = rocy + 0.0001;
1666  }
1667  if (abs(DBladder) == 1) {
1668  rocy = rocy + ladsign * 0.5;
1669  } // take care of the half module
1670 
1671  if (DBlayer == 1) {
1672  meinput.at(0)->Fill(rocx, rocy);
1673  }
1674  if (DBlayer == 2) {
1675  meinput.at(1)->Fill(rocx, rocy);
1676  }
1677  if (DBlayer == 3) {
1678  meinput.at(2)->Fill(rocx, rocy);
1679  }
1680  } // end of looping over pxdi
1681  }
1682 }
1683 
1685  double y1,
1686  double z1,
1687  double x2,
1688  double y2,
1689  double z2,
1690  double x3,
1691  double y3,
1692  double z3,
1693  double ptsig,
1694  double &dca2,
1695  double &dz2,
1696  double kap) {
1697  // Define some constants
1698  using namespace std;
1699 
1700  // Curvature kap from global Track
1701 
1702  // inverse of the curvature is the radius in the transverse plane
1703  double rho = 1 / kap;
1704  // Check that the hits are in the correct layers
1705  double r1 = sqrt(x1 * x1 + y1 * y1);
1706  double r3 = sqrt(x3 * x3 + y3 * y3);
1707 
1708  if (r3 - r1 < 2.0)
1709  cout << "warn r1 = " << r1 << ", r3 = " << r3 << endl;
1710 
1711  // Calculate the centre of the helix in xy-projection with radius rho from the
1712  // track.
1713  // start with a line (sekante) connecting the two points (x1,y1) and (x3,y3)
1714  // vec_L = vec_x3-vec_x1 with L being the length of that vector.
1715  double L = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
1716  // lam is the line from the middel point of vec_q towards the center of the
1717  // circle X0,Y0
1718  // we already have kap and rho = 1/kap
1719  double lam = sqrt(rho * rho - L * L / 4);
1720 
1721  // There are two solutions, the sign of kap gives the information
1722  // which of them is correct.
1723  //
1724  if (kap > 0)
1725  lam = -lam;
1726 
1727  //
1728  // ( X0, Y0 ) is the centre of the circle that describes the helix in
1729  // xy-projection.
1730  //
1731  double x0 = 0.5 * (x1 + x3) + lam / L * (-y1 + y3);
1732  double y0 = 0.5 * (y1 + y3) + lam / L * (x1 - x3);
1733 
1734  // Calculate the dipangle in z direction (needed later for z residual) :
1735  // Starting from the heliz equation whihc has to hold for both points z1,z3
1736  double num = (y3 - y0) * (x1 - x0) - (x3 - x0) * (y1 - y0);
1737  double den = (x1 - x0) * (x3 - x0) + (y1 - y0) * (y3 - y0);
1738  double tandip = kap * (z3 - z1) / atan(num / den);
1739 
1740  // angle from first hit to dca point:
1741  //
1742  double dphi = atan(((x1 - x0) * y0 - (y1 - y0) * x0) / ((x1 - x0) * x0 + (y1 - y0) * y0));
1743  // z position of the track based on the middle of the circle
1744  // track equation for the z component
1745  double uz0 = z1 + tandip * dphi * rho;
1746 
1748  // RESIDUAL IN R-PHI
1750  // Calculate distance dca2 from point (x2,y2) to the circle which is given by
1751  // the distance of the point to the middlepoint dcM = sqrt((x0-x2)^2+(y0-y2))
1752  // and rho dca = rho +- dcM
1753  if (kap > 0)
1754  dca2 = rho - sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2));
1755  else
1756  dca2 = rho + sqrt((-x0 + x2) * (-x0 + x2) + (-y0 + y2) * (-y0 + y2));
1757 
1759  // RESIDUAL IN Z
1761  double xx = 0;
1762  double yy = 0;
1763  // sign of kappa determines the calculation
1764  // xx and yy are the new coordinates starting from x2, y2 that are on the
1765  // track itself vec_X2+-dca2*vec(X0-X2)/|(X0-X2)|
1766  if (kap < 0) {
1767  xx = x2 + (dca2 * ((x0 - x2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1768  yy = y2 + (dca2 * ((y0 - y2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1769  } else if (kap >= 0) {
1770  xx = x2 - (dca2 * ((x0 - x2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1771  yy = y2 - (dca2 * ((y0 - y2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1772  }
1773 
1774  // to get residual in z start with calculating the new uz2 position if one has
1775  // moved to xx, yy on the track. First calculate the change in phi2 with
1776  // respect to the center X0, Y0
1777  double dphi2 = atan(((xx - x0) * y0 - (yy - y0) * x0) / ((xx - x0) * x0 + (yy - y0) * y0));
1778  // Solve track equation for this new z depending on the dip angle of the track
1779  // (see above calculated based on X1, X3 and X0, use uz0 as reference point
1780  // again.
1781  double uz2 = uz0 - dphi2 * tandip * rho;
1782 
1783  // subtract new z position from the old one
1784  dz2 = z2 - uz2;
1785 
1786  // if we are interested in the arclength this is unsigned though
1787  // double cosphi2 = (x2*xx+y2*yy)/(sqrt(x2*x2+y2*y2)*sqrt(xx*xx+yy*yy));
1788  // double arcdca2=sqrt(x2*x2+y2*y2)*acos(cosphi2);
1789 }
1790 
1793  float xclust,
1794  float yclust,
1795  float z,
1796  MonitorElement *meinput) {
1797  int pxfpanel = tTopo->pxfPanel((*hit).geographicalId());
1798  int pxfmodule = tTopo->pxfModule((*hit).geographicalId());
1799  int pxfdisk = tTopo->pxfDisk((*hit).geographicalId());
1800  int pxfblade_off = tTopo->pxfBlade((*hit).geographicalId());
1801 
1802  // translate to online conventions
1803  // each EPIX disk is split in 2 half-disk - each one consists of 12 blades
1804  // in offline: blades num 0->24; here translate numbering to online convetion
1805  // positive blades pointing to beam; negative pointing away
1806  // each blade has two panels: each consisting of an array of ROC plaquettes
1807  // front (rear) pannel: 3 (4) plaquettes
1808  // number of ROCs in each plaquette depends on the position on the panel
1809  // each ROC has 80x52 pixel cells
1810  if (z < 0.) {
1811  pxfdisk = -1. * pxfdisk;
1812  }
1813  int pxfblade = -99;
1814  if (pxfblade_off <= 6 && pxfblade_off >= 1) {
1815  pxfblade = 7 - pxfblade_off;
1816  } else if (pxfblade_off <= 18 && pxfblade_off >= 7) {
1817  pxfblade = 6 - pxfblade_off;
1818  } else if (pxfblade_off <= 24 && pxfblade_off >= 19) {
1819  pxfblade = 31 - pxfblade_off;
1820  }
1821 
1822  int clu_sdpx = ((pxfdisk > 0) ? 1 : -1) * (2 * (abs(pxfdisk) - 1) + pxfpanel);
1823  int binselx = (pxfpanel == 1 && (pxfmodule == 1 || pxfmodule == 4))
1824  ? (pxfmodule == 1)
1825  : ((pxfpanel == 1 && xclust < 80.0) || (pxfpanel == 2 && xclust >= 80.0));
1826  int nperpan = 2 * pxfmodule + pxfpanel - 1 + binselx;
1827  int clu_roc_binx =
1828  ((pxfdisk > 0) ? nperpan : 9 - nperpan) + (clu_sdpx + 4) * 8 - 2 * ((abs(pxfdisk) == 1) ? pxfdisk : 0);
1829 
1830  int clu_roc_biny = -99.;
1831  int nrocly = pxfmodule + pxfpanel;
1832  for (int i = 0; i < nrocly; i++) {
1833  int j = (pxfdisk < 0) ? i : nrocly - 1 - i;
1834  if (yclust >= (j * 52.0) && yclust < ((j + 1) * 52.0))
1835  clu_roc_biny = 6 - nrocly + 2 * i + ((pxfblade > 0) ? pxfblade - 1 : pxfblade + 12) * 12 + 1;
1836  }
1837  if (pxfblade > 0) {
1838  clu_roc_biny = clu_roc_biny + 144;
1839  }
1840 
1841  meinput->setBinContent(clu_roc_binx, clu_roc_biny, meinput->getBinContent(clu_roc_binx, clu_roc_biny) + 1);
1842  meinput->setBinContent(clu_roc_binx, clu_roc_biny + 1, meinput->getBinContent(clu_roc_binx, clu_roc_biny + 1) + 1);
1843 }
1844 
1846  DetId detId, const TrackerTopology *tTopo, float xclust, float yclust, float z, MonitorElement *meinput) {
1847  PXFDetId pxfid = PXFDetId(detId);
1848 
1849  // int pxfside = PixelEndcapName(detId,tTopo,isUpgrade).halfCylinder();
1850  int pxfpanel = pxfid.panel();
1851  int pxfmodule = pxfid.module();
1852  int pxfdisk = pxfid.disk();
1853  int pxfblade_off = pxfid.blade();
1854 
1855  if (z < 0.) {
1856  pxfdisk = -1. * pxfdisk;
1857  }
1858 
1859  int pxfblade = -99;
1860  if (pxfblade_off <= 6 && pxfblade_off >= 1) {
1861  pxfblade = 7 - pxfblade_off;
1862  } else if (pxfblade_off <= 18 && pxfblade_off >= 7) {
1863  pxfblade = 6 - pxfblade_off;
1864  } else if (pxfblade_off <= 24 && pxfblade_off >= 19) {
1865  pxfblade = 31 - pxfblade_off;
1866  }
1867 
1868  int clu_sdpx = ((pxfdisk > 0) ? 1 : -1) * (2 * (abs(pxfdisk) - 1) + pxfpanel);
1869  int binselx = (pxfpanel == 1 && (pxfmodule == 1 || pxfmodule == 4))
1870  ? (pxfmodule == 1)
1871  : ((pxfpanel == 1 && xclust < 80.0) || (pxfpanel == 2 && xclust >= 80.0));
1872  int nperpan = 2 * pxfmodule + pxfpanel - 1 + binselx;
1873  int clu_roc_binx =
1874  ((pxfdisk > 0) ? nperpan : 9 - nperpan) + (clu_sdpx + 4) * 8 - 2 * ((abs(pxfdisk) == 1) ? pxfdisk : 0);
1875 
1876  int clu_roc_biny = -99.;
1877  int nrocly = pxfmodule + pxfpanel;
1878  for (int i = 0; i < nrocly; i++) {
1879  int j = (pxfdisk < 0) ? i : nrocly - 1 - i;
1880  if (yclust >= (j * 52.0) && yclust < ((j + 1) * 52.0))
1881  clu_roc_biny = 6 - nrocly + 2 * i + ((pxfblade > 0) ? pxfblade - 1 : pxfblade + 12) * 12 + 1;
1882  }
1883  if (pxfblade > 0) {
1884  clu_roc_biny = clu_roc_biny + 144;
1885  }
1886 
1887  meinput->setBinContent(clu_roc_binx, clu_roc_biny, meinput->getBinContent(clu_roc_binx, clu_roc_biny) + 1);
1888  meinput->setBinContent(clu_roc_binx, clu_roc_biny + 1, meinput->getBinContent(clu_roc_binx, clu_roc_biny + 1) + 1);
1889 }
1890 
1891 DEFINE_FWK_MODULE(SiPixelTrackResidualSource); // define this as a plug-in
std::vector< MonitorElement * > meClSizeYNotOnTrack_diskms
std::vector< MonitorElement * > meNofClustersvsPhiOnTrack_diskms
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > generalTracksToken_
double z0() const
z coordinate
Definition: BeamSpot.h:65
T getUntrackedParameter(std::string const &, T const &) const
std::vector< MonitorElement * > meClChargeNotOnTrack_diskps
bool hasFilledProb() const
unsigned int panel() const
panel id
Definition: PXFDetId.h:41
const_iterator end(bool update=false) const
std::vector< MonitorElement * > meClPosDisksmzNotOnTrack
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
float clusterProbability(unsigned int flags=0) const
Definition: SiPixelRecHit.cc:9
T y() const
Definition: PV2DBase.h:44
iterator find(det_id_type id)
Definition: DetSetVector.h:264
std::map< uint32_t, SiPixelTrackResidualModule * > theSiPixelStructure
std::vector< MonitorElement * > meClPosLayersLadVsModOnTrack
edm::EDGetTokenT< std::vector< Trajectory > > tracksrcToken_
std::vector< MonitorElement * > meClChargeNotOnTrack_layers
const LocalTrajectoryParameters & localParameters() const
std::vector< MonitorElement * > meClChargeOnTrack_layers
int moduleName() const
module id (index in z)
std::vector< MonitorElement * > meClChargeNotOnTrack_diskms
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
unsigned int pxfDisk(const DetId &id) const
std::vector< MonitorElement * > meClSizeOnTrack_layers
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
std::vector< MonitorElement * > meClSizeXNotOnTrack_diskms
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
reco::TransientTrack build(const reco::Track *p) const
T y() const
Definition: PV3DBase.h:60
std::vector< MonitorElement * > meClSizeNotOnTrack_diskms
data_type const * const_iterator
Definition: DetSetNew.h:31
key_type key() const
Accessor for product key.
Definition: Ref.h:250
std::vector< MonitorElement * > meClSizeXOnTrack_diskps
std::vector< MonitorElement * > meClPosLayersNotOnTrack
std::vector< MonitorElement * > meClPosDiskspzNotOnTrack
std::vector< MonitorElement * > meClSizeYNotOnTrack_diskps
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
SiPixelTrackResidualSource(const edm::ParameterSet &)
TrajectoryStateOnSurface innermostMeasurementState() const
std::vector< MonitorElement * > meClPosDisksmzOnTrack
std::vector< MonitorElement * > meClSizeXOnTrack_layers
unsigned int blade() const
blade id
Definition: PXFDetId.h:38
void Fill(long long x)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< MonitorElement * > meNClustersOnTrack_layers
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
std::vector< MonitorElement * > meNofClustersvsPhiOnTrack_layers
void getepixrococcupancyontrk(const TrackerTopology *const tTopo, TransientTrackingRecHit::ConstRecHitPointer hit, float xclust, float yclust, float z, MonitorElement *meinput)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
T mag() const
Definition: PV3DBase.h:64
bool isHalfModule() const
full or half module
std::vector< MonitorElement * > meZeroRocLadvsModOffTrackBarrel
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< MonitorElement * > meClSizeYOnTrack_diskps
T sqrt(T t)
Definition: SSEVec.h:19
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0, bool isUpgrade=false)
Set folder name for a module or plaquette.
std::vector< MonitorElement * > meClChargeOnTrack_diskps
std::vector< MonitorElement * > meNClustersOnTrack_diskms
T z() const
Definition: PV3DBase.h:61
void triplets(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double ptsig, double &dc, double &dz, double kap)
const DetContainer & detsPXB() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< MonitorElement * > meResidualYSummedLay
std::vector< MonitorElement * > meClPosLayersOnTrack
unsigned int module() const
det id
Definition: PXFDetId.h:44
LocalVector momentum() const
Momentum vector in the local frame.
std::vector< MonitorElement * > meClPosDiskspzOnTrack
edm::EDGetTokenT< std::vector< reco::Track > > trackToken_
bool isValid() const
Definition: HandleBase.h:70
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
virtual double getBinContent(int binx) const
get content of bin (1-D)
char const * module
Definition: ProductLabels.h:5
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clustersrcToken_
std::vector< MonitorElement * > meClSizeXNotOnTrack_layers
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
unsigned int disk() const
disk id
Definition: PXFDetId.h:35
void getepixrococcupancyofftrk(DetId detId, const TrackerTopology *const tTopo, float xclust, float yclust, float z, MonitorElement *meinput)
std::shared_ptr< TrackingRecHit const > RecHitPointer
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
double ndof() const
Definition: Vertex.h:109
unsigned int pxfModule(const DetId &id) const
std::vector< MonitorElement * > meClSizeYOnTrack_layers
std::vector< MonitorElement * > meClChargeOnTrack_diskms
unsigned int pxbLayer(const DetId &id) const
FreeTrajectoryState initialFreeState() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
bool failedToGet() const
Definition: HandleBase.h:72
Definition: DetId.h:17
virtual TrackingRecHit const * hit() const
int ladderName() const
ladder id (index in phi)
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > digisrcToken_
std::vector< MonitorElement * > meNClustersNotOnTrack_layers
T const * product() const
Definition: Handle.h:69
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< MonitorElement * > meZeroRocLadvsModOnTrackBarrel
void getrococcupancy(DetId detId, const edm::DetSetVector< PixelDigi > &diginp, const TrackerTopology *const tTopo, std::vector< MonitorElement * > meinput)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< MonitorElement * > meNofClustersvsPhiOnTrack_diskps
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
int layerName() const
layer id
edm::EDGetTokenT< reco::VertexCollection > offlinePrimaryVerticesToken_
std::vector< MonitorElement * > meNClustersOnTrack_diskps
Shell shell() const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
double transverseCurvature() const
std::vector< MonitorElement * > meClSizeYOnTrack_diskms
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
std::string const & label() const
Definition: InputTag.h:36
Pixel cluster – collection of neighboring pixels above threshold.
HLT enums.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
std::vector< MonitorElement * > meClSizeOnTrack_diskps
T get() const
Definition: EventSetup.h:73
const DetContainer & detsPXF() const
col
Definition: cuy.py:1010
const TrackerGeomDet * idToDet(DetId) const override
double y0() const
y coordinate
Definition: BeamSpot.h:63
std::vector< MonitorElement * > meClSizeXNotOnTrack_diskps
std::vector< MonitorElement * > meNClustersNotOnTrack_diskms
int diskName() const
disk id
Definition: shell.py:1
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
void dqmBeginRun(const edm::Run &r, edm::EventSetup const &iSetup) override
std::vector< MonitorElement * > meClSizeYNotOnTrack_layers
std::vector< MonitorElement * > meResidualXSummedLay
std::vector< MonitorElement * > meNClustersNotOnTrack_diskps
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
bool isValid() const
Definition: ESHandle.h:44
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
T x() const
Definition: PV2DBase.h:43
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
T x() const
Definition: PV3DBase.h:59
modOn
online/offline RawDataErrors
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:198
std::vector< MonitorElement * > meClSizeNotOnTrack_diskps
std::vector< MonitorElement * > meClSizeOnTrack_diskms
edm::EDGetTokenT< TrajTrackAssociationCollection > trackAssociationToken_
std::vector< MonitorElement * > meClSizeNotOnTrack_layers
int layerName() const
layer id
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
const_iterator begin(bool update=false) const
std::vector< MonitorElement * > meClSizeXOnTrack_diskms
Definition: Run.h:45
Our base class.
Definition: SiPixelRecHit.h:23
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
double x0() const
x coordinate
Definition: BeamSpot.h:61
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)