77#ifndef READ_BINNING_CINT
96 TFile *outputFile=
new TFile(
"testUnfold5_histograms.root",
"recreate");
102#ifdef READ_BINNING_CINT
103 TFile *binningSchemes=
new TFile(
"testUnfold5_binning.root");
111#ifndef READ_BINNING_CINT
114 if(error) cout<<
"error="<<error<<
" from TDOMParser\n";
121 binningSchemes->GetObject(
"detector",detectorBinning);
122 binningSchemes->GetObject(
"generator",generatorBinning);
124 delete binningSchemes;
126 detectorBinning->
Write();
127 generatorBinning->
Write();
129 if(detectorBinning) {
132 cout<<
"could not read 'detector' binning\n";
134 if(generatorBinning) {
137 cout<<
"could not read 'generator' binning\n";
142 detectorBinning->
FindNode(
"detectordistribution");
145 generatorBinning->
FindNode(
"signal");
148 generatorBinning->
FindNode(
"background");
155 Float_t etaRec,ptRec,discr,etaGen,ptGen;
156 Int_t istriggered,issignal;
163 TFile *dataFile=
new TFile(
"testUnfold5_data.root");
164 TTree *dataTree=(TTree *) dataFile->Get(
"data");
167 cout<<
"could not read 'data' tree\n";
170 dataTree->ResetBranchAddresses();
171 dataTree->SetBranchAddress(
"etarec",&etaRec);
172 dataTree->SetBranchAddress(
"ptrec",&ptRec);
173 dataTree->SetBranchAddress(
"discr",&discr);
175 dataTree->SetBranchAddress(
"istriggered",&istriggered);
177 dataTree->SetBranchAddress(
"etagen",&etaGen);
178 dataTree->SetBranchAddress(
"ptgen",&ptGen);
179 dataTree->SetBranchAddress(
"issignal",&issignal);
180 dataTree->SetBranchStatus(
"*",1);
183 cout<<
"loop over data events\n";
185 for(
Int_t ievent=0;ievent<dataTree->GetEntriesFast();ievent++) {
186 if(dataTree->GetEntry(ievent)<=0)
break;
191 histDataReco->
Fill(binNumber);
197 histDataTruth->
Fill(binNumber);
201 histDataTruth->
Fill(binNumber);
215 (generatorBinning,detectorBinning,
"histMCGenRec");
217 TFile *signalFile=
new TFile(
"testUnfold5_signal.root");
218 TTree *signalTree=(TTree *) signalFile->Get(
"signal");
221 cout<<
"could not read 'signal' tree\n";
224 signalTree->ResetBranchAddresses();
225 signalTree->SetBranchAddress(
"etarec",&etaRec);
226 signalTree->SetBranchAddress(
"ptrec",&ptRec);
227 signalTree->SetBranchAddress(
"discr",&discr);
228 signalTree->SetBranchAddress(
"istriggered",&istriggered);
229 signalTree->SetBranchAddress(
"etagen",&etaGen);
230 signalTree->SetBranchAddress(
"ptgen",&ptGen);
231 signalTree->SetBranchStatus(
"*",1);
233 cout<<
"loop over MC signal events\n";
235 for(
Int_t ievent=0;ievent<signalTree->GetEntriesFast();ievent++) {
236 if(signalTree->GetEntry(ievent)<=0)
break;
247 histMCGenRec->
Fill(genBin,recBin);
253 TFile *bgrFile=
new TFile(
"testUnfold5_background.root");
254 TTree *bgrTree=(TTree *) bgrFile->Get(
"background");
257 cout<<
"could not read 'background' tree\n";
260 bgrTree->ResetBranchAddresses();
261 bgrTree->SetBranchAddress(
"etarec",&etaRec);
262 bgrTree->SetBranchAddress(
"ptrec",&ptRec);
263 bgrTree->SetBranchAddress(
"discr",&discr);
264 bgrTree->SetBranchAddress(
"istriggered",&istriggered);
265 bgrTree->SetBranchStatus(
"*",1);
267 cout<<
"loop over MC background events\n";
269 for(
Int_t ievent=0;ievent<bgrTree->GetEntriesFast();ievent++) {
270 if(bgrTree->GetEntry(ievent)<=0)
break;
279 (ptRec,etaRec,discr);
280 histMCGenRec->
Fill(genBin,recBin);
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
virtual Int_t ParseFile(const char *filename)
Parse the XML file where filename is the XML file name.
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-Dim histogram classes.
Int_t Fill(Double_t)
Invalid Fill method.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
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=0, const char *histogramTitle=0, const char *axisSteering=0) 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=0)
Create a TH2D histogram capable to hold the bins of the two input binning schemes on the x and y axes...
TUnfoldBinning const * FindNode(char const *name) const
Traverse the tree and return the first node which matches the given name.
TXMLDocument contains a pointer to an xmlDoc structure, after the parser returns a tree built during ...