67 #include "TObjString.h"
81 #include <unordered_map>
100 void algoEndJob()
override;
103 int statCollectionFromMode(
const char*
tag)
const;
104 void bookDQMHistos(
const char* dqm_dir,
const char*
tag);
107 void swapBFieldMode(
void);
110 void algoAnalyzeTheTree();
111 void algoComputeMPVandGain();
114 void getPeakOfLandau(TH1* InputHisto,
double* FitResults,
double LowRange = 50,
double HighRange = 5400);
115 bool IsGoodLandauFit(
double* FitResults);
117 void qualityMonitor();
118 void MakeCalibrationMap();
119 bool produceTagFilter();
121 template <
typename T>
129 std::unique_ptr<SiStripApvGain> getNewObject()
override;
174 std::array<std::vector<APVGain::APVmon>, 7>
Charge_1;
175 std::array<std::vector<APVGain::APVmon>, 7>
Charge_2;
176 std::array<std::vector<APVGain::APVmon>, 7>
Charge_3;
177 std::array<std::vector<APVGain::APVmon>, 7>
Charge_4;
260 unsigned int eventnumber = 0;
262 const std::vector<bool>* TrigTech =
nullptr;
266 const std::vector<double>* trackchi2ndof =
nullptr;
268 const std::vector<float>* trackp =
nullptr;
270 const std::vector<float>* trackpt =
nullptr;
272 const std::vector<double>* tracketa =
nullptr;
274 const std::vector<double>* trackphi =
nullptr;
276 const std::vector<unsigned int>* trackhitsvalid =
nullptr;
278 const std::vector<int>* trackalgo =
nullptr;
282 const std::vector<int>* trackindex =
nullptr;
284 const std::vector<unsigned int>* rawid =
nullptr;
286 const std::vector<double>* localdirx =
nullptr;
288 const std::vector<double>* localdiry =
nullptr;
290 const std::vector<double>* localdirz =
nullptr;
292 const std::vector<unsigned short>* firststrip =
nullptr;
294 const std::vector<unsigned short>* nstrips =
nullptr;
298 const std::vector<bool>* overlapping =
nullptr;
300 const std::vector<bool>* farfromedge =
nullptr;
302 const std::vector<unsigned int>*
charge =
nullptr;
304 const std::vector<double>*
path =
nullptr;
306 const std::vector<double>* chargeoverpath =
nullptr;
310 const std::vector<double>* gainused =
nullptr;
312 const std::vector<double>* gainusedTick =
nullptr;
324 std::unordered_map<unsigned int, stAPVGain*>
APVsColl;
335 std::vector<string>::const_iterator it = dqm_tag_.begin();
336 while (it != dqm_tag_.end()) {
338 return it - dqm_tag_.begin();
349 if (
A->GetNbinsX() ==
B->GetNbinsX()) {
352 for (
int x = 0; x <=
B->GetNbinsX() + 1; x++) {
353 for (
int y = 0; y <=
B->GetNbinsY() + 1; y++) {
354 A->SetBinContent(x, y,
A->GetBinContent(x, y) +
B->GetBinContent(x, y));
454 label = evtinfo_pset.getUntrackedParameter<
string>(
"label");
455 EventPrefix_ = evtinfo_pset.getUntrackedParameter<
string>(
"prefix");
456 EventSuffix_ = evtinfo_pset.getUntrackedParameter<
string>(
"suffix");
460 label = track_pset.getUntrackedParameter<
string>(
"label");
461 TrackPrefix_ = track_pset.getUntrackedParameter<
string>(
"prefix");
462 TrackSuffix_ = track_pset.getUntrackedParameter<
string>(
"suffix");
473 tTopoToken_ = esConsumes<edm::Transition::BeginRun>();
476 gainToken_ = esConsumes<edm::Transition::BeginRun>();
482 <<
"Setting " << dqm_dir <<
"in DQM and booking histograms for tag " <<
tag << std::endl;
490 if (!stag.empty() && stag[0] !=
'_')
491 stag.insert(0, 1,
'_');
514 std::vector<float> binXarray;
517 binXarray.push_back((
float)
a);
520 std::array<float, 688> binYarray;
522 double p1 = 0.002113;
523 double p2 = 69.01576;
525 for (
int b = 0;
b < 687;
b++) {
532 binYarray[687] = 4000.;
546 std::vector<std::pair<std::string, std::string>> hnames =
548 for (
unsigned int i = 0;
i < hnames.size();
i++) {
559 for (
unsigned int i = 0;
i < hnames.size();
i++) {
570 for (
unsigned int i = 0;
i < hnames.size();
i++) {
581 for (
unsigned int i = 0;
i < hnames.size();
i++) {
611 NoMPVfit =
dbe->
book2DD(
"NoMPVfit",
"Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
649 std::vector<std::pair<std::string, std::string>> hnames =
651 for (
unsigned int i = 0;
i < hnames.size();
i++) {
668 const char* dqm_dir =
"AlCaReco/SiStripGainsHarvesting/";
675 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " << prevMode
689 unsigned int Index = 0;
690 for (
unsigned int i = 0;
i <
Det.size();
i++) {
696 auto DetUnit = dynamic_cast<const StripGeomDetUnit*>(
Det[
i]);
701 unsigned int NAPV = Topo.
nstrips() / 128;
703 for (
unsigned int j = 0;
j < NAPV;
j++) {
713 APV->FitWidthErr = -1;
717 APV->PreviousGain = 1;
718 APV->PreviousGainTick = 1;
719 APV->x = DetUnit->position().basicVector().x();
720 APV->y = DetUnit->position().basicVector().y();
721 APV->z = DetUnit->position().basicVector().z();
722 APV->Eta = DetUnit->position().basicVector().eta();
723 APV->Phi = DetUnit->position().basicVector().phi();
724 APV->R = DetUnit->position().basicVector().transverse();
725 APV->Thickness = DetUnit->surface().bounds().thickness();
727 APV->isMasked =
false;
737 for (
unsigned int i = 0;
i <
Det.size();
742 auto DetUnit = dynamic_cast<const PixelGeomDetUnit*>(
Det[
i]);
747 unsigned int NROCRow = Topo.
nrows() / (80.);
748 unsigned int NROCCol = Topo.
ncolumns() / (52.);
750 for (
unsigned int j = 0;
j < NROCRow;
j++) {
751 for (
unsigned int i = 0;
i < NROCCol;
i++) {
756 APV->APVId = (
j << 3 |
i);
761 APV->FitWidthErr = -1;
764 APV->PreviousGain = 1;
765 APV->PreviousGainTick = 1;
766 APV->x = DetUnit->position().basicVector().x();
767 APV->y = DetUnit->position().basicVector().y();
768 APV->z = DetUnit->position().basicVector().z();
769 APV->Eta = DetUnit->position().basicVector().eta();
770 APV->Phi = DetUnit->position().basicVector().phi();
771 APV->R = DetUnit->position().basicVector().transverse();
772 APV->Thickness = DetUnit->surface().bounds().thickness();
773 APV->isMasked =
false;
801 double average_current =
runInfo.m_avg_current;
805 return ((isOn && !is0T) || (!isOn && is0T));
822 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " << prevMode
828 if (!gainHandle.isValid()) {
829 edm::LogError(
"SiStripGainFromCalibTree") <<
"gainHandle is not valid\n";
841 APV->isMasked = siStripQuality.IsApvBad(
APV->DetId,
APV->APVId);
844 if (gainHandle->getNumberOfTags() != 2) {
845 edm::LogError(
"SiStripGainFromCalibTree") <<
"NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
849 float newPreviousGain = gainHandle->getApvGain(
APV->APVId, gainHandle->getRange(
APV->DetId, 1), 1);
850 if (
APV->PreviousGain != 1 and newPreviousGain !=
APV->PreviousGain)
851 edm::LogWarning(
"SiStripGainFromCalibTree") <<
"WARNING: ParticleGain in the global tag changed\n";
852 APV->PreviousGain = newPreviousGain;
854 float newPreviousGainTick = gainHandle->getApvGain(
APV->APVId, gainHandle->getRange(
APV->DetId, 0), 0);
855 if (
APV->PreviousGainTick != 1 and newPreviousGainTick !=
APV->PreviousGainTick) {
857 <<
"WARNING: TickMarkGain in the global tag changed\n"
859 <<
" APV->SubDet: " <<
APV->SubDet <<
" APV->APVId:" <<
APV->APVId << std::endl
860 <<
" APV->PreviousGainTick: " <<
APV->PreviousGainTick <<
" newPreviousGainTick: " << newPreviousGainTick
863 APV->PreviousGainTick = newPreviousGainTick;
879 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Starting harvesting statistics" << std::endl;
886 if (!stag.empty() && stag[0] !=
'_')
887 stag.insert(0, 1,
'_');
921 <<
"Harvesting: could not retrieve " << cvi.c_str() <<
", statistics will not be summed!" << std::endl;
925 <<
"Harvesting " << (
Charge_Vs_Index[elepos])->getTH2S()->GetEntries() <<
" more clusters" << std::endl;
935 <<
"Harvesting: could not retrieve " << cvpTIB.c_str() <<
", statistics will not be summed!" << std::endl;
941 <<
"Harvesting: could not retrieve " << cvpTOB.c_str() <<
", statistics will not be summed!" << std::endl;
947 <<
"Harvesting: could not retrieve " << cvpTIDP.c_str() <<
", statistics will not be summed!" << std::endl;
953 <<
"Harvesting: could not retrieve " << cvpTIDM.c_str() <<
", statistics will not be summed!" << std::endl;
959 <<
"Harvesting: could not retrieve " << cvpTECP1.c_str() <<
", statistics will not be summed!" << std::endl;
965 <<
"Harvesting: could not retrieve " << cvpTECP2.c_str() <<
", statistics will not be summed!" << std::endl;
971 <<
"Harvesting: could not retrieve " << cvpTECM1.c_str() <<
", statistics will not be summed!" << std::endl;
977 <<
"Harvesting: could not retrieve " << cvpTECM2.c_str() <<
", statistics will not be summed!" << std::endl;
982 std::vector<std::pair<std::string, std::string>>
tags =
984 for (
unsigned int i = 0;
i <
tags.size();
i++) {
987 if ((
Charge_1[elepos][
i]).getMonitor() ==
nullptr) {
989 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
995 for (
unsigned int i = 0;
i <
tags.size();
i++) {
998 if ((
Charge_2[elepos][
i]).getMonitor() ==
nullptr) {
1000 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1006 for (
unsigned int i = 0;
i <
tags.size();
i++) {
1009 if ((
Charge_3[elepos][
i]).getMonitor() ==
nullptr) {
1011 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1017 for (
unsigned int i = 0;
i <
tags.size();
i++) {
1020 if ((
Charge_4[elepos][
i]).getMonitor() ==
nullptr) {
1022 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1035 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Analyzing calibration tree" << std::endl;
1054 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Saving summary into root file" << std::endl;
1087 FitResults[0] = -0.5;
1089 FitResults[2] = -0.5;
1091 FitResults[4] = -0.5;
1098 TF1* MyLandau =
new TF1(
"MyLandau",
"landau", LowRange, HighRange);
1099 MyLandau->SetParameter(1, 300);
1100 InputHisto->Fit(MyLandau,
"0QR WW");
1103 FitResults[0] = MyLandau->GetParameter(1);
1104 FitResults[1] = MyLandau->GetParError(1);
1105 FitResults[2] = MyLandau->GetParameter(2);
1106 FitResults[3] = MyLandau->GetParError(2);
1107 FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF();
1108 FitResults[5] = MyLandau->GetParameter(0);
1114 if (FitResults[0] <= 0)
1131 NTrack += (*trackp).size();
1135 unsigned int FirstAmplitude = 0;
1136 for (
unsigned int i = 0;
i < (*chargeoverpath).size();
i++) {
1137 FirstAmplitude += (*nstrips)[
i];
1138 int TI = (*trackindex)[
i];
1181 if (
APV->SubDet > 2) {
1189 bool Saturation =
false;
1190 for (
unsigned int s = 0;
s < (*nstrips)[
i];
s++) {
1191 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
i] +
s];
1193 StripCharge = (
int)(StripCharge * (
APV->PreviousGain /
APV->CalibGain));
1195 StripCharge = (
int)(StripCharge /
APV->CalibGain);
1197 StripCharge = (
int)(StripCharge *
APV->PreviousGain);
1199 if (StripCharge > 1024) {
1202 }
else if (StripCharge > 254) {
1210 }
else if (
APV->SubDet > 2) {
1213 Charge = (*charge)[
i] / 265.0;
1218 double ClusterChargeOverPath = ((double)
Charge) / (*path)[
i];
1219 if (
APV->SubDet > 2) {
1221 ClusterChargeOverPath /= (*gainused)[
i];
1224 ClusterChargeOverPath *= (*gainused)[
i];
1229 if (
APV->SubDet <= 2)
1239 if (
APV->SubDet > 2) {
1240 for (
unsigned int s = 0;
s < (*nstrips)[
i];
s++) {
1241 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
i] +
s];
1242 if (StripCharge > 1024)
1244 else if (StripCharge > 254)
1246 mCharge1 += StripCharge;
1247 mCharge2 += StripCharge;
1248 mCharge3 += StripCharge;
1249 mCharge4 += StripCharge;
1252 mCharge2 *= (*gainused)[
i];
1253 mCharge3 *= (*gainusedTick)[
i];
1254 mCharge4 *= ((*gainused)[
i] * (*gainusedTick)[
i]);
1256 std::vector<APVGain::APVmon>& v1 =
Charge_1[elepos];
1258 for (
unsigned int m = 0;
m < cmon1.size();
m++)
1259 cmon1[
m]->
Fill(((
double)mCharge1) / (*path)[
i]);
1261 std::vector<APVGain::APVmon>& v2 =
Charge_2[elepos];
1263 for (
unsigned int m = 0;
m < cmon2.size();
m++)
1264 cmon2[
m]->
Fill(((
double)mCharge2) / (*path)[
i]);
1266 std::vector<APVGain::APVmon>& v3 =
Charge_3[elepos];
1268 for (
unsigned int m = 0;
m < cmon3.size();
m++)
1269 cmon3[
m]->
Fill(((
double)mCharge3) / (*path)[
i]);
1271 std::vector<APVGain::APVmon>& v4 =
Charge_4[elepos];
1273 for (
unsigned int m = 0;
m < cmon4.size();
m++)
1274 cmon4[
m]->
Fill(((
double)mCharge4) / (*path)[
i]);
1287 else if (
APV->Eta > 0) {
1293 if (
APV->Thickness < 0.04) {
1296 else if (
APV->Thickness > 0.04) {
1299 }
else if (
APV->Eta > 0) {
1300 if (
APV->Thickness < 0.04) {
1303 else if (
APV->Thickness > 0.04) {
1317 TString tree_path = TString::Format(
"gainCalibrationTree%s/tree",
m_calibrationMode.c_str());
1318 TTree*
tree = dynamic_cast<TTree*>(
tfile->Get(tree_path.Data()));
1349 unsigned int nentries =
tree->GetEntries();
1350 printf(
"Number of Events = %i + %i = %i\n",
NEvent, nentries, (
NEvent + nentries));
1351 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1352 printf(
"Looping on the Tree :");
1353 int TreeStep = nentries / 50;
1356 for (
unsigned int ientry = 0; ientry <
tree->GetEntries(); ientry++) {
1357 if (ientry % TreeStep == 0) {
1361 tree->GetEntry(ientry);
1370 TH1F* Proj =
nullptr;
1371 double FitResults[6];
1372 double MPVmean = 300;
1378 <<
"Harvesting: could not execute algoComputeMPVandGain method because " <<
m_calibrationMode.c_str()
1379 <<
" statistics cannot be retrieved.\n"
1380 <<
"Please check if input contains " <<
m_calibrationMode.c_str() <<
" data." << std::endl;
1386 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1387 printf(
"Fitting Charge Distribution :");
1388 int TreeStep =
APVsColl.size() / 50;
1390 if (
I % TreeStep == 0) {
1396 APV->Bin = chvsidx->GetXaxis()->FindBin(
APV->Index);
1398 if (
APV->isMasked) {
1399 APV->Gain =
APV->PreviousGain;
1404 Proj = (TH1F*)(chvsidx->ProjectionY(
1405 "", chvsidx->GetXaxis()->FindBin(
APV->Index), chvsidx->GetXaxis()->FindBin(
APV->Index),
"e"));
1411 int SecondAPVId =
APV->APVId;
1412 if (SecondAPVId % 2 == 0) {
1413 SecondAPVId = SecondAPVId + 1;
1415 SecondAPVId = SecondAPVId - 1;
1419 APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1420 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->
Bin, APV2->
Bin,
"e"));
1422 Proj->Add(Proj2, 1);
1426 for (
unsigned int i = 0;
i < 16;
i++) {
1434 APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1435 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->
Bin, APV2->
Bin,
"e"));
1437 Proj->Add(Proj2, 1);
1447 APV->FitMPV = FitResults[0];
1448 APV->FitMPVErr = FitResults[1];
1449 APV->FitWidth = FitResults[2];
1450 APV->FitWidthErr = FitResults[3];
1451 APV->FitChi2 = FitResults[4];
1452 APV->FitNorm = FitResults[5];
1453 APV->NEntries = Proj->GetEntries();
1456 APV->Gain =
APV->FitMPV / MPVmean;
1457 if (
APV->SubDet > 2)
1460 APV->Gain =
APV->PreviousGain;
1461 if (
APV->SubDet > 2)
1481 unsigned int Index =
APV->Index;
1485 float Eta =
APV->Eta;
1488 float Thickness =
APV->Thickness;
1489 double FitMPV =
APV->FitMPV;
1490 double FitMPVErr =
APV->FitMPVErr;
1492 double NEntries =
APV->NEntries;
1493 double PreviousGain =
APV->PreviousGain;
1501 int bin = chvsidx->GetXaxis()->FindBin(Index);
1502 TH1D* Proj = chvsidx->ProjectionY(
"proj",
bin,
bin);
1503 for (
int binId = 0; binId < Proj->GetXaxis()->GetNbins(); binId++) {
1504 double new_charge = Proj->GetXaxis()->GetBinCenter(binId) /
Gain;
1505 if (Proj->GetBinContent(binId) != 0.) {
1506 for (
unsigned int h = 0;
h < charge_histos.size();
h++) {
1507 TH1D* chisto = (charge_histos[
h])->getTH1D();
1508 for (
int e = 0;
e < Proj->GetBinContent(binId);
e++)
1509 chisto->Fill(new_charge);
1526 if (Thickness < 0.04)
1528 if (Thickness > 0.04)
1542 }
else if (
SubDet == 4) {
1551 }
else if (
SubDet == 5) {
1556 }
else if (
SubDet == 6) {
1564 if (Thickness < 0.04) {
1573 if (Thickness > 0.04) {
1585 if (
SubDet == 3 && PreviousGain != 0.)
1587 else if (
SubDet == 4 && PreviousGain != 0.)
1589 else if (
SubDet == 5 && PreviousGain != 0.)
1591 else if (
SubDet == 6 && PreviousGain != 0.)
1606 unsigned int tree_Index;
1607 unsigned int tree_Bin;
1608 unsigned int tree_DetId;
1609 unsigned char tree_APVId;
1610 unsigned char tree_SubDet;
1617 float tree_Thickness;
1619 float tree_FitMPVErr;
1620 float tree_FitWidth;
1621 float tree_FitWidthErr;
1622 float tree_FitChi2NDF;
1625 double tree_PrevGain;
1626 double tree_PrevGainTick;
1627 double tree_NEntries;
1631 MyTree =
tfs->
make<TTree>(
"APVGain",
"APVGain");
1632 MyTree->Branch(
"Index", &tree_Index,
"Index/i");
1633 MyTree->Branch(
"Bin", &tree_Bin,
"Bin/i");
1634 MyTree->Branch(
"DetId", &tree_DetId,
"DetId/i");
1635 MyTree->Branch(
"APVId", &tree_APVId,
"APVId/b");
1636 MyTree->Branch(
"SubDet", &tree_SubDet,
"SubDet/b");
1637 MyTree->Branch(
"x", &tree_x,
"x/F");
1638 MyTree->Branch(
"y", &tree_y,
"y/F");
1639 MyTree->Branch(
"z", &tree_z,
"z/F");
1640 MyTree->Branch(
"Eta", &tree_Eta,
"Eta/F");
1641 MyTree->Branch(
"R", &tree_R,
"R/F");
1642 MyTree->Branch(
"Phi", &tree_Phi,
"Phi/F");
1643 MyTree->Branch(
"Thickness", &tree_Thickness,
"Thickness/F");
1644 MyTree->Branch(
"FitMPV", &tree_FitMPV,
"FitMPV/F");
1645 MyTree->Branch(
"FitMPVErr", &tree_FitMPVErr,
"FitMPVErr/F");
1646 MyTree->Branch(
"FitWidth", &tree_FitWidth,
"FitWidth/F");
1647 MyTree->Branch(
"FitWidthErr", &tree_FitWidthErr,
"FitWidthErr/F");
1648 MyTree->Branch(
"FitChi2NDF", &tree_FitChi2NDF,
"FitChi2NDF/F");
1649 MyTree->Branch(
"FitNorm", &tree_FitNorm,
"FitNorm/F");
1650 MyTree->Branch(
"Gain", &tree_Gain,
"Gain/D");
1651 MyTree->Branch(
"PrevGain", &tree_PrevGain,
"PrevGain/D");
1652 MyTree->Branch(
"PrevGainTick", &tree_PrevGainTick,
"PrevGainTick/D");
1653 MyTree->Branch(
"NEntries", &tree_NEntries,
"NEntries/D");
1654 MyTree->Branch(
"isMasked", &tree_isMasked,
"isMasked/O");
1662 fprintf(
Gains,
"Number of Strip APVs = %lu\n", static_cast<unsigned long>(
NStripAPVs));
1664 "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1675 fprintf(
Gains,
"Number of Strip APVs = %lu\n", static_cast<unsigned long>(
NStripAPVs));
1678 "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1692 "%i | %i | PreviousGain = %7.5f(tick) x %7.5f(particle) NewGain (particle) = %7.5f (#clusters=%8.0f)\n",
1695 APV->PreviousGainTick,
1700 tree_Index =
APV->Index;
1702 tree_DetId =
APV->DetId;
1703 tree_APVId =
APV->APVId;
1704 tree_SubDet =
APV->SubDet;
1708 tree_Eta =
APV->Eta;
1710 tree_Phi =
APV->Phi;
1711 tree_Thickness =
APV->Thickness;
1712 tree_FitMPV =
APV->FitMPV;
1713 tree_FitMPVErr =
APV->FitMPVErr;
1714 tree_FitWidth =
APV->FitWidth;
1715 tree_FitWidthErr =
APV->FitWidthErr;
1716 tree_FitChi2NDF =
APV->FitChi2;
1717 tree_FitNorm =
APV->FitNorm;
1718 tree_Gain =
APV->Gain;
1719 tree_PrevGain =
APV->PreviousGain;
1720 tree_PrevGainTick =
APV->PreviousGainTick;
1721 tree_NEntries =
APV->NEntries;
1722 tree_isMasked =
APV->isMasked;
1724 if (tree_DetId == 402673324) {
1725 printf(
"%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
1740 <<
"produceTagFilter -> Return false: could not retrieve the " <<
m_calibrationMode.c_str() <<
" statistics.\n"
1741 <<
"Please check if input contains " <<
m_calibrationMode.c_str() <<
" data." << std::endl;
1749 <<
"produceTagFilter -> Return false: Statistics is too low : " <<
integral << endl;
1755 <<
"produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 *
GOOD) / (
GOOD +
BAD) << endl;
1762 auto obj = std::make_unique<SiStripApvGain>();
1768 <<
"getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
1773 std::vector<float>* theSiStripVector =
nullptr;
1774 unsigned int PreviousDetId = 0;
1777 if (
APV ==
nullptr) {
1781 if (
APV->SubDet <= 2)
1783 if (
APV->DetId != PreviousDetId) {
1784 if (theSiStripVector !=
nullptr) {
1786 if (!
obj->put(PreviousDetId,
range))
1787 printf(
"Bug to put detId = %i\n", PreviousDetId);
1789 theSiStripVector =
new std::vector<float>;
1790 PreviousDetId =
APV->DetId;
1792 theSiStripVector->push_back(
APV->Gain);
1794 if (theSiStripVector !=
nullptr) {
1796 if (!
obj->put(PreviousDetId,
range))
1797 printf(
"Bug to put detId = %i\n", PreviousDetId);
1800 if (theSiStripVector !=
nullptr)
1801 delete theSiStripVector;
1820 TChain*
t1 =
new TChain(
"SiStripCalib/APVGain");
1823 unsigned int tree_DetId;
1824 unsigned char tree_APVId;
1827 t1->SetBranchAddress(
"DetId", &tree_DetId);
1828 t1->SetBranchAddress(
"APVId", &tree_APVId);
1829 t1->SetBranchAddress(
"Gain", &tree_Gain);
1831 for (
unsigned int ientry = 0; ientry <
t1->GetEntries(); ientry++) {
1832 t1->GetEntry(ientry);
1834 APV->CalibGain = tree_Gain;