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