CMS 3D CMS Logo

CTPPSPixelDQMSource.cc
Go to the documentation of this file.
1 /******************************************
2 *
3 * This is a part of CTPPSDQM software.
4 * Authors:
5 * F.Ferro INFN Genova
6 * Vladimir Popov (vladimir.popov@cern.ch)
7 *
8 *******************************************/
9 
16 
19 
21 
27 
28 #include <string>
29 
30 //-----------------------------------------------------------------------------
31 
33 public:
35  ~CTPPSPixelDQMSource() override;
36 
37 protected:
38  void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override;
39  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
40  void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override;
41  void dqmEndRun(edm::Run const &run, edm::EventSetup const &eSetup) override;
42 
43 private:
44  unsigned int verbosity;
45  long int nEvents = 0;
49 
50  static constexpr int NArms = 2;
51  static constexpr int NStationMAX = 3; // in an arm
52  static constexpr int NRPotsMAX = 6; // per station
53  static constexpr int NplaneMAX = 6; // per RPot
54  static constexpr int NROCsMAX = 6; // per plane
55  static constexpr int RPn_first = 3, RPn_last = 4;
56  static constexpr int ADCMax = 256;
57  static constexpr int StationIDMAX = 4; // possible range of ID
58  static constexpr int RPotsIDMAX = 8; // possible range of ID
59  static constexpr int NLocalTracksMAX = 20;
60  static constexpr int hitMultMAX = 50; // tuned
61  static constexpr int ClusMultMAX = 10; // tuned
62  static constexpr int ClusterSizeMax = 9;
63 
65  int pixRowMAX = 160; // defaultDetSizeInX, CMS Y-axis
66  int pixColMAX = 156; // defaultDetSizeInY, CMS X-axis
67  int ROCSizeInX = pixRowMAX / 2; // ROC row size in pixels = 80
68  int ROCSizeInY = pixColMAX / 3; // ROC col size in pixels = 52
69 
71 
73  static constexpr int NPlaneBins = NplaneMAX * NRPotBinsInStation;
74 
77 
80 
81  static constexpr int RPotsTotalNumber = NArms * NStationMAX * NRPotsMAX;
82 
96  MonitorElement *hROCadc[RPotsTotalNumber * NplaneMAX][NROCsMAX];
98  int HitsMultROC[RPotsTotalNumber * NplaneMAX][NROCsMAX];
101 
102  unsigned int rpStatusWord = 0x8008; //220_fr_hr(stn2rp3)+ 210_fr_hr
103  int RPstatus[StationIDMAX][RPotsIDMAX]; // symmetric in both arms
104  int StationStatus[StationIDMAX]; // symmetric in both arms
105  const int IndexNotValid = 0;
106 
107  int getRPindex(int arm, int station, int rp) {
108  if (arm < 0 || station < 0 || rp < 0)
109  return (IndexNotValid);
110  if (arm > 1 || station >= NStationMAX || rp >= NRPotsMAX)
111  return (IndexNotValid);
112  int rc = (arm * NStationMAX + station) * NRPotsMAX + rp;
113  return (rc);
114  }
115 
116  int getPlaneIndex(int arm, int station, int rp, int plane) {
117  if (plane < 0 || plane >= NplaneMAX)
118  return (IndexNotValid);
119  int rc = getRPindex(arm, station, rp);
120  if (rc == IndexNotValid)
121  return (IndexNotValid);
122  return (rc * NplaneMAX + plane);
123  }
124 
125  int getRPInStationBin(int rp) { return (rp - RPn_first + 1); }
126 
127  static constexpr int NRPglobalBins = 4; //2 arms w. 2 stations w. 1 RP
128  int getRPglobalBin(int arm, int stn) {
129  static constexpr int stationBinOrder[NStationMAX] = {0, 4, 1};
130  return (arm * 2 + stationBinOrder[stn] + 1);
131  }
132 
133  int prIndex(int rp, int plane) // plane index in station
134  {
135  return ((rp - RPn_first) * NplaneMAX + plane);
136  }
137  int getDet(int id) { return (id >> DetId::kDetOffset) & 0xF; }
138  int getPixPlane(int id) { return ((id >> 16) & 0x7); }
139  // int getSubdet(int id) { return ((id>>kSubdetOffset)&0x7); }
140 
141  int multHitsMax, cluSizeMax; // for tuning
143 };
144 
145 //----------------------------------------------------------------------------------
146 
147 using namespace std;
148 using namespace edm;
149 
150 //-------------------------------------------------------------------------------
151 
153  : verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0)),
154  rpStatusWord(ps.getUntrackedParameter<unsigned int>("RPStatusWord", 0x8008)) {
155  tokenDigi = consumes<DetSetVector<CTPPSPixelDigi>>(ps.getParameter<edm::InputTag>("tagRPixDigi"));
156  tokenCluster = consumes<DetSetVector<CTPPSPixelCluster>>(ps.getParameter<edm::InputTag>("tagRPixCluster"));
157  tokenTrack = consumes<DetSetVector<CTPPSPixelLocalTrack>>(ps.getParameter<edm::InputTag>("tagRPixLTrack"));
158 }
159 
160 //----------------------------------------------------------------------------------
161 
163 
164 //--------------------------------------------------------------------------
165 
167  if (verbosity)
168  LogPrint("CTPPSPixelDQMSource") << "RPstatusWord= " << rpStatusWord;
169  nEvents = 0;
170 
171  CTPPSPixelLocalTrack thePixelLocalTrack;
172  TrackFitDimension = thePixelLocalTrack.dimension;
173 
176  ROCSizeInX = pixRowMAX / 2; // ROC row size in pixels = 80
177  ROCSizeInY = pixColMAX / 3;
178 
179  for (int stn = 0; stn < StationIDMAX; stn++) {
180  StationStatus[stn] = 0;
181  for (int rp = 0; rp < RPotsIDMAX; rp++)
182  RPstatus[stn][rp] = 0;
183  }
184 
185  unsigned int rpSts = rpStatusWord << 1;
186  for (int stn = 0; stn < NStationMAX; stn++) {
187  int stns = 0;
188  for (int rp = 0; rp < NRPotsMAX; rp++) {
189  rpSts = (rpSts >> 1);
190  RPstatus[stn][rp] = rpSts & 1;
191  if (RPstatus[stn][rp] > 0)
192  stns = 1;
193  }
194  StationStatus[stn] = stns;
195  }
196 
197  for (int ind = 0; ind < 2 * 3 * NRPotsMAX; ind++)
198  RPindexValid[ind] = 0;
199 
200  multHitsMax = cluSizeMax = -1;
201  x0_MIN = y0_MIN = 1.0e06;
202  x0_MAX = y0_MAX = -1.0e06;
203 }
204 
205 //-------------------------------------------------------------------------------------
206 
207 void CTPPSPixelDQMSource::bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) {
208  ibooker.cd();
209  ibooker.setCurrentFolder("CTPPS/TrackingPixel");
210  char s[50];
211  string armTitleShort, stnTitleShort;
212  hBX = ibooker.book1D("events per BX", "ctpps_pixel;Event.BX", 4002, -1.5, 4000. + 0.5);
213  hBXshort = ibooker.book1D("events per BX(short)", "ctpps_pixel;Event.BX", 102, -1.5, 100. + 0.5);
214 
215  string str1st = "Pixel planes activity";
216  h2AllPlanesActive = ibooker.book2DD(
217  str1st, str1st + "(digi task);Plane #", NplaneMAX, 0, NplaneMAX, NRPglobalBins, 0.5, NRPglobalBins + 0.5);
218  TH2D *h1st = h2AllPlanesActive->getTH2D();
219  h1st->SetOption("colz");
220  TAxis *yah1st = h1st->GetYaxis();
221 
222  string str2 = "Pixel RP active";
223  hpRPactive =
224  ibooker.bookProfile(str2, str2 + " per event(digi task)", NRPglobalBins, 0.5, NRPglobalBins + 0.5, -0.1, 1.1, "");
225  TAxis *xaRPact = hpRPactive->getTProfile()->GetXaxis();
226  hpRPactive->getTProfile()->SetOption("hist");
227  hpRPactive->getTProfile()->SetMinimum(0.);
228  hpRPactive->getTProfile()->SetMaximum(1.1);
229 
230  str2 = "Pixel Local Tracks";
231  hpixLTrack = ibooker.bookProfile(
232  str2, str2 + " per event", NRPglobalBins, 0.5, NRPglobalBins + 0.5, -0.1, NLocalTracksMAX, "");
233 
234  TAxis *xah1trk = hpixLTrack->getTProfile()->GetXaxis();
235  hpixLTrack->getTProfile()->GetYaxis()->SetTitle("average number of tracks per event");
236  hpixLTrack->getTProfile()->SetOption("hist");
237 
238  for (int arm = 0; arm < 2; arm++) {
240  string sd, armTitle;
241  ID.armName(sd, CTPPSDetId::nPath);
242  ID.armName(armTitle, CTPPSDetId::nFull);
243  ID.armName(armTitleShort, CTPPSDetId::nShort);
244 
245  ibooker.setCurrentFolder(sd);
246 
247  for (int stn = 0; stn < NStationMAX; stn++) {
248  if (StationStatus[stn] == 0)
249  continue;
250  ID.setStation(stn);
251  string stnd, stnTitle;
252 
253  CTPPSDetId(ID.stationId()).stationName(stnd, CTPPSDetId::nPath);
254  CTPPSDetId(ID.stationId()).stationName(stnTitle, CTPPSDetId::nFull);
255  CTPPSDetId(ID.stationId()).stationName(stnTitleShort, CTPPSDetId::nShort);
256 
257  ibooker.setCurrentFolder(stnd);
258  //--------- RPots ---
259  int pixBinW = 4;
260  for (int rp = RPn_first; rp < RPn_last; rp++) { // only installed pixel pots
261  ID.setRP(rp);
262  string rpd, rpTitle;
263  CTPPSDetId(ID.rpId()).rpName(rpTitle, CTPPSDetId::nShort);
264  string rpBinName = armTitleShort + "_" + stnTitleShort + "_" + rpTitle;
265  yah1st->SetBinLabel(getRPglobalBin(arm, stn), rpBinName.c_str());
266  xah1trk->SetBinLabel(getRPglobalBin(arm, stn), rpBinName.c_str());
267  xaRPact->SetBinLabel(getRPglobalBin(arm, stn), rpBinName.c_str());
268 
269  if (RPstatus[stn][rp] == 0)
270  continue;
271  int indexP = getRPindex(arm, stn, rp);
272  RPindexValid[indexP] = 1;
273 
274  CTPPSDetId(ID.rpId()).rpName(rpTitle, CTPPSDetId::nFull);
275  CTPPSDetId(ID.rpId()).rpName(rpd, CTPPSDetId::nPath);
276 
277  ibooker.setCurrentFolder(rpd);
278 
279  string st2 = ": " + stnTitle;
280 
281  string st = "hit multiplicity in planes";
282  string st3 = ";PlaneIndex(=pixelPot*PlaneMAX + plane)";
283  h2HitsMultipl[arm][stn] =
284  ibooker.book2DD(st, st + st2 + st3 + ";multiplicity", NPlaneBins, 0, NPlaneBins, hitMultMAX, 0, hitMultMAX);
285  h2HitsMultipl[arm][stn]->setOption("colz");
286 
287  st = "cluster size in planes";
288  h2CluSize[arm][stn] = ibooker.book2D(
289  st, st + st2 + st3 + ";Cluster size", NPlaneBins, 0, NPlaneBins, ClusterSizeMax + 1, 0, ClusterSizeMax + 1);
290  h2CluSize[arm][stn]->setOption("colz");
291 
292  const float x0Maximum = 70.;
293  const float y0Maximum = 15.;
294  st = "track intercept point";
295  h2trackXY0[indexP] = ibooker.book2D(
296  st, st + st2 + ";x0;y0", int(x0Maximum) * 2, 0., x0Maximum, int(y0Maximum) * 4, -y0Maximum, y0Maximum);
297  h2trackXY0[indexP]->setOption("colz");
298 
299  st = "number of tracks per event";
300  htrackMult[indexP] = ibooker.bookProfile(st,
301  rpTitle + ";number of tracks",
302  NLocalTracksMAX + 1,
303  -0.5,
304  NLocalTracksMAX + 0.5,
305  -0.5,
306  NLocalTracksMAX + 0.5,
307  "");
308  htrackMult[indexP]->getTProfile()->SetOption("hist");
309 
310  st = "number of hits per track";
311  htrackHits[indexP] = ibooker.bookProfile(st, rpTitle + ";number of hits", 5, 1.5, 6.5, -0.1, 1.1, "");
312  htrackHits[indexP]->getTProfile()->SetOption("hist");
313 
314  hRPotActivPlanes[indexP] = ibooker.bookProfile("number of fired planes per event",
315  rpTitle + ";nPlanes;Probability",
316  NplaneMAX + 1,
317  -0.5,
318  NplaneMAX + 0.5,
319  -0.5,
320  NplaneMAX + 0.5,
321  "");
322  hRPotActivPlanes[indexP]->getTProfile()->SetOption("hist");
323 
324  h2HitsMultROC[indexP] = ibooker.bookProfile2D("ROCs hits multiplicity per event",
325  rpTitle + ";plane # ;ROC #",
326  NplaneMAX,
327  -0.5,
328  NplaneMAX - 0.5,
329  NROCsMAX,
330  -0.5,
331  NROCsMAX - 0.5,
332  0.,
334  "");
335  h2HitsMultROC[indexP]->getTProfile2D()->SetOption("colztext");
336  h2HitsMultROC[indexP]->getTProfile2D()->SetMinimum(1.e-10);
337 
338  hp2HitsMultROC_LS[indexP] = ibooker.bookProfile2D("ROCs_hits_multiplicity_per_event vs LS",
339  rpTitle + ";LumiSection;Plane#___ROC#",
340  1000,
341  0.,
342  1000.,
344  0.,
345  double(NplaneMAX * NROCsMAX),
346  0.,
347  ROCSizeInX *ROCSizeInY,
348  "");
349  hp2HitsMultROC_LS[indexP]->getTProfile2D()->SetOption("colz");
350  hp2HitsMultROC_LS[indexP]->getTProfile2D()->SetMinimum(1.0e-10);
351  hp2HitsMultROC_LS[indexP]->getTProfile2D()->SetCanExtend(TProfile2D::kXaxis);
352  TAxis *yahp2 = hp2HitsMultROC_LS[indexP]->getTProfile2D()->GetYaxis();
353  for (int p = 0; p < NplaneMAX; p++) {
354  sprintf(s, "plane%d_0", p);
355  yahp2->SetBinLabel(p * NplaneMAX + 1, s);
356  for (int r = 1; r < NROCsMAX; r++) {
357  sprintf(s, " %d_%d", p, r);
358  yahp2->SetBinLabel(p * NplaneMAX + r + 1, s);
359  }
360  }
361 
362  ibooker.setCurrentFolder(rpd + "/latency");
363  hRPotActivBX[indexP] = ibooker.book1D("5 fired planes per BX", rpTitle + ";Event.BX", 4002, -1.5, 4000. + 0.5);
364 
365  hRPotActivBXroc[indexP] = ibooker.book1D("4 fired ROCs per BX", rpTitle + ";Event.BX", 4002, -1.5, 4000. + 0.5);
366 
367  hRPotActivBXall[indexP] = ibooker.book1D("hits per BX", rpTitle + ";Event.BX", 4002, -1.5, 4000. + 0.5);
368 
369  int nbins = pixRowMAX / pixBinW;
370 
371  for (int p = 0; p < NplaneMAX; p++) {
372  sprintf(s, "plane_%d", p);
373  string pd = rpd + "/" + string(s);
374  ibooker.setCurrentFolder(pd);
375  string st1 = ": " + rpTitle + "_" + string(s);
376 
377  st = "hits position";
378  h2xyHits[indexP][p] =
379  ibooker.book2DD(st, st1 + ";pix col;pix row", pixRowMAX, 0, pixRowMAX, pixRowMAX, 0, pixRowMAX);
380  h2xyHits[indexP][p]->setOption("colz");
381 
382  st = "adc average value";
383  hp2xyADC[indexP][p] = ibooker.bookProfile2D(
384  st, st1 + ";pix col;pix row", nbins, 0, pixRowMAX, nbins, 0, pixRowMAX, 0., 512., "");
385  hp2xyADC[indexP][p]->getTProfile2D()->SetOption("colz");
386 
387  st = "hits multiplicity";
388  hHitsMult[indexP][p] =
389  ibooker.book1DD(st, st1 + ";number of hits;N / 1 hit", hitMultMAX + 1, -0.5, hitMultMAX + 0.5);
390  } // end of for(int p=0; p<NplaneMAX;..
391 
392  } // end for(int rp=0; rp<NRPotsMAX;...
393  } // end of for(int stn=0; stn<
394  } //end of for(int arm=0; arm<2;...
395 
396  return;
397 }
398 
399 //-------------------------------------------------------------------------------
400 
402  ++nEvents;
403  int lumiId = event.getLuminosityBlock().id().luminosityBlock();
404  if (lumiId < 0)
405  lumiId = 0;
406 
407  int RPactivity[RPotsTotalNumber], RPdigiSize[RPotsTotalNumber];
408  int pixRPTracks[RPotsTotalNumber];
409 
410  for (int rp = 0; rp < RPotsTotalNumber; rp++) {
411  RPactivity[rp] = RPdigiSize[rp] = pixRPTracks[rp] = 0;
412  }
413 
414  for (int ind = 0; ind < RPotsTotalNumber; ind++) {
415  for (int p = 0; p < NplaneMAX; p++) {
416  HitsMultPlane[ind][p] = 0;
417  ClusMultPlane[ind][p] = 0;
418  }
419  }
420  for (int ind = 0; ind < RPotsTotalNumber * NplaneMAX; ind++) {
421  for (int roc = 0; roc < NROCsMAX; roc++) {
422  HitsMultROC[ind][roc] = 0;
423  }
424  }
426  event.getByToken(tokenDigi, pixDigi);
427 
429  event.getByToken(tokenCluster, pixClus);
430 
432  event.getByToken(tokenTrack, pixTrack);
433 
434  hBX->Fill(event.bunchCrossing());
435  hBXshort->Fill(event.bunchCrossing());
436 
437  if (pixTrack.isValid()) {
438  for (const auto &ds_tr : *pixTrack) {
439  int idet = getDet(ds_tr.id);
440  if (idet != DetId::VeryForward) {
441  if (verbosity > 1)
442  LogPrint("CTPPSPixelDQMSource") << "not CTPPS: ds_tr.id" << ds_tr.id;
443  continue;
444  }
445  CTPPSDetId theId(ds_tr.id);
446  int arm = theId.arm() & 0x1;
447  int station = theId.station() & 0x3;
448  int rpot = theId.rp() & 0x7;
449  int rpInd = getRPindex(arm, station, rpot);
450 
451  for (DetSet<CTPPSPixelLocalTrack>::const_iterator dit = ds_tr.begin(); dit != ds_tr.end(); ++dit) {
452  ++pixRPTracks[rpInd];
453  int nh_tr = (dit->ndf() + TrackFitDimension) / 2;
454  for (int i = 0; i <= NplaneMAX; i++) {
455  if (i == nh_tr)
456  htrackHits[rpInd]->Fill(nh_tr, 1.);
457  else
458  htrackHits[rpInd]->Fill(i, 0.);
459  }
460  float x0 = dit->x0();
461  float y0 = dit->y0();
462  h2trackXY0[rpInd]->Fill(x0, y0);
463  if (x0_MAX < x0)
464  x0_MAX = x0;
465  if (y0_MAX < y0)
466  y0_MAX = y0;
467  if (x0_MIN > x0)
468  x0_MIN = x0;
469  if (y0_MIN > y0)
470  y0_MIN = y0;
471  }
472  }
473  } // end if(pixTrack.isValid())
474 
475  bool valid = false;
476  valid |= pixDigi.isValid();
477  // valid |= Clus.isValid();
478 
479  if (!valid && verbosity)
480  LogPrint("CTPPSPixelDQMSource") << "No valid data in Event " << nEvents;
481 
482  if (pixDigi.isValid()) {
483  for (const auto &ds_digi : *pixDigi) {
484  int idet = getDet(ds_digi.id);
485  if (idet != DetId::VeryForward) {
486  if (verbosity > 1)
487  LogPrint("CTPPSPixelDQMSource") << "not CTPPS: ds_digi.id" << ds_digi.id;
488  continue;
489  }
490  // int subdet = getSubdet(ds_digi.id);
491 
492  int plane = getPixPlane(ds_digi.id);
493 
494  CTPPSDetId theId(ds_digi.id);
495  int arm = theId.arm() & 0x1;
496  int station = theId.station() & 0x3;
497  int rpot = theId.rp() & 0x7;
498  int rpInd = getRPindex(arm, station, rpot);
499  RPactivity[rpInd] = 1;
500  ++RPdigiSize[rpInd];
501 
502  if (StationStatus[station] && RPstatus[station][rpot]) {
503  h2HitsMultipl[arm][station]->Fill(prIndex(rpot, plane), ds_digi.data.size());
504  h2AllPlanesActive->Fill(plane, getRPglobalBin(arm, station));
505 
506  int index = getRPindex(arm, station, rpot);
507  HitsMultPlane[index][plane] += ds_digi.data.size();
508  if (RPindexValid[index]) {
509  int nh = ds_digi.data.size();
510  if (nh > hitMultMAX)
511  nh = hitMultMAX;
512  hHitsMult[index][plane]->Fill(nh);
513  }
514  int rocHistIndex = getPlaneIndex(arm, station, rpot, plane);
515 
516  for (DetSet<CTPPSPixelDigi>::const_iterator dit = ds_digi.begin(); dit != ds_digi.end(); ++dit) {
517  int row = dit->row();
518  int col = dit->column();
519  int adc = dit->adc();
520 
521  if (RPindexValid[index]) {
522  h2xyHits[index][plane]->Fill(col, row);
523  hp2xyADC[index][plane]->Fill(col, row, adc);
524  int colROC, rowROC;
525  int trocId;
526  if (!thePixIndices.transformToROC(col, row, trocId, colROC, rowROC)) {
527  if (trocId >= 0 && trocId < NROCsMAX) {
528  ++HitsMultROC[rocHistIndex][trocId];
529  }
530  }
531  } //end if(RPindexValid[index]) {
532  }
533  if (int(ds_digi.data.size()) > multHitsMax)
534  multHitsMax = ds_digi.data.size();
535 
536  } // end if(StationStatus[station]) {
537  } // end for(const auto &ds_digi : *pixDigi)
538  } //if(pixDigi.isValid()) {
539 
540  if (pixClus.isValid())
541  for (const auto &ds : *pixClus) {
542  int idet = getDet(ds.id);
543  if (idet != DetId::VeryForward) {
544  if (verbosity > 1)
545  LogPrint("CTPPSPixelDQMSource") << "not CTPPS: cluster.id" << ds.id;
546  continue;
547  }
548  // int subdet = getSubdet(ds.id);
549 
550  int plane = getPixPlane(ds.id);
551 
552  CTPPSDetId theId(ds.id);
553  int arm = theId.arm() & 0x1;
554  int station = theId.station() & 0x3;
555  int rpot = theId.rp() & 0x7;
556 
557  if ((StationStatus[station] == 0) || (RPstatus[station][rpot] == 0))
558  continue;
559 
560  int index = getRPindex(arm, station, rpot);
561  ++ClusMultPlane[index][plane];
562 
563  for (const auto &p : ds) {
564  int clusize = p.size();
565  h2CluSize[arm][station]->Fill(prIndex(rpot, plane), clusize);
566  if (cluSizeMax < clusize)
567  cluSizeMax = clusize;
568  if (clusize > ClusterSizeMax)
569  clusize = ClusterSizeMax;
570  }
571  } // end if(pixClus.isValid()) for(const auto &ds : *pixClus)
572 
573  bool allRPactivity = false;
574  for (int rp = 0; rp < RPotsTotalNumber; rp++)
575  if (RPactivity[rp] > 0)
576  allRPactivity = true;
577  for (int arm = 0; arm < 2; arm++) {
578  for (int stn = 0; stn < NStationMAX; stn++) {
579  for (int rp = 0; rp < NRPotsMAX; rp++) {
580  int index = getRPindex(arm, stn, rp);
581  if (RPindexValid[index] == 0)
582  continue;
583  hpRPactive->Fill(getRPglobalBin(arm, stn), RPactivity[index]);
584  // if(RPactivity[index]==0) continue;
585  if (!allRPactivity)
586  continue;
587  hpixLTrack->Fill(getRPglobalBin(arm, stn), pixRPTracks[index]);
588  int ntr = pixRPTracks[index];
589  if (ntr > NLocalTracksMAX)
590  ntr = NLocalTracksMAX;
591  for (int i = 0; i <= NLocalTracksMAX; i++) {
592  if (i == ntr)
593  htrackMult[index]->Fill(ntr, 1.);
594  else
595  htrackMult[index]->Fill(i, 0.);
596  }
597 
598  int np = 0;
599  for (int p = 0; p < NplaneMAX; p++)
600  if (HitsMultPlane[index][p] > 0)
601  np++;
602  for (int p = 0; p <= NplaneMAX; p++) {
603  if (p == np)
604  hRPotActivPlanes[index]->Fill(p, 1.);
605  else
606  hRPotActivPlanes[index]->Fill(p, 0.);
607  }
608  if (np >= 5)
610  hRPotActivBXall[index]->Fill(event.bunchCrossing(), float(RPdigiSize[index]));
611 
612  int rocf[NplaneMAX];
613  for (int r = 0; r < NROCsMAX; r++)
614  rocf[r] = 0;
615  for (int p = 0; p < NplaneMAX; p++) {
616  int indp = getPlaneIndex(arm, stn, rp, p);
617  for (int r = 0; r < NROCsMAX; r++)
618  if (HitsMultROC[indp][r] > 0)
619  ++rocf[r];
620  for (int r = 0; r < NROCsMAX; r++) {
621  h2HitsMultROC[index]->Fill(p, r, HitsMultROC[indp][r]);
622  hp2HitsMultROC_LS[index]->Fill(lumiId, p * NROCsMAX + r, HitsMultROC[indp][r]);
623  }
624  }
625  int max = 0;
626  for (int r = 0; r < NROCsMAX; r++)
627  if (max < rocf[r]) {
628  max = rocf[r];
629  }
630  if (max >= 4)
632  } //end for(int rp=0; rp<NRPotsMAX; rp++) {
633  }
634  } //end for(int arm=0; arm<2; arm++) {
635 
636  if ((nEvents % 100))
637  return;
638  if (verbosity)
639  LogPrint("CTPPSPixelDQMSource") << "analyze event " << nEvents;
640 }
641 
642 //-----------------------------------------------------------------------------
644  if (!verbosity)
645  return;
646  LogPrint("CTPPSPixelDQMSource") << "end of Run " << run.run() << ": " << nEvents << " events\n"
647  << "multHitsMax= " << multHitsMax << " cluSizeMax= " << cluSizeMax
648  << "\nx0: " << x0_MIN << "/" << x0_MAX << "y0: " << y0_MIN << "/" << y0_MAX << "\n";
649 }
650 
651 //---------------------------------------------------------------------------
uint32_t station() const
Definition: CTPPSDetId.h:58
int StationStatus[StationIDMAX]
T getParameter(std::string const &) const
virtual TH2D * getTH2D() const
MonitorElement * hHitsMult[RPotsTotalNumber][NplaneMAX]
int HitsMultPlane[RPotsTotalNumber][NplaneMAX]
MonitorElement * hp2xyADC[RPotsTotalNumber][NplaneMAX]
MonitorElement * hpRPactive
MonitorElement * hp2HitsMultROC_LS[RPotsTotalNumber]
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelCluster > > tokenCluster
MonitorElement * h2CluSize[NArms][NStationMAX]
RunNumber_t run() const
Definition: RunBase.h:40
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tokenDigi
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
virtual void setOption(const char *option)
MonitorElement * htrackMult[RPotsTotalNumber]
MonitorElement * h2HitsMultROC[RPotsTotalNumber]
uint32_t ID
Definition: Definitions.h:24
MonitorElement * h2trackXY0[RPotsTotalNumber]
MonitorElement * hpixLTrack
void setRP(uint32_t rp)
Definition: CTPPSDetId.h:67
int bunchCrossing() const
Definition: EventBase.h:64
int getDefaultRowDetSize() const
void dqmEndRun(edm::Run const &run, edm::EventSetup const &eSetup) override
CTPPSPixelIndices thePixIndices
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:78
void Fill(long long x)
MonitorElement * htrackHits[RPotsTotalNumber]
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelLocalTrack > > tokenTrack
CTPPSDetId stationId() const
Definition: CTPPSDetId.h:76
int prIndex(int rp, int plane)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int RPindexValid[RPotsTotalNumber]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * hROCadc[RPotsTotalNumber *NplaneMAX][NROCsMAX]
int np
Definition: AMPTWrapper.h:43
CTPPSPixelDQMSource(const edm::ParameterSet &ps)
MonitorElement * hRPotActivBX[RPotsTotalNumber]
int getDefaultColDetSize() const
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
uint32_t arm() const
Definition: CTPPSDetId.h:51
bool isValid() const
Definition: HandleBase.h:70
void armName(std::string &name, NameFlag flag=nFull) const
Definition: CTPPSDetId.h:92
int getRPindex(int arm, int station, int rp)
virtual TProfile2D * getTProfile2D() const
MonitorElement * hRPotActivBXroc[RPotsTotalNumber]
MonitorElement * h2xyROCHits[RPotsTotalNumber *NplaneMAX][NROCsMAX]
void setStation(uint32_t station)
Definition: CTPPSDetId.h:60
int ClusMultPlane[RPotsTotalNumber][NplaneMAX]
MonitorElement * hRPotActivBXall[RPotsTotalNumber]
double sd
virtual TProfile * getTProfile() const
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
int transformToROC(const int col, const int row, int &rocId, int &colROC, int &rowROC) const
HLT enums.
static const int kDetOffset
Definition: DetId.h:21
col
Definition: cuy.py:1010
MonitorElement * h2AllPlanesActive
int getRPglobalBin(int arm, int stn)
int HitsMultROC[RPotsTotalNumber *NplaneMAX][NROCsMAX]
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
int getPlaneIndex(int arm, int station, int rp, int plane)
MonitorElement * h2xyHits[RPotsTotalNumber][NplaneMAX]
MonitorElement * hRPotActivPlanes[RPotsTotalNumber]
int RPstatus[StationIDMAX][RPotsIDMAX]
MonitorElement * hBXshort
#define constexpr
MonitorElement * h2HitsMultipl[NArms][NStationMAX]
Definition: event.py:1
Definition: Run.h:45
uint32_t rp() const
Definition: CTPPSDetId.h:65