35 TFile* f = TFile::Open(inFilename.c_str(),
"UPDATE");
38 if (f == 0 || !f->IsOpen()) {
39 std::cerr <<
"--> L1CaloPostProcess: Input file not opened" << std::endl;
46 std::cerr <<
"--> L1CaloPostProcess: Input file " << inFilename <<
" cannot be opened. " << std::endl;
52 if (f->GetSize() < 1000.) {
53 std::cerr <<
"--> L1CaloPostProcess: Input file empty" << std::endl;
60 TIter next_run(f->GetListOfKeys());
64 while ((key_run =
dynamic_cast<TKey*
>(next_run())) != 0) {
65 TObject* obj_run = key_run->ReadObj();
66 TDirectory* tdir_run =
dynamic_cast<TDirectory*
>(obj_run);
75 std::string runDirName(tdir_run->GetName());
78 if (runDirName.find(
"run") == std::string::npos) {
84 std::string stabilityDirName = runDirName +
"/L1Calo/PPM/Stability";
93 3., 3., 3., 6., 4., 2.
95 static const std::string energies[6] = {
96 "10",
"20",
"30",
"50",
"100",
"200"
98 for (
int i = 0; i < 3; ++i) {
99 std::string effDir = runDirName +
"/L1Calo/Reco/EmEfficiencies/ClusterRaw_"
100 + energies[i] +
"GeV_EtaVsPhi";
101 std::string nameDen =
"ClusterRaw_" + energies[i] +
"GeV_Eta_vs_Phi";
102 std::string nameEff = nameDen +
"_trig_Eff";
109 for (
int i = 3; i < 6; ++i) {
110 std::string effDir = runDirName +
"/L1Calo/Reco/JetEfficiencies/JetEmScale_"
111 + energies[i] +
"GeV_EtaVsPhi";
112 std::string nameDen =
"JetEmScale_" + energies[i] +
"GeV_Eta_vs_Phi";
113 std::string nameEff = nameDen +
"_J_Eff_item";
114 std::string nameEffF = nameDen +
"_FJ_J_Eff_item";
142 const std::string& nameData,
const std::string& nameError) {
146 if (!(f->GetDirectory(nameDir.c_str()))) {
151 if (f->cd(nameDir.c_str()) == 0) {
157 std::string p1 = nameDir +
"/" + nameData;
163 TH1* h1 = (TH1*) (f->Get(p1.c_str()));
166 std::string p2 = nameDir +
"/" + nameError;
172 TH1* h2 = (TH1*) (f->Get(p2.c_str()));
175 const int dim = h1->GetDimension();
176 if (dim != h2->GetDimension()) {
180 if (h1->GetNbinsX() != h2->GetNbinsX() ||
181 ((dim == 2) && (h1->GetNbinsY() != h2->GetNbinsY()))) {
188 int nbins = h1->GetNbinsX() + 2;
189 if (dim == 2) nbins *= (h1->GetNbinsY() + 2);
191 double error = h1->GetBinError(
bin);
196 h2->Write(
"", TObject::kOverwrite);
203 const std::string& nameDen,
const std::string& nameEff,
204 int items,
double threshold,
int binSkip) {
208 if (!(f->GetDirectory(effDir.c_str()))) {
213 if (f->cd(effDir.c_str()) == 0) {
219 std::string denPath = effDir +
"/denominator/" + nameDen;
220 TH1* h1 = (TH1*) (f->Get(denPath.c_str()));
226 if (h1->GetDimension() != 2) {
233 int xbins = h1->GetNbinsX();
234 int ybins = h1->GetNbinsY();
235 std::vector<TH1*> effVec;
236 std::string effBase = effDir +
"/" + nameEff;
237 for (
int i = 0; i < items; ++i) {
238 std::string effPath = effBase + std::format(
"_{:d}", i);
239 TH1* h2 = (TH1*) (f->Get(effPath.c_str()));
245 if (h2->GetDimension() != 2) {
250 if (xbins != h2->GetNbinsX() || ybins != h2->GetNbinsY()) {
255 effVec.push_back(h2);
257 if (effVec.empty()) {
261 std::vector<TH1*>::iterator iter;
262 std::vector<TH1*>::iterator iterEnd = effVec.end();
265 for (
int x = 1 + binSkip;
x <= xbins - binSkip; ++
x) {
266 for (
int y = 1;
y <= ybins; ++
y) {
269 for (iter = effVec.begin(); iter != iterEnd; ++iter) {
270 (*iter)->SetBinContent(
x,
y, 100.0);
277 for (iter = effVec.begin(); iter != iterEnd; ++iter) {
278 (*iter)->Write(
"", TObject::kOverwrite);