30 TFile *outputFile=
new TFile(
"testUnfold5_histograms.root",
"recreate");
36 TFile *binningSchemes=
new TFile(
"testUnfold5_binning.root");
42 binningSchemes->GetObject(
"detector",detectorBinning);
43 binningSchemes->GetObject(
"generator",generatorBinning);
45 delete binningSchemes;
47 detectorBinning->
Write();
48 generatorBinning->
Write();
53 cout<<
"could not read 'detector' binning\n";
55 if(generatorBinning) {
58 cout<<
"could not read 'generator' binning\n";
63 detectorBinning->
FindNode(
"detectordistribution");
66 generatorBinning->
FindNode(
"signal");
69 generatorBinning->
FindNode(
"background");
76 Float_t etaRec,ptRec,discr,etaGen,ptGen;
77 Int_t istriggered,issignal;
84 TFile *dataFile=
new TFile(
"testUnfold5_data.root");
85 TTree *dataTree=(TTree *) dataFile->Get(
"data");
88 cout<<
"could not read 'data' tree\n";
91 dataTree->ResetBranchAddresses();
92 dataTree->SetBranchAddress(
"etarec",&etaRec);
93 dataTree->SetBranchAddress(
"ptrec",&ptRec);
94 dataTree->SetBranchAddress(
"discr",&discr);
96 dataTree->SetBranchAddress(
"istriggered",&istriggered);
98 dataTree->SetBranchAddress(
"etagen",&etaGen);
99 dataTree->SetBranchAddress(
"ptgen",&ptGen);
100 dataTree->SetBranchAddress(
"issignal",&issignal);
101 dataTree->SetBranchStatus(
"*",1);
104 cout<<
"loop over data events\n";
106 for(
Int_t ievent=0;ievent<dataTree->GetEntriesFast();ievent++) {
107 if(dataTree->GetEntry(ievent)<=0)
break;
112 histDataReco->
Fill(binNumber);
118 histDataTruth->
Fill(binNumber);
122 histDataTruth->
Fill(binNumber);
136 (generatorBinning,detectorBinning,
"histMCGenRec");
138 TFile *signalFile=
new TFile(
"testUnfold5_signal.root");
139 TTree *signalTree=(TTree *) signalFile->Get(
"signal");
142 cout<<
"could not read 'signal' tree\n";
145 signalTree->ResetBranchAddresses();
146 signalTree->SetBranchAddress(
"etarec",&etaRec);
147 signalTree->SetBranchAddress(
"ptrec",&ptRec);
148 signalTree->SetBranchAddress(
"discr",&discr);
149 signalTree->SetBranchAddress(
"istriggered",&istriggered);
150 signalTree->SetBranchAddress(
"etagen",&etaGen);
151 signalTree->SetBranchAddress(
"ptgen",&ptGen);
152 signalTree->SetBranchStatus(
"*",1);
154 cout<<
"loop over MC signal events\n";
156 for(
Int_t ievent=0;ievent<signalTree->GetEntriesFast();ievent++) {
157 if(signalTree->GetEntry(ievent)<=0)
break;
168 histMCGenRec->
Fill(genBin,recBin);
174 TFile *bgrFile=
new TFile(
"testUnfold5_background.root");
175 TTree *bgrTree=(TTree *) bgrFile->Get(
"background");
178 cout<<
"could not read 'background' tree\n";
181 bgrTree->ResetBranchAddresses();
182 bgrTree->SetBranchAddress(
"etarec",&etaRec);
183 bgrTree->SetBranchAddress(
"ptrec",&ptRec);
184 bgrTree->SetBranchAddress(
"discr",&discr);
185 bgrTree->SetBranchAddress(
"istriggered",&istriggered);
186 bgrTree->SetBranchStatus(
"*",1);
188 cout<<
"loop over MC background events\n";
190 for(
Int_t ievent=0;ievent<bgrTree->GetEntriesFast();ievent++) {
191 if(bgrTree->GetEntry(ievent)<=0)
break;
200 (ptRec,etaRec,discr);
201 histMCGenRec->
Fill(genBin,recBin);
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
TH1 * CreateHistogram(const char *histogramName, Bool_t originalAxisBinning=kFALSE, Int_t **binMap=0, const char *histogramTitle=0, const char *axisSteering=0) const
void PrintStream(std::ostream &out, Int_t indent=0) const
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.
static TH2D * CreateHistogramOfMigrations(TUnfoldBinning const *xAxis, TUnfoldBinning const *yAxis, char const *histogramName, Bool_t originalXAxisBinning=kFALSE, Bool_t originalYAxisBinning=kFALSE, char const *histogramTitle=0)
This class serves as a container of analysis bins analysis bins are specified by defining the axes of...
Int_t GetGlobalBinNumber(Double_t x) const
Int_t Fill(Double_t)
Invalid Fill method.
TUnfoldBinning const * FindNode(char const *name) const