/* $Id$ */
+const Int_t nPadX = 3, nPadY = 2;
+const Int_t nPtBins=6 ;
+const Double_t ptBinEdges[21]={1., 2., 3., 4., 5., 7., 10.} ;
+
const Double_t kMean=0.136 ; //Approximate peak position to facilitate error estimate
+const char format[] = ".eps"; // say if you want .pdf
+
//-----------------------------------------------------------------------------
-void MakeMmixPi0(const TString filename = "Pi0Flow_000167920.root",
- const TString listPath = "PHOSPi0Flow/PHOSPi0FlowCoutput1",
+void MakeMmixPi0(const TString filename,
+ const TString listPath = "PHOSPi0Flow/PHOSPi0FlowCoutput1", // lego train
const Int_t centrality=0,
- const char* pid="CPV")
+ const char* pid="CPV",
+ const char* saveToDir="")
{
+ Printf("\nMakeMmixPi0(%s, %s, %i, %s, %s)", filename.Data(), listPath.Data(), centrality, pid, saveToDir);
+
//Fit Real/Mixed ratio, normalize Mixed and subtract it from Real
- TFile * f = new TFile(filename) ;
- //TList *histoList = (TList*)f->Get("PHOSPi0Flow");
- TList *histoList = (TList*)f->Get(listPath); // lego train
+ TFile * file = new TFile(filename) ;
+ TList *histoList = (TList*)file->Get(listPath);
char key[125] ;
TH1F * hev = (TH1F*)histoList->FindObject("hTotSelEvents") ;
TH2F * hCentrality = (TH2F*)histoList->FindObject("hCenPHOSCells") ;
- TH1D * hCentrality1 = hCentrality->ProjectionX();
+ TH1D * hCentralityX = hCentrality->ProjectionX();
- printf("TotSelEvents: %f \n",hev->GetBinContent(4)) ;
- printf("Centrality: %f \n",hCentrality1->Integral()) ;
+ printf("TotSelEvents (4): %f \n",hev->GetBinContent(4)) ;
+ printf("Centrality: %f \n",hCentralityX->Integral()) ;
- TString inputKey;
- TString outputKey = Form("%s_cent%d",pid,centrality);
-
- TH2F *h , *hAdd;
- TH2F *hm, *hmAdd;
-
- if (centrality >= 0 && centrality < 4) {
- printf("\tCentrality %d\n",centrality);
- inputKey = Form("hPi0%s_cen%d" ,pid,centrality);
- TH2F *h = (TH2F*)histoList->FindObject(inputKey) ;
- inputKey = Form("hMiPi0%s_cen%d",pid,centrality);
- TH2F *hm= (TH2F*)histoList->FindObject(inputKey) ;
- if (h==0) {
- printf("Missing histogram %s\n",inputKey);
- return;
- }
- }
- else {
- printf("Wrong centrality %d. Allowed values are 0,1,2,3,10.\n",centrality);
+ TH2F *hPi0 = (TH2F*) histoList->FindObject(Form("hPi0%s_cen%d" ,pid,centrality));
+ TH2F *hPi0Mix = (TH2F*) histoList->FindObject(Form("hMiPi0%s_cen%d",pid,centrality)) ;
+ if( !hPi0 || !hPi0Mix || hPi0->GetEntries() < 10000) {
+ Printf(Form("no histogram(0x%x, 0x%x) or to low number of entries(%d) in hPi0, skipping this cent", hPi0, hPi0Mix, hPi0->GetEntries()));
+ file->Close();
+ delete file;
return;
}
+
- Int_t nPadX = 3, nPadY = 2;
- Int_t nPtBins=6 ;
- Double_t ptBinEdges[21]={1., 2., 3., 4., 5., 7., 10.} ;
+ TFile* outFile = new TFile("Pi0_FitResult.root","recreate");
PPRstyle();
gStyle->SetPadLeftMargin(0.14);
//Fit real only
//Linear Bg
char kkey[55];
- sprintf(kkey,outputKey.Data()) ;
+ sprintf(kkey, Form("%s_cent%d",pid,centrality)) ;
char key2[155];
sprintf(key,"Mix%s",kkey) ;
sprintf(key2,"%s_mr1",key) ;
TCanvas * rawCanvas = new TCanvas("rawCanvas","rawCanvas",10,10,1200,800);
rawCanvas->Divide(nPadX, nPadY);
- TAxis * pta=h->GetYaxis() ;
- TAxis * ma=h->GetXaxis() ;
+ TAxis * pta=hPi0->GetYaxis() ;
+ TAxis * ma=hPi0->GetXaxis() ;
for(Int_t ptBin=1; ptBin<=nPtBins; ptBin++){
c1->cd(ptBin) ;
printf("\n\t%.1f<pt<%.1f GeV/c\n",ptBinEdges[ptBin-1],ptBinEdges[ptBin]);
Int_t imin=pta->FindBin(ptBinEdges[ptBin-1]+0.0001);
Int_t imax=pta->FindBin(ptBinEdges[ptBin]-0.0001) ;
Double_t pt=(ptBinEdges[ptBin]+ptBinEdges[ptBin-1])/2. ;
- TH1D * hp = h->ProjectionX(Form("re_%d",ptBin),imin,imax) ;
+ TH1D * hp = hPi0->ProjectionX(Form("re_%d",ptBin),imin,imax) ;
hp->Sumw2() ;
- TH1D * hpm= hm->ProjectionX("mi",imin,imax) ;
+ TH1D * hpm= hPi0Mix->ProjectionX("mi",imin,imax) ;
hpm->Sumw2() ;
if(ptBin<=17){
hp ->Rebin(4) ;
cr2->SetBinContent(ptBin,fit2->GetParameter(5)) ;
cr2->SetBinError (ptBin,fit2->GetParError(5)) ;
hpcopy->GetXaxis()->SetRangeUser(0.05,0.30) ;
- hpcopy->Draw() ;
+ hpcopy->DrawCopy() ;
c1->Update() ;
fbg1->SetParameters(fit1->GetParameter(3),fit1->GetParameter(4),fit1->GetParameter(5));
hpmScaled->Scale(fbg1(0.1349));
hp->SetTitle(key);
hp->SetLineColor(kBlack);
- hp->SetAxisRange(0.05, 0.3);
+ hp->SetAxisRange(0.0, 0.3);
+ //hp->GetYaxis()->SetRangeUser(0.6*hp->GetMaximum(), 1.1*hp->GetMaximum());
hp->DrawCopy();
hpmScaled->SetLineColor(kRed);
hpmScaled->DrawCopy("same");
nr2int->SetBinError(ptBin,TMath::Sqrt(npiInt + norm*errStat + normErr*normErr*errStat*errStat + norm*norm*errStat)) ;
}
hp2->SetTitle(key) ;
- hp2->Draw() ;
+ hp2->DrawCopy() ;
c3->Update() ;
delete hp ;
delete hpm ;
delete hpm2 ;
+ delete hpmScaled;
+ delete hpcopy;
+ delete hp2;
}
- char name[55] ;
- sprintf(name,"Pi0_ratio_%s.eps",kkey) ;
+ if( TString(saveToDir).Length() )
+ gSystem->mkdir(saveToDir, true);
+
+ char name[55] ;
+ sprintf(name,"%sPi0_ratio_%s%s", saveToDir, kkey, format) ;
c1->Print(name) ;
- sprintf(name,"Pi0_signal_%s.eps",kkey) ;
+ sprintf(name,"%sPi0_signal_%s%s", saveToDir, kkey, format) ;
c3->Print(name) ;
+ sprintf(name,"%sPi0_raw_%s%s", saveToDir, kkey, format) ;
+ rawCanvas->Print(name);
//Normalize by the number of events
- Int_t cMin,cMax;
+ Int_t cMin=0, cMax=100;
if (centrality == 0) {
cMin=1;
cMax=10;
}
else if (centrality == 1) {
- cMin=21;
+ cMin=11;
cMax=40;
}
else if (centrality == 2) {
cMin=41;
- cMax=60;
- }
- else if (centrality == 3) {
- cMin=61;
cMax=80;
}
- Double_t nevents = hCentrality1->Integral(cMin,cMax);
+ else {
+ Printf("ERROR: Centrality: %d not defined !!! ERROR", centrality);
+ return;
+ }
+
+ Double_t nevents = hCentralityX->Integral(cMin,cMax);
nr1 ->Scale(1./nevents) ;
nr1int->Scale(1./nevents) ;
nr2 ->Scale(1./nevents) ;
nr2int->Scale(1./nevents) ;
- printf("Nevents=%f \n",nevents) ;
- TFile fout("LHC10h_Pi0_FitResult.root","update");
mr1->Write(0,TObject::kOverwrite) ;
sr1->Write(0,TObject::kOverwrite) ;
ar1->Write(0,TObject::kOverwrite) ;
sr2->Write(0,TObject::kOverwrite) ;
nr2->Write(0,TObject::kOverwrite) ;
nr2int->Write(0,TObject::kOverwrite) ;
- fout.Close() ;
+
+ outFile->Close();
+ delete outFile;
+
+ file->Close();
+ delete file;
+
}
//-----------------------------------------------------------------------------
}
+// For different tasks (e.g. triggers)
+void MakeMmixPi0()
+{
+ for(int cent = 0; cent < 1; ++cent ) {
+ MakeMmixPi0("AnalysisResults.root", "PHOSPi0Flow/PHOSPi0FlowCoutput1", cent, "CPV", "imgs/kCentral/");
+ //MakeMmixPi0("AnalysisResults.root", "AliPHOSPi0Flow_SemiCentral/AliPHOSPi0Flow_SemiCentralCoutput1", cent, "CPV", "imgs/kSemiCentral/");
+ //MakeMmixPi0("AnalysisResults.root", "AliPHOSPi0Flow_MB/AliPHOSPi0Flow_MBCoutput1", cent, "CPV", "imgs/kMB/");
+ //MakeMmixPi0("AnalysisResults.root", "AliPHOSPi0Flow_PHOSPb/AliPHOSPi0Flow_PHOSPbCoutput1", cent, "CPV", "imgs/kPHOSPb/");
+ }
+}