133 if(rnd->
Rndm()>frac) {
134 return rnd->
Gaus(mTrue+smallBias,smallSigma);
136 return rnd->
Gaus(mTrue+wideBias,wideSigma);
149 Double_t const luminosityData=100000;
150 Double_t const luminosityMC=1000000;
153 Int_t const nDet=250;
154 Int_t const nGen=100;
163 TH1D *histMgenMC=
new TH1D(
"MgenMC",
";mass(gen)",nGen,xminGen,xmaxGen);
164 TH1D *histMdetMC=
new TH1D(
"MdetMC",
";mass(det)",nDet,xminDet,xmaxDet);
165 TH2D *histMdetGenMC=
new TH2D(
"MdetgenMC",
";mass(det);mass(gen)",nDet,xminDet,xmaxDet,
166 nGen,xminGen,xmaxGen);
168 for(
Int_t i=0;i<neventMC;i++) {
181 histMgenMC->
Fill(mGen,luminosityData/luminosityMC);
183 histMdetMC->
Fill(mDet,luminosityData/luminosityMC);
198 histMdetGenMC->
Fill(mDet,mGen,luminosityData/luminosityMC);
204 TH1D *histMgenData=
new TH1D(
"MgenData",
";mass(gen)",nGen,xminGen,xmaxGen);
205 TH1D *histMdetData=
new TH1D(
"MdetData",
";mass(det)",nDet,xminDet,xmaxDet);
206 Int_t neventData=rnd->
Poisson(luminosityData*crossSection);
207 for(
Int_t i=0;i<neventData;i++) {
214 histMgenData->
Fill(mGen);
217 histMdetData->
Fill(mDet);
242 Int_t iPeek=(
Int_t)(nGen*(estimatedPeakPosition-xminGen)/(xmaxGen-xminGen)
248 unfold.RegularizeBins(1,1,iPeek-nPeek,regMode);
250 unfold.RegularizeBins(iPeek+nPeek,1,nGen-(iPeek+nPeek),regMode);
256 if(unfold.SetInput(histMdetData,0.0)>=10000) {
257 std::cout<<
"Unfolding result may be wrong\n";
269 iBest=unfold.ScanLcurve(nScan,tauMin,tauMax,&lCurve,&logTauX,&logTauY);
270 std::cout<<
"tau="<<unfold.GetTau()<<
"\n";
271 std::cout<<
"chi**2="<<unfold.GetChi2A()<<
"+"<<unfold.GetChi2L()
272 <<
" / "<<unfold.GetNdf()<<
"\n";
288 for(
Int_t i=1;i<=nGen;i++) binMap[i]=i;
292 TH1D *histMunfold=
new TH1D(
"Unfolded",
";mass(gen)",nGen,xminGen,xmaxGen);
293 unfold.GetOutput(histMunfold,binMap);
294 TH1D *histMdetFold=
new TH1D(
"FoldedBack",
"mass(det)",nDet,xminDet,xmaxDet);
295 unfold.GetFoldedOutput(histMdetFold);
298 TH1D *histRhoi=
new TH1D(
"rho_I",
"mass",nGen,xminGen,xmaxGen);
299 unfold.GetRhoI(histRhoi,binMap);
318 histMdetGenMC->
Draw(
"BOX");
328 histMgenData->
Draw(
"SAME");
329 histMgenMC->
Draw(
"SAME HIST");
337 histMdetFold->
Draw();
339 histMdetData->
Draw(
"SAME");
340 histMdetMC->
Draw(
"SAME HIST");
354 bestLogTauX->
Draw(
"*");
359 bestLcurve->
Draw(
"*");
361 output.
SaveAs(
"testUnfold2.ps");
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
1-D histogram with a double per channel (see TH1 documentation)
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
When this static function is called with sumw2=kTRUE, all new histograms will automatically activate ...
2-D histogram with a double per channel (see TH1 documentation)
Int_t Fill(Double_t) override
Invalid Fill method.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
void SaveAs(const char *filename="", Option_t *option="") const override
Save the pad content in a file.
Random number generator class based on M.
This is the base class for the ROOT Random number generators.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Double_t Rndm() override
Machine independent random number generator.
virtual ULong64_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
Base class for spline implementation containing the Draw/Paint methods.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
virtual void GetKnot(Int_t i, Double_t &x, Double_t &y) const =0
An algorithm to unfold distributions from detector to truth level.
ERegMode
choice of regularisation scheme
@ kRegModeNone
no regularisation, or defined later by RegularizeXXX() methods
@ kRegModeCurvature
regularize the 2nd derivative of the output distribution
@ kHistMapOutputVert
truth level on y-axis of the response matrix
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.