66 #include "TObjString.h" 80 #include <unordered_map> 99 void algoEndJob()
override;
102 int statCollectionFromMode(
const char*
tag)
const;
103 void bookDQMHistos(
const char* dqm_dir,
const char*
tag);
106 void swapBFieldMode(
void);
109 void algoAnalyzeTheTree();
110 void algoComputeMPVandGain();
113 void getPeakOfLandau(TH1* InputHisto,
double* FitResults,
double LowRange = 50,
double HighRange = 5400);
114 bool IsGoodLandauFit(
double* FitResults);
116 void qualityMonitor();
117 void MakeCalibrationMap();
118 bool produceTagFilter();
120 template <
typename T>
128 std::unique_ptr<SiStripApvGain> getNewObject()
override;
173 std::array<std::vector<APVGain::APVmon>, 7>
Charge_1;
174 std::array<std::vector<APVGain::APVmon>, 7>
Charge_2;
175 std::array<std::vector<APVGain::APVmon>, 7>
Charge_3;
176 std::array<std::vector<APVGain::APVmon>, 7>
Charge_4;
259 unsigned int eventnumber = 0;
261 const std::vector<bool>* TrigTech =
nullptr;
265 const std::vector<double>* trackchi2ndof =
nullptr;
267 const std::vector<float>* trackp =
nullptr;
269 const std::vector<float>* trackpt =
nullptr;
271 const std::vector<double>* tracketa =
nullptr;
273 const std::vector<double>* trackphi =
nullptr;
275 const std::vector<unsigned int>* trackhitsvalid =
nullptr;
277 const std::vector<int>* trackalgo =
nullptr;
281 const std::vector<int>* trackindex =
nullptr;
283 const std::vector<unsigned int>* rawid =
nullptr;
285 const std::vector<double>* localdirx =
nullptr;
287 const std::vector<double>* localdiry =
nullptr;
289 const std::vector<double>* localdirz =
nullptr;
291 const std::vector<unsigned short>* firststrip =
nullptr;
293 const std::vector<unsigned short>* nstrips =
nullptr;
297 const std::vector<bool>* overlapping =
nullptr;
299 const std::vector<bool>* farfromedge =
nullptr;
301 const std::vector<unsigned int>*
charge =
nullptr;
303 const std::vector<double>*
path =
nullptr;
305 const std::vector<double>* chargeoverpath =
nullptr;
309 const std::vector<double>* gainused =
nullptr;
311 const std::vector<double>* gainusedTick =
nullptr;
323 std::unordered_map<unsigned int, stAPVGain*>
APVsColl;
334 std::vector<string>::const_iterator it = dqm_tag_.begin();
335 while (it != dqm_tag_.end()) {
337 return it - dqm_tag_.begin();
348 if (
A->GetNbinsX() ==
B->GetNbinsX()) {
351 for (
int x = 0;
x <=
B->GetNbinsX() + 1;
x++) {
352 for (
int y = 0; y <=
B->GetNbinsY() + 1; y++) {
353 A->SetBinContent(
x, y,
A->GetBinContent(
x, y) +
B->GetBinContent(
x, y));
453 label = evtinfo_pset.getUntrackedParameter<
string>(
"label");
454 EventPrefix_ = evtinfo_pset.getUntrackedParameter<
string>(
"prefix");
455 EventSuffix_ = evtinfo_pset.getUntrackedParameter<
string>(
"suffix");
459 label = track_pset.getUntrackedParameter<
string>(
"label");
460 TrackPrefix_ = track_pset.getUntrackedParameter<
string>(
"prefix");
461 TrackSuffix_ = track_pset.getUntrackedParameter<
string>(
"suffix");
472 tTopoToken_ = esConsumes<edm::Transition::BeginRun>();
475 gainToken_ = esConsumes<edm::Transition::BeginRun>();
481 <<
"Setting " << dqm_dir <<
"in DQM and booking histograms for tag " <<
tag << std::endl;
489 if (!stag.empty() && stag[0] !=
'_')
490 stag.insert(0, 1,
'_');
513 std::vector<float> binXarray;
516 binXarray.push_back((
float)
a);
519 std::array<float, 688> binYarray;
521 double p1 = 0.002113;
522 double p2 = 69.01576;
524 for (
int b = 0;
b < 687;
b++) {
531 binYarray[687] = 4000.;
545 std::vector<std::pair<std::string, std::string>> hnames =
547 for (
unsigned int i = 0;
i < hnames.size();
i++) {
558 for (
unsigned int i = 0;
i < hnames.size();
i++) {
569 for (
unsigned int i = 0;
i < hnames.size();
i++) {
580 for (
unsigned int i = 0;
i < hnames.size();
i++) {
610 NoMPVfit =
dbe->
book2DD(
"NoMPVfit",
"Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
648 std::vector<std::pair<std::string, std::string>> hnames =
650 for (
unsigned int i = 0;
i < hnames.size();
i++) {
667 const char* dqm_dir =
"AlCaReco/SiStripGainsHarvesting/";
674 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " << prevMode
688 unsigned int Index = 0;
689 for (
unsigned int i = 0;
i <
Det.size();
i++) {
700 unsigned int NAPV = Topo.
nstrips() / 128;
702 for (
unsigned int j = 0;
j < NAPV;
j++) {
712 APV->FitWidthErr = -1;
716 APV->PreviousGain = 1;
717 APV->PreviousGainTick = 1;
718 APV->x = DetUnit->position().basicVector().x();
719 APV->y = DetUnit->position().basicVector().y();
720 APV->z = DetUnit->position().basicVector().z();
721 APV->Eta = DetUnit->position().basicVector().eta();
722 APV->Phi = DetUnit->position().basicVector().phi();
723 APV->R = DetUnit->position().basicVector().transverse();
724 APV->Thickness = DetUnit->surface().bounds().thickness();
726 APV->isMasked =
false;
736 for (
unsigned int i = 0;
i <
Det.size();
746 unsigned int NROCRow = Topo.
nrows() / (80.);
747 unsigned int NROCCol = Topo.
ncolumns() / (52.);
749 for (
unsigned int j = 0;
j < NROCRow;
j++) {
750 for (
unsigned int i = 0;
i < NROCCol;
i++) {
755 APV->APVId = (
j << 3 |
i);
760 APV->FitWidthErr = -1;
763 APV->PreviousGain = 1;
764 APV->PreviousGainTick = 1;
765 APV->x = DetUnit->position().basicVector().x();
766 APV->y = DetUnit->position().basicVector().y();
767 APV->z = DetUnit->position().basicVector().z();
768 APV->Eta = DetUnit->position().basicVector().eta();
769 APV->Phi = DetUnit->position().basicVector().phi();
770 APV->R = DetUnit->position().basicVector().transverse();
771 APV->Thickness = DetUnit->surface().bounds().thickness();
772 APV->isMasked =
false;
800 double average_current =
runInfo.m_avg_current;
804 return ((isOn && !is0T) || (!isOn && is0T));
821 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " << prevMode
827 if (!gainHandle.isValid()) {
828 edm::LogError(
"SiStripGainFromCalibTree") <<
"gainHandle is not valid\n";
840 APV->isMasked = siStripQuality.IsApvBad(
APV->DetId,
APV->APVId);
843 if (gainHandle->getNumberOfTags() != 2) {
844 edm::LogError(
"SiStripGainFromCalibTree") <<
"NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
848 float newPreviousGain = gainHandle->getApvGain(
APV->APVId, gainHandle->getRange(
APV->DetId, 1), 1);
849 if (
APV->PreviousGain != 1 and newPreviousGain !=
APV->PreviousGain)
850 edm::LogWarning(
"SiStripGainFromCalibTree") <<
"WARNING: ParticleGain in the global tag changed\n";
851 APV->PreviousGain = newPreviousGain;
853 float newPreviousGainTick = gainHandle->getApvGain(
APV->APVId, gainHandle->getRange(
APV->DetId, 0), 0);
854 if (
APV->PreviousGainTick != 1 and newPreviousGainTick !=
APV->PreviousGainTick) {
856 <<
"WARNING: TickMarkGain in the global tag changed\n" 858 <<
" APV->SubDet: " <<
APV->SubDet <<
" APV->APVId:" <<
APV->APVId << std::endl
859 <<
" APV->PreviousGainTick: " <<
APV->PreviousGainTick <<
" newPreviousGainTick: " << newPreviousGainTick
862 APV->PreviousGainTick = newPreviousGainTick;
878 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Starting harvesting statistics" << std::endl;
885 if (!stag.empty() && stag[0] !=
'_')
886 stag.insert(0, 1,
'_');
920 <<
"Harvesting: could not retrieve " << cvi.c_str() <<
", statistics will not be summed!" << std::endl;
924 <<
"Harvesting " << (
Charge_Vs_Index[elepos])->getTH2S()->GetEntries() <<
" more clusters" << std::endl;
934 <<
"Harvesting: could not retrieve " << cvpTIB.c_str() <<
", statistics will not be summed!" << std::endl;
940 <<
"Harvesting: could not retrieve " << cvpTOB.c_str() <<
", statistics will not be summed!" << std::endl;
946 <<
"Harvesting: could not retrieve " << cvpTIDP.c_str() <<
", statistics will not be summed!" << std::endl;
952 <<
"Harvesting: could not retrieve " << cvpTIDM.c_str() <<
", statistics will not be summed!" << std::endl;
958 <<
"Harvesting: could not retrieve " << cvpTECP1.c_str() <<
", statistics will not be summed!" << std::endl;
964 <<
"Harvesting: could not retrieve " << cvpTECP2.c_str() <<
", statistics will not be summed!" << std::endl;
970 <<
"Harvesting: could not retrieve " << cvpTECM1.c_str() <<
", statistics will not be summed!" << std::endl;
976 <<
"Harvesting: could not retrieve " << cvpTECM2.c_str() <<
", statistics will not be summed!" << std::endl;
981 std::vector<std::pair<std::string, std::string>>
tags =
983 for (
unsigned int i = 0;
i <
tags.size();
i++) {
986 if ((
Charge_1[elepos][
i]).getMonitor() ==
nullptr) {
988 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
994 for (
unsigned int i = 0;
i <
tags.size();
i++) {
997 if ((
Charge_2[elepos][
i]).getMonitor() ==
nullptr) {
999 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1005 for (
unsigned int i = 0;
i <
tags.size();
i++) {
1008 if ((
Charge_3[elepos][
i]).getMonitor() ==
nullptr) {
1010 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1016 for (
unsigned int i = 0;
i <
tags.size();
i++) {
1019 if ((
Charge_4[elepos][
i]).getMonitor() ==
nullptr) {
1021 <<
"Harvesting: could not retrieve " <<
tag.c_str() <<
", statistics will not be summed!" << std::endl;
1034 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Analyzing calibration tree" << std::endl;
1053 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Saving summary into root file" << std::endl;
1086 FitResults[0] = -0.5;
1088 FitResults[2] = -0.5;
1090 FitResults[4] = -0.5;
1097 TF1* MyLandau =
new TF1(
"MyLandau",
"landau", LowRange, HighRange);
1098 MyLandau->SetParameter(1, 300);
1099 InputHisto->Fit(MyLandau,
"0QR WW");
1102 FitResults[0] = MyLandau->GetParameter(1);
1103 FitResults[1] = MyLandau->GetParError(1);
1104 FitResults[2] = MyLandau->GetParameter(2);
1105 FitResults[3] = MyLandau->GetParError(2);
1106 FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF();
1107 FitResults[5] = MyLandau->GetParameter(0);
1113 if (FitResults[0] <= 0)
1130 NTrack += (*trackp).size();
1134 unsigned int FirstAmplitude = 0;
1135 for (
unsigned int i = 0;
i < (*chargeoverpath).size();
i++) {
1136 FirstAmplitude += (*nstrips)[
i];
1137 int TI = (*trackindex)[
i];
1180 if (
APV->SubDet > 2) {
1188 bool Saturation =
false;
1189 for (
unsigned int s = 0;
s < (*nstrips)[
i];
s++) {
1190 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
i] +
s];
1192 StripCharge = (
int)(StripCharge * (
APV->PreviousGain /
APV->CalibGain));
1194 StripCharge = (
int)(StripCharge /
APV->CalibGain);
1196 StripCharge = (
int)(StripCharge *
APV->PreviousGain);
1198 if (StripCharge > 1024) {
1201 }
else if (StripCharge > 254) {
1209 }
else if (
APV->SubDet > 2) {
1212 Charge = (*charge)[
i] / 265.0;
1217 double ClusterChargeOverPath = ((double)
Charge) / (*path)[
i];
1218 if (
APV->SubDet > 2) {
1220 ClusterChargeOverPath /= (*gainused)[
i];
1223 ClusterChargeOverPath *= (*gainused)[
i];
1228 if (
APV->SubDet <= 2)
1238 if (
APV->SubDet > 2) {
1239 for (
unsigned int s = 0;
s < (*nstrips)[
i];
s++) {
1240 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
i] +
s];
1241 if (StripCharge > 1024)
1243 else if (StripCharge > 254)
1245 mCharge1 += StripCharge;
1246 mCharge2 += StripCharge;
1247 mCharge3 += StripCharge;
1248 mCharge4 += StripCharge;
1251 mCharge2 *= (*gainused)[
i];
1252 mCharge3 *= (*gainusedTick)[
i];
1253 mCharge4 *= ((*gainused)[
i] * (*gainusedTick)[
i]);
1255 std::vector<APVGain::APVmon>& v1 =
Charge_1[elepos];
1257 for (
unsigned int m = 0;
m < cmon1.size();
m++)
1258 cmon1[
m]->
Fill(((
double)mCharge1) / (*path)[
i]);
1260 std::vector<APVGain::APVmon>& v2 =
Charge_2[elepos];
1262 for (
unsigned int m = 0;
m < cmon2.size();
m++)
1263 cmon2[
m]->
Fill(((
double)mCharge2) / (*path)[
i]);
1265 std::vector<APVGain::APVmon>& v3 =
Charge_3[elepos];
1267 for (
unsigned int m = 0;
m < cmon3.size();
m++)
1268 cmon3[
m]->
Fill(((
double)mCharge3) / (*path)[
i]);
1270 std::vector<APVGain::APVmon>& v4 =
Charge_4[elepos];
1272 for (
unsigned int m = 0;
m < cmon4.size();
m++)
1273 cmon4[
m]->
Fill(((
double)mCharge4) / (*path)[
i]);
1286 else if (
APV->Eta > 0) {
1292 if (
APV->Thickness < 0.04) {
1295 else if (
APV->Thickness > 0.04) {
1298 }
else if (
APV->Eta > 0) {
1299 if (
APV->Thickness < 0.04) {
1302 else if (
APV->Thickness > 0.04) {
1316 TString tree_path = TString::Format(
"gainCalibrationTree%s/tree",
m_calibrationMode.c_str());
1317 TTree*
tree =
dynamic_cast<TTree*
>(
tfile->Get(tree_path.Data()));
1348 unsigned int nentries =
tree->GetEntries();
1349 printf(
"Number of Events = %i + %i = %i\n",
NEvent, nentries, (
NEvent + nentries));
1350 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1351 printf(
"Looping on the Tree :");
1352 int TreeStep = nentries / 50;
1355 for (
unsigned int ientry = 0; ientry <
tree->GetEntries(); ientry++) {
1356 if (ientry % TreeStep == 0) {
1360 tree->GetEntry(ientry);
1369 TH1F* Proj =
nullptr;
1370 double FitResults[6];
1371 double MPVmean = 300;
1377 <<
"Harvesting: could not execute algoComputeMPVandGain method because " <<
m_calibrationMode.c_str()
1378 <<
" statistics cannot be retrieved.\n" 1379 <<
"Please check if input contains " <<
m_calibrationMode.c_str() <<
" data." << std::endl;
1385 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1386 printf(
"Fitting Charge Distribution :");
1387 int TreeStep =
APVsColl.size() / 50;
1389 if (
I % TreeStep == 0) {
1395 APV->Bin = chvsidx->GetXaxis()->FindBin(
APV->Index);
1397 if (
APV->isMasked) {
1398 APV->Gain =
APV->PreviousGain;
1403 Proj = (TH1F*)(chvsidx->ProjectionY(
1404 "", chvsidx->GetXaxis()->FindBin(
APV->Index), chvsidx->GetXaxis()->FindBin(
APV->Index),
"e"));
1410 int SecondAPVId =
APV->APVId;
1411 if (SecondAPVId % 2 == 0) {
1412 SecondAPVId = SecondAPVId + 1;
1414 SecondAPVId = SecondAPVId - 1;
1418 APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1419 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->
Bin, APV2->
Bin,
"e"));
1421 Proj->Add(Proj2, 1);
1425 for (
unsigned int i = 0;
i < 16;
i++) {
1433 APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1434 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"", APV2->
Bin, APV2->
Bin,
"e"));
1436 Proj->Add(Proj2, 1);
1446 APV->FitMPV = FitResults[0];
1447 APV->FitMPVErr = FitResults[1];
1448 APV->FitWidth = FitResults[2];
1449 APV->FitWidthErr = FitResults[3];
1450 APV->FitChi2 = FitResults[4];
1451 APV->FitNorm = FitResults[5];
1452 APV->NEntries = Proj->GetEntries();
1455 APV->Gain =
APV->FitMPV / MPVmean;
1456 if (
APV->SubDet > 2)
1459 APV->Gain =
APV->PreviousGain;
1460 if (
APV->SubDet > 2)
1480 unsigned int Index =
APV->Index;
1484 float Eta =
APV->Eta;
1487 float Thickness =
APV->Thickness;
1488 double FitMPV =
APV->FitMPV;
1489 double FitMPVErr =
APV->FitMPVErr;
1491 double NEntries =
APV->NEntries;
1492 double PreviousGain =
APV->PreviousGain;
1500 int bin = chvsidx->GetXaxis()->FindBin(Index);
1501 TH1D* Proj = chvsidx->ProjectionY(
"proj",
bin,
bin);
1502 for (
int binId = 0; binId < Proj->GetXaxis()->GetNbins(); binId++) {
1503 double new_charge = Proj->GetXaxis()->GetBinCenter(binId) /
Gain;
1504 if (Proj->GetBinContent(binId) != 0.) {
1505 for (
unsigned int h = 0;
h < charge_histos.size();
h++) {
1506 TH1D* chisto = (charge_histos[
h])->getTH1D();
1507 for (
int e = 0;
e < Proj->GetBinContent(binId);
e++)
1508 chisto->Fill(new_charge);
1525 if (Thickness < 0.04)
1527 if (Thickness > 0.04)
1541 }
else if (
SubDet == 4) {
1550 }
else if (
SubDet == 5) {
1555 }
else if (
SubDet == 6) {
1563 if (Thickness < 0.04) {
1572 if (Thickness > 0.04) {
1584 if (
SubDet == 3 && PreviousGain != 0.)
1586 else if (
SubDet == 4 && PreviousGain != 0.)
1588 else if (
SubDet == 5 && PreviousGain != 0.)
1590 else if (
SubDet == 6 && PreviousGain != 0.)
1605 unsigned int tree_Index;
1606 unsigned int tree_Bin;
1607 unsigned int tree_DetId;
1608 unsigned char tree_APVId;
1609 unsigned char tree_SubDet;
1616 float tree_Thickness;
1618 float tree_FitMPVErr;
1619 float tree_FitWidth;
1620 float tree_FitWidthErr;
1621 float tree_FitChi2NDF;
1624 double tree_PrevGain;
1625 double tree_PrevGainTick;
1626 double tree_NEntries;
1630 MyTree =
tfs->
make<TTree>(
"APVGain",
"APVGain");
1631 MyTree->Branch(
"Index", &tree_Index,
"Index/i");
1632 MyTree->Branch(
"Bin", &tree_Bin,
"Bin/i");
1633 MyTree->Branch(
"DetId", &tree_DetId,
"DetId/i");
1634 MyTree->Branch(
"APVId", &tree_APVId,
"APVId/b");
1635 MyTree->Branch(
"SubDet", &tree_SubDet,
"SubDet/b");
1636 MyTree->Branch(
"x", &tree_x,
"x/F");
1637 MyTree->Branch(
"y", &tree_y,
"y/F");
1638 MyTree->Branch(
"z", &tree_z,
"z/F");
1639 MyTree->Branch(
"Eta", &tree_Eta,
"Eta/F");
1640 MyTree->Branch(
"R", &tree_R,
"R/F");
1641 MyTree->Branch(
"Phi", &tree_Phi,
"Phi/F");
1642 MyTree->Branch(
"Thickness", &tree_Thickness,
"Thickness/F");
1643 MyTree->Branch(
"FitMPV", &tree_FitMPV,
"FitMPV/F");
1644 MyTree->Branch(
"FitMPVErr", &tree_FitMPVErr,
"FitMPVErr/F");
1645 MyTree->Branch(
"FitWidth", &tree_FitWidth,
"FitWidth/F");
1646 MyTree->Branch(
"FitWidthErr", &tree_FitWidthErr,
"FitWidthErr/F");
1647 MyTree->Branch(
"FitChi2NDF", &tree_FitChi2NDF,
"FitChi2NDF/F");
1648 MyTree->Branch(
"FitNorm", &tree_FitNorm,
"FitNorm/F");
1649 MyTree->Branch(
"Gain", &tree_Gain,
"Gain/D");
1650 MyTree->Branch(
"PrevGain", &tree_PrevGain,
"PrevGain/D");
1651 MyTree->Branch(
"PrevGainTick", &tree_PrevGainTick,
"PrevGainTick/D");
1652 MyTree->Branch(
"NEntries", &tree_NEntries,
"NEntries/D");
1653 MyTree->Branch(
"isMasked", &tree_isMasked,
"isMasked/O");
1661 fprintf(
Gains,
"Number of Strip APVs = %lu\n", static_cast<unsigned long>(
NStripAPVs));
1663 "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1674 fprintf(
Gains,
"Number of Strip APVs = %lu\n", static_cast<unsigned long>(
NStripAPVs));
1677 "GoodFits = %i BadFits = %i ratio = %f%% (MASKED=%i)\n",
1691 "%i | %i | PreviousGain = %7.5f(tick) x %7.5f(particle) NewGain (particle) = %7.5f (#clusters=%8.0f)\n",
1694 APV->PreviousGainTick,
1699 tree_Index =
APV->Index;
1701 tree_DetId =
APV->DetId;
1702 tree_APVId =
APV->APVId;
1703 tree_SubDet =
APV->SubDet;
1707 tree_Eta =
APV->Eta;
1709 tree_Phi =
APV->Phi;
1710 tree_Thickness =
APV->Thickness;
1711 tree_FitMPV =
APV->FitMPV;
1712 tree_FitMPVErr =
APV->FitMPVErr;
1713 tree_FitWidth =
APV->FitWidth;
1714 tree_FitWidthErr =
APV->FitWidthErr;
1715 tree_FitChi2NDF =
APV->FitChi2;
1716 tree_FitNorm =
APV->FitNorm;
1717 tree_Gain =
APV->Gain;
1718 tree_PrevGain =
APV->PreviousGain;
1719 tree_PrevGainTick =
APV->PreviousGainTick;
1720 tree_NEntries =
APV->NEntries;
1721 tree_isMasked =
APV->isMasked;
1723 if (tree_DetId == 402673324) {
1724 printf(
"%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
1739 <<
"produceTagFilter -> Return false: could not retrieve the " <<
m_calibrationMode.c_str() <<
" statistics.\n" 1740 <<
"Please check if input contains " <<
m_calibrationMode.c_str() <<
" data." << std::endl;
1748 <<
"produceTagFilter -> Return false: Statistics is too low : " <<
integral << endl;
1754 <<
"produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 *
GOOD) / (
GOOD +
BAD) << endl;
1761 auto obj = std::make_unique<SiStripApvGain>();
1767 <<
"getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
1772 std::vector<float>* theSiStripVector =
nullptr;
1773 unsigned int PreviousDetId = 0;
1776 if (
APV ==
nullptr) {
1780 if (
APV->SubDet <= 2)
1782 if (
APV->DetId != PreviousDetId) {
1783 if (theSiStripVector !=
nullptr) {
1785 if (!
obj->put(PreviousDetId,
range))
1786 printf(
"Bug to put detId = %i\n", PreviousDetId);
1788 theSiStripVector =
new std::vector<float>;
1789 PreviousDetId =
APV->DetId;
1791 if (theSiStripVector !=
nullptr) {
1792 theSiStripVector->push_back(
APV->Gain);
1795 if (theSiStripVector !=
nullptr) {
1797 if (!
obj->put(PreviousDetId,
range))
1798 printf(
"Bug to put detId = %i\n", PreviousDetId);
1801 if (theSiStripVector !=
nullptr)
1802 delete theSiStripVector;
1821 TChain*
t1 =
new TChain(
"SiStripCalib/APVGain");
1824 unsigned int tree_DetId;
1825 unsigned char tree_APVId;
1828 t1->SetBranchAddress(
"DetId", &tree_DetId);
1829 t1->SetBranchAddress(
"APVId", &tree_APVId);
1830 t1->SetBranchAddress(
"Gain", &tree_Gain);
1832 for (
unsigned int ientry = 0; ientry <
t1->GetEntries(); ientry++) {
1833 t1->GetEntry(ientry);
1835 APV->CalibGain = tree_Gain;
static const std::string kSharedResource
MonitorElement * MPVError
edm::EDGetTokenT< std::vector< int > > trackindex_token_
std::vector< MonitorElement * > Charge_Vs_Index
static constexpr auto TEC
void swapBFieldMode(void)
virtual int nstrips() const =0
std::vector< string > dqm_tag_
MonitorElement * MPVsTECP2
const std::vector< float > * trackp
T getParameter(std::string const &) const
unsigned int MinTrackHits
edm::EDGetTokenT< std::vector< double > > tracketa_token_
edm::EDGetTokenT< std::vector< unsigned char > > amplitude_token_
std::vector< APVGain::APVmon > newCharge
const std::vector< double > * chargeoverpath
MonitorElement * DiffWRTPrevGainTEC
edm::EDGetTokenT< std::vector< unsigned int > > rawid_token_
const std::vector< unsigned char > * amplitude
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
~SiStripGainFromCalibTree() override
dqm::legacy::DQMStore DQMStore
MonitorElement * MPV_Vs_PhiTEC
virtual int ncolumns() const =0
MonitorElement * MPVsTIDP
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const std::vector< double > * localdirz
MonitorElement * MPVErrorVsN
const std::vector< double > * trackchi2ndof
void algoBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
const std::vector< double > * localdirx
const std::vector< double > * gainusedTick
MonitorElement * MPV_Vs_PhiTID
dispatcher processEvent(e, inputTag, standby)
unsigned int NClusterPixel
void algoEndRun(const edm::Run &run, const edm::EventSetup &iSetup) override
MonitorElement * MPV_Vs_EtaTOB
void setCurrentFolder(std::string const &fullpath) override
const std::vector< unsigned int > * rawid
MonitorElement * MPV_Vs_PhiTIB
edm::EDGetTokenT< std::vector< bool > > overlapping_token_
dqm::legacy::MonitorElement MonitorElement
double tagCondition_GoodFrac
SiStripGainFromCalibTree(const edm::ParameterSet &)
const TrackerTopology * tTopo_
edm::Handle< T > connect(const T *&ptr, edm::EDGetTokenT< T > token, const edm::Event &evt)
MonitorElement * MPVErrorVsPhi
virtual int nrows() const =0
int subdetectorPlane(uint32_t, const TrackerTopology *)
const std::vector< int > * trackalgo
int statCollectionFromMode(const char *tag) const
std::vector< MonitorElement * > Charge_Vs_PathlengthTOB
MonitorElement * MPV_Vs_EtaTIB
void storeOnTree(TFileService *tfs)
const std::vector< float > * trackpt
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM1
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
Log< level::Error, false > LogError
const std::vector< unsigned int > * trackhitsvalid
MonitorElement * MPVsTECP
MonitorElement * MPVsTECM
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
void MakeCalibrationMap()
MonitorElement * MPVsTECM2
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM2
MonitorElement * MPV_Vs_EtaTECthick
double MaxTrackChiOverNdf
MonitorElement * GainVsPrevGainTIB
edm::EDGetTokenT< std::vector< bool > > farfromedge_token_
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< std::vector< unsigned int > > trackhitsvalid_token_
std::string m_calibrationMode
std::vector< stAPVGain * > APVsCollOrdered
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
edm::EDGetTokenT< std::vector< double > > path_token_
void algoComputeMPVandGain()
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
edm::EDGetTokenT< std::vector< int > > trackalgo_token_
MonitorElement * GainVsPrevGainTEC
MonitorElement * MPVErrorVsEta
edm::EDGetTokenT< std::vector< float > > trackp_token_
bool IsGoodLandauFit(double *FitResults)
std::unique_ptr< SiStripApvGain > getNewObject() override
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::unordered_map< unsigned int, stAPVGain * > APVsColl
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool doChargeMonitorPerPlane
bool isBFieldConsistentWithMode(const edm::EventSetup &iSetup) const
void algoBeginJob(const edm::EventSetup &iSetup) override
std::pair< ContainerIterator, ContainerIterator > Range
edm::EDGetTokenT< std::vector< bool > > TrigTech_token_
edm::EDGetTokenT< std::vector< double > > chargeoverpath_token_
const std::complex< double > I
edm::EDGetTokenT< std::vector< double > > gainusedTick_token_
const std::vector< double > * gainused
#define DEFINE_FWK_MODULE(type)
MonitorElement * MPV_Vs_EtaTID
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MonitorElement * GainVsPrevGainTOB
MonitorElement * MPVsTECthick
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP1
edm::EDGetTokenT< std::vector< double > > localdirz_token_
static constexpr auto TOB
const std::vector< unsigned short > * firststrip
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDM
const std::vector< double > * localdiry
edm::EDGetTokenT< std::vector< unsigned int > > charge_token_
MonitorElement * MPV_Vs_PhiTECthick
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
MonitorElement * NoMPVmasked
MonitorElement * GainVsPrevGainTID
MonitorElement * MPV_Vs_PhiTOB
Integral< F, X >::type integral(const F &f)
MonitorElement * DiffWRTPrevGainTIB
vector< string > VInputFiles
void algoEndJob() override
edm::EDGetTokenT< std::vector< unsigned short > > nstrips_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP2
Log< level::Info, false > LogInfo
std::string m_calibrationPath
const std::vector< int > * trackindex
MonitorElement * MPVsTECthin
std::vector< MonitorElement * > Charge_Vs_PathlengthTIB
edm::EDGetTokenT< std::vector< unsigned short > > firststrip_token_
void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
static constexpr auto TIB
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
edm::EDGetTokenT< std::vector< float > > trackpt_token_
MonitorElement * DiffWRTPrevGainTOB
const std::vector< bool > * overlapping
const std::vector< bool > * saturation
MonitorElement * MPVsTECP1
MonitorElement * MPV_Vs_EtaTECthin
constexpr uint32_t rawId() const
get the raw id
bool merge(LuminosityBlockRange &lh, LuminosityBlockRange &rh)
std::array< std::vector< APVGain::APVmon >, 7 > Charge_4
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
std::vector< MonitorElement * > FetchMonitor(std::vector< APVmon >, uint32_t, const TrackerTopology *topo=nullptr)
int subdetectorSide(uint32_t, const TrackerTopology *)
void algoAnalyzeTheTree()
MonitorElement * MPVsTECM1
virtual MonitorElement * get(std::string const &fullpath) const
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
const std::vector< bool > * farfromedge
MonitorElement * MPV_Vs_PhiTECthin
MonitorElement * MPV_Vs_EtaTEC
const std::vector< bool > * TrigTech
void setDoStore(const bool doStore)
When set to false the payload will not be written to the db.
MonitorElement * NoMPVfit
MonitorElement * MPVErrorVsMPV
std::vector< std::string > VChargeHisto
double tagCondition_NClusters
edm::EDGetTokenT< std::vector< double > > localdirx_token_
T * make(const Args &...args) const
make new ROOT object
edm::EDGetTokenT< std::vector< bool > > saturation_token_
edm::EDGetTokenT< std::vector< double > > trackchi2ndof_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDP
edm::EDGetTokenT< std::vector< double > > localdiry_token_
Log< level::Warning, false > LogWarning
std::array< std::vector< APVGain::APVmon >, 7 > Charge_3
const std::vector< unsigned int > * charge
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
std::array< std::vector< APVGain::APVmon >, 7 > Charge_1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const std::vector< double > * path
const std::vector< double > * trackphi
static constexpr auto TID
const std::vector< unsigned short > * nstrips
edm::EDGetTokenT< std::vector< double > > gainused_token_
std::array< std::vector< APVGain::APVmon >, 7 > Charge_2
int subdetectorId(uint32_t)
MonitorElement * DiffWRTPrevGainTID
void bookDQMHistos(const char *dqm_dir, const char *tag)
edm::EDGetTokenT< std::vector< double > > trackphi_token_
const std::vector< double > * tracketa
MonitorElement * MPVsTIDM
unsigned int NClusterStrip
void merge(TH2 *A, TH2 *B)