68 #include "TObjString.h"
82 #include <unordered_map>
101 void algoEndJob()
override;
104 int statCollectionFromMode(
const char*
tag)
const;
105 void bookDQMHistos(
const char* dqm_dir,
const char*
tag);
108 void swapBFieldMode(
void);
111 void algoAnalyzeTheTree();
112 void algoComputeMPVandGain();
115 void getPeakOfLandau(TH1* InputHisto,
double* FitResults,
double LowRange = 50,
double HighRange = 5400);
116 bool IsGoodLandauFit(
double* FitResults);
118 void qualityMonitor();
119 void MakeCalibrationMap();
120 bool produceTagFilter();
122 template <
typename T>
130 std::unique_ptr<SiStripApvGain> getNewObject()
override;
175 std::array<std::vector<APVGain::APVmon>, 7>
Charge_1;
176 std::array<std::vector<APVGain::APVmon>, 7>
Charge_2;
177 std::array<std::vector<APVGain::APVmon>, 7>
Charge_3;
178 std::array<std::vector<APVGain::APVmon>, 7>
Charge_4;
261 unsigned int eventnumber = 0;
263 const std::vector<bool>* TrigTech =
nullptr;
267 const std::vector<double>* trackchi2ndof =
nullptr;
269 const std::vector<float>* trackp =
nullptr;
271 const std::vector<float>* trackpt =
nullptr;
273 const std::vector<double>* tracketa =
nullptr;
275 const std::vector<double>* trackphi =
nullptr;
277 const std::vector<unsigned int>* trackhitsvalid =
nullptr;
279 const std::vector<int>* trackalgo =
nullptr;
283 const std::vector<int>* trackindex =
nullptr;
285 const std::vector<unsigned int>* rawid =
nullptr;
287 const std::vector<double>* localdirx =
nullptr;
289 const std::vector<double>* localdiry =
nullptr;
291 const std::vector<double>* localdirz =
nullptr;
293 const std::vector<unsigned short>* firststrip =
nullptr;
295 const std::vector<unsigned short>* nstrips =
nullptr;
297 const std::vector<bool>* saturation =
nullptr;
299 const std::vector<bool>* overlapping =
nullptr;
301 const std::vector<bool>* farfromedge =
nullptr;
303 const std::vector<unsigned int>*
charge =
nullptr;
305 const std::vector<double>*
path =
nullptr;
307 const std::vector<double>* chargeoverpath =
nullptr;
311 const std::vector<double>* gainused =
nullptr;
313 const std::vector<double>* gainusedTick =
nullptr;
325 std::unordered_map<unsigned int, stAPVGain*>
APVsColl;
330 std::vector<string>::const_iterator it = dqm_tag_.begin();
331 while (it != dqm_tag_.end()) {
333 return it - dqm_tag_.begin();
344 if (
A->GetNbinsX() ==
B->GetNbinsX()) {
347 for (
int x = 0; x <=
B->GetNbinsX() + 1; x++) {
348 for (
int y = 0; y <=
B->GetNbinsY() + 1; y++) {
349 A->SetBinContent(x, y,
A->GetBinContent(x, y) +
B->GetBinContent(x, y));
449 label = evtinfo_pset.getUntrackedParameter<
string>(
"label");
450 EventPrefix_ = evtinfo_pset.getUntrackedParameter<
string>(
"prefix");
451 EventSuffix_ = evtinfo_pset.getUntrackedParameter<
string>(
"suffix");
455 label = track_pset.getUntrackedParameter<
string>(
"label");
456 TrackPrefix_ = track_pset.getUntrackedParameter<
string>(
"prefix");
457 TrackSuffix_ = track_pset.getUntrackedParameter<
string>(
"suffix");
473 <<
"Setting " << dqm_dir <<
"in DQM and booking histograms for tag " <<
tag << std::endl;
481 if (!stag.empty() && stag[0] !=
'_')
482 stag.insert(0, 1,
'_');
505 std::vector<float> binXarray;
508 binXarray.push_back((
float)
a);
511 std::array<float, 688> binYarray;
513 double p1 = 0.002113;
514 double p2 = 69.01576;
516 for (
int b = 0;
b < 687;
b++) {
523 binYarray[687] = 4000.;
537 std::vector<std::pair<std::string, std::string>> hnames =
539 for (
unsigned int i = 0;
i < hnames.size();
i++) {
549 for (
unsigned int i = 0;
i < hnames.size();
i++) {
559 for (
unsigned int i = 0;
i < hnames.size();
i++) {
569 for (
unsigned int i = 0;
i < hnames.size();
i++) {
598 NoMPVfit =
dbe->
book2DD(
"NoMPVfit",
"Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
636 std::vector<std::pair<std::string, std::string>> hnames =
638 for (
unsigned int i = 0;
i < hnames.size();
i++) {
654 const char* dqm_dir =
"AlCaReco/SiStripGainsHarvesting/";
661 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " << prevMode
675 auto const&
Det = tkGeom->
dets();
679 unsigned int Index = 0;
680 for (
unsigned int i = 0;
i <
Det.size();
i++) {
686 auto DetUnit = dynamic_cast<const StripGeomDetUnit*>(
Det[
i]);
691 unsigned int NAPV = Topo.
nstrips() / 128;
693 for (
unsigned int j = 0;
j < NAPV;
j++) {
703 APV->FitWidthErr = -1;
707 APV->PreviousGain = 1;
708 APV->PreviousGainTick = 1;
709 APV->x = DetUnit->position().basicVector().x();
710 APV->y = DetUnit->position().basicVector().y();
711 APV->z = DetUnit->position().basicVector().z();
712 APV->Eta = DetUnit->position().basicVector().eta();
713 APV->Phi = DetUnit->position().basicVector().phi();
714 APV->R = DetUnit->position().basicVector().transverse();
715 APV->Thickness = DetUnit->surface().bounds().thickness();
717 APV->isMasked =
false;
727 for (
unsigned int i = 0;
i <
Det.size();
732 auto DetUnit = dynamic_cast<const PixelGeomDetUnit*>(
Det[
i]);
737 unsigned int NROCRow = Topo.
nrows() / (80.);
738 unsigned int NROCCol = Topo.
ncolumns() / (52.);
740 for (
unsigned int j = 0;
j < NROCRow;
j++) {
741 for (
unsigned int i = 0;
i < NROCCol;
i++) {
746 APV->APVId = (
j << 3 |
i);
751 APV->FitWidthErr = -1;
754 APV->PreviousGain = 1;
755 APV->PreviousGainTick = 1;
756 APV->x = DetUnit->position().basicVector().x();
757 APV->y = DetUnit->position().basicVector().y();
758 APV->z = DetUnit->position().basicVector().z();
759 APV->Eta = DetUnit->position().basicVector().eta();
760 APV->Phi = DetUnit->position().basicVector().phi();
761 APV->R = DetUnit->position().basicVector().transverse();
762 APV->Thickness = DetUnit->surface().bounds().thickness();
763 APV->isMasked =
false;
796 return ((isOn && !is0T) || (!isOn && is0T));
813 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " << prevMode
821 edm::LogError(
"SiStripGainFromCalibTree") <<
"gainHandle is not valid\n";
839 edm::LogError(
"SiStripGainFromCalibTree") <<
"NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
844 if (
APV->PreviousGain != 1 and newPreviousGain !=
APV->PreviousGain)
845 edm::LogWarning(
"SiStripGainFromCalibTree") <<
"WARNING: ParticleGain in the global tag changed\n";
846 APV->PreviousGain = newPreviousGain;
849 if (
APV->PreviousGainTick != 1 and newPreviousGainTick !=
APV->PreviousGainTick) {
851 <<
"WARNING: TickMarkGain in the global tag changed\n"
853 <<
" APV->SubDet: " <<
APV->SubDet <<
" APV->APVId:" <<
APV->APVId << std::endl
854 <<
" APV->PreviousGainTick: " <<
APV->PreviousGainTick <<
" newPreviousGainTick: " << newPreviousGainTick
857 APV->PreviousGainTick = newPreviousGainTick;
873 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Starting harvesting statistics" << std::endl;
880 if (!stag.empty() && stag[0] !=
'_')
881 stag.insert(0, 1,
'_');
915 <<
"Harvesting: could not retrieve " << cvi.c_str() <<
", statistics will not be summed!" << std::endl;
919 <<
"Harvesting " << (
Charge_Vs_Index[elepos])->getTH2S()->GetEntries() <<
" more clusters" << std::endl;
929 <<
"Harvesting: could not retrieve " << cvpTIB.c_str() <<
", statistics will not be summed!" << std::endl;
935 <<
"Harvesting: could not retrieve " << cvpTOB.c_str() <<
", statistics will not be summed!" << std::endl;
941 <<
"Harvesting: could not retrieve " << cvpTIDP.c_str() <<
", statistics will not be summed!" << std::endl;
947 <<
"Harvesting: could not retrieve " << cvpTIDM.c_str() <<
", statistics will not be summed!" << std::endl;
953 <<
"Harvesting: could not retrieve " << cvpTECP1.c_str() <<
", statistics will not be summed!" << std::endl;
959 <<
"Harvesting: could not retrieve " << cvpTECP2.c_str() <<
", statistics will not be summed!" << std::endl;
965 <<
"Harvesting: could not retrieve " << cvpTECM1.c_str() <<
", statistics will not be summed!" << std::endl;
971 <<
"Harvesting: could not retrieve " << cvpTECM2.c_str() <<
", statistics will not be summed!" << std::endl;
976 std::vector<std::pair<std::string, std::string>>
tags =
978 for (
unsigned int i = 0;
i <
tags.size();
i++) {
981 if ((
Charge_1[elepos][
i]).getMonitor() ==
nullptr) {
983 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
989 for (
unsigned int i = 0;
i <
tags.size();
i++) {
992 if ((
Charge_2[elepos][
i]).getMonitor() ==
nullptr) {
994 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1000 for (
unsigned int i = 0;
i <
tags.size();
i++) {
1003 if ((
Charge_3[elepos][
i]).getMonitor() ==
nullptr) {
1005 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1011 for (
unsigned int i = 0;
i <
tags.size();
i++) {
1014 if ((
Charge_4[elepos][
i]).getMonitor() ==
nullptr) {
1016 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1029 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Analyzing calibration tree" << std::endl;
1048 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Saving summary into root file" << std::endl;
1081 FitResults[0] = -0.5;
1083 FitResults[2] = -0.5;
1085 FitResults[4] = -0.5;
1092 TF1* MyLandau =
new TF1(
"MyLandau",
"landau", LowRange, HighRange);
1093 MyLandau->SetParameter(1, 300);
1094 InputHisto->Fit(MyLandau,
"0QR WW");
1097 FitResults[0] = MyLandau->GetParameter(1);
1098 FitResults[1] = MyLandau->GetParError(1);
1099 FitResults[2] = MyLandau->GetParameter(2);
1100 FitResults[3] = MyLandau->GetParError(2);
1101 FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF();
1102 FitResults[5] = MyLandau->GetParameter(0);
1108 if (FitResults[0] <= 0)
1125 NTrack += (*trackp).size();
1129 unsigned int FirstAmplitude = 0;
1130 for (
unsigned int i = 0;
i < (*chargeoverpath).size();
i++) {
1131 FirstAmplitude += (*nstrips)[
i];
1132 int TI = (*trackindex)[
i];
1175 if (
APV->SubDet > 2) {
1183 bool Saturation =
false;
1184 for (
unsigned int s = 0;
s < (*nstrips)[
i];
s++) {
1185 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
i] +
s];
1187 StripCharge = (
int)(StripCharge * (
APV->PreviousGain /
APV->CalibGain));
1189 StripCharge = (
int)(StripCharge /
APV->CalibGain);
1191 StripCharge = (
int)(StripCharge *
APV->PreviousGain);
1193 if (StripCharge > 1024) {
1196 }
else if (StripCharge > 254) {
1204 }
else if (
APV->SubDet > 2) {
1207 Charge = (*charge)[
i] / 265.0;
1212 double ClusterChargeOverPath = ((double)
Charge) / (*path)[
i];
1213 if (
APV->SubDet > 2) {
1215 ClusterChargeOverPath /= (*gainused)[
i];
1218 ClusterChargeOverPath *= (*gainused)[
i];
1223 if (
APV->SubDet <= 2)
1233 if (
APV->SubDet > 2) {
1234 for (
unsigned int s = 0;
s < (*nstrips)[
i];
s++) {
1235 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
i] +
s];
1236 if (StripCharge > 1024)
1238 else if (StripCharge > 254)
1240 mCharge1 += StripCharge;
1241 mCharge2 += StripCharge;
1242 mCharge3 += StripCharge;
1243 mCharge4 += StripCharge;
1246 mCharge2 *= (*gainused)[
i];
1247 mCharge3 *= (*gainusedTick)[
i];
1248 mCharge4 *= ((*gainused)[
i] * (*gainusedTick)[
i]);
1250 std::vector<APVGain::APVmon>& v1 =
Charge_1[elepos];
1252 for (
unsigned int m = 0;
m < cmon1.size();
m++)
1253 cmon1[
m]->
Fill(((
double)mCharge1) / (*path)[
i]);
1255 std::vector<APVGain::APVmon>& v2 =
Charge_2[elepos];
1257 for (
unsigned int m = 0;
m < cmon2.size();
m++)
1258 cmon2[
m]->
Fill(((
double)mCharge2) / (*path)[
i]);
1260 std::vector<APVGain::APVmon>& v3 =
Charge_3[elepos];
1262 for (
unsigned int m = 0;
m < cmon3.size();
m++)
1263 cmon3[
m]->
Fill(((
double)mCharge3) / (*path)[
i]);
1265 std::vector<APVGain::APVmon>& v4 =
Charge_4[elepos];
1267 for (
unsigned int m = 0;
m < cmon4.size();
m++)
1268 cmon4[
m]->
Fill(((
double)mCharge4) / (*path)[
i]);
1281 else if (
APV->Eta > 0) {
1287 if (
APV->Thickness < 0.04) {
1290 else if (
APV->Thickness > 0.04) {
1293 }
else if (
APV->Eta > 0) {
1294 if (
APV->Thickness < 0.04) {
1297 else if (
APV->Thickness > 0.04) {
1311 TString tree_path = TString::Format(
"gainCalibrationTree%s/tree",
m_calibrationMode.c_str());
1312 TTree*
tree = dynamic_cast<TTree*>(
tfile->Get(tree_path.Data()));
1343 unsigned int nentries =
tree->GetEntries();
1344 printf(
"Number of Events = %i + %i = %i\n",
NEvent, nentries, (
NEvent + nentries));
1345 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1346 printf(
"Looping on the Tree :");
1347 int TreeStep = nentries / 50;
1350 for (
unsigned int ientry = 0; ientry <
tree->GetEntries(); ientry++) {
1351 if (ientry % TreeStep == 0) {
1355 tree->GetEntry(ientry);
1364 TH1F* Proj =
nullptr;
1365 double FitResults[6];
1366 double MPVmean = 300;
1372 <<
"Harvesting: could not execute algoComputeMPVandGain method because " <<
m_calibrationMode.c_str()
1373 <<
" statistics cannot be retrieved.\n"
1374 <<
"Please check if input contains " <<
m_calibrationMode.c_str() <<
" data." << std::endl;
1380 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1381 printf(
"Fitting Charge Distribution :");
1382 int TreeStep =
APVsColl.size() / 50;
1384 if (
I % TreeStep == 0) {
1390 APV->Bin = chvsidx->GetXaxis()->FindBin(
APV->Index);
1392 if (
APV->isMasked) {
1393 APV->Gain =
APV->PreviousGain;
1398 Proj = (TH1F*)(chvsidx->ProjectionY(
1399 "", chvsidx->GetXaxis()->FindBin(
APV->Index), chvsidx->GetXaxis()->FindBin(
APV->Index),
"e"));
1405 int SecondAPVId =
APV->APVId;
1406 if (SecondAPVId % 2 == 0) {
1407 SecondAPVId = SecondAPVId + 1;
1409 SecondAPVId = SecondAPVId - 1;
1413 APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1414 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->
Bin, APV2->
Bin,
"e"));
1416 Proj->Add(Proj2, 1);
1420 for (
unsigned int i = 0;
i < 16;
i++) {
1428 APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1429 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->
Bin, APV2->
Bin,
"e"));
1431 Proj->Add(Proj2, 1);
1441 APV->FitMPV = FitResults[0];
1442 APV->FitMPVErr = FitResults[1];
1443 APV->FitWidth = FitResults[2];
1444 APV->FitWidthErr = FitResults[3];
1445 APV->FitChi2 = FitResults[4];
1446 APV->FitNorm = FitResults[5];
1447 APV->NEntries = Proj->GetEntries();
1450 APV->Gain =
APV->FitMPV / MPVmean;
1451 if (
APV->SubDet > 2)
1454 APV->Gain =
APV->PreviousGain;
1455 if (
APV->SubDet > 2)
1475 unsigned int Index =
APV->Index;
1479 float Eta =
APV->Eta;
1482 float Thickness =
APV->Thickness;
1483 double FitMPV =
APV->FitMPV;
1484 double FitMPVErr =
APV->FitMPVErr;
1486 double NEntries =
APV->NEntries;
1487 double PreviousGain =
APV->PreviousGain;
1495 int bin = chvsidx->GetXaxis()->FindBin(Index);
1496 TH1D* Proj = chvsidx->ProjectionY(
"proj",
bin,
bin);
1497 for (
int binId = 0; binId < Proj->GetXaxis()->GetNbins(); binId++) {
1498 double new_charge = Proj->GetXaxis()->GetBinCenter(binId) /
Gain;
1499 if (Proj->GetBinContent(binId) != 0.) {
1500 for (
unsigned int h = 0;
h < charge_histos.size();
h++) {
1501 TH1D* chisto = (charge_histos[
h])->getTH1D();
1502 for (
int e = 0;
e < Proj->GetBinContent(binId);
e++)
1503 chisto->Fill(new_charge);
1520 if (Thickness < 0.04)
1522 if (Thickness > 0.04)
1536 }
else if (
SubDet == 4) {
1545 }
else if (
SubDet == 5) {
1550 }
else if (
SubDet == 6) {
1558 if (Thickness < 0.04) {
1567 if (Thickness > 0.04) {
1579 if (
SubDet == 3 && PreviousGain != 0.)
1581 else if (
SubDet == 4 && PreviousGain != 0.)
1583 else if (
SubDet == 5 && PreviousGain != 0.)
1585 else if (
SubDet == 6 && PreviousGain != 0.)
1600 unsigned int tree_Index;
1601 unsigned int tree_Bin;
1602 unsigned int tree_DetId;
1603 unsigned char tree_APVId;
1604 unsigned char tree_SubDet;
1611 float tree_Thickness;
1613 float tree_FitMPVErr;
1614 float tree_FitWidth;
1615 float tree_FitWidthErr;
1616 float tree_FitChi2NDF;
1619 double tree_PrevGain;
1620 double tree_PrevGainTick;
1621 double tree_NEntries;
1625 MyTree =
tfs->
make<TTree>(
"APVGain",
"APVGain");
1626 MyTree->Branch(
"Index", &tree_Index,
"Index/i");
1627 MyTree->Branch(
"Bin", &tree_Bin,
"Bin/i");
1628 MyTree->Branch(
"DetId", &tree_DetId,
"DetId/i");
1629 MyTree->Branch(
"APVId", &tree_APVId,
"APVId/b");
1630 MyTree->Branch(
"SubDet", &tree_SubDet,
"SubDet/b");
1631 MyTree->Branch(
"x", &tree_x,
"x/F");
1632 MyTree->Branch(
"y", &tree_y,
"y/F");
1633 MyTree->Branch(
"z", &tree_z,
"z/F");
1634 MyTree->Branch(
"Eta", &tree_Eta,
"Eta/F");
1635 MyTree->Branch(
"R", &tree_R,
"R/F");
1636 MyTree->Branch(
"Phi", &tree_Phi,
"Phi/F");
1637 MyTree->Branch(
"Thickness", &tree_Thickness,
"Thickness/F");
1638 MyTree->Branch(
"FitMPV", &tree_FitMPV,
"FitMPV/F");
1639 MyTree->Branch(
"FitMPVErr", &tree_FitMPVErr,
"FitMPVErr/F");
1640 MyTree->Branch(
"FitWidth", &tree_FitWidth,
"FitWidth/F");
1641 MyTree->Branch(
"FitWidthErr", &tree_FitWidthErr,
"FitWidthErr/F");
1642 MyTree->Branch(
"FitChi2NDF", &tree_FitChi2NDF,
"FitChi2NDF/F");
1643 MyTree->Branch(
"FitNorm", &tree_FitNorm,
"FitNorm/F");
1644 MyTree->Branch(
"Gain", &tree_Gain,
"Gain/D");
1645 MyTree->Branch(
"PrevGain", &tree_PrevGain,
"PrevGain/D");
1646 MyTree->Branch(
"PrevGainTick", &tree_PrevGainTick,
"PrevGainTick/D");
1647 MyTree->Branch(
"NEntries", &tree_NEntries,
"NEntries/D");
1648 MyTree->Branch(
"isMasked", &tree_isMasked,
"isMasked/O");
1656 fprintf(
Gains,
"Number of Strip APVs = %lu\n", static_cast<unsigned long>(
NStripAPVs));
1658 "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1669 fprintf(
Gains,
"Number of Strip APVs = %lu\n", static_cast<unsigned long>(
NStripAPVs));
1672 "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1686 "%i | %i | PreviousGain = %7.5f(tick) x %7.5f(particle) NewGain (particle) = %7.5f (#clusters=%8.0f)\n",
1689 APV->PreviousGainTick,
1694 tree_Index =
APV->Index;
1696 tree_DetId =
APV->DetId;
1697 tree_APVId =
APV->APVId;
1698 tree_SubDet =
APV->SubDet;
1702 tree_Eta =
APV->Eta;
1704 tree_Phi =
APV->Phi;
1705 tree_Thickness =
APV->Thickness;
1706 tree_FitMPV =
APV->FitMPV;
1707 tree_FitMPVErr =
APV->FitMPVErr;
1708 tree_FitWidth =
APV->FitWidth;
1709 tree_FitWidthErr =
APV->FitWidthErr;
1710 tree_FitChi2NDF =
APV->FitChi2;
1711 tree_FitNorm =
APV->FitNorm;
1712 tree_Gain =
APV->Gain;
1713 tree_PrevGain =
APV->PreviousGain;
1714 tree_PrevGainTick =
APV->PreviousGainTick;
1715 tree_NEntries =
APV->NEntries;
1716 tree_isMasked =
APV->isMasked;
1718 if (tree_DetId == 402673324) {
1719 printf(
"%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
1734 <<
"produceTagFilter -> Return false: could not retrieve the " <<
m_calibrationMode.c_str() <<
" statistics.\n"
1735 <<
"Please check if input contains " <<
m_calibrationMode.c_str() <<
" data." << std::endl;
1743 <<
"produceTagFilter -> Return false: Statistics is too low : " <<
integral << endl;
1749 <<
"produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 *
GOOD) / (
GOOD +
BAD) << endl;
1756 auto obj = std::make_unique<SiStripApvGain>();
1762 <<
"getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
1767 std::vector<float>* theSiStripVector =
nullptr;
1768 unsigned int PreviousDetId = 0;
1771 if (
APV ==
nullptr) {
1775 if (
APV->SubDet <= 2)
1777 if (
APV->DetId != PreviousDetId) {
1778 if (theSiStripVector !=
nullptr) {
1780 if (!
obj->put(PreviousDetId,
range))
1781 printf(
"Bug to put detId = %i\n", PreviousDetId);
1783 theSiStripVector =
new std::vector<float>;
1784 PreviousDetId =
APV->DetId;
1786 theSiStripVector->push_back(
APV->Gain);
1788 if (theSiStripVector !=
nullptr) {
1790 if (!
obj->put(PreviousDetId,
range))
1791 printf(
"Bug to put detId = %i\n", PreviousDetId);
1794 if (theSiStripVector !=
nullptr)
1795 delete theSiStripVector;
1814 TChain*
t1 =
new TChain(
"SiStripCalib/APVGain");
1817 unsigned int tree_DetId;
1818 unsigned char tree_APVId;
1821 t1->SetBranchAddress(
"DetId", &tree_DetId);
1822 t1->SetBranchAddress(
"APVId", &tree_APVId);
1823 t1->SetBranchAddress(
"Gain", &tree_Gain);
1825 for (
unsigned int ientry = 0; ientry <
t1->GetEntries(); ientry++) {
1826 t1->GetEntry(ientry);
1828 APV->CalibGain = tree_Gain;