ATLAS Offline Software
Loading...
Searching...
No Matches
dqutils Namespace Reference

Classes

class  CoolMdt
class  CoolRpc
class  CoolTgc
class  HanOutputFile
class  HistogramDataCOOL
class  MonitoringFile
class  StatusFlagCommentCOOL
class  StatusFlagCOOL
class  StatusFlagCOOLBase

Typedefs

typedef std::map< std::string, std::vector< int > > keycyclemap
typedef std::map< std::string, std::set< std::string > > fileLBMap_t

Enumerations

enum  debugLevel_t { none = 0 , DEBUG , VERBOSE }

Functions

void populateKeyMapping (TDirectory *, keycyclemap &)
std::string getInputDirectory (const std::string &outputDirName, TFile *input, bool has_multiple_runs, std::map< TFile *, std::string > *prefixes)
void getImageBuffer ATLAS_NOT_THREAD_SAFE (TImage **img, TCanvas *myC, char **x, int *y)
void plotResolution (const TString &coordinate, const TString &versus)
void plotEfficiency ()
double error_func (float x, const Double_t *par)
double scaleFactorFitFcn (double *x, double *par)
std::vector< float > stableGaussianFit (TH1 *histo)
int updateHists (const std::string &inFileName, const std::string &inStem, const std::string &outFileName="", const std::string &outStem="")
bool makeDirectories (const std::string &dirName)
bool makeDir (const std::string &dirName)
void Copy (TFile *source, TFile *target, const std::string &inDir, const std::string &outDir, const std::string &inHist="", const std::string &outHist="")
void CopyHist (TFile *source, TFile *target, const std::string &inDir, const std::string &outDir, const std::string &inHist, const std::string &outHist)

Variables

std::vector< int > root_color_choices
static const bool fdbg = true
static const bool fpdbg = false
std::atomic< int > padding = 0
static const bool rno_debug = false
static const float TGCChamberLowOccupancyCut = 1.0e-6
static const float TGCChamberHighOccupancyCut = 0.005
static const float TGCChannelOccupancyCut = 0.01
static const float TGCChamberEfficiencyCut = 0.7
static const float TGCChamberTimingCut = 0.95
static const bool tgc_debug = false

Typedef Documentation

◆ fileLBMap_t

typedef std::map<std::string, std::set<std::string> > dqutils::fileLBMap_t

Definition at line 53 of file MonitoringFile.h.

◆ keycyclemap

typedef std::map<std::string, std::vector<int> > dqutils::keycyclemap

Definition at line 52 of file MonitoringFile.h.

Enumeration Type Documentation

◆ debugLevel_t

Enumerator
none 
DEBUG 
VERBOSE 

Definition at line 56 of file MonitoringFile.h.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

void getImageBuffer dqutils::ATLAS_NOT_THREAD_SAFE ( TImage ** img,
TCanvas * myC,
char ** x,
int * y )

Definition at line 1129 of file HanOutputFile.cxx.

1129 {
1130 gVirtualPS->Open(myC->GetName(), 114);
1131 myC->Paint();
1132 auto pImgDump = dynamic_cast<TImageDump*>(gVirtualPS);
1133 if (pImgDump) {
1134 (*img) = pImgDump->GetImage();
1135 if (*img) {
1136 (*img)->GetImageBuffer(x, y, TImage::kPng);
1137 }
1138 }
1139 }
#define y
#define x

◆ Copy()

void dqutils::Copy ( TFile * source,
TFile * target,
const std::string & inDir,
const std::string & outDir,
const std::string & inHist = "",
const std::string & outHist = "" )

Definition at line 253 of file MonitoringFile_MoveVertexMonitoring.cxx.

254 {
255 padding += 3;
256
257 if (!inHist.empty()) {
258 CopyHist(source, target, inDir, outDir, inHist, outHist);
259 } else {
260 TDirectory* sourceDir = source->GetDirectory(inDir.c_str());
261 TDirectory* targetDir = target->GetDirectory(outDir.c_str());
262
263 TIter nextKey(sourceDir->GetListOfKeys());
264
265 TKey* key;
266 while ((key = (TKey*) nextKey())) {
267 std::string keyName = key->GetName();
268 std::string className(key->GetClassName());
269
270 if (className == "TDirectoryFile") {
271 std::string newInDir = inDir;
272 newInDir += '/';
273 newInDir += keyName;
274
275 std::string newOutDir = outDir;
276 newOutDir += '/';
277 newOutDir += keyName;
278
279 if (!targetDir->FindKey(keyName.c_str())) {
280 /*
281 std::cout << std::setw(padding) << " ";
282 std::cout << "creating Dir " << newOutDir << std::endl;
283 */
284 targetDir->mkdir(keyName.c_str());
285 }
286 /*
287 std::cout << std::setw(padding) << " ";
288 std::cout << "moving to " << newInDir << ", a " << className << std::endl;
289 */
290 Copy(source, target, newInDir, newOutDir);
291 } else {
292 CopyHist(source, target, inDir, outDir, keyName, keyName);
293 }
294 }
295 }
296
297 padding -= 3;
298 }
void Copy(TFile *source, TFile *target, const std::string &inDir, const std::string &outDir, const std::string &inHist="", const std::string &outHist="")
void CopyHist(TFile *source, TFile *target, const std::string &inDir, const std::string &outDir, const std::string &inHist, const std::string &outHist)

◆ CopyHist()

void dqutils::CopyHist ( TFile * source,
TFile * target,
const std::string & inDir,
const std::string & outDir,
const std::string & inHist,
const std::string & outHist )

Definition at line 300 of file MonitoringFile_MoveVertexMonitoring.cxx.

301 {
302 TDirectory* sourceDir = source->GetDirectory(inDir.c_str());
303 TDirectory* targetDir = target->GetDirectory(outDir.c_str());
304
305 targetDir->cd();
306 TKey* key = sourceDir->FindKey(inHist.c_str());
307 TObject* object = key->ReadObj();
308 bool permission = true;
309
310 if (targetDir->FindKey(outHist.c_str())) permission = false;
311 if (permission) object->Write(outHist.c_str(), TObject::kOverwrite);
312 }

◆ error_func()

double dqutils::error_func ( float x,
const Double_t * par )

Definition at line 455 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

455 {
456//calculating the square of the propagated error on the fit values
457 return(TMath::Power(par[0], 2) + x * TMath::Power(par[1], 2) + TMath::Power(x * par[2], 2));
458 }

◆ getInputDirectory()

std::string dqutils::getInputDirectory ( const std::string & outputDirName,
TFile * input,
bool has_multiple_runs,
std::map< TFile *, std::string > * prefixes )

◆ makeDir()

bool dqutils::makeDir ( const std::string & dirName)

Definition at line 239 of file MonitoringFile_MoveVertexMonitoring.cxx.

239 {
240 padding += 3;
241 std::cout << std::setw(padding) << " ";
242
243 if (!gDirectory->FindKey(dirName.c_str())) {
244 gDirectory->mkdir(dirName.c_str());
245// std::cout << "makeDir=" << dirName << std::endl;
246 } else
247// std::cout << "object " << dirName << " already exists in directory " << gDirectory->GetName() <<
248// std::endl;
249 padding -= 3;
250 return gDirectory->cd(dirName.c_str());
251 }

◆ makeDirectories()

bool dqutils::makeDirectories ( const std::string & dirName)

Definition at line 221 of file MonitoringFile_MoveVertexMonitoring.cxx.

221 {
222 bool success = true;
223
224 if (!dirName.empty()) {
225 std::string::size_type firstSlash = dirName.find('/');
226 if (firstSlash == std::string::npos) {
227 success &= makeDir(dirName);
228 } else {
229 std::string subdir(dirName, 0, firstSlash);
230 if (!subdir.empty()) success &= makeDir(subdir);
231
232 std::string newSubdir(dirName, firstSlash + 1, dirName.size() - firstSlash);
233 success &= makeDirectories(newSubdir);
234 }
235 }
236 return success;
237 }
bool makeDirectories(const std::string &dirName)
bool makeDir(const std::string &dirName)

◆ plotEfficiency()

void dqutils::plotEfficiency ( )

Definition at line 379 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

379 {
380// cout << "Creating and writing histos for efficiency" << endl;
381
382 // get histos but return if any histo is not there in input
383 TH1F* h_Vrt_split_tag_ntrk = (TH1F*) gDirectory->Get("Vrt_split_tag_ntrk");
384
385 if (h_Vrt_split_tag_ntrk == 0) return;
386
387 TH1F* h_Vrt_split_probe_ntrk = (TH1F*) gDirectory->Get("Vrt_split_probe_ntrk");
388 if (h_Vrt_split_probe_ntrk == 0) return;
389
390 TH1F* h_Vrt_split_matched_tag_ntrk = (TH1F*) gDirectory->Get("Vrt_split_matched_tag_ntrk");
391 if (h_Vrt_split_matched_tag_ntrk == 0) return;
392
393 TH1F* h_Vrt_split_matched_probe_ntrk = (TH1F*) gDirectory->Get("Vrt_split_matched_probe_ntrk");
394 if (h_Vrt_split_matched_probe_ntrk == 0) return;
395
396 TH1F* h_Vrt_split_dist_tag = (TH1F*) gDirectory->Get("Vrt_split_dist_tag");
397 if (h_Vrt_split_dist_tag == 0) return;
398
399 TH1F* h_Vrt_split_dist_probe = (TH1F*) gDirectory->Get("Vrt_split_dist_probe");
400 if (h_Vrt_split_dist_probe == 0) return;
401
402 // Use BayesDivide routing of TGraphAsymmErrors
403 TGraphAsymmErrors* g_Vrt_rec_eff_m1_split_vs_ntrk = new TGraphAsymmErrors();
404
405 g_Vrt_rec_eff_m1_split_vs_ntrk->BayesDivide(h_Vrt_split_probe_ntrk, h_Vrt_split_tag_ntrk);
406 g_Vrt_rec_eff_m1_split_vs_ntrk->SetName("g_RecEff_M1");
407
408 TGraphAsymmErrors* g_Vrt_sel_eff_m1_split_vs_ntrk = new TGraphAsymmErrors();
409 g_Vrt_sel_eff_m1_split_vs_ntrk->BayesDivide(h_Vrt_split_matched_probe_ntrk, h_Vrt_split_matched_tag_ntrk);
410 g_Vrt_sel_eff_m1_split_vs_ntrk->SetName("g_SelEff_M1");
411
412 // formatting and writing out
413 g_Vrt_rec_eff_m1_split_vs_ntrk->GetHistogram()->GetXaxis()->SetTitle("Number of tracks");
414 g_Vrt_rec_eff_m1_split_vs_ntrk->GetHistogram()->GetYaxis()->SetTitle("Reconstruction efficiency");
415 g_Vrt_rec_eff_m1_split_vs_ntrk->SetMarkerStyle(20);
416 g_Vrt_rec_eff_m1_split_vs_ntrk->Write("", TObject::kOverwrite);
417 delete g_Vrt_rec_eff_m1_split_vs_ntrk;
418
419 g_Vrt_sel_eff_m1_split_vs_ntrk->GetHistogram()->GetXaxis()->SetTitle("Number of tracks");
420 g_Vrt_sel_eff_m1_split_vs_ntrk->GetHistogram()->GetYaxis()->SetTitle("Selection Efficiency");
421 g_Vrt_sel_eff_m1_split_vs_ntrk->SetMarkerStyle(20);
422 g_Vrt_sel_eff_m1_split_vs_ntrk->Write("", TObject::kOverwrite);
423 delete g_Vrt_sel_eff_m1_split_vs_ntrk;
424
425 return;
426 }

◆ plotResolution()

void dqutils::plotResolution ( const TString & coordinate = "Z",
const TString & versus = "Ntrk" )

Definition at line 107 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

107 {
108// cout << "Creating and writing histos for resolution " << coordinate << " versus " << versus << endl;
109
110 TH2F* h_Vrt_pullVsSomething_split(0);
111 TH2F* h_Vrt_err_vs_Something(0);
112// TH2F* h_Vrt_Tag_err_vs_Something(0);
113 TString xAxisLabel("");
114
115 if (versus == "Ntrk") {
116 h_Vrt_pullVsSomething_split = (TH2F*) gDirectory->Get("Vrt_" + coordinate + "pullVsNtrkAverage_split");
117 h_Vrt_err_vs_Something = (TH2F*) gDirectory->Get("Vrt_" + coordinate + "err_vs_ntrk");
118// h_Vrt_Tag_err_vs_Something = (TH2F*)gDirectory->Get("Vrt_Tag_"+coordinate+"err_vs_ntrk");
119 xAxisLabel = "Number of fitted tracks";
120 } else if (versus == "SumPt2") {
121 h_Vrt_pullVsSomething_split = (TH2F*) gDirectory->Get("Vrt_" + coordinate + "pullVsPt2Average_split");
122 h_Vrt_err_vs_Something = (TH2F*) gDirectory->Get("Vrt_" + coordinate + "err_vs_pt2");
123// h_Vrt_Tag_err_vs_Something = (TH2F*)gDirectory->Get("Vrt_Tag_"+coordinate+"err_vs_pt2");
124 xAxisLabel = "#sqrt{#sum p_{T}^{2}} [GeV]";
125 } else return;
126
127 //if (h_Vrt_pullVsSomething_split == 0) std::cout << "h_Vrt_pullVsSomething_split has zero pointer!" << std::endl;
128 //if (h_Vrt_err_vs_Something == 0) std::cout << "h_Vrt_err_vs_Something has zero pointer!" << std::endl;
129 if (h_Vrt_pullVsSomething_split == 0 or h_Vrt_err_vs_Something == 0) return;
130
131 int n_bins = h_Vrt_pullVsSomething_split->GetNbinsX();
132 std::vector<float> rms_z;
133 std::vector<float> rms_z_er;
134 std::vector<float> sigma_z;
135 std::vector<float> sigma_z_er;
136 std::vector<float> bins_z_nt;
137 std::vector<float> bins_z_nt_er;
138
139// root starts counting the bins at 1, i.e. bin 1 holds NTrk = 0. or sqrt(sumpt2) = 0. - 0.25. GeV
140// std::cout << "n bins: " << n_bins << "\tTotal entries: " << h_Vrt_pullVsSomething_split->GetEntries() << std::endl;
141// TH1D * nTrksPerVertex = h_Vrt_pullVsSomething_split->ProjectionX("projectionNTrks_"+coordinate+"_"+versus);
142
143// TH1D * profileZFull = h_Vrt_pullVsSomething_split->ProjectionY("projectionPullsFull_"+coordinate+"_"+versus);
144
145 Int_t startBin = 0;
146 TH1D* profileZ = 0;
147 const Int_t minEntriesForKFactorBin = 1000;
148 for (int bin_count = 1; bin_count < n_bins + 1; bin_count++) {
149 //Fixed binning
150// TH1D *profileZ = h_Vrt_pullVsSomething_split->ProjectionY("projectionPulls", bin_count, bin_count,"e");
151// Double_t binCenter = h_Vrt_pullVsSomething_split->GetXaxis()->GetBinCenter(bin_count);
152// Double_t binWidth = h_Vrt_pullVsSomething_split->GetXaxis()->GetBinWidth(bin_count)/2.;
153
154 //Variable binning
155 TH1D* profileZTmp = h_Vrt_pullVsSomething_split->ProjectionY("projectionPulls", bin_count, bin_count, "e");
156 //cout << "Bin: " << bin_count << ", Entries: " << profileZTmp->GetEntries() << endl;
157 if (profileZ == 0) {
158 startBin = bin_count;
159 profileZ = (TH1D*) profileZTmp->Clone("projectionPulls_Integrated");
160 //cout << "StartBin = " << startBin << endl;
161 } else {
162 profileZ->Add(profileZTmp);
163 }
164 delete profileZTmp;
165 profileZTmp = 0;
166 if ((profileZ->GetEntries() < minEntriesForKFactorBin) && (bin_count < n_bins)) //not enough entries, not last bin
167 continue;
168
169 Double_t lowEdge = h_Vrt_pullVsSomething_split->GetXaxis()->GetBinLowEdge(startBin);
170 Double_t highEdge = h_Vrt_pullVsSomething_split->GetXaxis()->GetBinLowEdge(bin_count) +
171 h_Vrt_pullVsSomething_split->GetXaxis()->GetBinWidth(bin_count);
172 Double_t binCenter = (lowEdge + highEdge) / 2;
173 Double_t binWidth = (highEdge - lowEdge) / 2; //half of the bin width
174 //cout << "Bin done: " << binCenter << " +/- " << binWidth << ", Entries: " << profileZ->GetEntries() << endl;
175 // variable binning end
176
177 bins_z_nt.push_back(binCenter);
178 bins_z_nt_er.push_back(binWidth); // dummy error of binwidth for now
179
180 rms_z.push_back(profileZ->GetRMS());
181 rms_z_er.push_back(profileZ->GetRMSError());
182
183 //making a gaussian fit if there is anough entries
184 if (profileZ->GetEntries() > 100.) {
185 std::vector<float> fit_res = stableGaussianFit(profileZ);
186 sigma_z.push_back(fit_res[0]);
187 sigma_z_er.push_back(fit_res[1]);
188 } else {
189 sigma_z.push_back(0.);
190 sigma_z_er.push_back(0.);
191 }//end of good number of bins selection
192
193 delete profileZ; // must keep this to delete the projection from memory (next one has same name!)
194 profileZ = 0;
195 }//end of loop over all the ntrk bins
196
197 TGraphErrors* krms_z_vs_ntrk = new TGraphErrors(
198 bins_z_nt.size(), &(bins_z_nt[0]), &(rms_z[0]), &(bins_z_nt_er[0]), &(rms_z_er[0]));
199 krms_z_vs_ntrk->GetYaxis()->SetTitle(coordinate + " scale factor from RMS");
200 krms_z_vs_ntrk->GetXaxis()->SetTitle(xAxisLabel);
201 krms_z_vs_ntrk->SetTitle("scaleFactor" + coordinate + "_RMS");
202 krms_z_vs_ntrk->SetName("scaleFactor" + coordinate + "_" + versus + "_RMS");
203
204 TGraphErrors* kgs_z_vs_ntrk = new TGraphErrors(
205 bins_z_nt.size(), &(bins_z_nt[0]), &(sigma_z[0]), &(bins_z_nt_er[0]), &(sigma_z_er[0]));
206 kgs_z_vs_ntrk->GetYaxis()->SetTitle(coordinate + " scale factor from gauss fit");
207 kgs_z_vs_ntrk->GetXaxis()->SetTitle(xAxisLabel);
208 kgs_z_vs_ntrk->SetTitle("scaleFactor" + coordinate + "_Fit");
209 kgs_z_vs_ntrk->SetName("scaleFactor_" + coordinate + "_" + versus + "_Fit");
210
211// approximating the graph with 2nd order polynomial.
212 float maxFitRange(100.);
213 float minFitRange(2.);
214 if (versus == "SumPt2") {
215 minFitRange = 0.5;
216 maxFitRange = 20.;
217 }
218 TF1* kgs_z_ntrk_fit;
219 const Double_t* kgs_z_ntrk_fit_er;
220 int fitResKFactorMethod = 2; // set by hand for now
221 if (fitResKFactorMethod == 1) {
222 //Fit with a pol2
223 //coverity[DEADCODE]
224 kgs_z_vs_ntrk->Fit("pol2", "Q", "", minFitRange, maxFitRange);
225 kgs_z_vs_ntrk->GetFunction("pol2")->SetLineColor(kRed);
226 kgs_z_ntrk_fit = kgs_z_vs_ntrk->GetFunction("pol2");
227 kgs_z_ntrk_fit_er = kgs_z_ntrk_fit->GetParErrors();
228 } else if (fitResKFactorMethod == 2) {
229 //Fit with a pol1
230 kgs_z_vs_ntrk->Fit("pol1", "Q", "", minFitRange, maxFitRange);
231 kgs_z_vs_ntrk->GetFunction("pol1")->SetLineColor(kRed);
232 kgs_z_ntrk_fit = kgs_z_vs_ntrk->GetFunction("pol1");
233 kgs_z_ntrk_fit_er = kgs_z_ntrk_fit->GetParErrors();
234 //coverity[DEADCODE]
235 } else if (fitResKFactorMethod == 3) {
236 TF1* kgsFitFcn = new TF1("kgsFitFcn", scaleFactorFitFcn, minFitRange, maxFitRange, 3);
237 kgsFitFcn->SetParameter(0, minFitRange);
238 kgsFitFcn->SetParameter(1, 1.0);
239 kgsFitFcn->SetParameter(2, 1.0);
240 for (int ifit = 0; ifit < 1; ifit++) //initial estimation of best parameters
241 kgs_z_vs_ntrk->Fit(kgsFitFcn, "Q");
242 kgs_z_vs_ntrk->Fit(kgsFitFcn, "Q"); //perform actual fit
243 kgs_z_ntrk_fit = kgsFitFcn;
244 kgs_z_ntrk_fit_er = kgsFitFcn->GetParErrors();
245/* cout << "ScaleFactor fit for " << coordinate << " vs " << versus << " (method " << fitResKFactorMethod << ")= "
246 << kgsFitFcn->GetParameter(0) << " +/- " << kgsFitFcn->GetParError(0) << " "
247 << kgsFitFcn->GetParameter(1) << " +/- " << kgsFitFcn->GetParError(1) << " "
248 << kgsFitFcn->GetParameter(2) << " +/- " << kgsFitFcn->GetParError(2) << endl; */
249 } else if (fitResKFactorMethod == 4) {
250 //constant fit
251 kgs_z_vs_ntrk->Fit("pol0", "Q", "", minFitRange, maxFitRange);
252 kgs_z_vs_ntrk->GetFunction("pol0")->SetLineColor(kRed);
253 kgs_z_ntrk_fit = kgs_z_vs_ntrk->GetFunction("pol0");
254 kgs_z_ntrk_fit_er = kgs_z_ntrk_fit->GetParErrors();
255/* cout << "ScaleFactor fit for " << coordinate << " vs " << versus << " (method " << fitResKFactorMethod << ")= "
256 << kgs_z_ntrk_fit->GetParameter(0) << " +/- " << kgs_z_ntrk_fit->GetParError(0) << endl; */
257 }
258
259// plotting the fit error of the unconstrained primary vertex and correcting them
260 int nbins_z_err_ntrk = h_Vrt_err_vs_Something->GetNbinsX();
261
262 std::vector<float> av_err_z;
263 std::vector<float> av_err_z_er;
264// std::vector<float> av_err_tag_z;
265// std::vector<float> av_err_tag_z_er;
266 std::vector<float> err_bins_z_nt;
267 std::vector<float> err_bins_z_nt_er;
268 std::vector<float> res_z;
269 std::vector<float> res_z_er;
270// std::vector<float> res_tag_z;
271// std::vector<float> res_tag_z_er;
272
273 for (int bin_count = 1; bin_count <= nbins_z_err_ntrk; ++bin_count) {
274 err_bins_z_nt.push_back(h_Vrt_err_vs_Something->GetXaxis()->GetBinCenter(bin_count));
275 err_bins_z_nt_er.push_back(h_Vrt_err_vs_Something->GetXaxis()->GetBinWidth(bin_count) / 2.);
276
277 TH1D* profileY = h_Vrt_err_vs_Something->ProjectionY("projectionErrors", bin_count, bin_count, "e");
278// TH1D * profileYTag(0);
279// if (h_Vrt_Tag_err_vs_Something)
280// profileYTag = h_Vrt_Tag_err_vs_Something->ProjectionY("projectionErrorsTag",bin_count,bin_count,"e");
281
282 float mean = profileY->GetMean();
283 float mean_error = profileY->GetMeanError();
284// float meanTag(0);
285// float mean_errorTag(0);
286// if (profileYTag) {
287// meanTag = profileYTag->GetMean();
288// mean_errorTag = profileYTag->GetMeanError();
289// }
290 delete profileY;
291// delete profileYTag;
292
293 av_err_z.push_back(mean);
294 av_err_z_er.push_back(mean_error);
295// av_err_tag_z.push_back(meanTag);
296// av_err_tag_z_er.push_back(mean_errorTag);
297
298 //estimating the approximate k-factor and the error value
299 double pr_er = 0.0;
300 float val(0.);
301 if (fitResKFactorMethod == 1) {
302 //coverity[DEADCODE]
303 pr_er = error_func(bin_count, kgs_z_ntrk_fit_er);
304 } else if (fitResKFactorMethod == 2) {
305 val = h_Vrt_err_vs_Something->GetXaxis()->GetBinCenter(bin_count);
306 pr_er = TMath::Power(kgs_z_ntrk_fit_er[1] * val, 2) + TMath::Power(kgs_z_ntrk_fit_er[0], 2);
307 pr_er = TMath::Sqrt(pr_er);
308// cout << "val = " << val << ", pr_er = " << pr_er << ", p0er = " << kgs_z_ntrk_fit_er[0] << ", p1er = "<<
309// kgs_z_ntrk_fit_er[1] << endl;
310 //coverity[DEADCODE]
311 } else if (fitResKFactorMethod == 3) {
312 val = h_Vrt_err_vs_Something->GetXaxis()->GetBinCenter(bin_count);
313 //approximately the error on the plateau
314 pr_er = kgs_z_ntrk_fit_er[2];
315 } else if (fitResKFactorMethod == 4) {
316 pr_er = kgs_z_ntrk_fit_er[0];
317 }
318
319 res_z.push_back(mean * kgs_z_ntrk_fit->Eval(h_Vrt_err_vs_Something->GetXaxis()->GetBinCenter(bin_count)));
320 res_z_er.push_back(TMath::Sqrt(TMath::Power(mean_error *
321 kgs_z_ntrk_fit->Eval(h_Vrt_err_vs_Something->GetXaxis()->GetBinCenter(
322 bin_count)),
323 2) + TMath::Power(pr_er * mean, 2)));
324// res_tag_z.push_back(meanTag * kgs_z_ntrk_fit->Eval(h_Vrt_err_vs_Something->GetXaxis()->GetBinCenter(bin_count)));
325// res_tag_z_er.push_back(TMath::Sqrt(TMath::Power(mean_errorTag *
326// kgs_z_ntrk_fit->Eval(h_Vrt_err_vs_Something->GetXaxis()->GetBinCenter(bin_count)),2) + TMath::Power( pr_er * mean
327// ,2)));
328 }
329 TGraphErrors* res_z_vs_ntrk =
330 new TGraphErrors(err_bins_z_nt.size(), &(err_bins_z_nt[0]), &(res_z[0]), &(err_bins_z_nt_er[0]), &(res_z_er[0]));
331 res_z_vs_ntrk->GetYaxis()->SetTitle(coordinate + " Vertex Resolution [mm]");
332 res_z_vs_ntrk->GetXaxis()->SetTitle(xAxisLabel);
333 res_z_vs_ntrk->SetTitle(coordinate + " Vertex Resolution");
334 res_z_vs_ntrk->SetName("resolution_" + coordinate + "_" + versus);
335
336// TGraphErrors * res_tag_z_vs_ntrk = new TGraphErrors(err_bins_z_nt.size(),
337// &(err_bins_z_nt[0]),&(res_tag_z[0]),&(err_bins_z_nt_er[0]), &(res_tag_z_er[0]) );
338// res_tag_z_vs_ntrk->GetYaxis()->SetTitle(coordinate+" Tagged Vertex Resolution [mm]");
339// res_tag_z_vs_ntrk->GetXaxis()->SetTitle(xAxisLabel);
340// res_tag_z_vs_ntrk->SetTitle(coordinate+" Tagged Vertex Resolution");
341// res_tag_z_vs_ntrk->SetName("resolution_tag_"+coordinate+"_"+versus);
342
343// TGraphErrors * mean_err_z_vs_ntrk = new TGraphErrors(err_bins_z_nt.size(),
344// &(err_bins_z_nt[0]),&(av_err_z[0]),&(err_bins_z_nt_er[0]), &(av_err_z_er[0]) );
345// mean_err_z_vs_ntrk->GetYaxis()->SetTitle(coordinate+" mean vertex error [mm]");
346// mean_err_z_vs_ntrk->GetXaxis()->SetTitle(xAxisLabel);
347// mean_err_z_vs_ntrk->SetTitle(coordinate+" Mean Vertex Error");
348// mean_err_z_vs_ntrk->SetName("resolution_"+coordinate+"_"+versus+"_Uncorrected"); //not corrected with k-factor
349
351 // Writing out
353 if (versus == "Ntrk") res_z_vs_ntrk->GetXaxis()->SetRangeUser(0., 100.);
354 else res_z_vs_ntrk->GetXaxis()->SetRangeUser(0., 20.);
355 res_z_vs_ntrk->GetYaxis()->SetRangeUser(0.0025, 1.);
356 res_z_vs_ntrk->Write("", TObject::kOverwrite);
357 delete res_z_vs_ntrk;
358
359 if (versus == "Ntrk") krms_z_vs_ntrk->GetXaxis()->SetRangeUser(0., 100.);
360 else krms_z_vs_ntrk->GetXaxis()->SetRangeUser(0., 20.);
361 krms_z_vs_ntrk->GetYaxis()->SetRangeUser(0.5, 1.3);
362 krms_z_vs_ntrk->Write("", TObject::kOverwrite);
363 delete krms_z_vs_ntrk;
364
365 if (versus == "Ntrk") kgs_z_vs_ntrk->GetXaxis()->SetRangeUser(0., 100.);
366 else kgs_z_vs_ntrk->GetXaxis()->SetRangeUser(0., 20.);
367 kgs_z_vs_ntrk->GetYaxis()->SetRangeUser(0.5, 1.3);
368 kgs_z_vs_ntrk->Write("", TObject::kOverwrite);
369 delete kgs_z_vs_ntrk;
370
371// nTrksPerVertex->GetYaxis()->SetTitle("Entries");
372// nTrksPerVertex->Draw();
373// nTrksPerVertex->Write("", TObject::kOverwrite);
374
375 return;
376 }
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
void binWidth(TH1 *h)
Definition listroot.cxx:80
std::vector< float > stableGaussianFit(TH1 *histo)
double error_func(float x, const Double_t *par)
double scaleFactorFitFcn(double *x, double *par)

◆ populateKeyMapping()

void dqutils::populateKeyMapping ( TDirectory * ,
keycyclemap &  )

◆ scaleFactorFitFcn()

double dqutils::scaleFactorFitFcn ( double * x,
double * par )

Definition at line 460 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

460 {
461 // Truncated gaus-smeared step function
462 // par 0: mean of turn-on (and truncation point)
463 // par 1: slope of turn-on
464 // par 2: plateau
465 return (x[0] >= par[0]) * TMath::Erf(par[1] * x[0] - par[0]) * par[2];
466 }

◆ stableGaussianFit()

std::vector< float > dqutils::stableGaussianFit ( TH1 * histo)

Definition at line 428 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

428 {
429 std::vector<float> results;
430 if (histo) {
431 double sigmas = 2.;
432
433 histo->Fit("gaus", "Q0", "", -2, 2);
434 TF1* func = histo->GetFunction("gaus");
435 double actualSigma = func->GetParameter(2);
436 double actualSigmaErr = func->GetParError(2);
437
438 for (int u = 0; u < 10; u++) {
439 histo->Fit("gaus", "Q0", "", -sigmas * actualSigma, sigmas * actualSigma);
440 func = histo->GetFunction("gaus");
441 actualSigma = func->GetParameter(2);
442 actualSigmaErr = func->GetParError(2);
443 }//end of the fitting loop
444
445 results.push_back(actualSigma);
446 results.push_back(actualSigmaErr);
447 } else {
448 results.push_back(0.);
449 results.push_back(0.);
450 }//end of protection against an empty histogram
451
452 return results;
453 }//end of stableGaussian Fit function

◆ updateHists()

int dqutils::updateHists ( const std::string & inFileName,
const std::string & inStem,
const std::string & outFileName = "",
const std::string & outStem = "" )

Definition at line 149 of file MonitoringFile_MoveVertexMonitoring.cxx.

150 {
151 std::string outFileName = fileName;
152 std::string outStem = stem;
153 //open original file
154 TFile* source = TFile::Open(inFileName.c_str());
155 if (!source) {
156 //std::cout << "Couldn't open input file, " << inFileName << std::endl;
157 return 1;
158 }//else std::cout << "opening input file, " << inFileName << std::endl;
159
160 //find out whether inStem is a histogram or a directory
161 bool isDir = true;
162 std::string path = inStem;
163 std::string hist;
164
165 if (inStem[inStem.size() - 1] != '/') {
166 std::string::size_type lastSlash = inStem.find_last_of('/');
167 hist = inStem.substr(lastSlash + 1, inStem.size() - lastSlash - 1);
168 path = inStem.substr(0, lastSlash + 1);
169 isDir = (source->FindObjectAny(hist.c_str()))->InheritsFrom("TDirectory");
170 if (isDir) {
171 path = inStem;
172 hist.clear();
173 }
174 }
175
176 if (path[path.size() - 1] == '/') path.resize(path.size() - 1);
177 if (!source->GetDirectory(path.c_str())) {
178 //std::cout << "path " << path << " directory doesn't exist in input file" << std::endl;
179 return 1;
180 }
181
182 //open target file
183 std::cout.fill(' ');
184 if (outFileName.empty()) {
185 outFileName = std::string(inFileName, 0, inFileName.find(".root"));
186 outFileName += "_trimmed.root";
187 }
188
189 TFile* target = TFile::Open(outFileName.c_str(), "update");
190 if (!target) {
191 //std::cout << "coundn't open output file " << outFileName << std::endl;
192 return 1;
193 }//else std::cout << "opening output file " << outFileName << std::endl;
194
195 if (outStem.empty()) outStem = inStem;
196 std::string targetPath = outStem;
197 std::string targetHist;
198 if (!isDir) {
199 std::string::size_type lastSlash = outStem.find_last_of('/');
200 targetPath = outStem.substr(0, lastSlash + 1);
201 targetHist = outStem.substr(lastSlash + 1, outStem.size() - lastSlash - 1);
202 }
203
204 if (targetPath[targetPath.size() - 1] == '/') targetPath.resize(targetPath.size() - 1);
205
206 target->cd();
207 if (!makeDirectories(targetPath)) {
208 //std::cout << "couldn't create outStem directories in output" << std::endl;
209 return 1;
210 }
211 //copy relevant objects
212 if (!target->IsWritable()) return 1;
213
214 Copy(source, target, path, targetPath, hist, targetHist);
215
216 delete target;
217 delete source;
218 return 0;
219 }
path
python interpreter configuration --------------------------------------—
Definition athena.py:128

Variable Documentation

◆ fdbg

const bool dqutils::fdbg = true
static

Definition at line 41 of file MonitoringFile_HLTMuonHistogramDivision.cxx.

◆ fpdbg

const bool dqutils::fpdbg = false
static

Definition at line 38 of file MonitoringFile_HLTMuonPostProcess.cxx.

◆ padding

std::atomic<int> dqutils::padding = 0

Definition at line 20 of file MonitoringFile_MoveVertexMonitoring.cxx.

◆ rno_debug

const bool dqutils::rno_debug = false
static

Definition at line 38 of file MonitoringFile_PixelPostProcess.cxx.

◆ root_color_choices

std::vector<int> dqutils::root_color_choices
Initial value:
= {
kBlue, kRed, kGray, kOrange, kViolet, kGreen + 1
}

Definition at line 85 of file HanOutputFile.cxx.

85 {
86 kBlue, kRed, kGray, kOrange, kViolet, kGreen + 1
87 };

◆ tgc_debug

const bool dqutils::tgc_debug = false
static

Definition at line 43 of file MonitoringFile_TGCPostProcess.cxx.

◆ TGCChamberEfficiencyCut

const float dqutils::TGCChamberEfficiencyCut = 0.7
static

Definition at line 40 of file MonitoringFile_TGCPostProcess.cxx.

◆ TGCChamberHighOccupancyCut

const float dqutils::TGCChamberHighOccupancyCut = 0.005
static

Definition at line 38 of file MonitoringFile_TGCPostProcess.cxx.

◆ TGCChamberLowOccupancyCut

const float dqutils::TGCChamberLowOccupancyCut = 1.0e-6
static

Definition at line 37 of file MonitoringFile_TGCPostProcess.cxx.

◆ TGCChamberTimingCut

const float dqutils::TGCChamberTimingCut = 0.95
static

Definition at line 41 of file MonitoringFile_TGCPostProcess.cxx.

◆ TGCChannelOccupancyCut

const float dqutils::TGCChannelOccupancyCut = 0.01
static

Definition at line 39 of file MonitoringFile_TGCPostProcess.cxx.