83 void getPeakOfLandau(TH1* InputHisto,
double* FitResults,
double LowRange = 50,
double HighRange = 5400);
84 void getPeakOfLanGau(TH1* InputHisto,
double* FitResults,
double LowRange = 50,
double HighRange = 5400);
85 void doFakeFit(TH1* InputHisto,
double* FitResults);
87 static double langaufun(Double_t*
x, Double_t* par);
95 if (
h.count(
s) == 0) {
96 edm::LogWarning(
"SiStripApvGainInspector") <<
"Trying to fill non-existing Histogram named " <<
s << std::endl;
103 if (
h.count(
s) == 0) {
104 edm::LogWarning(
"SiStripApvGainInspector") <<
"Trying to fill non-existing Histogram named " <<
s << std::endl;
132 std::map<std::pair<unsigned char, uint32_t>, TH1F*>
histoMap_;
146 std::unordered_map<unsigned int, std::shared_ptr<stAPVGain>>
APVsColl;
174 bareTkGeomPtr_(nullptr),
178 filename_(iConfig.getUntrackedParameter<
std::
string>(
"inputFile")),
179 minNrEntries(iConfig.getUntrackedParameter<double>(
"minNrEntries", 20)),
180 wantedmods(iConfig.getUntrackedParameter<
std::
vector<unsigned
int>>(
"selectedModules")) {
186 edm::LogInfo(
"SelectedModules") <<
"Selected module list";
193 throw std::invalid_argument(
"Invalid value provided for 'fitMode'");
202 Charge_Vs_Index = (TH2F*)
fin->Get(
"DQMData/Run 999999/AlCaReco/Run summary/SiStripGainsAAG/Charge_Vs_Index_AagBunch");
204 ratio_map = std::make_unique<TrackerMap>(
"ratio");
205 ratio_map->setTitle(
"Average by module of the G2 Gain payload ratio (new/old)");
209 new_payload_map->setTitle(
"Tracker Map of Updated G2 Gain payload averaged by module");
213 old_payload_map->setTitle(
"Tracker Map of Starting G2 Gain Payload averaged by module");
218 mpv_map = std::make_unique<TrackerMap>(
"MPV");
219 mpv_map->setTitle(
"Landau Fit MPV average value per module [ADC counts/mm]");
222 mpv_err_map = std::make_unique<TrackerMap>(
"MPVerr");
223 mpv_err_map->setTitle(
"Landau Fit MPV average error per module [ADC counts/mm]");
226 entries_map = std::make_unique<TrackerMap>(
"Entries");
227 entries_map->setTitle(
"log_{10}(entries) average per module");
230 fitChi2_map = std::make_unique<TrackerMap>(
"FitChi2");
231 fitChi2_map->setTitle(
"log_{10}(Fit #chi^{2}/ndf) average per module");
254 edm::LogError(
"SiStripApvGainInspector") <<
"gainHandle is not valid\n";
269 edm::LogError(
"SiStripApvGainInspector") <<
"NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
274 if (
APV->PreviousGain != 1 and newPreviousGain !=
APV->PreviousGain)
275 edm::LogWarning(
"SiStripApvGainInspector") <<
"WARNING: ParticleGain in the global tag changed\n";
276 APV->PreviousGain = newPreviousGain;
279 if (
APV->PreviousGainTick != 1 and newPreviousGainTick !=
APV->PreviousGainTick) {
281 <<
"WARNING: TickMarkGain in the global tag changed\n" 283 <<
" APV->SubDet: " <<
APV->SubDet <<
" APV->APVId:" <<
APV->APVId << std::endl
284 <<
" APV->PreviousGainTick: " <<
APV->PreviousGainTick <<
" newPreviousGainTick: " << newPreviousGainTick
287 APV->PreviousGainTick = newPreviousGainTick;
291 TH1F* Proj =
nullptr;
292 double FitResults[6];
293 double MPVmean = 300;
296 edm::LogError(
"SiStripGainsPCLHarvester") <<
"Harvesting: could not find input histogram " << std::endl;
300 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
301 printf(
"Fitting Charge Distribution :");
302 int TreeStep =
APVsColl.size() / 50;
305 if (
I % TreeStep == 0) {
309 std::shared_ptr<stAPVGain>
APV =
it->second;
332 throw std::invalid_argument(
"Invalid value provided for 'fitMode'");
335 APV->FitMPV = FitResults[0];
336 APV->FitMPVErr = FitResults[1];
337 APV->FitWidth = FitResults[2];
338 APV->FitWidthErr = FitResults[3];
339 APV->FitChi2 = FitResults[4];
340 APV->FitNorm = FitResults[5];
341 APV->NEntries = Proj->GetEntries();
345 edm::LogInfo(
"ModuleFound") <<
" module " <<
mod <<
" found! Storing... " << std::endl;
346 histoMap_[std::make_pair(
APV->APVId,
APV->DetId)] = (TH1F*)Proj->Clone(Form(
"hClone_%s", Proj->GetName()));
351 APV->Gain =
APV->FitMPV / MPVmean;
355 APV->Gain =
APV->PreviousGain;
376 auto const&
Det = newBareTkGeomPtr->
dets();
378 unsigned int Index = 0;
380 for (
unsigned int i = 0;
i <
Det.size();
i++) {
391 unsigned int NAPV = Topo.
nstrips() / 128;
393 for (
unsigned int j = 0;
j < NAPV;
j++) {
394 auto APV = std::make_shared<stAPVGain>();
403 APV->FitWidthErr = -1;
407 APV->PreviousGain = 1;
408 APV->PreviousGainTick = 1;
409 APV->x = DetUnit->position().basicVector().x();
410 APV->y = DetUnit->position().basicVector().y();
411 APV->z = DetUnit->position().basicVector().z();
412 APV->Eta = DetUnit->position().basicVector().eta();
413 APV->Phi = DetUnit->position().basicVector().phi();
414 APV->R = DetUnit->position().basicVector().transverse();
415 APV->Thickness = DetUnit->surface().bounds().thickness();
417 APV->isMasked =
false;
427 for (
unsigned int i = 0;
i <
Det.size();
437 unsigned int NROCRow = Topo.
nrows() / (80.);
438 unsigned int NROCCol = Topo.
ncolumns() / (52.);
440 for (
unsigned int j = 0;
j < NROCRow;
j++) {
441 for (
unsigned int i = 0;
i < NROCCol;
i++) {
442 auto APV = std::make_shared<stAPVGain>();
446 APV->APVId = (
j << 3 |
i);
451 APV->FitWidthErr = -1;
454 APV->PreviousGain = 1;
455 APV->PreviousGainTick = 1;
456 APV->x = DetUnit->position().basicVector().x();
457 APV->y = DetUnit->position().basicVector().y();
458 APV->z = DetUnit->position().basicVector().z();
459 APV->Eta = DetUnit->position().basicVector().eta();
460 APV->Phi = DetUnit->position().basicVector().phi();
461 APV->R = DetUnit->position().basicVector().transverse();
462 APV->Thickness = DetUnit->surface().bounds().thickness();
463 APV->isMasked =
false;
480 unsigned int tree_Index;
481 unsigned int tree_Bin;
482 unsigned int tree_DetId;
483 unsigned char tree_APVId;
484 unsigned char tree_SubDet;
491 float tree_Thickness;
493 float tree_FitMPVErr;
495 float tree_FitWidthErr;
496 float tree_FitChi2NDF;
499 double tree_PrevGain;
500 double tree_PrevGainTick;
501 double tree_NEntries;
505 MyTree =
tfs->
make<TTree>(
"APVGain",
"APVGain");
506 MyTree->Branch(
"Index", &tree_Index,
"Index/i");
507 MyTree->Branch(
"Bin", &tree_Bin,
"Bin/i");
508 MyTree->Branch(
"DetId", &tree_DetId,
"DetId/i");
509 MyTree->Branch(
"APVId", &tree_APVId,
"APVId/b");
510 MyTree->Branch(
"SubDet", &tree_SubDet,
"SubDet/b");
511 MyTree->Branch(
"x", &tree_x,
"x/F");
512 MyTree->Branch(
"y", &tree_y,
"y/F");
513 MyTree->Branch(
"z", &tree_z,
"z/F");
514 MyTree->Branch(
"Eta", &tree_Eta,
"Eta/F");
515 MyTree->Branch(
"R", &tree_R,
"R/F");
516 MyTree->Branch(
"Phi", &tree_Phi,
"Phi/F");
517 MyTree->Branch(
"Thickness", &tree_Thickness,
"Thickness/F");
518 MyTree->Branch(
"FitMPV", &tree_FitMPV,
"FitMPV/F");
519 MyTree->Branch(
"FitMPVErr", &tree_FitMPVErr,
"FitMPVErr/F");
520 MyTree->Branch(
"FitWidth", &tree_FitWidth,
"FitWidth/F");
521 MyTree->Branch(
"FitWidthErr", &tree_FitWidthErr,
"FitWidthErr/F");
522 MyTree->Branch(
"FitChi2NDF", &tree_FitChi2NDF,
"FitChi2NDF/F");
523 MyTree->Branch(
"FitNorm", &tree_FitNorm,
"FitNorm/F");
524 MyTree->Branch(
"Gain", &tree_Gain,
"Gain/D");
525 MyTree->Branch(
"PrevGain", &tree_PrevGain,
"PrevGain/D");
526 MyTree->Branch(
"PrevGainTick", &tree_PrevGainTick,
"PrevGainTick/D");
527 MyTree->Branch(
"NEntries", &tree_NEntries,
"NEntries/D");
528 MyTree->Branch(
"isMasked", &tree_isMasked,
"isMasked/O");
530 uint32_t cachedId(0);
550 tree_Index =
APV->Index;
552 tree_DetId =
APV->DetId;
553 tree_APVId =
APV->APVId;
554 tree_SubDet =
APV->SubDet;
561 tree_Thickness =
APV->Thickness;
562 tree_FitMPV =
APV->FitMPV;
563 tree_FitMPVErr =
APV->FitMPVErr;
564 tree_FitWidth =
APV->FitWidth;
565 tree_FitWidthErr =
APV->FitWidthErr;
566 tree_FitChi2NDF =
APV->FitChi2;
567 tree_FitNorm =
APV->FitNorm;
568 tree_Gain =
APV->Gain;
569 tree_PrevGain =
APV->PreviousGain;
570 tree_PrevGainTick =
APV->PreviousGainTick;
571 tree_NEntries =
APV->NEntries;
572 tree_isMasked =
APV->isMasked;
575 if (cachedId != 0 && tree_DetId != cachedId) {
581 if (entries.
mean() > 0) {
602 cachedId = tree_DetId;
603 gain_ratio.
add(tree_PrevGain / tree_Gain);
604 o_gain.
add(tree_PrevGain);
605 n_gain.
add(tree_Gain);
606 mpv.
add(tree_FitMPV);
607 mpv_err.
add(tree_FitMPVErr);
608 entries.
add(tree_NEntries);
611 if (tree_DetId == 402673324) {
612 printf(
"%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
629 FitResults[0] = -0.5;
631 FitResults[2] = -0.5;
633 FitResults[4] = -0.5;
640 TF1 MyLandau(
"MyLandau",
"landau", LowRange, HighRange);
641 MyLandau.SetParameter(1, 300);
642 InputHisto->Fit(&MyLandau,
"QR WW");
645 FitResults[0] = MyLandau.GetParameter(1);
646 FitResults[1] = MyLandau.GetParError(1);
647 FitResults[2] = MyLandau.GetParameter(2);
648 FitResults[3] = MyLandau.GetParError(2);
649 FitResults[4] = MyLandau.GetChisquare() / MyLandau.GetNDF();
650 FitResults[5] = MyLandau.GetParameter(0);
654 FitResults[0] = -0.5;
656 FitResults[2] = -0.5;
658 FitResults[4] = -0.5;
678 Double_t invsq2pi = 0.3989422804014;
679 Double_t mpshift = -0.22278298;
695 mpc = par[1] - mpshift * par[0];
698 xlow =
x[0] - sc * par[3];
699 xupp =
x[0] + sc * par[3];
701 step = (xupp - xlow) /
np;
704 for (
i = 1.0;
i <=
np / 2;
i++) {
706 fland = TMath::Landau(
xx, mpc, par[0]) / par[0];
707 sum += fland * TMath::Gaus(
x[0],
xx, par[3]);
710 fland = TMath::Landau(
xx, mpc, par[0]) / par[0];
711 sum += fland * TMath::Gaus(
x[0],
xx, par[3]);
714 return (par[2] *
step * sum * invsq2pi / par[3]);
719 FitResults[0] = -0.5;
721 FitResults[2] = -0.5;
723 FitResults[4] = -0.5;
730 TF1 MyLandau(
"MyLandau",
"landau", LowRange, HighRange);
731 MyLandau.SetParameter(1, 300);
732 InputHisto->Fit(&MyLandau,
"QR WW");
734 double startvalues[4] = {100, 300, 10000, 100};
735 double parlimitslo[4] = {0, 250, 10, 0};
736 double parlimitshi[4] = {200, 350, 1000000, 200};
738 TF1 MyLangau(
"MyLanGau",
langaufun, LowRange, HighRange, 4);
740 MyLangau.SetParameters(startvalues);
741 MyLangau.SetParNames(
"Width",
"MP",
"Area",
"GSigma");
743 for (
unsigned int i = 0;
i < 4;
i++) {
744 MyLangau.SetParLimits(
i, parlimitslo[
i], parlimitshi[
i]);
747 InputHisto->Fit(
"MyLanGau",
"QRB0");
750 FitResults[0] = MyLangau.GetParameter(1);
751 FitResults[1] = MyLangau.GetParError(1);
752 FitResults[2] = MyLangau.GetParameter(0);
753 FitResults[3] = MyLangau.GetParError(0);
754 FitResults[4] = MyLangau.GetChisquare() / MyLangau.GetNDF();
755 FitResults[5] = MyLangau.GetParameter(3);
763 FitResults[0] = -0.5;
765 FitResults[2] = -0.5;
767 FitResults[4] = -0.5;
773 int maxbin = InputHisto->GetMaximumBin();
774 int maxbin2 = -9999.;
776 if (InputHisto->GetBinContent(maxbin - 1) > InputHisto->GetBinContent(maxbin + 1)) {
777 maxbin2 = maxbin - 1;
779 maxbin2 = maxbin + 1;
782 float maxbincenter = (InputHisto->GetBinCenter(maxbin) + InputHisto->GetBinCenter(maxbin2)) / 2;
784 TF1 MyLandau(
"MyLandau",
"[2]*TMath::Landau(x,[0],[1],0)", maxbincenter - LowRange, maxbincenter + HighRange);
787 InputHisto->Fit(&MyLandau,
"QR WW");
789 MyLandau.SetParameter(0, maxbincenter);
790 MyLandau.SetParameter(1, maxbincenter / 10.);
791 MyLandau.SetParameter(2, InputHisto->GetMaximum());
793 float mpv = MyLandau.GetParameter(1);
794 MyLandau.SetParameter(1, mpv);
796 InputHisto->Fit(&MyLandau,
"QOR",
"", mpv - 50, mpv + 100);
798 InputHisto->Fit(&MyLandau,
"QOR",
"", maxbincenter - LowRange, maxbincenter + HighRange);
799 InputHisto->Fit(&MyLandau,
"QOR",
"", maxbincenter - LowRange, maxbincenter + HighRange);
802 FitResults[0] = MyLandau.GetParameter(1);
803 FitResults[1] = MyLandau.GetParError(1);
804 FitResults[2] = MyLandau.GetParameter(2);
805 FitResults[3] = MyLandau.GetParError(2);
806 FitResults[4] = MyLandau.GetChisquare() / MyLandau.GetNDF();
807 FitResults[5] = MyLandau.GetParameter(0);
812 if (FitResults[0] <= 0)
823 plot->GetXaxis()->CenterTitle(
true);
824 plot->GetYaxis()->CenterTitle(
true);
825 plot->GetXaxis()->SetTitleFont(42);
826 plot->GetYaxis()->SetTitleFont(42);
827 plot->GetXaxis()->SetTitleSize(0.05);
828 plot->GetYaxis()->SetTitleSize(0.05);
829 plot->GetXaxis()->SetTitleOffset(0.9);
830 plot->GetYaxis()->SetTitleOffset(1.3);
831 plot->GetXaxis()->SetLabelFont(42);
832 plot->GetYaxis()->SetLabelFont(42);
833 plot->GetYaxis()->SetLabelSize(.05);
834 plot->GetXaxis()->SetLabelSize(.05);
839 std::unique_ptr<SiStripApvGain>
obj = std::make_unique<SiStripApvGain>();
841 std::vector<float> theSiStripVector;
842 unsigned int PreviousDetId = 0;
845 if (
APV ==
nullptr) {
849 if (
APV->SubDet <= 2)
851 if (
APV->DetId != PreviousDetId) {
852 if (!theSiStripVector.empty()) {
854 if (!
obj->put(PreviousDetId,
range))
855 printf(
"Bug to put detId = %i\n", PreviousDetId);
857 theSiStripVector.clear();
858 PreviousDetId =
APV->DetId;
860 theSiStripVector.push_back(
APV->Gain);
862 LogDebug(
"SiStripGainsPCLHarvester") <<
" DetId: " <<
APV->DetId <<
" APV: " <<
APV->APVId
863 <<
" Gain: " <<
APV->Gain << std::endl;
865 if (!theSiStripVector.empty()) {
867 if (!
obj->put(PreviousDetId,
range))
868 printf(
"Bug to put detId = %i\n", PreviousDetId);
885 TCanvas*
c1 =
new TCanvas(Form(
"c1_%i_%i",
plot.first.second,
plot.first.first),
886 Form(
"c1_%i_%i",
plot.first.second,
plot.first.first),
891 gStyle->SetOptFit(1011);
894 c1->SetLeftMargin(0.15);
895 c1->SetRightMargin(0.10);
896 plot.second->SetTitle(Form(
"Cluster Charge (%i,%i)",
plot.first.second,
plot.first.first));
897 plot.second->GetXaxis()->SetTitle(
"Normalized Cluster Charge [ADC counts/mm]");
898 plot.second->GetYaxis()->SetTitle(
"On-track clusters");
899 plot.second->GetXaxis()->SetRangeUser(0., 1000.);
907 c1->Print(Form(
"c1_%i_%i.png",
plot.first.second,
plot.first.first));
908 c1->Print(Form(
"c1_%i_%i.pdf",
plot.first.second,
plot.first.first));
929 mpv_map->save(
true, 250, 350.,
"mpv_map.pdf");
930 mpv_map->save(
true, 250, 350.,
"mpv_map.png");
932 mpv_err_map->save(
true, 0., 3.,
"mpv_err_map.pdf");
933 mpv_err_map->save(
true, 0., 3.,
"mpv_err_map.png");
938 fitChi2_map->save(
true, 0., 0.,
"fitChi2_map.pdf");
939 fitChi2_map->save(
true, 0., 0.,
"fitChi2_map.png");
943 std::unique_ptr<SiStripApvGain> theAPVGains = this->
getNewObject();
951 throw std::runtime_error(
"PoolDBService required.");
959 TH1F::SetDefaultSumw2(kTRUE);
960 std::map<std::string, TH1*>
h;
962 h[
"MPV_Vs_EtaTIB"] =
dir.make<TH2F>(
"MPVvsEtaTIB",
"MPV vs Eta TIB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
963 h[
"MPV_Vs_EtaTID"] =
dir.make<TH2F>(
"MPVvsEtaTID",
"MPV vs Eta TID", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
964 h[
"MPV_Vs_EtaTOB"] =
dir.make<TH2F>(
"MPVvsEtaTOB",
"MPV vs Eta TOB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
965 h[
"MPV_Vs_EtaTEC"] =
dir.make<TH2F>(
"MPVvsEtaTEC",
"MPV vs Eta TEC", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
966 h[
"MPV_Vs_EtaTECthin"] =
dir.make<TH2F>(
"MPVvsEtaTEC1",
"MPV vs Eta TEC-thin", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
967 h[
"MPV_Vs_EtaTECthick"] =
968 dir.make<TH2F>(
"MPVvsEtaTEC2",
"MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
970 h[
"MPV_Vs_PhiTIB"] =
dir.make<TH2F>(
"MPVvsPhiTIB",
"MPV vs Phi TIB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
971 h[
"MPV_Vs_PhiTID"] =
dir.make<TH2F>(
"MPVvsPhiTID",
"MPV vs Phi TID", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
972 h[
"MPV_Vs_PhiTOB"] =
dir.make<TH2F>(
"MPVvsPhiTOB",
"MPV vs Phi TOB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
973 h[
"MPV_Vs_PhiTEC"] =
dir.make<TH2F>(
"MPVvsPhiTEC",
"MPV vs Phi TEC", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
974 h[
"MPV_Vs_PhiTECthin"] =
975 dir.make<TH2F>(
"MPVvsPhiTEC1",
"MPV vs Phi TEC-thin ", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
976 h[
"MPV_Vs_PhiTECthick"] =
977 dir.make<TH2F>(
"MPVvsPhiTEC2",
"MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
979 h[
"NoMPVfit"] =
dir.make<TH2F>(
"NoMPVfit",
"Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
980 h[
"NoMPVmasked"] =
dir.make<TH2F>(
"NoMPVmasked",
"Masked Modules", 350, -350, 350, 240, 0, 120);
982 h[
"Gains"] =
dir.make<TH1F>(
"Gains",
"Gains", 300, 0, 2);
983 h[
"MPVs"] =
dir.make<TH1F>(
"MPVs",
"MPVs", MPVbin, MPVmin, MPVmax);
984 h[
"MPVs320"] =
dir.make<TH1F>(
"MPV_320",
"MPV 320 thickness", MPVbin, MPVmin, MPVmax);
985 h[
"MPVs500"] =
dir.make<TH1F>(
"MPV_500",
"MPV 500 thickness", MPVbin, MPVmin, MPVmax);
986 h[
"MPVsTIB"] =
dir.make<TH1F>(
"MPV_TIB",
"MPV TIB", MPVbin, MPVmin, MPVmax);
987 h[
"MPVsTID"] =
dir.make<TH1F>(
"MPV_TID",
"MPV TID", MPVbin, MPVmin, MPVmax);
988 h[
"MPVsTIDP"] =
dir.make<TH1F>(
"MPV_TIDP",
"MPV TIDP", MPVbin, MPVmin, MPVmax);
989 h[
"MPVsTIDM"] =
dir.make<TH1F>(
"MPV_TIDM",
"MPV TIDM", MPVbin, MPVmin, MPVmax);
990 h[
"MPVsTOB"] =
dir.make<TH1F>(
"MPV_TOB",
"MPV TOB", MPVbin, MPVmin, MPVmax);
991 h[
"MPVsTEC"] =
dir.make<TH1F>(
"MPV_TEC",
"MPV TEC", MPVbin, MPVmin, MPVmax);
992 h[
"MPVsTECP"] =
dir.make<TH1F>(
"MPV_TECP",
"MPV TECP", MPVbin, MPVmin, MPVmax);
993 h[
"MPVsTECM"] =
dir.make<TH1F>(
"MPV_TECM",
"MPV TECM", MPVbin, MPVmin, MPVmax);
994 h[
"MPVsTECthin"] =
dir.make<TH1F>(
"MPV_TEC1",
"MPV TEC thin", MPVbin, MPVmin, MPVmax);
995 h[
"MPVsTECthick"] =
dir.make<TH1F>(
"MPV_TEC2",
"MPV TEC thick", MPVbin, MPVmin, MPVmax);
996 h[
"MPVsTECP1"] =
dir.make<TH1F>(
"MPV_TECP1",
"MPV TECP thin ", MPVbin, MPVmin, MPVmax);
997 h[
"MPVsTECP2"] =
dir.make<TH1F>(
"MPV_TECP2",
"MPV TECP thick", MPVbin, MPVmin, MPVmax);
998 h[
"MPVsTECM1"] =
dir.make<TH1F>(
"MPV_TECM1",
"MPV TECM thin", MPVbin, MPVmin, MPVmax);
999 h[
"MPVsTECM2"] =
dir.make<TH1F>(
"MPV_TECM2",
"MPV TECM thick", MPVbin, MPVmin, MPVmax);
1001 h[
"MPVError"] =
dir.make<TH1F>(
"MPVError",
"MPV Error", 150, 0, 150);
1002 h[
"MPVErrorVsMPV"] =
dir.make<TH2F>(
"MPVErrorVsMPV",
"MPV Error vs MPV", 300, 0, 600, 150, 0, 150);
1003 h[
"MPVErrorVsEta"] =
dir.make<TH2F>(
"MPVErrorVsEta",
"MPV Error vs Eta", 50, -3.0, 3.0, 150, 0, 150);
1004 h[
"MPVErrorVsPhi"] =
dir.make<TH2F>(
"MPVErrorVsPhi",
"MPV Error vs Phi", 50, -3.4, 3.4, 150, 0, 150);
1005 h[
"MPVErrorVsN"] =
dir.make<TH2F>(
"MPVErrorVsN",
"MPV Error vs N", 500, 0, 1000, 150, 0, 150);
1007 h[
"DiffWRTPrevGainTIB"] =
dir.make<TH1F>(
"DiffWRTPrevGainTIB",
"Diff w.r.t. PrevGain TIB", 250, 0.5, 1.5);
1008 h[
"DiffWRTPrevGainTID"] =
dir.make<TH1F>(
"DiffWRTPrevGainTID",
"Diff w.r.t. PrevGain TID", 250, 0.5, 1.5);
1009 h[
"DiffWRTPrevGainTOB"] =
dir.make<TH1F>(
"DiffWRTPrevGainTOB",
"Diff w.r.t. PrevGain TOB", 250, 0.5, 1.5);
1010 h[
"DiffWRTPrevGainTEC"] =
dir.make<TH1F>(
"DiffWRTPrevGainTEC",
"Diff w.r.t. PrevGain TEC", 250, 0.5, 1.5);
1012 h[
"GainVsPrevGainTIB"] =
dir.make<TH2F>(
"GainVsPrevGainTIB",
"Gain vs PrevGain TIB", 100, 0, 2, 100, 0, 2);
1013 h[
"GainVsPrevGainTID"] =
dir.make<TH2F>(
"GainVsPrevGainTID",
"Gain vs PrevGain TID", 100, 0, 2, 100, 0, 2);
1014 h[
"GainVsPrevGainTOB"] =
dir.make<TH2F>(
"GainVsPrevGainTOB",
"Gain vs PrevGain TOB", 100, 0, 2, 100, 0, 2);
1015 h[
"GainVsPrevGainTEC"] =
dir.make<TH2F>(
"GainVsPrevGainTEC",
"Gain vs PrevGain TEC", 100, 0, 2, 100, 0, 2);
1030 float Eta =
APV->Eta;
1033 float Thickness =
APV->Thickness;
1034 double FitMPV =
APV->FitMPV;
1035 double FitMPVErr =
APV->FitMPVErr;
1037 double NEntries =
APV->NEntries;
1038 double PreviousGain =
APV->PreviousGain;
1053 if (Thickness < 0.04)
1055 if (Thickness > 0.04)
1069 }
else if (
SubDet == 4) {
1078 }
else if (
SubDet == 5) {
1083 }
else if (
SubDet == 6) {
1091 if (Thickness < 0.04) {
1100 if (Thickness > 0.04) {
1112 if (
SubDet == 3 && PreviousGain != 0.)
1114 else if (
SubDet == 4 && PreviousGain != 0.)
1116 else if (
SubDet == 5 && PreviousGain != 0.)
1118 else if (
SubDet == 6 && PreviousGain != 0.)
1137 desc.addUntracked<
double>(
"minNrEntries", 20);
1138 desc.add<
int>(
"fitMode", 2)
1139 ->setComment(
"fit mode. Available options: 1: landau\n 2: landau around max\n 3:landau&gaus convo\n 4: fake");
1140 desc.addUntracked<std::vector<unsigned int>>(
"selectedModules", {});
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
static constexpr auto TEC
virtual int nstrips() const =0
std::unique_ptr< TrackerMap > mpv_err_map
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
void getPeakOfLanGau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
T getParameter(std::string const &) const
std::map< std::string, TH1 * > hControl
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
static double langaufun(Double_t *x, Double_t *par)
std::map< std::string, TH1 * > bookQualityMonitor(const TFileDirectory &dir)
bool IsApvBad(uint32_t detid, short apvNb) const
bool isValidMode(int mode) const
std::unique_ptr< TrackerMap > entries_map
virtual int ncolumns() const =0
std::unique_ptr< TrackerMap > new_payload_map
virtual int nrows() const =0
std::unique_ptr< TrackerMap > mpv_map
SiStripApvGainInspector(const edm::ParameterSet &)
void storeOnTree(TFileService *tfs)
const std::string filename_
const SiStripApvGain::Range getRange(uint32_t detID) const
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
void doFakeFit(TH1 *InputHisto, double *FitResults)
std::vector< unsigned int > wantedmods
Log< level::Error, false > LogError
std::unique_ptr< TrackerMap > fitChi2_map
static double fitChi2(const CachingVertex< 5 > &vtx)
void analyze(const edm::Event &, const edm::EventSetup &) override
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
std::unordered_map< unsigned int, std::shared_ptr< stAPVGain > > APVsColl
void getPeakOfLandauAroundMax(TH1 *InputHisto, double *FitResults, double LowRange=100, double HighRange=100)
size_t getNumberOfTags() const
T const * product() const
const std::vector< std::string > fitModeStrings
const TrackerTopology * tTopo_
cond::Time_t currentTime() const
std::unique_ptr< TrackerMap > old_payload_map
~SiStripApvGainInspector() override
std::pair< ContainerIterator, ContainerIterator > Range
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const std::complex< double > I
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::unique_ptr< TrackerMap > ratio_map
static constexpr auto TOB
Log< level::Warning, true > LogPrint
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
std::unique_ptr< SiStripApvGain > getNewObject()
const edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
std::map< std::pair< unsigned char, uint32_t >, TH1F * > histoMap_
void fill1D(std::map< std::string, TH1 *> &h, const std::string &s, double x)
Log< level::Info, false > LogInfo
static constexpr auto TIB
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
constexpr uint32_t rawId() const
get the raw id
const TrackerGeometry * bareTkGeomPtr_
std::pair< float, float > getTruncatedRange(const TrackerMap *theMap)
bool isGoodLandauFit(double *FitResults)
std::vector< std::shared_ptr< stAPVGain > > APVsCollOrdered
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void checkBookAPVColls(const edm::EventSetup &es)
static const std::string kSharedResource
const TH2F * Charge_Vs_Index
edm::ESHandle< TrackerGeometry > tkGeom_
void fill2D(std::map< std::string, TH1 *> &h, const std::string &s, double x, double y)
T * make(const Args &...args) const
make new ROOT object
void makeNicePlotStyle(TH1F *plot)
void fillQualityMonitor()
Log< level::Warning, false > LogWarning
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
T mod(const T &a, const T &b)
static constexpr auto TID
void checkAndRetrieveTopology(const edm::EventSetup &setup)
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)