test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 = 0;
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))!=0) {
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))!=0) {
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  meRocBladevsDiskEndcap = iBooker.book2D("ROC_endcap_occupancy","Pixel Endcap Occupancy, ROC level (On Track)",72, -4.5, 4.5,288,-12.5,12.5);
592  meRocBladevsDiskEndcap->setBinLabel(1, "Disk-2 Pnl2",1);
593  meRocBladevsDiskEndcap->setBinLabel(9, "Disk-2 Pnl1",1);
594  meRocBladevsDiskEndcap->setBinLabel(19, "Disk-1 Pnl2",1);
595  meRocBladevsDiskEndcap->setBinLabel(27, "Disk-1 Pnl1",1);
596  meRocBladevsDiskEndcap->setBinLabel(41, "Disk+1 Pnl1",1);
597  meRocBladevsDiskEndcap->setBinLabel(49, "Disk+1 Pnl2",1);
598  meRocBladevsDiskEndcap->setBinLabel(59, "Disk+2 Pnl1",1);
599  meRocBladevsDiskEndcap->setBinLabel(67, "Disk+2 Pnl2",1);
600  meRocBladevsDiskEndcap->setAxisTitle("Blades in Inner (>0) / Outer(<) Halves",2);
601  meRocBladevsDiskEndcap->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  //HitProbability
660  //on track
661  iBooker.setCurrentFolder(topFolderName_+"/Clusters/OnTrack");
662  meHitProbability = iBooker.book1D("FractionLowProb","Fraction of hits with low probability;FractionLowProb;#HitsOnTrack",100,0.,1.);
663 
664  if (debug_) {
665  // book summary residual histograms in a debugging folder - one (x,y) pair of histograms per subdetector
666  iBooker.setCurrentFolder("debugging");
667  char hisID[80];
668  for (int s=0; s<3; s++) {
669  sprintf(hisID,"residual_x_subdet_%i",s);
670  meSubdetResidualX[s] = iBooker.book1D(hisID,"Pixel Hit-to-Track Residual in X",500,-5.,5.);
671 
672  sprintf(hisID,"residual_y_subdet_%i",s);
673  meSubdetResidualY[s] = iBooker.book1D(hisID,"Pixel Hit-to-Track Residual in Y",500,-5.,5.);
674  }
675  }
676 
677  firstRun = false;
678 }
679 
680 
682  //Retrieve tracker topology from geometry
683  edm::ESHandle<TrackerTopology> tTopoHandle;
684  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
685  const TrackerTopology* const tTopo = tTopoHandle.product();
686 
687  // retrieve TrackerGeometry again and MagneticField for use in transforming
688  // a TrackCandidate's P(ersistent)TrajectoryStateoOnDet (PTSoD) to a TrajectoryStateOnSurface (TSoS)
690  iSetup.get<TrackerDigiGeometryRecord>().get(TG);
691  const TrackerGeometry* theTrackerGeometry = TG.product();
692 
693  //analytic triplet method to calculate the track residuals in the pixe barrel detector
694 
695  //--------------------------------------------------------------------
696  // beam spot:
697  //
699  //iEvent.getByLabel( "offlineBeamSpot", rbs );
700  iEvent.getByToken( beamSpotToken_, rbs );
701  math::XYZPoint bsP = math::XYZPoint(0,0,0);
702  if( !rbs.failedToGet() && rbs.isValid() )
703  {
704  bsP = math::XYZPoint( rbs->x0(), rbs->y0(), rbs->z0() );
705  }
706 
707  //--------------------------------------------------------------------
708  // primary vertices:
709  //
711  //iEvent.getByLabel("offlinePrimaryVertices", vertices );
712  iEvent.getByToken( offlinePrimaryVerticesToken_, vertices );
713 
714  if( vertices.failedToGet() ) return;
715  if( !vertices.isValid() ) return;
716 
717  math::XYZPoint vtxN = math::XYZPoint(0,0,0);
718  math::XYZPoint vtxP = math::XYZPoint(0,0,0);
719 
720  double bestNdof = 0.0;
721  double maxSumPt = 0.0;
722  reco::Vertex bestPvx;
723  for(reco::VertexCollection::const_iterator iVertex = vertices->begin();
724  iVertex != vertices->end(); ++iVertex ) {
725  if( iVertex->ndof() > bestNdof ) {
726  bestNdof = iVertex->ndof();
727  vtxN = math::XYZPoint( iVertex->x(), iVertex->y(), iVertex->z() );
728  }//ndof
729  if( iVertex->p4().pt() > maxSumPt ) {
730  maxSumPt = iVertex->p4().pt();
731  vtxP = math::XYZPoint( iVertex->x(), iVertex->y(), iVertex->z() );
732  bestPvx = *iVertex;
733  }//sumpt
734 
735  }//vertex
736 
737  if( maxSumPt < 1.0 ) vtxP = vtxN;
738 
739  //---------------------------------------------
740  //get Tracks
741  //
743  //iEvent.getByLabel( "generalTracks", TracksForRes );
744  iEvent.getByToken( generalTracksToken_, TracksForRes );
745 
746  //
747  // transient track builder, needs B-field from data base (global tag in .py)
748  //
750  iSetup.get<TransientTrackRecord>().get( "TransientTrackBuilder", theB );
751 
752  //get the TransienTrackingRecHitBuilder needed for extracting the global position of the hits in the pixel
753  edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
754  iSetup.get<TransientRecHitRecord>().get(ttrhbuilder_,theTrackerRecHitBuilder);
755 
756  //check that tracks are valid
757  if( TracksForRes.failedToGet() ) return;
758  if( !TracksForRes.isValid() ) return;
759 
760  //get tracker geometry
762  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
763 
764  if( !pDD.isValid() ) {
765  cout << "Unable to find TrackerDigiGeometry. Return\n";
766  return;
767  }
768 
769  int kk = -1;
770  //----------------------------------------------------------------------------
771  // Residuals:
772  //
773  for( reco::TrackCollection::const_iterator iTrack = TracksForRes->begin();
774  iTrack != TracksForRes->end(); ++iTrack ) {
775  //count
776  kk++;
777  //Calculate minimal track pt before curling
778  // cpt = cqRB = 0.3*R[m]*B[T] = 1.14*R[m] for B=3.8T
779  // D = 2R = 2*pt/1.14
780  // calo: D = 1.3 m => pt = 0.74 GeV/c
781  double pt = iTrack->pt();
782  if( pt < 0.75 ) continue;// curls up
783  if( abs( iTrack->dxy(vtxP) ) > 5*iTrack->dxyError() ) continue; // not prompt
784 
785  double charge = iTrack->charge();
786 
787  reco::TransientTrack tTrack = theB->build(*iTrack);
788  //get curvature of the track, needed for the residuals
789  double kap = tTrack.initialFreeState().transverseCurvature();
790  //needed for the TransienTrackingRecHitBuilder
792  if( iTrack->extra().isNonnull() &&iTrack->extra().isAvailable() ){
793 
794  double x1 = 0;
795  double y1 = 0;
796  double z1 = 0;
797  double x2 = 0;
798  double y2 = 0;
799  double z2 = 0;
800  double x3 = 0;
801  double y3 = 0;
802  double z3 = 0;
803  int n1 = 0;
804  int n2 = 0;
805  int n3 = 0;
806 
807  //for saving the pixel barrel hits
808  vector<TransientTrackingRecHit::RecHitPointer> GoodPixBarrelHits;
809  //looping through the RecHits of the track
810  for( trackingRecHit_iterator irecHit = iTrack->recHitsBegin();
811  irecHit != iTrack->recHitsEnd(); ++irecHit){
812 
813  if( (*irecHit)->isValid() ){
814  DetId detId = (*irecHit)->geographicalId();
815  // enum Detector { Tracker=1, Muon=2, Ecal=3, Hcal=4, Calo=5 };
816  if( detId.det() != 1 ){
817  if(debug_){
818  cout << "rec hit ID = " << detId.det() << " not in tracker!?!?\n";
819  }
820  continue;
821  }
822  uint32_t subDet = detId.subdetId();
823 
824  // enum SubDetector{ PixelBarrel=1, PixelEndcap=2 };
825  // enum SubDetector{ TIB=3, TID=4, TOB=5, TEC=6 };
826 
827  TransientTrackingRecHit::RecHitPointer trecHit = theTrackerRecHitBuilder->build( &*(*irecHit), initialTSOS);
828 
829 
830  double gX = trecHit->globalPosition().x();
831  double gY = trecHit->globalPosition().y();
832  double gZ = trecHit->globalPosition().z();
833 
834 
835  if( subDet == PixelSubdetector::PixelBarrel ) {
836 
837  int ilay = tTopo->pxbLayer(detId);
838 
839  if( ilay == 1 ){
840  n1++;
841  x1 = gX;
842  y1 = gY;
843  z1 = gZ;
844 
845  GoodPixBarrelHits.push_back((trecHit));
846  }//PXB1
847  if( ilay == 2 ){
848 
849  n2++;
850  x2 = gX;
851  y2 = gY;
852  z2 = gZ;
853 
854  GoodPixBarrelHits.push_back((trecHit));
855 
856  }//PXB2
857  if( ilay == 3 ){
858 
859  n3++;
860  x3 = gX;
861  y3 = gY;
862  z3 = gZ;
863  GoodPixBarrelHits.push_back((trecHit));
864  }
865  }//PXB
866 
867 
868  }//valid
869  }//loop rechits
870 
871  //CS extra plots
872 
873 
874  if( n1+n2+n3 == 3 && n1*n2*n3 > 0) {
875  for( unsigned int i = 0; i < GoodPixBarrelHits.size(); i++){
876 
877  if( GoodPixBarrelHits[i]->isValid() ){
878  DetId detId = GoodPixBarrelHits[i]->geographicalId().rawId();
879  int ilay = tTopo->pxbLayer(detId);
880  if(pt > ptminres_){
881 
882  double dca2 = 0.0, dz2=0.0;
883  double ptsig = pt;
884  if(charge<0.) ptsig = -pt;
885  //Filling the histograms in modules
886 
887  MeasurementPoint Test;
888  MeasurementPoint Test2;
889  Test=MeasurementPoint(0,0);
890  Test2=MeasurementPoint(0,0);
891  Measurement2DVector residual;
892 
893  if( ilay == 1 ){
894 
895  triplets(x2,y2,z2,x1,y1,z1,x3,y3,z3,ptsig,dca2,dz2, kap);
896 
897  Test=MeasurementPoint(dca2*1E4,dz2*1E4);
898  residual=Test-Test2;
899  }
900 
901  if( ilay == 2 ){
902 
903  triplets(x1,y1,z1,x2,y2,z2,x3,y3,z3,ptsig,dca2,dz2, kap);
904 
905  Test=MeasurementPoint(dca2*1E4,dz2*1E4);
906  residual=Test-Test2;
907 
908  }
909 
910  if( ilay == 3 ){
911 
912  triplets(x1,y1,z1,x3,y3,z3,x2,y2,z2,ptsig,dca2,dz2, kap);
913 
914  Test=MeasurementPoint(dca2*1E4,dz2*1E4);
915  residual=Test-Test2;
916  }
917  // fill the residual histograms
918 
919  std::map<uint32_t, SiPixelTrackResidualModule*>::iterator pxd = theSiPixelStructure.find(detId);
920  if (pxd!=theSiPixelStructure.end()) (*pxd).second->fill(residual, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
921 
922  if(ladOn&&pxd!=theSiPixelStructure.end()){
923  meResidualXSummedLay.at(PixelBarrelNameUpgrade((*pxd).first).layerName()-1)->Fill(residual.x());
924  meResidualYSummedLay.at(PixelBarrelNameUpgrade((*pxd).first).layerName()-1)->Fill(residual.y());
925  }
926 
927  }//three hits
928  }//is valid
929  }//rechits loop
930  }//pt 4
931  }
932 
933 
934  }//-----Tracks
936  //get trajectories
937  edm::Handle<std::vector<Trajectory> > trajCollectionHandle;
938  //iEvent.getByLabel(tracksrc_,trajCollectionHandle);
939  iEvent.getByToken ( tracksrcToken_, trajCollectionHandle );
940  auto const & trajColl = *(trajCollectionHandle.product());
941 
942  //get tracks
943  edm::Handle<std::vector<reco::Track> > trackCollectionHandle;
944  //iEvent.getByLabel(tracksrc_,trackCollectionHandle);
945  iEvent.getByToken( trackToken_, trackCollectionHandle );
946  auto const & trackColl = *(trackCollectionHandle.product());
947 
948  //get the map
950  //iEvent.getByLabel(tracksrc_,match);
951  iEvent.getByToken( trackAssociationToken_, match);
952  auto const & ttac = *(match.product());
953 
954  // get clusters
956  //iEvent.getByLabel( clustersrc_, clusterColl );
957  iEvent.getByToken( clustersrcToken_, clusterColl );
958  auto const & clustColl = *(clusterColl.product());
959 
960  // get digis
962  iEvent.getByToken( digisrcToken_, digiinput );
963  const edm::DetSetVector<PixelDigi> diginp = *(digiinput.product());
964 
965 
966  if(debug_){
967  std::cout << "Trajectories\t : " << trajColl.size() << std::endl;
968  std::cout << "recoTracks \t : " << trackColl.size() << std::endl;
969  std::cout << "Map entries \t : " << ttac.size() << std::endl;
970  }
971 
972  std::set<SiPixelCluster> clusterSet;
973  TrajectoryStateCombiner tsoscomb;
974  int tracks=0, pixeltracks=0, bpixtracks=0, fpixtracks=0;
975  int trackclusters=0, barreltrackclusters=0, endcaptrackclusters=0;
976  int otherclusters=0, barrelotherclusters=0, endcapotherclusters=0;
977 
978  //Loop over map entries
979  for(TrajTrackAssociationCollection::const_iterator it = ttac.begin();it != ttac.end(); ++it){
980  const edm::Ref<std::vector<Trajectory> > traj_iterator = it->key;
981  // Trajectory Map, extract Trajectory for this track
982  reco::TrackRef trackref = it->val;
983  tracks++;
984 
985  bool isBpixtrack = false, isFpixtrack = false, crossesPixVol=false;
986 
987  //find out whether track crosses pixel fiducial volume (for cosmic tracks)
988 
989  double d0 = (*trackref).d0(), dz = (*trackref).dz();
990 
991  if(abs(d0)<15 && abs(dz)<50) crossesPixVol = true;
992 
993  const std::vector<TrajectoryMeasurement>& tmeasColl =traj_iterator->measurements();
994  std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
995  //loop on measurements to find out whether there are bpix and/or fpix hits
996  for(tmeasIt = tmeasColl.begin();tmeasIt!=tmeasColl.end();tmeasIt++){
997  if(! tmeasIt->updatedState().isValid()) continue;
998  TransientTrackingRecHit::ConstRecHitPointer testhit = tmeasIt->recHit();
999  if(! testhit->isValid() || testhit->geographicalId().det() != DetId::Tracker) continue;
1000  uint testSubDetID = (testhit->geographicalId().subdetId());
1001  if(testSubDetID==PixelSubdetector::PixelBarrel) isBpixtrack = true;
1002  if(testSubDetID==PixelSubdetector::PixelEndcap) isFpixtrack = true;
1003  }//end loop on measurements
1004  if(isBpixtrack) {
1005  bpixtracks++;
1006  if(debug_) std::cout << "bpixtrack\n";
1007  }
1008  if(isFpixtrack) {
1009  fpixtracks++;
1010  if(debug_) std::cout << "fpixtrack\n";
1011  }
1012  if(isBpixtrack || isFpixtrack){
1013  pixeltracks++;
1014 
1015  if(crossesPixVol) meNofTracksInPixVol_->Fill(0,1);
1016 
1017  const std::vector<TrajectoryMeasurement>& tmeasColl = traj_iterator->measurements();
1018  for(std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt!=tmeasColl.end(); tmeasIt++){
1019  if(! tmeasIt->updatedState().isValid()) continue;
1020 
1021  TrajectoryStateOnSurface tsos = tsoscomb( tmeasIt->forwardPredictedState(), tmeasIt->backwardPredictedState() );
1022  if (!tsos.isValid()) continue; // Happens rarely, due to singular matrix or similar
1023 
1025  if(! hit->isValid() || hit->geographicalId().det() != DetId::Tracker ) {
1026  continue;
1027  } else {
1028 
1029 // //residual
1030  const DetId & hit_detId = hit->geographicalId();
1031  //uint IntRawDetID = (hit_detId.rawId());
1032  uint IntSubDetID = (hit_detId.subdetId());
1033 
1034  if(IntSubDetID == 0 ) continue; // don't look at SiStrip hits!
1035 
1036  // get the enclosed persistent hit
1037  const TrackingRecHit *persistentHit = hit->hit();
1038  // check if it's not null, and if it's a valid pixel hit
1039  if ((persistentHit != 0) && (typeid(*persistentHit) == typeid(SiPixelRecHit))) {
1040  // tell the C++ compiler that the hit is a pixel hit
1041  const SiPixelRecHit* pixhit = static_cast<const SiPixelRecHit*>( hit->hit() );
1042  //Hit probability:
1043  float hit_prob = -1.;
1044  if(pixhit->hasFilledProb()){
1045  hit_prob = pixhit->clusterProbability(0);
1046  //std::cout<<"HITPROB= "<<hit_prob<<std::endl;
1047  if(hit_prob<pow(10.,-15.)) NLowProb++;
1048  NTotal++;
1049  if(NTotal>0) meHitProbability->Fill(float(NLowProb/NTotal));
1050  }
1051 
1052  // get the edm::Ref to the cluster
1053  edm::Ref<edmNew::DetSetVector<SiPixelCluster>, SiPixelCluster> const& clust = (*pixhit).cluster();
1054 
1055  // check if the ref is not null
1056  if (clust.isNonnull()) {
1057 
1058  //define tracker and pixel geometry and topology
1059  const TrackerGeometry& theTracker(*theTrackerGeometry);
1060  const PixelGeomDetUnit* theGeomDet = static_cast<const PixelGeomDetUnit*> (theTracker.idToDet(hit_detId) );
1061 
1062  //test if PixelGeomDetUnit exists
1063  if(theGeomDet == 0) {
1064  if(debug_) std::cout << "NO THEGEOMDET\n";
1065  continue;
1066  }
1067 
1068  const PixelTopology * topol = &(theGeomDet->specificTopology());
1069  //fill histograms for clusters on tracks
1070  //correct SiPixelTrackResidualModule
1071  std::map<uint32_t, SiPixelTrackResidualModule*>::iterator pxd = theSiPixelStructure.find((*hit).geographicalId().rawId());
1072 
1073  //CHARGE CORRECTION (for track impact angle)
1074  // calculate alpha and beta from cluster position
1076  LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
1077 
1078  float clust_alpha = atan2(localDir.z(), localDir.x());
1079  float clust_beta = atan2(localDir.z(), localDir.y());
1080  double corrCharge = clust->charge() * sqrt( 1.0 / ( 1.0/pow( tan(clust_alpha), 2 ) +
1081  1.0/pow( tan(clust_beta ), 2 ) +
1082  1.0 )
1083  )/1000.;
1084 
1085  if (pxd!=theSiPixelStructure.end()) (*pxd).second->fill((*clust), true, corrCharge, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1086 
1087 
1088  trackclusters++;
1089  //CORR CHARGE
1090  meClChargeOnTrack_all->Fill(corrCharge);
1091  meClSizeOnTrack_all->Fill((*clust).size());
1092  meClSizeXOnTrack_all->Fill((*clust).sizeX());
1093  meClSizeYOnTrack_all->Fill((*clust).sizeY());
1094  clusterSet.insert(*clust);
1095 
1096  //find cluster global position (rphi, z)
1097  // get cluster center of gravity (of charge)
1098  float xcenter = clust->x();
1099  float ycenter = clust->y();
1100  // get the cluster position in local coordinates (cm)
1101  LocalPoint clustlp = topol->localPosition( MeasurementPoint(xcenter, ycenter) );
1102  // get the cluster position in global coordinates (cm)
1103  GlobalPoint clustgp = theGeomDet->surface().toGlobal( clustlp );
1104 
1105  //find location of hit (barrel or endcap, same for cluster)
1106  bool barrel = DetId((*hit).geographicalId()).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
1107  bool endcap = DetId((*hit).geographicalId()).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
1108  if(barrel) {
1109  barreltrackclusters++;
1110 
1111  DetId detId = (*hit).geographicalId();
1112  if(detId>=302055684 && detId<=352477708) { getrococcupancy(detId,diginp,tTopo,meZeroRocLadvsModOnTrackBarrel); }
1113 
1114  //CORR CHARGE
1115  meClChargeOnTrack_bpix->Fill(corrCharge);
1116  meClSizeOnTrack_bpix->Fill((*clust).size());
1117  meClSizeXOnTrack_bpix->Fill((*clust).sizeX());
1118  meClSizeYOnTrack_bpix->Fill((*clust).sizeY());
1119  int DBlayer;
1120  DBlayer = PixelBarrelName(DetId((*hit).geographicalId()), tTopo, isUpgrade).layerName();
1121  float phi = clustgp.phi();
1122  float z = clustgp.z();
1123 
1124  PixelBarrelName pbn(DetId((*hit).geographicalId()), tTopo, isUpgrade);
1125  int ladder = pbn.ladderName();
1126  int module = pbn.moduleName();
1127 
1128  PixelBarrelName::Shell sh = pbn.shell(); //enum
1129  int ladderSigned=ladder;
1130  int moduleSigned=module;
1131  // Shell { mO = 1, mI = 2 , pO =3 , pI =4 };
1132  int shell = int(sh);
1133  // change the module sign for z<0
1134  if(shell==1 || shell==2) { moduleSigned = -module; }
1135  // change ladeer sign for Outer )x<0)
1136  if(shell==1 || shell==3) { ladderSigned = -ladder; }
1137 
1138  for (int i = 0; i < noOfLayers; i++)
1139  {
1140  if (DBlayer == i + 1) {
1141  meClPosLayersOnTrack.at(i)->Fill(z,phi);
1142  meClPosLayersLadVsModOnTrack.at(i)->Fill(moduleSigned,ladderSigned);
1143  meClChargeOnTrack_layers.at(i)->Fill(corrCharge);
1144  meClSizeOnTrack_layers.at(i)->Fill((*clust).size());
1145  meClSizeXOnTrack_layers.at(i)->Fill((*clust).sizeX());
1146  meClSizeYOnTrack_layers.at(i)->Fill((*clust).sizeY());
1147  meNofClustersvsPhiOnTrack_layers.at(i)->Fill(phi);
1148  }
1149  }
1150  }
1151  if(endcap) {
1152  endcaptrackclusters++;
1153  //CORR CHARGE
1154  meClChargeOnTrack_fpix->Fill(corrCharge);
1155  meClSizeOnTrack_fpix->Fill((*clust).size());
1156  meClSizeXOnTrack_fpix->Fill((*clust).sizeX());
1157  meClSizeYOnTrack_fpix->Fill((*clust).sizeY());
1158  int DBdisk = 0;
1159  DBdisk = PixelEndcapName(DetId((*hit).geographicalId()), tTopo, isUpgrade).diskName();
1160  float x = clustgp.x();
1161  float y = clustgp.y();
1162  float z = clustgp.z();
1163  float phi = clustgp.phi();
1164 
1165  float xclust = clust->x();
1166  float yclust = clust->y();
1167 
1168  int pxfpanel = tTopo->pxfPanel((*hit).geographicalId());
1169  int pxfmodule = tTopo->pxfModule((*hit).geographicalId());
1170  int pxfdisk = tTopo->pxfDisk((*hit).geographicalId());
1171  int pxfblade_off = tTopo->pxfBlade((*hit).geographicalId());
1172 
1173  // translate to online conventions
1174  if (z<0.) { pxfdisk = -1.*pxfdisk; }
1175  int pxfblade = -99;
1176  if (pxfblade_off<=6 && pxfblade_off>=1) { pxfblade = 7-pxfblade_off; }
1177  else if (pxfblade_off<=18 && pxfblade_off>=7) { pxfblade = 6-pxfblade_off; }
1178  else if (pxfblade_off<=24 && pxfblade_off>=19) { pxfblade = 31-pxfblade_off; }
1179 
1180  int clu_sdpx = ((pxfdisk>0) ? 1 : -1) * (2 * (abs(pxfdisk) - 1) + pxfpanel);
1181  int binselx = (pxfpanel==1&&(pxfmodule==1||pxfmodule==4)) ? (pxfmodule==1) : ((pxfpanel==1&& xclust<80.0)||(pxfpanel==2&&xclust>=80.0));
1182  int nperpan = 2 * pxfmodule + pxfpanel - 1 + binselx;
1183  int clu_roc_binx = ((pxfdisk>0) ? nperpan : 9 - nperpan) + (clu_sdpx + 4) * 8 - 2 * ((abs(pxfdisk)==1) ? pxfdisk : 0);
1184 
1185  int clu_roc_biny = -99.;
1186  int nrocly = pxfmodule + pxfpanel;
1187  for (int i=0; i<nrocly; i++) {
1188  int j = (pxfdisk<0) ? i : nrocly - 1 - i;
1189  if (yclust>=(j*52.0)&& yclust<((j+1)*52.0))
1190  clu_roc_biny = 6 - nrocly + 2 * i + ((pxfblade>0) ? pxfblade-1 : pxfblade + 12)*12 + 1;
1191  }
1192  if (pxfblade>0) { clu_roc_biny = clu_roc_biny+144; }
1193 
1194  meRocBladevsDiskEndcap->setBinContent(clu_roc_binx,clu_roc_biny, meRocBladevsDiskEndcap->getBinContent(clu_roc_binx,clu_roc_biny)+1);
1195  meRocBladevsDiskEndcap->setBinContent(clu_roc_binx,clu_roc_biny+1, meRocBladevsDiskEndcap->getBinContent(clu_roc_binx,clu_roc_biny+1)+1);
1196 
1197  if(z>0){
1198  for (int i = 0; i < noOfDisks; i++)
1199  {
1200  if (DBdisk == i + 1) {
1201  meClPosDiskspzOnTrack.at(i)->Fill(x,y);
1202  meClChargeOnTrack_diskps.at(i)->Fill(corrCharge);
1203  meClSizeOnTrack_diskps.at(i)->Fill((*clust).size());
1204  meClSizeXOnTrack_diskps.at(i)->Fill((*clust).sizeX());
1205  meClSizeYOnTrack_diskps.at(i)->Fill((*clust).sizeY());
1206  meNofClustersvsPhiOnTrack_diskps.at(i)->Fill(phi);
1207  }
1208  }
1209  }
1210  else{
1211  for (int i = 0; i < noOfDisks; i++)
1212  {
1213  if (DBdisk == i + 1) {
1214  meClPosDisksmzOnTrack.at(i)->Fill(x,y);
1215  meClChargeOnTrack_diskms.at(i)->Fill(corrCharge);
1216  meClSizeOnTrack_diskms.at(i)->Fill((*clust).size());
1217  meClSizeXOnTrack_diskms.at(i)->Fill((*clust).sizeX());
1218  meClSizeYOnTrack_diskms.at(i)->Fill((*clust).sizeY());
1219  meNofClustersvsPhiOnTrack_diskms.at(i)->Fill(phi);
1220  }
1221  }
1222  }
1223  }
1224 
1225  }//end if (cluster exists)
1226 
1227  }//end if (persistent hit exists and is pixel hit)
1228 
1229  }//end of else
1230 
1231 
1232  }//end for (all traj measurements of pixeltrack)
1233  }//end if (is pixeltrack)
1234  else {
1235  if(debug_) std::cout << "no pixeltrack:\n";
1236  if(crossesPixVol) meNofTracksInPixVol_->Fill(1,1);
1237  }
1238 
1239  }//end loop on map entries
1240 
1241  //find clusters that are NOT on track
1242  //edmNew::DetSet<SiPixelCluster>::const_iterator di;
1243  if(debug_) std::cout << "clusters not on track: (size " << clustColl.size() << ") ";
1244 
1245  for(TrackerGeometry::DetContainer::const_iterator it = TG->dets().begin(); it != TG->dets().end(); it++){
1246  //if(dynamic_cast<PixelGeomDetUnit const *>((*it))!=0){
1247  DetId detId = (*it)->geographicalId();
1248  if(detId>=302055684 && detId<=352477708){ // make sure it's a Pixel module WITHOUT using dynamic_cast!
1249  int nofclOnTrack = 0, nofclOffTrack=0;
1250  float z=0.;
1251  edmNew::DetSetVector<SiPixelCluster>::const_iterator isearch = clustColl.find(detId);
1252  if( isearch != clustColl.end() ) { // Not an empty iterator
1254  for(di=isearch->begin(); di!=isearch->end(); di++){
1255  unsigned int temp = clusterSet.size();
1256  clusterSet.insert(*di);
1257  //check if cluster is off track
1258  if(clusterSet.size()>temp) {
1259  otherclusters++;
1260  nofclOffTrack++;
1261  //fill histograms for clusters off tracks
1262  //correct SiPixelTrackResidualModule
1263  bool barrel = DetId(detId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
1264  if (barrel) { getrococcupancy(detId,diginp,tTopo,meZeroRocLadvsModOffTrackBarrel); }
1265 
1266  std::map<uint32_t, SiPixelTrackResidualModule*>::iterator pxd = theSiPixelStructure.find((*it)->geographicalId().rawId());
1267 
1268  if (pxd!=theSiPixelStructure.end()) (*pxd).second->fill((*di), false, -1., reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1269 
1270 
1271 
1272  meClSizeNotOnTrack_all->Fill((*di).size());
1273  meClSizeXNotOnTrack_all->Fill((*di).sizeX());
1274  meClSizeYNotOnTrack_all->Fill((*di).sizeY());
1275  meClChargeNotOnTrack_all->Fill((*di).charge()/1000);
1276 
1278  //find cluster global position (rphi, z) get cluster
1279  //define tracker and pixel geometry and topology
1280  const TrackerGeometry& theTracker(*theTrackerGeometry);
1281  const PixelGeomDetUnit* theGeomDet = static_cast<const PixelGeomDetUnit*> (theTracker.idToDet(detId) );
1282  //test if PixelGeomDetUnit exists
1283  if(theGeomDet == 0) {
1284  if(debug_) std::cout << "NO THEGEOMDET\n";
1285  continue;
1286  }
1287  const PixelTopology * topol = &(theGeomDet->specificTopology());
1288 
1289  //center of gravity (of charge)
1290  float xcenter = di->x();
1291  float ycenter = di->y();
1292  // get the cluster position in local coordinates (cm)
1293  LocalPoint clustlp = topol->localPosition( MeasurementPoint(xcenter, ycenter) );
1294  // get the cluster position in global coordinates (cm)
1295  GlobalPoint clustgp = theGeomDet->surface().toGlobal( clustlp );
1296 
1298 
1299  //barrel
1300  if(DetId(detId).subdetId() == 1) {
1301  meClSizeNotOnTrack_bpix->Fill((*di).size());
1302  meClSizeXNotOnTrack_bpix->Fill((*di).sizeX());
1303  meClSizeYNotOnTrack_bpix->Fill((*di).sizeY());
1304  meClChargeNotOnTrack_bpix->Fill((*di).charge()/1000);
1305  barrelotherclusters++;
1306  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1307  float phi = clustgp.phi();
1308  //float r = clustgp.perp();
1309  z = clustgp.z();
1310  for (int i = 0; i < noOfLayers; i++)
1311  {
1312  if (DBlayer == i + 1) {
1313  meClPosLayersNotOnTrack.at(i)->Fill(z,phi);
1314  meClSizeNotOnTrack_layers.at(i)->Fill((*di).size());
1315  meClSizeXNotOnTrack_layers.at(i)->Fill((*di).sizeX());
1316  meClSizeYNotOnTrack_layers.at(i)->Fill((*di).sizeY());
1317  meClChargeNotOnTrack_layers.at(i)->Fill((*di).charge()/1000);
1318  }
1319  }
1320  }
1321  //endcap
1322  if(DetId(detId).subdetId() == 2) {
1323  meClSizeNotOnTrack_fpix->Fill((*di).size());
1324  meClSizeXNotOnTrack_fpix->Fill((*di).sizeX());
1325  meClSizeYNotOnTrack_fpix->Fill((*di).sizeY());
1326  meClChargeNotOnTrack_fpix->Fill((*di).charge()/1000);
1327  endcapotherclusters++;
1328  int DBdisk = PixelEndcapName(DetId(detId), tTopo, isUpgrade).diskName();
1329  float x = clustgp.x();
1330  float y = clustgp.y();
1331  z = clustgp.z();
1332  if(z>0){
1333  for (int i = 0; i < noOfDisks; i++)
1334  {
1335  if (DBdisk == i + 1) {
1336  meClPosDiskspzNotOnTrack.at(i)->Fill(x,y);
1337  meClSizeNotOnTrack_diskps.at(i)->Fill((*di).size());
1338  meClSizeXNotOnTrack_diskps.at(i)->Fill((*di).sizeX());
1339  meClSizeYNotOnTrack_diskps.at(i)->Fill((*di).sizeY());
1340  meClChargeNotOnTrack_diskps.at(i)->Fill((*di).charge()/1000);
1341  }
1342  }
1343  }
1344  else{
1345  for (int i = 0; i < noOfDisks; i++)
1346  {
1347  if (DBdisk == i + 1) {
1348  meClPosDisksmzNotOnTrack.at(i)->Fill(x,y);
1349  meClSizeNotOnTrack_diskms.at(i)->Fill((*di).size());
1350  meClSizeXNotOnTrack_diskms.at(i)->Fill((*di).sizeX());
1351  meClSizeYNotOnTrack_diskms.at(i)->Fill((*di).sizeY());
1352  meClChargeNotOnTrack_diskms.at(i)->Fill((*di).charge()/1000);
1353  }
1354  }
1355  }
1356 
1357  }
1358  }// end "if cluster off track"
1359  else {
1360  nofclOnTrack++;
1361  if(z == 0){
1362  //find cluster global position (rphi, z) get cluster
1363  //define tracker and pixel geometry and topology
1364  const TrackerGeometry& theTracker(*theTrackerGeometry);
1365  const PixelGeomDetUnit* theGeomDet = static_cast<const PixelGeomDetUnit*> (theTracker.idToDet(detId) );
1366  //test if PixelGeomDetUnit exists
1367  if(theGeomDet == 0) {
1368  if(debug_) std::cout << "NO THEGEOMDET\n";
1369  continue;
1370  }
1371  const PixelTopology * topol = &(theGeomDet->specificTopology());
1372  //center of gravity (of charge)
1373  float xcenter = di->x();
1374  float ycenter = di->y();
1375  // get the cluster position in local coordinates (cm)
1376  LocalPoint clustlp = topol->localPosition( MeasurementPoint(xcenter, ycenter) );
1377  // get the cluster position in global coordinates (cm)
1378  GlobalPoint clustgp = theGeomDet->surface().toGlobal( clustlp );
1379  z = clustgp.z();
1380  }
1381  }
1382  }
1383  }
1384  //++ fill the number of clusters on a module
1385  std::map<uint32_t, SiPixelTrackResidualModule*>::iterator pxd = theSiPixelStructure.find((*it)->geographicalId().rawId());
1386  if (pxd!=theSiPixelStructure.end()) (*pxd).second->nfill(nofclOnTrack, nofclOffTrack, reducedSet, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);
1387  if(nofclOnTrack!=0) meNClustersOnTrack_all->Fill(nofclOnTrack);
1388  if(nofclOffTrack!=0) meNClustersNotOnTrack_all->Fill(nofclOffTrack);
1389  //barrel
1390  if(DetId(detId).subdetId() == 1){
1391  if(nofclOnTrack!=0) meNClustersOnTrack_bpix->Fill(nofclOnTrack);
1392  if(nofclOffTrack!=0) meNClustersNotOnTrack_bpix->Fill(nofclOffTrack);
1393  int DBlayer = PixelBarrelName(DetId(detId), tTopo, isUpgrade).layerName();
1394  for (int i = 0; i < noOfLayers; i++)
1395  {
1396  if (DBlayer == i + 1) {
1397  if(nofclOnTrack!=0) meNClustersOnTrack_layers.at(i)->Fill(nofclOnTrack);
1398  if(nofclOffTrack!=0) meNClustersNotOnTrack_layers.at(i)->Fill(nofclOffTrack);
1399  }
1400  }
1401  }//end barrel
1402  //endcap
1403  if(DetId(detId).subdetId() == 2) {
1404  int DBdisk = PixelEndcapName(DetId(detId )).diskName();
1405  //z = clustgp.z();
1406  if(nofclOnTrack!=0) meNClustersOnTrack_fpix->Fill(nofclOnTrack);
1407  if(nofclOffTrack!=0) meNClustersNotOnTrack_fpix->Fill(nofclOffTrack);
1408  if(z>0){
1409  for (int i = 0; i < noOfDisks; i++)
1410  {
1411  if (DBdisk == i + 1) {
1412  if(nofclOnTrack!=0) meNClustersOnTrack_diskps.at(i)->Fill(nofclOnTrack);
1413  if(nofclOffTrack!=0) meNClustersNotOnTrack_diskps.at(i)->Fill(nofclOffTrack);
1414  }
1415  }
1416  }
1417  if(z<0){
1418  for (int i = 0; i < noOfDisks; i++)
1419  {
1420  if (DBdisk == i + 1) {
1421  if(nofclOnTrack!=0) meNClustersOnTrack_diskms.at(i)->Fill(nofclOnTrack);
1422  if(nofclOffTrack!=0) meNClustersNotOnTrack_diskms.at(i)->Fill(nofclOffTrack);
1423  }
1424  }
1425  }
1426  }
1427 
1428  }//end if it's a Pixel module
1429  }//end for loop over tracker detector geometry modules
1430 
1431  if(trackclusters>0) (meNofClustersOnTrack_)->Fill(0,trackclusters);
1432  if(barreltrackclusters>0)(meNofClustersOnTrack_)->Fill(1,barreltrackclusters);
1433  if(endcaptrackclusters>0)(meNofClustersOnTrack_)->Fill(2,endcaptrackclusters);
1434  if(otherclusters>0)(meNofClustersNotOnTrack_)->Fill(0,otherclusters);
1435  if(barrelotherclusters>0)(meNofClustersNotOnTrack_)->Fill(1,barrelotherclusters);
1436  if(endcapotherclusters>0)(meNofClustersNotOnTrack_)->Fill(2,endcapotherclusters);
1437  if(tracks>0)(meNofTracks_)->Fill(0,tracks);
1438  if(pixeltracks>0)(meNofTracks_)->Fill(1,pixeltracks);
1439  if(bpixtracks>0)(meNofTracks_)->Fill(2,bpixtracks);
1440  if(fpixtracks>0)(meNofTracks_)->Fill(3,fpixtracks);
1441 }
1442 
1443 void SiPixelTrackResidualSource::getrococcupancy(DetId detId,const edm::DetSetVector<PixelDigi> diginp,const TrackerTopology* const tTopo,std::vector<MonitorElement*> meinput) {
1444 
1445  edm::DetSetVector<PixelDigi>::const_iterator ipxsearch = diginp.find(detId);
1446  if( ipxsearch != diginp.end() ) {
1447 
1448  // Look at digis now
1450  for (pxdi = ipxsearch->begin(); pxdi != ipxsearch->end(); pxdi++) {
1451 
1452  bool isHalfModule = PixelBarrelName(DetId(detId),tTopo,isUpgrade).isHalfModule();
1453  int DBlayer = PixelBarrelName(DetId(detId),tTopo,isUpgrade).layerName();
1454  int DBmodule = PixelBarrelName(DetId(detId),tTopo,isUpgrade).moduleName();
1455  int DBladder = PixelBarrelName(DetId(detId),tTopo,isUpgrade).ladderName();
1456  int DBshell = PixelBarrelName(DetId(detId),tTopo,isUpgrade).shell();
1457 
1458  // add sign to the modules
1459  if (DBshell==1 || DBshell==2) { DBmodule = -DBmodule; }
1460  if (DBshell==1 || DBshell==3) { DBladder = -DBladder; }
1461 
1462  int col = pxdi->column();
1463  int row = pxdi->row();
1464 
1465  float modsign = (float)DBmodule/(abs((float)DBmodule));
1466  float ladsign = (float)DBladder/(abs((float)DBladder));
1467  float rocx = ((float)col/(52.*8.))*modsign + ((float)DBmodule-(modsign)*0.5);
1468  float rocy = ((float)row/(80.*2.))*ladsign + ((float)DBladder-(ladsign)*0.5);
1469 
1470  // do the flip where need
1471  bool flip = false;
1472  if ( (DBladder%2==0) && (!isHalfModule) ) { flip = true; }
1473  if ((flip) && (DBladder>0)) {
1474  if ( ( ((float)DBladder-(ladsign)*0.5)<=rocy) && (rocy<(float)DBladder)) { rocy = rocy + ladsign*0.5; }
1475  else if ( ( ((float)DBladder)<=rocy) && (rocy<((float)DBladder+(ladsign)*0.5)) ) { rocy = rocy - ladsign*0.5; }
1476  }
1477 
1478  // tweak border effect for negative modules/ladders
1479  if (modsign<0) { rocx = rocx -0.0001; }
1480  if (ladsign<0) { rocy = rocy -0.0001; } else { rocy = rocy +0.0001; }
1481  if (abs(DBladder)==1) { rocy = rocy + ladsign*0.5; } //take care of the half module
1482 
1483  if (DBlayer==1) { meinput.at(0)->Fill(rocx,rocy); }
1484  if (DBlayer==2) { meinput.at(1)->Fill(rocx,rocy); }
1485  if (DBlayer==3) { meinput.at(2)->Fill(rocx,rocy); }
1486  } // end of looping over pxdi
1487  }
1488 }
1489 
1490 
1491 
1492 void SiPixelTrackResidualSource::triplets(double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3,
1493  double ptsig, double & dca2,double & dz2, double kap) {
1494 
1495  //Define some constants
1496  using namespace std;
1497 
1498  //Curvature kap from global Track
1499 
1500  //inverse of the curvature is the radius in the transverse plane
1501  double rho = 1/kap;
1502  //Check that the hits are in the correct layers
1503  double r1 = sqrt( x1*x1 + y1*y1 );
1504  double r3 = sqrt( x3*x3 + y3*y3 );
1505 
1506  if( r3-r1 < 2.0 ) cout << "warn r1 = " << r1 << ", r3 = " << r3 << endl;
1507 
1508  // Calculate the centre of the helix in xy-projection with radius rho from the track.
1509  //start with a line (sekante) connecting the two points (x1,y1) and (x3,y3) vec_L = vec_x3-vec_x1
1510  //with L being the length of that vector.
1511  double L=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
1512  //lam is the line from the middel point of vec_q towards the center of the circle X0,Y0
1513  // we already have kap and rho = 1/kap
1514  double lam = sqrt(rho*rho - L*L/4);
1515 
1516  // There are two solutions, the sign of kap gives the information
1517  // which of them is correct.
1518  //
1519  if( kap > 0 ) lam = -lam;
1520 
1521  //
1522  // ( X0, Y0 ) is the centre of the circle that describes the helix in xy-projection.
1523  //
1524  double x0 = 0.5*( x1 + x3 ) + lam/L * ( -y1 + y3 );
1525  double y0 = 0.5*( y1 + y3 ) + lam/L * ( x1 - x3 );
1526 
1527  // Calculate the dipangle in z direction (needed later for z residual) :
1528  //Starting from the heliz equation whihc has to hold for both points z1,z3
1529  double num = ( y3 - y0 ) * ( x1 - x0 ) - ( x3 - x0 ) * ( y1 - y0 );
1530  double den = ( x1 - x0 ) * ( x3 - x0 ) + ( y1 - y0 ) * ( y3 - y0 );
1531  double tandip = kap * ( z3 - z1 ) / atan( num / den );
1532 
1533 
1534  // angle from first hit to dca point:
1535  //
1536  double dphi = atan( ( ( x1 - x0 ) * y0 - ( y1 - y0 ) * x0 )
1537  / ( ( x1 - x0 ) * x0 + ( y1 - y0 ) * y0 ) );
1538  //z position of the track based on the middle of the circle
1539  //track equation for the z component
1540  double uz0 = z1 + tandip * dphi * rho;
1541 
1543  //RESIDUAL IN R-PHI
1545  //Calculate distance dca2 from point (x2,y2) to the circle which is given by
1546  //the distance of the point to the middlepoint dcM = sqrt((x0-x2)^2+(y0-y2)) and rho
1547  //dca = rho +- dcM
1548  if(kap>0) dca2=rho-sqrt((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2));
1549  else dca2=rho+sqrt((-x0+x2)*(-x0+x2)+(-y0+y2)*(-y0+y2));
1550 
1552  //RESIDUAL IN Z
1554  double xx =0 ;
1555  double yy =0 ;
1556  //sign of kappa determines the calculation
1557  //xx and yy are the new coordinates starting from x2, y2 that are on the track itself
1558  //vec_X2+-dca2*vec(X0-X2)/|(X0-X2)|
1559  if(kap<0){
1560  xx = x2+(dca2*((x0-x2))/sqrt((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)));
1561  yy = y2+(dca2*((y0-y2))/sqrt((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)));
1562  }
1563  else if(kap>=0){
1564  xx = x2-(dca2*((x0-x2))/sqrt((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)));
1565  yy = y2-(dca2*((y0-y2))/sqrt((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)));
1566  }
1567 
1568  //to get residual in z start with calculating the new uz2 position if one has moved to xx, yy
1569  //on the track. First calculate the change in phi2 with respect to the center X0, Y0
1570  double dphi2 = atan( ( ( xx - x0 ) * y0 - ( yy - y0 ) * x0 )
1571  / ( ( xx - x0 ) * x0 + ( yy - y0 ) * y0 ) );
1572  //Solve track equation for this new z depending on the dip angle of the track (see above
1573  //calculated based on X1, X3 and X0, use uz0 as reference point again.
1574  double uz2= uz0 - dphi2*tandip*rho;
1575 
1576  //subtract new z position from the old one
1577  dz2=z2-uz2;
1578 
1579  //if we are interested in the arclength this is unsigned though
1580  // double cosphi2 = (x2*xx+y2*yy)/(sqrt(x2*x2+y2*y2)*sqrt(xx*xx+yy*yy));
1581  //double arcdca2=sqrt(x2*x2+y2*y2)*acos(cosphi2);
1582 
1583 }
1584 
1585 
1586 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_
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
bool hasFilledProb() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
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:252
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_
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
const LocalTrajectoryParameters & localParameters() const
int moduleName() const
module id (index in z)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< MonitorElement * > meClSizeXNotOnTrack_diskms
virtual void dqmBeginRun(const edm::Run &r, edm::EventSetup const &iSetup)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
unsigned int pxfDisk(const DetId &id) const
virtual 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
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:264
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
tuple gX
Definition: corrVsCorr.py:109
TrajectoryStateOnSurface innermostMeasurementState() const
void Fill(long long x)
std::vector< MonitorElement * > meNofClustersvsPhiOnTrack_diskps
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< MonitorElement * > meClSizeXNotOnTrack_layers
std::vector< MonitorElement * > meNofClustersvsPhiOnTrack_diskms
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int iEvent
Definition: GenABIO.cc:230
void getrococcupancy(DetId detId, const edm::DetSetVector< PixelDigi > diginp, const TrackerTopology *const tTopo, std::vector< MonitorElement * > meinput)
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)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
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:75
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clustersrcToken_
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
std::shared_ptr< TrackingRecHit const > RecHitPointer
double ndof() const
Definition: Vertex.h:95
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:79
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:276
std::map< uint32_t, SiPixelTrackResidualModule * > theSiPixelStructure
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
tuple tracks
Definition: testEve_cfg.py:39
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:56
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
int layerName() const
layer id
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< reco::VertexCollection > offlinePrimaryVerticesToken_
Shell shell() const
tuple gY
Definition: corrVsCorr.py:110
double transverseCurvature() 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.
std::vector< MonitorElement * > meNClustersNotOnTrack_diskms
tuple cout
Definition: gather_cfg.py:145
std::vector< MonitorElement * > meClSizeXNotOnTrack_diskps
int diskName() const
disk id
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
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< MonitorElement * > meNClustersOnTrack_layers
volatile std::atomic< bool > shutdown_flag false
std::vector< MonitorElement * > meClSizeNotOnTrack_layers
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
bool isValid() const
Definition: ESHandle.h:47
int col
Definition: cuy.py:1008
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:35
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)
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
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
Definition: Run.h:43
const TrackerGeomDet * idToDet(DetId) const
Our base class.
Definition: SiPixelRecHit.h:23