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