5 #ifndef dqutilsMonitoringFile_h
6 #define dqutilsMonitoringFile_h
13 #include "RooRealVar.h"
57 inline MetaData(
const std::string& name_,
const std::string& interval_,
const std::string& chain_,
58 const std::string& merge_)
74 const std::string&
chain,
75 const std::string&
merge);
77 void makeBranch(
const char* branchName,
const char* branchstr);
88 typedef std::map< std::string, TDirectory* >
DirMap_t;
100 std::map< TFile*, std::string >* prefixes = 0);
102 static void fillMetaDataMap(std::map<std::string, dqutils::MonitoringFile::MetaData>& mdMap, TDirectory*
dir);
108 static void merge_effAsPerCent(TH2&
a,
const TH2&
b);
110 static void merge_perBinEffPerCent(TH1&
a,
const TH1&
b);
112 static void merge_effAsPerCentAlt(TH1&
a,
const TH1&
b);
114 static void merge_weightedAverage(TH1&
a,
const TH1&
b);
116 static void merge_weightedAverage2D(TH2&
a,
const TH2&
b);
118 static void merge_weightedEff(TH1&
a,
const TH1&
b);
120 static void merge_Rebinned(TH1&
a, TH1&
b);
122 static void merge_eventSample(TH2&
a,
const TH2&
b);
124 static void merge_RMS(TH1&
a,
const TH1&
b);
126 static void merge_RMSpercentDeviation(TH1&
a,
const TH1&
b);
128 static void merge_lowerLB(TH1&
a,
const TH1&
b);
130 static void merge_identical(TH1&
a,
const TH1&
b);
140 static void fitMergedFile_IDAlignMonResiduals(TFile*
f,
const std::string& run_dir,
const std::string& TriggerName);
141 static void fitMergedFile_IDAlignMonTrackSegments(TFile*
file,
const std::string& run_dir,
142 const std::string& tracksName);
143 static void fitMergedFile_IDAlignMonGenericTracks(TFile*
file,
const std::string& run_dir,
144 const std::string& tracksName);
145 static void fitMergedFile_IDAlignMonPVbiases(TFile*
file,
const std::string& run_dir,
146 const std::string& tracksName);
147 static void fitMergedFile_IDPerfMonKshort(TFile*
f,
const std::string& run_dir,
const std::string& TriggerName);
148 static void fitMergedFile_IDPerfMonJpsi(TFile*
f,
const std::string& run_dir,
149 const std::string& TriggerName);
150 static void fitMergedFile_IDPerfMonUpsilon(TFile*
f,
const std::string& run_dir,
151 const std::string& TriggerName);
152 static void fitMergedFile_IDPerfMonZee(TFile*
f,
const std::string& run_dir,
const std::string& TriggerName);
153 static void fitMergedFile_IDPerfMonWenu(TFile*
f,
const std::string& run_dir,
const std::string& TriggerName);
154 static void fitMergedFile_IDPerfMonZMM(TFile*
f,
const std::string& run_dir,
const std::string& TriggerName);
155 static void fitJpsiHistograms(
TH1F* hmass,
TH1F* hwidth,
TH1F*
h1[],
int n);
156 static void fitUpsilonHistograms(
TH1F* hmass,
TH1F* hwidth,
TH1F*
h1[],
int n);
157 static void fitZmumuMassPlot(
TH1F* hmass);
158 static std::pair<RooRealVar, RooRealVar> fitZmumuMass(
TH1F* hmass);
159 static void fitZmumuHistograms(
TH1F* hmass,
TH1F* hwidth, std::vector<TH1F*> hvec);
160 static void processModule(TFile*
f,
const std::string& run_dir, TKey* key_module,
const std::string& moduleName);
161 static void fitMergedFile_DiMuMonAll(TFile*
f,
const std::string& run_dir,
const std::string& resonName,
162 const std::string& triggerName);
163 static void fitHistos(
TH2F* hin,
const std::vector<TH1F*>& hout,
int mode,
const std::string& triggerName,
164 const std::string& resonName,
TH1F* m_chi2);
165 static void fillGaussianMeanOrWidth(
TH2F* h2d,
TH1F*
h,
float fitMin,
float fitMax,
int iopt);
166 static void fillMeanOrWidth(
TH2F* h2d,
TH1F*
h,
int iopt);
167 static void fillDetPaperMeanRMS(
TH2F* h2d,
TH1F*
h,
int iopt);
169 static void meanRMSProjections2D(
TH2F* h2d,
TH1F*
h,
int iopt);
170 static void meanRMSProjections3D(TH3F* h3d,
TH2F*
h,
int iopt);
171 static void meanRMSProjections3D_DMRPlot(TH3F* h3d,
TH1F*
h,
int iopt);
172 static void meanRMSProjections3D_XY(TH3F* h3d,
TH1F*
h,
int iXY,
int iopt);
174 static void setMinWindow(TH1*
h1,
float min,
float max);
175 static float getMedian(TH1*
h1);
176 static void ProcessAsymHistograms(
TH1F* m_neg,
TH1F* m_pos,
TH1F* m_asym);
177 static void Make1DProfile(TH1*
output, TH2*
histo);
178 static void MakeMap(TH2* outputhist, TH3*
hist);
179 static int IterativeGaussFit(TH1*
hist,
double&
mu,
double& mu_err,
double&
sigma,
double& sigma_err);
186 static void RPCPostProcess(
const std::string& inFilename,
bool isIncremental =
false);
187 static bool RPCCheckHistogram(TFile*
f,
const char* HistoName);
190 static void TGCPostProcess(
const std::string& inFilename,
bool isIncremental =
false);
191 static void TGCChannelOccupancy(
const std::string& inFilename, std::vector< std::pair< std::string, float > >&
p);
192 static void TGCChamberOccupancy(
const std::string& inFilename, std::vector< std::pair< std::string,
194 std::vector< std::pair< std::string, float > >& plow);
195 static void TGCChamberEfficiency(
const std::string& inFilename, std::vector< std::pair< std::string, float > >&
p);
196 static void TGCChamberTiming(
const std::string& inFilename, std::vector< std::pair< std::string, float > >& pro,
197 std::vector< std::pair< std::string, float > >& ptrg);
199 static void TGCsubsectbin2stationeta(
int subsect,
int bin,
int& station,
int& eta);
200 static void TGCsubsect2sectorphi(
int subsect,
int& sector,
int& phi4);
201 static void TGCRawHistogramDivision(
const std::string& inFilename);
202 static void TGCLV1HistogramDivision(
const std::string& inFilename);
203 static int nTGCWireStripMap(
int ws,
int etac,
int phi48);
204 static int getTGCNumberOfWires(
const int istationName,
const int layer,
const int istationEta,
205 const int istationPhi);
206 static void TGCResetContents(TH1*
h);
209 static void MDTvsTGCPostProcess(
const std::string& inFilename,
bool isIncremental =
false);
210 static void MDTvsTGCEfficiency(
const std::string& inFilename);
211 static void MDTvsTGCResetContents(TH1*
h);
224 void get(
const char* namecycle, T*&
ptr, TDirectory* baseDir = 0, TDirectory*
target = 0);
228 void setDirectory(TH1*
h, TDirectory*
dir = 0);
229 void setDirectory(TH2*
h, TDirectory*
dir = 0);
230 void setDirectory(TGraph*
g, TDirectory*
dir = 0);
231 void setMetaData(TDirectory* targetDir, TH1*
h1, TH1* h2 = 0, TH1* h3 = 0);
240 static bool TGCCheckHistogram(TFile*
f, TString&
hname);
241 static void TGCSetMetaData(TDirectory* targetDir, TH1*
h1, TH1* h2 = 0, TH1* h3 = 0);
244 static void HLTMuonPostProcess(
const std::string& inFilename,
bool isIncremental =
false);
245 static void HLTMuonHistogramDivision(
const std::string& inFilename, TString& run_dir);
246 static void HLTMuonTriggerOverlapMatrix(
const std::string& inFilename, TString& run_dir);
247 static bool HLTMuonCheckHistogram(TFile*
f, TString&
hname);
248 static void HLTMuonHDiv(PostProcessorFileWrapper&
mf, TString sdir, TString snum, TString sden, TString seff,
252 static void HLTEgammaPostProcess(
const std::string& inFilename,
bool isIncremental =
false);
254 static void HLTEgammaEfficiencyOff(TFile*
f, TDirectory* trig_dir, TDirectory* off_dir,
const TString& pathNum,
255 const TString& pathEff,
const std::vector<TString>&
varName);
256 static void HLTEgammaEfficiencyRel(TFile*
f, TDirectory* trig_dir,
const TString& pathPre,
const TString& pathRej,
257 const std::vector<TString>& objStage,
const std::vector<TString>&
varName);
260 static void HLTTauPostProcess(
const std::string& inFilename,
bool isIncremental =
false);
262 static void HLTTauPostProcess(TFile*
f, TDirectory*
dir,
263 TString pathApp, TString pathAppEff,
264 const std::vector<TString>& lvlN,
const std::vector<TString>& varN,
265 const std::vector< std::pair< int, int > >& ratioIndex,
int nameStyle,
266 TString nameApp =
"");
272 static void HLTMETAveragePhivsEtaMaps(TFile*
f, TString& run_dir);
273 static size_t HLTMETGetDQLBNRange(TDirectory*& run_dir, std::vector<TString>& lbnDirs);
274 static int HLTMETGetStatusPerBin(TH1I*&
hist,
int ymin,
int ymax,
int rmin,
int rmax);
275 static void HLTMETDQFlagSummary(TFile*
f, TString& run_dir);
279 static void HLTCaloAveragePtPhiEtaMaps(TFile*
f, TString& run_dir);
283 static void HLTJetCalcEfficiencyAndRate(TFile*
f, TString& run_dir);
287 static void BJetTaggingAdjustRanges(TFile*
f);
288 static void BJetTaggingNormalise(TFile*
f);
292 static void HLTMinBiasMonGetTargetHistos(TDirectory*
source,
293 std::vector< std::pair<TString, TString> >& targetNames);
296 static void pv_PrimaryVertexMonitoring_calcResoAndEfficiency(
const std::string& inFilename,
300 static void VxMon_move(
const std::string& inFilename,
bool isIncremental =
false);
304 static void L1CaloStabilityRMS(TFile*
f,
const TString&
nameDir,
const TString& nameTag);
305 static void L1CaloFillWithError(TFile*
f,
const TString&
nameDir,
const TString& nameData,
306 const TString& nameError);
307 static void L1CaloResetEfficiencies(TFile*
f,
const TString& effDir,
308 const TString& nameDen,
const TString& nameEff,
312 static void PixelPostProcess(
const std::string& inFilename,
bool isIncremental =
false);
316 static int ComputeUPXBinErrors(
TH1F* hnum,
TH1F* hden, std::vector<float>&
errors);
336 const std::string& dirName =
"all");
344 virtual std::string
FindCommon(
const std::string&
name1,
const std::string& name2)
const;
373 TDirectory* m_target {};
375 TTree* m_metadata {};
387 int m_nHist1DBins {};
389 int m_nGraphPoints {};
391 int m_nHist2DBins {};
392 int m_nEfficiency {};
393 int m_nEfficiencyBins {};
417 const std::string& listFileName);
430 const std::vector<int>&,
431 TDirectory*,
const std::string&,
432 std::unique_ptr<TObject>&);
443 static Int_t getNumBins(
const TH1&
hist);
468 std::map< TFile*, std::string >* prefixes);
471 std::map< TFile*, std::string >* prefixes);
474 std::string >* prefixes);
479 if (baseDir) baseDir->GetObject(namecycle,
ptr);
480 else this->GetObject(namecycle,
ptr);
483 if ((T::Class())->InheritsFrom(
"TH1")) {
484 TH1*
obj =
reinterpret_cast<TH1*
> (
ptr);
489 TObject*
obj =
reinterpret_cast<TObject*
>(
ptr);