CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PreparePVTrends Class Reference

#include <PreparePVTrends.h>

Public Member Functions

std::vector< int > list_files (const char *dirname=".", const char *ext=".root")
 
void multiRunPVValidation (bool useRMS=true, TString lumiInputFile="", bool doUnitTest=false)
 
void outputGraphs (const pv::wrappedTrends &allInputs, const std::vector< double > &ticks, const std::vector< double > &ex_ticks, TGraph *&g_mean, TGraph *&g_chi2, TGraph *&g_KS, TGraph *&g_low, TGraph *&g_high, TGraphAsymmErrors *&g_asym, TH1F *h_RMS[], const pv::bundle &mybundle, const pv::view &theView, const int index, const TString &label)
 
 PreparePVTrends (const char *outputFileName, int nWorkers, boost::property_tree::ptree &json)
 
void setDirsAndLabels (boost::property_tree::ptree &json)
 
 ~PreparePVTrends ()
 

Static Public Member Functions

static TH1F * drawConstantWithErr (TH1F *hist, Int_t iter, Double_t theConst)
 
static pv::biases getBiases (TH1F *hist)
 
static unrolledHisto getUnrolledHisto (TH1F *hist)
 
static outPVtrends processData (size_t iter, std::vector< int > intersection, const Int_t nDirs_, const char *dirs[10], TString LegLabels[10], bool useRMS, const size_t nWorkers, bool doUnitTest)
 

Private Attributes

std::vector< std::string > DirList
 
std::vector< std::string > LabelList
 
const size_t nWorkers_
 
const char * outputFileName_
 

Detailed Description

Definition at line 248 of file PreparePVTrends.h.

Constructor & Destructor Documentation

◆ PreparePVTrends()

PreparePVTrends::PreparePVTrends ( const char *  outputFileName,
int  nWorkers,
boost::property_tree::ptree &  json 
)

Definition at line 6 of file PreparePVTrends.cc.

References setDirsAndLabels().

9 }
nlohmann::json json
void setDirsAndLabels(boost::property_tree::ptree &json)
const char * outputFileName_
const size_t nWorkers_

◆ ~PreparePVTrends()

PreparePVTrends::~PreparePVTrends ( )
inline

Definition at line 251 of file PreparePVTrends.h.

251 {}

Member Function Documentation

◆ drawConstantWithErr()

TH1F * PreparePVTrends::drawConstantWithErr ( TH1F *  hist,
Int_t  iter,
Double_t  theConst 
)
static

Definition at line 610 of file PreparePVTrends.cc.

References MonitorHOAlCaRecoStream_cfi::highedge, compareTotals::hist, mps_fire::i, MonitorHOAlCaRecoStream_cfi::lowedge, and LaserClient_cfi::nbins.

Referenced by getBiases().

612 {
613  Int_t nbins = hist->GetNbinsX();
614  Double_t lowedge = hist->GetBinLowEdge(1);
615  Double_t highedge = hist->GetBinLowEdge(nbins + 1);
616 
617  TH1F *hzero = new TH1F(Form("hconst_%s_%i", hist->GetName(), iter),
618  Form("hconst_%s_%i", hist->GetName(), iter),
619  nbins,
620  lowedge,
621  highedge);
622  for (Int_t i = 0; i <= hzero->GetNbinsX(); i++) {
623  hzero->SetBinContent(i, theConst);
624  hzero->SetBinError(i, hist->GetBinError(i));
625  }
626  hzero->SetLineWidth(2);
627  hzero->SetLineStyle(9);
628  hzero->SetLineColor(kMagenta);
629 
630  return hzero;
631 }

◆ getBiases()

pv::biases PreparePVTrends::getBiases ( TH1F *  hist)
static

Definition at line 664 of file PreparePVTrends.cc.

References nano_mu_local_reco_cff::chi2, BPHMonitor_cff::displaced, drawConstantWithErr(), submitPVResolutionJobs::err, f, compareTotals::hist, dqmiolumiharvest::j, logError, SiStripPI::max, Mean, SiStripPI::mean, SiStripPI::min, LaserClient_cfi::nbins, mps_fire::result, RMS, SiStripPI::rms, and y.

Referenced by processData().

666 {
667  int nbins = hist->GetNbinsX();
668  // if there are no bins in the histogram then return default constructed object
669  // shouldn't really ever happen
670  if (nbins <= 0) {
671  logError << "No bins in the input histogram";
672  return pv::biases();
673  }
674 
675  //extract median from histogram
676  double *y = new double[nbins];
677  double *err = new double[nbins];
678 
679  // remember for weight means <x> = sum_i (x_i* w_i) / sum_i w_i ; where w_i = 1/sigma^2_i
680 
681  for (int j = 0; j < nbins; j++) {
682  y[j] = hist->GetBinContent(j + 1);
683  if (hist->GetBinError(j + 1) != 0.) {
684  err[j] = 1. / (hist->GetBinError(j + 1) * hist->GetBinError(j + 1));
685  } else {
686  err[j] = 0.;
687  }
688  }
689 
690  Double_t w_mean = TMath::Mean(nbins, y, err);
691  Double_t w_rms = TMath::RMS(nbins, y, err);
692 
693  Double_t mean = TMath::Mean(nbins, y);
694  Double_t rms = TMath::RMS(nbins, y);
695 
696  Double_t max = hist->GetMaximum();
697  Double_t min = hist->GetMinimum();
698 
699  // in case one would like to use a pol0 fit
700  hist->Fit("pol0", "Q0+");
701  TF1 *f = (TF1 *)hist->FindObject("pol0");
702  //f->SetLineColor(hist->GetLineColor());
703  //f->SetLineStyle(hist->GetLineStyle());
704  Double_t chi2 = f->GetChisquare();
705  Int_t ndf = f->GetNDF();
706 
707  TH1F *theZero = drawConstantWithErr(hist, 1, 1.);
708  TH1F *displaced = (TH1F *)hist->Clone("displaced");
709  displaced->Add(theZero);
710  Double_t ksScore = std::max(-20., TMath::Log10(displaced->KolmogorovTest(theZero)));
711 
712  /*
713  std::pair<std::pair<Double_t,Double_t>, Double_t> result;
714  std::pair<Double_t,Double_t> resultBounds;
715  resultBounds = useRMS_ ? std::make_pair(mean-rms,mean+rms) : std::make_pair(min,max) ;
716  result = make_pair(resultBounds,mean);
717  */
718 
719  pv::biases result(mean, rms, w_mean, w_rms, min, max, chi2, ndf, ksScore);
720 
721  delete theZero;
722  delete displaced;
723  delete[] y;
724  delete[] err;
725  return result;
726 }
Structure biases Contains characterization of a single run PV bias plot.
double f[11][100]
static TH1F * drawConstantWithErr(TH1F *hist, Int_t iter, Double_t theConst)
#define logError

◆ getUnrolledHisto()

unrolledHisto PreparePVTrends::getUnrolledHisto ( TH1F *  hist)
static

Definition at line 638 of file PreparePVTrends.cc.

References funct::abs(), relmon_rootfiles_spy::contents, compareTotals::hist, dqmiolumiharvest::j, and runTheMatrix::ret.

Referenced by processData().

640 {
641  /*
642  Double_t y_min = hist->GetBinLowEdge(1);
643  Double_t y_max = hist->GetBinLowEdge(hist->GetNbinsX()+1);
644  */
645 
646  Double_t y_min = -0.1;
647  Double_t y_max = 0.1;
648 
649  std::vector<Double_t> contents;
650  for (int j = 0; j < hist->GetNbinsX(); j++) {
651  if (std::abs(hist->GetXaxis()->GetBinCenter(j)) <= 0.1)
652  contents.push_back(hist->GetBinContent(j + 1));
653  }
654 
655  auto ret = unrolledHisto(y_min, y_max, contents.size(), contents);
656  return ret;
657 }
ret
prodAgent to be discontinued
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ list_files()

std::vector< int > PreparePVTrends::list_files ( const char *  dirname = ".",
const char *  ext = ".root" 
)

Definition at line 578 of file PreparePVTrends.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, DeadROC_duringRun::dir, BTVHLTOfflineSource_cfi::dirname, geometryDiff::file, submitPVResolutionJobs::files, alignmentValidation::fname, and GetRecoTauVFromDQM_MC_cff::next.

Referenced by multiRunPVValidation().

580 {
581  std::vector<int> theRunNumbers;
582 
583  TSystemDirectory dir(dirname, dirname);
584  TList *files = dir.GetListOfFiles();
585  if (files) {
586  TSystemFile *file;
587  TString fname;
588  TIter next(files);
589  while ((file = (TSystemFile *)next())) {
590  fname = file->GetName();
591  if (!file->IsDirectory() && fname.EndsWith(ext) && fname.BeginsWith("PVValidation")) {
592  //logInfo << fname.Data() << std::endl;
593  TObjArray *bits = fname.Tokenize("_");
594  TString theRun = bits->At(2)->GetName();
595  //logInfo << theRun << std::endl;
596  TString formatRun = (theRun.ReplaceAll(".root", "")).ReplaceAll("_", "");
597  //logInfo << dirname << " "<< formatRun.Atoi() << std::endl;
598  theRunNumbers.push_back(formatRun.Atoi());
599  }
600  }
601  }
602  return theRunNumbers;
603 }
string fname
main script
Definition: memstream.h:15

◆ multiRunPVValidation()

void PreparePVTrends::multiRunPVValidation ( bool  useRMS = true,
TString  lumiInputFile = "",
bool  doUnitTest = false 
)

Definition at line 20 of file PreparePVTrends.cc.

References a, funct::abs(), cms::cuda::assert(), b, DirList, heppy_check::dirs, pv::dxyeta, pv::dxyphi, pv::dzeta, pv::dzphi, spr::find(), groupFilesInBlocks::fout, reco::helper::VirtualJetProducerHelper::intersection(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmiolumiharvest::j, label, LabelList, mps_splice::line, list_files(), logInfo, logWarning, SiStripPI::min, nWorkers_, das-up-to-nevents::outfile, outputFileName_, outputGraphs(), pv::bundle::printAll(), processData(), FastTimerService_cff::range, writedatasetfile::run, submitPVResolutionJobs::runindex, writedatasetfile::runs, DBoxMetadataHelper::set_intersection(), jetUpdater_cfi::sort, AlCaHLTBitMon_QueryRunRegistry::string, and VERBOSE.

Referenced by trends().

20  {
21  TStopwatch timer;
22  timer.Start();
23 
24  gROOT->ProcessLine("gErrorIgnoreLevel = kError;");
25 
26  ROOT::EnableThreadSafety();
27  TH1::AddDirectory(kFALSE);
28 
29  std::ofstream outfile("log.txt");
30 
31  const Int_t nDirs_ = DirList.size();
32  TString LegLabels[10];
33  const char *dirs[10];
34 
35  std::vector<int> intersection;
36  std::vector<double> runs;
37  std::vector<double> x_ticks;
38  std::vector<double> ex_ticks = {0.};
39 
40  for (Int_t j = 0; j < nDirs_; j++) {
41  // Retrieve labels
42  LegLabels[j] = LabelList[j];
43  dirs[j] = DirList[j].data();
44 
45  std::vector<int> currentList = list_files(dirs[j]);
46  std::vector<int> tempSwap;
47 
48  std::sort(currentList.begin(), currentList.end());
49 
50  if (j == 0) {
51  intersection = currentList;
52  }
53 
54  std::sort(intersection.begin(), intersection.end());
55 
57  currentList.begin(), currentList.end(), intersection.begin(), intersection.end(), std::back_inserter(tempSwap));
58 
59  intersection.clear();
60  intersection = tempSwap;
61  tempSwap.clear();
62  }
63 
64  std::ifstream lumifile(lumiInputFile.Data());
65 
67  while (std::getline(lumifile, line)) {
68  std::istringstream iss(line);
69  std::string a, b;
70  if (!(iss >> a >> b)) {
71  break;
72  } // error
73  int run = std::stoi(a);
74 
75  // check if the run is in the list
76  if (std::find(intersection.begin(), intersection.end(), run) == intersection.end()) {
77  logWarning << " Run: " << run << " is not found in the intersection" << std::endl;
78  }
79  }
80 
81  // book the vectors of values
82  alignmentTrend dxyPhiMeans_;
83  alignmentTrend dxyPhiChi2_;
84  alignmentTrend dxyPhiHiErr_;
85  alignmentTrend dxyPhiLoErr_;
86  alignmentTrend dxyPhiKS_;
87  alignmentTrend dxyPhiHi_;
88  alignmentTrend dxyPhiLo_;
89 
90  alignmentTrend dxyEtaMeans_;
91  alignmentTrend dxyEtaChi2_;
92  alignmentTrend dxyEtaHiErr_;
93  alignmentTrend dxyEtaLoErr_;
94  alignmentTrend dxyEtaKS_;
95  alignmentTrend dxyEtaHi_;
96  alignmentTrend dxyEtaLo_;
97 
98  alignmentTrend dzPhiMeans_;
99  alignmentTrend dzPhiChi2_;
100  alignmentTrend dzPhiHiErr_;
101  alignmentTrend dzPhiLoErr_;
102  alignmentTrend dzPhiKS_;
103  alignmentTrend dzPhiHi_;
104  alignmentTrend dzPhiLo_;
105 
106  alignmentTrend dzEtaMeans_;
107  alignmentTrend dzEtaChi2_;
108  alignmentTrend dzEtaHiErr_;
109  alignmentTrend dzEtaLoErr_;
110  alignmentTrend dzEtaKS_;
111  alignmentTrend dzEtaHi_;
112  alignmentTrend dzEtaLo_;
113 
114  // unrolled histos
115 
116  std::map<TString, std::vector<unrolledHisto> > dxyVect;
117  std::map<TString, std::vector<unrolledHisto> > dzVect;
118 
119  logInfo << " pre do-stuff: " << runs.size() << std::endl;
120 
121  //we should use std::bind to create a functor and then pass it to the procPool
122  auto f_processData =
123  std::bind(processData, ph::_1, intersection, nDirs_, dirs, LegLabels, useRMS, nWorkers_, doUnitTest);
124 
125  //f_processData(0);
126  //logInfo<<" post do-stuff: " << runs.size() << std::endl;
127 
128  TProcPool procPool(std::min(nWorkers_, intersection.size()));
129  std::vector<size_t> range(std::min(nWorkers_, intersection.size()));
130  std::iota(range.begin(), range.end(), 0);
131  //procPool.Map([&f_processData](size_t a) { f_processData(a); },{1,2,3});
132  auto extracts = procPool.Map(f_processData, range);
133 
134  // sort the extracts according to the global index
135  std::sort(extracts.begin(), extracts.end(), [](const outPVtrends &a, const outPVtrends &b) -> bool {
136  return a.m_index < b.m_index;
137  });
138 
139  // re-assemble everything together
140  for (auto extractedTrend : extracts) {
141  runs.insert(std::end(runs), std::begin(extractedTrend.m_runs), std::end(extractedTrend.m_runs));
142 
143  for (const auto &label : LegLabels) {
144  //******************************//
145  dxyPhiMeans_[label].insert(std::end(dxyPhiMeans_[label]),
146  std::begin(extractedTrend.m_dxyPhiMeans[label]),
147  std::end(extractedTrend.m_dxyPhiMeans[label]));
148  dxyPhiChi2_[label].insert(std::end(dxyPhiChi2_[label]),
149  std::begin(extractedTrend.m_dxyPhiChi2[label]),
150  std::end(extractedTrend.m_dxyPhiChi2[label]));
151  dxyPhiKS_[label].insert(std::end(dxyPhiKS_[label]),
152  std::begin(extractedTrend.m_dxyPhiKS[label]),
153  std::end(extractedTrend.m_dxyPhiKS[label]));
154 
155  dxyPhiHi_[label].insert(std::end(dxyPhiHi_[label]),
156  std::begin(extractedTrend.m_dxyPhiHi[label]),
157  std::end(extractedTrend.m_dxyPhiHi[label]));
158  dxyPhiLo_[label].insert(std::end(dxyPhiLo_[label]),
159  std::begin(extractedTrend.m_dxyPhiLo[label]),
160  std::end(extractedTrend.m_dxyPhiLo[label]));
161 
162  //******************************//
163  dzPhiMeans_[label].insert(std::end(dzPhiMeans_[label]),
164  std::begin(extractedTrend.m_dzPhiMeans[label]),
165  std::end(extractedTrend.m_dzPhiMeans[label]));
166  dzPhiChi2_[label].insert(std::end(dzPhiChi2_[label]),
167  std::begin(extractedTrend.m_dzPhiChi2[label]),
168  std::end(extractedTrend.m_dzPhiChi2[label]));
169  dzPhiKS_[label].insert(std::end(dzPhiKS_[label]),
170  std::begin(extractedTrend.m_dzPhiKS[label]),
171  std::end(extractedTrend.m_dzPhiKS[label]));
172 
173  dzPhiHi_[label].insert(std::end(dzPhiHi_[label]),
174  std::begin(extractedTrend.m_dzPhiHi[label]),
175  std::end(extractedTrend.m_dzPhiHi[label]));
176  dzPhiLo_[label].insert(std::end(dzPhiLo_[label]),
177  std::begin(extractedTrend.m_dzPhiLo[label]),
178  std::end(extractedTrend.m_dzPhiLo[label]));
179 
180  //******************************//
181  dxyEtaMeans_[label].insert(std::end(dxyEtaMeans_[label]),
182  std::begin(extractedTrend.m_dxyEtaMeans[label]),
183  std::end(extractedTrend.m_dxyEtaMeans[label]));
184  dxyEtaChi2_[label].insert(std::end(dxyEtaChi2_[label]),
185  std::begin(extractedTrend.m_dxyEtaChi2[label]),
186  std::end(extractedTrend.m_dxyEtaChi2[label]));
187  dxyEtaKS_[label].insert(std::end(dxyEtaKS_[label]),
188  std::begin(extractedTrend.m_dxyEtaKS[label]),
189  std::end(extractedTrend.m_dxyEtaKS[label]));
190 
191  dxyEtaHi_[label].insert(std::end(dxyEtaHi_[label]),
192  std::begin(extractedTrend.m_dxyEtaHi[label]),
193  std::end(extractedTrend.m_dxyEtaHi[label]));
194  dxyEtaLo_[label].insert(std::end(dxyEtaLo_[label]),
195  std::begin(extractedTrend.m_dxyEtaLo[label]),
196  std::end(extractedTrend.m_dxyEtaLo[label]));
197 
198  //******************************//
199  dzEtaMeans_[label].insert(std::end(dzEtaMeans_[label]),
200  std::begin(extractedTrend.m_dzEtaMeans[label]),
201  std::end(extractedTrend.m_dzEtaMeans[label]));
202  dzEtaChi2_[label].insert(std::end(dzEtaChi2_[label]),
203  std::begin(extractedTrend.m_dzEtaChi2[label]),
204  std::end(extractedTrend.m_dzEtaChi2[label]));
205  dzEtaKS_[label].insert(std::end(dzEtaKS_[label]),
206  std::begin(extractedTrend.m_dzEtaKS[label]),
207  std::end(extractedTrend.m_dzEtaKS[label]));
208 
209  dzEtaHi_[label].insert(std::end(dzEtaHi_[label]),
210  std::begin(extractedTrend.m_dzEtaHi[label]),
211  std::end(extractedTrend.m_dzEtaHi[label]));
212  dzEtaLo_[label].insert(std::end(dzEtaLo_[label]),
213  std::begin(extractedTrend.m_dzEtaLo[label]),
214  std::end(extractedTrend.m_dzEtaLo[label]));
215 
216  //******************************//
217  dxyVect[label].insert(std::end(dxyVect[label]),
218  std::begin(extractedTrend.m_dxyVect[label]),
219  std::end(extractedTrend.m_dxyVect[label]));
220  dzVect[label].insert(std::end(dzVect[label]),
221  std::begin(extractedTrend.m_dzVect[label]),
222  std::end(extractedTrend.m_dzVect[label]));
223  }
224  }
225  // extra vectors for low and high boundaries
226 
227  for (const auto &label : LegLabels) {
228  for (unsigned int it = 0; it < dxyPhiMeans_[label].size(); it++) {
229  dxyPhiHiErr_[label].push_back(std::abs(dxyPhiHi_[label][it] - dxyPhiMeans_[label][it]));
230  dxyPhiLoErr_[label].push_back(std::abs(dxyPhiLo_[label][it] - dxyPhiMeans_[label][it]));
231  dxyEtaHiErr_[label].push_back(std::abs(dxyEtaHi_[label][it] - dxyEtaMeans_[label][it]));
232  dxyEtaLoErr_[label].push_back(std::abs(dxyEtaLo_[label][it] - dxyEtaMeans_[label][it]));
233 
234  if (VERBOSE) {
235  logInfo << "label: " << label << " means:" << dxyEtaMeans_[label][it] << " low: " << dxyEtaLo_[label][it]
236  << " loErr: " << dxyEtaLoErr_[label][it] << std::endl;
237  }
238 
239  dzPhiHiErr_[label].push_back(std::abs(dzPhiHi_[label][it] - dzPhiMeans_[label][it]));
240  dzPhiLoErr_[label].push_back(std::abs(dzPhiLo_[label][it] - dzPhiMeans_[label][it]));
241  dzEtaHiErr_[label].push_back(std::abs(dzEtaHi_[label][it] - dzEtaMeans_[label][it]));
242  dzEtaLoErr_[label].push_back(std::abs(dzEtaLo_[label][it] - dzEtaMeans_[label][it]));
243  }
244  }
245  // bias on the mean
246 
247  TGraph *g_dxy_phi_vs_run[nDirs_];
248  TGraphAsymmErrors *gerr_dxy_phi_vs_run[nDirs_];
249  TGraph *g_chi2_dxy_phi_vs_run[nDirs_];
250  TGraph *g_KS_dxy_phi_vs_run[nDirs_];
251  //TGraph *gprime_dxy_phi_vs_run[nDirs_];
252  TGraph *g_dxy_phi_hi_vs_run[nDirs_];
253  TGraph *g_dxy_phi_lo_vs_run[nDirs_];
254 
255  TGraph *g_dxy_eta_vs_run[nDirs_];
256  TGraphAsymmErrors *gerr_dxy_eta_vs_run[nDirs_];
257  TGraph *g_chi2_dxy_eta_vs_run[nDirs_];
258  TGraph *g_KS_dxy_eta_vs_run[nDirs_];
259  //TGraph *gprime_dxy_eta_vs_run[nDirs_];
260  TGraph *g_dxy_eta_hi_vs_run[nDirs_];
261  TGraph *g_dxy_eta_lo_vs_run[nDirs_];
262 
263  TGraph *g_dz_phi_vs_run[nDirs_];
264  TGraphAsymmErrors *gerr_dz_phi_vs_run[nDirs_];
265  TGraph *g_chi2_dz_phi_vs_run[nDirs_];
266  TGraph *g_KS_dz_phi_vs_run[nDirs_];
267  //TGraph *gprime_dz_phi_vs_run[nDirs_];
268  TGraph *g_dz_phi_hi_vs_run[nDirs_];
269  TGraph *g_dz_phi_lo_vs_run[nDirs_];
270 
271  TGraph *g_dz_eta_vs_run[nDirs_];
272  TGraphAsymmErrors *gerr_dz_eta_vs_run[nDirs_];
273  TGraph *g_chi2_dz_eta_vs_run[nDirs_];
274  TGraph *g_KS_dz_eta_vs_run[nDirs_];
275  //TGraph *gprime_dz_eta_vs_run[nDirs_];
276  TGraph *g_dz_eta_hi_vs_run[nDirs_];
277  TGraph *g_dz_eta_lo_vs_run[nDirs_];
278 
279  // resolutions
280 
281  TH1F *h_RMS_dxy_phi_vs_run[nDirs_];
282  TH1F *h_RMS_dxy_eta_vs_run[nDirs_];
283  TH1F *h_RMS_dz_phi_vs_run[nDirs_];
284  TH1F *h_RMS_dz_eta_vs_run[nDirs_];
285 
286  // scatters of integrated bias
287 
288  TH2F *h2_scatter_dxy_vs_run[nDirs_];
289  TH2F *h2_scatter_dz_vs_run[nDirs_];
290 
291  // decide the type
292  TString theType = "run number";
293  TString theTypeLabel = "run number";
294  x_ticks = runs;
295 
296  pv::bundle theBundle = pv::bundle(nDirs_, theType, theTypeLabel, useRMS);
297  theBundle.printAll();
298 
299  TFile *fout = TFile::Open(outputFileName_, "RECREATE");
300 
301  for (Int_t j = 0; j < nDirs_; j++) {
302  // check on the sanity
303  logInfo << "x_ticks.size()= " << x_ticks.size() << " dxyPhiMeans_[LegLabels[" << j
304  << "]].size()=" << dxyPhiMeans_[LegLabels[j]].size() << std::endl;
305 
306  // otherwise something very bad has happened
307  assert(x_ticks.size() == dxyPhiMeans_[LegLabels[j]].size());
308 
309  // *************************************
310  // dxy vs phi
311  // *************************************
312 
313  auto dxyPhiInputs =
314  pv::wrappedTrends(dxyPhiMeans_, dxyPhiLo_, dxyPhiHi_, dxyPhiLoErr_, dxyPhiHiErr_, dxyPhiChi2_, dxyPhiKS_);
315 
316  outputGraphs(dxyPhiInputs,
317  x_ticks,
318  ex_ticks,
319  g_dxy_phi_vs_run[j],
320  g_chi2_dxy_phi_vs_run[j],
321  g_KS_dxy_phi_vs_run[j],
322  g_dxy_phi_lo_vs_run[j],
323  g_dxy_phi_hi_vs_run[j],
324  gerr_dxy_phi_vs_run[j],
325  h_RMS_dxy_phi_vs_run,
326  theBundle,
327  pv::dxyphi,
328  j,
329  LegLabels[j]);
330 
331  // *************************************
332  // dxy vs eta
333  // *************************************
334 
335  auto dxyEtaInputs =
336  pv::wrappedTrends(dxyEtaMeans_, dxyEtaLo_, dxyEtaHi_, dxyEtaLoErr_, dxyEtaHiErr_, dxyEtaChi2_, dxyEtaKS_);
337 
338  outputGraphs(dxyEtaInputs,
339  x_ticks,
340  ex_ticks,
341  g_dxy_eta_vs_run[j],
342  g_chi2_dxy_eta_vs_run[j],
343  g_KS_dxy_eta_vs_run[j],
344  g_dxy_eta_lo_vs_run[j],
345  g_dxy_eta_hi_vs_run[j],
346  gerr_dxy_eta_vs_run[j],
347  h_RMS_dxy_eta_vs_run,
348  theBundle,
349  pv::dxyeta,
350  j,
351  LegLabels[j]);
352 
353  // *************************************
354  // dz vs phi
355  // *************************************
356 
357  auto dzPhiInputs =
358  pv::wrappedTrends(dzPhiMeans_, dzPhiLo_, dzPhiHi_, dzPhiLoErr_, dzPhiHiErr_, dzPhiChi2_, dzPhiKS_);
359 
360  outputGraphs(dzPhiInputs,
361  x_ticks,
362  ex_ticks,
363  g_dz_phi_vs_run[j],
364  g_chi2_dz_phi_vs_run[j],
365  g_KS_dz_phi_vs_run[j],
366  g_dz_phi_lo_vs_run[j],
367  g_dz_phi_hi_vs_run[j],
368  gerr_dz_phi_vs_run[j],
369  h_RMS_dz_phi_vs_run,
370  theBundle,
371  pv::dzphi,
372  j,
373  LegLabels[j]);
374 
375  // *************************************
376  // dz vs eta
377  // *************************************
378 
379  auto dzEtaInputs =
380  pv::wrappedTrends(dzEtaMeans_, dzEtaLo_, dzEtaHi_, dzEtaLoErr_, dzEtaHiErr_, dzEtaChi2_, dzEtaKS_);
381 
382  outputGraphs(dzEtaInputs,
383  x_ticks,
384  ex_ticks,
385  g_dz_eta_vs_run[j],
386  g_chi2_dz_eta_vs_run[j],
387  g_KS_dz_eta_vs_run[j],
388  g_dz_eta_lo_vs_run[j],
389  g_dz_eta_hi_vs_run[j],
390  gerr_dz_eta_vs_run[j],
391  h_RMS_dz_eta_vs_run,
392  theBundle,
393  pv::dzeta,
394  j,
395  LegLabels[j]);
396 
397  // *************************************
398  // Integrated bias dxy scatter plots
399  // *************************************
400 
401  h2_scatter_dxy_vs_run[j] =
402  new TH2F(Form("h2_scatter_dxy_%s", LegLabels[j].Data()),
403  Form("scatter of d_{xy} vs %s;%s;d_{xy} [cm]", theType.Data(), theTypeLabel.Data()),
404  x_ticks.size() - 1,
405  &(x_ticks[0]),
406  dxyVect[LegLabels[j]][0].get_n_bins(),
407  dxyVect[LegLabels[j]][0].get_y_min(),
408  dxyVect[LegLabels[j]][0].get_y_max());
409  h2_scatter_dxy_vs_run[j]->SetStats(kFALSE);
410  h2_scatter_dxy_vs_run[j]->SetTitle(LegLabels[j]);
411 
412  for (unsigned int runindex = 0; runindex < x_ticks.size(); runindex++) {
413  for (unsigned int binindex = 0; binindex < dxyVect[LegLabels[j]][runindex].get_n_bins(); binindex++) {
414  h2_scatter_dxy_vs_run[j]->SetBinContent(runindex + 1,
415  binindex + 1,
416  dxyVect[LegLabels[j]][runindex].get_bin_contents().at(binindex) /
417  dxyVect[LegLabels[j]][runindex].get_integral());
418  }
419  }
420 
421  // *************************************
422  // Integrated bias dz scatter plots
423  // *************************************
424 
425  h2_scatter_dz_vs_run[j] =
426  new TH2F(Form("h2_scatter_dz_%s", LegLabels[j].Data()),
427  Form("scatter of d_{z} vs %s;%s;d_{z} [cm]", theType.Data(), theTypeLabel.Data()),
428  x_ticks.size() - 1,
429  &(x_ticks[0]),
430  dzVect[LegLabels[j]][0].get_n_bins(),
431  dzVect[LegLabels[j]][0].get_y_min(),
432  dzVect[LegLabels[j]][0].get_y_max());
433  h2_scatter_dz_vs_run[j]->SetStats(kFALSE);
434  h2_scatter_dz_vs_run[j]->SetTitle(LegLabels[j]);
435 
436  for (unsigned int runindex = 0; runindex < x_ticks.size(); runindex++) {
437  for (unsigned int binindex = 0; binindex < dzVect[LegLabels[j]][runindex].get_n_bins(); binindex++) {
438  h2_scatter_dz_vs_run[j]->SetBinContent(runindex + 1,
439  binindex + 1,
440  dzVect[LegLabels[j]][runindex].get_bin_contents().at(binindex) /
441  dzVect[LegLabels[j]][runindex].get_integral());
442  }
443  }
444 
445  TString modified_label = (LegLabels[j].ReplaceAll(" ", "_"));
446  g_dxy_phi_vs_run[j]->Write("mean_" + modified_label + "_dxy_phi_vs_run");
447  g_chi2_dxy_phi_vs_run[j]->Write("chi2_" + modified_label + "_dxy_phi_vs_run");
448  g_KS_dxy_phi_vs_run[j]->Write("KS_" + modified_label + "_dxy_phi_vs_run");
449  g_dxy_phi_hi_vs_run[j]->Write("hi_" + modified_label + "_dxy_phi_hi_vs_run");
450  g_dxy_phi_lo_vs_run[j]->Write("lo_" + modified_label + "_dxy_phi_lo_vs_run");
451 
452  g_dxy_eta_vs_run[j]->Write("mean_" + modified_label + "_dxy_eta_vs_run");
453  g_chi2_dxy_eta_vs_run[j]->Write("chi2_" + modified_label + "_dxy_eta_vs_run");
454  g_KS_dxy_eta_vs_run[j]->Write("KS_" + modified_label + "_dxy_eta_vs_run");
455  g_dxy_eta_hi_vs_run[j]->Write("hi_" + modified_label + "_dxy_eta_hi_vs_run");
456  g_dxy_eta_lo_vs_run[j]->Write("lo_" + modified_label + "_dxy_eta_lo_vs_run");
457 
458  g_dz_phi_vs_run[j]->Write("mean_" + modified_label + "_dz_phi_vs_run");
459  g_chi2_dz_phi_vs_run[j]->Write("chi2_" + modified_label + "_dz_phi_vs_run");
460  g_KS_dz_phi_vs_run[j]->Write("KS_" + modified_label + "_dz_phi_vs_run");
461  g_dz_phi_hi_vs_run[j]->Write("hi_" + modified_label + "_dz_phi_hi_vs_run");
462  g_dz_phi_lo_vs_run[j]->Write("lo_" + modified_label + "_dz_phi_lo_vs_run");
463 
464  g_dz_eta_vs_run[j]->Write("mean_" + modified_label + "_dz_eta_vs_run");
465  g_chi2_dz_eta_vs_run[j]->Write("chi2_" + modified_label + "_dz_eta_vs_run");
466  g_KS_dz_eta_vs_run[j]->Write("KS_" + modified_label + "_dz_eta_vs_run");
467  g_dz_eta_hi_vs_run[j]->Write("hi_" + modified_label + "_dz_eta_hi_vs_run");
468  g_dz_eta_lo_vs_run[j]->Write("lo_" + modified_label + "_dz_eta_lo_vs_run");
469 
470  h_RMS_dxy_phi_vs_run[j]->Write("RMS_" + modified_label + "_dxy_phi_vs_run");
471  h_RMS_dxy_eta_vs_run[j]->Write("RMS_" + modified_label + "_dxy_eta_vs_run");
472  h_RMS_dz_phi_vs_run[j]->Write("RMS_" + modified_label + "_dz_phi_vs_run");
473  h_RMS_dz_eta_vs_run[j]->Write("RMS_" + modified_label + "_dz_eta_vs_run");
474 
475  // scatter
476 
477  h2_scatter_dxy_vs_run[j]->Write("Scatter_" + modified_label + "_dxy_vs_run");
478  h2_scatter_dz_vs_run[j]->Write("Scatter_" + modified_label + "_dz_vs_run");
479  }
480  // do all the deletes
481 
482  for (int iDir = 0; iDir < nDirs_; iDir++) {
483  delete g_dxy_phi_vs_run[iDir];
484  delete g_chi2_dxy_phi_vs_run[iDir];
485  delete g_KS_dxy_phi_vs_run[iDir];
486  delete g_dxy_phi_hi_vs_run[iDir];
487  delete g_dxy_phi_lo_vs_run[iDir];
488 
489  delete g_dxy_eta_vs_run[iDir];
490  delete g_chi2_dxy_eta_vs_run[iDir];
491  delete g_KS_dxy_eta_vs_run[iDir];
492  delete g_dxy_eta_hi_vs_run[iDir];
493  delete g_dxy_eta_lo_vs_run[iDir];
494 
495  delete g_dz_phi_vs_run[iDir];
496  delete g_chi2_dz_phi_vs_run[iDir];
497  delete g_KS_dz_phi_vs_run[iDir];
498  delete g_dz_phi_hi_vs_run[iDir];
499  delete g_dz_phi_lo_vs_run[iDir];
500 
501  delete g_dz_eta_vs_run[iDir];
502  delete g_chi2_dz_eta_vs_run[iDir];
503  delete g_KS_dz_eta_vs_run[iDir];
504  delete g_dz_eta_hi_vs_run[iDir];
505  delete g_dz_eta_lo_vs_run[iDir];
506 
507  delete h_RMS_dxy_phi_vs_run[iDir];
508  delete h_RMS_dxy_eta_vs_run[iDir];
509  delete h_RMS_dz_phi_vs_run[iDir];
510  delete h_RMS_dz_eta_vs_run[iDir];
511 
512  delete h2_scatter_dxy_vs_run[iDir];
513  delete h2_scatter_dz_vs_run[iDir];
514  }
515 
516  fout->Close();
517 
518  timer.Stop();
519  timer.Print();
520 }
Structure outPVtrends Contains the ensemble of all the alignmentTrends built by the functor...
Definition: OutPVtrends.h:88
#define VERBOSE
std::vector< std::string > LabelList
static outPVtrends processData(size_t iter, std::vector< int > intersection, const Int_t nDirs_, const char *dirs[10], TString LegLabels[10], bool useRMS, const size_t nWorkers, bool doUnitTest)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< int > list_files(const char *dirname=".", const char *ext=".root")
assert(be >=bs)
Structure wrappedTrends Contains the ensemble vs run number of the alignmentTrend characterization...
#define logInfo
char const * label
Structure bundle Contains the ensemble of all the information to build the graphs alignmentTrends...
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const char * outputFileName_
void outputGraphs(const pv::wrappedTrends &allInputs, const std::vector< double > &ticks, const std::vector< double > &ex_ticks, TGraph *&g_mean, TGraph *&g_chi2, TGraph *&g_KS, TGraph *&g_low, TGraph *&g_high, TGraphAsymmErrors *&g_asym, TH1F *h_RMS[], const pv::bundle &mybundle, const pv::view &theView, const int index, const TString &label)
std::map< TString, std::vector< double > > alignmentTrend
Definition: OutPVtrends.h:44
std::vector< std::string > DirList
const size_t nWorkers_
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
#define logWarning
std::vector< std::string > set_intersection(std::vector< std::string > const &v1, std::vector< std::string > const &v2)

◆ outputGraphs()

void PreparePVTrends::outputGraphs ( const pv::wrappedTrends allInputs,
const std::vector< double > &  ticks,
const std::vector< double > &  ex_ticks,
TGraph *&  g_mean,
TGraph *&  g_chi2,
TGraph *&  g_KS,
TGraph *&  g_low,
TGraph *&  g_high,
TGraphAsymmErrors *&  g_asym,
TH1F *  h_RMS[],
const pv::bundle mybundle,
const pv::view theView,
const int  index,
const TString &  label 
)

Definition at line 527 of file PreparePVTrends.cc.

References funct::abs(), pv::wrappedTrends::getChi2(), pv::wrappedTrends::getHigh(), pv::wrappedTrends::getHighErr(), pv::wrappedTrends::getKS(), pv::wrappedTrends::getLow(), pv::wrappedTrends::getLowErr(), pv::wrappedTrends::getMean(), and label.

Referenced by multiRunPVValidation().

542 {
543  g_mean = new TGraph(ticks.size(), &(ticks[0]), &((allInputs.getMean()[label])[0]));
544  g_chi2 = new TGraph(ticks.size(), &(ticks[0]), &((allInputs.getChi2()[label])[0]));
545  g_KS = new TGraph(ticks.size(), &(ticks[0]), &((allInputs.getKS()[label])[0]));
546  g_high = new TGraph(ticks.size(), &(ticks[0]), &((allInputs.getHigh()[label])[0]));
547  g_low = new TGraph(ticks.size(), &(ticks[0]), &((allInputs.getLow()[label])[0]));
548 
549  g_asym = new TGraphAsymmErrors(ticks.size(),
550  &(ticks[0]),
551  &((allInputs.getMean()[label])[0]),
552  &(ex_ticks[0]),
553  &(ex_ticks[0]),
554  &((allInputs.getLowErr()[label])[0]),
555  &((allInputs.getHighErr()[label])[0]));
556 
557  g_mean->SetTitle(label);
558  g_asym->SetTitle(label);
559 
560  // scatter or RMS TH1
561  std::vector<double> newTicks = ticks;
562  newTicks.insert(newTicks.end(), ticks.back() + 1.);
563  h_RMS[index] = new TH1F(Form("h_RMS_dz_eta_%s", label.Data()), label, newTicks.size() - 1, &(newTicks[0]));
564  h_RMS[index]->SetStats(kFALSE);
565 
566  for (size_t bincounter = 1; bincounter < ticks.size() + 1; bincounter++) {
567  h_RMS[index]->SetBinContent(
568  bincounter, std::abs(allInputs.getHigh()[label][bincounter - 1] - allInputs.getLow()[label][bincounter - 1]));
569  h_RMS[index]->SetBinError(bincounter, 0.01);
570  }
571 }
alignmentTrend getHighErr() const
alignmentTrend getMean() const
alignmentTrend getLowErr() const
char const * label
alignmentTrend getHigh() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
alignmentTrend getKS() const
alignmentTrend getChi2() const
alignmentTrend getLow() const

◆ processData()

outPVtrends PreparePVTrends::processData ( size_t  iter,
std::vector< int >  intersection,
const Int_t  nDirs_,
const char *  dirs[10],
TString  LegLabels[10],
bool  useRMS,
const size_t  nWorkers,
bool  doUnitTest 
)
static

Definition at line 733 of file PreparePVTrends.cc.

References heppy_check::dirs, dqmdumpme::first, Get(), getBiases(), getUnrolledHisto(), mps_fire::i, reco::helper::VirtualJetProducerHelper::intersection(), dqmiolumiharvest::j, dqmdumpme::last, logError, logInfo, logWarning, SiStripPI::min, dqmiodumpmetadata::n, simpleEdmComparison::numEvents, position, runTheMatrix::ret, AlCaHLTBitMon_QueryRunRegistry::string, and VERBOSE.

Referenced by multiRunPVValidation().

742 {
744 
745  unsigned int effSize = std::min(nWorkers, intersection.size());
746 
747  unsigned int pitch = std::floor(intersection.size() / effSize);
748  unsigned int first = iter * pitch;
749  unsigned int last = (iter == (effSize - 1)) ? intersection.size() : ((iter + 1) * pitch);
750 
751  logInfo << "iter:" << iter << "| pitch: " << pitch << " [" << first << "-" << last << ")" << std::endl;
752 
753  ret.m_index = iter;
754 
755  for (unsigned int n = first; n < last; n++) {
756  //in case of debug, use only 50
757  //for(unsigned int n=0; n<50;n++){
758 
759  //if(intersection.at(n)!=283946)
760  // continue;
761 
762  if (VERBOSE) {
763  logInfo << "iter: " << iter << " " << n << " " << intersection.at(n) << std::endl;
764  }
765 
766  TFile *fins[nDirs_];
767 
768  TH1F *dxyPhiMeanTrend[nDirs_];
769  TH1F *dxyPhiWidthTrend[nDirs_];
770  TH1F *dzPhiMeanTrend[nDirs_];
771  TH1F *dzPhiWidthTrend[nDirs_];
772 
773  //TH1F *dxyLadderMeanTrend[nDirs_];
774  //TH1F *dxyLadderWidthTrend[nDirs_];
775  //TH1F *dzLadderWidthTrend[nDirs_];
776  //TH1F *dzLadderMeanTrend[nDirs_];
777 
778  //TH1F *dxyModZMeanTrend[nDirs_];
779  //TH1F *dxyModZWidthTrend[nDirs_];
780  //TH1F *dzModZMeanTrend[nDirs_];
781  //TH1F *dzModZWidthTrend[nDirs_];
782 
783  TH1F *dxyEtaMeanTrend[nDirs_];
784  TH1F *dxyEtaWidthTrend[nDirs_];
785  TH1F *dzEtaMeanTrend[nDirs_];
786  TH1F *dzEtaWidthTrend[nDirs_];
787 
788  TH1F *dxyNormPhiWidthTrend[nDirs_];
789  TH1F *dxyNormEtaWidthTrend[nDirs_];
790  TH1F *dzNormPhiWidthTrend[nDirs_];
791  TH1F *dzNormEtaWidthTrend[nDirs_];
792 
793  TH1F *dxyNormPtWidthTrend[nDirs_];
794  TH1F *dzNormPtWidthTrend[nDirs_];
795  TH1F *dxyPtWidthTrend[nDirs_];
796  TH1F *dzPtWidthTrend[nDirs_];
797 
798  TH1F *dxyIntegralTrend[nDirs_];
799  TH1F *dzIntegralTrend[nDirs_];
800 
801  bool areAllFilesOK = true;
802  Int_t lastOpen = 0;
803 
804  // loop over the objects
805  for (Int_t j = 0; j < nDirs_; j++) {
806  //fins[j] = TFile::Open(Form("%s/PVValidation_%s_%i.root",dirs[j],dirs[j],intersection[n]));
807  size_t position = std::string(dirs[j]).find('/');
808  std::string stem = std::string(dirs[j]).substr(position + 1); // get from position to the end
809 
810  fins[j] = new TFile(Form("%s/PVValidation_%s_%i.root", dirs[j], stem.c_str(), intersection[n]));
811  if (fins[j]->IsZombie()) {
812  logError << Form("%s/PVValidation_%s_%i.root", dirs[j], stem.c_str(), intersection[n])
813  << " is a Zombie! cannot combine" << std::endl;
814  areAllFilesOK = false;
815  lastOpen = j;
816  break;
817  }
818 
819  if (VERBOSE) {
820  logInfo << Form("%s/PVValidation_%s_%i.root", dirs[j], stem.c_str(), intersection[n])
821  << " has size: " << fins[j]->GetSize() << " b ";
822  }
823 
824  // sanity check
825  TH1F *h_tracks = (TH1F *)fins[j]->Get("PVValidation/EventFeatures/h_nTracks");
826  Double_t numEvents = h_tracks->GetEntries();
827 
828  if (!doUnitTest) {
829  if (numEvents < 2500) {
830  logWarning << "excluding run " << intersection[n] << " because it has less than 2.5k events" << std::endl;
831  areAllFilesOK = false;
832  lastOpen = j;
833  break;
834  }
835  } else {
836  if (numEvents == 0) {
837  logWarning << "excluding run " << intersection[n] << " because it has 0 events" << std::endl;
838  areAllFilesOK = false;
839  lastOpen = j;
840  break;
841  }
842  }
843 
844  dxyPhiMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dxy_phi");
845  dxyPhiWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dxy_phi");
846  dzPhiMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dz_phi");
847  dzPhiWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dz_phi");
848 
849  //dxyLadderMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dxy_ladder");
850  //dxyLadderWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dxy_ladder");
851  //dzLadderMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dz_ladder");
852  //dzLadderWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dz_ladder");
853 
854  dxyEtaMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dxy_eta");
855  dxyEtaWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dxy_eta");
856  dzEtaMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dz_eta");
857  dzEtaWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dz_eta");
858 
859  //dxyModZMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dxy_modZ");
860  //dxyModZWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dxy_modZ");
861  //dzModZMeanTrend[j] = (TH1F *)fins[j]->Get("PVValidation/MeanTrends/means_dz_modZ");
862  //dzModZWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dz_modZ");
863 
864  dxyNormPhiWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/norm_widths_dxy_phi");
865  dxyNormEtaWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/norm_widths_dxy_eta");
866  dzNormPhiWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/norm_widths_dz_phi");
867  dzNormEtaWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/norm_widths_dz_eta");
868 
869  dxyNormPtWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/norm_widths_dxy_pTCentral");
870  dzNormPtWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/norm_widths_dz_pTCentral");
871  dxyPtWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dxy_pTCentral");
872  dzPtWidthTrend[j] = (TH1F *)fins[j]->Get("PVValidation/WidthTrends/widths_dz_pTCentral");
873 
874  dxyIntegralTrend[j] = (TH1F *)fins[j]->Get("PVValidation/ProbeTrackFeatures/h_probedxyRefitV");
875  dzIntegralTrend[j] = (TH1F *)fins[j]->Get("PVValidation/ProbeTrackFeatures/h_probedzRefitV");
876 
877  // fill the vectors of biases
878 
879  auto dxyPhiBiases = getBiases(dxyPhiMeanTrend[j]);
880 
881  //logInfo<<"\n" <<j<<" "<< LegLabels[j] << " dxy(phi) mean: "<< dxyPhiBiases.getWeightedMean()
882  // <<" dxy(phi) max: "<< dxyPhiBiases.getMax()
883  // <<" dxy(phi) min: "<< dxyPhiBiases.getMin()
884  // << std::endl;
885 
886  ret.m_dxyPhiMeans[LegLabels[j]].push_back(dxyPhiBiases.getWeightedMean());
887  ret.m_dxyPhiChi2[LegLabels[j]].push_back(TMath::Log10(dxyPhiBiases.getNormChi2()));
888  ret.m_dxyPhiKS[LegLabels[j]].push_back(dxyPhiBiases.getKSScore());
889 
890  //logInfo<<"\n" <<j<<" "<< LegLabels[j] << " dxy(phi) ks score: "<< dxyPhiBiases.getKSScore() << std::endl;
891 
892  useRMS
893  ? ret.m_dxyPhiLo[LegLabels[j]].push_back(dxyPhiBiases.getWeightedMean() - 2 * dxyPhiBiases.getWeightedRMS())
894  : ret.m_dxyPhiLo[LegLabels[j]].push_back(dxyPhiBiases.getMin());
895  useRMS
896  ? ret.m_dxyPhiHi[LegLabels[j]].push_back(dxyPhiBiases.getWeightedMean() + 2 * dxyPhiBiases.getWeightedRMS())
897  : ret.m_dxyPhiHi[LegLabels[j]].push_back(dxyPhiBiases.getMax());
898 
899  auto dxyEtaBiases = getBiases(dxyEtaMeanTrend[j]);
900  ret.m_dxyEtaMeans[LegLabels[j]].push_back(dxyEtaBiases.getWeightedMean());
901  ret.m_dxyEtaChi2[LegLabels[j]].push_back(TMath::Log10(dxyEtaBiases.getNormChi2()));
902  ret.m_dxyEtaKS[LegLabels[j]].push_back(dxyEtaBiases.getKSScore());
903  useRMS
904  ? ret.m_dxyEtaLo[LegLabels[j]].push_back(dxyEtaBiases.getWeightedMean() - 2 * dxyEtaBiases.getWeightedRMS())
905  : ret.m_dxyEtaLo[LegLabels[j]].push_back(dxyEtaBiases.getMin());
906  useRMS
907  ? ret.m_dxyEtaHi[LegLabels[j]].push_back(dxyEtaBiases.getWeightedMean() + 2 * dxyEtaBiases.getWeightedRMS())
908  : ret.m_dxyEtaHi[LegLabels[j]].push_back(dxyEtaBiases.getMax());
909 
910  auto dzPhiBiases = getBiases(dzPhiMeanTrend[j]);
911  ret.m_dzPhiMeans[LegLabels[j]].push_back(dzPhiBiases.getWeightedMean());
912  ret.m_dzPhiChi2[LegLabels[j]].push_back(TMath::Log10(dzPhiBiases.getNormChi2()));
913  ret.m_dzPhiKS[LegLabels[j]].push_back(dzPhiBiases.getKSScore());
914  useRMS ? ret.m_dzPhiLo[LegLabels[j]].push_back(dzPhiBiases.getWeightedMean() - 2 * dzPhiBiases.getWeightedRMS())
915  : ret.m_dzPhiLo[LegLabels[j]].push_back(dzPhiBiases.getMin());
916  useRMS ? ret.m_dzPhiHi[LegLabels[j]].push_back(dzPhiBiases.getWeightedMean() + 2 * dzPhiBiases.getWeightedRMS())
917  : ret.m_dzPhiHi[LegLabels[j]].push_back(dzPhiBiases.getMax());
918 
919  auto dzEtaBiases = getBiases(dzEtaMeanTrend[j]);
920  ret.m_dzEtaMeans[LegLabels[j]].push_back(dzEtaBiases.getWeightedMean());
921  ret.m_dzEtaChi2[LegLabels[j]].push_back(TMath::Log10(dzEtaBiases.getNormChi2()));
922  ret.m_dzEtaKS[LegLabels[j]].push_back(dzEtaBiases.getKSScore());
923  useRMS ? ret.m_dzEtaLo[LegLabels[j]].push_back(dzEtaBiases.getWeightedMean() - 2 * dzEtaBiases.getWeightedRMS())
924  : ret.m_dzEtaLo[LegLabels[j]].push_back(dzEtaBiases.getMin());
925  useRMS ? ret.m_dzEtaHi[LegLabels[j]].push_back(dzEtaBiases.getWeightedMean() + 2 * dzEtaBiases.getWeightedRMS())
926  : ret.m_dzEtaHi[LegLabels[j]].push_back(dzEtaBiases.getMax());
927 
928  // unrolled histograms
929  ret.m_dxyVect[LegLabels[j]].push_back(getUnrolledHisto(dxyIntegralTrend[j]));
930  ret.m_dzVect[LegLabels[j]].push_back(getUnrolledHisto(dzIntegralTrend[j]));
931  }
932 
933  if (!areAllFilesOK) {
934  // do all the necessary deletions
935  logWarning << "====> not all files are OK" << std::endl;
936 
937  for (int i = 0; i < lastOpen; i++) {
938  fins[i]->Close();
939  }
940  continue;
941  } else {
942  ret.m_runs.push_back(intersection.at(n));
943  }
944 
945  if (VERBOSE) {
946  logInfo << "I am still here - runs.size(): " << ret.m_runs.size() << std::endl;
947  }
948 
949  // do all the necessary deletions
950 
951  for (int i = 0; i < nDirs_; i++) {
952  delete dxyPhiMeanTrend[i];
953  delete dzPhiMeanTrend[i];
954  delete dxyEtaMeanTrend[i];
955  delete dzEtaMeanTrend[i];
956 
957  delete dxyPhiWidthTrend[i];
958  delete dzPhiWidthTrend[i];
959  delete dxyEtaWidthTrend[i];
960  delete dzEtaWidthTrend[i];
961 
962  delete dxyNormPhiWidthTrend[i];
963  delete dxyNormEtaWidthTrend[i];
964  delete dzNormPhiWidthTrend[i];
965  delete dzNormEtaWidthTrend[i];
966 
967  delete dxyNormPtWidthTrend[i];
968  delete dzNormPtWidthTrend[i];
969  delete dxyPtWidthTrend[i];
970  delete dzPtWidthTrend[i];
971 
972  fins[i]->Close();
973  }
974 
975  if (VERBOSE) {
976  logInfo << std::endl;
977  }
978  }
979 
980  return ret;
981 }
Structure outPVtrends Contains the ensemble of all the alignmentTrends built by the functor...
Definition: OutPVtrends.h:88
#define VERBOSE
ret
prodAgent to be discontinued
#define logInfo
static unrolledHisto getUnrolledHisto(TH1F *hist)
static int position[264][3]
Definition: ReadPGInfo.cc:289
static pv::biases getBiases(TH1F *hist)
#define logWarning
#define logError
T * Get(Args... args)
Definition: Trend.h:122

◆ setDirsAndLabels()

void PreparePVTrends::setDirsAndLabels ( boost::property_tree::ptree &  json)

Definition at line 11 of file PreparePVTrends.cc.

References DirList, LabelList, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PreparePVTrends().

11  {
12  DirList.clear();
13  LabelList.clear();
14  for (const auto &childTree : json) {
15  DirList.push_back(childTree.first.c_str());
16  LabelList.push_back(childTree.second.get<std::string>("title"));
17  }
18 }
std::vector< std::string > LabelList
nlohmann::json json
std::vector< std::string > DirList

Member Data Documentation

◆ DirList

std::vector<std::string> PreparePVTrends::DirList
private

Definition at line 287 of file PreparePVTrends.h.

Referenced by multiRunPVValidation(), and setDirsAndLabels().

◆ LabelList

std::vector<std::string> PreparePVTrends::LabelList
private

Definition at line 288 of file PreparePVTrends.h.

Referenced by multiRunPVValidation(), and setDirsAndLabels().

◆ nWorkers_

const size_t PreparePVTrends::nWorkers_
private

Definition at line 286 of file PreparePVTrends.h.

Referenced by multiRunPVValidation().

◆ outputFileName_

const char* PreparePVTrends::outputFileName_
private

Definition at line 285 of file PreparePVTrends.h.

Referenced by multiRunPVValidation().