106 TFile *outputFile=
new TFile(
"testUnfold7_histograms.root",
"recreate");
122 cout<<
"error="<<error<<
" from TDOMParser\n";
123 cout<<
"==============================================================\n";
124 cout<<
"Maybe the file testUnfold7binning.xml is missing?\n";
125 cout<<
"The content of the file is included in the comments section\n";
126 cout<<
"of this macro \"testUnfold7b.C\"\n";
127 cout<<
"==============================================================\n";
136 fineBinningRoot->
Write();
137 coarseBinningRoot->
Write();
139 if(fineBinningRoot) {
142 cout<<
"could not read 'detector' binning\n";
144 if(coarseBinningRoot) {
147 cout<<
"could not read 'generator' binning\n";
157 Float_t ptRec[3],ptGen[3],weight;
158 Int_t isTriggered,isSignal;
168 TFile *dataFile=
new TFile(
"testUnfold7_data.root");
172 cout<<
"could not read 'data' tree\n";
185 cout<<
"loop over data events\n";
187#define VAR_REC (ptRec[2])
188#define VAR_GEN (ptGen[2])
191 if(dataTree->
GetEntry(ievent)<=0)
break;
196 histDataRecF->
Fill(binF);
197 histDataRecC->
Fill(binC);
199 histDataBgrF->
Fill(binF);
200 histDataBgrC->
Fill(binC);
206 histDataGen->
Fill(binGen);
220 (coarseBinning,fineBinning,
"histMcsigGenRecF");
222 (coarseBinning,coarseBinning,
"histMcsigGenRecC");
227 TFile *signalFile=
new TFile(
"testUnfold7_signal.root");
231 cout<<
"could not read 'signal' tree\n";
242 cout<<
"loop over MC signal events\n";
245 if(signalTree->
GetEntry(ievent)<=0)
break;
253 histMcsigGenRecF->
Fill(binGen,binF,weight);
254 histMcsigGenRecC->
Fill(binGen,binC,weight);
255 histMcsigRecF->
Fill(binF,weight);
256 histMcsigRecC->
Fill(binC,weight);
257 histMcsigGen->
Fill(binGen,weight);
268 TFile *bgrFile=
new TFile(
"testUnfold7_background.root");
272 cout<<
"could not read 'background' tree\n";
282 cout<<
"loop over MC background events\n";
285 if(bgrTree->
GetEntry(ievent)<=0)
break;
292 histMcbgrRecF->
Fill(binF,weight);
293 histMcbgrRecC->
Fill(binC,weight);
R__EXTERN TSystem * gSystem
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
Int_t ParseFile(const char *filename) override
Parse the XML file where filename is the XML file name.
Bool_t cd() override
Change current directory to "this" directory.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsiz=0) override
Write memory objects to this file.
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
When this static function is called with sumw2=kTRUE, all new histograms will automatically activate ...
Service class for 2-D histogram classes.
Int_t Fill(Double_t) override
Invalid Fill method.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
A TTree represents a columnar dataset.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
virtual void SetBranchStatus(const char *bname, Bool_t status=1, UInt_t *found=nullptr)
Set branch status to Process or DoNotProcess.
virtual Long64_t GetEntriesFast() const
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
static TUnfoldBinningXML * ImportXML(const TXMLDocument *document, const char *name)
Import a binning scheme from an XML file.
Binning schemes for use with the unfolding algorithm TUnfoldDensity.
void PrintStream(std::ostream &out, Int_t indent=0, int debug=0) const
Print some information about this binning tree.
TH1 * CreateHistogram(const char *histogramName, Bool_t originalAxisBinning=kFALSE, Int_t **binMap=nullptr, const char *histogramTitle=nullptr, const char *axisSteering=nullptr) const
Create a THxx histogram capable to hold the bins of this binning node and its children.
Int_t GetGlobalBinNumber(Double_t x) const
Locate a bin in a one-dimensional distribution.
static TH2D * CreateHistogramOfMigrations(TUnfoldBinning const *xAxis, TUnfoldBinning const *yAxis, char const *histogramName, Bool_t originalXAxisBinning=kFALSE, Bool_t originalYAxisBinning=kFALSE, char const *histogramTitle=nullptr)
Create a TH2D histogram capable to hold the bins of the two input binning schemes on the x and y axes...
TXMLDocument contains a pointer to an xmlDoc structure, after the parser returns a tree built during ...