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