ATLAS Offline Software
Loading...
Searching...
No Matches
MonitoringFile_HLTMETPostProcess.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4
5
6/* Methods to perform post-processing on run_nnnnnn/HLT/METMon* histograms
7 * Author : Venkatesh Kaushik (venkat.kaushik@cern.ch)
8 * Date : Feb 2010
9 */
10
12
13#include <iostream>
14#include <iomanip>
15#include <algorithm>
16#include <fstream>
17#include <cmath>
18#include <cstdlib>
19#include <sstream>
20#include <vector>
21#include <utility>
22#include <map>
23#include <string>
24
25#include "TH1F.h"
26#include "TH2F.h"
27#include "TFile.h"
28#include "TClass.h"
29#include "TKey.h"
30#include "TMath.h"
31#include "TF1.h"
32#include "TTree.h"
33#include "TBranch.h"
34
35
36
37namespace dqutils {
38 void
39 MonitoringFile::HLTMETPostProcess(const std::string& inFilename, bool /* isIncremental */) {
40 //bool dbgLevel = false;
41
42 //if (dbgLevel) std::cout << "--> HLTMETPostProcess: Begin HLTMET post-processing" << std::endl;
43
44 //open root file
45 TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
46
47 //check files are loaded.
48
49 if (f == 0 || !f->IsOpen()) {
50 std::cerr << "--> HLTMETPostProcess: Input file not opened" << std::endl;
51 return;
52 }
53
54 if (f->IsZombie()) {
55 std::cerr << "--> HLTMETPostProcess: Input file " << inFilename << " cannot be opened. " << std::endl;
56 return;
57 }
58
59 //check file size is not too small.
60 if (f->GetSize() < 1000.) {
61 std::cerr << "--> HLTMETPostProcess: Input file empty" << std::endl;
62 f->Close();
63 return;
64 }
65
66 //start postprocessing
67 TString run_dir;
68 HLTMETAveragePhivsEtaMaps(f, run_dir);
69 HLTMETDQFlagSummary(f, run_dir);
70 //close root file
71 f->Close();
72 delete f;
73
74 //if (dbgLevel) std::cout << "--> HLTMETPostProcess: End HLTMET post-processing " << std::endl;
75
76 return;
77 }
78
79 /*unsigned int MonitoringFile::HLTMETGetDQLBNRange(TDirectory*& run_dir) {
80
81 if(!run_dir) return 0;
82 std::cout << "--> : HLTMETGetDQLBNRange: looking for lb_* directories inside " << run_dir->GetName() << " for
83 [L2/EF]_MET_status flags." << std::endl;
84 run_dir->cd();
85
86 // get run directory name
87 //Seemingly unnecessary lines are necessary
88 TIter nextcd0(run_dir->GetListOfKeys());
89 TKey *key0 = (TKey*)nextcd0();
90 TDirectory *dir0= dynamic_cast<TDirectory*> (key0->ReadObj());
91 //dir0->pwd(); //dir0->ls();
92 dir0->cd();
93
94
95 TIter next_lbn ( run_dir->GetListOfKeys() );
96 TKey* key_lbn(0);
97
98 // loop over all objects
99 std::vector<TString> lbnDirs;
100 while ((key_lbn = dynamic_cast<TKey*> ( next_lbn() )) !=0 ) {
101 TObject* obj_lbn = key_lbn->ReadObj();
102 TDirectory* tdir_lbn = dynamic_cast<TDirectory*>( obj_lbn );
103 if (tdir_lbn ==0 ){ delete obj_lbn; continue; }
104 TString lbn_dir = tdir_lbn->GetName();
105 if (!lbn_dir.Contains("lb_") ) {delete obj_lbn; continue;}
106 std::cout << "--> HLTMETGetDQLBNRange: found lbn directory named " << lbn_dir << std::endl;
107 lbnDirs.push_back(lbn_dir);
108 }
109 return lbnDirs.size();
110 }*/
111}//namespace
static void HLTMETPostProcess(const std::string &inFileName, bool isIncremental=false)
static void HLTMETDQFlagSummary(TFile *f, TString &run_dir)
static void HLTMETAveragePhivsEtaMaps(TFile *f, TString &run_dir)