ATLAS Offline Software
MakeQuarkGluonFractionPlots.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 // ===============================================================================
3 // Macro to compute the gluon initiated jets fraction in your sample/selection
4 // To run the macro: .x MakeQuarkGluonFractionPlots.cxx+("config.txt")
5 // ===============================================================================
7 #include <TH1.h>
8 #include <TH2D.h>
9 #include <TCanvas.h>
10 #include <TFile.h>
11 #include <TROOT.h> //gRoot
12 #include <TStyle.h> //gStyle
13 #include <cstdio> //printf
14 #include <iostream> //cout
15 #include <cstring> //strncmp
16 #include <cmath>
17 
19  m_doGluVsFlavour("lightC"),
20  m_channel({}),
21  m_detailedConfig(false),
22  m_OutputFile("FlavourComposition"),
23  m_doPS(false){
24 
25  //Suppressing info/error/... ROOT messages
26  gErrorIgnoreLevel = 5000;
27  TH1::AddDirectory(kFALSE);
28  gStyle->SetPaintTextFormat(".3f");
29  gROOT->SetBatch(kTRUE);
30  printf("\n %s\n MakeQuarkGluonFractionPlots::MakeQuarkGluonFractionPlots\n %s\n",std::string(75,'=').c_str(),std::string(75,'=').c_str());
31  //----------------------------
32  // reading configuration file
33  //----------------------------
34  readXMLConfigFile(filename);
35  printXMLConfigFile();
36  //-----------------------------------------------------------------------------------------------
37  // plotting the 2D input histograms in a ps file and storing them in a vector and
38  // compute the gluon fraction for nominal and systematic samples
39  //-----------------------------------------------------------------------------------------------
40  std::string psfilename;
41  TCanvas c1;
42  //Maps to store histograms
43  std::map<std::string, TH2D*> h_input;
44  std::vector< std::map<std::string, TH2D*> > h_input_1P;
45  std::vector< std::map<std::string, TH2D*> > h_input_1PVar;
46  std::vector< std::map<std::string, TH2D*> > h_input_2P;
47  std::vector< std::map<std::string, TH2D*> > h_input_2PUp;
48  std::vector< std::map<std::string, TH2D*> > h_input_2PDown;
49  printf("\n %s\n Retrieving histograms\n %s\n",std::string(75,'%').c_str(),std::string(75,'%').c_str());
50  if(m_mergechannels){
51  psfilename = "PlotsGluonFraction_AllChannels.ps";
52  if(m_doPS) c1.Print((psfilename+"[").c_str());
53  bool createMap = true;
54  for(unsigned int c=0; c<m_channel.size(); ++c){
55  std::string append = "nominal_";
56  DumpToMap(h_input, m_configNominal.path, m_channel.at(c), m_configNominal.folder, append, createMap);
57  createMap = false;
58  }
59  if(m_doPS) drawhistos(h_input, psfilename);
60  for(unsigned int v=0; v<m_config1PointVec.size(); ++v){
61  createMap = true;
62  std::map<std::string, TH2D*> map_temp;
63  for(unsigned int c=0; c<m_channel.size(); ++c){
64  std::string append = "central1P_"+std::to_string(v)+"_";
65  DumpToMap(map_temp, m_config1PointVec.at(v).central, m_channel.at(c), m_config1PointVec.at(v).folder_c, append, createMap);
66  createMap = false;
67  }
68  h_input_1P.push_back(map_temp);
69  if(m_doPS) drawhistos(h_input_1P.at(v), psfilename);
70  }
71  for(unsigned int v=0; v<m_config1PointVec.size(); ++v){
72  createMap = true;
73  std::map<std::string, TH2D*> map_temp;
74  for(unsigned int c=0; c<m_channel.size(); ++c){
75  std::string append = "variation1P_"+std::to_string(v)+"_";
76  DumpToMap(map_temp, m_config1PointVec.at(v).variation, m_channel.at(c), m_config1PointVec.at(v).folder_v, append, createMap);
77  createMap = false;
78  }
79  h_input_1PVar.push_back(map_temp);
80  if(m_doPS) drawhistos(h_input_1PVar.at(v), psfilename);
81  }
82  for(unsigned int v=0; v<m_config2PointVec.size(); ++v){
83  createMap = true;
84  std::map<std::string, TH2D*> map_temp;
85  for(unsigned int c=0; c<m_channel.size(); ++c){
86  std::string append = "central2P_"+std::to_string(v)+"_";
87  DumpToMap(map_temp, m_config2PointVec.at(v).central, m_channel.at(c), m_config2PointVec.at(v).folder_c, append, createMap);
88  createMap = false;
89  }
90  h_input_2P.push_back(map_temp);
91  if(m_doPS) drawhistos(h_input_2P.at(v), psfilename);
92  }
93  for(unsigned int v=0; v<m_config2PointVec.size(); ++v){
94  createMap = true;
95  std::map<std::string, TH2D*> map_temp;
96  for(unsigned int c=0; c<m_channel.size(); ++c){
97  std::string append = "variation2PUp_"+std::to_string(v)+"_";
98  DumpToMap(map_temp, m_config2PointVec.at(v).variation_up, m_channel.at(c), m_config2PointVec.at(v).folder_up, append, createMap);
99  createMap = false;
100  }
101  h_input_2PUp.push_back(map_temp);
102  if(m_doPS) drawhistos(h_input_2PUp.at(v), psfilename);
103  }
104  for(unsigned int v=0; v<m_config2PointVec.size(); ++v){
105  createMap = true;
106  std::map<std::string, TH2D*> map_temp;
107  for(unsigned int c=0; c<m_channel.size(); ++c){
108  std::string append = "variation2PDown_"+std::to_string(v)+"_";
109  DumpToMap(map_temp, m_config2PointVec.at(v).variation_down, m_channel.at(c), m_config2PointVec.at(v).folder_down, append, createMap);
110  createMap = false;
111  }
112  h_input_2PDown.push_back(map_temp);
113  if(m_doPS) drawhistos(h_input_2PDown.at(v), psfilename);
114  }
115  CreateQGFFile("AllChannels",h_input,h_input_1P,h_input_1PVar,h_input_2P,h_input_2PUp,h_input_2PDown);
116  }
117  else{
118  for(unsigned int c=0; c<m_channel.size(); ++c){
119  psfilename = "PlotsGluonFraction_" + m_channel.at(c) +".ps";
120  if(m_doPS) c1.Print((psfilename+"[").c_str());
121  bool createMap = true;
122  std::string append = "nominal_";
123 
124  //Clear the input map
125  h_input.clear();
126  h_input_1P.clear();
127  h_input_1PVar.clear();
128  h_input_2P.clear();
129  h_input_2PUp.clear();
130  h_input_2PDown.clear();
131 
132  DumpToMap(h_input, m_configNominal.path, m_channel.at(c), m_configNominal.folder, append, createMap);
133  if(m_doPS) drawhistos(h_input, psfilename);
134 
135  for(unsigned int v=0; v<m_config1PointVec.size(); ++v){
136  std::map<std::string, TH2D*> map_temp;
137  std::string append = "central1P_"+std::to_string(v)+"_"+m_channel.at(c)+"_";
138  DumpToMap(map_temp, m_config1PointVec.at(v).central, m_channel.at(c), m_config1PointVec.at(v).folder_c, append, createMap);
139  h_input_1P.push_back(map_temp);
140  if(m_doPS) drawhistos(h_input_1P.at(v), psfilename);
141  }
142  for(unsigned int v=0; v<m_config1PointVec.size(); ++v){
143  std::map<std::string, TH2D*> map_temp;
144  std::string append = "variation1P_"+std::to_string(v)+"_"+m_channel.at(c)+"_";
145  DumpToMap(map_temp, m_config1PointVec.at(v).variation, m_channel.at(c), m_config1PointVec.at(v).folder_v, append, createMap);
146  h_input_1PVar.push_back(map_temp);
147  if(m_doPS) drawhistos(h_input_1PVar.at(v), psfilename);
148  }
149  for(unsigned int v=0; v<m_config2PointVec.size(); ++v){
150  std::map<std::string, TH2D*> map_temp;
151  std::string append = "central2P_"+std::to_string(v)+"_"+m_channel.at(c)+"_";
152  DumpToMap(map_temp, m_config2PointVec.at(v).central, m_channel.at(c), m_config2PointVec.at(v).folder_c, append, createMap);
153  h_input_2P.push_back(map_temp);
154  if(m_doPS) drawhistos(h_input_2P.at(v), psfilename);
155  }
156  for(unsigned int v=0; v<m_config2PointVec.size(); ++v){
157  std::map<std::string, TH2D*> map_temp;
158  std::string append = "variation2PUp_"+std::to_string(v)+"_"+m_channel.at(c)+"_";
159  DumpToMap(map_temp, m_config2PointVec.at(v).variation_up, m_channel.at(c), m_config2PointVec.at(v).folder_up, append, createMap);
160  h_input_2PUp.push_back(map_temp);
161  if(m_doPS) drawhistos(h_input_2PUp.at(v), psfilename);
162  }
163  for(unsigned int v=0; v<m_config2PointVec.size(); ++v){
164  std::map<std::string, TH2D*> map_temp;
165  std::string append = "variation2PDown_"+std::to_string(v)+"_"+m_channel.at(c)+"_";
166  DumpToMap(map_temp, m_config2PointVec.at(v).variation_down, m_channel.at(c), m_config2PointVec.at(v).folder_down, append, createMap);
167  h_input_2PDown.push_back(map_temp);
168  if(m_doPS) drawhistos(h_input_2PDown.at(v), psfilename);
169  }
170  CreateQGFFile(m_channel.at(c),h_input,h_input_1P,h_input_1PVar,h_input_2P,h_input_2PUp,h_input_2PDown);
171  }
172  }
173 }
174 /*********************************************
175  * Drawing methods
176  * *******************************************/
177 // Draw histograms from a map
178 void MakeQuarkGluonFractionPlots::drawhistos(const std::map<std::string, TH2D*> & histos, const std::string& psfilename){
179  TCanvas c1;
180  c1.SetLogx();
181  for (std::map<std::string, TH2D*>::iterator it = histos.begin() ; it != histos.end(); ++it){
182  TH2D *h = it->second;
183  if(h->Integral()==0.) continue;
184  h->Draw("COLZtext");
185  c1.Print(psfilename.c_str());
186 
187  }
188 }
189 // Draw histograms from a vector
190 void MakeQuarkGluonFractionPlots::drawhistos(const std::vector<TH2D*> & histos, const std::string& psfilename){
191  TCanvas c1;
192  c1.SetLogx();
193  for (std::vector<TH2D*>::iterator it = histos.begin() ; it != histos.end(); ++it){
194  TH2D *h = *it;
195  if(h->Integral()==0.) continue;
196  h->Draw("COLZtext");
197  c1.Print(psfilename.c_str());
198 
199  }
200 }
201 //Write histograms to file (nominal and uncertainties, if presents)
202 void MakeQuarkGluonFractionPlots::createOutputFile(const std::string& filename, std::vector<TH2D*> histos, std::vector<TH2D*> histosUnc){
203  TFile *fout = new TFile(filename.c_str(),"recreate");
204  fout->cd();
205  for (std::vector<TH2D*>::iterator it = histos.begin() ; it != histos.end(); ++it) (*it)->Write();
206  for (std::vector<TH2D*>::iterator it = histosUnc.begin() ; it != histosUnc.end(); ++it) { if((*it)!= NULL) (*it)->Write();}
207  fout->Close();
208  std::cout<<" Histograms are saved in "<<filename<<std::endl;
209 }
210 /**************************************************************
211  * QGF Evaluation - related methods
212  * ************************************************************/
213 void MakeQuarkGluonFractionPlots::DumpToMap(std::map<std::string, TH2D*> &h_map, std::string filename, const std::string& channel, const std::string& folder, const std::string& keyname, bool createMap){
214  bool newMap = createMap;
215  bool istxt = ( (filename.find(".txt") + 4 ) == filename.length());
216  if(istxt){
217  std::string f_name;
218  ifstream reader;
219  reader.open (filename);
220  while(!reader.eof()){
221  getline(reader,f_name);
222  if(f_name.compare("")==0) continue;
223  DumpFileToMap(h_map, f_name, channel, folder, keyname, newMap);
224  newMap = false;
225  }
226  reader.close();
227  }
228  else
229  DumpFileToMap(h_map, filename, channel, folder, keyname, newMap);
230 }
231 void MakeQuarkGluonFractionPlots::DumpFileToMap(std::map<std::string, TH2D*> &h_map,
232  const std::string& filename,
233  const std::string& channel,
234  const std::string& folder,
235  const std::string& keyname, bool createMap){
236  TFile *f_in=TFile::Open(filename.c_str());
237  std::string dirname = channel + "/"+folder;
238  TDirectory* dir = f_in->GetDirectory(dirname.c_str());
239  if(!dir) {
240  std::cout<<" ERROR: directory "<<dirname<<" not found in file "<<filename<<"! Exiting.\n";
241  abort();
242  }
243  TIter next(dir->GetListOfKeys());
244  TKey *key;
245  int counter = 0;
246  while ((key = (TKey*)next())) {
247  TClass *cl = gROOT->GetClass(key->GetClassName());
248  if (!cl->InheritsFrom("TH2D")) continue;
249  TH2D *h = (TH2D*)key->ReadObj();
250  if(createMap){
251  std::string histoname = keyname + std::to_string(counter);
252  ++counter;
253  std::string orig_name = h->GetName();
254  h->SetName(histoname.c_str());
255  std::string titlename = keyname + "_" + orig_name;
256  h->SetTitle(titlename.c_str());
257  h->SetStats(kTRUE); // Activate or desactivate the statistics box
258  gStyle->SetStatY(0.95); // Set y-position (fraction of pad size)
259  gStyle->SetStatX(0.89); // Set x-position (fraction of pad size)
260  h_map.insert( std::pair<std::string, TH2D* >( orig_name, h ) );
261  }
262  else{
263  h_map.at(h->GetName())->Add(h);
264  }
265  }
266 }
267 //QGF File creation
268 void MakeQuarkGluonFractionPlots::CreateQGFFile(const std::string& prename,
269  const std::map<std::string, TH2D*>& h_input,
270  const std::vector< std::map<std::string, TH2D*> > & h_input_1P,
271  const std::vector< std::map<std::string, TH2D*> > & h_input_1PVar,
272  const std::vector< std::map<std::string, TH2D*> > & h_input_2P,
273  const std::vector< std::map<std::string, TH2D*> > & h_input_2PUp,
274  const std::vector< std::map<std::string, TH2D*> > & h_input_2PDown){
275  //Since I am here, all histograms have already been retrieved!
276  printf("\n %s\n Computing the gluon fraction in %s channel\n %s\n",std::string(75,'%').c_str(),prename.c_str(),std::string(75,'%').c_str());
277  std::string outputName = prename + "_" + m_OutputFile;
278  //Creating ps file to plot all flavour plots/channel
279  std::string psfilename = "PlotsGluonFraction_" + prename +".ps";
280  TCanvas c1;
281  if(m_doPS) c1.Print((psfilename+"[").c_str());
282  //Nominal
283  printf("\n %s\n Computing QGF (nominal): \n %s\n",std::string(75,'=').c_str(),std::string(75,'=').c_str());
284  std::vector<TH2D*> fractionhistos=computeQuarkGluonFraction(h_input, m_doGluVsFlavour, prename);
285  if(m_doPS) drawhistos(fractionhistos, psfilename);
286  //Systematics:
287  std::vector<std::vector<TH2D*>> h_fractionUnc1PSyst;
288  std::vector<std::vector<TH2D*>> h_fractionUnc2PSyst_up;
289  std::vector<std::vector<TH2D*>> h_fractionUnc2PSyst_down;
290  printf("\n %s\n Computing QGF (%s): \n %s\n",std::string(75,'%').c_str(),"1 point systematics",std::string(75,'%').c_str());
291  for(unsigned int v=0; v<m_config1PointVec.size(); ++v){
292  std::string prehistname="central_1PSystematic" + std::to_string(v) ;
293  std::string prehistnameVar="variation_1PSystematic" + std::to_string(v) ;//std::to_string(v) + "variation_1PSystematic";
294  printf("\n %s\n Computing QGF (%s): \n %s\n",std::string(75,'=').c_str(),m_config1PointVec.at(v).name.c_str(),std::string(75,'=').c_str());
295  std::vector<TH2D*> qgf_nominal = computeQuarkGluonFraction(h_input_1P.at(v), m_doGluVsFlavour, prehistname);
296  if(m_doPS) drawhistos(qgf_nominal, psfilename);
297  std::vector<TH2D*> qgf_variation = computeQuarkGluonFraction(h_input_1PVar.at(v), m_doGluVsFlavour, prehistnameVar);
298  if(m_doPS) drawhistos(qgf_variation, psfilename);
299  prehistname=std::to_string(v) + "_1PSystematic_delta";
300  h_fractionUnc1PSyst.push_back(getDelta(qgf_nominal, qgf_variation, m_config1PointVec.at(v).scalefactor, prehistname)); //nominal-var
301  if(m_doPS) drawhistos(h_fractionUnc1PSyst.at(v), psfilename);
302  }
303  printf("\n %s\n Computing QGF (%s): \n %s\n",std::string(75,'%').c_str(),"2 point systematics",std::string(75,'%').c_str());
304  for(unsigned int v=0; v<m_config2PointVec.size(); ++v){
305  std::string prehistname=std::to_string(v) + "_2PSystematic";
306  printf("\n %s\n Computing QGF (%s): \n %s\n",std::string(75,'=').c_str(),m_config2PointVec.at(v).name.c_str(),std::string(75,'=').c_str());
307  std::vector<TH2D*> qgf_nominal = computeQuarkGluonFraction(h_input_2P.at(v), m_doGluVsFlavour, prehistname);
308  if(m_doPS) drawhistos(qgf_nominal, psfilename);
309  std::vector<TH2D*> qgf_variationUp = computeQuarkGluonFraction(h_input_2PUp.at(v), m_doGluVsFlavour, prehistname);
310  if(m_doPS) drawhistos(qgf_variationUp, psfilename);
311  prehistname=std::to_string(v) + "_2PSystematic_deltaUp";
312  h_fractionUnc2PSyst_up.push_back(getDelta(qgf_variationUp, qgf_nominal, m_config2PointVec.at(v).scalefactor, prehistname)); //up-nominal
313  if(m_doPS) drawhistos(h_fractionUnc2PSyst_up.at(v), psfilename);
314 
315  std::vector<TH2D*> qgf_variationDown = computeQuarkGluonFraction(h_input_2PDown.at(v), m_doGluVsFlavour, prehistname);
316  if(m_doPS) drawhistos(qgf_variationDown, psfilename);
317  prehistname=std::to_string(v) + "_2PSystematic_deltaDown";
318  h_fractionUnc2PSyst_down.push_back(getDelta(qgf_nominal, qgf_variationDown, m_config2PointVec.at(v).scalefactor, prehistname)); //up-nominal
319  if(m_doPS) drawhistos(h_fractionUnc2PSyst_down.at(v), psfilename);
320 
321  }
322  //-----------------------------------------------------------
323  // compute the uncertainty histograms
324  //-----------------------------------------------------------
325  printf("\n %s\n Computing the total systematic uncertainty: \n %s\n",std::string(75,'=').c_str(),std::string(75,'=').c_str());
326  std::vector<TH2D*> fractionTotalUnc = evaluateQGFUncertaity(h_fractionUnc1PSyst,h_fractionUnc2PSyst_up,h_fractionUnc2PSyst_down,prename);
327  if(m_doPS) drawhistos( fractionTotalUnc, psfilename);
328  //------------------------------------------------------------------
329  // create output file to store fraction histograms in a root file
330  //------------------------------------------------------------------
331  printf("\n %s\n Writing output file: \n %s\n",std::string(75,'%').c_str(),std::string(75,'%').c_str());
332  if(m_config1PointVec.size()+m_config2PointVec.size())
333  createOutputFile(outputName, fractionhistos, fractionTotalUnc);
334  else
335  createOutputFile(outputName, fractionhistos, {});
336  //close ps file
337  c1.Print((psfilename+"]").c_str());
338 }
339 // Evaluate Delta
340 std::vector<TH2D*> MakeQuarkGluonFractionPlots::getDelta (const std::vector<TH2D*> & h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname){
341  std::vector<TH2D*> QuarkGluonDiffFractionhistos;
342  if(h_nom.size() != h_var.size()) std::cout<<"ERROR: Systematic variation don't have the same number of histograms!\n";
343  std::string JetCollection = extractJetCollectionName((h_nom.at(0))->GetName());
344  for(size_t i = 0; i<h_nom.size(); i++){
345  //return diff*(nominal-varied)
346  std::string njets = extractJetNumber(h_nom.at(i)->GetName());
347  std::string histname = prehistname + "_gluonFractionError_" + njets + "_" + JetCollection;
348  TH2D *hist_diff;
349  hist_diff = (TH2D*)((h_nom.at(i))->Clone(histname.c_str()));
350  hist_diff->Add((TH2D*)(h_var.at(i)), -1);
351  hist_diff->Scale(scale);
352  hist_diff->SetTitle(hist_diff->GetName());
353  hist_diff->SetStats(kFALSE);
354  QuarkGluonDiffFractionhistos.push_back(hist_diff);
355  }
356  return QuarkGluonDiffFractionhistos;
357 }
358 
359 //Evaluate uncertainty
360 std::vector<TH2D*> MakeQuarkGluonFractionPlots::evaluateQGFUncertaity(const std::vector<std::vector<TH2D*> > & f_1P, const std::vector<std::vector<TH2D*> > & f_2PUp, const std::vector<std::vector<TH2D*> > &f_2PDown, const std::string& channel){
361  std::vector<TH2D*> histUnc;
362  TH2D *h_tmp;
363  std::string h_tmp_name;
364  if(f_1P.size()!=0){
365  h_tmp = (TH2D*)((f_1P.at(0)).at(0))->Clone("TH2_tmp_TotalUnc");
366  h_tmp_name = ((f_1P.at(0)).at(0))->GetName();
367  }
368  else{
369  h_tmp = (TH2D*)((f_2PUp.at(0)).at(0))->Clone("TH2_tmp_TotalUnc");
370  h_tmp_name = ((f_2PUp.at(0)).at(0))->GetName();
371  }
372  std::string JetCollection = extractJetCollectionName(h_tmp_name);
373  // create a new uncertainty histogram (take the bin and axis from the histograms)
374  int binX = h_tmp->GetXaxis()->GetNbins();
375  int binY = h_tmp->GetYaxis()->GetNbins();
376  h_tmp->Reset();
377  h_tmp->Sumw2();
378  //Get squared 1P systematics histograms
379  std::vector<TH2D*> squared_histos1P;
380  if(f_1P.size()!=0){
381  for(unsigned int h=0; h<f_1P.at(0).size(); ++h){
382 
383  std::string h_tmp_name = ((f_1P.at(0)).at(h))->GetName();
384  std::string h_new_name("TH2_tmp_1P_TotalUnc_"+std::to_string(h));
385  TH2D *h_tmp = (TH2D*)((f_1P.at(0)).at(h))->Clone(h_new_name.c_str());
386  h_tmp->Reset();
387  h_tmp->Sumw2();
388  for(int x = 0; x <= binX; ++x){
389  for(int y = 0; y <= binY; ++y){
390  int bin = h_tmp->GetBin(x,y);
391  float sq_err = 0.;
392  for(unsigned int hs=0; hs<f_1P.size(); ++hs){
393  sq_err+=pow(((f_1P.at(hs)).at(h))->GetBinContent(bin),2);
394  }
395 
396  h_tmp->SetBinContent(bin,sq_err);
397  }
398  }
399  squared_histos1P.push_back(h_tmp);
400  }
401  }
402  //Get squared 2P systematics (symmetrized) histograms
403  std::vector<TH2D*> squared_histos2P;
404  if(f_2PUp.size()!=0){
405  for(unsigned int h=0; h<f_2PUp.at(0).size(); ++h){
406  std::string h_tmp_name = ((f_2PUp.at(0)).at(h))->GetName();
407  std::string h_new_name("TH2_tmp_2P_TotalUnc_"+std::to_string(h));
408  TH2D *h_tmp = (TH2D*)((f_2PUp.at(0)).at(h))->Clone(h_new_name.c_str());
409  h_tmp->Reset();
410  h_tmp->Sumw2();
411  for(int x = 0; x <= binX; ++x){
412  for(int y = 0; y <= binY; ++y){
413  int bin = h_tmp->GetBin(x,y);
414  float sq_err = 0.;
415  float sq_err_up = 0.;
416  float sq_err_down = 0.;
417  for(unsigned int hs=0; hs<f_2PUp.size(); ++hs){
418  float err_up = ((f_2PUp.at(hs)).at(h))->GetBinContent(bin);
419  float err_down = ((f_2PDown.at(hs)).at(h))->GetBinContent(bin);
420  /* 4 different cases:
421  * (+,-): no action
422  * (-,+): swap
423  * (+,+): (max(+,+),0)
424  * (-,-): (0,min(-,-))
425  */
426  bool isneg_up = std::signbit(err_up);
427  bool isneg_down = std::signbit(err_down);
428  if((isneg_up)&&(!isneg_down)){
429  float tmp_swap = err_up;
430  err_up = err_down;
431  err_down = tmp_swap;
432  }
433  else if((!isneg_up)&&(!isneg_down)){
434  err_up = std::max(err_up,err_down);
435  err_down = 0.;
436  }
437  else if((isneg_up)&&(isneg_down)){
438  err_down = std::min(err_up,err_down);
439  err_up = 0.;
440  }
441  sq_err_up+=pow(err_up,2);
442  sq_err_down+=pow(err_down,2);
443  }
444  //symmetrize error
445  sq_err=pow((sqrt(sq_err_down)+sqrt(sq_err_up))/2.,2);
446  h_tmp->SetBinContent(bin,sq_err);
447  }
448  }
449  squared_histos2P.push_back(h_tmp);
450  }
451  }
452  //Filling empty final histograms (just to retrieve correct binning
453  std::vector<TH2D*> final_histos;
454 
455  if(f_1P.size()!=0){
456  for(unsigned int h=0; h<f_1P.at(0).size(); ++h){
457  std::string h_tmp_name = ((f_1P.at(0)).at(h))->GetName();
458  std::string JetCollection = extractJetCollectionName(h_tmp_name);
459  std::string njets = extractJetNumber(h_tmp_name);
460  std::string histoname = channel + "_gluonFractionError_"+ njets + JetCollection;
461  TH2D *h_tmp = (TH2D*)((f_1P.at(0)).at(h))->Clone(histoname.c_str());
462  h_tmp->Reset();
463  h_tmp->SetTitle(histoname.c_str());
464  h_tmp->Sumw2();
465  final_histos.push_back(h_tmp);
466  }
467  }
468  else{
469  for(unsigned int h=0; h<f_2PUp.at(0).size(); ++h){
470  std::string h_tmp_name = ((f_2PUp.at(0)).at(h))->GetName();
471  std::string JetCollection = extractJetCollectionName(h_tmp_name);
472  std::string njets = extractJetNumber(h_tmp_name);
473  std::string histoname = channel + "_gluonFractionError_"+ njets + "_" + JetCollection;
474  TH2D *h_tmp = (TH2D*)((f_2PUp.at(0)).at(h))->Clone(histoname.c_str());
475  h_tmp->Reset();
476  h_tmp->SetTitle(histoname.c_str());
477  h_tmp->Sumw2();
478  final_histos.push_back(h_tmp);
479  }
480  }
481  //Filling final histograms
482  for(unsigned int h=0; h<final_histos.size(); ++h){
483  for(int x = 0; x <= binX; ++x){
484  for(int y = 0; y <= binY; ++y){
485  int bin = h_tmp->GetBin(x,y);
486  float content = 0.;
487 
488  if((squared_histos1P.size())!=0){
489  content+=(squared_histos1P.at(h))->GetBinContent(bin);
490  }
491  if((squared_histos2P.size())!=0){
492  content+=(squared_histos2P.at(h))->GetBinContent(bin);
493  }
494  content = sqrt(content);
495  final_histos.at(h)->SetBinContent(bin,content);
496  }
497  }
498  }
499  return final_histos;
500 }
501 // Compute quark-gluon composition
502 std::vector<TH2D*> MakeQuarkGluonFractionPlots::computeQuarkGluonFraction (std::map< std::string, TH2D* > inputhistos, const std::string& quarkflavour, const std::string& prename){
503  std::vector<TH2D*> QuarkGluonFractionhistos;
504  std::string jetCollection = extractJetCollectionName(inputhistos.begin()->first);
505  int njets = (inputhistos.size()-6)/5; //FIXME this can be potentially wrong
506  if(!m_detailedConfig){
507  std::string name_gluons = "gluon_jets_"; name_gluons += jetCollection.c_str();
508  std::string name_quarks = "quark_jets_"; name_quarks += jetCollection.c_str();
509  TH2D *hist_g = inputhistos[name_gluons];
510  TH2D *hist_q = inputhistos[name_quarks];
511  //Ratio is f=g/(g+q)
512  std::string name_fraction = prename + "_gluonFraction_" + jetCollection;
513  TH2D *hist_ratio = (TH2D*)hist_g->Clone(name_fraction.c_str());
514  hist_ratio->SetTitle(hist_ratio->GetName());
515  hist_ratio->SetStats(kFALSE);
516  TH2D *hist_summ = (TH2D*)hist_g->Clone("hist_summ"); //denominator
517  hist_summ->Add(hist_q);
518  hist_ratio->Divide(hist_summ);
519  QuarkGluonFractionhistos.push_back(hist_ratio);
520  }
521  else{
522  for (int nj = -1; nj < njets ; nj++) { //nj = -1 mean inclusive case
523  std::string name_gluons = "gluon_jets_";
524  std::string name_lquarks = "lightquark_jets_";
525  std::string name_cquarks = "cquark_jets_";
526  std::string name_bquarks = "bquark_jets_";
527  std::string name_other = "other_jets_";
528  std::string name_fraction = prename + "_gluonFraction_";
529  if (nj==-1){
530  name_gluons += jetCollection;
531  name_lquarks += jetCollection;
532  name_cquarks += jetCollection;
533  name_bquarks += jetCollection;
534  name_other += jetCollection;
535  name_fraction += jetCollection;
536  }
537  else{
538  std::string name_append="njet" + std::to_string(nj) + "_" + jetCollection;
539  name_gluons += name_append;
540  name_lquarks += name_append;
541  name_cquarks += name_append;
542  name_bquarks += name_append;
543  name_other += name_append;
544  name_fraction += name_append;
545  }
546  TH2D *hist_g = inputhistos[name_gluons];
547  TH2D *hist_lj = inputhistos[name_lquarks];
548  TH2D *hist_cj = inputhistos[name_cquarks];
549  TH2D *hist_bj = inputhistos[name_bquarks];
550  TH2D *hist_oth = inputhistos[name_other];
551  //Ratio is f=g/(g+lj[light]+cj[lightC]+bj[lightCB])
552  TH2D *hist_ratio = (TH2D*)hist_g->Clone(name_fraction.c_str());
553  hist_ratio->SetTitle(hist_ratio->GetName());
554  hist_ratio->SetStats(kFALSE);
555  std::string name_summ = "hist_summ_" + std::to_string(nj); //denominator
556  TH2D *hist_summ = (TH2D*)hist_g->Clone(name_summ.c_str());
557  hist_summ->Add(hist_lj);
558  if(quarkflavour.compare("light") == 0){
559  hist_ratio->Divide(hist_summ);}
560  else if (quarkflavour.compare("lightC") == 0){
561  hist_summ->Add(hist_cj);
562  hist_ratio->Divide(hist_summ);}
563  else if(quarkflavour.compare("lightCB") == 0){
564  hist_summ->Add(hist_cj);
565  hist_summ->Add(hist_bj);
566  hist_ratio->Divide(hist_summ);}
567  else
568  std::cout<< " WARNING: no flavor known to calculate the gluon fraction" << std::endl;
569  QuarkGluonFractionhistos.push_back(hist_ratio);
570  }
571  }
572  return QuarkGluonFractionhistos;
573 }
574 // Extract jet collection name
576  if(histoname.find("EMPFlow")!=std::string::npos) return "AntiKt4EMPFlow";
577  else if(histoname.find("EMTopo")!=std::string::npos) return "AntiKt4EMTopo";
578  else if(histoname.find("LCTopo")!=std::string::npos) return "AntiKt4LCTopo";
579  else std::cout<<"ERROR: jet collection not found"<<std::endl;
580  return NULL;
581 }
582 // Extract number of jets
584  std::string njets;
585  std::size_t found = histoname.find("njet");
586  if (found!=std::string::npos){
587  std::size_t first= histoname.find("njet");
588  std::size_t last = histoname.find("_AntiKt");
589  njets = histoname.substr(first,(last-first));
590  }
591  return njets;
592 }
593 /**************************************************************
594  * Configuration - related methods
595  * ************************************************************/
597  printf("\n %s\n Extracting configuration: \n %s\n",std::string(75,'=').c_str(),std::string(75,'=').c_str());
598  std::cout<<" Nominal input file: "<<m_configNominal.path<<std::endl;
600  std::cout<<" Nominal folder: "<<m_configNominal.folder<<std::endl;
601  std::cout<<" The gluon fraction will be calculated for the following channels: \n";
602  for(unsigned int i=0; i<m_channel.size(); ++i)
603  std::cout<<"\t"<<i<<") "<<m_channel.at(i)<<std::endl;
604  if(m_detailedConfig) std::cout<<" It will be calculated for different jet multiplicities.\n";
605  if(m_mergechannels) std::cout<<" The different channels will be merged.\n";
606  std::cout<<" The gluon fraction will be calculated taking into account: "<< m_doGluVsFlavour<< " jets\n";
607  std::cout<<"\n\n Systematic samples:\n";
608  std::cout<<"\t 1 PointSystematic samples:\n";
609  for(unsigned int i=0; i<m_config1PointVec.size();++i){
610  std::cout<<"\t("<<i<<") "<<m_config1PointVec.at(i).name<<"\n";
611  std::cout<<"\t\tCentral file: "<<m_config1PointVec.at(i).central<<std::endl;
612  checkFile(m_config1PointVec.at(i).central);
613  std::cout<<"\t\tCentral folder: "<<m_config1PointVec.at(i).folder_c<<std::endl;
614  std::cout<<"\t\tVariated file: "<<m_config1PointVec.at(i).variation<<std::endl;
615  checkFile(m_config1PointVec.at(i).variation);
616  std::cout<<"\t\tVariated folder: "<<m_config1PointVec.at(i).folder_v<<std::endl;
617  std::cout<<"\t\tScalefactor to apply: "<<m_config1PointVec.at(i).scalefactor<<std::endl;
618  }
619  std::cout<<"\t 2 PointSystematic samples:\n";
620  for(unsigned int i=0; i<m_config2PointVec.size();++i){
621  std::cout<<"\t("<<i<<") "<<m_config2PointVec.at(i).name<<"\n";
622  std::cout<<"\t\tCentral file: "<<m_config2PointVec.at(i).central<<std::endl;
623  checkFile(m_config2PointVec.at(i).central);
624  std::cout<<"\t\tCentral folder : "<<m_config2PointVec.at(i).folder_c<<std::endl;
625  std::cout<<"\t\tUp-variated file: "<<m_config2PointVec.at(i).variation_up<<std::endl;
626  checkFile(m_config2PointVec.at(i).variation_up);
627  std::cout<<"\t\tUp-variated folder: "<<m_config2PointVec.at(i).folder_up<<std::endl;
628  std::cout<<"\t\tDown-variated file: "<<m_config2PointVec.at(i).variation_down<<std::endl;
629  checkFile(m_config2PointVec.at(i).variation_down);
630  std::cout<<"\t\tDown-variated folder: "<<m_config2PointVec.at(i).folder_down<<std::endl;
631  std::cout<<"\t\tScalefactor to apply: "<<m_config2PointVec.at(i).scalefactor<<std::endl;
632  }
633  std::cout<<"\n\n The histograms will be stored inside [channel]_"<<m_OutputFile<<std::endl;
634  if (m_doPS) std::cout<<" All plots will be stored in PS files "<<std::endl;
635  printf("\n %s\n Configuration Extracted\n %s\n",std::string(75,'=').c_str(),std::string(75,'=').c_str());
636 }
637 
639  std::cout<<"ERROR! Unknown attribute: "<<value<<". Aborting!\n";
640  abort();
641 }
642 
643 bool MakeQuarkGluonFractionPlots::decodeFloat(TXMLEngine xml, XMLAttrPointer_t attr, const std::string& match, float &value){
644  if(strncmp(xml.GetAttrName(attr),match.c_str(),100)!=0) return false;
645  value=std::stof(xml.GetAttrValue(attr));
646  return true;
647 }
648 
649 bool MakeQuarkGluonFractionPlots::decodeString(TXMLEngine xml, XMLAttrPointer_t attr, const std::string& match, std::string &value){
650  if(strncmp(xml.GetAttrName(attr),match.c_str(),100)!=0) return false;
651  value=xml.GetAttrValue(attr);
652  return true;
653 }
654 
655 bool MakeQuarkGluonFractionPlots::decodeBool(TXMLEngine xml, XMLAttrPointer_t attr, const std::string& match, bool &value){
656  if(strncmp(xml.GetAttrName(attr),match.c_str(),100)!=0) return false;
657  if(strncmp(xml.GetAttrValue(attr),"true",100)==0)
658  value=true;
659  else if(strncmp(xml.GetAttrValue(attr),"false",100)==0)
660  value=false;
661  else{
662  std::cout<<"ERROR! Unknown attribute value: "<<xml.GetAttrValue(attr)<<". Choose between true or false! Exiting!\n";
663  abort();
664  }
665  return true;
666 }
667 
668 void MakeQuarkGluonFractionPlots::readXMLConfigFile(const std::string& configfile){
669  TXMLEngine xml;
670  // Now try to parse xml file
671  XMLDocPointer_t xmldoc = xml.ParseFile(configfile.c_str());
672  if (xmldoc==0) {
673  std::cout<<"ERROR! No valid xml configuration file provided! Aborting!\n";
674  abort();
675  }
676  // Access to main node
677  XMLNodePointer_t mainnode = xml.DocGetRootElement(xmldoc);
678  // Loop through all nodes and subnodes
679  readXMLNode(xml, mainnode);
680  // Release memory before exit
681  xml.FreeDoc(xmldoc);
682 }
683 void MakeQuarkGluonFractionPlots::readXMLNode(TXMLEngine xml, XMLNodePointer_t node){
684  if(strncmp(xml.GetNodeName(node),"nominal",100)==0){
685  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
686  while (attr!=0) {
687  bool pass=0;
688  pass+=decodeString(xml, attr, "path", m_configNominal.path);
689  pass+=decodeString(xml, attr, "folder", m_configNominal.folder);
690  if(!pass) AbortXMLDecode(xml.GetAttrName(attr));
691  attr = xml.GetNextAttr(attr);
692  }
693  }
694  else if(strncmp(xml.GetNodeName(node),"systematic1point",100)==0){
695  config_1PointSyst temp_config1Point;
696  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
697  while (attr!=0) {
698  bool pass=0;
699  pass+=decodeString(xml, attr, "name", temp_config1Point.name);
700  pass+=decodeString(xml, attr, "central", temp_config1Point.central);
701  pass+=decodeString(xml, attr, "variation", temp_config1Point.variation);
702  pass+=decodeFloat(xml, attr, "scalefactor", temp_config1Point.scalefactor);
703  pass+=decodeString(xml, attr, "folder_central", temp_config1Point.folder_c);
704  pass+=decodeString(xml, attr, "folder_variation", temp_config1Point.folder_v);
705  if(!pass) AbortXMLDecode(xml.GetAttrName(attr));
706  attr = xml.GetNextAttr(attr);
707  }
708  m_config1PointVec.push_back(temp_config1Point);
709  }
710  else if(strncmp(xml.GetNodeName(node),"systematic2point",100)==0){
711  config_2PointSyst temp_config2Point;
712  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
713  while (attr!=0) {
714  bool pass=0;
715  pass+=decodeString(xml, attr, "name", temp_config2Point.name);
716  pass+=decodeString(xml, attr, "central", temp_config2Point.central);
717  pass+=decodeString(xml, attr, "variation_up", temp_config2Point.variation_up);
718  pass+=decodeString(xml, attr, "variation_down", temp_config2Point.variation_down);
719  pass+=decodeFloat(xml, attr, "scalefactor", temp_config2Point.scalefactor);
720  pass+=decodeString(xml, attr, "folder_central", temp_config2Point.folder_c);
721  pass+=decodeString(xml, attr, "folder_up", temp_config2Point.folder_up);
722  pass+=decodeString(xml, attr, "folder_down", temp_config2Point.folder_down);
723  if(!pass) AbortXMLDecode(xml.GetAttrName(attr));
724  attr = xml.GetNextAttr(attr);
725  }
726  m_config2PointVec.push_back(temp_config2Point);
727  std::cout<<"systematic2point\n";
728  }
729  else if(strncmp(xml.GetNodeName(node),"output",100)==0){
730  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
731  if(!decodeString(xml, attr, "path", m_OutputFile)) AbortXMLDecode(xml.GetAttrName(attr));
732  }
733  else if(strncmp(xml.GetNodeName(node),"channel",100)==0){
734  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
735  std::string tmp_channel="";
736  if(!decodeString(xml, attr, "name", tmp_channel)) AbortXMLDecode(xml.GetAttrName(attr));
737  m_channel.push_back(tmp_channel);
738  }
739  else if(strncmp(xml.GetNodeName(node),"mergechannels",100)==0){
740  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
741  if(!decodeBool(xml, attr, "value", m_mergechannels)) AbortXMLDecode(xml.GetAttrName(attr));
742  }
743  else if(strncmp(xml.GetNodeName(node),"detailed",100)==0){
744  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
745  if(!decodeBool(xml, attr, "value", m_detailedConfig)) AbortXMLDecode(xml.GetAttrName(attr));
746  }
747  else if(strncmp(xml.GetNodeName(node),"gluon_vs_flavour",100)==0){
748  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
749  if(!decodeString(xml, attr, "value", m_doGluVsFlavour)) AbortXMLDecode(xml.GetAttrName(attr));
750  if(strncmp(xml.GetAttrValue(attr),"light" ,100)
751  *strncmp(xml.GetAttrValue(attr),"lightC" ,100)
752  *strncmp(xml.GetAttrValue(attr),"lightCB",100))
753  AbortXMLDecode(xml.GetAttrName(attr));
754  }
755  else if(strncmp(xml.GetNodeName(node),"do_ps",100)==0){
756  XMLAttrPointer_t attr = xml.GetFirstAttr(node);
757  if(!decodeBool(xml, attr, "value", m_doPS)) AbortXMLDecode(xml.GetAttrName(attr));
758  }
759  //Loop over child nodes
760  XMLNodePointer_t child = xml.GetChild(node);
761  while (child!=0) {
762  readXMLNode(xml, child);
763  child = xml.GetNext(child);
764  }
765 }
766 void MakeQuarkGluonFractionPlots::checkFile(std::string inputfilename){
767  bool istxt = ( (inputfilename.find(".txt") + 4 ) == inputfilename.length());
768  if(istxt){
769  std::string f_name;
770  ifstream reader;
771  reader.open (inputfilename);
772  while(!reader.eof()){
773  getline(reader,f_name);
774  if(f_name.compare("")==0) continue;
775  TFile *f = TFile::Open(f_name.c_str());
776  if (f->IsZombie()){
777  std::cout<<"File "<<f_name<<" from list "<<inputfilename<<" not found! Please check against your configuration file! Aborting|\n";
778  abort();
779  }
780  }
781  reader.close();
782  }
783  else{
784  TFile f(inputfilename.c_str());
785  if (f.IsZombie()){
786  std::cout<<"File "<<inputfilename<<" not found! Please check against your configuration file! Aborting|\n";
787  abort();
788  }
789  }
790 }
791 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
MakeQuarkGluonFractionPlots::extractJetCollectionName
std::string extractJetCollectionName(const std::string &histoname)
Definition: MakeQuarkGluonFractionPlots.cxx:575
MakeQuarkGluonFractionPlots::printXMLConfigFile
void printXMLConfigFile()
Definition: MakeQuarkGluonFractionPlots.cxx:596
MakeQuarkGluonFractionPlots::m_doGluVsFlavour
std::string m_doGluVsFlavour
Definition: MakeQuarkGluonFractionPlots.h:97
config_2PointSyst::folder_down
std::string folder_down
Definition: MakeQuarkGluonFractionPlots.h:44
max
#define max(a, b)
Definition: cfImp.cxx:41
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
config_2PointSyst::variation_down
std::string variation_down
Definition: MakeQuarkGluonFractionPlots.h:40
config_2PointSyst::central
std::string central
Definition: MakeQuarkGluonFractionPlots.h:38
MakeQuarkGluonFractionPlots::m_detailedConfig
bool m_detailedConfig
Definition: MakeQuarkGluonFractionPlots.h:103
config_1PointSyst::central
std::string central
Definition: MakeQuarkGluonFractionPlots.h:29
config_2PointSyst::folder_up
std::string folder_up
Definition: MakeQuarkGluonFractionPlots.h:43
config_2PointSyst::variation_up
std::string variation_up
Definition: MakeQuarkGluonFractionPlots.h:39
TH2D::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:436
extractSporadic.c1
c1
Definition: extractSporadic.py:134
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
MakeQuarkGluonFractionPlots::m_doPS
bool m_doPS
Definition: MakeQuarkGluonFractionPlots.h:109
skel.it
it
Definition: skel.GENtoEVGEN.py:423
dirname
std::string dirname(std::string name)
Definition: utils.cxx:200
bin
Definition: BinsDiffFromStripMedian.h:43
MakeQuarkGluonFractionPlots::CreateQGFFile
void CreateQGFFile(const std::string &prename, const std::map< std::string, TH2D * > &h_input, const std::vector< std::map< std::string, TH2D * > > &h_input_1P, const std::vector< std::map< std::string, TH2D * > > &h_input_1PVar, const std::vector< std::map< std::string, TH2D * > > &h_input_2P, const std::vector< std::map< std::string, TH2D * > > &h_input_2PUp, const std::vector< std::map< std::string, TH2D * > > &h_input_2PDown)
Definition: MakeQuarkGluonFractionPlots.cxx:268
config_1PointSyst::folder_v
std::string folder_v
Definition: MakeQuarkGluonFractionPlots.h:33
athena.value
value
Definition: athena.py:122
MakeQuarkGluonFractionPlots.h
MakeQuarkGluonFractionPlots::decodeFloat
bool decodeFloat(TXMLEngine xml, XMLAttrPointer_t attr, std::string match, float &value)
Definition: MakeQuarkGluonFractionPlots.cxx:643
MakeQuarkGluonFractionPlots::DumpFileToMap
void DumpFileToMap(std::map< std::string, TH2D * > &h_map, std::string filename, std::string channel, std::string folder, std::string keyname, bool createMap)
Definition: MakeQuarkGluonFractionPlots.cxx:231
MakeQuarkGluonFractionPlots::decodeString
bool decodeString(TXMLEngine xml, XMLAttrPointer_t attr, std::string match, std::string &value)
Definition: MakeQuarkGluonFractionPlots.cxx:649
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
MakeQuarkGluonFractionPlots::drawhistos
void drawhistos(const std::map< std::string, TH2D * > &histos, const std::string &psfilename)
Definition: MakeQuarkGluonFractionPlots.cxx:178
x
#define x
ExtractEBRunDetails.xml
xml
Definition: ExtractEBRunDetails.py:239
MakeQuarkGluonFractionPlots::checkFile
void checkFile(std::string filename)
Definition: MakeQuarkGluonFractionPlots.cxx:766
grepfile.content
string content
Definition: grepfile.py:56
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Trk::binY
@ binY
Definition: BinningType.h:48
MakeQuarkGluonFractionPlots::extractJetNumber
std::string extractJetNumber(const std::string &histoname)
Definition: MakeQuarkGluonFractionPlots.cxx:583
MakeQuarkGluonFractionPlots::getDelta
std::vector< TH2D * > getDelta(const std::vector< TH2D * > &h_nom, std::vector< TH2D * > h_var, double scale, const std::string &prehistname)
Definition: MakeQuarkGluonFractionPlots.cxx:340
MakeQuarkGluonFractionPlots::decodeBool
bool decodeBool(TXMLEngine xml, XMLAttrPointer_t attr, std::string match, bool &value)
Definition: MakeQuarkGluonFractionPlots.cxx:655
PixelAthClusterMonAlgCfg.histname
histname
Definition: PixelAthClusterMonAlgCfg.py:106
config_2PointSyst::name
std::string name
Definition: MakeQuarkGluonFractionPlots.h:37
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
MakeQuarkGluonFractionPlots::m_OutputFile
std::string m_OutputFile
Definition: MakeQuarkGluonFractionPlots.h:106
lumiFormat.i
int i
Definition: lumiFormat.py:92
CreatePhysValWebPage.hs
hs
Definition: CreatePhysValWebPage.py:107
MakeQuarkGluonFractionPlots::m_config2PointVec
std::vector< config_2PointSyst > m_config2PointVec
Definition: MakeQuarkGluonFractionPlots.h:113
MakeQuarkGluonFractionPlots::m_config1PointVec
std::vector< config_1PointSyst > m_config1PointVec
Definition: MakeQuarkGluonFractionPlots.h:112
dqt_zlumi_alleff_HIST.fout
fout
Definition: dqt_zlumi_alleff_HIST.py:59
extractSporadic.h
list h
Definition: extractSporadic.py:97
config_2PointSyst::scalefactor
float scalefactor
Definition: MakeQuarkGluonFractionPlots.h:41
config_1PointSyst::variation
std::string variation
Definition: MakeQuarkGluonFractionPlots.h:30
TH2D
Definition: rootspy.cxx:430
MakeQuarkGluonFractionPlots::readXMLNode
void readXMLNode(TXMLEngine xml, XMLNodePointer_t node)
Definition: MakeQuarkGluonFractionPlots.cxx:683
Trk::binX
@ binX
Definition: BinningType.h:47
config_NominalInput::path
std::string path
Definition: MakeQuarkGluonFractionPlots.h:23
MakeQuarkGluonFractionPlots::evaluateQGFUncertaity
std::vector< TH2D * > evaluateQGFUncertaity(const std::vector< std::vector< TH2D * > > &f_1P, const std::vector< std::vector< TH2D * > > &f_2PUp, const std::vector< std::vector< TH2D * > > &f_2PDown, const std::string &channel)
Definition: MakeQuarkGluonFractionPlots.cxx:360
beamspotman.dir
string dir
Definition: beamspotman.py:623
min
#define min(a, b)
Definition: cfImp.cxx:40
config_1PointSyst::name
std::string name
Definition: MakeQuarkGluonFractionPlots.h:28
MakeQuarkGluonFractionPlots::createOutputFile
void createOutputFile(std::string filename, std::vector< TH2D * > histos, std::vector< TH2D * > histosUnc)
Definition: MakeQuarkGluonFractionPlots.cxx:202
PixelAthHitMonAlgCfg.histoname
string histoname
Definition: PixelAthHitMonAlgCfg.py:139
MakeQuarkGluonFractionPlots::computeQuarkGluonFraction
std::vector< TH2D * > computeQuarkGluonFraction(std::map< std::string, TH2D * > inputhistos, const std::string &quarkflavour, const std::string &prename)
Definition: MakeQuarkGluonFractionPlots.cxx:502
MakeQuarkGluonFractionPlots::m_mergechannels
bool m_mergechannels
Definition: MakeQuarkGluonFractionPlots.h:115
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
gErrorIgnoreLevel
int gErrorIgnoreLevel
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:71
config_2PointSyst::folder_c
std::string folder_c
Definition: MakeQuarkGluonFractionPlots.h:42
MakeQuarkGluonFractionPlots::m_channel
std::vector< std::string > m_channel
Definition: MakeQuarkGluonFractionPlots.h:100
python.PyAthena.v
v
Definition: PyAthena.py:157
MakeQuarkGluonFractionPlots::DumpToMap
void DumpToMap(std::map< std::string, TH2D * > &h_map, const std::string &filename, const std::string &channel, const std::string &folder, const std::string &keyname, bool createMap)
Definition: MakeQuarkGluonFractionPlots.cxx:213
y
#define y
h
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
config_1PointSyst::scalefactor
float scalefactor
Definition: MakeQuarkGluonFractionPlots.h:31
JetCollection
Container for Jets
Definition: JetCollection.h:30
DeMoScan.first
bool first
Definition: DeMoScan.py:534
MakeQuarkGluonFractionPlots::m_configNominal
config_NominalInput m_configNominal
Definition: MakeQuarkGluonFractionPlots.h:111
config_NominalInput::folder
std::string folder
Definition: MakeQuarkGluonFractionPlots.h:24
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
MakeQuarkGluonFractionPlots::AbortXMLDecode
void AbortXMLDecode(const std::string &value)
Definition: MakeQuarkGluonFractionPlots.cxx:638
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
checkCorrelInHIST.histos
dictionary histos
Definition: checkCorrelInHIST.py:413
collisions.reader
reader
read the goodrunslist xml file(s)
Definition: collisions.py:22
test_pyathena.counter
counter
Definition: test_pyathena.py:15
config_1PointSyst
Definition: MakeQuarkGluonFractionPlots.h:26
python.compressB64.c
def c
Definition: compressB64.py:93
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
MakeQuarkGluonFractionPlots::readXMLConfigFile
void readXMLConfigFile(const std::string &configfile)
Definition: MakeQuarkGluonFractionPlots.cxx:668
JetCollection
JetCollection
Definition: JetEventTPCnv.cxx:52
config_1PointSyst::folder_c
std::string folder_c
Definition: MakeQuarkGluonFractionPlots.h:32
node
Definition: memory_hooks-stdcmalloc.h:74
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356
MakeQuarkGluonFractionPlots::MakeQuarkGluonFractionPlots
MakeQuarkGluonFractionPlots(const std::string &configfile)
Definition: MakeQuarkGluonFractionPlots.cxx:18
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
config_2PointSyst
Definition: MakeQuarkGluonFractionPlots.h:35