61 tTopoToken_ = esConsumes<edm::Transition::EndRun>();
63 gainToken_ = esConsumes<edm::Transition::BeginRun>();
71 static constexpr
float defaultGainTick = 690. / 640.;
76 if (!gainHandle.isValid()) {
77 edm::LogError(
"SiStripGainPCLHarvester") <<
"gainHandle is not valid\n";
89 APV->isMasked = stripQuality.IsApvBad(APV->DetId, APV->APVId);
91 if (gainHandle->getNumberOfTags() != 2) {
92 edm::LogError(
"SiStripGainPCLHarvester") <<
"NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
96 float newPreviousGain = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 1), 1);
97 if (APV->PreviousGain != 1 and newPreviousGain != APV->PreviousGain)
98 edm::LogWarning(
"SiStripGainPCLHarvester") <<
"WARNING: ParticleGain in the global tag changed\n";
99 APV->PreviousGain = newPreviousGain;
101 float newPreviousGainTick =
102 APV->isMasked ? defaultGainTick : gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 0), 0);
103 if (APV->PreviousGainTick != 1 and newPreviousGainTick != APV->PreviousGainTick) {
105 <<
"WARNING: TickMarkGain in the global tag changed\n"
107 <<
" APV->SubDet: " << APV->SubDet <<
" APV->APVId:" << APV->APVId << std::endl
108 <<
" APV->PreviousGainTick: " << APV->PreviousGainTick <<
" newPreviousGainTick: " << newPreviousGainTick
111 APV->PreviousGainTick = newPreviousGainTick;
117 edm::LogInfo(
"SiStripGainsPCLHarvester") <<
"Starting harvesting statistics" << std::endl;
122 if (!stag.empty() && stag[0] !=
'_')
123 stag.insert(0, 1,
'_');
129 if (Charge_Vs_Index ==
nullptr) {
131 <<
"Harvesting: could not retrieve " << cvi.c_str() <<
", statistics will not be summed!" << std::endl;
134 <<
"Harvesting " << (Charge_Vs_Index)->getTH2S()->GetEntries() <<
" more clusters" << std::endl;
138 std::unique_ptr<SiStripApvGain> theAPVGains = this->
getNewObject(Charge_Vs_Index);
147 throw std::runtime_error(
"PoolDBService required.");
149 edm::LogInfo(
"SiStripGainsPCLHarvester") <<
"Will not produce payload!" << std::endl;
156 if (Charge_Vs_Index !=
nullptr) {
160 <<
"Harvesting: could not retrieve " << cvi.c_str() <<
"Tree won't be stored" << std::endl;
170 std::vector<APVGain::APVmon> new_charge_histos;
171 std::vector<std::pair<std::string, std::string>> cnames =
173 for (
unsigned int i = 0;
i < cnames.size();
i++) {
179 new_charge_histos.push_back(
APVGain::APVmon(thick,
id, side, plane, monitor));
187 ibooker_.
book2DD(
"MPVvsEtaTIB",
"MPV vs Eta TIB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
189 ibooker_.
book2DD(
"MPVvsEtaTID",
"MPV vs Eta TID", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
191 ibooker_.
book2DD(
"MPVvsEtaTOB",
"MPV vs Eta TOB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
193 ibooker_.
book2DD(
"MPVvsEtaTEC",
"MPV vs Eta TEC", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
195 ibooker_.
book2DD(
"MPVvsEtaTEC1",
"MPV vs Eta TEC-thin", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
197 ibooker_.
book2DD(
"MPVvsEtaTEC2",
"MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
200 ibooker_.
book2DD(
"MPVvsPhiTIB",
"MPV vs Phi TIB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
202 ibooker_.
book2DD(
"MPVvsPhiTID",
"MPV vs Phi TID", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
204 ibooker_.
book2DD(
"MPVvsPhiTOB",
"MPV vs Phi TOB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
206 ibooker_.
book2DD(
"MPVvsPhiTEC",
"MPV vs Phi TEC", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
208 ibooker_.
book2DD(
"MPVvsPhiTEC1",
"MPV vs Phi TEC-thin ", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
210 ibooker_.
book2DD(
"MPVvsPhiTEC2",
"MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
212 MonitorElement* NoMPVfit = ibooker_.
book2DD(
"NoMPVfit",
"Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
213 MonitorElement* NoMPVmasked = ibooker_.
book2DD(
"NoMPVmasked",
"Masked Modules", 350, -350, 350, 240, 0, 120);
228 MonitorElement* MPVsTECthick = ibooker_.
book1DD(
"MPV_TEC2",
"MPV TEC thick", MPVbin, MPVmin, MPVmax);
235 MonitorElement* MPVErrorVsMPV = ibooker_.
book2DD(
"MPVErrorVsMPV",
"MPV Error vs MPV", 300, 0, 600, 150, 0, 150);
236 MonitorElement* MPVErrorVsEta = ibooker_.
book2DD(
"MPVErrorVsEta",
"MPV Error vs Eta", 50, -3.0, 3.0, 150, 0, 150);
237 MonitorElement* MPVErrorVsPhi = ibooker_.
book2DD(
"MPVErrorVsPhi",
"MPV Error vs Phi", 50, -3.4, 3.4, 150, 0, 150);
238 MonitorElement* MPVErrorVsN = ibooker_.
book2DD(
"MPVErrorVsN",
"MPV Error vs N", 500, 0, 1000, 150, 0, 150);
240 MonitorElement* DiffWRTPrevGainTIB = ibooker_.
book1DD(
"DiffWRTPrevGainTIB",
"Diff w.r.t. PrevGain TIB", 250, 0, 2);
241 MonitorElement* DiffWRTPrevGainTID = ibooker_.
book1DD(
"DiffWRTPrevGainTID",
"Diff w.r.t. PrevGain TID", 250, 0, 2);
242 MonitorElement* DiffWRTPrevGainTOB = ibooker_.
book1DD(
"DiffWRTPrevGainTOB",
"Diff w.r.t. PrevGain TOB", 250, 0, 2);
243 MonitorElement* DiffWRTPrevGainTEC = ibooker_.
book1DD(
"DiffWRTPrevGainTEC",
"Diff w.r.t. PrevGain TEC", 250, 0, 2);
246 ibooker_.
book2DD(
"GainVsPrevGainTIB",
"Gain vs PrevGain TIB", 100, 0, 2, 100, 0, 2);
248 ibooker_.
book2DD(
"GainVsPrevGainTID",
"Gain vs PrevGain TID", 100, 0, 2, 100, 0, 2);
250 ibooker_.
book2DD(
"GainVsPrevGainTOB",
"Gain vs PrevGain TOB", 100, 0, 2, 100, 0, 2);
252 ibooker_.
book2DD(
"GainVsPrevGainTEC",
"Gain vs PrevGain TEC", 100, 0, 2, 100, 0, 2);
259 unsigned int Index = APV->Index;
260 unsigned int SubDet = APV->SubDet;
263 float Eta = APV->Eta;
265 float Phi = APV->Phi;
266 float Thickness = APV->Thickness;
267 double FitMPV = APV->FitMPV;
268 double FitMPVErr = APV->FitMPVErr;
269 double Gain = APV->Gain;
270 double NEntries = APV->NEntries;
271 double PreviousGain = APV->PreviousGain;
279 if (!Charge_Vs_Index)
281 TH2S* chvsidx = (Charge_Vs_Index)->getTH2S();
282 int bin = chvsidx->GetXaxis()->FindBin(Index);
283 TH1D* Proj = chvsidx->ProjectionY(
"proj", bin, bin);
284 for (
int binId = 0; binId < Proj->GetXaxis()->GetNbins(); binId++) {
285 double new_charge = Proj->GetXaxis()->GetBinCenter(binId) / Gain;
286 if (Proj->GetBinContent(binId) != 0.) {
287 for (
unsigned int h = 0;
h < charge_histos.size();
h++) {
288 TH1D* chisto = (charge_histos[
h])->getTH1D();
289 for (
int e = 0;
e < Proj->GetBinContent(binId);
e++)
290 chisto->Fill(new_charge);
298 NoMPVmasked->
Fill(z, R);
300 NoMPVfit->
Fill(z, R);
307 if (Thickness < 0.04)
308 MPVs320->
Fill(FitMPV);
309 if (Thickness > 0.04)
310 MPVs500->
Fill(FitMPV);
312 MPVError->
Fill(FitMPVErr);
313 MPVErrorVsMPV->
Fill(FitMPV, FitMPVErr);
314 MPVErrorVsEta->
Fill(Eta, FitMPVErr);
315 MPVErrorVsPhi->
Fill(Phi, FitMPVErr);
316 MPVErrorVsN->
Fill(NEntries, FitMPVErr);
319 MPV_Vs_EtaTIB->
Fill(Eta, FitMPV);
320 MPV_Vs_PhiTIB->
Fill(Phi, FitMPV);
321 MPVsTIB->
Fill(FitMPV);
323 }
else if (SubDet == 4) {
324 MPV_Vs_EtaTID->
Fill(Eta, FitMPV);
325 MPV_Vs_PhiTID->
Fill(Phi, FitMPV);
326 MPVsTID->
Fill(FitMPV);
328 MPVsTIDM->
Fill(FitMPV);
330 MPVsTIDP->
Fill(FitMPV);
332 }
else if (SubDet == 5) {
333 MPV_Vs_EtaTOB->
Fill(Eta, FitMPV);
334 MPV_Vs_PhiTOB->
Fill(Phi, FitMPV);
335 MPVsTOB->
Fill(FitMPV);
337 }
else if (SubDet == 6) {
338 MPV_Vs_EtaTEC->
Fill(Eta, FitMPV);
339 MPV_Vs_PhiTEC->
Fill(Phi, FitMPV);
340 MPVsTEC->
Fill(FitMPV);
342 MPVsTECM->
Fill(FitMPV);
344 MPVsTECP->
Fill(FitMPV);
345 if (Thickness < 0.04) {
346 MPV_Vs_EtaTECthin->
Fill(Eta, FitMPV);
347 MPV_Vs_PhiTECthin->
Fill(Phi, FitMPV);
348 MPVsTECthin->
Fill(FitMPV);
350 MPVsTECP1->
Fill(FitMPV);
352 MPVsTECM1->
Fill(FitMPV);
354 if (Thickness > 0.04) {
355 MPV_Vs_EtaTECthick->
Fill(Eta, FitMPV);
356 MPV_Vs_PhiTECthick->
Fill(Phi, FitMPV);
357 MPVsTECthick->
Fill(FitMPV);
359 MPVsTECP2->
Fill(FitMPV);
361 MPVsTECM2->
Fill(FitMPV);
366 if (SubDet == 3 && PreviousGain != 0.)
367 DiffWRTPrevGainTIB->
Fill(Gain / PreviousGain);
368 else if (SubDet == 4 && PreviousGain != 0.)
369 DiffWRTPrevGainTID->
Fill(Gain / PreviousGain);
370 else if (SubDet == 5 && PreviousGain != 0.)
371 DiffWRTPrevGainTOB->
Fill(Gain / PreviousGain);
372 else if (SubDet == 6 && PreviousGain != 0.)
373 DiffWRTPrevGainTEC->
Fill(Gain / PreviousGain);
376 GainVsPrevGainTIB->
Fill(PreviousGain, Gain);
377 else if (SubDet == 4)
378 GainVsPrevGainTID->
Fill(PreviousGain, Gain);
379 else if (SubDet == 5)
380 GainVsPrevGainTOB->
Fill(PreviousGain, Gain);
381 else if (SubDet == 6)
382 GainVsPrevGainTEC->
Fill(PreviousGain, Gain);
388 std::pair<double, double> findFitRange(TH1* inputHisto) {
389 const auto prevErrorIgnoreLevel = gErrorIgnoreLevel;
390 gErrorIgnoreLevel =
kError;
391 auto charge_clone = std::unique_ptr<TH1D>(
dynamic_cast<TH1D*
>(inputHisto->Rebin(10,
"charge_clone")));
392 gErrorIgnoreLevel = prevErrorIgnoreLevel;
393 float max_content = -1;
395 for (
int i = 1;
i < charge_clone->GetNbinsX() + 1; ++
i) {
396 const auto bin_content = charge_clone->GetBinContent(
i);
397 const auto bin_center = charge_clone->GetXaxis()->GetBinCenter(
i);
398 if ((bin_content > max_content) && (bin_center > 100.)) {
399 max_content = bin_content;
403 return std::pair<double, double>(xMax - 100., xMax + 500.);
406 Double_t langaufun(Double_t*
x, Double_t* par) {
408 Double_t invsq2pi = 0.3989422804014;
409 Double_t mpshift = -0.22278298;
425 mpc = par[1] - mpshift * par[0];
428 xlow = x[0] - sc * par[3];
429 xupp = x[0] + sc * par[3];
431 step = (xupp - xlow) / np;
434 for (i = 1.0; i <= np / 2; i++) {
435 xx = xlow + (i - .5) *
step;
436 fland = TMath::Landau(xx, mpc, par[0]) / par[0];
437 sum += fland * TMath::Gaus(x[0], xx, par[3]);
439 xx = xupp - (i - .5) *
step;
440 fland = TMath::Landau(xx, mpc, par[0]) / par[0];
442 sum += fland * TMath::Gaus(x[0], xx, par[3]);
445 return (par[2] *
step * sum * invsq2pi / par[3]);
448 std::unique_ptr<TF1> langaufit(TH1D* his,
450 Double_t* startvalues,
451 Double_t* parlimitslo,
452 Double_t* parlimitshi,
460 sprintf(FunName,
"Fitfcn_%s", his->GetName());
462 TF1* ffitold = (TF1*)gROOT->GetListOfFunctions()->FindObject(FunName);
466 auto ffit = std::make_unique<TF1>(FunName, langaufun, fitrange[0], fitrange[1], 4);
468 ffit->SetParameters(startvalues);
469 ffit->SetParNames(
"Width",
"MP",
"Area",
"GSigma");
471 for (i = 0; i < 4; i++) {
472 ffit->SetParLimits(i, parlimitslo[i], parlimitshi[i]);
475 his->Fit(FunName,
"QRB0");
477 ffit->GetParameters(fitparams);
478 for (i = 0; i < 4; i++) {
479 fiterrors[
i] = ffit->GetParError(i);
481 ChiSqr[0] = ffit->GetChisquare();
482 NDF[0] = ffit->GetNDF();
491 TH1F* Proj =
nullptr;
492 static constexpr
double DEF_F = -9999.;
493 double FitResults[6] = {DEF_F, DEF_F, DEF_F, DEF_F, DEF_F, DEF_F};
494 double MPVmean = 300;
496 if (Charge_Vs_Index ==
nullptr) {
498 <<
"Harvesting: could not execute algoComputeMPVandGain method because " <<
m_calibrationMode
499 <<
" statistics cannot be retrieved.\n"
500 <<
"Please check if input contains " <<
m_calibrationMode <<
" data." << std::endl;
504 TH2S* chvsidx = (Charge_Vs_Index)->getTH2S();
506 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
507 printf(
"Fitting Charge Distribution :");
508 int TreeStep =
APVsColl.size() / 50;
511 if (I % TreeStep == 0) {
515 std::shared_ptr<stAPVGain>
APV = it->second;
517 APV->Bin = chvsidx->GetXaxis()->FindBin(APV->Index);
520 APV->Gain = APV->PreviousGain;
525 Proj = (TH1F*)(chvsidx->ProjectionY(
526 "", chvsidx->GetXaxis()->FindBin(APV->Index), chvsidx->GetXaxis()->FindBin(APV->Index),
"e"));
532 int SecondAPVId = APV->APVId;
533 if (SecondAPVId % 2 == 0) {
534 SecondAPVId = SecondAPVId + 1;
536 SecondAPVId = SecondAPVId - 1;
538 std::shared_ptr<stAPVGain> APV2 =
APVsColl[(APV->DetId << 4) | SecondAPVId];
540 APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
541 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->Bin, APV2->Bin,
"e"));
547 for (
unsigned int i = 0; i < 16; i++) {
548 auto tmpit =
APVsColl.find((APV->DetId << 4) | i);
551 std::shared_ptr<stAPVGain> APV2 = tmpit->second;
552 if (APV2->DetId != APV->DetId || APV2->APVId == APV->APVId)
555 APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
556 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->Bin, APV2->Bin,
"e"));
567 std::pair<double, double> fitRange{50., 5400.};
569 fitRange = findFitRange(Proj);
572 const bool isTOBL5L6 =
581 assert(FitResults[0] != DEF_F);
583 APV->FitMPV = FitResults[0];
584 APV->FitMPVErr = FitResults[1];
585 APV->FitWidth = FitResults[2];
586 APV->FitWidthErr = FitResults[3];
587 APV->FitChi2 = FitResults[4];
588 APV->FitNorm = FitResults[5];
589 APV->NEntries = Proj->GetEntries();
592 if (APV->FitChi2 <= 0.1) {
594 <<
"fit failed on this APV:" << APV->DetId <<
":" << APV->APVId <<
" !" << std::endl;
596 std::fill(FitResults, FitResults + 6, 0);
597 fitRange = std::make_pair(50., 5400.);
601 getPeakOfLandau(Proj, FitResults, fitRange.first, fitRange.second,
false);
603 APV->FitMPV = FitResults[0];
604 APV->FitMPVErr = FitResults[1];
605 APV->FitWidth = FitResults[2];
606 APV->FitWidthErr = FitResults[3];
607 APV->FitChi2 = FitResults[4];
608 APV->FitNorm = FitResults[5];
609 APV->NEntries = Proj->GetEntries();
615 APV->Gain = APV->FitMPV / MPVmean;
619 APV->Gain = APV->PreviousGain;
633 TH1* InputHisto,
double* FitResults,
double LowRange,
double HighRange,
bool gaussianConvolution) {
635 FitResults[0] = -0.5;
637 FitResults[2] = -0.5;
639 FitResults[4] = -0.5;
645 if (gaussianConvolution) {
647 Double_t fr[2] = {LowRange, HighRange};
648 Double_t sv[4] = {25., 300., InputHisto->Integral(), 40.};
649 Double_t pllo[4] = {0.5, 100., 1.0, 0.4};
650 Double_t plhi[4] = {100., 500., 1.e7, 100.};
651 Double_t
fp[4], fpe[4];
654 auto fitsnr = langaufit(dynamic_cast<TH1D*>(InputHisto), fr, sv, pllo, plhi, fp, fpe, &chisqr, &ndf);
655 FitResults[0] = fitsnr->GetMaximumX();
656 FitResults[1] = fpe[1];
657 FitResults[2] = fp[0];
658 FitResults[3] = fpe[0];
659 FitResults[4] = chisqr / ndf;
660 FitResults[5] = fp[2];
663 TF1 MyLandau(
"MyLandau",
"landau", LowRange, HighRange);
664 MyLandau.SetParameter(1, 300);
665 InputHisto->Fit(&MyLandau,
"0QR WW");
667 FitResults[0] = MyLandau.GetParameter(1);
668 FitResults[1] = MyLandau.GetParError(1);
669 FitResults[2] = MyLandau.GetParameter(2);
670 FitResults[3] = MyLandau.GetParError(2);
671 FitResults[4] = MyLandau.GetChisquare() / MyLandau.GetNDF();
672 FitResults[5] = MyLandau.GetParameter(0);
678 if (FitResults[0] <= 0)
693 auto const&
Det = newBareTkGeomPtr->dets();
695 unsigned int Index = 0;
697 for (
unsigned int i = 0; i <
Det.size(); i++) {
708 unsigned int NAPV = Topo.
nstrips() / 128;
710 for (
unsigned int j = 0;
j < NAPV;
j++) {
711 auto APV = std::make_shared<stAPVGain>();
720 APV->FitWidthErr = -1;
725 APV->PreviousGain = 1;
726 APV->PreviousGainTick = 1;
727 APV->x = DetUnit->position().basicVector().x();
728 APV->y = DetUnit->position().basicVector().y();
729 APV->z = DetUnit->position().basicVector().z();
730 APV->Eta = DetUnit->position().basicVector().eta();
731 APV->Phi = DetUnit->position().basicVector().phi();
732 APV->R = DetUnit->position().basicVector().transverse();
733 APV->Thickness = DetUnit->surface().bounds().thickness();
735 APV->isMasked =
false;
745 for (
unsigned int i = 0; i <
Det.size();
755 unsigned int NROCRow = Topo.
nrows() / (80.);
756 unsigned int NROCCol = Topo.
ncolumns() / (52.);
758 for (
unsigned int j = 0;
j < NROCRow;
j++) {
759 for (
unsigned int i = 0; i < NROCCol; i++) {
760 auto APV = std::make_shared<stAPVGain>();
764 APV->APVId = (
j << 3 |
i);
769 APV->FitWidthErr = -1;
773 APV->PreviousGain = 1;
774 APV->PreviousGainTick = 1;
775 APV->x = DetUnit->position().basicVector().x();
776 APV->y = DetUnit->position().basicVector().y();
777 APV->z = DetUnit->position().basicVector().z();
778 APV->Eta = DetUnit->position().basicVector().eta();
779 APV->Phi = DetUnit->position().basicVector().phi();
780 APV->R = DetUnit->position().basicVector().transverse();
781 APV->Thickness = DetUnit->surface().bounds().thickness();
782 APV->isMasked =
false;
803 if (Charge_Vs_Index ==
nullptr) {
805 <<
"produceTagFilter -> Return false: could not retrieve the " <<
m_calibrationMode <<
" statistics.\n"
806 <<
"Please check if input contains " <<
m_calibrationMode <<
" data." << std::endl;
810 float integral = (Charge_Vs_Index)->getTH2S()->Integral();
814 <<
"produceTagFilter -> Return false: Statistics is too low : " << integral << std::endl;
820 <<
"produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 *
GOOD) / (
GOOD +
BAD)
829 std::unique_ptr<SiStripApvGain>
obj = std::make_unique<SiStripApvGain>();
833 <<
"getNewObject -> will not produce a paylaod because produceTagFilter returned false " << std::endl;
839 std::vector<float> theSiStripVector;
840 unsigned int PreviousDetId = 0;
843 if (APV ==
nullptr) {
847 if (APV->SubDet <= 2)
849 if (APV->DetId != PreviousDetId) {
850 if (!theSiStripVector.empty()) {
852 if (!obj->put(PreviousDetId,
range))
853 printf(
"Bug to put detId = %i\n", PreviousDetId);
855 theSiStripVector.clear();
856 PreviousDetId = APV->DetId;
858 theSiStripVector.push_back(APV->Gain);
860 LogDebug(
"SiStripGainsPCLHarvester") <<
" DetId: " << APV->DetId <<
" APV: " << APV->APVId
861 <<
" Gain: " << APV->Gain << std::endl;
863 if (!theSiStripVector.empty()) {
865 if (!obj->put(PreviousDetId,
range))
866 printf(
"Bug to put detId = %i\n", PreviousDetId);
873 unsigned int t_Index, t_Bin, t_DetId;
874 unsigned char t_APVId, t_SubDet;
875 float t_x,
t_y,
t_z, t_Eta, t_R, t_Phi, t_Thickness;
876 float t_FitMPV, t_FitMPVErr, t_FitWidth, t_FitWidthErr, t_FitChi2NDF, t_FitNorm, t_FitGrade;
877 double t_Gain, t_PrevGain, t_PrevGainTick, t_NEntries;
880 tree->Branch(
"Index", &t_Index,
"Index/i");
881 tree->Branch(
"Bin", &t_Bin,
"Bin/i");
882 tree->Branch(
"DetId", &t_DetId,
"DetId/i");
883 tree->Branch(
"APVId", &t_APVId,
"APVId/b");
884 tree->Branch(
"SubDet", &t_SubDet,
"SubDet/b");
885 tree->Branch(
"x", &t_x,
"x/F");
886 tree->Branch(
"y", &t_y,
"y/F");
887 tree->Branch(
"z", &t_z,
"z/F");
888 tree->Branch(
"Eta", &t_Eta,
"Eta/F");
889 tree->Branch(
"R", &t_R,
"R/F");
890 tree->Branch(
"Phi", &t_Phi,
"Phi/F");
891 tree->Branch(
"Thickness", &t_Thickness,
"Thickness/F");
892 tree->Branch(
"FitMPV", &t_FitMPV,
"FitMPV/F");
893 tree->Branch(
"FitMPVErr", &t_FitMPVErr,
"FitMPVErr/F");
894 tree->Branch(
"FitWidth", &t_FitWidth,
"FitWidth/F");
895 tree->Branch(
"FitWidthErr", &t_FitWidthErr,
"FitWidthErr/F");
896 tree->Branch(
"FitChi2NDF", &t_FitChi2NDF,
"FitChi2NDF/F");
897 tree->Branch(
"FitNorm", &t_FitNorm,
"FitNorm/F");
898 tree->Branch(
"FitGrade", &t_FitGrade,
"FitGrade/F");
899 tree->Branch(
"Gain", &t_Gain,
"Gain/D");
900 tree->Branch(
"PrevGain", &t_PrevGain,
"PrevGain/D");
901 tree->Branch(
"PrevGainTick", &t_PrevGainTick,
"PrevGainTick/D");
902 tree->Branch(
"NEntries", &t_NEntries,
"NEntries/D");
903 tree->Branch(
"isMasked", &t_isMasked,
"isMasked/O");
907 t_Index = iAPV->Index;
908 t_Bin = chVsIdxXaxis->FindBin(iAPV->Index);
909 t_DetId = iAPV->DetId;
910 t_APVId = iAPV->APVId;
911 t_SubDet = iAPV->SubDet;
918 t_Thickness = iAPV->Thickness;
919 t_FitMPV = iAPV->FitMPV;
920 t_FitMPVErr = iAPV->FitMPVErr;
921 t_FitWidth = iAPV->FitWidth;
922 t_FitWidthErr = iAPV->FitWidthErr;
923 t_FitChi2NDF = iAPV->FitChi2;
924 t_FitNorm = iAPV->FitNorm;
925 t_FitGrade = iAPV->FitGrade;
927 t_PrevGain = iAPV->PreviousGain;
928 t_PrevGainTick = iAPV->PreviousGainTick;
929 t_NEntries = iAPV->NEntries;
930 t_isMasked = iAPV->isMasked;
bool fit_gaussianConvolutionTOBL56_
std::unique_ptr< SiStripApvGain > getNewObject(const MonitorElement *Charge_Vs_Index)
static constexpr auto TEC
virtual int nstrips() const =0
T getUntrackedParameter(std::string const &, T const &) const
void dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
virtual void setCurrentFolder(std::string const &fullpath)
virtual int ncolumns() const =0
constexpr uint32_t rawId() const
get the raw id
bool fit_gaussianConvolution_
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 storeGainsTree(const TAxis *chVsIdxXaxis) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void algoComputeMPVandGain(const MonitorElement *Charge_Vs_Index)
const uint16_t range(const Frame &aFrame)
bool getData(T &iHolder) const
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())
Data available (reporting)
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
double tagCondition_GoodFrac
bool doChargeMonitorPerPlane
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
virtual MonitorElement * get(std::string const &fullpath) const
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400, bool gaussianConvolution=false)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::pair< ContainerIterator, ContainerIterator > Range
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const std::complex< double > I
static constexpr auto TOB
std::vector< std::string > VChargeHisto
std::unique_ptr< TrackerTopology > tTopo_
Integral< F, X >::type integral(const F &f)
virtual TH2S * getTH2S() const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::string m_calibrationMode
Log< level::Info, false > LogInfo
bool IsGoodLandauFit(double *FitResults)
static constexpr auto TIB
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
void gainQualityMonitor(DQMStore::IBooker &ibooker_, const MonitorElement *Charge_Vs_Index) const
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
double tagCondition_NClusters
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual void checkBookAPVColls(const edm::EventSetup &setup)
std::vector< std::shared_ptr< stAPVGain > > APVsCollOrdered
cond::Time_t currentTime() const
bool fit_dataDrivenRange_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
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.
static constexpr auto TID
int subdetectorId(uint32_t)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
constexpr DetId()
Create an empty or null id (also for persistence)
std::unordered_map< unsigned int, std::shared_ptr< stAPVGain > > APVsColl