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 std::string &coordinate, const std::string &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 1128 of file HanOutputFile.cxx.

1128 {
1129 gVirtualPS->Open(myC->GetName(), 114);
1130 myC->Paint();
1131 auto pImgDump = dynamic_cast<TImageDump*>(gVirtualPS);
1132 if (pImgDump) {
1133 (*img) = pImgDump->GetImage();
1134 if (*img) {
1135 (*img)->GetImageBuffer(x, y, TImage::kPng);
1136 }
1137 }
1138 }
#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 252 of file MonitoringFile_MoveVertexMonitoring.cxx.

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

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

◆ error_func()

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

Definition at line 454 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

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

◆ 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 238 of file MonitoringFile_MoveVertexMonitoring.cxx.

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

◆ makeDirectories()

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

Definition at line 220 of file MonitoringFile_MoveVertexMonitoring.cxx.

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

◆ plotEfficiency()

void dqutils::plotEfficiency ( )

Definition at line 378 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

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

◆ plotResolution()

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

Definition at line 106 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

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

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

◆ stableGaussianFit()

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

Definition at line 427 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

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

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

Variable Documentation

◆ fdbg

const bool dqutils::fdbg = true
static

Definition at line 40 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 19 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 84 of file HanOutputFile.cxx.

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

◆ 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.