ATLAS Offline Software
MakeQuarkGluonFractionPlots.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 //Author: Regina Moles Valls - <regina.moles.valls@cern.ch>
5 //R21 migration: Matteo Scornajenghi - <matteo.scornajenghi@cern.ch>
6 
7 #ifndef MAKEQUARKGLUONFRACTIONPLOTS_H
8 #define MAKEQUARKGLUONFRACTIONPLOTS_H
9 
10 
11 #include "TXMLEngine.h"//typedefs for XMLNodePointer_t, XMLAttrPointer_t
12 #include <map>
13 #include <string>
14 #include <vector>
15 
16 class TH2D;
17 
18 // ===============================================================================
19 // Macro to compute the gluon initiated jets fraction in your sample/selection
20 // ===============================================================================
22  config_NominalInput(): path(""),folder("JetFlavorPlots"){}
23  std::string path;
24  std::string folder;
25 };
27  config_1PointSyst(): name(""),central(""),variation(""),scalefactor(1),folder_c("JetFlavorPlots"),folder_v("JetFlavorPlots"){}
28  std::string name;
29  std::string central;
30  std::string variation;
31  float scalefactor{};
32  std::string folder_c;
33  std::string folder_v;
34 };
36  config_2PointSyst(): name(""),central(""),variation_up(""),variation_down(""),scalefactor(1),folder_c("JetFlavorPlots"),folder_up("JetFlavorPlots"),folder_down("JetFlavorPlots"){}
37  std::string name;
38  std::string central;
39  std::string variation_up;
40  std::string variation_down;
41  float scalefactor{};
42  std::string folder_c;
43  std::string folder_up;
44  std::string folder_down;
45 };
46 
48 
49  public:
50 //new functions
51  void printXMLConfigFile();
52  void readXMLConfigFile(const std::string& configfile);
53  void readXMLNode(TXMLEngine xml, XMLNodePointer_t node);
54  bool decodeBool(TXMLEngine xml, XMLAttrPointer_t attr, std::string match, bool &value);
55  bool decodeString(TXMLEngine xml, XMLAttrPointer_t attr, std::string match, std::string &value);
56  bool decodeFloat(TXMLEngine xml, XMLAttrPointer_t attr, std::string match, float &value);
57  void AbortXMLDecode(const std::string& value);
58 //end new
59 
60  //function that reads the configuration file and makes the gluon fraction plots
61  MakeQuarkGluonFractionPlots(const std::string& configfile);
62 
63  //function to check if the file exists
64  void checkFile(std::string filename);
65 
66  //function to draw histograms from a map
67  void drawhistos(const std::map<std::string, TH2D*> & histos, const std::string& psfilename);
68  //function to draw histograms from a vector
69  void drawhistos(const std::vector<TH2D*> & histos, const std::string& psfilename);
70 
71  //function to extract the JetCollectionName
72  std::string extractJetCollectionName(const std::string& histoname);
73 
74  //function to extract the JetNumber
75  std::string extractJetNumber(const std::string & histoname);
76 
77  //function to compute the gluon fraction
78  std::vector<TH2D*> computeQuarkGluonFraction (std::map< std::string,TH2D* > inputhistos, const std::string& quarkflavour, const std::string& prename);
79 
80  //function to create the output file
81  void createOutputFile(std::string filename,std::vector<TH2D*> histos, std::vector<TH2D*> histosUnc );
82 
83  //Subtract
84  std::vector<TH2D*> getDelta (const std::vector<TH2D*> & h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname);
85 
86  //function to compute the total systematic uncertainty
87  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);
88 
89 
90 
91 
92  private:
93  // QuarkGluon fraction can be calculated respect to different quark flavours
94  // light: computed only talking into account light quarks (gluons/light-quarks)
95  // lightC default): computed only talking into account light quarks (gluons/light-quarks+c-quarks)
96  // lightCB: computed only talking into account light quarks (gluons/light-quarks+c-quarks+b-quarks)
97  std::string m_doGluVsFlavour;
98 
99  // channel:name of the folder where the histograms has been stored: ee, mumu, emu, mujets, ejets...
100  std::vector<std::string> m_channel;
101 
102  //compute the gluon fraction versus jet multiplicity
104 
105  // name of the output file
106  std::string m_OutputFile;
107 
108  // store plots in PS files
109  bool m_doPS{};
110 
112  std::vector<config_1PointSyst> m_config1PointVec;
113  std::vector<config_2PointSyst> m_config2PointVec;
114 
116 
117  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);
118  void DumpFileToMap(std::map<std::string, TH2D*> &h_map, std::string filename, std::string channel, std::string folder, std::string keyname, bool createMap);
119  void CreateQGFFile(const std::string& prename, const std::map<std::string, TH2D*>& h_input,
120  const std::vector< std::map<std::string, TH2D*> > & h_input_1P,
121  const std::vector< std::map<std::string, TH2D*> > & h_input_1PVar,
122  const std::vector< std::map<std::string, TH2D*> > & h_input_2P,
123  const std::vector< std::map<std::string, TH2D*> > & h_input_2PUp,
124  const std::vector< std::map<std::string, TH2D*> > & h_input_2PDown);
125 
126 };
127 
128 
129 #endif
130 
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
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
MakeQuarkGluonFractionPlots::m_doPS
bool m_doPS
Definition: MakeQuarkGluonFractionPlots.h:109
MakeQuarkGluonFractionPlots
Definition: MakeQuarkGluonFractionPlots.h:47
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::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
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
config_NominalInput::config_NominalInput
config_NominalInput()
Definition: MakeQuarkGluonFractionPlots.h:22
ExtractEBRunDetails.xml
xml
Definition: ExtractEBRunDetails.py:239
MakeQuarkGluonFractionPlots::checkFile
void checkFile(std::string filename)
Definition: MakeQuarkGluonFractionPlots.cxx:766
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
config_2PointSyst::name
std::string name
Definition: MakeQuarkGluonFractionPlots.h:37
MakeQuarkGluonFractionPlots::m_OutputFile
std::string m_OutputFile
Definition: MakeQuarkGluonFractionPlots.h:106
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
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
config_1PointSyst::config_1PointSyst
config_1PointSyst()
Definition: MakeQuarkGluonFractionPlots.h:27
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
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
config_2PointSyst::config_2PointSyst
config_2PointSyst()
Definition: MakeQuarkGluonFractionPlots.h:36
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
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
config_NominalInput
Definition: MakeQuarkGluonFractionPlots.h:21
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
config_1PointSyst::scalefactor
float scalefactor
Definition: MakeQuarkGluonFractionPlots.h:31
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
config_1PointSyst
Definition: MakeQuarkGluonFractionPlots.h:26
MakeQuarkGluonFractionPlots::readXMLConfigFile
void readXMLConfigFile(const std::string &configfile)
Definition: MakeQuarkGluonFractionPlots.cxx:668
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
config_2PointSyst
Definition: MakeQuarkGluonFractionPlots.h:35