CMS 3D CMS Logo

SiStripGainsPCLHarvester.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 
4 // CMSSW includes
19 
20 // user include files
26 #include <iostream>
27 #include <sstream>
28 
29 // ROOT includes
30 #include <TROOT.h>
31 #include <TTree.h>
32 
33 //********************************************************************************//
35  : doStoreOnDB(false), GOOD(0), BAD(0), MASKED(0), NStripAPVs(0), NPixelDets(0) {
36  m_Record = ps.getUntrackedParameter<std::string>("Record", "SiStripApvGainRcd");
37  CalibrationLevel = ps.getUntrackedParameter<int>("CalibrationLevel", 0);
38  MinNrEntries = ps.getUntrackedParameter<double>("minNrEntries", 20);
39  m_DQMdir = ps.getUntrackedParameter<std::string>("DQMdir", "AlCaReco/SiStripGains");
40  m_calibrationMode = ps.getUntrackedParameter<std::string>("calibrationMode", "StdBunch");
41  tagCondition_NClusters = ps.getUntrackedParameter<double>("NClustersForTagProd", 2E8);
42  tagCondition_GoodFrac = ps.getUntrackedParameter<double>("GoodFracForTagProd", 0.95);
43  doChargeMonitorPerPlane = ps.getUntrackedParameter<bool>("doChargeMonitorPerPlane", false);
44  VChargeHisto = ps.getUntrackedParameter<std::vector<std::string>>("ChargeHisto");
45  fit_gaussianConvolution_ = ps.getUntrackedParameter<bool>("FitGaussianConvolution", false);
46  fit_gaussianConvolutionTOBL56_ = ps.getUntrackedParameter<bool>("FitGaussianConvolutionTOBL5L6", false);
47  fit_dataDrivenRange_ = ps.getUntrackedParameter<bool>("FitDataDrivenRange", false);
48  storeGainsTree_ = ps.getUntrackedParameter<bool>("StoreGainsTree", false);
49 
50  //Set the monitoring element tag and store
51  dqm_tag_.reserve(7);
52  dqm_tag_.clear();
53  dqm_tag_.push_back("StdBunch"); // statistic collection from Standard Collision Bunch @ 3.8 T
54  dqm_tag_.push_back("StdBunch0T"); // statistic collection from Standard Collision Bunch @ 0 T
55  dqm_tag_.push_back("AagBunch"); // statistic collection from First Collision After Abort Gap @ 3.8 T
56  dqm_tag_.push_back("AagBunch0T"); // statistic collection from First Collision After Abort Gap @ 0 T
57  dqm_tag_.push_back("IsoMuon"); // statistic collection from Isolated Muon @ 3.8 T
58  dqm_tag_.push_back("IsoMuon0T"); // statistic collection from Isolated Muon @ 0 T
59  dqm_tag_.push_back("Harvest"); // statistic collection: Harvest
60 
61  tTopoTokenBR_ = esConsumes<edm::Transition::BeginRun>();
62  tTopoTokenER_ = esConsumes<edm::Transition::EndRun>();
63  tkGeomToken_ = esConsumes<edm::Transition::BeginRun>();
64  gainToken_ = esConsumes<edm::Transition::BeginRun>();
65  qualityToken_ = esConsumes<edm::Transition::BeginRun>();
66 }
67 
68 //********************************************************************************//
69 // ------------ method called for each event ------------
71  using namespace edm;
72  static constexpr float defaultGainTick = 690. / 640.;
73 
74  this->checkBookAPVColls(iSetup); // check whether APV colls are booked and do so if not yet done
75 
76  const auto gainHandle = iSetup.getHandle(gainToken_);
77  if (!gainHandle.isValid()) {
78  edm::LogError("SiStripGainPCLHarvester") << "gainHandle is not valid\n";
79  exit(0);
80  }
81 
82  const auto& stripQuality = iSetup.getData(qualityToken_);
83 
84  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
85  std::shared_ptr<stAPVGain> APV = APVsCollOrdered[a];
86 
88  continue;
89 
90  APV->isMasked = stripQuality.IsApvBad(APV->DetId, APV->APVId);
91 
92  if (gainHandle->getNumberOfTags() != 2) {
93  edm::LogError("SiStripGainPCLHarvester") << "NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
94  fflush(stdout);
95  exit(0);
96  };
97  float newPreviousGain = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 1), 1);
98  if (APV->PreviousGain != 1 and newPreviousGain != APV->PreviousGain)
99  edm::LogWarning("SiStripGainPCLHarvester") << "WARNING: ParticleGain in the global tag changed\n";
100  APV->PreviousGain = newPreviousGain;
101 
102  float newPreviousGainTick =
103  APV->isMasked ? defaultGainTick : gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 0), 0);
104  if (APV->PreviousGainTick != 1 and newPreviousGainTick != APV->PreviousGainTick) {
105  edm::LogWarning("SiStripGainPCLHarvester")
106  << "WARNING: TickMarkGain in the global tag changed\n"
107  << std::endl
108  << " APV->SubDet: " << APV->SubDet << " APV->APVId:" << APV->APVId << std::endl
109  << " APV->PreviousGainTick: " << APV->PreviousGainTick << " newPreviousGainTick: " << newPreviousGainTick
110  << std::endl;
111  }
112  APV->PreviousGainTick = newPreviousGainTick;
113  }
114 }
115 
116 //********************************************************************************//
118  edm::LogInfo("SiStripGainsPCLHarvester") << "Starting harvesting statistics" << std::endl;
119 
120  std::string DQM_dir = m_DQMdir;
121 
122  std::string stag = *(std::find(dqm_tag_.begin(), dqm_tag_.end(), m_calibrationMode));
123  if (!stag.empty() && stag[0] != '_')
124  stag.insert(0, 1, '_');
125 
126  std::string cvi = DQM_dir + std::string("/Charge_Vs_Index") + stag;
127 
128  MonitorElement* Charge_Vs_Index = igetter_.get(cvi);
129 
130  if (Charge_Vs_Index == nullptr) {
131  edm::LogError("SiStripGainsPCLHarvester")
132  << "Harvesting: could not retrieve " << cvi.c_str() << ", statistics will not be summed!" << std::endl;
133  } else {
134  edm::LogInfo("SiStripGainsPCLHarvester")
135  << "Harvesting " << (Charge_Vs_Index)->getTH2S()->GetEntries() << " more clusters" << std::endl;
136  }
137 
138  algoComputeMPVandGain(Charge_Vs_Index);
139  std::unique_ptr<SiStripApvGain> theAPVGains = this->getNewObject(Charge_Vs_Index);
140 
141  // write out the APVGains record
143 
144  if (doStoreOnDB) {
145  if (poolDbService.isAvailable())
146  poolDbService->writeOneIOV(*theAPVGains, poolDbService->currentTime(), m_Record);
147  else
148  throw std::runtime_error("PoolDBService required.");
149  } else {
150  edm::LogInfo("SiStripGainsPCLHarvester") << "Will not produce payload!" << std::endl;
151  }
152 
153  //Collect the statistics for monitoring and validation
154  gainQualityMonitor(ibooker_, Charge_Vs_Index);
155 
156  if (storeGainsTree_) {
157  if (Charge_Vs_Index != nullptr) {
158  storeGainsTree(Charge_Vs_Index->getTH2S()->GetXaxis());
159  } else {
160  edm::LogError("SiStripGainsPCLHarvester")
161  << "Harvesting: could not retrieve " << cvi.c_str() << "Tree won't be stored" << std::endl;
162  }
163  }
164 }
165 
166 //********************************************************************************//
168  const MonitorElement* Charge_Vs_Index) const {
169  ibooker_.setCurrentFolder("AlCaReco/SiStripGainsHarvesting/");
170 
171  std::vector<APVGain::APVmon> new_charge_histos;
172  std::vector<std::pair<std::string, std::string>> cnames =
174  for (unsigned int i = 0; i < cnames.size(); i++) {
175  MonitorElement* monitor = ibooker_.book1DD((cnames[i]).first, (cnames[i]).second.c_str(), 100, 0., 1000.);
176  int thick = APVGain::thickness((cnames[i]).first);
177  int id = APVGain::subdetectorId((cnames[i]).first);
178  int side = APVGain::subdetectorSide((cnames[i]).first);
179  int plane = APVGain::subdetectorPlane((cnames[i]).first);
180  new_charge_histos.push_back(APVGain::APVmon(thick, id, side, plane, monitor));
181  }
182 
183  int MPVbin = 300;
184  float MPVmin = 0.;
185  float MPVmax = 600.;
186 
187  MonitorElement* MPV_Vs_EtaTIB =
188  ibooker_.book2DD("MPVvsEtaTIB", "MPV vs Eta TIB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
189  MonitorElement* MPV_Vs_EtaTID =
190  ibooker_.book2DD("MPVvsEtaTID", "MPV vs Eta TID", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
191  MonitorElement* MPV_Vs_EtaTOB =
192  ibooker_.book2DD("MPVvsEtaTOB", "MPV vs Eta TOB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
193  MonitorElement* MPV_Vs_EtaTEC =
194  ibooker_.book2DD("MPVvsEtaTEC", "MPV vs Eta TEC", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
195  MonitorElement* MPV_Vs_EtaTECthin =
196  ibooker_.book2DD("MPVvsEtaTEC1", "MPV vs Eta TEC-thin", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
197  MonitorElement* MPV_Vs_EtaTECthick =
198  ibooker_.book2DD("MPVvsEtaTEC2", "MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
199 
200  MonitorElement* MPV_Vs_PhiTIB =
201  ibooker_.book2DD("MPVvsPhiTIB", "MPV vs Phi TIB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
202  MonitorElement* MPV_Vs_PhiTID =
203  ibooker_.book2DD("MPVvsPhiTID", "MPV vs Phi TID", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
204  MonitorElement* MPV_Vs_PhiTOB =
205  ibooker_.book2DD("MPVvsPhiTOB", "MPV vs Phi TOB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
206  MonitorElement* MPV_Vs_PhiTEC =
207  ibooker_.book2DD("MPVvsPhiTEC", "MPV vs Phi TEC", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
208  MonitorElement* MPV_Vs_PhiTECthin =
209  ibooker_.book2DD("MPVvsPhiTEC1", "MPV vs Phi TEC-thin ", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
210  MonitorElement* MPV_Vs_PhiTECthick =
211  ibooker_.book2DD("MPVvsPhiTEC2", "MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
212 
213  MonitorElement* NoMPVfit = ibooker_.book2DD("NoMPVfit", "Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
214  MonitorElement* NoMPVmasked = ibooker_.book2DD("NoMPVmasked", "Masked Modules", 350, -350, 350, 240, 0, 120);
215 
216  MonitorElement* Gains = ibooker_.book1DD("Gains", "Gains", 300, 0, 2);
217  MonitorElement* MPVs = ibooker_.book1DD("MPVs", "MPVs", MPVbin, MPVmin, MPVmax);
218  MonitorElement* MPVs320 = ibooker_.book1DD("MPV_320", "MPV 320 thickness", MPVbin, MPVmin, MPVmax);
219  MonitorElement* MPVs500 = ibooker_.book1DD("MPV_500", "MPV 500 thickness", MPVbin, MPVmin, MPVmax);
220  MonitorElement* MPVsTIB = ibooker_.book1DD("MPV_TIB", "MPV TIB", MPVbin, MPVmin, MPVmax);
221  MonitorElement* MPVsTID = ibooker_.book1DD("MPV_TID", "MPV TID", MPVbin, MPVmin, MPVmax);
222  MonitorElement* MPVsTIDP = ibooker_.book1DD("MPV_TIDP", "MPV TIDP", MPVbin, MPVmin, MPVmax);
223  MonitorElement* MPVsTIDM = ibooker_.book1DD("MPV_TIDM", "MPV TIDM", MPVbin, MPVmin, MPVmax);
224  MonitorElement* MPVsTOB = ibooker_.book1DD("MPV_TOB", "MPV TOB", MPVbin, MPVmin, MPVmax);
225  MonitorElement* MPVsTEC = ibooker_.book1DD("MPV_TEC", "MPV TEC", MPVbin, MPVmin, MPVmax);
226  MonitorElement* MPVsTECP = ibooker_.book1DD("MPV_TECP", "MPV TECP", MPVbin, MPVmin, MPVmax);
227  MonitorElement* MPVsTECM = ibooker_.book1DD("MPV_TECM", "MPV TECM", MPVbin, MPVmin, MPVmax);
228  MonitorElement* MPVsTECthin = ibooker_.book1DD("MPV_TEC1", "MPV TEC thin", MPVbin, MPVmin, MPVmax);
229  MonitorElement* MPVsTECthick = ibooker_.book1DD("MPV_TEC2", "MPV TEC thick", MPVbin, MPVmin, MPVmax);
230  MonitorElement* MPVsTECP1 = ibooker_.book1DD("MPV_TECP1", "MPV TECP thin ", MPVbin, MPVmin, MPVmax);
231  MonitorElement* MPVsTECP2 = ibooker_.book1DD("MPV_TECP2", "MPV TECP thick", MPVbin, MPVmin, MPVmax);
232  MonitorElement* MPVsTECM1 = ibooker_.book1DD("MPV_TECM1", "MPV TECM thin", MPVbin, MPVmin, MPVmax);
233  MonitorElement* MPVsTECM2 = ibooker_.book1DD("MPV_TECM2", "MPV TECM thick", MPVbin, MPVmin, MPVmax);
234 
235  MonitorElement* MPVError = ibooker_.book1DD("MPVError", "MPV Error", 150, 0, 150);
236  MonitorElement* MPVErrorVsMPV = ibooker_.book2DD("MPVErrorVsMPV", "MPV Error vs MPV", 300, 0, 600, 150, 0, 150);
237  MonitorElement* MPVErrorVsEta = ibooker_.book2DD("MPVErrorVsEta", "MPV Error vs Eta", 50, -3.0, 3.0, 150, 0, 150);
238  MonitorElement* MPVErrorVsPhi = ibooker_.book2DD("MPVErrorVsPhi", "MPV Error vs Phi", 50, -3.4, 3.4, 150, 0, 150);
239  MonitorElement* MPVErrorVsN = ibooker_.book2DD("MPVErrorVsN", "MPV Error vs N", 500, 0, 1000, 150, 0, 150);
240 
241  MonitorElement* DiffWRTPrevGainTIB = ibooker_.book1DD("DiffWRTPrevGainTIB", "Diff w.r.t. PrevGain TIB", 250, 0, 2);
242  MonitorElement* DiffWRTPrevGainTID = ibooker_.book1DD("DiffWRTPrevGainTID", "Diff w.r.t. PrevGain TID", 250, 0, 2);
243  MonitorElement* DiffWRTPrevGainTOB = ibooker_.book1DD("DiffWRTPrevGainTOB", "Diff w.r.t. PrevGain TOB", 250, 0, 2);
244  MonitorElement* DiffWRTPrevGainTEC = ibooker_.book1DD("DiffWRTPrevGainTEC", "Diff w.r.t. PrevGain TEC", 250, 0, 2);
245 
246  MonitorElement* GainVsPrevGainTIB =
247  ibooker_.book2DD("GainVsPrevGainTIB", "Gain vs PrevGain TIB", 100, 0, 2, 100, 0, 2);
248  MonitorElement* GainVsPrevGainTID =
249  ibooker_.book2DD("GainVsPrevGainTID", "Gain vs PrevGain TID", 100, 0, 2, 100, 0, 2);
250  MonitorElement* GainVsPrevGainTOB =
251  ibooker_.book2DD("GainVsPrevGainTOB", "Gain vs PrevGain TOB", 100, 0, 2, 100, 0, 2);
252  MonitorElement* GainVsPrevGainTEC =
253  ibooker_.book2DD("GainVsPrevGainTEC", "Gain vs PrevGain TEC", 100, 0, 2, 100, 0, 2);
254 
255  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
256  std::shared_ptr<stAPVGain> APV = APVsCollOrdered[a];
257  if (APV == nullptr)
258  continue;
259 
260  unsigned int Index = APV->Index;
261  unsigned int SubDet = APV->SubDet;
262  unsigned int DetId = APV->DetId;
263  float z = APV->z;
264  float Eta = APV->Eta;
265  float R = APV->R;
266  float Phi = APV->Phi;
267  float Thickness = APV->Thickness;
268  double FitMPV = APV->FitMPV;
269  double FitMPVErr = APV->FitMPVErr;
270  double Gain = APV->Gain;
271  double NEntries = APV->NEntries;
272  double PreviousGain = APV->PreviousGain;
273 
274  if (SubDet < 3)
275  continue; // avoid to loop over Pixel det id
276 
277  if (Gain != 1.) {
278  std::vector<MonitorElement*> charge_histos = APVGain::FetchMonitor(new_charge_histos, DetId, tTopo_.get());
279 
280  if (!Charge_Vs_Index)
281  continue;
282  TH2S* chvsidx = (Charge_Vs_Index)->getTH2S();
283  int bin = chvsidx->GetXaxis()->FindBin(Index);
284  TH1D* Proj = chvsidx->ProjectionY("proj", bin, bin);
285  for (int binId = 0; binId < Proj->GetXaxis()->GetNbins(); binId++) {
286  double new_charge = Proj->GetXaxis()->GetBinCenter(binId) / Gain;
287  if (Proj->GetBinContent(binId) != 0.) {
288  for (unsigned int h = 0; h < charge_histos.size(); h++) {
289  TH1D* chisto = (charge_histos[h])->getTH1D();
290  for (int e = 0; e < Proj->GetBinContent(binId); e++)
291  chisto->Fill(new_charge);
292  }
293  }
294  }
295  }
296 
297  if (FitMPV <= 0.) { // No fit of MPV
298  if (APV->isMasked)
299  NoMPVmasked->Fill(z, R);
300  else
301  NoMPVfit->Fill(z, R);
302 
303  } else { // Fit of MPV
304  if (FitMPV > 0.)
305  Gains->Fill(Gain);
306 
307  MPVs->Fill(FitMPV);
308  if (Thickness < 0.04)
309  MPVs320->Fill(FitMPV);
310  if (Thickness > 0.04)
311  MPVs500->Fill(FitMPV);
312 
313  MPVError->Fill(FitMPVErr);
314  MPVErrorVsMPV->Fill(FitMPV, FitMPVErr);
315  MPVErrorVsEta->Fill(Eta, FitMPVErr);
316  MPVErrorVsPhi->Fill(Phi, FitMPVErr);
317  MPVErrorVsN->Fill(NEntries, FitMPVErr);
318 
319  if (SubDet == 3) {
320  MPV_Vs_EtaTIB->Fill(Eta, FitMPV);
321  MPV_Vs_PhiTIB->Fill(Phi, FitMPV);
322  MPVsTIB->Fill(FitMPV);
323 
324  } else if (SubDet == 4) {
325  MPV_Vs_EtaTID->Fill(Eta, FitMPV);
326  MPV_Vs_PhiTID->Fill(Phi, FitMPV);
327  MPVsTID->Fill(FitMPV);
328  if (Eta < 0.)
329  MPVsTIDM->Fill(FitMPV);
330  if (Eta > 0.)
331  MPVsTIDP->Fill(FitMPV);
332 
333  } else if (SubDet == 5) {
334  MPV_Vs_EtaTOB->Fill(Eta, FitMPV);
335  MPV_Vs_PhiTOB->Fill(Phi, FitMPV);
336  MPVsTOB->Fill(FitMPV);
337 
338  } else if (SubDet == 6) {
339  MPV_Vs_EtaTEC->Fill(Eta, FitMPV);
340  MPV_Vs_PhiTEC->Fill(Phi, FitMPV);
341  MPVsTEC->Fill(FitMPV);
342  if (Eta < 0.)
343  MPVsTECM->Fill(FitMPV);
344  if (Eta > 0.)
345  MPVsTECP->Fill(FitMPV);
346  if (Thickness < 0.04) {
347  MPV_Vs_EtaTECthin->Fill(Eta, FitMPV);
348  MPV_Vs_PhiTECthin->Fill(Phi, FitMPV);
349  MPVsTECthin->Fill(FitMPV);
350  if (Eta > 0.)
351  MPVsTECP1->Fill(FitMPV);
352  if (Eta < 0.)
353  MPVsTECM1->Fill(FitMPV);
354  }
355  if (Thickness > 0.04) {
356  MPV_Vs_EtaTECthick->Fill(Eta, FitMPV);
357  MPV_Vs_PhiTECthick->Fill(Phi, FitMPV);
358  MPVsTECthick->Fill(FitMPV);
359  if (Eta > 0.)
360  MPVsTECP2->Fill(FitMPV);
361  if (Eta < 0.)
362  MPVsTECM2->Fill(FitMPV);
363  }
364  }
365  }
366 
367  if (SubDet == 3 && PreviousGain != 0.)
368  DiffWRTPrevGainTIB->Fill(Gain / PreviousGain);
369  else if (SubDet == 4 && PreviousGain != 0.)
370  DiffWRTPrevGainTID->Fill(Gain / PreviousGain);
371  else if (SubDet == 5 && PreviousGain != 0.)
372  DiffWRTPrevGainTOB->Fill(Gain / PreviousGain);
373  else if (SubDet == 6 && PreviousGain != 0.)
374  DiffWRTPrevGainTEC->Fill(Gain / PreviousGain);
375 
376  if (SubDet == 3)
377  GainVsPrevGainTIB->Fill(PreviousGain, Gain);
378  else if (SubDet == 4)
379  GainVsPrevGainTID->Fill(PreviousGain, Gain);
380  else if (SubDet == 5)
381  GainVsPrevGainTOB->Fill(PreviousGain, Gain);
382  else if (SubDet == 6)
383  GainVsPrevGainTEC->Fill(PreviousGain, Gain);
384  }
385 }
386 
387 namespace {
388 
389  std::pair<double, double> findFitRange(TH1* inputHisto) {
390  const auto prevErrorIgnoreLevel = gErrorIgnoreLevel;
392  auto charge_clone = std::unique_ptr<TH1D>(dynamic_cast<TH1D*>(inputHisto->Rebin(10, "charge_clone")));
393  gErrorIgnoreLevel = prevErrorIgnoreLevel;
394  float max_content = -1;
395  float xMax = -1;
396  for (int i = 1; i < charge_clone->GetNbinsX() + 1; ++i) {
397  const auto bin_content = charge_clone->GetBinContent(i);
398  const auto bin_center = charge_clone->GetXaxis()->GetBinCenter(i);
399  if ((bin_content > max_content) && (bin_center > 100.)) {
400  max_content = bin_content;
401  xMax = bin_center;
402  }
403  }
404  return std::pair<double, double>(xMax - 100., xMax + 500.);
405  }
406 
407  Double_t langaufun(Double_t* x, Double_t* par) {
408  // Numeric constants
409  Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
410  Double_t mpshift = -0.22278298; // Landau maximum location
411 
412  // Control constants
413  Double_t np = 100.0; // number of convolution steps
414  Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
415 
416  // Variables
417  Double_t xx;
418  Double_t mpc;
419  Double_t fland;
420  Double_t sum = 0.0;
421  Double_t xlow, xupp;
422  Double_t step;
423  Double_t i;
424 
425  // MP shift correction
426  mpc = par[1] - mpshift * par[0];
427 
428  // Range of convolution integral
429  xlow = x[0] - sc * par[3];
430  xupp = x[0] + sc * par[3];
431 
432  step = (xupp - xlow) / np;
433 
434  // Convolution integral of Landau and Gaussian by sum
435  for (i = 1.0; i <= np / 2; i++) {
436  xx = xlow + (i - .5) * step;
437  fland = TMath::Landau(xx, mpc, par[0]) / par[0];
438  sum += fland * TMath::Gaus(x[0], xx, par[3]);
439 
440  xx = xupp - (i - .5) * step;
441  fland = TMath::Landau(xx, mpc, par[0]) / par[0];
442 
443  sum += fland * TMath::Gaus(x[0], xx, par[3]);
444  }
445 
446  return (par[2] * step * sum * invsq2pi / par[3]);
447  }
448 
449  std::unique_ptr<TF1> langaufit(TH1D* his,
450  Double_t* fitrange,
451  Double_t* startvalues,
452  Double_t* parlimitslo,
453  Double_t* parlimitshi,
454  Double_t* fitparams,
455  Double_t* fiterrors,
456  Double_t* ChiSqr,
457  Int_t* NDF) {
458  Int_t i;
459  Char_t FunName[100];
460 
461  sprintf(FunName, "Fitfcn_%s", his->GetName());
462 
463  TF1* ffitold = dynamic_cast<TF1*>(gROOT->GetListOfFunctions()->FindObject(FunName));
464  if (ffitold)
465  delete ffitold;
466 
467  auto ffit = std::make_unique<TF1>(FunName, langaufun, fitrange[0], fitrange[1], 4);
468  //TF1 *ffit = new TF1(FunName,langaufun,his->GetXaxis()->GetXmin(),his->GetXaxis()->GetXmax(),4);
469  ffit->SetParameters(startvalues);
470  ffit->SetParNames("Width", "MP", "Area", "GSigma");
471 
472  for (i = 0; i < 4; i++) {
473  ffit->SetParLimits(i, parlimitslo[i], parlimitshi[i]);
474  }
475 
476  his->Fit(FunName, "QRB0"); // fit within specified range, use ParLimits, do not plot
477 
478  ffit->GetParameters(fitparams); // obtain fit parameters
479  for (i = 0; i < 4; i++) {
480  fiterrors[i] = ffit->GetParError(i); // obtain fit parameter errors
481  }
482  ChiSqr[0] = ffit->GetChisquare(); // obtain chi^2
483  NDF[0] = ffit->GetNDF(); // obtain ndf
484 
485  return ffit; // return fit function
486  }
487 } // namespace
488 
489 //********************************************************************************//
491  unsigned int I = 0;
492  TH1D* Proj = nullptr;
493  static constexpr double DEF_F = -9999.;
494  double FitResults[6] = {DEF_F, DEF_F, DEF_F, DEF_F, DEF_F, DEF_F};
495  double MPVmean = 300;
496 
497  if (Charge_Vs_Index == nullptr) {
498  edm::LogError("SiStripGainsPCLHarvester")
499  << "Harvesting: could not execute algoComputeMPVandGain method because " << m_calibrationMode
500  << " statistics cannot be retrieved.\n"
501  << "Please check if input contains " << m_calibrationMode << " data." << std::endl;
502  return;
503  }
504 
505  TH2S* chvsidx = (Charge_Vs_Index)->getTH2S();
506 
507  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
508  printf("Fitting Charge Distribution :");
509  int TreeStep = APVsColl.size() / 50;
510 
511  for (auto it = APVsColl.begin(); it != APVsColl.end(); it++, I++) {
512  if (I % TreeStep == 0) {
513  printf(".");
514  fflush(stdout);
515  }
516  std::shared_ptr<stAPVGain> APV = it->second;
517  if (APV->Bin < 0)
518  APV->Bin = chvsidx->GetXaxis()->FindBin(APV->Index);
519 
520  if (APV->isMasked) {
521  APV->Gain = APV->PreviousGain;
522  MASKED++;
523  continue;
524  }
525 
526  Proj = chvsidx->ProjectionY(
527  "", chvsidx->GetXaxis()->FindBin(APV->Index), chvsidx->GetXaxis()->FindBin(APV->Index), "e");
528  if (!Proj)
529  continue;
530 
531  if (CalibrationLevel == 0) {
532  } else if (CalibrationLevel == 1) {
533  int SecondAPVId = APV->APVId;
534  if (SecondAPVId % 2 == 0) {
535  SecondAPVId = SecondAPVId + 1;
536  } else {
537  SecondAPVId = SecondAPVId - 1;
538  }
539  std::shared_ptr<stAPVGain> APV2 = APVsColl[(APV->DetId << 4) | SecondAPVId];
540  if (APV2->Bin < 0)
541  APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
542  TH1D* Proj2 = chvsidx->ProjectionY("", APV2->Bin, APV2->Bin, "e");
543  if (Proj2) {
544  Proj->Add(Proj2, 1);
545  delete Proj2;
546  }
547  } else if (CalibrationLevel == 2) {
548  for (unsigned int i = 0; i < 16; i++) { //loop up to 6APV for Strip and up to 16 for Pixels
549  auto tmpit = APVsColl.find((APV->DetId << 4) | i);
550  if (tmpit == APVsColl.end())
551  continue;
552  std::shared_ptr<stAPVGain> APV2 = tmpit->second;
553  if (APV2->DetId != APV->DetId || APV2->APVId == APV->APVId)
554  continue;
555  if (APV2->Bin < 0)
556  APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
557  TH1D* Proj2 = chvsidx->ProjectionY("", APV2->Bin, APV2->Bin, "e");
558  if (Proj2) {
559  Proj->Add(Proj2, 1);
560  delete Proj2;
561  }
562  }
563  } else {
564  CalibrationLevel = 0;
565  printf("Unknown Calibration Level, will assume %i\n", CalibrationLevel);
566  }
567 
568  std::pair<double, double> fitRange{50., 5400.};
569  if (fit_dataDrivenRange_) {
570  fitRange = findFitRange(Proj);
571  }
572 
573  const bool isTOBL5L6 =
574  (DetId{APV->DetId}.subdetId() == StripSubdetector::TOB) && (tTopo_->tobLayer(APV->DetId) > 4);
575  getPeakOfLandau(Proj,
576  FitResults,
577  fitRange.first,
578  fitRange.second,
580 
581  // throw if the fit results are not set
582  assert(FitResults[0] != DEF_F);
583 
584  APV->FitMPV = FitResults[0];
585  APV->FitMPVErr = FitResults[1];
586  APV->FitWidth = FitResults[2];
587  APV->FitWidthErr = FitResults[3];
588  APV->FitChi2 = FitResults[4];
589  APV->FitNorm = FitResults[5];
590  APV->NEntries = Proj->GetEntries();
591 
592  // fall back to legacy fit in case of very low chi2 probability
593  if (APV->FitChi2 <= 0.1) {
594  edm::LogInfo("SiStripGainsPCLHarvester")
595  << "fit failed on this APV:" << APV->DetId << ":" << APV->APVId << " !" << std::endl;
596 
597  std::fill(FitResults, FitResults + 6, 0);
598  fitRange = std::make_pair(50., 5400.);
599 
600  APV->FitGrade = fitgrade::B;
601 
602  getPeakOfLandau(Proj, FitResults, fitRange.first, fitRange.second, false);
603 
604  APV->FitMPV = FitResults[0];
605  APV->FitMPVErr = FitResults[1];
606  APV->FitWidth = FitResults[2];
607  APV->FitWidthErr = FitResults[3];
608  APV->FitChi2 = FitResults[4];
609  APV->FitNorm = FitResults[5];
610  APV->NEntries = Proj->GetEntries();
611  } else {
612  APV->FitGrade = fitgrade::A;
613  }
614 
615  if (IsGoodLandauFit(FitResults)) {
616  APV->Gain = APV->FitMPV / MPVmean;
617  if (APV->SubDet > 2)
618  GOOD++;
619  } else {
620  APV->Gain = APV->PreviousGain;
621  if (APV->SubDet > 2)
622  BAD++;
623  }
624  if (APV->Gain <= 0)
625  APV->Gain = 1;
626 
627  delete Proj;
628  }
629  printf("\n");
630 }
631 
632 //********************************************************************************//
634  TH1* InputHisto, double* FitResults, double LowRange, double HighRange, bool gaussianConvolution) {
635  // undo defaults (checked for assertion)
636  FitResults[0] = -0.5; //MPV
637  FitResults[1] = 0; //MPV error
638  FitResults[2] = -0.5; //Width
639  FitResults[3] = 0; //Width error
640  FitResults[4] = -0.5; //Fit Chi2/NDF
641  FitResults[5] = 0; //Normalization
642 
643  if (InputHisto->GetEntries() < MinNrEntries)
644  return;
645 
646  if (gaussianConvolution) {
647  // perform fit with landau convoluted with a gaussian
648  Double_t fr[2] = {LowRange, HighRange};
649  Double_t sv[4] = {25., 300., InputHisto->Integral(), 40.};
650  Double_t pllo[4] = {0.5, 100., 1.0, 0.4};
651  Double_t plhi[4] = {100., 500., 1.e7, 100.};
652  Double_t fp[4], fpe[4];
653  Double_t chisqr;
654  Int_t ndf;
655  auto fitsnr = langaufit(dynamic_cast<TH1D*>(InputHisto), fr, sv, pllo, plhi, fp, fpe, &chisqr, &ndf);
656  FitResults[0] = fitsnr->GetMaximumX(); //MPV
657  FitResults[1] = fpe[1]; //MPV error // FIXME add error propagation
658  FitResults[2] = fp[0]; //Width
659  FitResults[3] = fpe[0]; //Width error
660  FitResults[4] = chisqr / ndf; //Fit Chi2/NDF
661  FitResults[5] = fp[2];
662  } else {
663  // perform fit with standard landau
664  TF1 MyLandau("MyLandau", "landau", LowRange, HighRange);
665  MyLandau.SetParameter(1, 300);
666  InputHisto->Fit(&MyLandau, "0QR WW");
667  // MPV is parameter 1 (0=constant, 1=MPV, 2=Sigma)
668  FitResults[0] = MyLandau.GetParameter(1); //MPV
669  FitResults[1] = MyLandau.GetParError(1); //MPV error
670  FitResults[2] = MyLandau.GetParameter(2); //Width
671  FitResults[3] = MyLandau.GetParError(2); //Width error
672  FitResults[4] = MyLandau.GetChisquare() / MyLandau.GetNDF(); //Fit Chi2/NDF
673  FitResults[5] = MyLandau.GetParameter(0);
674  }
675 }
676 
677 //********************************************************************************//
679  if (FitResults[0] <= 0)
680  return false;
681  // if(FitResults[1] > MaxMPVError )return false;
682  // if(FitResults[4] > MaxChi2OverNDF)return false;
683  return true;
684 }
685 
686 //********************************************************************************//
687 // ------------ method called once each job just before starting event loop ------------
689  auto newBareTkGeomPtr = &es.getData(tkGeomToken_);
690  auto bareTkTopoPtr = &es.getData(tTopoTokenBR_);
691  if (newBareTkGeomPtr == bareTkGeomPtr_)
692  return; // already filled APVColls, nothing changed
693 
694  if (!bareTkGeomPtr_) { // pointer not yet set: called the first time => fill the APVColls
695  auto const& Det = newBareTkGeomPtr->dets();
696 
697  unsigned int Index = 0;
698 
699  for (unsigned int i = 0; i < Det.size(); i++) {
700  DetId Detid = Det[i]->geographicalId();
701  int SubDet = Detid.subdetId();
702 
705  auto DetUnit = dynamic_cast<const StripGeomDetUnit*>(Det[i]);
706  if (!DetUnit)
707  continue;
708 
709  const StripTopology& Topo = DetUnit->specificTopology();
710  unsigned int NAPV = Topo.nstrips() / 128;
711 
712  for (unsigned int j = 0; j < NAPV; j++) {
713  auto APV = std::make_shared<stAPVGain>();
714  APV->Index = Index;
715  APV->Bin = -1;
716  APV->DetId = Detid.rawId();
717  APV->Side = 0;
718 
719  if (SubDet == StripSubdetector::TID) {
720  APV->Side = bareTkTopoPtr->tidSide(Detid);
721  } else if (SubDet == StripSubdetector::TEC) {
722  APV->Side = bareTkTopoPtr->tecSide(Detid);
723  }
724 
725  APV->APVId = j;
726  APV->SubDet = SubDet;
727  APV->FitMPV = -1;
728  APV->FitMPVErr = -1;
729  APV->FitWidth = -1;
730  APV->FitWidthErr = -1;
731  APV->FitChi2 = -1;
732  APV->FitNorm = -1;
733  APV->FitGrade = fitgrade::NONE;
734  APV->Gain = -1;
735  APV->PreviousGain = 1;
736  APV->PreviousGainTick = 1;
737  APV->x = DetUnit->position().basicVector().x();
738  APV->y = DetUnit->position().basicVector().y();
739  APV->z = DetUnit->position().basicVector().z();
740  APV->Eta = DetUnit->position().basicVector().eta();
741  APV->Phi = DetUnit->position().basicVector().phi();
742  APV->R = DetUnit->position().basicVector().transverse();
743  APV->Thickness = DetUnit->surface().bounds().thickness();
744  APV->NEntries = 0;
745  APV->isMasked = false;
746 
747  APVsCollOrdered.push_back(APV);
748  APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
749  Index++;
750  NStripAPVs++;
751  } // loop on APVs
752  } // if is Strips
753  } // loop on dets
754 
755  for (unsigned int i = 0; i < Det.size();
756  i++) { //Make two loop such that the Pixel information is added at the end --> make transition simpler
757  DetId Detid = Det[i]->geographicalId();
758  int SubDet = Detid.subdetId();
760  auto DetUnit = dynamic_cast<const PixelGeomDetUnit*>(Det[i]);
761  if (!DetUnit)
762  continue;
763 
764  const PixelTopology& Topo = DetUnit->specificTopology();
765  unsigned int NROCRow = Topo.nrows() / (80.);
766  unsigned int NROCCol = Topo.ncolumns() / (52.);
767 
768  for (unsigned int j = 0; j < NROCRow; j++) {
769  for (unsigned int i = 0; i < NROCCol; i++) {
770  auto APV = std::make_shared<stAPVGain>();
771  APV->Index = Index;
772  APV->Bin = -1;
773  APV->DetId = Detid.rawId();
774  APV->Side = 0;
775  APV->APVId = (j << 3 | i);
776  APV->SubDet = SubDet;
777  APV->FitMPV = -1;
778  APV->FitMPVErr = -1;
779  APV->FitWidth = -1;
780  APV->FitWidthErr = -1;
781  APV->FitChi2 = -1;
782  APV->FitGrade = fitgrade::NONE;
783  APV->Gain = -1;
784  APV->PreviousGain = 1;
785  APV->PreviousGainTick = 1;
786  APV->x = DetUnit->position().basicVector().x();
787  APV->y = DetUnit->position().basicVector().y();
788  APV->z = DetUnit->position().basicVector().z();
789  APV->Eta = DetUnit->position().basicVector().eta();
790  APV->Phi = DetUnit->position().basicVector().phi();
791  APV->R = DetUnit->position().basicVector().transverse();
792  APV->Thickness = DetUnit->surface().bounds().thickness();
793  APV->isMasked = false; //SiPixelQuality_->IsModuleBad(Detid.rawId());
794  APV->NEntries = 0;
795 
796  APVsCollOrdered.push_back(APV);
797  APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
798  Index++;
799  NPixelDets++;
800 
801  } // loop on ROC cols
802  } // loop on ROC rows
803  } // if Pixel
804  } // loop on Dets
805  } //if (!bareTkGeomPtr_) ...
806  bareTkGeomPtr_ = newBareTkGeomPtr;
807 }
808 
809 //********************************************************************************//
811  // The goal of this function is to check wether or not there is enough statistics
812  // to produce a meaningful tag for the DB
813 
814  if (Charge_Vs_Index == nullptr) {
815  edm::LogError("SiStripGainsPCLHarvester")
816  << "produceTagFilter -> Return false: could not retrieve the " << m_calibrationMode << " statistics.\n"
817  << "Please check if input contains " << m_calibrationMode << " data." << std::endl;
818  return false;
819  }
820 
821  float integral = (Charge_Vs_Index)->getTH2S()->Integral();
822  if ((Charge_Vs_Index)->getTH2S()->Integral(0, NStripAPVs + 1, 0, 99999) < tagCondition_NClusters) {
823  edm::LogWarning("SiStripGainsPCLHarvester")
824  << "calibrationMode -> " << m_calibrationMode << "\n"
825  << "produceTagFilter -> Return false: Statistics is too low : " << integral << std::endl;
826  return false;
827  }
828  if ((1.0 * GOOD) / (GOOD + BAD) < tagCondition_GoodFrac) {
829  edm::LogWarning("SiStripGainsPCLHarvester")
830  << "calibrationMode -> " << m_calibrationMode << "\n"
831  << "produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 * GOOD) / (GOOD + BAD)
832  << std::endl;
833  return false;
834  }
835  return true;
836 }
837 
838 //********************************************************************************//
839 std::unique_ptr<SiStripApvGain> SiStripGainsPCLHarvester::getNewObject(const MonitorElement* Charge_Vs_Index) {
840  std::unique_ptr<SiStripApvGain> obj = std::make_unique<SiStripApvGain>();
841 
842  if (!produceTagFilter(Charge_Vs_Index)) {
843  edm::LogWarning("SiStripGainsPCLHarvester")
844  << "getNewObject -> will not produce a paylaod because produceTagFilter returned false " << std::endl;
845  return obj;
846  } else {
847  doStoreOnDB = true;
848  }
849 
850  std::vector<float> theSiStripVector;
851  unsigned int PreviousDetId = 0;
852  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
853  std::shared_ptr<stAPVGain> APV = APVsCollOrdered[a];
854  if (APV == nullptr) {
855  printf("Bug\n");
856  continue;
857  }
858  if (APV->SubDet <= 2)
859  continue;
860  if (APV->DetId != PreviousDetId) {
861  if (!theSiStripVector.empty()) {
862  SiStripApvGain::Range range(theSiStripVector.begin(), theSiStripVector.end());
863  if (!obj->put(PreviousDetId, range))
864  printf("Bug to put detId = %i\n", PreviousDetId);
865  }
866  theSiStripVector.clear();
867  PreviousDetId = APV->DetId;
868  }
869  theSiStripVector.push_back(APV->Gain);
870 
871  LogDebug("SiStripGainsPCLHarvester") << " DetId: " << APV->DetId << " APV: " << APV->APVId
872  << " Gain: " << APV->Gain << std::endl;
873  }
874  if (!theSiStripVector.empty()) {
875  SiStripApvGain::Range range(theSiStripVector.begin(), theSiStripVector.end());
876  if (!obj->put(PreviousDetId, range))
877  printf("Bug to put detId = %i\n", PreviousDetId);
878  }
879 
880  return obj;
881 }
882 
883 void SiStripGainsPCLHarvester::storeGainsTree(const TAxis* chVsIdxXaxis) const {
884  unsigned int t_Index, t_Bin, t_DetId;
885  unsigned char t_APVId, t_SubDet;
886  float t_x, t_y, t_z, t_Eta, t_R, t_Phi, t_Thickness;
887  float t_FitMPV, t_FitMPVErr, t_FitWidth, t_FitWidthErr, t_FitChi2NDF, t_FitNorm, t_FitGrade;
888  double t_Gain, t_PrevGain, t_PrevGainTick, t_NEntries;
889  bool t_isMasked;
890  auto tree = edm::Service<TFileService>()->make<TTree>("APVGain", "APVGain");
891  tree->Branch("Index", &t_Index, "Index/i");
892  tree->Branch("Bin", &t_Bin, "Bin/i");
893  tree->Branch("DetId", &t_DetId, "DetId/i");
894  tree->Branch("APVId", &t_APVId, "APVId/b");
895  tree->Branch("SubDet", &t_SubDet, "SubDet/b");
896  tree->Branch("x", &t_x, "x/F");
897  tree->Branch("y", &t_y, "y/F");
898  tree->Branch("z", &t_z, "z/F");
899  tree->Branch("Eta", &t_Eta, "Eta/F");
900  tree->Branch("R", &t_R, "R/F");
901  tree->Branch("Phi", &t_Phi, "Phi/F");
902  tree->Branch("Thickness", &t_Thickness, "Thickness/F");
903  tree->Branch("FitMPV", &t_FitMPV, "FitMPV/F");
904  tree->Branch("FitMPVErr", &t_FitMPVErr, "FitMPVErr/F");
905  tree->Branch("FitWidth", &t_FitWidth, "FitWidth/F");
906  tree->Branch("FitWidthErr", &t_FitWidthErr, "FitWidthErr/F");
907  tree->Branch("FitChi2NDF", &t_FitChi2NDF, "FitChi2NDF/F");
908  tree->Branch("FitNorm", &t_FitNorm, "FitNorm/F");
909  tree->Branch("FitGrade", &t_FitGrade, "FitGrade/F");
910  tree->Branch("Gain", &t_Gain, "Gain/D");
911  tree->Branch("PrevGain", &t_PrevGain, "PrevGain/D");
912  tree->Branch("PrevGainTick", &t_PrevGainTick, "PrevGainTick/D");
913  tree->Branch("NEntries", &t_NEntries, "NEntries/D");
914  tree->Branch("isMasked", &t_isMasked, "isMasked/O");
915 
916  for (const auto& iAPV : APVsCollOrdered) {
917  if (iAPV) {
918  t_Index = iAPV->Index;
919  t_Bin = chVsIdxXaxis->FindBin(iAPV->Index);
920  t_DetId = iAPV->DetId;
921  t_APVId = iAPV->APVId;
922  t_SubDet = iAPV->SubDet;
923  t_x = iAPV->x;
924  t_y = iAPV->y;
925  t_z = iAPV->z;
926  t_Eta = iAPV->Eta;
927  t_R = iAPV->R;
928  t_Phi = iAPV->Phi;
929  t_Thickness = iAPV->Thickness;
930  t_FitMPV = iAPV->FitMPV;
931  t_FitMPVErr = iAPV->FitMPVErr;
932  t_FitWidth = iAPV->FitWidth;
933  t_FitWidthErr = iAPV->FitWidthErr;
934  t_FitChi2NDF = iAPV->FitChi2;
935  t_FitNorm = iAPV->FitNorm;
936  t_FitGrade = iAPV->FitGrade;
937  t_Gain = iAPV->Gain;
938  t_PrevGain = iAPV->PreviousGain;
939  t_PrevGainTick = iAPV->PreviousGainTick;
940  t_NEntries = iAPV->NEntries;
941  t_isMasked = iAPV->isMasked;
942 
943  tree->Fill();
944  }
945  }
946 }
947 
948 //********************************************************************************//
949 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
952  desc.setUnknown();
953  descriptions.addDefault(desc);
954 }
955 
956 //********************************************************************************//
958  if (!tTopo_) {
959  tTopo_ = std::make_unique<TrackerTopology>(isetup.getData(tTopoTokenER_));
960  }
961 }
std::unique_ptr< SiStripApvGain > getNewObject(const MonitorElement *Charge_Vs_Index)
static constexpr auto TEC
virtual int nstrips() const =0
void storeGainsTree(const TAxis *chVsIdxXaxis) const
void dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Definition: APVGainStruct.h:7
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual int ncolumns() const =0
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoTokenBR_
virtual int nrows() const =0
int subdetectorPlane(uint32_t, const TrackerTopology *)
std::vector< std::string > dqm_tag_
void beginRun(edm::Run const &run, edm::EventSetup const &isetup) override
bool produceTagFilter(const MonitorElement *Charge_Vs_Index)
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
void algoComputeMPVandGain(const MonitorElement *Charge_Vs_Index)
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
U second(std::pair< T, U > const &p)
SiStripGainsPCLHarvester(const edm::ParameterSet &ps)
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
Data available (reporting)
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int np
Definition: AMPTWrapper.h:43
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
void gainQualityMonitor(DQMStore::IBooker &ibooker_, const MonitorElement *Charge_Vs_Index) const
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400, bool gaussianConvolution=false)
std::pair< ContainerIterator, ContainerIterator > Range
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const std::complex< double > I
Definition: I.h:8
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
double const GOOD
Definition: Constants.h:13
static constexpr auto TOB
std::vector< std::string > VChargeHisto
std::unique_ptr< TrackerTopology > tTopo_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:70
Log< level::Info, false > LogInfo
Definition: DetId.h:17
bool IsGoodLandauFit(double *FitResults)
double const BAD
Definition: Constants.h:15
static constexpr auto TIB
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< MonitorElement * > FetchMonitor(std::vector< APVmon >, uint32_t, const TrackerTopology *topo=nullptr)
int subdetectorSide(uint32_t, const TrackerTopology *)
const TrackerGeometry * bareTkGeomPtr_
void endRun(edm::Run const &run, edm::EventSetup const &isetup) override
int thickness(uint32_t)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
gErrorIgnoreLevel
Definition: utils.py:27
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:338
virtual void checkBookAPVColls(const edm::EventSetup &setup)
std::vector< std::shared_ptr< stAPVGain > > APVsCollOrdered
HLT enums.
double a
Definition: hdecay.h:121
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
bool isAvailable() const
Definition: Service.h:40
Definition: APVGainStruct.h:7
step
Definition: StallMonitor.cc:98
Definition: tree.py:1
Log< level::Warning, false > LogWarning
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Definition: TkAlStyle.h:43
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoTokenER_
static constexpr auto TID
int subdetectorId(uint32_t)
virtual TH2S * getTH2S() const
Definition: Run.h:45
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
#define LogDebug(id)
def exit(msg="")
std::unordered_map< unsigned int, std::shared_ptr< stAPVGain > > APVsColl