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  //----------------------------------------------------------------------------
912  // Residuals:
913  //
914  for (reco::TrackCollection::const_iterator iTrack = TracksForRes->begin(); iTrack != TracksForRes->end(); ++iTrack) {
915  // count
916  // Calculate minimal track pt before curling
917  // cpt = cqRB = 0.3*R[m]*B[T] = 1.14*R[m] for B=3.8T
918  // D = 2R = 2*pt/1.14
919  // calo: D = 1.3 m => pt = 0.74 GeV/c
920  double pt = iTrack->pt();
921  if (pt < 0.75)
922  continue; // curls up
923  if (abs(iTrack->dxy(vtxP)) > 5 * iTrack->dxyError())
924  continue; // not prompt
925 
926  double charge = iTrack->charge();
927 
928  reco::TransientTrack tTrack = theB->build(*iTrack);
929  // get curvature of the track, needed for the residuals
930  double kap = tTrack.initialFreeState().transverseCurvature();
931  // needed for the TransienTrackingRecHitBuilder
933  if (iTrack->extra().isNonnull() && iTrack->extra().isAvailable()) {
934  double x1 = 0;
935  double y1 = 0;
936  double z1 = 0;
937  double x2 = 0;
938  double y2 = 0;
939  double z2 = 0;
940  double x3 = 0;
941  double y3 = 0;
942  double z3 = 0;
943  int n1 = 0;
944  int n2 = 0;
945  int n3 = 0;
946 
947  // for saving the pixel barrel hits
948  vector<TransientTrackingRecHit::RecHitPointer> GoodPixBarrelHits;
949  // looping through the RecHits of the track
950  for (trackingRecHit_iterator irecHit = iTrack->recHitsBegin(); irecHit != iTrack->recHitsEnd(); ++irecHit) {
951  if ((*irecHit)->isValid()) {
952  DetId detId = (*irecHit)->geographicalId();
953  // enum Detector { Tracker=1, Muon=2, Ecal=3, Hcal=4, Calo=5 };
954  if (detId.det() != 1) {
955  if (debug_) {
956  cout << "rec hit ID = " << detId.det() << " not in tracker!?!?\n";
957  }
958  continue;
959  }
960  uint32_t subDet = detId.subdetId();
961 
962  // enum SubDetector{ PixelBarrel=1, PixelEndcap=2 };
963  // enum SubDetector{ TIB=3, TID=4, TOB=5, TEC=6 };
964 
965  TransientTrackingRecHit::RecHitPointer trecHit = theTrackerRecHitBuilder->build(&*(*irecHit), initialTSOS);
966 
967  double gX = trecHit->globalPosition().x();
968  double gY = trecHit->globalPosition().y();
969  double gZ = trecHit->globalPosition().z();
970 
971  if (subDet == PixelSubdetector::PixelBarrel) {
972  int ilay = tTopo->pxbLayer(detId);
973 
974  if (ilay == 1) {
975  n1++;
976  x1 = gX;
977  y1 = gY;
978  z1 = gZ;
979 
980  GoodPixBarrelHits.push_back((trecHit));
981  } // PXB1
982  if (ilay == 2) {
983  n2++;
984  x2 = gX;
985  y2 = gY;
986  z2 = gZ;
987 
988  GoodPixBarrelHits.push_back((trecHit));
989 
990  } // PXB2
991  if (ilay == 3) {
992  n3++;
993  x3 = gX;
994  y3 = gY;
995  z3 = gZ;
996  GoodPixBarrelHits.push_back((trecHit));
997  }
998  } // PXB
999 
1000  } // valid
1001  } // loop rechits
1002 
1003  // CS extra plots
1004 
1005  if (n1 + n2 + n3 == 3 && n1 * n2 * n3 > 0) {
1006  for (unsigned int i = 0; i < GoodPixBarrelHits.size(); i++) {
1007  if (GoodPixBarrelHits[i]->isValid()) {
1008  DetId detId = GoodPixBarrelHits[i]->geographicalId().rawId();
1009  int ilay = tTopo->pxbLayer(detId);
1010  if (pt > ptminres_) {
1011  double dca2 = 0.0, dz2 = 0.0;
1012  double ptsig = pt;
1013  if (charge < 0.)
1014  ptsig = -pt;
1015  // Filling the histograms in modules
1016 
1017  MeasurementPoint Test;
1018  MeasurementPoint Test2;
1019  Test = MeasurementPoint(0, 0);
1020  Test2 = MeasurementPoint(0, 0);
1021  Measurement2DVector residual;
1022 
1023  if (ilay == 1) {
1024  triplets(x2, y2, z2, x1, y1, z1, x3, y3, z3, ptsig, dca2, dz2, kap);
1025 
1026  Test = MeasurementPoint(dca2 * 1E4, dz2 * 1E4);
1027  residual = Test - Test2;
1028  }
1029 
1030  if (ilay == 2) {
1031  triplets(x1, y1, z1, x2, y2, z2, x3, y3, z3, ptsig, dca2, dz2, kap);
1032 
1033  Test = MeasurementPoint(dca2 * 1E4, dz2 * 1E4);
1034  residual = Test - Test2;
1035  }
1036 
1037  if (ilay == 3) {
1038  triplets(x1, y1, z1, x3, y3, z3, x2, y2, z2, ptsig, dca2, dz2, kap);
1039 
1040  Test = MeasurementPoint(dca2 * 1E4, dz2 * 1E4);
1041  residual = Test - Test2;
1042  }
1043  // fill the residual histograms
1044 
1045  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd = theSiPixelStructure.find(detId);
1046  if (pxd != theSiPixelStructure.end())
1047  (*pxd).second->fill(residual, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1048 
1049  if (ladOn && pxd != theSiPixelStructure.end()) {
1050  meResidualXSummedLay.at(PixelBarrelNameUpgrade((*pxd).first).layerName() - 1)->Fill(residual.x());
1051  meResidualYSummedLay.at(PixelBarrelNameUpgrade((*pxd).first).layerName() - 1)->Fill(residual.y());
1052  }
1053 
1054  } // three hits
1055  } // is valid
1056  } // rechits loop
1057  } // pt 4
1058  }
1059 
1060  } //-----Tracks
1062  // get tracks
1063  edm::Handle<std::vector<reco::Track>> trackCollectionHandle;
1064  // iEvent.getByLabel(tracksrc_,trackCollectionHandle);
1065  iEvent.getByToken(trackToken_, trackCollectionHandle);
1066  auto const &trackColl = *(trackCollectionHandle.product());
1067 
1068  // get clusters
1070  // iEvent.getByLabel( clustersrc_, clusterColl );
1071  iEvent.getByToken(clustersrcToken_, clusterColl);
1072  auto const &clustColl = *(clusterColl.product());
1073 
1074  // get digis
1076  iEvent.getByToken(digisrcToken_, digiinput);
1077  edm::DetSetVector<PixelDigi> const &diginp = *(digiinput.product());
1078 
1079  std::set<SiPixelCluster> clusterSet;
1080  TrajectoryStateCombiner tsoscomb;
1081  int tracks = 0, pixeltracks = 0, bpixtracks = 0, fpixtracks = 0;
1082  int trackclusters = 0, barreltrackclusters = 0, endcaptrackclusters = 0;
1083  int otherclusters = 0, barrelotherclusters = 0, endcapotherclusters = 0;
1084 
1085  // get trajectories
1086  edm::Handle<std::vector<Trajectory>> trajCollectionHandle;
1087  iEvent.getByToken(tracksrcToken_, trajCollectionHandle);
1088 
1089  if (debug_) {
1091  labelsForToken(tracksrcToken_, labels);
1092  std::cout << "Trajectories for Res from " << labels.module << std::endl;
1093  }
1094 
1095  if (trajCollectionHandle.isValid()) {
1096  auto const &trajColl = *(trajCollectionHandle.product());
1097  // get the map
1099  iEvent.getByToken(trackAssociationToken_, match);
1100  auto const &ttac = *(match.product());
1101 
1102  if (debug_) {
1103  std::cout << "Trajectories\t : " << trajColl.size() << std::endl;
1104  std::cout << "recoTracks \t : " << trackColl.size() << std::endl;
1105  std::cout << "Map entries \t : " << ttac.size() << std::endl;
1106  }
1107 
1108  // Loop over map entries
1109  for (TrajTrackAssociationCollection::const_iterator it = ttac.begin(); it != ttac.end(); ++it) {
1110  const edm::Ref<std::vector<Trajectory>> traj_iterator = it->key;
1111  // Trajectory Map, extract Trajectory for this track
1112  reco::TrackRef trackref = it->val;
1113  tracks++;
1114 
1115  bool isBpixtrack = false, isFpixtrack = false, crossesPixVol = false;
1116 
1117  // find out whether track crosses pixel fiducial volume (for cosmic
1118  // tracks)
1119 
1120  double d0 = (*trackref).d0(), dz = (*trackref).dz();
1121 
1122  if (abs(d0) < 15 && abs(dz) < 50)
1123  crossesPixVol = true;
1124 
1125  const std::vector<TrajectoryMeasurement> &tmeasColl = traj_iterator->measurements();
1126  std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
1127  // loop on measurements to find out whether there are bpix and/or fpix
1128  // hits
1129  for (tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end(); tmeasIt++) {
1130  if (!tmeasIt->updatedState().isValid())
1131  continue;
1132  TransientTrackingRecHit::ConstRecHitPointer testhit = tmeasIt->recHit();
1133  if (!testhit->isValid() || testhit->geographicalId().det() != DetId::Tracker)
1134  continue;
1135  uint testSubDetID = (testhit->geographicalId().subdetId());
1136  if (testSubDetID == PixelSubdetector::PixelBarrel)
1137  isBpixtrack = true;
1138  if (testSubDetID == PixelSubdetector::PixelEndcap)
1139  isFpixtrack = true;
1140  } // end loop on measurements
1141  if (isBpixtrack) {
1142  bpixtracks++;
1143  if (debug_)
1144  std::cout << "bpixtrack\n";
1145  }
1146  if (isFpixtrack) {
1147  fpixtracks++;
1148  if (debug_)
1149  std::cout << "fpixtrack\n";
1150  }
1151  if (isBpixtrack || isFpixtrack) {
1152  pixeltracks++;
1153 
1154  if (crossesPixVol)
1155  meNofTracksInPixVol_->Fill(0, 1);
1156 
1157  const std::vector<TrajectoryMeasurement> &tmeasColl = traj_iterator->measurements();
1158  for (std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt != tmeasColl.end();
1159  tmeasIt++) {
1160  if (!tmeasIt->updatedState().isValid())
1161  continue;
1162 
1163  TrajectoryStateOnSurface tsos = tsoscomb(tmeasIt->forwardPredictedState(), tmeasIt->backwardPredictedState());
1164  if (!tsos.isValid())
1165  continue; // Happens rarely, due to singular matrix or similar
1166 
1168  if (!hit->isValid() || hit->geographicalId().det() != DetId::Tracker) {
1169  continue;
1170  } else {
1171  // //residual
1172  const DetId &hit_detId = hit->geographicalId();
1173  // uint IntRawDetID = (hit_detId.rawId());
1174  uint IntSubDetID = (hit_detId.subdetId());
1175 
1176  if (IntSubDetID == 0)
1177  continue; // don't look at SiStrip hits!
1178 
1179  // get the enclosed persistent hit
1180  const TrackingRecHit *persistentHit = hit->hit();
1181  // check if it's not null, and if it's a valid pixel hit
1182  if ((persistentHit != nullptr) && (typeid(*persistentHit) == typeid(SiPixelRecHit))) {
1183  // tell the C++ compiler that the hit is a pixel hit
1184  const SiPixelRecHit *pixhit = static_cast<const SiPixelRecHit *>(hit->hit());
1185  // Hit probability:
1186  float hit_prob = -1.;
1187  if (pixhit->hasFilledProb()) {
1188  hit_prob = pixhit->clusterProbability(0);
1189  // std::cout<<"HITPROB= "<<hit_prob<<std::endl;
1190  if (hit_prob < pow(10., -15.))
1191  NLowProb++;
1192  NTotal++;
1193  if (NTotal > 0)
1194  meHitProbability->Fill(float(NLowProb / NTotal));
1195  }
1196 
1197  // get the edm::Ref to the cluster
1198  edm::Ref<edmNew::DetSetVector<SiPixelCluster>, SiPixelCluster> const &clust = (*pixhit).cluster();
1199 
1200  // check if the ref is not null
1201  if (clust.isNonnull()) {
1202  // define tracker and pixel geometry and topology
1203  const TrackerGeometry &theTracker(*theTrackerGeometry);
1204  const PixelGeomDetUnit *theGeomDet =
1205  static_cast<const PixelGeomDetUnit *>(theTracker.idToDet(hit_detId));
1206 
1207  // test if PixelGeomDetUnit exists
1208  if (theGeomDet == nullptr) {
1209  if (debug_)
1210  std::cout << "NO THEGEOMDET\n";
1211  continue;
1212  }
1213 
1214  const PixelTopology *topol = &(theGeomDet->specificTopology());
1215  // fill histograms for clusters on tracks
1216  // correct SiPixelTrackResidualModule
1217  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd =
1218  theSiPixelStructure.find((*hit).geographicalId().rawId());
1219 
1220  // CHARGE CORRECTION (for track impact angle)
1221  // calculate alpha and beta from cluster position
1223  LocalVector localDir = ltp.momentum() / ltp.momentum().mag();
1224 
1225  float clust_alpha = atan2(localDir.z(), localDir.x());
1226  float clust_beta = atan2(localDir.z(), localDir.y());
1227  double corrCharge = clust->charge() *
1228  sqrt(1.0 / (1.0 / pow(tan(clust_alpha), 2) + 1.0 / pow(tan(clust_beta), 2) + 1.0)) /
1229  1000.;
1230 
1231  if (pxd != theSiPixelStructure.end())
1232  (*pxd).second->fill(
1233  (*clust), true, corrCharge, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1234 
1235  trackclusters++;
1236  // CORR CHARGE
1237  meClChargeOnTrack_all->Fill(corrCharge);
1238  meClSizeOnTrack_all->Fill((*clust).size());
1239  meClSizeXOnTrack_all->Fill((*clust).sizeX());
1240  meClSizeYOnTrack_all->Fill((*clust).sizeY());
1241  clusterSet.insert(*clust);
1242 
1243  // find cluster global position (rphi, z)
1244  // get cluster center of gravity (of charge)
1245  float xcenter = clust->x();
1246  float ycenter = clust->y();
1247  // get the cluster position in local coordinates (cm)
1248  LocalPoint clustlp = topol->localPosition(MeasurementPoint(xcenter, ycenter));
1249  // get the cluster position in global coordinates (cm)
1250  GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
1251 
1252  // find location of hit (barrel or endcap, same for cluster)
1253  bool barrel =
1254  DetId((*hit).geographicalId()).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
1255  bool endcap =
1256  DetId((*hit).geographicalId()).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
1257  if (barrel) {
1258  barreltrackclusters++;
1259 
1260  DetId detId = (*hit).geographicalId();
1261  if (detId >= 302055684 && detId <= 352477708) {
1263  }
1264 
1265  // CORR CHARGE
1266  meClChargeOnTrack_bpix->Fill(corrCharge);
1267  meClSizeOnTrack_bpix->Fill((*clust).size());
1268  meClSizeXOnTrack_bpix->Fill((*clust).sizeX());
1269  meClSizeYOnTrack_bpix->Fill((*clust).sizeY());
1270  int DBlayer;
1271  DBlayer = PixelBarrelName(DetId((*hit).geographicalId()), tTopo, isUpgrade).layerName();
1272  float phi = clustgp.phi();
1273  float z = clustgp.z();
1274 
1275  PixelBarrelName pbn(DetId((*hit).geographicalId()), tTopo, isUpgrade);
1276  int ladder = pbn.ladderName();
1277  int module = pbn.moduleName();
1278 
1279  PixelBarrelName::Shell sh = pbn.shell(); // enum
1280  int ladderSigned = ladder;
1281  int moduleSigned = module;
1282  // Shell { mO = 1, mI = 2 , pO =3 , pI =4 };
1283  int shell = int(sh);
1284  // change the module sign for z<0
1285  if (shell == 1 || shell == 2) {
1286  moduleSigned = -module;
1287  }
1288  // change ladeer sign for Outer )x<0)
1289  if (shell == 1 || shell == 3) {
1290  ladderSigned = -ladder;
1291  }
1292 
1293  for (int i = 0; i < noOfLayers; i++) {
1294  if (DBlayer == i + 1) {
1295  meClPosLayersOnTrack.at(i)->Fill(z, phi);
1296  meClPosLayersLadVsModOnTrack.at(i)->Fill(moduleSigned, ladderSigned);
1297  meClChargeOnTrack_layers.at(i)->Fill(corrCharge);
1298  meClSizeOnTrack_layers.at(i)->Fill((*clust).size());
1299  meClSizeXOnTrack_layers.at(i)->Fill((*clust).sizeX());
1300  meClSizeYOnTrack_layers.at(i)->Fill((*clust).sizeY());
1302  }
1303  }
1304  }
1305  if (endcap) {
1306  endcaptrackclusters++;
1307  // CORR CHARGE
1308  meClChargeOnTrack_fpix->Fill(corrCharge);
1309  meClSizeOnTrack_fpix->Fill((*clust).size());
1310  meClSizeXOnTrack_fpix->Fill((*clust).sizeX());
1311  meClSizeYOnTrack_fpix->Fill((*clust).sizeY());
1312  int DBdisk = 0;
1313  DBdisk = PixelEndcapName(DetId((*hit).geographicalId()), tTopo, isUpgrade).diskName();
1314  float x = clustgp.x();
1315  float y = clustgp.y();
1316  float z = clustgp.z();
1317  float phi = clustgp.phi();
1318 
1319  float xclust = clust->x();
1320  float yclust = clust->y();
1321 
1322  getepixrococcupancyontrk(tTopo, hit, xclust, yclust, z, meRocBladevsDiskEndcapOnTrk);
1323 
1324  if (z > 0) {
1325  for (int i = 0; i < noOfDisks; i++) {
1326  if (DBdisk == i + 1) {
1327  meClPosDiskspzOnTrack.at(i)->Fill(x, y);
1328  meClChargeOnTrack_diskps.at(i)->Fill(corrCharge);
1329  meClSizeOnTrack_diskps.at(i)->Fill((*clust).size());
1330  meClSizeXOnTrack_diskps.at(i)->Fill((*clust).sizeX());
1331  meClSizeYOnTrack_diskps.at(i)->Fill((*clust).sizeY());
1333  }
1334  }
1335  } else {
1336  for (int i = 0; i < noOfDisks; i++) {
1337  if (DBdisk == i + 1) {
1338  meClPosDisksmzOnTrack.at(i)->Fill(x, y);
1339  meClChargeOnTrack_diskms.at(i)->Fill(corrCharge);
1340  meClSizeOnTrack_diskms.at(i)->Fill((*clust).size());
1341  meClSizeXOnTrack_diskms.at(i)->Fill((*clust).sizeX());
1342  meClSizeYOnTrack_diskms.at(i)->Fill((*clust).sizeY());
1344  }
1345  }
1346  }
1347  }
1348 
1349  } // end if (cluster exists)
1350 
1351  } // end if (persistent hit exists and is pixel hit)
1352 
1353  } // end of else
1354 
1355  } // end for (all traj measurements of pixeltrack)
1356  } // end if (is pixeltrack)
1357  else {
1358  if (debug_)
1359  std::cout << "no pixeltrack:\n";
1360  if (crossesPixVol)
1361  meNofTracksInPixVol_->Fill(1, 1);
1362  }
1363 
1364  } // end loop on map entries
1365 
1366  } // end valid trajectory:
1367 
1368  // find clusters that are NOT on track
1369  // edmNew::DetSet<SiPixelCluster>::const_iterator di;
1370  if (debug_)
1371  std::cout << "clusters not on track: (size " << clustColl.size() << ") ";
1372 
1373  for (TrackerGeometry::DetContainer::const_iterator it = TG->dets().begin(); it != TG->dets().end(); it++) {
1374  // if(dynamic_cast<PixelGeomDetUnit const *>((*it))!=0){
1375  DetId detId = (*it)->geographicalId();
1376  if (detId >= 302055684 && detId <= 352477708) { // make sure it's a Pixel module WITHOUT using
1377  // dynamic_cast!
1378  int nofclOnTrack = 0, nofclOffTrack = 0;
1379  float z = 0.;
1381  if (isearch != clustColl.end()) { // Not an empty iterator
1383  for (di = isearch->begin(); di != isearch->end(); di++) {
1384  unsigned int temp = clusterSet.size();
1385  clusterSet.insert(*di);
1386  // check if cluster is off track
1387  if (clusterSet.size() > temp) {
1388  otherclusters++;
1389  nofclOffTrack++;
1390  // fill histograms for clusters off tracks
1391  // correct SiPixelTrackResidualModule
1392  bool barrel = DetId(detId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
1393  if (barrel) {
1395  }
1396 
1397  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd =
1398  theSiPixelStructure.find((*it)->geographicalId().rawId());
1399 
1400  if (pxd != theSiPixelStructure.end())
1401  (*pxd).second->fill((*di), false, -1., reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1402 
1403  meClSizeNotOnTrack_all->Fill((*di).size());
1404  meClSizeXNotOnTrack_all->Fill((*di).sizeX());
1405  meClSizeYNotOnTrack_all->Fill((*di).sizeY());
1406  meClChargeNotOnTrack_all->Fill((*di).charge() / 1000);
1407 
1409  // find cluster global position (rphi, z) get cluster
1410  // define tracker and pixel geometry and topology
1411  const TrackerGeometry &theTracker(*theTrackerGeometry);
1412  const PixelGeomDetUnit *theGeomDet = static_cast<const PixelGeomDetUnit *>(theTracker.idToDet(detId));
1413  // test if PixelGeomDetUnit exists
1414  if (theGeomDet == nullptr) {
1415  if (debug_)
1416  std::cout << "NO THEGEOMDET\n";
1417  continue;
1418  }
1419  const PixelTopology *topol = &(theGeomDet->specificTopology());
1420 
1421  // center of gravity (of charge)
1422  float xcenter = di->x();
1423  float ycenter = di->y();
1424  // get the cluster position in local coordinates (cm)
1425  LocalPoint clustlp = topol->localPosition(MeasurementPoint(xcenter, ycenter));
1426  // get the cluster position in global coordinates (cm)
1427  GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
1428 
1430 
1431  // barrel
1432  if (DetId(detId).subdetId() == 1) {
1433  meClSizeNotOnTrack_bpix->Fill((*di).size());
1434  meClSizeXNotOnTrack_bpix->Fill((*di).sizeX());
1435  meClSizeYNotOnTrack_bpix->Fill((*di).sizeY());
1436  meClChargeNotOnTrack_bpix->Fill((*di).charge() / 1000);
1437  barrelotherclusters++;
1438  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1439  float phi = clustgp.phi();
1440  // float r = clustgp.perp();
1441  z = clustgp.z();
1442  for (int i = 0; i < noOfLayers; i++) {
1443  if (DBlayer == i + 1) {
1444  meClPosLayersNotOnTrack.at(i)->Fill(z, phi);
1445  meClSizeNotOnTrack_layers.at(i)->Fill((*di).size());
1446  meClSizeXNotOnTrack_layers.at(i)->Fill((*di).sizeX());
1447  meClSizeYNotOnTrack_layers.at(i)->Fill((*di).sizeY());
1448  meClChargeNotOnTrack_layers.at(i)->Fill((*di).charge() / 1000);
1449  }
1450  }
1451  }
1452  // endcap
1453  if (DetId(detId).subdetId() == 2) {
1454  meClSizeNotOnTrack_fpix->Fill((*di).size());
1455  meClSizeXNotOnTrack_fpix->Fill((*di).sizeX());
1456  meClSizeYNotOnTrack_fpix->Fill((*di).sizeY());
1457  meClChargeNotOnTrack_fpix->Fill((*di).charge() / 1000);
1458  endcapotherclusters++;
1459  int DBdisk = PixelEndcapName(DetId(detId), tTopo, isUpgrade).diskName();
1460  float x = clustgp.x();
1461  float y = clustgp.y();
1462  z = clustgp.z();
1463 
1465 
1466  if (z > 0) {
1467  for (int i = 0; i < noOfDisks; i++) {
1468  if (DBdisk == i + 1) {
1469  meClPosDiskspzNotOnTrack.at(i)->Fill(x, y);
1470  meClSizeNotOnTrack_diskps.at(i)->Fill((*di).size());
1471  meClSizeXNotOnTrack_diskps.at(i)->Fill((*di).sizeX());
1472  meClSizeYNotOnTrack_diskps.at(i)->Fill((*di).sizeY());
1473  meClChargeNotOnTrack_diskps.at(i)->Fill((*di).charge() / 1000);
1474  }
1475  }
1476  } else {
1477  for (int i = 0; i < noOfDisks; i++) {
1478  if (DBdisk == i + 1) {
1479  meClPosDisksmzNotOnTrack.at(i)->Fill(x, y);
1480  meClSizeNotOnTrack_diskms.at(i)->Fill((*di).size());
1481  meClSizeXNotOnTrack_diskms.at(i)->Fill((*di).sizeX());
1482  meClSizeYNotOnTrack_diskms.at(i)->Fill((*di).sizeY());
1483  meClChargeNotOnTrack_diskms.at(i)->Fill((*di).charge() / 1000);
1484  }
1485  }
1486  }
1487  }
1488  } // end "if cluster off track"
1489  else {
1490  nofclOnTrack++;
1491  if (z == 0) {
1492  // find cluster global position (rphi, z) get cluster
1493  // define tracker and pixel geometry and topology
1494  const TrackerGeometry &theTracker(*theTrackerGeometry);
1495  const PixelGeomDetUnit *theGeomDet = static_cast<const PixelGeomDetUnit *>(theTracker.idToDet(detId));
1496  // test if PixelGeomDetUnit exists
1497  if (theGeomDet == nullptr) {
1498  if (debug_)
1499  std::cout << "NO THEGEOMDET\n";
1500  continue;
1501  }
1502  const PixelTopology *topol = &(theGeomDet->specificTopology());
1503  // center of gravity (of charge)
1504  float xcenter = di->x();
1505  float ycenter = di->y();
1506  // get the cluster position in local coordinates (cm)
1507  LocalPoint clustlp = topol->localPosition(MeasurementPoint(xcenter, ycenter));
1508  // get the cluster position in global coordinates (cm)
1509  GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
1510  z = clustgp.z();
1511  }
1512  }
1513  }
1514  }
1515  //++ fill the number of clusters on a module
1516  std::map<uint32_t, SiPixelTrackResidualModule *>::iterator pxd =
1517  theSiPixelStructure.find((*it)->geographicalId().rawId());
1518  if (pxd != theSiPixelStructure.end())
1519  (*pxd).second->nfill(
1520  nofclOnTrack, nofclOffTrack, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1521  if (nofclOnTrack != 0)
1522  meNClustersOnTrack_all->Fill(nofclOnTrack);
1523  if (nofclOffTrack != 0)
1524  meNClustersNotOnTrack_all->Fill(nofclOffTrack);
1525  // barrel
1526  if (DetId(detId).subdetId() == 1) {
1527  if (nofclOnTrack != 0)
1528  meNClustersOnTrack_bpix->Fill(nofclOnTrack);
1529  if (nofclOffTrack != 0)
1530  meNClustersNotOnTrack_bpix->Fill(nofclOffTrack);
1531  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1532  for (int i = 0; i < noOfLayers; i++) {
1533  if (DBlayer == i + 1) {
1534  if (nofclOnTrack != 0)
1535  meNClustersOnTrack_layers.at(i)->Fill(nofclOnTrack);
1536  if (nofclOffTrack != 0)
1537  meNClustersNotOnTrack_layers.at(i)->Fill(nofclOffTrack);
1538  }
1539  }
1540  } // end barrel
1541  // endcap
1542  if (DetId(detId).subdetId() == 2) {
1543  int DBdisk = PixelEndcapName(DetId(detId)).diskName();
1544  // z = clustgp.z();
1545  if (nofclOnTrack != 0)
1546  meNClustersOnTrack_fpix->Fill(nofclOnTrack);
1547  if (nofclOffTrack != 0)
1548  meNClustersNotOnTrack_fpix->Fill(nofclOffTrack);
1549  if (z > 0) {
1550  for (int i = 0; i < noOfDisks; i++) {
1551  if (DBdisk == i + 1) {
1552  if (nofclOnTrack != 0)
1553  meNClustersOnTrack_diskps.at(i)->Fill(nofclOnTrack);
1554  if (nofclOffTrack != 0)
1555  meNClustersNotOnTrack_diskps.at(i)->Fill(nofclOffTrack);
1556  }
1557  }
1558  }
1559  if (z < 0) {
1560  for (int i = 0; i < noOfDisks; i++) {
1561  if (DBdisk == i + 1) {
1562  if (nofclOnTrack != 0)
1563  meNClustersOnTrack_diskms.at(i)->Fill(nofclOnTrack);
1564  if (nofclOffTrack != 0)
1565  meNClustersNotOnTrack_diskms.at(i)->Fill(nofclOffTrack);
1566  }
1567  }
1568  }
1569  }
1570 
1571  } // end if it's a Pixel module
1572  } // end for loop over tracker detector geometry modules
1573 
1574  if (trackclusters > 0)
1575  (meNofClustersOnTrack_)->Fill(0, trackclusters);
1576  if (barreltrackclusters > 0)
1577  (meNofClustersOnTrack_)->Fill(1, barreltrackclusters);
1578  if (endcaptrackclusters > 0)
1579  (meNofClustersOnTrack_)->Fill(2, endcaptrackclusters);
1580  if (otherclusters > 0)
1581  (meNofClustersNotOnTrack_)->Fill(0, otherclusters);
1582  if (barrelotherclusters > 0)
1583  (meNofClustersNotOnTrack_)->Fill(1, barrelotherclusters);
1584  if (endcapotherclusters > 0)
1585  (meNofClustersNotOnTrack_)->Fill(2, endcapotherclusters);
1586  if (tracks > 0)
1587  (meNofTracks_)->Fill(0, tracks);
1588  if (pixeltracks > 0)
1589  (meNofTracks_)->Fill(1, pixeltracks);
1590  if (bpixtracks > 0)
1591  (meNofTracks_)->Fill(2, bpixtracks);
1592  if (fpixtracks > 0)
1593  (meNofTracks_)->Fill(3, fpixtracks);
1594 }
1595 
1597  const edm::DetSetVector<PixelDigi> &diginp,
1598  const TrackerTopology *tTopo,
1599  std::vector<MonitorElement *> meinput) {
1601  if (ipxsearch != diginp.end()) {
1602  // Look at digis now
1604  for (pxdi = ipxsearch->begin(); pxdi != ipxsearch->end(); pxdi++) {
1605  bool isHalfModule = PixelBarrelName(DetId(detId), tTopo, isUpgrade).isHalfModule();
1606  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1607  int DBmodule = PixelBarrelName(DetId(detId), tTopo, isUpgrade).moduleName();
1608  int DBladder = PixelBarrelName(DetId(detId), tTopo, isUpgrade).ladderName();
1609  int DBshell = PixelBarrelName(DetId(detId), tTopo, isUpgrade).shell();
1610 
1611  // add sign to the modules
1612  if (DBshell == 1 || DBshell == 2) {
1613  DBmodule = -DBmodule;
1614  }
1615  if (DBshell == 1 || DBshell == 3) {
1616  DBladder = -DBladder;
1617  }
1618 
1619  int col = pxdi->column();
1620  int row = pxdi->row();
1621 
1622  float modsign = (float)DBmodule / (abs((float)DBmodule));
1623  float ladsign = (float)DBladder / (abs((float)DBladder));
1624  float rocx = ((float)col / (52. * 8.)) * modsign + ((float)DBmodule - (modsign)*0.5);
1625  float rocy = ((float)row / (80. * 2.)) * ladsign + ((float)DBladder - (ladsign)*0.5);
1626 
1627  // do the flip where need
1628  bool flip = false;
1629  if ((DBladder % 2 == 0) && (!isHalfModule)) {
1630  flip = true;
1631  }
1632  if ((flip) && (DBladder > 0)) {
1633  if ((((float)DBladder - (ladsign)*0.5) <= rocy) && (rocy < (float)DBladder)) {
1634  rocy = rocy + ladsign * 0.5;
1635  } else if ((((float)DBladder) <= rocy) && (rocy < ((float)DBladder + (ladsign)*0.5))) {
1636  rocy = rocy - ladsign * 0.5;
1637  }
1638  }
1639 
1640  // tweak border effect for negative modules/ladders
1641  if (modsign < 0) {
1642  rocx = rocx - 0.0001;
1643  }
1644  if (ladsign < 0) {
1645  rocy = rocy - 0.0001;
1646  } else {
1647  rocy = rocy + 0.0001;
1648  }
1649  if (abs(DBladder) == 1) {
1650  rocy = rocy + ladsign * 0.5;
1651  } // take care of the half module
1652 
1653  if (DBlayer == 1) {
1654  meinput.at(0)->Fill(rocx, rocy);
1655  }
1656  if (DBlayer == 2) {
1657  meinput.at(1)->Fill(rocx, rocy);
1658  }
1659  if (DBlayer == 3) {
1660  meinput.at(2)->Fill(rocx, rocy);
1661  }
1662  } // end of looping over pxdi
1663  }
1664 }
1665 
1667  double y1,
1668  double z1,
1669  double x2,
1670  double y2,
1671  double z2,
1672  double x3,
1673  double y3,
1674  double z3,
1675  double ptsig,
1676  double &dca2,
1677  double &dz2,
1678  double kap) {
1679  // Define some constants
1680  using namespace std;
1681 
1682  // Curvature kap from global Track
1683 
1684  // inverse of the curvature is the radius in the transverse plane
1685  double rho = 1 / kap;
1686  // Check that the hits are in the correct layers
1687  double r1 = sqrt(x1 * x1 + y1 * y1);
1688  double r3 = sqrt(x3 * x3 + y3 * y3);
1689 
1690  if (r3 - r1 < 2.0)
1691  cout << "warn r1 = " << r1 << ", r3 = " << r3 << endl;
1692 
1693  // Calculate the centre of the helix in xy-projection with radius rho from the
1694  // track.
1695  // start with a line (sekante) connecting the two points (x1,y1) and (x3,y3)
1696  // vec_L = vec_x3-vec_x1 with L being the length of that vector.
1697  double L = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
1698  // lam is the line from the middel point of vec_q towards the center of the
1699  // circle X0,Y0
1700  // we already have kap and rho = 1/kap
1701  double lam = sqrt(rho * rho - L * L / 4);
1702 
1703  // There are two solutions, the sign of kap gives the information
1704  // which of them is correct.
1705  //
1706  if (kap > 0)
1707  lam = -lam;
1708 
1709  //
1710  // ( X0, Y0 ) is the centre of the circle that describes the helix in
1711  // xy-projection.
1712  //
1713  double x0 = 0.5 * (x1 + x3) + lam / L * (-y1 + y3);
1714  double y0 = 0.5 * (y1 + y3) + lam / L * (x1 - x3);
1715 
1716  // Calculate the dipangle in z direction (needed later for z residual) :
1717  // Starting from the heliz equation whihc has to hold for both points z1,z3
1718  double num = (y3 - y0) * (x1 - x0) - (x3 - x0) * (y1 - y0);
1719  double den = (x1 - x0) * (x3 - x0) + (y1 - y0) * (y3 - y0);
1720  double tandip = kap * (z3 - z1) / atan(num / den);
1721 
1722  // angle from first hit to dca point:
1723  //
1724  double dphi = atan(((x1 - x0) * y0 - (y1 - y0) * x0) / ((x1 - x0) * x0 + (y1 - y0) * y0));
1725  // z position of the track based on the middle of the circle
1726  // track equation for the z component
1727  double uz0 = z1 + tandip * dphi * rho;
1728 
1730  // RESIDUAL IN R-PHI
1732  // Calculate distance dca2 from point (x2,y2) to the circle which is given by
1733  // the distance of the point to the middlepoint dcM = sqrt((x0-x2)^2+(y0-y2))
1734  // and rho dca = rho +- dcM
1735  if (kap > 0)
1736  dca2 = rho - sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2));
1737  else
1738  dca2 = rho + sqrt((-x0 + x2) * (-x0 + x2) + (-y0 + y2) * (-y0 + y2));
1739 
1741  // RESIDUAL IN Z
1743  double xx = 0;
1744  double yy = 0;
1745  // sign of kappa determines the calculation
1746  // xx and yy are the new coordinates starting from x2, y2 that are on the
1747  // track itself vec_X2+-dca2*vec(X0-X2)/|(X0-X2)|
1748  if (kap < 0) {
1749  xx = x2 + (dca2 * ((x0 - x2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1750  yy = y2 + (dca2 * ((y0 - y2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1751  } else if (kap >= 0) {
1752  xx = x2 - (dca2 * ((x0 - x2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1753  yy = y2 - (dca2 * ((y0 - y2)) / sqrt((x0 - x2) * (x0 - x2) + (y0 - y2) * (y0 - y2)));
1754  }
1755 
1756  // to get residual in z start with calculating the new uz2 position if one has
1757  // moved to xx, yy on the track. First calculate the change in phi2 with
1758  // respect to the center X0, Y0
1759  double dphi2 = atan(((xx - x0) * y0 - (yy - y0) * x0) / ((xx - x0) * x0 + (yy - y0) * y0));
1760  // Solve track equation for this new z depending on the dip angle of the track
1761  // (see above calculated based on X1, X3 and X0, use uz0 as reference point
1762  // again.
1763  double uz2 = uz0 - dphi2 * tandip * rho;
1764 
1765  // subtract new z position from the old one
1766  dz2 = z2 - uz2;
1767 
1768  // if we are interested in the arclength this is unsigned though
1769  // double cosphi2 = (x2*xx+y2*yy)/(sqrt(x2*x2+y2*y2)*sqrt(xx*xx+yy*yy));
1770  // double arcdca2=sqrt(x2*x2+y2*y2)*acos(cosphi2);
1771 }
1772 
1775  float xclust,
1776  float yclust,
1777  float z,
1778  MonitorElement *meinput) {
1779  int pxfpanel = tTopo->pxfPanel((*hit).geographicalId());
1780  int pxfmodule = tTopo->pxfModule((*hit).geographicalId());
1781  int pxfdisk = tTopo->pxfDisk((*hit).geographicalId());
1782  int pxfblade_off = tTopo->pxfBlade((*hit).geographicalId());
1783 
1784  // translate to online conventions
1785  // each EPIX disk is split in 2 half-disk - each one consists of 12 blades
1786  // in offline: blades num 0->24; here translate numbering to online convetion
1787  // positive blades pointing to beam; negative pointing away
1788  // each blade has two panels: each consisting of an array of ROC plaquettes
1789  // front (rear) pannel: 3 (4) plaquettes
1790  // number of ROCs in each plaquette depends on the position on the panel
1791  // each ROC has 80x52 pixel cells
1792  if (z < 0.) {
1793  pxfdisk = -1. * pxfdisk;
1794  }
1795  int pxfblade = -99;
1796  if (pxfblade_off <= 6 && pxfblade_off >= 1) {
1797  pxfblade = 7 - pxfblade_off;
1798  } else if (pxfblade_off <= 18 && pxfblade_off >= 7) {
1799  pxfblade = 6 - pxfblade_off;
1800  } else if (pxfblade_off <= 24 && pxfblade_off >= 19) {
1801  pxfblade = 31 - pxfblade_off;
1802  }
1803 
1804  int clu_sdpx = ((pxfdisk > 0) ? 1 : -1) * (2 * (abs(pxfdisk) - 1) + pxfpanel);
1805  int binselx = (pxfpanel == 1 && (pxfmodule == 1 || pxfmodule == 4))
1806  ? (pxfmodule == 1)
1807  : ((pxfpanel == 1 && xclust < 80.0) || (pxfpanel == 2 && xclust >= 80.0));
1808  int nperpan = 2 * pxfmodule + pxfpanel - 1 + binselx;
1809  int clu_roc_binx =
1810  ((pxfdisk > 0) ? nperpan : 9 - nperpan) + (clu_sdpx + 4) * 8 - 2 * ((abs(pxfdisk) == 1) ? pxfdisk : 0);
1811 
1812  int clu_roc_biny = -99.;
1813  int nrocly = pxfmodule + pxfpanel;
1814  for (int i = 0; i < nrocly; i++) {
1815  int j = (pxfdisk < 0) ? i : nrocly - 1 - i;
1816  if (yclust >= (j * 52.0) && yclust < ((j + 1) * 52.0))
1817  clu_roc_biny = 6 - nrocly + 2 * i + ((pxfblade > 0) ? pxfblade - 1 : pxfblade + 12) * 12 + 1;
1818  }
1819  if (pxfblade > 0) {
1820  clu_roc_biny = clu_roc_biny + 144;
1821  }
1822 
1823  meinput->setBinContent(clu_roc_binx, clu_roc_biny, meinput->getBinContent(clu_roc_binx, clu_roc_biny) + 1);
1824  meinput->setBinContent(clu_roc_binx, clu_roc_biny + 1, meinput->getBinContent(clu_roc_binx, clu_roc_biny + 1) + 1);
1825 }
1826 
1828  DetId detId, const TrackerTopology *tTopo, float xclust, float yclust, float z, MonitorElement *meinput) {
1829  PXFDetId pxfid = PXFDetId(detId);
1830 
1831  // int pxfside = PixelEndcapName(detId,tTopo,isUpgrade).halfCylinder();
1832  int pxfpanel = pxfid.panel();
1833  int pxfmodule = pxfid.module();
1834  int pxfdisk = pxfid.disk();
1835  int pxfblade_off = pxfid.blade();
1836 
1837  if (z < 0.) {
1838  pxfdisk = -1. * pxfdisk;
1839  }
1840 
1841  int pxfblade = -99;
1842  if (pxfblade_off <= 6 && pxfblade_off >= 1) {
1843  pxfblade = 7 - pxfblade_off;
1844  } else if (pxfblade_off <= 18 && pxfblade_off >= 7) {
1845  pxfblade = 6 - pxfblade_off;
1846  } else if (pxfblade_off <= 24 && pxfblade_off >= 19) {
1847  pxfblade = 31 - pxfblade_off;
1848  }
1849 
1850  int clu_sdpx = ((pxfdisk > 0) ? 1 : -1) * (2 * (abs(pxfdisk) - 1) + pxfpanel);
1851  int binselx = (pxfpanel == 1 && (pxfmodule == 1 || pxfmodule == 4))
1852  ? (pxfmodule == 1)
1853  : ((pxfpanel == 1 && xclust < 80.0) || (pxfpanel == 2 && xclust >= 80.0));
1854  int nperpan = 2 * pxfmodule + pxfpanel - 1 + binselx;
1855  int clu_roc_binx =
1856  ((pxfdisk > 0) ? nperpan : 9 - nperpan) + (clu_sdpx + 4) * 8 - 2 * ((abs(pxfdisk) == 1) ? pxfdisk : 0);
1857 
1858  int clu_roc_biny = -99.;
1859  int nrocly = pxfmodule + pxfpanel;
1860  for (int i = 0; i < nrocly; i++) {
1861  int j = (pxfdisk < 0) ? i : nrocly - 1 - i;
1862  if (yclust >= (j * 52.0) && yclust < ((j + 1) * 52.0))
1863  clu_roc_biny = 6 - nrocly + 2 * i + ((pxfblade > 0) ? pxfblade - 1 : pxfblade + 12) * 12 + 1;
1864  }
1865  if (pxfblade > 0) {
1866  clu_roc_biny = clu_roc_biny + 144;
1867  }
1868 
1869  meinput->setBinContent(clu_roc_binx, clu_roc_biny, meinput->getBinContent(clu_roc_binx, clu_roc_biny) + 1);
1870  meinput->setBinContent(clu_roc_binx, clu_roc_biny + 1, meinput->getBinContent(clu_roc_binx, clu_roc_biny + 1) + 1);
1871 }
1872 
1873 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
constexpr int pow(int x)
Definition: conifer.h:24
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
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:130
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
std::vector< MonitorElement * > meNClustersNotOnTrack_layers
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< MonitorElement * > meZeroRocLadvsModOnTrackBarrel
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
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)