test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelClusterSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelMonitorCluster
4 // Class: SiPixelClusterSource
5 //
13 //
14 // Original Author: Vincenzo Chiochia & Andrew York
15 // Created:
16 //
17 //
18 // Updated by: Lukas Wehrli
19 // for pixel offline DQM
21 // Framework
24 // DQM Framework
27 // Geometry
33 // DataFormats
41 //
42 #include <string>
43 #include <stdlib.h>
44 
45 using namespace std;
46 using namespace edm;
47 
49  conf_(iConfig),
50  src_( conf_.getParameter<edm::InputTag>( "src" ) ),
51  digisrc_( conf_.getParameter<edm::InputTag>( "digisrc" ) ),
52  saveFile( conf_.getUntrackedParameter<bool>("saveFile",false) ),
53  isPIB( conf_.getUntrackedParameter<bool>("isPIB",false) ),
54  slowDown( conf_.getUntrackedParameter<bool>("slowDown",false) ),
55  modOn( conf_.getUntrackedParameter<bool>("modOn",true) ),
56  twoDimOn( conf_.getUntrackedParameter<bool>("twoDimOn",true) ),
57  reducedSet( conf_.getUntrackedParameter<bool>("reducedSet",false) ),
58  ladOn( conf_.getUntrackedParameter<bool>("ladOn",false) ),
59  layOn( conf_.getUntrackedParameter<bool>("layOn",false) ),
60  phiOn( conf_.getUntrackedParameter<bool>("phiOn",false) ),
61  ringOn( conf_.getUntrackedParameter<bool>("ringOn",false) ),
62  bladeOn( conf_.getUntrackedParameter<bool>("bladeOn",false) ),
63  diskOn( conf_.getUntrackedParameter<bool>("diskOn",false) ),
64  smileyOn(conf_.getUntrackedParameter<bool>("smileyOn",false) ),
65  bigEventSize( conf_.getUntrackedParameter<int>("bigEventSize",100) ),
66  isUpgrade( conf_.getUntrackedParameter<bool>("isUpgrade",false) ),
67  noOfLayers(0),
68  noOfDisks(0)
69 {
70  LogInfo ("PixelDQM") << "SiPixelClusterSource::SiPixelClusterSource: Got DQM BackEnd interface"<<endl;
71 
72  //set Token(-s)
73  srcToken_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(conf_.getParameter<edm::InputTag>("src"));
74  digisrcToken_ = consumes<edm::DetSetVector<PixelDigi> >(conf_.getParameter<edm::InputTag>("digisrc"));
75  firstRun = true;
76  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
77 
78 }
79 
80 
82 {
83  // do anything here that needs to be done at desctruction time
84  // (e.g. close files, deallocate resources etc.)
85  LogInfo ("PixelDQM") << "SiPixelClusterSource::~SiPixelClusterSource: Destructor"<<endl;
86 
87  std::map<uint32_t,SiPixelClusterModule*>::iterator struct_iter;
88  for (struct_iter = thePixelStructure.begin() ; struct_iter != thePixelStructure.end() ; struct_iter++){
89  delete struct_iter->second;
90  struct_iter->second = 0;
91  }
92 }
93 
94 
95 
97  LogInfo ("PixelDQM") << " SiPixelClusterSource::beginJob - Initialisation ... " << std::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  LogInfo ("PixelDQM") << "2DIM IS " << twoDimOn << "\n";
103  LogInfo ("PixelDQM") << "Smiley (Cluster sizeY vs. Cluster eta) is " << smileyOn << "\n";
104 
105  if(firstRun){
106  eventNo = 0;
107  lumSec = 0;
108  nLumiSecs = 0;
109  nBigEvents = 0;
110  // Build map
111  buildStructure(iSetup);
112 
113  firstRun = false;
114  }
115 }
116 
118  bookMEs(iBooker, iSetup);
119  // Book occupancy maps in global coordinates for all clusters:
120  iBooker.setCurrentFolder(topFolderName_+"/Clusters/OffTrack");
121  //bpix
122  std::stringstream ss1, ss2;
123  for (int i = 1; i <= noOfLayers; i++)
124  {
125  ss1.str(std::string()); ss1 << "position_siPixelClusters_Layer_" << i;
126  ss2.str(std::string()); ss2 << "Clusters Layer" << i << ";Global Z (cm);Global #phi";
127  meClPosLayer.push_back(iBooker.book2D(ss1.str(),ss2.str(),200,-30.,30.,128,-3.2,3.2));
128  }
129  for (int i = 1; i <= noOfDisks; i++)
130  {
131  ss1.str(std::string()); ss1 << "position_siPixelClusters_pz_Disk_" << i;
132  ss2.str(std::string()); ss2 << "Clusters +Z Disk" << i << ";Global X (cm);Global Y (cm)";
133  meClPosDiskpz.push_back(iBooker.book2D(ss1.str(),ss2.str(),80,-20.,20.,80,-20.,20.));
134  ss1.str(std::string()); ss1 << "position_siPixelClusters_mz_Disk_" << i;
135  ss2.str(std::string()); ss2 << "Clusters -Z Disk" << i << ";Global X (cm);Global Y (cm)";
136  meClPosDiskmz.push_back(iBooker.book2D(ss1.str(),ss2.str(),80,-20.,20.,80,-20.,20.));
137  }
138 
139  //Book trend cluster plots for barrel and endcap. Lumisections for offline and second for online - taken from strips
140  iBooker.setCurrentFolder(topFolderName_+"/Barrel");
141  ss1.str(std::string()); ss1 << "totalNumberOfClustersProfile_siPixelClusters_Barrel";
142  ss2.str(std::string()); ss2 << "Total number of barrel clusters profile;Lumisection;";
143  meClusBarrelProf = iBooker.bookProfile(ss1.str(),ss2.str(),2400,0.,150,0,0,"");
144  meClusBarrelProf->getTH1()->SetCanExtend(TH1::kAllAxes);
145 
146  iBooker.setCurrentFolder(topFolderName_+"/Endcap");
147 
148  ss1.str(std::string()); ss1 << "totalNumberOfClustersProfile_siPixelClusters_FPIX+";
149  ss2.str(std::string()); ss2 << "Total number of FPIX+ clusters profile;Lumisection;";
150  meClusFpixPProf = iBooker.bookProfile(ss1.str(),ss2.str(),2400,0.,150,0,0,"");
151  meClusFpixPProf->getTH1()->SetCanExtend(TH1::kAllAxes);
152 
153  ss1.str(std::string()); ss1 << "totalNumberOfClustersProfile_siPixelClusters_FPIX-";
154  ss2.str(std::string()); ss2 << "Total number of FPIX- clusters profile;Lumisection;";
155  meClusFpixMProf = iBooker.bookProfile(ss1.str(),ss2.str(),2400,0.,150,0,0,"");
156  meClusFpixMProf->getTH1()->SetCanExtend(TH1::kAllAxes);
157 
158  iBooker.setCurrentFolder(topFolderName_+"/Barrel");
159  for (int i = 1; i <= noOfLayers; i++) {
160  int ybins = -1; float ymin = 0.; float ymax = 0.;
161  if (i==1) { ybins = 42; ymin = -10.5; ymax = 10.5; }
162  if (i==2) { ybins = 66; ymin = -16.5; ymax = 16.5; }
163  if (i==3) { ybins = 90; ymin = -22.5; ymax = 22.5; }
164  ss1.str(std::string()); ss1 << "pix_bar Occ_roc_online_" + digisrc_. label() + "_layer_" << i;
165  ss2.str(std::string()); ss2 << "Pixel Barrel Occupancy, ROC level (Online): Layer " << i;
166  meZeroRocBPIX.push_back(iBooker.book2D(ss1.str(),ss2.str(),72,-4.5,4.5,ybins,ymin,ymax));
167  meZeroRocBPIX.at(i-1)->setAxisTitle("ROC / Module",1);
168  meZeroRocBPIX.at(i-1)->setAxisTitle("ROC / Ladder",2);
169  }
170 
171  iBooker.setCurrentFolder(topFolderName_+"/Endcap");
172  meZeroRocFPIX = iBooker.book2D("ROC_endcap_occupancy","Pixel Endcap Occupancy, ROC level (Online)",72, -4.5, 4.5,288,-12.5,12.5);
173  meZeroRocFPIX->setBinLabel(1, "Disk-2 Pnl2",1);
174  meZeroRocFPIX->setBinLabel(9, "Disk-2 Pnl1",1);
175  meZeroRocFPIX->setBinLabel(19, "Disk-1 Pnl2",1);
176  meZeroRocFPIX->setBinLabel(27, "Disk-1 Pnl1",1);
177  meZeroRocFPIX->setBinLabel(41, "Disk+1 Pnl1",1);
178  meZeroRocFPIX->setBinLabel(49, "Disk+1 Pnl2",1);
179  meZeroRocFPIX->setBinLabel(59, "Disk+2 Pnl1",1);
180  meZeroRocFPIX->setBinLabel(67, "Disk+2 Pnl2",1);
181  meZeroRocFPIX->setAxisTitle("Blades in Inner (>0) / Outer(<) Halves",2);
182  meZeroRocFPIX->setAxisTitle("ROC occupancy",3);
183 
184 }
185 
186 //------------------------------------------------------------------
187 // Method called for every event
188 //------------------------------------------------------------------
190 {
191  eventNo++;
192 
193  if(meClPosLayer.at(0) && meClPosLayer.at(0)->getEntries()>150000){
194  for (int i = 0; i < noOfLayers; i++)
195  {
196  meClPosLayer.at(i)->Reset();
197  }
198  for (int i = 0; i < noOfDisks; i++)
199  {
200  meClPosDiskpz.at(i)->Reset();
201  meClPosDiskmz.at(i)->Reset();
202  }
203  }
204 
205  // get input data
207  iEvent.getByToken(srcToken_, input);
208  auto const & clustColl = *(input.product());
209 
211  iSetup.get<TrackerDigiGeometryRecord> ().get (pDD);
212  const TrackerGeometry* tracker = &(* pDD);
213 
215  iEvent.getByToken( digisrcToken_, digiinput );
216  const edm::DetSetVector<PixelDigi> diginp = *(digiinput.product());
217 
218  edm::ESHandle<TrackerTopology> tTopoHandle;
219  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
220  const TrackerTopology *pTT = tTopoHandle.product();
221 
222 
223  int lumiSection = (int)iEvent.luminosityBlock();
224  int nEventFpixClusters = 0;
225 
226  int nEventsBarrel = 0;
227  int nEventsFPIXm = 0;
228  int nEventsFPIXp = 0;
229 
230 
231  std::map<uint32_t,SiPixelClusterModule*>::iterator struct_iter;
232  for (struct_iter = thePixelStructure.begin() ; struct_iter != thePixelStructure.end() ; struct_iter++) {
233 
234  int numberOfFpixClusters = (*struct_iter).second->fill(*input, tracker,
235  &nEventsBarrel, &nEventsFPIXp, &nEventsFPIXm,
236  meClPosLayer,
239  modOn, ladOn, layOn, phiOn,
240  bladeOn, diskOn, ringOn,
242  nEventFpixClusters = nEventFpixClusters + numberOfFpixClusters;
243 
244  }
245 
246  if(nEventFpixClusters>bigEventSize){
248  bigFpixClusterEventRate->Fill(lumiSection,1./23.);
249  }
250  }
251 
252  float trendVar = iEvent.orbitNumber()/262144.0; //lumisection : seconds - matches strip trend plot
253 
254  meClusBarrelProf->Fill(trendVar,nEventsBarrel);
255  meClusFpixPProf->Fill(trendVar,nEventsFPIXp);
256  meClusFpixMProf->Fill(trendVar,nEventsFPIXm);
257 
258  //std::cout<<"nEventFpixClusters: "<<nEventFpixClusters<<" , nLumiSecs: "<<nLumiSecs<<" , nBigEvents: "<<nBigEvents<<std::endl;
259 
260  for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
261 
262  DetId detId = (*it)->geographicalId();
263 
264  // fill barrel
265  if (detId.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) {
266  getrococcupancy(detId,diginp,pTT,meZeroRocBPIX);
267  }
268 
269  // fill endcap
270  if (detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) {
271  getrococcupancye(detId,clustColl,pTT,pDD,meZeroRocFPIX);
272  }
273 
274  }
275 
276 
277 
278  // slow down...
279  if(slowDown) usleep(10000);
280 
281 }
282 
283 //------------------------------------------------------------------
284 // Build data structure
285 //------------------------------------------------------------------
287 
288  LogInfo ("PixelDQM") <<" SiPixelClusterSource::buildStructure" ;
290  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
291 
292  edm::ESHandle<TrackerTopology> tTopoHandle;
293  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
294  const TrackerTopology *pTT = tTopoHandle.product();
295 
296  LogVerbatim ("PixelDQM") << " *** Geometry node for TrackerGeom is "<<&(*pDD)<<std::endl;
297  LogVerbatim ("PixelDQM") << " *** I have " << pDD->dets().size() <<" detectors"<<std::endl;
298  LogVerbatim ("PixelDQM") << " *** I have " << pDD->detTypes().size() <<" types"<<std::endl;
299 
300  for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
301 
302  if(dynamic_cast<PixelGeomDetUnit const *>((*it))!=0){
303 
304  DetId detId = (*it)->geographicalId();
305  const GeomDetUnit * geoUnit = pDD->idToDetUnit( detId );
306  const PixelGeomDetUnit * pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit);
307  int nrows = (pixDet->specificTopology()).nrows();
308  int ncols = (pixDet->specificTopology()).ncolumns();
309 
310 
311  if((detId.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) ||
312  (detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap))){
313  uint32_t id = detId();
314  SiPixelClusterModule* theModule = new SiPixelClusterModule(id, ncols, nrows);
315  if(detId.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) {
316  if(isPIB) continue;
317  LogDebug ("PixelDQM") << " ---> Adding Barrel Module " << detId.rawId() << endl;
318  int layer = PixelBarrelName(DetId(id),pTT,isUpgrade).layerName();
319  if (layer > noOfLayers) noOfLayers = layer;
320  thePixelStructure.insert(pair<uint32_t,SiPixelClusterModule*> (id,theModule));
321  }else if ( detId.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap ) ) {
322  LogDebug ("PixelDQM") << " ---> Adding Endcap Module " << detId.rawId() << endl;
324  int disk = PixelEndcapName(DetId(id),pTT,isUpgrade).diskName();
325  if (disk>noOfDisks) noOfDisks=disk;
326  int blade = PixelEndcapName(DetId(id),pTT,isUpgrade).bladeName();
327  int panel = PixelEndcapName(DetId(id),pTT,isUpgrade).pannelName();
329  char sside[80]; sprintf(sside, "HalfCylinder_%i",side);
330  char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
331  char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
332  char spanel[80]; sprintf(spanel, "Panel_%i",panel);
333  char smodule[80];sprintf(smodule,"Module_%i",module);
334  std::string side_str = sside;
335  std::string disk_str = sdisk;
336  bool mask = side_str.find("HalfCylinder_1")!=string::npos||
337  side_str.find("HalfCylinder_2")!=string::npos||
338  side_str.find("HalfCylinder_4")!=string::npos||
339  disk_str.find("Disk_2")!=string::npos;
340  // clutch to take all of FPIX, but no BPIX:
341  mask = false;
342  if(isPIB && mask) continue;
343  thePixelStructure.insert(pair<uint32_t,SiPixelClusterModule*> (id,theModule));
344  }
345  }
346  }
347  }
348  LogInfo ("PixelDQM") << " *** Pixel Structure Size " << thePixelStructure.size() << endl;
349 }
350 //------------------------------------------------------------------
351 // Book MEs
352 //------------------------------------------------------------------
354 
355  // Get DQM interface
357  char title[256]; snprintf(title, 256, "Rate of events with >%i FPIX clusters;LumiSection;Rate of large FPIX events per LS [Hz]",bigEventSize);
358  bigFpixClusterEventRate = iBooker.book1D("bigFpixClusterEventRate",title,5000,0.,5000.);
359 
360 
361  std::map<uint32_t,SiPixelClusterModule*>::iterator struct_iter;
362 
363  SiPixelFolderOrganizer theSiPixelFolder(false);
364 
365  for(struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++){
366 
368  if(modOn){
369  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,0,isUpgrade)){
370  (*struct_iter).second->book( conf_,iSetup,iBooker,0,twoDimOn,reducedSet,isUpgrade);
371  } else {
372 
373  if(!isPIB) throw cms::Exception("LogicError")
374  << "[SiPixelClusterSource::bookMEs] Creation of DQM folder failed";
375  }
376  }
377  if(ladOn){
378  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,1,isUpgrade)){
379  (*struct_iter).second->book( conf_,iSetup,iBooker,1,twoDimOn,reducedSet,isUpgrade);
380  } else {
381  LogDebug ("PixelDQM") << "PROBLEM WITH LADDER-FOLDER\n";
382  }
383  }
384  if(layOn){
385  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,2,isUpgrade)){
386  (*struct_iter).second->book( conf_,iSetup,iBooker,2,twoDimOn,reducedSet,isUpgrade);
387  } else {
388  LogDebug ("PixelDQM") << "PROBLEM WITH LAYER-FOLDER\n";
389  }
390  }
391  if(phiOn){
392  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,3,isUpgrade)){
393  (*struct_iter).second->book( conf_,iSetup,iBooker,3,twoDimOn,reducedSet,isUpgrade);
394  } else {
395  LogDebug ("PixelDQM") << "PROBLEM WITH PHI-FOLDER\n";
396  }
397  }
398  if(bladeOn){
399  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,4,isUpgrade)){
400  (*struct_iter).second->book( conf_,iSetup,iBooker,4,twoDimOn,reducedSet,isUpgrade);
401  } else {
402  LogDebug ("PixelDQM") << "PROBLEM WITH BLADE-FOLDER\n";
403  }
404  }
405  if(diskOn){
406  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,5,isUpgrade)){
407  (*struct_iter).second->book( conf_,iSetup,iBooker,5,twoDimOn,reducedSet,isUpgrade);
408  } else {
409  LogDebug ("PixelDQM") << "PROBLEM WITH DISK-FOLDER\n";
410  }
411  }
412  if(ringOn){
413  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,6,isUpgrade)){
414  (*struct_iter).second->book( conf_,iSetup,iBooker,6,twoDimOn,reducedSet,isUpgrade);
415  } else {
416  LogDebug ("PixelDQM") << "PROBLEM WITH RING-FOLDER\n";
417  }
418  }
419  if(smileyOn){
420  if(theSiPixelFolder.setModuleFolder(iBooker,(*struct_iter).first,7,isUpgrade)){
421  (*struct_iter).second->book( conf_,iSetup,iBooker,7,twoDimOn,reducedSet,isUpgrade);
422  } else {
423  LogDebug ("PixelDQM") << "PROBLEM WITH BARREL-FOLDER\n";
424  }
425  }
426 
427  }
428 
429 }
430 
431 
432 void SiPixelClusterSource::getrococcupancy(DetId detId,const edm::DetSetVector<PixelDigi> diginp,const TrackerTopology* const tTopo,std::vector<MonitorElement*> meinput) {
433 
434  edm::DetSetVector<PixelDigi>::const_iterator ipxsearch = diginp.find(detId);
435  if( ipxsearch != diginp.end() ) {
436 
437  // Look at digis now
439  for (pxdi = ipxsearch->begin(); pxdi != ipxsearch->end(); pxdi++) {
440 
441  bool isHalfModule = PixelBarrelName(DetId(detId),tTopo,isUpgrade).isHalfModule();
442  int DBlayer = PixelBarrelName(DetId(detId),tTopo,isUpgrade).layerName();
443  int DBmodule = PixelBarrelName(DetId(detId),tTopo,isUpgrade).moduleName();
444  int DBladder = PixelBarrelName(DetId(detId),tTopo,isUpgrade).ladderName();
445  int DBshell = PixelBarrelName(DetId(detId),tTopo,isUpgrade).shell();
446 
447  // add sign to the modules
448  if (DBshell==1 || DBshell==2) { DBmodule = -DBmodule; }
449  if (DBshell==1 || DBshell==3) { DBladder = -DBladder; }
450 
451  int col = pxdi->column();
452  int row = pxdi->row();
453 
454  float modsign = (float)DBmodule/(abs((float)DBmodule));
455  float ladsign = (float)DBladder/(abs((float)DBladder));
456  float rocx = ((float)col/(52.*8.))*modsign + ((float)DBmodule-(modsign)*0.5);
457  float rocy = ((float)row/(80.*2.))*ladsign + ((float)DBladder-(ladsign)*0.5);
458 
459  // do the flip where need
460  bool flip = false;
461  if ( (DBladder%2==0) && (!isHalfModule) ) { flip = true; }
462  if ((flip) && (DBladder>0)) {
463  if ( ( ((float)DBladder-(ladsign)*0.5)<=rocy) && (rocy<(float)DBladder)) { rocy = rocy + ladsign*0.5; }
464  else if ( ( ((float)DBladder)<=rocy) && (rocy<((float)DBladder+(ladsign)*0.5)) ) { rocy = rocy - ladsign*0.5; }
465  }
466 
467  // tweak border effect for negative modules/ladders
468  if (modsign<0) { rocx = rocx -0.0001; }
469  if (ladsign<0) { rocy = rocy -0.0001; } else { rocy = rocy +0.0001; }
470  if (abs(DBladder)==1) { rocy = rocy + ladsign*0.5; } //take care of the half module
471  meinput[DBlayer-1]->Fill(rocx,rocy);
472  } // end of looping over pxdi
473  }
474 }
475 
476 
477 
479  const TrackerTopology* const pTT,edm::ESHandle<TrackerGeometry> pDD,MonitorElement* meinput) {
480 
481  edmNew::DetSetVector<SiPixelCluster>::const_iterator ipxsearch = clustColl.find(detId);
482  if( ipxsearch != clustColl.end() ) {
483 
484  // Look at clusters now
486  for (pxclust = ipxsearch->begin(); pxclust != ipxsearch->end(); pxclust++) {
487 
488  const GeomDetUnit * geoUnit = pDD->idToDetUnit( detId );
489  const PixelGeomDetUnit * pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit);
490  const PixelTopology * topol = &(pixDet->specificTopology());
491  LocalPoint clustlp = topol->localPosition( MeasurementPoint(pxclust->x(),pxclust->y()) );
492  GlobalPoint clustgp = geoUnit->surface().toGlobal( clustlp );
493 
494  float xclust = pxclust->x();
495  float yclust = pxclust->y();
496  float z = clustgp.z();
497 
498  int pxfside = PixelEndcapName(detId,pTT,isUpgrade).halfCylinder();
499  int pxfpanel = PixelEndcapName(detId,pTT,isUpgrade).pannelName();
500  int pxfmodule = PixelEndcapName(detId,pTT,isUpgrade).plaquetteName();
501  int pxfdisk = PixelEndcapName(detId,pTT,isUpgrade).diskName();
502  int pxfblade = PixelEndcapName(detId,pTT,isUpgrade).bladeName();
503 
504  if ( (pxfside==1) || (pxfside==3) ) { pxfblade = -1.*pxfblade; }
505 
506  if (z<0.) { pxfdisk = -1.*pxfdisk; }
507 
508  int clu_sdpx = ((pxfdisk>0) ? 1 : -1) * (2 * (abs(pxfdisk) - 1) + pxfpanel);
509  int binselx = (pxfpanel==1&&(pxfmodule==1||pxfmodule==4)) ? (pxfmodule==1) : ((pxfpanel==1&& xclust<80.0)||(pxfpanel==2&&xclust>=80.0));
510  int nperpan = 2 * pxfmodule + pxfpanel - 1 + binselx;
511  int clu_roc_binx = ((pxfdisk>0) ? nperpan : 9 - nperpan) + (clu_sdpx + 4) * 8 - 2 * ((abs(pxfdisk)==1) ? pxfdisk : 0);
512 
513  int clu_roc_biny = -99.;
514  int nrocly = pxfmodule + pxfpanel;
515  for (int i=0; i<nrocly; i++) {
516  int j = (pxfdisk<0) ? i : nrocly - 1 - i;
517  if (yclust>=(j*52.0)&& yclust<((j+1)*52.0))
518  clu_roc_biny = 6 - nrocly + 2 * i + ((pxfblade>0) ? pxfblade-1 : pxfblade + 12)*12 + 1;
519  }
520  if (pxfblade>0) { clu_roc_biny = clu_roc_biny+144; }
521 
522  meinput->setBinContent(clu_roc_binx,clu_roc_biny, meinput->getBinContent(clu_roc_binx,clu_roc_biny)+1);
523  meinput->setBinContent(clu_roc_binx,clu_roc_biny+1, meinput->getBinContent(clu_roc_binx,clu_roc_biny+1)+1);
524 
525  }
526  }
527 
528 }
529 
530 //define this as a plug-in
void getrococcupancy(DetId detId, const edm::DetSetVector< PixelDigi > diginp, const TrackerTopology *const tTopo, std::vector< MonitorElement * > meinput)
#define LogDebug(id)
int plaquetteName() const
plaquetteId (in pannel)
virtual void buildStructure(edm::EventSetup const &)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
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
iterator find(det_id_type id)
Definition: DetSetVector.h:290
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
int moduleName() const
module id (index in z)
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< MonitorElement * > meClPosDiskmz
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:62
data_type const * const_iterator
Definition: DetSetNew.h:30
virtual void dqmBeginRun(const edm::Run &, edm::EventSetup const &) override
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > srcToken_
std::vector< MonitorElement * > meZeroRocBPIX
MonitorElement * meZeroRocFPIX
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
SiPixelClusterSource(const edm::ParameterSet &conf)
static std::string const input
Definition: EdmProvDump.cc:44
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int bladeName() const
blade id
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int iEvent
Definition: GenABIO.cc:230
std::vector< MonitorElement * > meClPosDiskpz
bool isHalfModule() const
full or half module
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0, bool isUpgrade=false)
Set folder name for a module or plaquette.
T z() const
Definition: PV3DBase.h:64
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
MonitorElement * meClusBarrelProf
TH1 * getTH1(void) const
std::vector< MonitorElement * > meClPosLayer
int orbitNumber() const
Definition: EventBase.h:66
MonitorElement * meClusFpixMProf
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
edm::ParameterSet conf_
Definition: DetId.h:18
int ladderName() const
ladder id (index in phi)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void getrococcupancye(DetId detId, const edmNew::DetSetVector< SiPixelCluster > &clustColl, const TrackerTopology *const pTT, edm::ESHandle< TrackerGeometry > pDD, MonitorElement *meinput)
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > digisrcToken_
const T & get() const
Definition: EventSetup.h:56
MonitorElement * meClusFpixPProf
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
Shell shell() const
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const_iterator find(id_type i, bool update=false) const
double getBinContent(int binx) const
get content of bin (1-D)
int pannelName() const
pannel id
virtual void bookMEs(DQMStore::IBooker &, const edm::EventSetup &iSetup)
int diskName() const
disk id
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
std::map< uint32_t, SiPixelClusterModule * > thePixelStructure
volatile std::atomic< bool > shutdown_flag false
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
HalfCylinder halfCylinder() const
int col
Definition: cuy.py:1008
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
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
MonitorElement * bigFpixClusterEventRate
const_iterator begin(bool update=false) const
Definition: Run.h:43