#include <TCanvas.h>
#include <TH3F.h>
#include <TH2F.h>
+#include <TMath.h>
#include <AliLog.h>
#include "AliCorrectionMatrix2D.h"
return;
}
+ // third axis for track histogram
Int_t nBinsN2 = 1;
Float_t binLimitsN2[] = {-0.5, 1000};
+ const char* title3 = "Ntracks";
//Int_t nBinsN2 = 21;
//Float_t binLimitsN2[] = {-0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 12.5, 14.5, 16.5, 18.5, 20.5, 25.5, 30.5, 40.5, 50.5, 100.5, 1000.5};
+ // phi
+ //Int_t nBinsN2 = 36;
+ //Float_t binLimitsN2[] = {0.000, 0.175, 0.349, 0.524, 0.698, 0.873, 1.047, 1.222, 1.396, 1.571, 1.745, 1.920, 2.094, 2.269, 2.443, 2.618, 2.793, 2.967, 3.142, 3.316, 3.491, 3.665, 3.840, 4.014, 4.189, 4.363, 4.538, 4.712, 4.887, 5.061, 5.236, 5.411, 5.585, 5.760, 5.934, 6.109, TMath::Pi() * 2};
+ //const char* title3 = "#phi";
+
+ // mult axis for event histogram
Int_t nBinsN = 22;
Float_t binLimitsN[] = {-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 12.5, 14.5, 16.5, 18.5, 20.5, 25.5, 30.5, 40.5, 50.5, 100.5, 300.5};
//Int_t nBinsN = 52;
//Float_t binLimitsVtx[] = {-20,-15,-10,-6,-3,0,3,6,10,15,20};
//Float_t binLimitsVtx[] = {-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
Float_t binLimitsVtx[] = {-30,-25,-20,-15,-10,-8,-6,-4,-2,0,2,4,6,8,10,15,20,25,30};
- Float_t binLimitsEta[] = {-3.0,-2.8,-2.6,-2.4,-2.2,
+ /*Float_t binLimitsEta[] = {-3.0,-2.8,-2.6,-2.4,-2.2,
-2.0,-1.8,-1.6,-1.4,-1.2,
-1.0,-0.8,-0.6,-0.4,-0.2, 0.0,
0.2, 0.4, 0.6, 0.8, 1.0,
1.2, 1.4, 1.6, 1.8, 2.0,
- 2.2, 2.4, 2.6, 2.8, 3.0};
+ 2.2, 2.4, 2.6, 2.8, 3.0};*/
+ Float_t binLimitsEta[] = { -3.0, -2.9, -2.8, -2.7, -2.6, -2.5, -2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, -0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0 };
// Float_t binLimitsEta[] = {-2,-1.8,-1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0};
// Float_t binLimitsEta[] = {-2,-1.9,-1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,-1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0};
// Float_t binLimitsEta[] = { -7.0, -6.9, -6.8, -6.7, -6.6, -6.5, -6.4, -6.3, -6.2, -6.1, -6.0, -5.9, -5.8, -5.7, -5.6, -5.5, -5.4, -5.3, -5.2, -5.1, -5.0, -4.9, -4.8, -4.7, -4.6, -4.5, -4.4, -4.3, -4.2, -4.1, -4.0, -3.9, -3.8, -3.7, -3.6, -3.5, -3.4, -3.3, -3.2, -3.1, -3.0, -2.9, -2.8, -2.7, -2.6, -2.5, -2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, -0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0 };
if (analysisMode == AliPWG0Helper::kSPD)
{
- TH3F* dummyBinning = new TH3F("dummyBinning","dummyBinning",18, binLimitsVtx, 30, binLimitsEta, nBinsN2, binLimitsN2);
+ TH3F* dummyBinning = new TH3F("dummyBinning","dummyBinning",18, binLimitsVtx, 60, binLimitsEta, nBinsN2, binLimitsN2);
fTrackCorr = new AliCorrectionMatrix3D("TrackCorrection", Form("%s TrackCorrection", fTitle.Data()), dummyBinning);
- fTrackCorr->SetAxisTitles("vtx z [cm]", "#eta", "Ntracks");
+ fTrackCorr->SetAxisTitles("vtx-z (cm)", "#eta", title3);
delete dummyBinning;
}
else
{
- TH3F* dummyBinning = new TH3F("dummyBinning","dummyBinning",18, binLimitsVtx, 30, binLimitsEta , nBinsPt, binLimitsPt);
+ TH3F* dummyBinning = new TH3F("dummyBinning","dummyBinning",18, binLimitsVtx, 60, binLimitsEta , nBinsPt, binLimitsPt);
fTrackCorr = new AliCorrectionMatrix3D("TrackCorrection", Form("%s TrackCorrection", fTitle.Data()), dummyBinning);
- fTrackCorr->SetAxisTitles("vtx z [cm]", "#eta", "p_{T} [GeV/c]");
+ fTrackCorr->SetAxisTitles("vtx-z (cm)", "#eta", "p_{T} (GeV/c)");
delete dummyBinning;
}
- fEventCorr->SetAxisTitles("vtx z [cm]", "Ntracks");
+ fEventCorr->SetAxisTitles("vtx-z (cm)", "Ntracks");
}
//____________________________________________________________________
fEventCorr->Divide();
fTrackCorr->Divide();
- Int_t emptyBins = fTrackCorr->CheckEmptyBins(-9.99, 9.99, -0.79, 0.79, 0.3, 4.9);
+ Int_t emptyBins = fTrackCorr->CheckEmptyBins(-9.99, 9.99, -0.79, 0.79, 0.2, 4.9);
printf("INFO: In the central region the track correction of %s has %d empty bins\n", GetName(), emptyBins);
}
//
#include <TH2F.h>
+#include <TMath.h>
#include <AliLog.h>
}
//____________________________________________________________________
-TH1* AliCorrectionMatrix2D::Get1DCorrectionHistogram(const Char_t* opt, Float_t min, Float_t max)
+TH1* AliCorrectionMatrix2D::Get1DCorrectionHistogram(const Char_t* opt, Float_t min, Float_t max, Bool_t binomialErrors)
{
//
// integrate the correction over one variable
return 0;
}
- gene1D->Sumw2();
-
+ if (!binomialErrors)
+ {
+ // set the errors on gene manually, and clear the ones on meas.
+ gene1D->Sumw2();
+ for (Int_t bin=0; bin <= gene1D->GetNbinsX()+1; bin++)
+ {
+ gene1D->SetBinError(bin, TMath::Sqrt(gene1D->GetBinContent(bin)));
+ meas1D->SetBinError(bin, 0);
+ }
+ }
+
gene1D->SetName(Form("corr_1D_%s",fName.Data()));
gene1D->SetTitle(Form("corr_1D_%s",fName.Data()));
TH1* divided = (TH1*) gene1D->Clone(Form("corr_1D_%s",fName.Data()));
divided->Reset();
-
- divided->Divide(gene1D, meas1D, 1, 1, "B");
+
+ divided->Divide(gene1D, meas1D, 1, 1, (binomialErrors) ? "B" : "");
Printf("%p %p", gene1D, meas1D);
TH2* GetCorrectionHistogram() {return (TH2*)fhCorr;}
TH1* Get1DCorrection(const Char_t* opt="x", Float_t min=0, Float_t max=0) {return Get1DCorrectionHistogram(opt,min,max);}
- TH1* Get1DCorrectionHistogram(const Char_t* opt="x", Float_t min=0, Float_t max=0);
+ TH1* Get1DCorrectionHistogram(const Char_t* opt="x", Float_t min=0, Float_t max=0, Bool_t binomialErrors = kFALSE);
void Rebin(Int_t x = 1, Int_t y = 1);
#include <TH2F.h>
#include <TH3F.h>
#include <TString.h>
+#include <TMath.h>
#include <AliLog.h>
TH2F* meas = (TH2F*) ((TH3F*)fhMeas)->Project3D(option)->Clone(Form("%s_meas", corr2D->GetName()));
TH2F* gene = (TH2F*) ((TH3F*)fhGene)->Project3D(option)->Clone(Form("%s_gene", corr2D->GetName()));
+
+ // set errors
+ for (Int_t x = 0; x<=meas->GetNbinsX()+1; x++)
+ for (Int_t y = 0; y<=meas->GetNbinsY()+1; y++)
+ {
+ gene->SetBinError(x, y, TMath::Sqrt(gene->GetBinContent(x, y)));
+ meas->SetBinError(x, y, TMath::Sqrt(meas->GetBinContent(x, y)));
+ }
TH2F* corr = (TH2F*)gene->Clone(Form("%s_corr", corr2D->GetName()));
corr->Reset();
TH1* AliCorrectionMatrix3D::Get1DCorrectionHistogram(Option_t* opt, Float_t aMin1, Float_t aMax1, Float_t aMin2, Float_t aMax2)
{
// returns a 1D projection of this correction
- AliDebug(AliLog::kWarning, Form("WARNING: test"));
- AliCorrectionMatrix2D* corr2D;
+ AliCorrectionMatrix2D* corr2D = 0;
if (strcmp(opt,"x")==0) {
- corr2D = Get2DCorrection("yx",aMin1,aMax1);
- return corr2D->Get1DCorrectionHistogram("x",aMin2,aMax2);
+ corr2D = Get2DCorrection("yx",aMin2,aMax2);
+ return corr2D->Get1DCorrectionHistogram("x",aMin1,aMax1);
}
if (strcmp(opt,"y")==0) {
- corr2D = Get2DCorrection("xy",aMin1,aMax1);
- return corr2D->Get1DCorrectionHistogram("x",aMin2,aMax2);
+ corr2D = Get2DCorrection("xy",aMin2,aMax2);
+ return corr2D->Get1DCorrectionHistogram("x",aMin1,aMax1);
}
if (strcmp(opt,"z")==0) {
corr2D = Get2DCorrection("yz",aMin1,aMax1);
TH3* GetCorrectionHistogram();
AliCorrectionMatrix2D* Get2DCorrection(Option_t* opt, Float_t aMin, Float_t aMax);
- TH2* Get2DCorrectionHistogram(Option_t* opt, Float_t aMin, Float_t aMax) {return Get2DCorrection(opt,aMin,aMax)->GetCorrectionHistogram();}
+ TH2* Get2DCorrectionHistogram(Option_t* opt, Float_t aMin, Float_t aMax) {return Get2DCorrection(opt,aMin,aMax)->GetCorrectionHistogram();}
TH1* Get1DCorrectionHistogram(Option_t* opt, Float_t aMins1=0, Float_t aMax1=0, Float_t aMins2=0, Float_t aMax2=0);
void FillMeas(Float_t ax, Float_t ay, Float_t az);
#include <AliESDEvent.h>
#include <AliESDVertex.h>
#include <AliVertexerTracks.h>
+#include <AliMultiplicity.h>
#include <AliGenEventHeader.h>
#include <AliGenPythiaEventHeader.h>
#include <AliGenCocktailEventHeader.h>
#include <AliGenDPMjetEventHeader.h>
+#include <AliESDVZERO.h>
//____________________________________________________________________
ClassImp(AliPWG0Helper)
Int_t AliPWG0Helper::fgLastProcessType = -1;
//____________________________________________________________________
-Bool_t AliPWG0Helper::IsEventTriggered(const AliESD* aEsd, Trigger trigger)
+Bool_t AliPWG0Helper::IsEventTriggered(const AliESDEvent* aEsd, Trigger trigger)
{
- // see function with ULong64_t argument
+ // checks if an event has been triggered
+ // this function implements the "offline" methods that use the ESD, other trigger requests are passed to the function prototype with ULong_t
- ULong64_t triggerMask = aEsd->GetTriggerMask();
- return IsEventTriggered(triggerMask, trigger);
+ Int_t firedChips = 0;
+ Bool_t v0A = kFALSE;
+ Bool_t v0C = kFALSE;
+
+ // offline triggers have to be dealt with here, because we need the esd pointer
+ if (trigger == kOfflineFASTOR || trigger == kOfflineMB1 || trigger == kOfflineMB2 || trigger == kOfflineMB3)
+ {
+ const AliMultiplicity* mult = aEsd->GetMultiplicity();
+ if (!mult)
+ {
+ Printf("AliPWG0Helper::IsEventTriggered: ERROR: AliMultiplicity not available");
+ return kFALSE;
+ }
+ firedChips = mult->GetNumberOfFiredChips(0) + mult->GetNumberOfFiredChips(1);
+ }
+ if (trigger == kOfflineMB1 || trigger == kOfflineMB2 || trigger == kOfflineMB3)
+ {
+ AliESDVZERO* v0Data = aEsd->GetVZEROData();
+ if (!v0Data)
+ {
+ Printf("AliPWG0Helper::IsEventTriggered: ERROR: AliESDVZERO not available");
+ return kFALSE;
+ }
+ for (Int_t i=0; i<32; i++)
+ {
+ if (v0Data->BBTriggerV0A(i))
+ v0A = kTRUE;
+ if (v0Data->BBTriggerV0C(i))
+ v0C = kTRUE;
+ }
+ }
+
+ switch (trigger)
+ {
+ case kOfflineFASTOR:
+ {
+ if (firedChips > 0)
+ return kTRUE;
+ break;
+ }
+ case kOfflineMB1:
+ {
+ if ((firedChips > 0) || v0A || v0C)
+ return kTRUE;
+ break;
+ }
+ case kOfflineMB2:
+ {
+ if ((firedChips > 0) && (v0A || v0C))
+ return kTRUE;
+ break;
+ }
+ case kOfflineMB3:
+ {
+ if ((firedChips > 0) && v0A && v0C)
+ return kTRUE;
+ break;
+ }
+ default:
+ {
+ return IsEventTriggered(aEsd->GetTriggerMask(), trigger);
+ break;
+ }
+ }
+
+ return kFALSE;
}
//____________________________________________________________________
// definitions from p-p.cfg
ULong64_t spdFO = (1 << 14);
- ULong64_t v0left = (1 << 11);
- ULong64_t v0right = (1 << 12);
+ ULong64_t v0left = (1 << 10);
+ ULong64_t v0right = (1 << 11);
switch (trigger)
{
return kTRUE;
break;
}
+ case kMB3:
+ {
+ if (triggerMask & spdFO && (triggerMask & v0left) && (triggerMask & v0right))
+ return kTRUE;
+ break;
+ }
case kSPDFASTOR:
{
if (triggerMask & spdFO)
return kTRUE;
break;
}
+ default:
+ Printf("IsEventTriggered: ERROR: Trigger type %d not implemented in this method", (Int_t) trigger);
+ break;
}
return kFALSE;
}
//____________________________________________________________________
-const AliESDVertex* AliPWG0Helper::GetVertex(AliESDEvent* aEsd, AnalysisMode analysisMode, Bool_t debug,Bool_t bRedoTPC)
+const AliESDVertex* AliPWG0Helper::GetVertex(AliESDEvent* aEsd, AnalysisMode analysisMode, Bool_t debug, Bool_t bRedoTPC)
{
// Get the vertex from the ESD and returns it if the vertex is valid
//
else if (analysisMode == kTPC)
{
if(bRedoTPC){
+ if (debug)
+ Printf("AliPWG0Helper::GetVertex: Redoing vertex");
Double_t kBz = aEsd->GetMagneticField();
AliVertexerTracks vertexer(kBz);
vertexer.SetTPCMode();
{
case kMB1 : str += "MB1"; break;
case kMB2 : str += "MB2"; break;
+ case kMB3 : str += "MB3"; break;
case kSPDFASTOR : str += "SPD FASTOR"; break;
+ case kOfflineMB1 : str += "Offline MB1"; break;
+ case kOfflineMB2 : str += "Offline MB2"; break;
+ case kOfflineMB3 : str += "Offline MB3"; break;
+ case kOfflineFASTOR : str += "Offline SPD FASTOR"; break;
}
str += " <<<<";
// static helper functions
-class AliESD;
class AliESDEvent;
class AliESDVertex;
class TParticle;
class AliPWG0Helper : public TObject
{
public:
- enum Trigger { kMB1 = 0, kMB2, kSPDFASTOR }; // definition from ALICE-INT-2005-025
+ enum Trigger { kMB1 = 0, kMB2, kMB3, kSPDFASTOR, kOfflineMB1, kOfflineMB2, kOfflineMB3, kOfflineFASTOR }; // MB1, MB2, MB3 definition from ALICE-INT-2005-025
enum AnalysisMode { kInvalid = -1, kSPD = 0, kTPC, kTPCITS };
// in case we want to use bitmaps...
enum MCProcessType { kInvalidProcess = -1, kND = 0x1, kDD = 0x2, kSD = 0x4 };
- static Bool_t IsEventTriggered(const AliESD* aEsd, Trigger trigger = kMB2);
- static Bool_t IsEventTriggered(ULong64_t triggerMask, Trigger trigger = kMB2);
- static const AliESDVertex* GetVertex(AliESDEvent* aEsd, AnalysisMode analysisMethod, Bool_t debug = kFALSE,Bool_t bRedoTPC = false);
+ static Bool_t IsEventTriggered(const AliESDEvent* aEsd, Trigger trigger);
+ static Bool_t IsEventTriggered(ULong64_t triggerMask, Trigger trigger);
+ static const AliESDVertex* GetVertex(AliESDEvent* aEsd, AnalysisMode analysisMethod, Bool_t debug = kFALSE, Bool_t bRedoTPC = kFALSE);
static Bool_t TestVertex(const AliESDVertex* vertex, AnalysisMode analysisMode, Bool_t debug = kFALSE);
static Bool_t IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t adebug = kFALSE);
// TPC-only cuts
if (analysisMode == AliPWG0Helper::kTPC)
{
+ cov1 = 9;
+ cov2 = 9;
+ cov3 = 1e10;
+ cov4 = 1e10;
+ cov5 = 1e10;
+
tpcRefit = kFALSE;
sigmaToVertex = kFALSE;
-
+
tag = "TPC-only tracking";
}
esdTrackCuts->SetRequireSigmaToVertex(sigmaToVertex);
if (sigmaToVertex) {
- esdTrackCuts->SetMinNsigmaToVertex(nSigma);
+ esdTrackCuts->SetMaxNsigmaToVertex(nSigma);
}
else{
- // esdTrackCuts->SetDCAToVertex(3.0);
- esdTrackCuts->SetDCAToVertexZ(3.0);
- esdTrackCuts->SetDCAToVertexXY(3.0);
+
+ esdTrackCuts->SetMaxDCAToVertexZ(3.2);
+ esdTrackCuts->SetMaxDCAToVertexXY(2.4);
+ esdTrackCuts->SetDCAToVertex2D(kTRUE);
}
esdTrackCuts->SetRequireTPCRefit(tpcRefit);
// ------------------------------------------------------
//
// TODO:
-// - make the ntrack to npart correction 3D
-// - add documentation
-// - add status: generate or use maps
// - add functionality to set the bin sizes
// - update MERge function
//
#include "AlidNdEtaCorrectionTask.h"
-#include <TROOT.h>
#include <TCanvas.h>
#include <TChain.h>
#include <TFile.h>
#include "AliESDtrackCuts.h"
#include "AliPWG0Helper.h"
-//#include "AliCorrection.h"
-//#include "AliCorrectionMatrix3D.h"
#include "dNdEta/dNdEtaAnalysis.h"
#include "dNdEta/AlidNdEtaCorrection.h"
-#include "AliVertexerTracks.h"
ClassImp(AlidNdEtaCorrectionTask)
fOption(),
fAnalysisMode(AliPWG0Helper::kTPC),
fTrigger(AliPWG0Helper::kMB1),
+ fFillPhi(kFALSE),
+ fDeltaPhiCut(-1),
fSignMode(0),
fOnlyPrimaries(kFALSE),
+ fStatError(0),
fEsdTrackCuts(0),
fdNdEtaCorrection(0),
fdNdEtaAnalysisMC(0),
fEtaCorrelationShift(0),
fEtaProfile(0),
fEtaResolution(0),
+ fDeltaPhiCorrelation(0),
fpTResolution(0),
fEsdTrackCutsPrim(0),
fEsdTrackCutsSec(0),
// Constructor. Initialization of pointers
//
- for (Int_t i=0; i<2; i++)
- fdNdEtaCorrectionProcessType[i] = 0;
+ for (Int_t i=0; i<4; i++)
+ fdNdEtaCorrectionSpecial[i] = 0;
for (Int_t i=0; i<8; i++)
fDeltaPhi[i] = 0;
fOption(opt),
fAnalysisMode(AliPWG0Helper::kTPC),
fTrigger(AliPWG0Helper::kMB1),
+ fFillPhi(kFALSE),
+ fDeltaPhiCut(0),
fSignMode(0),
fOnlyPrimaries(kFALSE),
+ fStatError(0),
fEsdTrackCuts(0),
fdNdEtaCorrection(0),
fdNdEtaAnalysisMC(0),
fEtaCorrelationShift(0),
fEtaProfile(0),
fEtaResolution(0),
+ fDeltaPhiCorrelation(0),
fpTResolution(0),
fEsdTrackCutsPrim(0),
fEsdTrackCutsSec(0),
DefineInput(0, TChain::Class());
DefineOutput(0, TList::Class());
- for (Int_t i=0; i<2; i++)
- fdNdEtaCorrectionProcessType[i] = 0;
+ for (Int_t i=0; i<4; i++)
+ fdNdEtaCorrectionSpecial[i] = 0;
for (Int_t i=0; i<8; i++)
fDeltaPhi[i] = 0;
Printf("INFO: Processing only negative particles.");
fSignMode = -1;
}
+
+ if (fOption.Contains("stat-error-1"))
+ {
+ Printf("INFO: Evaluation statistical errors. Mode: 1.");
+ fStatError = 1;
+ }
+ else if (fOption.Contains("stat-error-2"))
+ {
+ Printf("INFO: Evaluation statistical errors. Mode: 2.");
+ fStatError = 2;
+ }
fOutput = new TList;
fOutput->SetOwner();
}
if (fOption.Contains("process-types")) {
- fdNdEtaCorrectionProcessType[0] = new AlidNdEtaCorrection("dndeta_correction_ND", "dndeta_correction_ND", fAnalysisMode);
- fdNdEtaCorrectionProcessType[1] = new AlidNdEtaCorrection("dndeta_correction_SD", "dndeta_correction_SD", fAnalysisMode);
- fdNdEtaCorrectionProcessType[2] = new AlidNdEtaCorrection("dndeta_correction_DD", "dndeta_correction_DD", fAnalysisMode);
+ fdNdEtaCorrectionSpecial[0] = new AlidNdEtaCorrection("dndeta_correction_ND", "dndeta_correction_ND", fAnalysisMode);
+ fdNdEtaCorrectionSpecial[1] = new AlidNdEtaCorrection("dndeta_correction_SD", "dndeta_correction_SD", fAnalysisMode);
+ fdNdEtaCorrectionSpecial[2] = new AlidNdEtaCorrection("dndeta_correction_DD", "dndeta_correction_DD", fAnalysisMode);
- fOutput->Add(fdNdEtaCorrectionProcessType[0]);
- fOutput->Add(fdNdEtaCorrectionProcessType[1]);
- fOutput->Add(fdNdEtaCorrectionProcessType[2]);
+ fOutput->Add(fdNdEtaCorrectionSpecial[0]);
+ fOutput->Add(fdNdEtaCorrectionSpecial[1]);
+ fOutput->Add(fdNdEtaCorrectionSpecial[2]);
+ }
+
+ if (fOption.Contains("particle-species")) {
+ fdNdEtaCorrectionSpecial[0] = new AlidNdEtaCorrection("dndeta_correction_pi", "dndeta_correction_pi", fAnalysisMode);
+ fdNdEtaCorrectionSpecial[1] = new AlidNdEtaCorrection("dndeta_correction_K", "dndeta_correction_K", fAnalysisMode);
+ fdNdEtaCorrectionSpecial[2] = new AlidNdEtaCorrection("dndeta_correction_p", "dndeta_correction_p", fAnalysisMode);
+ fdNdEtaCorrectionSpecial[3] = new AlidNdEtaCorrection("dndeta_correction_other", "dndeta_correction_other", fAnalysisMode);
+
+ for (Int_t i=0; i<4; i++)
+ fOutput->Add(fdNdEtaCorrectionSpecial[i]);
}
+
/*
- fTemp1 = new TH3F("fTemp1", "fTemp1 prim;b0;b1;1/pT", 200, 0, 10, 200, 0, 10, 200, 0, 10);
+ fTemp1 = new TH2F("fTemp1", "fTemp1", 200, -0.08, 0.08, 200, -0.08, 0.08);
fOutput->Add(fTemp1);
- fTemp2 = new TH3F("fTemp2", "fTemp2 sec;b0;b1;1/pT", 200, 0, 10, 200, 0, 10, 200, 0, 10);
+ fTemp2 = new TH1F("fTemp2", "fTemp2", 2000, -5, 5);
fOutput->Add(fTemp2);
*/
fEtaCorrelation = new TH2F("fEtaCorrelation", "fEtaCorrelation;MC #eta;ESD #eta", 120, -3, 3, 120, -3, 3);
fOutput->Add(fEtaCorrelation);
- fEtaCorrelationShift = new TH2F("fEtaCorrelationShift", "fEtaCorrelationShift;MC #eta - ESD #eta;ESD #eta", 120, -3, 3, 100, -0.1, 0.1);
+ fEtaCorrelationShift = new TH2F("fEtaCorrelationShift", "fEtaCorrelationShift;MC #eta;MC #eta - ESD #eta", 120, -3, 3, 100, -0.1, 0.1);
fOutput->Add(fEtaCorrelationShift);
fEtaProfile = new TProfile("fEtaProfile", "fEtaProfile;MC #eta;MC #eta - ESD #eta", 120, -3, 3);
fOutput->Add(fEtaProfile);
fEtaResolution = new TH1F("fEtaResolution", "fEtaResolution;MC #eta - ESD #eta", 201, -0.2, 0.2);
fOutput->Add(fEtaResolution);
- fpTResolution = new TH1F("fpTResolution", "fpTResolution;MC p_{T} - ESD p_{T}", 201, -0.2, 0.2);
+ fpTResolution = new TH2F("fpTResolution", ";MC p_{T} (GeV/c);(MC p_{T} - ESD p_{T}) / MC p_{T}", 160, 0, 20, 201, -0.2, 0.2);
fOutput->Add(fpTResolution);
fMultAll = new TH1F("fMultAll", "fMultAll", 500, -0.5, 499.5);
for (Int_t i=0; i<8; i++)
{
- fDeltaPhi[i] = new TH1F(Form("fDeltaPhi_%d", i), ";#Delta phi;Entries", 2000, -0.1, 0.1);
+ fDeltaPhi[i] = new TH2F(Form("fDeltaPhi_%d", i), ";#Delta phi;#phi;Entries", 2000, -0.1, 0.1, 18 * 5, 0, TMath::TwoPi());
fOutput->Add(fDeltaPhi[i]);
}
- fEventStats = new TH2F("fEventStats", "fEventStats;event type;status;count", 104, -3.5, 100.5, 4, -0.5, 3.5);
+ fEventStats = new TH2F("fEventStats", "fEventStats;event type;status;count", 106, -5.5, 100.5, 4, -0.5, 3.5);
fOutput->Add(fEventStats);
- fEventStats->GetXaxis()->SetBinLabel(1, "INEL"); // x = -3
- fEventStats->GetXaxis()->SetBinLabel(2, "NSD"); // x = -2
+ fEventStats->GetXaxis()->SetBinLabel(1, "INEL"); // x = -5
+ fEventStats->GetXaxis()->SetBinLabel(2, "NSD"); // x = -4
+ fEventStats->GetXaxis()->SetBinLabel(3, "ND"); // x = -3
+ fEventStats->GetXaxis()->SetBinLabel(4, "SD"); // x = -2
+ fEventStats->GetXaxis()->SetBinLabel(5, "DD"); // x = -1
+
for (Int_t i=0; i<100; i++)
- fEventStats->GetXaxis()->SetBinLabel(4+i, Form("%d", i));
+ fEventStats->GetXaxis()->SetBinLabel(7+i, Form("%d", i));
fEventStats->GetYaxis()->SetBinLabel(1, "nothing");
fEventStats->GetYaxis()->SetBinLabel(2, "trg");
if (fOnlyPrimaries)
Printf("WARNING: Processing only primaries. For systematical studies only!");
+
+ if (fStatError > 0)
+ Printf("WARNING: Statistical error evaluation active!");
// trigger definition
- Bool_t eventTriggered = AliPWG0Helper::IsEventTriggered(fESD->GetTriggerMask(), fTrigger);
+ Bool_t eventTriggered = AliPWG0Helper::IsEventTriggered(fESD, fTrigger);
if (!eventTriggered)
Printf("No trigger");
// post the data already here
PostData(0, fOutput);
-
+
// MC info
AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
if (!eventHandler) {
// get the ESD vertex
const AliESDVertex* vtxESD = AliPWG0Helper::GetVertex(fESD, fAnalysisMode);
-
Bool_t eventVertex = kFALSE;
if (vtxESD)
{
// fill process type
Int_t biny = (Int_t) eventTriggered + 2 * (Int_t) eventVertex;
// INEL
- fEventStats->Fill(-3, biny);
+ fEventStats->Fill(-5, biny);
// NSD
if (processType != AliPWG0Helper::kSD)
+ fEventStats->Fill(-4, biny);
+ // SD, ND, DD
+ if (processType == AliPWG0Helper::kND)
+ fEventStats->Fill(-3, biny);
+ if (processType == AliPWG0Helper::kSD)
fEventStats->Fill(-2, biny);
-
+ if (processType == AliPWG0Helper::kDD)
+ fEventStats->Fill(-1, biny);
+
// create list of (label, eta, pt) tuples
Int_t inputCount = 0;
Int_t* labelArr = 0;
Int_t* labelArr2 = 0; // only for case of SPD
Float_t* etaArr = 0;
- Float_t* ptArr = 0;
+ Float_t* thirdDimArr = 0;
Float_t* deltaPhiArr = 0;
if (fAnalysisMode == AliPWG0Helper::kSPD)
{
labelArr = new Int_t[mult->GetNumberOfTracklets()];
labelArr2 = new Int_t[mult->GetNumberOfTracklets()];
etaArr = new Float_t[mult->GetNumberOfTracklets()];
- ptArr = new Float_t[mult->GetNumberOfTracklets()];
+ thirdDimArr = new Float_t[mult->GetNumberOfTracklets()];
deltaPhiArr = new Float_t[mult->GetNumberOfTracklets()];
// get multiplicity from SPD tracklets
{
//printf("%d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), mult->GetDeltaPhi(i));
+ Float_t phi = mult->GetPhi(i);
+ if (phi < 0)
+ phi += TMath::Pi() * 2;
Float_t deltaPhi = mult->GetDeltaPhi(i);
- // prevent values to be shifted by 2 Pi()
- if (deltaPhi < -TMath::Pi())
- deltaPhi += TMath::Pi() * 2;
- if (deltaPhi > TMath::Pi())
- deltaPhi -= TMath::Pi() * 2;
if (TMath::Abs(deltaPhi) > 1)
printf("WARNING: Very high Delta Phi: %d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), deltaPhi);
if (mult->GetLabel(i, 0) < 0 || mult->GetLabel(i, 0) != mult->GetLabel(i, 1) || !stack->IsPhysicalPrimary(mult->GetLabel(i, 0)))
continue;
+ if (fDeltaPhiCut > 0 && TMath::Abs(deltaPhi) > fDeltaPhiCut)
+ continue;
+
etaArr[inputCount] = mult->GetEta(i);
labelArr[inputCount] = mult->GetLabel(i, 0);
labelArr2[inputCount] = mult->GetLabel(i, 1);
- ptArr[inputCount] = 0; // no pt for tracklets
+ thirdDimArr[inputCount] = phi;
deltaPhiArr[inputCount] = deltaPhi;
++inputCount;
}
return;
}
- // get multiplicity from ESD tracks
- TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD, (fAnalysisMode == AliPWG0Helper::kTPC));
- Int_t nGoodTracks = list->GetEntries();
-
- Printf("Accepted %d tracks", nGoodTracks);
-
- labelArr = new Int_t[nGoodTracks];
- labelArr2 = new Int_t[nGoodTracks];
- etaArr = new Float_t[nGoodTracks];
- ptArr = new Float_t[nGoodTracks];
- deltaPhiArr = new Float_t[nGoodTracks];
-
- // loop over esd tracks
- for (Int_t i=0; i<nGoodTracks; i++)
- {
- AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(i));
- if (!esdTrack)
- {
- AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", i));
- continue;
- }
-
- etaArr[inputCount] = esdTrack->Eta();
- labelArr[inputCount] = TMath::Abs(esdTrack->GetLabel());
- labelArr2[inputCount] = labelArr[inputCount]; // no second label for tracks
- ptArr[inputCount] = esdTrack->Pt();
- deltaPhiArr[inputCount] = 0; // no delta phi for tracks
- ++inputCount;
- }
-
- delete list;
-
- if (eventTriggered && vtxESD)
+ if (vtxESD)
{
- // collect values for primaries and secondaries
- for (Int_t iTrack = 0; iTrack < fESD->GetNumberOfTracks(); iTrack++)
+ // get multiplicity from ESD tracks
+ TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD, (fAnalysisMode == AliPWG0Helper::kTPC));
+ Int_t nGoodTracks = list->GetEntries();
+
+ Printf("Accepted %d tracks", nGoodTracks);
+
+ labelArr = new Int_t[nGoodTracks];
+ labelArr2 = new Int_t[nGoodTracks];
+ etaArr = new Float_t[nGoodTracks];
+ thirdDimArr = new Float_t[nGoodTracks];
+ deltaPhiArr = new Float_t[nGoodTracks];
+
+ // loop over esd tracks
+ for (Int_t i=0; i<nGoodTracks; i++)
{
- AliESDtrack* track = 0;
-
- if (fAnalysisMode == AliPWG0Helper::kTPC)
- track = AliESDtrackCuts::GetTPCOnlyTrack(fESD, iTrack);
- else if (fAnalysisMode == AliPWG0Helper::kTPCITS)
- track = fESD->GetTrack(iTrack);
-
- if (!track)
- continue;
-
- Int_t label = TMath::Abs(track->GetLabel());
- if (!stack->Particle(label) || !stack->Particle(label)->GetPDG())
+ AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(i));
+ if (!esdTrack)
{
- Printf("WARNING: No particle for %d", label);
- if (stack->Particle(label))
- stack->Particle(label)->Print();
+ AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", i));
continue;
}
+
+ // TODO fOnlyPrimaries not implemented for TPC
+
+ etaArr[inputCount] = esdTrack->Eta();
+ labelArr[inputCount] = TMath::Abs(esdTrack->GetLabel());
+ labelArr2[inputCount] = labelArr[inputCount]; // no second label for tracks
+ thirdDimArr[inputCount] = esdTrack->Pt();
+ deltaPhiArr[inputCount] = 0; // no delta phi for tracks
+ ++inputCount;
+ }
- if (stack->Particle(label)->GetPDG()->Charge() == 0)
- continue;
+ delete list;
- if (stack->IsPhysicalPrimary(label))
+ if (eventTriggered)
+ {
+ // collect values for primaries and secondaries
+ for (Int_t iTrack = 0; iTrack < fESD->GetNumberOfTracks(); iTrack++)
{
- // primary
- if (fEsdTrackCutsPrim->AcceptTrack(track)) {
- if (track->Pt() > 0) {
- Float_t b0, b1;
- track->GetImpactParameters(b0, b1);
- if (fTemp1)
- ((TH3*) fTemp1)->Fill(b0, b1, 1.0 / track->Pt());
- //fTemp1->Fill(TMath::Sqrt(b0*b0 + b1*b1), 1.0 / track->Pt());
- }
-
- if (AliESDtrackCuts::GetSigmaToVertex(track) > 900)
+ AliESDtrack* track = 0;
+
+ if (fAnalysisMode == AliPWG0Helper::kTPC)
+ track = AliESDtrackCuts::GetTPCOnlyTrack(fESD, iTrack);
+ else if (fAnalysisMode == AliPWG0Helper::kTPCITS)
+ track = fESD->GetTrack(iTrack);
+
+ if (!track)
+ continue;
+
+ Int_t label = TMath::Abs(track->GetLabel());
+ if (!stack->Particle(label) || !stack->Particle(label)->GetPDG())
+ {
+ Printf("WARNING: No particle for %d", label);
+ if (stack->Particle(label))
+ stack->Particle(label)->Print();
+ continue;
+ }
+
+ if (stack->Particle(label)->GetPDG()->Charge() == 0)
+ continue;
+
+ if (TMath::Abs(track->Eta()) < 1)
+ {
+ if (stack->IsPhysicalPrimary(label))
{
- Printf("Track %d has nsigma of %f. Printing track and vertex...", iTrack, AliESDtrackCuts::GetSigmaToVertex(track));
- Float_t b[2];
- Float_t r[3];
- track->GetImpactParameters(b, r);
- Printf("Impact parameter %f %f and resolution: %f %f %f", b[0], b[1], r[0], r[1], r[2]);
- track->Print("");
- if (vtxESD)
- vtxESD->Print();
+ // primary
+ if (fEsdTrackCutsPrim->AcceptTrack(track))
+ {
+ if (AliESDtrackCuts::GetSigmaToVertex(track) > 900)
+ {
+ Printf("Track %d has nsigma of %f. Printing track and vertex...", iTrack, AliESDtrackCuts::GetSigmaToVertex(track));
+ Float_t b[2];
+ Float_t r[3];
+ track->GetImpactParameters(b, r);
+ Printf("Impact parameter %f %f and resolution: %f %f %f", b[0], b[1], r[0], r[1], r[2]);
+ track->Print("");
+ if (vtxESD)
+ vtxESD->Print();
+ }
+ }
}
- }
- }
- else
- {
- // secondary
- if (fEsdTrackCutsSec->AcceptTrack(track)) {
- if (track->Pt() > 0) {
- Float_t b0, b1;
- track->GetImpactParameters(b0, b1);
- if (fTemp2)
- ((TH3*) fTemp2)->Fill(b0, b1, 1.0 / track->Pt());
- //fTemp2->Fill(TMath::Sqrt(b0*b0 + b1*b1), 1.0 / track->Pt());
+ else
+ {
+ // secondary
+ fEsdTrackCutsSec->AcceptTrack(track);
}
}
+
+ // TODO mem leak in the continue statements above
+ if (fAnalysisMode == AliPWG0Helper::kTPC)
+ delete track;
}
-
- // TODO mem leak in the continue statements above
- if (fAnalysisMode == AliPWG0Helper::kTPC)
- delete track;
}
}
}
fPIDParticles->Fill(particle->GetPdgCode());
Float_t eta = particle->Eta();
- Float_t thirdDim = (fAnalysisMode == AliPWG0Helper::kSPD) ? inputCount : particle->Pt();
+
+ Float_t thirdDim = -1;
+ if (fAnalysisMode == AliPWG0Helper::kSPD)
+ {
+ if (fFillPhi)
+ {
+ thirdDim = particle->Phi();
+ }
+ else
+ thirdDim = inputCount;
+ }
+ else
+ thirdDim = particle->Pt();
+
+ // calculate y
+ //Float_t y = 0.5 * TMath::Log((particle->Energy() + particle->Pz()) / (particle->Energy() - particle->Pz()));
+ //fTemp1->Fill(eta);
+ //fTemp2->Fill(y);
fdNdEtaCorrection->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
- if (fdNdEtaCorrectionProcessType[0])
+ if (fOption.Contains("process-types"))
{
// non diffractive
if (processType==AliPWG0Helper::kND)
- fdNdEtaCorrectionProcessType[0]->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
+ fdNdEtaCorrectionSpecial[0]->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
// single diffractive
if (processType==AliPWG0Helper::kSD)
- fdNdEtaCorrectionProcessType[1]->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
+ fdNdEtaCorrectionSpecial[1]->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
// double diffractive
if (processType==AliPWG0Helper::kDD)
- fdNdEtaCorrectionProcessType[2]->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
+ fdNdEtaCorrectionSpecial[2]->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
+ }
+
+ if (fOption.Contains("particle-species"))
+ {
+ Int_t id = -1;
+ switch (TMath::Abs(particle->GetPdgCode()))
+ {
+ case 211: id = 0; break;
+ case 321: id = 1; break;
+ case 2212: id = 2; break;
+ default: id = 3; break;
+ }
+ fdNdEtaCorrectionSpecial[id]->FillMCParticle(vtxMC[2], eta, thirdDim, eventTriggered, eventVertex, processType);
}
if (eventTriggered)
nAccepted++;
}
- if (nAccepted == 0)
- fEventStats->Fill(AliPWG0Helper::GetLastProcessType(), biny);
+ fEventStats->Fill(AliPWG0Helper::GetLastProcessType(), biny);
fMultAll->Fill(nAccepted);
if (eventTriggered) {
}
Int_t processed = 0;
+
+ Bool_t* primCount = 0;
+ if (fStatError > 0)
+ {
+ primCount = new Bool_t[nPrim];
+ for (Int_t i=0; i<nPrim; ++i)
+ primCount[i] = kFALSE;
+ }
for (Int_t i=0; i<inputCount; ++i)
{
// resolutions
fEtaResolution->Fill(particle->Eta() - etaArr[i]);
- fpTResolution->Fill(particle->Pt() - ptArr[i]);
+
+ if (fAnalysisMode == AliPWG0Helper::kTPC || fAnalysisMode == AliPWG0Helper::kTPCITS)
+ if (TMath::Abs(particle->Eta() < 0.9) && particle->Pt() > 0)
+ fpTResolution->Fill(particle->Pt(), (particle->Pt() - thirdDimArr[i]) / particle->Pt());
Float_t eta = -999;
Float_t thirdDim = -1;
// in case of primary the MC values are filled, otherwise (background) the reconstructed values
if (label == label2 && firstIsPrim)
{
- thirdDim = particle->Pt();
eta = particle->Eta();
+
+ if (fAnalysisMode == AliPWG0Helper::kSPD)
+ {
+ if (fFillPhi)
+ {
+ thirdDim = particle->Phi();
+ }
+ else
+ thirdDim = inputCount;
+ }
+ else
+ thirdDim = particle->Pt();
}
else
{
- thirdDim = ptArr[i];
+ if (fAnalysisMode == AliPWG0Helper::kSPD && !fFillPhi)
+ {
+ thirdDim = inputCount;
+ }
+ else
+ thirdDim = thirdDimArr[i];
+
eta = etaArr[i];
}
- if (fAnalysisMode == AliPWG0Helper::kSPD)
- thirdDim = inputCount;
+ Bool_t fillTrack = kTRUE;
- fdNdEtaCorrection->FillTrackedParticle(vtxMC[2], eta, thirdDim);
+ // statistical error evaluation active?
+ if (fStatError > 0)
+ {
+ Bool_t statErrorDecision = kFALSE;
+
+ // primary and not yet counted
+ if (label == label2 && firstIsPrim && !primCount[label])
+ {
+ statErrorDecision = kTRUE;
+ primCount[label] = kTRUE;
+ }
+
+ // in case of 1 we count only unique primaries, in case of 2 all the rest
+ if (fStatError == 1)
+ {
+ fillTrack = statErrorDecision;
+ }
+ else if (fStatError == 2)
+ fillTrack = !statErrorDecision;
+ }
+
+ if (fillTrack)
+ fdNdEtaCorrection->FillTrackedParticle(vtxMC[2], eta, thirdDim);
// eta comparison for tracklets with the same label (others are background)
if (label == label2)
{
fEtaProfile->Fill(particle->Eta(), particle->Eta() - etaArr[i]);
fEtaCorrelation->Fill(etaArr[i], particle->Eta());
- fEtaCorrelationShift->Fill(etaArr[i], particle->Eta() - etaArr[i]);
+ fEtaCorrelationShift->Fill(particle->Eta(), particle->Eta() - etaArr[i]);
}
fdNdEtaAnalysisESD->FillTrack(vtxMC[2], particle->Eta(), thirdDim);
- if (particle->Pt() > 0.1 && particle->Pt() < 0.2)
- {
- fPIDTracks->Fill(particle->GetPdgCode());
- }
-
- if (fdNdEtaCorrectionProcessType[0])
+ if (fOption.Contains("process-types"))
{
// non diffractive
if (processType == AliPWG0Helper::kND)
- fdNdEtaCorrectionProcessType[0]->FillTrackedParticle(vtxMC[2], eta, thirdDim);
+ fdNdEtaCorrectionSpecial[0]->FillTrackedParticle(vtxMC[2], eta, thirdDim);
// single diffractive
if (processType == AliPWG0Helper::kSD)
- fdNdEtaCorrectionProcessType[1]->FillTrackedParticle(vtxMC[2], eta, thirdDim);
+ fdNdEtaCorrectionSpecial[1]->FillTrackedParticle(vtxMC[2], eta, thirdDim);
// double diffractive
if (processType == AliPWG0Helper::kDD)
- fdNdEtaCorrectionProcessType[2]->FillTrackedParticle(vtxMC[2], eta, thirdDim);
+ fdNdEtaCorrectionSpecial[2]->FillTrackedParticle(vtxMC[2], eta, thirdDim);
+ }
+
+ if (fOption.Contains("particle-species"))
+ {
+ // find mother first
+ TParticle* mother = AliPWG0Helper::FindPrimaryMother(stack, label);
+
+ Int_t id = -1;
+ switch (TMath::Abs(mother->GetPdgCode()))
+ {
+ case 211: id = 0; break;
+ case 321: id = 1; break;
+ case 2212: id = 2; break;
+ default: id = 3; break;
+ }
+ fdNdEtaCorrectionSpecial[id]->FillTrackedParticle(vtxMC[2], eta, thirdDim);
}
// control histograms
Int_t hist = -1;
if (label == label2)
{
- if (firstIsPrim)
+ if (firstIsPrim)
{
- hist = 0;
+ hist = 0;
}
else
hist = 1;
else if (firstIsPrim && !secondIsPrim)
{
hist = 3;
-
+
// check if secondary is caused by the primary or it is a fake combination
//Printf("PS case --> Label 1 is %d, label 2 is %d", label, label2);
Int_t mother = label2;
else
hist = 7;
- fDeltaPhi[hist]->Fill(deltaPhiArr[i]);
+ fDeltaPhi[hist]->Fill(deltaPhiArr[i], thirdDimArr[i]);
}
}
+
+ if (primCount)
+ {
+ delete[] primCount;
+ primCount = 0;
+ }
if (processed < inputCount)
Printf("Only %d out of %d track(let)s were used", processed, inputCount);
// stuff regarding the vertex reco correction and trigger bias correction
fdNdEtaCorrection->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
- if (fdNdEtaCorrectionProcessType[0])
+ if (fOption.Contains("process-types"))
{
// non diffractive
if (processType == AliPWG0Helper::kND )
- fdNdEtaCorrectionProcessType[0]->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
+ fdNdEtaCorrectionSpecial[0]->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
// single diffractive
if (processType == AliPWG0Helper::kSD)
- fdNdEtaCorrectionProcessType[1]->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
+ fdNdEtaCorrectionSpecial[1]->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
// double diffractive
if (processType == AliPWG0Helper::kDD)
- fdNdEtaCorrectionProcessType[2]->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
+ fdNdEtaCorrectionSpecial[2]->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
}
-
- delete[] etaArr;
- delete[] labelArr;
- delete[] labelArr2;
- delete[] ptArr;
- delete[] deltaPhiArr;
+
+ if (fOption.Contains("particle-species"))
+ for (Int_t id=0; id<4; id++)
+ fdNdEtaCorrectionSpecial[id]->FillEvent(vtxMC[2], inputCount, eventTriggered, eventVertex, processType);
+
+ if (etaArr)
+ delete[] etaArr;
+ if (labelArr)
+ delete[] labelArr;
+ if (labelArr2)
+ delete[] labelArr2;
+ if (thirdDimArr)
+ delete[] thirdDimArr;
+ if (deltaPhiArr)
+ delete[] deltaPhiArr;
}
void AlidNdEtaCorrectionTask::Terminate(Option_t *)
fdNdEtaAnalysisMC->SaveHistograms();
fdNdEtaAnalysisESD->SaveHistograms();
- fdNdEtaCorrectionProcessType[0] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_ND"));
- fdNdEtaCorrectionProcessType[1] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_SD"));
- fdNdEtaCorrectionProcessType[2] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_DD"));
- for (Int_t i=0; i<3; ++i)
- if (fdNdEtaCorrectionProcessType[i])
- fdNdEtaCorrectionProcessType[i]->SaveHistograms();
+ if (fOutput->FindObject("dndeta_correction_ND"))
+ {
+ fdNdEtaCorrectionSpecial[0] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_ND"));
+ fdNdEtaCorrectionSpecial[1] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_SD"));
+ fdNdEtaCorrectionSpecial[2] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_DD"));
+ }
+ else
+ {
+ fdNdEtaCorrectionSpecial[0] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_pi"));
+ fdNdEtaCorrectionSpecial[1] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_K"));
+ fdNdEtaCorrectionSpecial[2] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_p"));
+ fdNdEtaCorrectionSpecial[3] = dynamic_cast<AlidNdEtaCorrection*> (fOutput->FindObject("dndeta_correction_other"));
+ }
+ for (Int_t i=0; i<4; ++i)
+ if (fdNdEtaCorrectionSpecial[i])
+ fdNdEtaCorrectionSpecial[i]->SaveHistograms();
fTemp1 = dynamic_cast<TH1*> (fOutput->FindObject("fTemp1"));
if (fTemp1)
fEtaResolution = dynamic_cast<TH1F*> (fOutput->FindObject("fEtaResolution"));
if (fEtaResolution)
fEtaResolution->Write();
- fpTResolution = dynamic_cast<TH1F*> (fOutput->FindObject("fpTResolution"));
+ fpTResolution = dynamic_cast<TH2F*> (fOutput->FindObject("fpTResolution"));
if (fpTResolution)
+ {
+ fpTResolution->FitSlicesY();
fpTResolution->Write();
+ }
fMultAll = dynamic_cast<TH1F*> (fOutput->FindObject("fMultAll"));
if (fMultAll)
for (Int_t i=0; i<8; ++i)
{
- fDeltaPhi[i] = dynamic_cast<TH1F*> (fOutput->FindObject(Form("fDeltaPhi_%d", i)));
+ fDeltaPhi[i] = dynamic_cast<TH2*> (fOutput->FindObject(Form("fDeltaPhi_%d", i)));
if (fDeltaPhi[i])
fDeltaPhi[i]->Write();
}
void SetAnalysisMode(AliPWG0Helper::AnalysisMode mode) { fAnalysisMode = mode; }
void SetOnlyPrimaries(Bool_t flag = kTRUE) { fOnlyPrimaries = flag; }
void SetTrigger(AliPWG0Helper::Trigger trigger) { fTrigger = trigger; }
+ void SetFillPhi(Bool_t flag = kTRUE) { fFillPhi = flag; }
+ void SetDeltaPhiCut(Float_t cut) { fDeltaPhiCut = cut; }
void SetOption(const char* opt) { fOption = opt; }
TString fOption; // option string
AliPWG0Helper::AnalysisMode fAnalysisMode; // detector that is used for analysis
AliPWG0Helper::Trigger fTrigger; // trigger used in the analysis
+ Bool_t fFillPhi; // if true phi is filled as 3rd coordinate in all maps
+ Float_t fDeltaPhiCut; // cut in delta phi (only SPD)
+
Int_t fSignMode; // if 0 process all particles, if +-1 process only particles with that sign
Bool_t fOnlyPrimaries; // only process primaries (syst. studies)
+ Int_t fStatError; // statistical error evaluation: if set to 1 we only count unique primaries (binomial errors are valid), for 2 all the rest
AliESDtrackCuts* fEsdTrackCuts; // Object containing the parameters of the esd track cuts
TH2F* fEtaCorrelationShift; //! (MC eta - ESD eta) vs MC eta
TProfile* fEtaProfile; //! Profile of MC eta - ESD eta vs. MC eta
TH1F* fEtaResolution; //! MC eta - ESD eta in |eta| < 1
+ TH2F* fDeltaPhiCorrelation; //! delta phi ESD vs. MC
- TH1F* fpTResolution; //! MC pT - ESD pT in |eta| < 1
+ TH2F* fpTResolution; //! (MC pT - ESD pT) / MC pT vs. MC pT in |eta| < 0.9
AliESDtrackCuts* fEsdTrackCutsPrim; //! control histograms for primaries
AliESDtrackCuts* fEsdTrackCutsSec; //! control histograms for secondaries
TH1F* fMultTr; //! primary particles in |eta| < 1 and pT > 0.2 in triggered events
TH1F* fMultVtx; //! primary particles in |eta| < 1 and pT > 0.2 in triggered events with vertex
- TH1F* fDeltaPhi[8]; //! delta phi of primaries, secondaries, other (= unclear cases)
+ TH2* fDeltaPhi[8]; //! delta phi of primaries, secondaries, other (= unclear cases)
- TH2F* fEventStats; //! some stats on number of events
+ TH2F* fEventStats; //! some stats on number of events, see CreateOutputObjects for a detailed definition
- AlidNdEtaCorrection* fdNdEtaCorrectionProcessType[3]; //! correction for specific process type (ND, SD, DD)
- // enable with option: process-types
+ AlidNdEtaCorrection* fdNdEtaCorrectionSpecial[4]; //! correction maps used for systematic studies, may contain:
+ // for specific process type (ND, SD, DD), enable with option: process-types
+ // for particle species (pi, K, p, rest), enable with: particle-species
private:
AlidNdEtaCorrectionTask(const AlidNdEtaCorrectionTask&);
#include <TNtuple.h>
#include <TObjString.h>
#include <TF1.h>
+#include <TGraph.h>
#include <AliLog.h>
#include <AliESDVertex.h>
#include <AliMCEventHandler.h>
#include <AliMCEvent.h>
#include <AliESDInputHandler.h>
+#include <AliESDHeader.h>
#include "AliESDtrackCuts.h"
#include "AliPWG0Helper.h"
fOption(opt),
fAnalysisMode(AliPWG0Helper::kTPC),
fTrigger(AliPWG0Helper::kMB1),
+ fFillPhi(kFALSE),
+ fDeltaPhiCut(-1),
fReadMC(kFALSE),
fUseMCVertex(kFALSE),
fOnlyPrimaries(kFALSE),
fEvents(0),
fVertexResolution(0),
fdNdEtaAnalysis(0),
+ fdNdEtaAnalysisND(0),
fdNdEtaAnalysisNSD(0),
fdNdEtaAnalysisTr(0),
fdNdEtaAnalysisTrVtx(0),
fPartPt(0),
fVertex(0),
fPhi(0),
+ fRawPt(0),
fEtaPhi(0),
- fDeltaPhi(0)
+ fDeltaPhi(0),
+ fFiredChips(0),
+ fTriggerVsTime(0),
+ fStats(0)
{
//
// Constructor. Initialization of pointers
// Define input and output slots here
DefineInput(0, TChain::Class());
DefineOutput(0, TList::Class());
+
+ fZPhi[0] = 0;
+ fZPhi[1] = 0;
AliLog::SetClassDebugLevel("AlidNdEtaTask", AliLog::kWarning);
}
{
static Int_t count = 0;
count++;
- Printf("Processing %d. file", count);
+ Printf("Processing %d. file: %s", count, ((TTree*) GetInputData(0))->GetCurrentFile()->GetName());
return kTRUE;
}
fEvents = new TH1F("dndeta_check_vertex", "dndeta_check_vertex", 800, -40, 40);
fOutput->Add(fEvents);
- fVertexResolution = new TH1F("dndeta_vertex_resolution_z", "dndeta_vertex_resolution_z", 1000, 0, 10);
+ Float_t resMax = (fAnalysisMode == AliPWG0Helper::kSPD) ? 0.2 : 2;
+ fVertexResolution = new TH1F("dndeta_vertex_resolution_z", "dndeta_vertex_resolution_z", 1000, 0, resMax);
fOutput->Add(fVertexResolution);
fPhi = new TH1F("fPhi", "fPhi;#phi in rad.;count", 720, 0, 2 * TMath::Pi());
fEtaPhi = new TH2F("fEtaPhi", "fEtaPhi;#eta;#phi in rad.;count", 80, -4, 4, 18*5, 0, 2 * TMath::Pi());
fOutput->Add(fEtaPhi);
+ fTriggerVsTime = new TGraph; //TH1F("fTriggerVsTime", "fTriggerVsTime;trigger time;count", 100, 0, 100);
+ fTriggerVsTime->SetName("fTriggerVsTime");
+ fTriggerVsTime->GetXaxis()->SetTitle("trigger time");
+ fTriggerVsTime->GetYaxis()->SetTitle("count");
+ fOutput->Add(fTriggerVsTime);
+
+ fStats = new TH1F("fStats", "fStats", 2, 0.5, 2.5);
+ fStats->GetXaxis()->SetBinLabel(1, "vertexer 3d");
+ fStats->GetXaxis()->SetBinLabel(2, "vertexer z");
+ fOutput->Add(fStats);
+
if (fAnalysisMode == AliPWG0Helper::kSPD)
- fDeltaPhi = new TH1F("fDeltaPhi", "fDeltaPhi;#Delta #phi;Entries", 18*50, -3.14, 3.14);
+ {
+ fDeltaPhi = new TH1F("fDeltaPhi", "fDeltaPhi;#Delta #phi;Entries", 500, -0.2, 0.2);
+ fOutput->Add(fDeltaPhi);
+ fFiredChips = new TH2F("fFiredChips", "fFiredChips;Chips L1 + L2;tracklets", 1201, -0.5, 1201, 50, -0.5, 49.5);
+ fOutput->Add(fFiredChips);
+ for (Int_t i=0; i<2; i++)
+ {
+ fZPhi[i] = new TH2F(Form("fZPhi_%d", i), Form("fZPhi Layer %d;z (cm);#phi (rad.)", i), 200, -20, 20, 180, 0, TMath::Pi() * 2);
+ fOutput->Add(fZPhi[i]);
+ }
+ }
+
+ if (fAnalysisMode == AliPWG0Helper::kTPC || fAnalysisMode == AliPWG0Helper::kTPCITS)
+ {
+ fRawPt = new TH1F("fRawPt", "raw pt;p_{T};Count", 2000, 0, 100);
+ fOutput->Add(fRawPt);
+ }
fVertex = new TH3F("vertex_check", "vertex_check", 100, -1, 1, 100, -1, 1, 100, -30, 30);
fOutput->Add(fVertex);
fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta", fAnalysisMode);
fOutput->Add(fdNdEtaAnalysis);
+ fdNdEtaAnalysisND = new dNdEtaAnalysis("dndetaND", "dndetaND", fAnalysisMode);
+ fOutput->Add(fdNdEtaAnalysisND);
+
fdNdEtaAnalysisNSD = new dNdEtaAnalysis("dndetaNSD", "dndetaNSD", fAnalysisMode);
fOutput->Add(fdNdEtaAnalysisNSD);
// ESD analysis
if (fESD)
{
+ // check event type (should be PHYSICS = 7)
+ AliESDHeader* esdHeader = fESD->GetHeader();
+ if (!esdHeader)
+ {
+ Printf("ERROR: esdHeader could not be retrieved");
+ return;
+ }
+
+ /*
+ UInt_t eventType = esdHeader->GetEventType();
+ if (eventType != 7)
+ {
+ Printf("Skipping event because it is of type %d", eventType);
+ return;
+ }
+ */
+
// trigger definition
- eventTriggered = AliPWG0Helper::IsEventTriggered(fESD->GetTriggerMask(), fTrigger);
+ eventTriggered = AliPWG0Helper::IsEventTriggered(fESD, fTrigger);
// get the ESD vertex
vtxESD = AliPWG0Helper::GetVertex(fESD, fAnalysisMode);
if (AliPWG0Helper::TestVertex(vtxESD, fAnalysisMode))
{
vtxESD->GetXYZ(vtx);
+
+ // vertex stats
+ if (strcmp(vtxESD->GetTitle(), "vertexer: 3D") == 0)
+ {
+ fStats->Fill(1);
+ }
+ else if (strcmp(vtxESD->GetTitle(), "vertexer: Z") == 0)
+ fStats->Fill(2);
}
else
vtxESD = 0;
Int_t inputCount = 0;
Int_t* labelArr = 0;
Float_t* etaArr = 0;
- Float_t* ptArr = 0;
+ Float_t* thirdDimArr = 0;
if (fAnalysisMode == AliPWG0Helper::kSPD)
{
// get tracklets
labelArr = new Int_t[mult->GetNumberOfTracklets()];
etaArr = new Float_t[mult->GetNumberOfTracklets()];
- ptArr = new Float_t[mult->GetNumberOfTracklets()];
+ thirdDimArr = new Float_t[mult->GetNumberOfTracklets()];
- // get multiplicity from ITS tracklets
+ // get multiplicity from SPD tracklets
for (Int_t i=0; i<mult->GetNumberOfTracklets(); ++i)
{
//printf("%d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), mult->GetDeltaPhi(i));
if (TMath::Abs(deltaPhi) > 1)
printf("WARNING: Very high Delta Phi: %d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), deltaPhi);
+ Int_t label = mult->GetLabel(i, 0);
+ Float_t eta = mult->GetEta(i);
+
+ // control histograms
Float_t phi = mult->GetPhi(i);
if (phi < 0)
phi += TMath::Pi() * 2;
fPhi->Fill(phi);
- fEtaPhi->Fill(mult->GetEta(i), phi);
+ fEtaPhi->Fill(eta, phi);
+
+ if (deltaPhi < 0.01)
+ {
+ // layer 0
+ Float_t z = vtx[2] + 3.9 / TMath::Tan(2 * TMath::ATan(TMath::Exp(- eta)));
+ fZPhi[0]->Fill(z, phi);
+ // layer 1
+ z = vtx[2] + 7.6 / TMath::Tan(2 * TMath::ATan(TMath::Exp(- eta)));
+ fZPhi[1]->Fill(z, phi);
+ }
fDeltaPhi->Fill(deltaPhi);
- Int_t label = mult->GetLabel(i, 0);
- Float_t eta = mult->GetEta(i);
+ if (fDeltaPhiCut > 0 && TMath::Abs(deltaPhi) > fDeltaPhiCut)
+ continue;
if (fUseMCKine)
{
{
TParticle* particle = stack->Particle(label);
eta = particle->Eta();
+ phi = particle->Phi();
}
else
Printf("WARNING: fUseMCKine set without fOnlyPrimaries and no label found");
}
-
+
etaArr[inputCount] = eta;
labelArr[inputCount] = label;
- ptArr[inputCount] = 0; // no pt for tracklets
+ thirdDimArr[inputCount] = phi;
++inputCount;
}
- // fill multiplicity in pt bin
- for (Int_t i=0; i<inputCount; ++i)
- ptArr[i] = inputCount;
+ if (!fFillPhi)
+ {
+ // fill multiplicity in third axis
+ for (Int_t i=0; i<inputCount; ++i)
+ thirdDimArr[i] = inputCount;
+ }
- Printf("Accepted %d tracklets", inputCount);
+ Int_t firedChips = mult->GetNumberOfFiredChips(0) + mult->GetNumberOfFiredChips(1);
+ fFiredChips->Fill(firedChips, inputCount);
+ Printf("Accepted %d tracklets (%d fired chips)", inputCount, firedChips);
}
else if (fAnalysisMode == AliPWG0Helper::kTPC || fAnalysisMode == AliPWG0Helper::kTPCITS)
{
return;
}
- // get multiplicity from ESD tracks
- TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD, (fAnalysisMode == AliPWG0Helper::kTPC));
- Int_t nGoodTracks = list->GetEntries();
-
- labelArr = new Int_t[nGoodTracks];
- etaArr = new Float_t[nGoodTracks];
- ptArr = new Float_t[nGoodTracks];
-
- // loop over esd tracks
- for (Int_t i=0; i<nGoodTracks; i++)
+ if (vtxESD)
{
- AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(i));
- if (!esdTrack)
+ // get multiplicity from ESD tracks
+ TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD, (fAnalysisMode == AliPWG0Helper::kTPC));
+ Int_t nGoodTracks = list->GetEntries();
+ Printf("Accepted %d tracks", nGoodTracks);
+
+ labelArr = new Int_t[nGoodTracks];
+ etaArr = new Float_t[nGoodTracks];
+ thirdDimArr = new Float_t[nGoodTracks];
+
+ // loop over esd tracks
+ for (Int_t i=0; i<nGoodTracks; i++)
{
- AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", i));
- continue;
- }
-
- Float_t phi = esdTrack->Phi();
- if (phi < 0)
- phi += TMath::Pi() * 2;
- fPhi->Fill(phi);
- fEtaPhi->Fill(esdTrack->Eta(), phi);
-
- Float_t eta = esdTrack->Eta();
- Int_t label = TMath::Abs(esdTrack->GetLabel());
- Float_t pT = esdTrack->Pt();
-
- if (fOnlyPrimaries && label == 0)
- continue;
-
- if (fUseMCKine)
- {
- if (label > 0)
+ AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(i));
+ if (!esdTrack)
{
- TParticle* particle = stack->Particle(label);
- eta = particle->Eta();
- pT = particle->Pt();
+ AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", i));
+ continue;
}
- else
- Printf("WARNING: fUseMCKine set without fOnlyPrimaries and no label found");
+
+ Float_t phi = esdTrack->Phi();
+ if (phi < 0)
+ phi += TMath::Pi() * 2;
+
+ Float_t eta = esdTrack->Eta();
+ Int_t label = TMath::Abs(esdTrack->GetLabel());
+ Float_t pT = esdTrack->Pt();
+
+ fPhi->Fill(phi);
+ fEtaPhi->Fill(eta, phi);
+ if (eventTriggered && vtxESD)
+ fRawPt->Fill(pT);
+
+ if (fOnlyPrimaries && label == 0)
+ continue;
+
+ if (fUseMCKine)
+ {
+ if (label > 0)
+ {
+ TParticle* particle = stack->Particle(label);
+ eta = particle->Eta();
+ pT = particle->Pt();
+ }
+ else
+ Printf("WARNING: fUseMCKine set without fOnlyPrimaries and no label found");
+ }
+
+ etaArr[inputCount] = eta;
+ labelArr[inputCount] = TMath::Abs(esdTrack->GetLabel());
+ thirdDimArr[inputCount] = pT;
+ ++inputCount;
}
-
- etaArr[inputCount] = eta;
- labelArr[inputCount] = TMath::Abs(esdTrack->GetLabel());
- ptArr[inputCount] = pT;
- ++inputCount;
+
+ // TODO restrict inputCount used as measure for the multiplicity to |eta| < 1
+
+ delete list;
}
-
- Printf("Accepted %d tracks", nGoodTracks);
-
- delete list;
}
else
return;
fMult->Fill(inputCount);
fdNdEtaAnalysisESD->FillTriggeredEvent(inputCount);
+ fTriggerVsTime->SetPoint(fTriggerVsTime->GetN(), fESD->GetTimeStamp(), 1);
+
if (vtxESD)
{
// control hist
for (Int_t i=0; i<inputCount; ++i)
{
Float_t eta = etaArr[i];
- Float_t pt = ptArr[i];
+ Float_t thirdDim = thirdDimArr[i];
- fdNdEtaAnalysisESD->FillTrack(vtx[2], eta, pt);
+ fdNdEtaAnalysisESD->FillTrack(vtx[2], eta, thirdDim);
- if (TMath::Abs(vtx[2]) < 20)
+ if (TMath::Abs(vtx[2]) < 10)
{
fPartEta[0]->Fill(eta);
continue;
}
- fdNdEtaAnalysisTracks->FillTrack(vtxMC[2], particle->Eta(), (fAnalysisMode == AliPWG0Helper::kSPD) ? inputCount : particle->Pt());
+ Float_t thirdDim = -1;
+ if (fAnalysisMode == AliPWG0Helper::kSPD)
+ {
+ if (fFillPhi)
+ {
+ thirdDim = particle->Phi();
+ }
+ else
+ thirdDim = inputCount;
+ }
+ else
+ thirdDim = particle->Pt();
+
+ fdNdEtaAnalysisTracks->FillTrack(vtxMC[2], particle->Eta(), thirdDim);
} // end of track loop
// for event count per vertex
}
}
- delete[] etaArr;
- delete[] labelArr;
- delete[] ptArr;
+ if (etaArr)
+ delete[] etaArr;
+ if (labelArr)
+ delete[] labelArr;
+ if (thirdDimArr)
+ delete[] thirdDimArr;
}
if (fReadMC) // Processing of MC information (optional)
continue;
Float_t eta = particle->Eta();
- Float_t thirdDim = (fAnalysisMode == AliPWG0Helper::kSPD) ? nAcceptedParticles : particle->Pt();
+ Float_t thirdDim = -1;
+
+ if (fAnalysisMode == AliPWG0Helper::kSPD)
+ {
+ if (fFillPhi)
+ {
+ thirdDim = particle->Phi();
+ }
+ else
+ thirdDim = nAcceptedParticles;
+ }
+ else
+ thirdDim = particle->Pt();
fdNdEtaAnalysis->FillTrack(vtxMC[2], eta, thirdDim);
- if (processType != AliPWG0Helper::kSD )
+ if (processType != AliPWG0Helper::kSD)
fdNdEtaAnalysisNSD->FillTrack(vtxMC[2], eta, thirdDim);
+ if (processType == AliPWG0Helper::kND)
+ fdNdEtaAnalysisND->FillTrack(vtxMC[2], eta, thirdDim);
+
if (eventTriggered)
{
fdNdEtaAnalysisTr->FillTrack(vtxMC[2], eta, thirdDim);
fdNdEtaAnalysisTrVtx->FillTrack(vtxMC[2], eta, thirdDim);
}
- if (TMath::Abs(eta) < 0.8)
+ if (TMath::Abs(eta) < 1.0)
fPartPt->Fill(particle->Pt());
}
fdNdEtaAnalysis->FillEvent(vtxMC[2], nAcceptedParticles);
if (processType != AliPWG0Helper::kSD)
fdNdEtaAnalysisNSD->FillEvent(vtxMC[2], nAcceptedParticles);
+ if (processType == AliPWG0Helper::kND)
+ fdNdEtaAnalysisND->FillEvent(vtxMC[2], nAcceptedParticles);
if (eventTriggered)
{
fVertexResolution = dynamic_cast<TH1F*> (fOutput->FindObject("dndeta_vertex_resolution_z"));
fPhi = dynamic_cast<TH1F*> (fOutput->FindObject("fPhi"));
+ fRawPt = dynamic_cast<TH1F*> (fOutput->FindObject("fRawPt"));
fEtaPhi = dynamic_cast<TH2F*> (fOutput->FindObject("fEtaPhi"));
+ for (Int_t i=0; i<2; ++i)
+ fZPhi[i] = dynamic_cast<TH2F*> (fOutput->FindObject(Form("fZPhi_%d", i)));
fDeltaPhi = dynamic_cast<TH1F*> (fOutput->FindObject("fDeltaPhi"));
+ fFiredChips = dynamic_cast<TH2F*> (fOutput->FindObject("fFiredChips"));
+ fTriggerVsTime = dynamic_cast<TGraph*> (fOutput->FindObject("fTriggerVsTime"));
+ fStats = dynamic_cast<TH1F*> (fOutput->FindObject("fStats"));
fEsdTrackCuts = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fEsdTrackCuts"));
}
fMultVtx->Draw("SAME");
}
+ if (fFiredChips)
+ {
+ new TCanvas;
+ fFiredChips->Draw("COLZ");
+ }
+
if (fPartEta[0])
{
Int_t events1 = (Int_t) fEvents->Integral(fEvents->GetXaxis()->FindBin(-19.9), fEvents->GetXaxis()->FindBin(-0.001));
if (fPhi)
fPhi->Write();
+ if (fRawPt)
+ fRawPt->Write();
+
if (fEtaPhi)
fEtaPhi->Write();
+ for (Int_t i=0; i<2; ++i)
+ if (fZPhi[i])
+ fZPhi[i]->Write();
+
+ if (fFiredChips)
+ fFiredChips->Write();
+
+ if (fTriggerVsTime)
+ fTriggerVsTime->Write();
+
+ if (fStats)
+ fStats->Write();
+
fVertex = dynamic_cast<TH3F*> (fOutput->FindObject("vertex_check"));
if (fVertex)
fVertex->Write();
if (fOutput)
{
fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
+ fdNdEtaAnalysisND = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndetaND"));
fdNdEtaAnalysisNSD = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndetaNSD"));
fdNdEtaAnalysisTr = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndetaTr"));
fdNdEtaAnalysisTrVtx = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndetaTrVtx"));
}
fdNdEtaAnalysis->Finish(0, -1, AlidNdEtaCorrection::kNone);
+ fdNdEtaAnalysisND->Finish(0, -1, AlidNdEtaCorrection::kNone);
fdNdEtaAnalysisNSD->Finish(0, -1, AlidNdEtaCorrection::kNone);
fdNdEtaAnalysisTr->Finish(0, -1, AlidNdEtaCorrection::kNone);
fdNdEtaAnalysisTrVtx->Finish(0, -1, AlidNdEtaCorrection::kNone);
TFile* fout = new TFile("analysis_mc.root","RECREATE");
fdNdEtaAnalysis->SaveHistograms();
+ fdNdEtaAnalysisND->SaveHistograms();
fdNdEtaAnalysisNSD->SaveHistograms();
fdNdEtaAnalysisTr->SaveHistograms();
fdNdEtaAnalysisTrVtx->SaveHistograms();
class TH2F;
class TH3F;
class AliESDEvent;
+class TGraph;
class AlidNdEtaTask : public AliAnalysisTask {
public:
void SetOnlyPrimaries(Bool_t flag = kTRUE) { fOnlyPrimaries = flag; }
void SetUseMCKine(Bool_t flag = kTRUE) { fUseMCKine = flag; }
void SetTrigger(AliPWG0Helper::Trigger trigger) { fTrigger = trigger; }
+ void SetFillPhi(Bool_t flag = kTRUE) { fFillPhi = flag; }
+ void SetDeltaPhiCut(Float_t cut) { fDeltaPhiCut = cut; }
void SetOption(const char* opt) { fOption = opt; }
TString fOption; // option string
AliPWG0Helper::AnalysisMode fAnalysisMode; // detector that is used for analysis
AliPWG0Helper::Trigger fTrigger; // trigger that is used
+ Bool_t fFillPhi; // if true phi is filled as 3rd coordinate in all maps
+ Float_t fDeltaPhiCut; // cut in delta phi (only SPD)
Bool_t fReadMC; // if true reads MC data (to build correlation maps)
Bool_t fUseMCVertex; // the MC vtx is used instead of the ESD vertex (for syst. check)
// Gathered from MC (when fReadMC is set)
dNdEtaAnalysis* fdNdEtaAnalysis; //! contains the dndeta from the full sample
- dNdEtaAnalysis* fdNdEtaAnalysisNSD; //! contains the dndeta for the NSD sample
+ dNdEtaAnalysis* fdNdEtaAnalysisND; //! contains the dndeta for the ND sample
+ dNdEtaAnalysis* fdNdEtaAnalysisNSD; //! contains the dndeta for the NSD sample
dNdEtaAnalysis* fdNdEtaAnalysisTr; //! contains the dndeta from the triggered events
dNdEtaAnalysis* fdNdEtaAnalysisTrVtx; //! contains the dndeta from the triggered events with vertex
dNdEtaAnalysis* fdNdEtaAnalysisTracks; //! contains the dndeta from the triggered events with vertex counted from the mc particles associated to the tracks (comparing this to the raw values from the esd shows the effect of the detector resolution)
// control histograms (ESD)
TH3F* fVertex; //! 3d vertex distribution
TH1F* fPhi; //! raw phi distribution
+ TH1F* fRawPt; //! raw pt distribution
TH2F* fEtaPhi; //! raw eta - phi distribution
+ TH2F* fZPhi[2]; //! raw z - phi distribution from tracklets per layer (only SPD)
TH1F* fDeltaPhi; //! histogram of delta_phi values for tracklets (only for SPD analysis)
+ TH2F* fFiredChips; //! fired chips l1+l2 vs. number of tracklets (only for SPD analysis)
+ TGraph* fTriggerVsTime; //! trigger as function of event time
+ TH1F* fStats; //! further statistics : bin 1 = vertexer 3d, bin 2 = vertexer z
private:
AlidNdEtaTask(const AlidNdEtaTask&);
// Note: the last parameter does not define which analysis is going to happen, the histograms will be overwritten when loading from the f
dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaNSD", "dndetaNSD");
fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
- fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.3, AlidNdEtaCorrection::kNSD, "ESD -> NSD");
+ fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kNSD, "ESD -> NSD");
//fdNdEtaAnalysis->DrawHistograms(kTRUE);
TFile* file2 = TFile::Open(dataOutput, "RECREATE");
fdNdEtaAnalysis->SaveHistograms();
file->cd();
dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
- fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.3, AlidNdEtaCorrection::kINEL, "ESD -> full inelastic");
+ fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kINEL, "ESD -> full inelastic");
//fdNdEtaAnalysis->DrawHistograms(kTRUE);
file2->cd();
fdNdEtaAnalysis->SaveHistograms();
file->cd();
fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTr", "dndetaTr");
fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
- fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.3, AlidNdEtaCorrection::kVertexReco, "ESD -> minimum bias");
+ fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kVertexReco, "ESD -> minimum bias");
//fdNdEtaAnalysis->DrawHistograms(kTRUE);
file2->cd();
fdNdEtaAnalysis->SaveHistograms();
file->cd();
fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
- fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.3, AlidNdEtaCorrection::kTrack2Particle, "ESD -> MB with vertex");
+ fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kTrack2Particle, "ESD -> MB with vertex");
//fdNdEtaAnalysis->DrawHistograms(kTRUE);
file2->cd();
fdNdEtaAnalysis->SaveHistograms();
file->cd();
fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTracks", "dndetaTracks");
fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
- fdNdEtaAnalysis->Finish(0, 0.3, AlidNdEtaCorrection::kNone, "ESD raw with pt cut");
+ fdNdEtaAnalysis->Finish(0, 0.21, AlidNdEtaCorrection::kNone, "ESD raw with pt cut");
//fdNdEtaAnalysis->DrawHistograms(kTRUE);
file2->cd();
fdNdEtaAnalysis->SaveHistograms();
TFile::Open(correctionMapFile);
dNdEtaCorrection->LoadHistograms();
- fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.3, AlidNdEtaCorrection::kINEL);
+ fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kINEL);
//fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0, AlidNdEtaCorrection::kINEL);
//fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0, AlidNdEtaCorrection::kTrack2Particle);
}
else
- fdNdEtaAnalysis->Finish(0, 0.3, AlidNdEtaCorrection::kNone);
+ fdNdEtaAnalysis->Finish(0, 0.21, AlidNdEtaCorrection::kNone);
fdNdEtaAnalysis->DrawHistograms(simple);
return fdNdEtaAnalysis;
}
-void correct()
+void correct(Bool_t onlyESD = kFALSE)
{
FinishAnalysisAll();
gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/dNdEta/drawPlots.C");
- dNdEta();
+ dNdEta(onlyESD);
}
}
//new TCanvas; correctedEvents->DrawCopy("TEXT");
- //new TCanvas; kineBias->Draw();
+ //new TCanvas; kineBias->DrawCopy();
}
fData->PrintInfo(ptCut);
Int_t ptLowBin = 1;
if (ptCut > 0 && fAnalysisMode != AliPWG0Helper::kSPD)
ptLowBin = dataHist->GetZaxis()->FindBin(ptCut);
+
+ //new TCanvas; dataHist->DrawCopy();
+ //dataHist->Sumw2();
dataHist->GetZaxis()->SetRange(ptLowBin, dataHist->GetZaxis()->GetNbins()+1);
printf("pt/multiplicity range %d %d\n", ptLowBin, dataHist->GetZaxis()->GetNbins()+1);
TH2D* vtxVsEta = dynamic_cast<TH2D*> (dataHist->Project3D("yx2e"));
+
+ //new TCanvas; vtxVsEta->Draw("COLZ");
dataHist->GetZaxis()->SetRange(0, 0);
vtxVsEta->GetXaxis()->SetTitle(dataHist->GetXaxis()->GetTitle());
Int_t vertexBinEnd = vertexHist->GetXaxis()->FindBin(vertexRangeEnd[vertexPos]);
const Int_t *binBegin = 0;
+ const Int_t maxBins = 60;
// adjust acceptance range
+ // produce with drawPlots.C: DetermineAcceptance(...)
if (fAnalysisMode == AliPWG0Helper::kSPD)
{
//const Int_t binBeginSPD[30] = { 18, 16, 15, 14, 13, 13, 12, 11, 9, 7, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1 }; // by eye
- const Int_t binBeginSPD[30] = { -1, -1, -1, -1, 16, 14, 12, 10, 9, 7, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, -1, -1, -1, -1}; // limit in correction map is 5
+ //const Int_t binBeginSPD[30] = { -1, -1, -1, -1, 16, 14, 12, 10, 9, 7, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, -1, -1, -1, -1}; // limit in correction map is 5
//const Int_t binBegin[30] = { -1, -1, -1, 17, 15, 14, 12, 10, 8, 7, 6, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, -1, -1, -1}; // limit in correction map is 10
//const Int_t binBeginSPD[30] = { -1, -1, -1, -1, 16, 15, 13, 11, 9, 8, 7, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, -1, -1, -1, -1}; // limit 2
+ const Int_t binBeginSPD[maxBins] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 14, 13, 12, 11, 10, 9, 9, 8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; //limit 5
binBegin = binBeginSPD;
}
else if (fAnalysisMode == AliPWG0Helper::kTPC)
{
- const Int_t binBeginTPC[30] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // limit 5, pt cut off 0.2 mev/c
+ //const Int_t binBeginTPC[30] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // limit 5, pt cut off 0.2 mev/c
+ const Int_t binBeginTPC[maxBins] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // limit 5
binBegin = binBeginTPC;
}
}
Int_t vtxBegin = 1;
- Int_t vtxEnd = 30;
+ Int_t vtxEnd = maxBins;
if (binBegin)
{
vtxBegin = binBegin[iEta - 1];
- vtxEnd = 18 + 1 - binBegin[30 - iEta];
+ vtxEnd = 18 + 1 - binBegin[maxBins - iEta];
}
else
Printf("WARNING: No acceptance applied!");
else
{
unusedTracks += vtxVsEta->GetBinContent(iVtx, iEta);
- unusedEvents +=vertexHist->GetBinContent(iVtx);
+ unusedEvents += vertexHist->GetBinContent(iVtx);
}
}
}
}
- //printf("Eta: %d Vertex Range: %d %d, Event Count %f, Track Sum: %f, Track Sum corrected: %f\n", iEta, vertexBinBegin, vertexBinEnd, totalEvents, sum, sum / ptCutOffCorrection);
+ //printf("Eta: %d (%f) Vertex Range: %d %d, Event Count %f, Track Sum: %f, Track Sum corrected: %f \n", iEta, vtxVsEta->GetYaxis()->GetBinCenter(iEta), vertexBinBegin, vertexBinEnd, totalEvents, sum, sum / ptCutOffCorrection);
Int_t bin = fdNdEta[vertexPos]->FindBin(vtxVsEta->GetYaxis()->GetBinCenter(iEta));
if (bin > 0 && bin <= fdNdEta[vertexPos]->GetNbinsX())
TH1F* GetdNdEtaPtCutOffCorrectedHistogram(Int_t i = 0) const { return fdNdEtaPtCutOffCorrected[i]; }
void SetAnalysisMode(AliPWG0Helper::AnalysisMode mode) { fAnalysisMode = mode; }
+ AliPWG0Helper::AnalysisMode GetAnalysisMode() { return fAnalysisMode; }
protected:
Float_t GetVtxMin(Float_t eta);
void loadlibs()
{
+ gSystem->Load("libVMC");
+ gSystem->Load("libTree");
+ gSystem->Load("libSTEERBase");
+ gSystem->Load("libESD");
+ gSystem->Load("libAOD");
gSystem->Load("libANALYSIS");
+ gSystem->Load("libANALYSISalice");
gSystem->Load("libPWG0base");
}
void SetRanges(TAxis* axis)
{
if (strcmp(axis->GetTitle(), "#eta") == 0)
- axis->SetRangeUser(-1.7999, 1.7999);
- if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0)
+ axis->SetRangeUser(-1.4999, 1.4999);
+ if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0 || strcmp(axis->GetTitle(), "p_{T} (GeV/c)") == 0)
+ {
axis->SetRangeUser(0, 4.9999);
- if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0)
+ axis->SetTitle("p_{T} (GeV/c)");
+ }
+ if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0 || strcmp(axis->GetTitle(), "vtx z (cm)") == 0)
+ {
axis->SetRangeUser(-15, 14.9999);
+ axis->SetTitle("vtx-z (cm)");
+ }
if (strcmp(axis->GetTitle(), "Ntracks") == 0)
axis->SetRangeUser(0, 99.9999);
}
TH1* GetMCHist(const char* folder, Float_t ptCut, const char* tag)
{
+ loadlibs();
+
dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis(folder, folder);
fdNdEtaAnalysis->LoadHistograms();
fdNdEtaAnalysis->Finish(0, ptCut, AlidNdEtaCorrection::kNone, tag);
return fdNdEtaAnalysis->GetdNdEtaHistogram(0);
}
+void dNdEtaFinal(Bool_t spd = kTRUE)
+{
+ TFile* file = TFile::Open("analysis_esd.root");
+ TH1* histESD = (TH1*) file->Get("dndeta/dNdEta_corrected");
+ TH1* histESDnsd = (TH1*) file->Get("dndetaNSD/dNdEta_corrected");
+ Prepare1DPlot(histESD);
+ Prepare1DPlot(histESDnsd);
+
+ TCanvas* canvas = new TCanvas("dNdEtaFinal", "dNdEtaFinal", 600, 600);
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
+ gPad->SetLeftMargin(0.12);
+ gPad->SetBottomMargin(0.12);
+ gPad->SetGridx();
+ gPad->SetGridy();
+
+ Float_t etaMax = 1.9;
+ Float_t histMax = 1.39;
+ Float_t systErrorValue = 0.023;
+ Float_t systErrorNSDValue = 0.081;
+ if (!spd)
+ {
+ //etaMax = 1.5;
+ histMax = 0.99;
+ systErrorValue = 0.043;
+ systErrorNSDValue = 0.088;
+ }
+
+ dummy = new TH2F("dummy", ";#eta;dN_{ch}/d#eta", 100, -etaMax, etaMax, 100, 3, 8);
+ dummy->SetStats(0);
+ dummy->GetYaxis()->SetTitleOffset(1.3);
+
+ histESD->SetMarkerStyle(20);
+ histESDnsd->SetMarkerStyle(21);
+ histESDnsd->SetMarkerColor(4);
+ histESDnsd->SetLineColor(4);
+ histESD->SetMarkerSize(1.5);
+ histESDnsd->SetMarkerSize(1.5);
+
+ histESD->GetXaxis()->SetRangeUser(-histMax, histMax);
+ histESDnsd->GetXaxis()->SetRangeUser(-histMax, histMax);
+
+ legend = new TLegend(0.3, 0.2, 0.78, 0.4);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+ legend->AddEntry(histESD, "Inelastic events", "P");
+ legend->AddEntry(histESDnsd, "NSD events", "P");
+
+ dummy->Draw();
+
+ // syst errors.
+ TH1* systError = (TH1*) histESD->Clone("systError");
+ for (Int_t i=1; i<=systError->GetNbinsX(); ++i)
+ systError->SetBinError(i, systError->GetBinContent(i) * systErrorValue);
+ // change error drawing style
+ systError->SetFillColor(15);
+ systError->DrawCopy("SAME E2 ][");
+
+ // syst error NSD
+ for (Int_t i=1; i<=systError->GetNbinsX(); ++i)
+ {
+ systError->SetBinContent(i, histESDnsd->GetBinContent(i));
+ systError->SetBinError(i, systError->GetBinContent(i) * systErrorNSDValue);
+ }
+ systError->DrawCopy("SAME E2 ][");
+
+ histESD->Draw("SAME");
+ histESDnsd->Draw("SAME");
+ legend->Draw();
+
+ canvas->SaveAs(Form("%s_dndeta_final.eps", (spd) ? "spd" : "tpc"));
+}
+
+void dNdEtaPythiaPhojet()
+{
+ // evtl. deactivate acceptance maps in dNdEtaAnalysis.cxx
+
+ loadlibs();
+
+ TH1* hist[4];
+
+ TFile::Open("LHC08c11_10TeV_0.5T/mb1/spd/analysis_mc.root");
+ hist[0] = (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMC");
+ hist[1] = (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsd");
+
+ TFile::Open("LHC08c15_10TeV_0.5T_Phojet/mb1/spd/analysis_mc.root");
+ hist[2] = (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMCPhojet");
+ hist[3] = (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsdPhojet");
+
+ file = TFile::Open("pythia_phojet_dndeta.root", "RECREATE");
+ for (Int_t i=0; i<4; i++)
+ hist[i]->Write();
+ file->Close();
+}
+
void dNdEta(Bool_t onlyESD = kFALSE, Bool_t save = kTRUE)
{
+ loadlibs();
+
TFile* file = TFile::Open("analysis_esd.root");
+
+ dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
+ fdNdEtaAnalysis->LoadHistograms("dndeta");
+
TH1* histESD = (TH1*) file->Get("dndeta/dNdEta_corrected");
TH1* histESDnsd = (TH1*) file->Get("dndetaNSD/dNdEta_corrected");
+ TH1* histESDnsdNoPt = (TH1*) file->Get("dndetaNSD/dNdEta");
TH1* histESDNoPt = (TH1*) file->Get("dndeta/dNdEta");
TH1* histESDMB = (TH1*) file->Get("dndetaTr/dNdEta_corrected");
TH1* histESDMBNoPt = (TH1*) file->Get("dndetaTr/dNdEta");
histESD->SetMarkerColor(1);
histESDnsd->SetMarkerColor(6);
histESDMB->SetMarkerColor(2);
- histESDMBVtx->SetMarkerColor(3);
+ histESDMBVtx->SetMarkerColor(4);
histESD->SetLineColor(1);
histESDnsd->SetLineColor(6);
histESDMB->SetLineColor(2);
- histESDMBVtx->SetLineColor(3);
+ histESDMBVtx->SetLineColor(4);
histESDNoPt->SetMarkerColor(1);
histESDMBNoPt->SetMarkerColor(2);
- histESDMBVtxNoPt->SetMarkerColor(3);
- histESDMBTracksNoPt->SetMarkerColor(4);
+ histESDMBVtxNoPt->SetMarkerColor(4);
+ histESDMBTracksNoPt->SetMarkerColor(3);
histESD->SetMarkerStyle(20);
histESDnsd->SetMarkerStyle(29);
histESDMBVtxNoPt->SetMarkerStyle(22);
histESDMBTracksNoPt->SetMarkerStyle(23);
- //Float_t etaLimit = 1.2999;
- Float_t etaLimit = 2.41;
- Float_t etaPlotLimit = 2.6;
+ Float_t etaLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 0.89 : 1.79;
+ Float_t etaPlotLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 1.2 : 2.3;
+ //Float_t etaLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 0.89 : 1.39;
+ //Float_t etaPlotLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 1.2 : 1.9;
histESDMBVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
histESDMB->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
Float_t max = TMath::Max(histESDMBVtx->GetMaximum(), histESDMB->GetMaximum());
max = TMath::Max(max, histESD->GetMaximum());
- TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 0, max * 1.1);
+ TLegend* legend = new TLegend(0.35, 0.05, 0.75, 0.4);
+ legend->SetFillColor(0);
+ legend->AddEntry(histESDMBVtx, "Triggered, vertex");
+ legend->AddEntry(histESDMB, "Triggered");
+ legend->AddEntry(histESD, "All events");
+
+ TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 2.1, max * 1.1);
Prepare1DPlot(dummy);
dummy->SetStats(kFALSE);
dummy->SetXTitle("#eta");
histESDMBVtx->Draw("SAME");
histESDMB->Draw("SAME");
histESD->Draw("SAME");
+ legend->Draw();
if (save)
{
TFile* file2 = TFile::Open("analysis_mc.root");
+ TH1* histMCTrVtx = (TH1*) GetMCHist("dndetaTrVtx", -1, "MC: MB with trigger")->Clone("histMCTrVtx");
+ TH1* ratioTrVtx = (TH1*) DrawdNdEtaRatio(histESDMBVtx, histMCTrVtx, "triggered_vertex", etaPlotLimit)->Clone();
+
TH1* histMC = (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMC");
TH1* histMCTr = (TH1*) GetMCHist("dndetaTr", -1, "MC: minimum bias")->Clone("histMCTr");
- TH1* histMCTrVtx = (TH1*) GetMCHist("dndetaTrVtx", -1, "MC: MB with trigger")->Clone("histMCTrVtx");
TH1* histMCnsd = (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsd");
- TH1* histMCPtCut = (TH1*) GetMCHist("dndeta", 0.3, "MC: full inelastic, pt cut")->Clone("histMCPtCut");
- TH1* histMCTrPtCut = (TH1*) GetMCHist("dndetaTr", 0.3, "MC: minimum bias, pt cut")->Clone("histMCTrPtCut");
- TH1* histMCTrVtxPtCut = (TH1*) GetMCHist("dndetaTrVtx", 0.3, "MC: MB with trigger, pt cut")->Clone("histMCTrVtxPtCut");
- TH1* histMCTracksPtCut = (TH1*) GetMCHist("dndetaTracks", 0.3, "MC: Tracks w/o resolution effect, pt cut")->Clone("histMCTracksPtCut");
+ TH1* histMCPtCut = (TH1*) GetMCHist("dndeta", 0.21, "MC: full inelastic, pt cut")->Clone("histMCPtCut");
+ TH1* histMCTrPtCut = (TH1*) GetMCHist("dndetaTr", 0.21, "MC: minimum bias, pt cut")->Clone("histMCTrPtCut");
+ TH1* histMCTrVtxPtCut = (TH1*) GetMCHist("dndetaTrVtx", 0.21, "MC: MB with trigger, pt cut")->Clone("histMCTrVtxPtCut");
+ TH1* histMCnsdNoPt = (TH1*) GetMCHist("dndetaNSD", 0.21, "MC: NSD, put cut")->Clone("histMCnsdNoPt");
+ TH1* histMCTracksPtCut = (TH1*) GetMCHist("dndetaTracks", 0.21, "MC: Tracks w/o resolution effect, pt cut")->Clone("histMCTracksPtCut");
Prepare1DPlot(histMC);
Prepare1DPlot(histMCnsd);
histMC->SetLineColor(1);
histMCnsd->SetLineColor(6);
histMCTr->SetLineColor(2);
- histMCTrVtx->SetLineColor(3);
+ histMCTrVtx->SetLineColor(4);
histMCPtCut->SetLineColor(1);
histMCTrPtCut->SetLineColor(2);
- histMCTrVtxPtCut->SetLineColor(3);
+ histMCTrVtxPtCut->SetLineColor(4);
if (histMCTracksPtCut)
- histMCTracksPtCut->SetLineColor(4);
+ histMCTracksPtCut->SetLineColor(3);
TCanvas* canvas2 = new TCanvas("dNdEta2", "dNdEta2", 500, 500);
canvas2->SaveAs("dNdEta2.eps");
}
- DrawdNdEtaRatio(histESD, histMC, "full_inelastic", etaPlotLimit);
- DrawdNdEtaRatio(histESDMB, histMCTr, "triggered", etaPlotLimit);
- DrawdNdEtaRatio(histESDMBVtx, histMCTrVtx, "triggered_vertex", etaPlotLimit);
- DrawdNdEtaRatio(histESDnsd, histMCnsd, "NSD", etaPlotLimit);
+ TH1* ratio = (TH1*) DrawdNdEtaRatio(histESD, histMC, "full_inelastic", etaPlotLimit)->Clone();
+ TH1* ratioTr = (TH1*) DrawdNdEtaRatio(histESDMB, histMCTr, "triggered", etaPlotLimit)->Clone();
+ TH1* ratioTrVtx = (TH1*) DrawdNdEtaRatio(histESDMBVtx, histMCTrVtx, "triggered_vertex", etaPlotLimit)->Clone();
+ TH1* ratioTrVtxNoPt = (TH1*) DrawdNdEtaRatio(histESDMBVtxNoPt, histMCTrVtxPtCut, "triggered_vertex_nopt", etaPlotLimit)->Clone();
+ TH1* ratioNSD = (TH1*) DrawdNdEtaRatio(histESDnsd, histMCnsd, "NSD", etaPlotLimit)->Clone();
+
+ // draw ratios of single steps
+ c7 = new TCanvas("all_ratios", "all_ratios", 600, 600);
+ c7->SetRightMargin(0.05);
+ c7->SetTopMargin(0.05);
+ c7->SetGridx();
+ c7->SetGridy();
+
+ ratioTrVtxNoPt->SetMarkerStyle(20);
+ ratioTrVtx->SetMarkerStyle(21);
+ ratioTr->SetMarkerStyle(23);
+ ratio->SetMarkerStyle(22);
+ ratioNSD->SetMarkerStyle(26);
+
+ ratioTrVtxNoPt->SetMarkerSize(2);
+ ratioTrVtx->SetMarkerSize(2);
+ ratioTr->SetMarkerSize(2);
+ ratio->SetMarkerSize(2);
+ ratioNSD->SetMarkerSize(2);
+
+ ratioTrVtxNoPt->SetMarkerColor(1);
+ ratioTrVtx->SetMarkerColor(2);
+ ratioTr->SetMarkerColor(4);
+ ratio->SetMarkerColor(2);
+ ratioNSD->SetMarkerColor(1);
+
+ ratioTrVtxNoPt->SetLineColor(1);
+ ratioTrVtx->SetLineColor(2);
+ ratioTr->SetLineColor(4);
+ ratio->SetLineColor(2);
+ ratioNSD->SetLineColor(1);
+
+ legend7 = new TLegend(0.13, 0.7, 0.94, 0.9);
+ legend7->SetFillColor(0);
+ legend7->SetTextSize(0.035);
+ legend7->SetNColumns(2);
+
+ flat = new TF1("flat", "-1", -5, 5);
+ ratioTrVtxNoPt->Add(flat);
+ ratioTrVtx->Add(flat);
+ ratioTr->Add(flat);
+ ratio->Add(flat);
+ ratioNSD->Add(flat);
+
+ ratioTrVtxNoPt->Scale(100);
+ ratioTrVtx->Scale(100);
+ ratioTr->Scale(100);
+ ratio->Scale(100);
+ ratioNSD->Scale(100);
+
+ ratio->Add(ratioTr, -1);
+ ratioNSD->Add(ratioTr, -1);
+ ratioTr->Add(ratioTrVtx, -1);
+ ratioTrVtx->Add(ratioTrVtxNoPt, -1);
+
+ legend7->AddEntry(ratioTrVtxNoPt, "Track-to-particle", "P");
+ legend7->AddEntry(ratio, "Trigger-bias INEL", "P");
+ legend7->AddEntry(ratioTr, "Vertex-reconstruction", "P");
+ legend7->AddEntry(ratioNSD, "Trigger-bias NSD", "P");
+ if (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC)
+ legend7->AddEntry(ratioTrVtx, "p_{T} cut-off", "P");
+
+ TH1* dummy7 = new TH2F("dummy7", ";#eta;Deviation in %", 100, -etaPlotLimit, etaPlotLimit, 100, -5, 7);
+ dummy7->SetStats(0);
+ dummy7->Draw();
+
+ ratio->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
+ ratioTr->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
+ ratioTrVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
+ ratioTrVtxNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
+ ratioNSD->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
+
+ ratio->Draw("HIST EP SAME");
+ ratioTr->Draw("HIST EP SAME");
+ if (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC)
+ ratioTrVtx->Draw("HIST EP SAME");
+ ratioTrVtxNoPt->Draw("HIST EP SAME");
+ ratioNSD->Draw("HIST EP SAME");
+ legend7->Draw();
+
+ c7->SaveAs("ratios.eps");
new TCanvas;
dummy2->DrawCopy();
histMCnsd->Draw("SAME");
histESDnsd->Draw("SAME");
- TH1* ratio = (TH1*) histMC->Clone("ratio");
+ ratio = (TH1*) histMC->Clone("ratio");
TH1* ratioNoPt = (TH1*) histMCPtCut->Clone("ratioNoPt");
ratio->Divide(histESD);
PrintIntegratedDeviation(histMCTr, histESDMB, "triggered");
PrintIntegratedDeviation(histMCTrVtx, histESDMBVtx, "trigger, vertex");
PrintIntegratedDeviation(histMCPtCut, histESDNoPt, "all events (no pt corr)");
+ PrintIntegratedDeviation(histMCnsdNoPt, histESDnsdNoPt, "all events (NSD) (no pt corr)");
PrintIntegratedDeviation(histMCTrPtCut, histESDMBNoPt, "triggered (no pt corr)");
PrintIntegratedDeviation(histMCTrVtxPtCut, histESDMBVtxNoPt, "trigger, vertex (no pt corr)");
- TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 700, 600);
+ TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 600, 600);
canvas3->Range(0, 0, 1, 1);
//canvas3->Divide(1, 2, 0, 0);
//canvas3->cd(1);
TPad* pad1 = new TPad("dNdEta_1", "", 0, 0.5, 0.98, 0.98);
+ pad1->SetTopMargin(0.05);
+ pad1->SetLeftMargin(0.13);
pad1->Draw();
TPad* pad2 = new TPad("dNdEta_2", "", 0, 0.02, 0.98, 0.5);
+ pad2->SetLeftMargin(0.13);
pad2->Draw();
- pad1->SetRightMargin(0.05);
- pad2->SetRightMargin(0.05);
+ pad1->SetRightMargin(0.01);
+ pad2->SetRightMargin(0.01);
// no border between them
pad1->SetBottomMargin(0);
pad2->SetTopMargin(0);
pad1->cd();
+ pad1->SetGridx();
+ pad1->SetGridy();
- TLegend* legend = new TLegend(0.4, 0.05, 0.65, 0.3);
- legend->SetFillColor(0);
- legend->AddEntry(histESDMBVtx, "triggered, vertex");
- legend->AddEntry(histESDMB, "triggered");
- legend->AddEntry(histESD, "all events");
legend->AddEntry(histMC, "MC prediction");
- dummy->GetXaxis()->SetLabelSize(0.06);
- dummy->GetYaxis()->SetLabelSize(0.06);
- dummy->GetXaxis()->SetTitleSize(0.06);
- dummy->GetYaxis()->SetTitleSize(0.06);
- dummy->GetYaxis()->SetTitleOffset(0.7);
+ dummy->GetXaxis()->SetLabelSize(0.08);
+ dummy->GetYaxis()->SetLabelSize(0.08);
+ dummy->GetXaxis()->SetTitleSize(0.08);
+ dummy->GetYaxis()->SetTitleSize(0.08);
+ dummy->GetYaxis()->SetTitleOffset(0.8);
dummy->DrawCopy();
histESDMBVtx->Draw("SAME");
histESDMB->Draw("SAME");
histESD->Draw("SAME");
histMC->Draw("SAME");
+ legend->SetTextSize(0.08);
legend->Draw();
pad2->cd();
pad2->SetBottomMargin(0.15);
+ //pad2->SetGridx();
+ //pad2->SetGridy();
- Float_t minR = 0.9; //TMath::Min(0.961, ratio->GetMinimum() * 0.95);
- Float_t maxR = 1.1; //TMath::Max(1.049, ratio->GetMaximum() * 1.05);
+ Float_t minR = 0.91; //TMath::Min(0.961, ratio->GetMinimum() * 0.95);
+ Float_t maxR = 1.09; //TMath::Max(1.049, ratio->GetMaximum() * 1.05);
- TH1F dummy3("dummy3", ";#eta;Ratio: MC / ESD", 100, -etaPlotLimit, etaPlotLimit);
+ TH1F dummy3("dummy3", ";#eta;Ratio: MC / corr", 100, -etaPlotLimit, etaPlotLimit);
dummy3.SetStats(kFALSE);
for (Int_t i=1; i<=100; ++i)
dummy3.SetBinContent(i, 1);
dummy3.GetYaxis()->SetRangeUser(minR, maxR);
dummy3.SetLineWidth(2);
- dummy3.GetXaxis()->SetLabelSize(0.06);
- dummy3.GetYaxis()->SetLabelSize(0.06);
- dummy3.GetXaxis()->SetTitleSize(0.06);
- dummy3.GetYaxis()->SetTitleSize(0.06);
- dummy3.GetYaxis()->SetTitleOffset(0.7);
+ dummy3.GetXaxis()->SetLabelSize(0.08);
+ dummy3.GetYaxis()->SetLabelSize(0.08);
+ dummy3.GetXaxis()->SetTitleSize(0.08);
+ dummy3.GetYaxis()->SetTitleSize(0.08);
+ dummy3.GetYaxis()->SetTitleOffset(0.8);
dummy3.DrawCopy();
ratio->Draw("SAME");
legend->Draw();
}
-void DrawdNdEtaRatio(TH1* corr, TH1* mc, const char* name, Float_t etaPlotLimit)
+TH1* DrawdNdEtaRatio(TH1* corr, TH1* mc, const char* name, Float_t etaPlotLimit)
{
- TCanvas* canvas3 = new TCanvas(name, name, 700, 600);
+ TCanvas* canvas3 = new TCanvas(name, name, 600, 600);
canvas3->Range(0, 0, 1, 1);
TPad* pad1 = new TPad(Form("%s_1", name), "", 0, 0.5, 0.98, 0.98);
TPad* pad2 = new TPad(Form("%s_2", name), "", 0, 0.02, 0.98, 0.5);
pad2->Draw();
- pad1->SetRightMargin(0.05);
- pad2->SetRightMargin(0.05);
-
+ pad1->SetRightMargin(0.01);
+ pad2->SetRightMargin(0.01);
+ pad1->SetTopMargin(0.05);
+ pad1->SetLeftMargin(0.13);
+ pad2->SetLeftMargin(0.13);
+ pad2->SetBottomMargin(0.15);
+
// no border between them
pad1->SetBottomMargin(0);
pad2->SetTopMargin(0);
pad1->cd();
+ pad1->SetGridx();
+ pad1->SetGridy();
- TLegend* legend = new TLegend(0.4, 0.05, 0.65, 0.3);
+ TLegend* legend = new TLegend(0.35, 0.05, 0.75, 0.3);
legend->SetFillColor(0);
- legend->AddEntry(corr, "corrected");
+ legend->AddEntry(corr, "Corrected");
legend->AddEntry(mc, "MC prediction");
+ legend->SetTextSize(0.08);
- TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 0, corr->GetMaximum() * 1.1);
+ TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 3.1, corr->GetMaximum() * 1.1);
Prepare1DPlot(dummy);
dummy->SetStats(kFALSE);
dummy->SetXTitle("#eta");
dummy->SetYTitle("dN_{ch}/d#eta");
dummy->GetYaxis()->SetTitleOffset(1);
- dummy->GetXaxis()->SetLabelSize(0.06);
- dummy->GetYaxis()->SetLabelSize(0.06);
- dummy->GetXaxis()->SetTitleSize(0.06);
- dummy->GetYaxis()->SetTitleSize(0.06);
- dummy->GetYaxis()->SetTitleOffset(0.7);
+ dummy->GetXaxis()->SetLabelSize(0.08);
+ dummy->GetYaxis()->SetLabelSize(0.08);
+ dummy->GetXaxis()->SetTitleSize(0.08);
+ dummy->GetYaxis()->SetTitleSize(0.08);
+ dummy->GetYaxis()->SetTitleOffset(0.8);
dummy->DrawCopy();
corr->Draw("SAME");
pad2->cd();
pad2->SetBottomMargin(0.15);
+ //pad2->SetGridx();
+ //pad2->SetGridy();
TH1* ratio = (TH1*) mc->Clone("ratio");
ratio->Divide(corr);
- Float_t minR = TMath::Min(0.961, ratio->GetMinimum() * 0.95);
- Float_t maxR = TMath::Max(1.049, ratio->GetMaximum() * 1.05);
+ Float_t minR = TMath::Min(0.91, ratio->GetMinimum() * 0.95);
+ Float_t maxR = TMath::Max(1.09, ratio->GetMaximum() * 1.05);
TH1F dummy3("dummy3", ";#eta;Ratio: MC / corr", 100, -etaPlotLimit, etaPlotLimit);
dummy3.SetStats(kFALSE);
dummy3.SetBinContent(i, 1);
dummy3.GetYaxis()->SetRangeUser(minR, maxR);
dummy3.SetLineWidth(2);
- dummy3.GetXaxis()->SetLabelSize(0.06);
- dummy3.GetYaxis()->SetLabelSize(0.06);
- dummy3.GetXaxis()->SetTitleSize(0.06);
- dummy3.GetYaxis()->SetTitleSize(0.06);
- dummy3.GetYaxis()->SetTitleOffset(0.7);
+ dummy3.GetXaxis()->SetLabelSize(0.08);
+ dummy3.GetYaxis()->SetLabelSize(0.08);
+ dummy3.GetXaxis()->SetTitleSize(0.08);
+ dummy3.GetYaxis()->SetTitleSize(0.08);
+ dummy3.GetYaxis()->SetTitleOffset(0.8);
dummy3.DrawCopy();
ratio->Draw("SAME");
canvas3->Modified();
+
+ return ratio;
}
void ptSpectrum()
corrX->SetTitle("a) z projection");
corrZ->SetTitle("b) p_{T} projection");
- corrX->GetYaxis()->SetTitle("correction factor");
- corrZ->GetYaxis()->SetTitle("correction factor");
+ corrX->GetYaxis()->SetTitle("Correction factor");
+ corrZ->GetYaxis()->SetTitle("Correction factor");
corrZ->GetXaxis()->SetRangeUser(0.11, 9.9);
printf("Correction with 0.3 < pT < 0.5: %f +- %f\n", eff3, error3);
}
-void Correction1DCreatePlots(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction", Float_t upperPtLimit = 9.9, Int_t correctionType = 0)
+void Correction1DCreatePlots(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction", Float_t upperPtLimit = 9.9, Int_t correctionType = 0, Int_t correctionType2 = -1)
{
+ if (correctionType2 == -1)
+ correctionType2 = correctionType;
+
TFile::Open(fileName);
AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName);
dNdEtaCorrection->LoadHistograms();
TH3F* gene = dNdEtaCorrection->GetCorrection(correctionType)->GetTrackCorrection()->GetGeneratedHistogram();
- TH3F* meas = dNdEtaCorrection->GetCorrection(correctionType)->GetTrackCorrection()->GetMeasuredHistogram();
+ TH3F* meas = dNdEtaCorrection->GetCorrection(correctionType2)->GetTrackCorrection()->GetMeasuredHistogram();
gene->GetZaxis()->SetRangeUser(0.3, upperPtLimit);
meas->GetZaxis()->SetRangeUser(0.3, upperPtLimit);
AliPWG0Helper::CreateDividedProjections(gene, meas, "z", kFALSE);
}
-TCanvas* Correction1D(Int_t correctionType = 0, const char* fileName = "correction_map.root", const char* folder = "dndeta_correction", Float_t upperPtLimit = 9.9)
+TCanvas* Correction1D(Int_t correctionType = 0, const char* fileName = "correction_map.root", const char* folder = "dndeta_correction", Float_t upperPtLimit = 9.9, Int_t correctionType2 = -1)
{
gSystem->Load("libPWG0base");
- Correction1DCreatePlots(fileName, folder, upperPtLimit, correctionType);
+ Correction1DCreatePlots(fileName, folder, upperPtLimit, correctionType, correctionType2);
TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_x_div_measured_x", folder, folder)));
TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_y_div_measured_y", folder, folder)));
Prepare1DPlot(corrY);
Prepare1DPlot(corrZ);
+ /*
corrX->SetTitle("a) z projection");
corrY->SetTitle("b) #eta projection");
corrZ->SetTitle("c) p_{T} projection");
-
- corrX->GetYaxis()->SetTitle("correction factor");
- corrY->GetYaxis()->SetTitle("correction factor");
- corrZ->GetYaxis()->SetTitle("correction factor");
- corrX->GetYaxis()->SetTitleOffset(1.7);
- corrY->GetYaxis()->SetTitleOffset(1.7);
- corrZ->GetYaxis()->SetTitleOffset(1.7);
+ */
+
+ corrX->SetTitle("");
+ corrY->SetTitle("");
+ corrZ->SetTitle("");
+
+ corrX->SetTitleSize(0.06, "xyz");
+ corrX->SetLabelSize(0.06, "xyz");
+ corrY->SetTitleSize(0.06, "xyz");
+ corrY->SetLabelSize(0.06, "xyz");
+ corrZ->SetTitleSize(0.06, "xyz");
+ corrZ->SetLabelSize(0.06, "xyz");
+
+ corrX->GetYaxis()->SetTitle("Correction factor");
+ corrY->GetYaxis()->SetTitle("Correction factor");
+ corrZ->GetYaxis()->SetTitle("Correction factor");
+ //corrX->GetYaxis()->SetTitleOffset(1.7);
+ //corrY->GetYaxis()->SetTitleOffset(1.7);
+ //corrZ->GetYaxis()->SetTitleOffset(1.7);
corrX->GetYaxis()->SetRangeUser(0.8, 1.5);
corrY->GetYaxis()->SetRangeUser(0.8, 1.5);
corrZ->GetYaxis()->SetRangeUser(0.8, 1.5);
canvas->Divide(3, 1);
TLatex* Tl = new TLatex;
- Tl->SetTextSize(0.04);
+ Tl->SetTextSize(0.06);
Tl->SetBit(TLatex::kTextNDC);
canvas->cd(1);
InitPad();
+ gPad->SetTopMargin(0.05);
+ gPad->SetBottomMargin(0.15);
corrX->DrawCopy();
- Tl->DrawLatex(0.6, 0.8, "0.3 < p_{T} < 10");
- Tl->DrawLatex(0.6, 0.75, "|#eta| < 0.8");
+ Tl->DrawLatex(0.5, 0.88, "0.3 < p_{T} < 10");
+ Tl->DrawLatex(0.5, 0.8, "|#eta| < 0.8");
canvas->cd(2);
InitPad();
+ gPad->SetTopMargin(0.05);
+ gPad->SetBottomMargin(0.15);
corrY->Draw();
- Tl->DrawLatex(0.6, 0.8, "0.3 < p_{T} < 10");
- Tl->DrawLatex(0.6, 0.75, "|vtx-z| < 10");
+ Tl->DrawLatex(0.5, 0.88, "0.3 < p_{T} < 10");
+ Tl->DrawLatex(0.5, 0.8, "|vtx-z| < 10 cm");
canvas->cd(3);
InitPad();
+ gPad->SetTopMargin(0.05);
+ gPad->SetBottomMargin(0.15);
gPad->SetLogx();
corrZ->Draw();
- Tl->DrawLatex(0.6, 0.8, "|vtx-z| < 10");
- Tl->DrawLatex(0.6, 0.75, "|#eta| < 0.8");
+ corrZ->GetXaxis()->SetLabelOffset(0.005);
+ corrZ->GetXaxis()->SetTitleOffset(1.2);
+ Tl->DrawLatex(0.5, 0.88, "|vtx-z| < 10 cm");
+ Tl->DrawLatex(0.5, 0.8, "|#eta| < 0.8");
return canvas;
}
canvas->SaveAs(Form("Track2Particle1D_etapt_%s_%f.gif", fileName, upperPtLimit));
}
+/*
void CompareTrack2Particle1D(Float_t upperPtLimit = 9.9)
{
gSystem->Load("libPWG0base");
canvas->SaveAs(Form("%s.eps", canvas->GetName()));
}
}
+*/
void CompareTrack2Particle1D(const char* file1, const char* file2, Float_t upperPtLimit = 9.9)
{
TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram();
TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram();
- gene->GetZaxis()->SetRangeUser(0.3, 10);
- meas->GetZaxis()->SetRangeUser(0.3, 10);
+ gene->GetZaxis()->SetRangeUser(0.2, 10);
+ meas->GetZaxis()->SetRangeUser(0.2, 10);
AliPWG0Helper::CreateDividedProjections(gene, meas, "yx");
gene->GetZaxis()->SetRange(0, 0);
meas->GetZaxis()->SetRange(0, 0);
drawPlots(2);
}
-void CompareCorrection2Measured(const char* dataInput = "analysis_esd_raw.root", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
+void CompareCorrection2Measured(Float_t ptMin = 0.301, const char* dataInput = "analysis_esd_raw.root", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
{
loadlibs();
TH3* hist1 = (TH3*) dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("mc");
hist1->SetTitle("mc");
Printf("mc contains %f entries", hist1->Integral());
- Printf("mc contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), 1, hist1->GetNbinsY(), hist1->GetZaxis()->FindBin(0.301), hist1->GetNbinsZ()));
+ Printf("mc contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), hist1->GetYaxis()->FindBin(-0.99), hist1->GetYaxis()->FindBin(0.99), hist1->GetZaxis()->FindBin(ptMin), hist1->GetNbinsZ()));
TH3* hist2 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("esd");
hist2->SetTitle("esd");
Printf("esd contains %f entries", hist2->Integral());
- Printf("esd contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), 1, hist2->GetNbinsY(), hist2->GetZaxis()->FindBin(0.301), hist2->GetNbinsZ()));
+ Printf("esd contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), hist2->GetYaxis()->FindBin(-0.99), hist2->GetYaxis()->FindBin(0.99), hist2->GetZaxis()->FindBin(ptMin), hist2->GetNbinsZ()));
+
+ AliPWG0Helper::CreateDividedProjections(hist1, hist2);
+ AliPWG0Helper::CreateDividedProjections(hist1, hist2, "x");
+
+ hist1->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10));
+ hist2->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10));
+ AliPWG0Helper::CreateDividedProjections(hist1, hist2, "y");
+
+ new TCanvas; gROOT->FindObject("mc_yx_div_esd_yx")->Draw("COLZ");
+ new TCanvas; gROOT->FindObject("mc_zx_div_esd_zx")->Draw("COLZ");
+ new TCanvas; gROOT->FindObject("mc_zy_div_esd_zy")->Draw("COLZ");
+ new TCanvas; gROOT->FindObject("mc_x_div_esd_x")->Draw("COLZ");
+ new TCanvas; gROOT->FindObject("mc_y_div_esd_y")->Draw("COLZ");
+}
+
+void CompareCorrection2Generated(Float_t ptMin = 0.301, const char* dataInput = "analysis_mc.root", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
+{
+ loadlibs();
+
+ AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
+ TFile::Open(correctionMapFile);
+ dNdEtaCorrection->LoadHistograms();
+
+ TFile* file = TFile::Open(dataInput);
+
+ if (!file)
+ {
+ cout << "Error. File not found" << endl;
+ return;
+ }
+
+ dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
+ fdNdEtaAnalysis->LoadHistograms("dndetaTrVtx");
+
+ gROOT->cd();
+
+ TH3* hist1 = (TH3*) dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram()->Clone("mc");
+ hist1->SetTitle("mc");
+ Printf("mc contains %f entries", hist1->Integral());
+ Printf("mc contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), hist1->GetYaxis()->FindBin(-0.99), hist1->GetYaxis()->FindBin(0.99), hist1->GetZaxis()->FindBin(ptMin), hist1->GetNbinsZ()));
+
+ TH3* hist2 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram()->Clone("esd");
+ hist2->SetTitle("esd");
+ Printf("esd contains %f entries", hist2->Integral());
+ Printf("esd contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), hist2->GetYaxis()->FindBin(-0.99), hist2->GetYaxis()->FindBin(0.99), hist2->GetZaxis()->FindBin(ptMin), hist2->GetNbinsZ()));
AliPWG0Helper::CreateDividedProjections(hist1, hist2);
AliPWG0Helper::CreateDividedProjections(hist1, hist2, "x");
}
-void DrawTrackletOrigin()
+void DrawTrackletOrigin(const char* fileName = "correction_map.root", Bool_t myFile = kTRUE)
{
- TFile::Open("correction_map.root");
-
- Int_t colors[] = {1,2,3,4,6,7,8,102};
+ TFile::Open(fileName);
Int_t maxHists = 8;
TH1* hist[8];
+
+ const Int_t kRebin = 8;
- const char* titles[] = { "PP", "SS", "PP'", "PS", "PS*", "SP", "SS'", "" };
+ const char* titles[] = { "PP", "SS", "PP'", "PS'", "PS", "SP'", "SS'", "" };
- TLegend* legend = new TLegend(0.75, 0.6, 0.95, 0.95);
+ if (myFile)
+ {
+ for (Int_t i=0; i<maxHists; i++)
+ {
+ hist[i] = (TH1*) gFile->Get(Form("fDeltaPhi_%d", i));
+ if (hist[i]->GetDimension() == 2)
+ hist[i] = ((TH2*) hist[i])->ProjectionX(Form("fDeltaPhi_clone_%d", i));
+ }
+ }
+ else
+ {
+ maxHists = 6;
+ const char* names[] = { "DePhiPPTracklets", "DePhiSecTracklets", "DePhiPpTracklets", "DePhiPSTracklets", "DePhiPSdaugTracklets", "DePhiSPTracklets" };
+ for (Int_t i=0; i<maxHists; i++)
+ hist[i] = (TH1*) gFile->Get(names[i]);
+ }
+
+ // clone before rebinning
+ good = (TH1*) hist[0]->Clone("good");
+ good->Add(hist[4]);
+
+ bad = (TH1*) hist[1]->Clone("bad");
+ bad->Add(hist[2]);
+ bad->Add(hist[3]);
+ bad->Add(hist[5]);
+ if (myFile)
+ bad->Add(hist[6]);
+
+ c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c");
+ TH1* ref = 0;
+ Bool_t nw = kFALSE;
+ if (!c)
+ {
+ c = new TCanvas("c", "c", 600, 600);
+ nw = kTRUE;
+ ref = (TH1*) c->GetListOfPrimitives()->At(1);
+ }
+ c->cd();
+ c->SetRightMargin(0.05);
+ c->SetTopMargin(0.05);
+ c->SetLogy();
+ c->SetGridx();
+ c->SetGridy();
+
+ Int_t order[] = { 0, 4, 1, 2, 3, 5, 6, 7 };
+ //Int_t colors[] = {1,2,4,1,2,4,1,2,4};
+ Int_t colors[] = {1,2,3,4,6,7,8,102};
+ Int_t markers[] = {20, 21, 22, 23, 24, 25, 26, 27, 28};
+
+ TLegend* legend = new TLegend(0.75, 0.6, 0.93, 0.93);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
Int_t total = 0;
- for (Int_t i=0; i<maxHists; i++)
+ for (Int_t ii=0; ii<maxHists; ii++)
{
- hist[i] = (TH1*) gFile->Get(Form("fDeltaPhi_%d", i));
- //hist[i]->Rebin(20);
+ i = order[ii];
+
+ hist[i]->Rebin(kRebin);
hist[i]->SetStats(kFALSE);
hist[i]->SetLineColor(colors[i]);
- hist[i]->GetXaxis()->SetRangeUser(-0.2, 0.2);
- hist[i]->Draw(((i == 0) ? "" : "SAME"));
+ hist[i]->SetLineWidth(2);
+ //hist[i]->SetMarkerStyle(markers[i]);
+ //hist[i]->SetMarkerColor(colors[i]);
+ //hist[i]->SetLineStyle(ii+1);
+ hist[i]->GetXaxis()->SetRangeUser(-0.09, 0.09);
+ hist[i]->GetYaxis()->SetRangeUser(5, hist[i]->GetMaximum() * 2);
+ hist[i]->GetYaxis()->SetTitleOffset(1.3);
+ hist[i]->GetXaxis()->SetTitle("#Delta#varphi (rad.)");
+
+ if (i == 0 && ref)
+ hist[i]->Scale(1.0 / hist[i]->GetMaximum() * ref->GetMaximum());
+
+ hist[i]->DrawCopy(((i == 0 && nw) ? "" : "SAME"));
total += hist[i]->GetEntries();
if (i != 7)
- legend->AddEntry(hist[i], titles[i]);
+ legend->AddEntry(hist[i], titles[i], "L");
}
legend->Draw();
- gPad->SetLogy();
+ c->SaveAs("spd_tracklets_deltaphi_detailed.eps");
Printf("Total: %d", total);
for (Int_t i=0; i<maxHists; i++)
- Printf("Histogram %d (%s) containts %.2f %% of the entries", i, titles[i], 100.0 * hist[i]->GetEntries() / total);
+ Printf("Histogram %d (%s) contains %.2f %% of the entries", i, titles[i], 100.0 * hist[i]->GetEntries() / total);
printf("| Delta phi | Acc. %% | ");
for (Int_t i=0; i<maxHists; i++)
printf("%6.2f | ", (hist[i]->GetEntries() > 0) ? (100.0 * hist[i]->Integral(integralBegin, integralEnd) / hist[i]->GetEntries()) : -1.0);
Printf("");
}
+
+ eff = new TH1F("eff", ";#Delta#varphi cut (rad.)", 101,-0.0005, 0.1005);
+ cont = new TH1F("cont", "cont", 101,-0.0005, 0.1005);
+ signalOverBg = new TH1F("signalOverBg", "signalOverBg", 101,-0.0005, 0.1005);
+ for (Float_t cut=0.000; cut<0.10; cut += 0.001)
+ {
+ Float_t accGood = good->Integral(good->GetXaxis()->FindBin(-cut), good->GetXaxis()->FindBin(cut));
+ Float_t accBad = bad->Integral(bad->GetXaxis()->FindBin(-cut), bad->GetXaxis()->FindBin(cut));
+ Float_t sB = accGood / accBad;
+ eff->Fill(cut, 100.0 * accGood / good->Integral());
+ cont->Fill(cut, 100.0 * accBad / (accGood + accBad));
+ signalOverBg->Fill(cut, sB);
+ }
+
+ //new TCanvas; signalOverBg->Draw();
+
+ c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c2");
+ Bool_t nw = kFALSE;
+ if (!c)
+ {
+ c = new TCanvas("c2", "c2", 600, 600);
+ nw = kTRUE;
+ }
+ c->cd();
+ c->SetRightMargin(0.05);
+ c->SetTopMargin(0.05);
+ c->SetGridx();
+ c->SetGridy();
+ gPad->SetLogy();
+ good->Rebin(kRebin);
+ bad->Rebin(kRebin);
+ good->GetXaxis()->SetRangeUser(-0.09, 0.09);
+ good->GetYaxis()->SetTitleOffset(1.3);
+ good->SetStats(0);
+ good->GetXaxis()->SetTitle("#Delta#varphi (rad.)");
+ good->DrawCopy((nw) ? "" : "SAME");
+
+ bad->SetLineColor(2);
+ bad->SetLineStyle(2);
+ bad->SetLineWidth(2);
+ //bad->SetMarkerColor(2);
+ //bad->SetMarkerStyle(7);
+ bad->DrawCopy("SAME");
+
+ TLegend* legend = new TLegend(0.2, 0.13, 0.85, 0.25);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+ legend->AddEntry(good, "Primaries", "L");
+ legend->AddEntry(bad, "Secondaries + Background", "L");
+ legend->Draw();
+
+ c->SaveAs("spd_tracklets_deltaphi.eps");
+
+ c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c3");
+ Bool_t nw = kFALSE;
+ if (!c)
+ {
+ c = new TCanvas("c3", "c3", 600, 600);
+ nw = kTRUE;
+ }
+ c->cd();
+ c->SetRightMargin(0.05);
+ c->SetTopMargin(0.05);
+ c->SetGridx();
+ c->SetGridy();
+
+ TLegend* legend = new TLegend(0.5, 0.6, 0.93, 0.75);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+ legend->AddEntry(eff, "Efficiency (%)", "L");
+ legend->AddEntry(cont, "Contamination (%)", "L");
+
+ eff->SetStats(0);
+ eff->GetXaxis()->SetRangeUser(0, 0.08);
+ eff->GetYaxis()->SetRangeUser(1e-3, 105);
+ eff->SetLineWidth(2);
+ eff->DrawCopy((nw) ? "" : "SAME");
+ cont->SetLineStyle(2);
+ cont->SetLineWidth(2);
+ cont->SetLineColor(2);
+ cont->DrawCopy("SAME");
+ legend->Draw();
+
+ c->SaveAs("spd_tracklets_efficiency.eps");
+
+
+}
+
+void Tracklets_Asymmetry()
+{
+ TFile::Open("correction_map.root");
+
+ Int_t maxHists = 7;
+ TH1* hist[8];
+
+ Int_t colors[] = {1,2,3,4,6,7,8,102};
+ const char* titles[] = { "PP", "SS", "PP'", "PS'", "PS", "SP'", "SS'", "" };
+
+ TLegend* legend = new TLegend(0.75, 0.6, 0.93, 0.93);
+
+ for (Int_t i=0; i<maxHists; i++)
+ {
+ hist[i] = (TH1*) gFile->Get(Form("fDeltaPhi_%d", i));
+ hist[i]->Rebin(10);
+
+ for (Int_t j=hist[i]->GetNbinsX()/2; j<=hist[i]->GetNbinsX(); j++)
+ if (hist[i]->GetBinContent(j) > 0)
+ hist[i]->SetBinContent(j, (hist[i]->GetBinContent(j) - hist[i]->GetBinContent(hist[i]->GetXaxis()->FindBin(-hist[i]->GetXaxis()->GetBinCenter(j)))) / hist[i]->GetBinContent(j));
+
+ hist[i]->SetStats(kFALSE);
+ hist[i]->SetLineColor(colors[i]);
+ hist[i]->GetXaxis()->SetRangeUser(0.001, 0.09);
+ //hist[i]->GetYaxis()->SetRangeUser(5, hist[i]->GetMaximum() * 2);
+ hist[i]->GetYaxis()->SetTitleOffset(1.3);
+ hist[i]->GetXaxis()->SetTitle("#Delta#varphi (rad.)");
+ hist[i]->Draw(((i == 0) ? "" : "SAME"));
+
+ legend->AddEntry(hist[i], titles[i], "L");
+ }
+
+ legend->Draw();
}
TH2* GetCorrection(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction", Double_t ptmin=0.2)
mcH->Fit("pol0", "", "", -etaRange, etaRange);
}
-void TrackCuts_Comparison(char* histName, Int_t plotWhich = 0, const char* fileName = "correction_map.root")
+void TrackCuts_Comparison(char* histName, Int_t plotWhich = 0, const char* fileName = "correction_map.root", Bool_t mirror = kFALSE)
{
// for the nsigmaplot it is needed to run with all cuts except the nsigmatovertex
// --> manually disable it in the run.C
// plotWhich: 0 = only before
// 1 = both
// 2 = only after
+ //
+ // mirror: kTRUE --> project negative values on the positive side
+
file = TFile::Open(fileName);
TLegend* legend2 = new TLegend(0.4, 0.6, 1, 1);
TLegend* legend3 = new TLegend(0.6, 0.5, 1, 0.7);
- TCanvas* c1 = new TCanvas("c1", "c1", 800, 1200);
+ TCanvas* c1 = new TCanvas(histName, histName, 800, 1200);
c1->Divide(1, 2);
//TCanvas* c2 = new TCanvas("c2", "c2", 800, 600);
//TCanvas* c3 = new TCanvas("c3", "c3", 800, 600);
TString folder;
folder.Form("%s/%s/%s", folders1[i], folders2[j], histName);
TH1* hist = (TH1*) file->Get(folder);
+
+ if (mirror)
+ {
+ for (Int_t bin=1; bin<=hist->GetXaxis()->FindBin(-0.0001); bin++)
+ {
+ Int_t newBin = hist->GetXaxis()->FindBin(-hist->GetXaxis()->GetBinCenter(bin));
+ if (bin != newBin)
+ {
+ hist->Fill(-hist->GetXaxis()->GetBinCenter(bin), hist->GetBinContent(bin));
+ hist->SetBinContent(bin, 0);
+ }
+ }
+ }
+
legend->AddEntry(hist, Form("%s %s", names[i], folders2[j]));
c1->cd(1);
c1->cd(2)->SetGridy();
legend3->Draw();
- c1->SaveAs(Form("%s.png", histName));
+ //c1->SaveAs(Form("%s.png", histName));
}
void TrackCuts_DCA()
result->GetYaxis()->SetRangeUser(-0.2, 0.2);
result->Draw();
}
+
+TH2* GetAcceptance(void* corr2d_void)
+{
+ corr2d = (AliCorrectionMatrix2D*) corr2d_void;
+ corr_xy = (TH2*) corr2d->GetCorrectionHistogram()->Clone("acceptance");
+
+ // fold in acceptance
+ for (Int_t x=1; x<=corr_xy->GetNbinsX(); ++x)
+ for (Int_t y=1; y<=corr_xy->GetNbinsY(); ++y)
+ {
+ if (corr_xy->GetBinContent(x, y) > 1.5)
+ corr_xy->SetBinContent(x, y, 0);
+
+ if (corr_xy->GetBinContent(x, y) > 0)
+ corr_xy->SetBinContent(x, y, 1);
+
+ corr_xy->SetBinError(x, y, 0);
+ }
+
+ return corr_xy;
+}
+
+void ZeroOutsideAcceptance(TH2* acc, TH3* hist)
+{
+ for (Int_t x=0; x<=acc->GetNbinsX()+1; ++x)
+ for (Int_t y=0; y<=acc->GetNbinsY()+1; ++y)
+ {
+ if (acc->GetBinContent(x, y) > 1.5 || acc->GetBinContent(x, y) == 0)
+ {
+ for (Int_t z=0; z<=hist->GetNbinsZ()+1; ++z)
+ {
+ hist->SetBinContent(x, y, z, 0);
+ hist->SetBinError(x, y, z, 0);
+ }
+ }
+ }
+}
+
+void DrawPhi()
+{
+ loadlibs();
+
+ TFile::Open("correction_map.root");
+ AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
+ if (!dNdEtaCorrection->LoadHistograms())
+ return 0;
+
+ TFile::Open("analysis_esd.root");
+ dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
+ fdNdEtaAnalysis->LoadHistograms();
+
+ // acc. map!
+ //acc = GetAcceptance(dNdEtaCorrection->GetCorrection(1)->GetTrackCorrection()->Get2DCorrection("yx", 0, 1000));
+ acc = dNdEtaCorrection->GetCorrection(1)->GetTrackCorrection()->Get2DCorrection("yx", 0, 1000)->GetCorrectionHistogram();
+ //new TCanvas; acc->Draw("COLZ");
+
+ histG = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram();
+ ZeroOutsideAcceptance(acc, histG);
+ //new TCanvas; histG->Project3D("yx")->Draw("COLZ");
+ //histG->GetYaxis()->SetRangeUser(-0.9, 0.9);
+
+ histM = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram();
+ ZeroOutsideAcceptance(acc, histM);
+ //histM->GetYaxis()->SetRangeUser(-0.9, 0.9);
+
+ TFile::Open("analysis_mc.root");
+ dNdEtaAnalysis* fdNdEtaAnalysis2 = new dNdEtaAnalysis("dndetaTrVtxMC", "dndetaTrVtxMC");
+ fdNdEtaAnalysis2->LoadHistograms("dndetaTrVtx");
+
+ histMC = fdNdEtaAnalysis2->GetData()->GetTrackCorrection()->GetMeasuredHistogram();
+ ZeroOutsideAcceptance(acc, histMC);
+ //new TCanvas; histMC->Project3D("yx2")->Draw("COLZ");
+
+ //histG->GetZaxis()->SetRangeUser(1,2); histMC->GetZaxis()->SetRangeUser(1,2);
+ new TCanvas; a = histG->Project3D("yx3"); a->Add(histMC->Project3D("yx4"), -1); a->Draw("COLZ");
+
+ //histMC->GetYaxis()->SetRangeUser(-0.9, 0.9);
+
+ c = new TCanvas;
+
+ histG->GetXaxis()->SetRangeUser(-9.9, 9.9);
+ histG->Project3D("z")->Draw();
+
+ histM->GetXaxis()->SetRangeUser(-9.9, 9.9);
+ proj = histM->Project3D("z2");
+ proj->SetLineColor(2);
+ proj->Draw("SAME");
+
+ histMC->GetXaxis()->SetRangeUser(-9.9, 9.9);
+ projMC = histMC->Project3D("z3");
+ projMC->SetLineColor(3);
+ projMC->Draw("SAME");
+}
+
+void PrintEventStats(Int_t corrID = 3)
+{
+ loadlibs();
+
+ /*
+ TFile::Open("analysis_mc.root");
+ fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaNSD", "dndetaNSD");
+ fdNdEtaAnalysis->LoadHistograms();
+ trackHist = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram();
+ eventHist = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetGeneratedHistogram();
+ */
+
+ TFile::Open("correction_map.root");
+ AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
+ if (!dNdEtaCorrection->LoadHistograms())
+ return;
+ trackHist = dNdEtaCorrection->GetCorrection(corrID)->GetTrackCorrection()->GetGeneratedHistogram();
+ eventHist = dNdEtaCorrection->GetCorrection(corrID)->GetEventCorrection()->GetGeneratedHistogram();
+
+ trackHist->GetXaxis()->SetRange(0, trackHist->GetNbinsX()+1);
+ trackHist->GetZaxis()->SetRange(0, trackHist->GetNbinsZ()+1);
+ eta = trackHist->Project3D("y");
+
+ events = eventHist->Integral(0, eventHist->GetNbinsX()+1, 0, eventHist->GetNbinsY()+1);
+
+ eta->Scale(1.0 / events);
+
+ Float_t avgN = eta->Integral(0, eta->GetNbinsX()+1);
+ Printf("<N> = %f", avgN);
+
+ eta->Scale(1.0 / eta->GetXaxis()->GetBinWidth(1));
+
+ Printf("dndeta | eta = 0 is %f", (eta->GetBinContent(eta->FindBin(0.01)) + eta->GetBinContent(eta->FindBin(-0.01))) / 2);
+ Printf("dndeta in |eta| < 1 is %f", eta->Integral(eta->FindBin(-0.99), eta->FindBin(0.99)) / (eta->FindBin(0.99) - eta->FindBin(-0.99) + 1));
+ Printf("dndeta in |eta| < 1.5 is %f", eta->Integral(eta->FindBin(-1.49), eta->FindBin(1.49)) / (eta->FindBin(1.49) - eta->FindBin(-1.49) + 1));
+
+ stats = (TH2*) gFile->Get("fEventStats");
+ proj = stats->ProjectionX();
+ gROOT->ProcessLine(".L PrintHist.C");
+ PrintHist2D(stats);
+ PrintHist(proj);
+
+ Printf("+++ TRIGGER EFFICIENCIES +++");
+
+ Printf("INEL = %.1f", 100. * (proj->GetBinContent(1) - stats->GetBinContent(1, 1)) / proj->GetBinContent(1));
+ Printf("NSD = %.1f", 100. * (proj->GetBinContent(2) - stats->GetBinContent(2, 1)) / proj->GetBinContent(2));
+ Printf("ND = %.1f", 100. * (proj->GetBinContent(3) - stats->GetBinContent(3, 1)) / proj->GetBinContent(3));
+ Printf("SD = %.1f", 100. * (proj->GetBinContent(4) - stats->GetBinContent(4, 1)) / proj->GetBinContent(4));
+ Printf("DD = %.1f", 100. * (proj->GetBinContent(5) - stats->GetBinContent(5, 1)) / proj->GetBinContent(5));
+
+ for (Int_t i=7; i<=proj->GetNbinsX(); i++)
+ if (proj->GetBinContent(i) > 0)
+ Printf("bin %d (process type %d) = %.2f", i, (Int_t) proj->GetXaxis()->GetBinCenter(i), 100.0 * (proj->GetBinContent(i) - stats->GetBinContent(i, 1)) / proj->GetBinContent(i));
+
+ //eta->Draw();
+}
+
+void TestAsymmetry()
+{
+ loadlibs();
+
+ TFile* file2 = TFile::Open("analysis_mc.root");
+
+ dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
+ fdNdEtaAnalysis->LoadHistograms();
+ fdNdEtaAnalysis->Finish(0, 0, AlidNdEtaCorrection::kNone, "...");
+
+ fdNdEtaAnalysis->GetdNdEtaHistogram(0)->DrawCopy();
+
+ hist = (TH1*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram();
+ hist2 = (TH1*) hist->Clone("hist2");
+ for (Int_t x=1; x<=hist->GetNbinsX(); x++)
+ for (Int_t y=1; y<=hist->GetNbinsY(); y++)
+ for (Int_t z=1; z<=hist->GetNbinsZ(); z++)
+ {
+ Printf("%d %d %d %d", x, y, z, hist->GetNbinsY() + 1 - y);
+ hist->SetBinContent(x, y, z, hist2->GetBinContent(hist->GetNbinsX() / 2, TMath::Min(y, hist->GetNbinsY() + 1 - y), z));
+ }
+
+ hist = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram();
+ for (Int_t x=1; x<=hist->GetNbinsX(); x++)
+ for (Int_t y=1; y<=hist->GetNbinsY(); y++)
+ {
+ //Printf("%d %d %d %d", x, y, z, hist->GetNbinsY() + 1 - y);
+ hist->SetBinContent(x, y, hist->GetBinContent(hist->GetNbinsX() / 2, y));
+ }
+
+ fdNdEtaAnalysis->Finish(0, 0, AlidNdEtaCorrection::kNone, "...");
+ fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetMarkerColor(2);
+ fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetLineColor(2);
+ fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetMarkerStyle(5);
+ fdNdEtaAnalysis->GetdNdEtaHistogram(0)->DrawCopy("SAMEP");
+}
+
+void DeltaPhiFromPt(Float_t smearing = 0.005)
+{
+ loadlibs();
+
+ TFile::Open("analysis_mc.root");
+ hist = (TH1*) gFile->Get("dndeta_check_pt");
+
+ dPhiHist = new TH1F("dPhiHist", ";#Delta phi", 400, -0.1, 0.1);
+ dPhiHist2 = new TH1F("dPhiHist2", ";#Delta phi", 400, -0.1, 0.1);
+
+ for (Int_t i=1; i<=hist->GetNbinsX(); i++)
+ {
+ Float_t pt = hist->GetBinCenter(i);
+ Float_t deltaPhi = (0.076 - 0.039) / 2 / (pt / 0.15);
+
+ if (smearing > 0)
+ {
+ gaus = new TF1("mygaus", "gaus(0)", -0.1, 0.1);
+ gaus->SetParameters(1, -deltaPhi, smearing);
+
+ dPhiHist->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000);
+
+ dPhiHist2->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000);
+ gaus->SetParameters(1, deltaPhi, smearing);
+ dPhiHist2->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000);
+ }
+ else
+{
+dPhiHist->Fill(deltaPhi, hist->GetBinContent(i) / 2);
+dPhiHist2->Fill(deltaPhi, hist->GetBinContent(i) / 2);
+dPhiHist2->Fill(-deltaPhi, hist->GetBinContent(i) / 2);
+}
+ }
+
+ new TCanvas;
+ dPhiHist->Draw();
+ dPhiHist2->SetLineColor(2);
+ dPhiHist2->Draw("SAME");
+ gPad->SetLogy();
+
+ TFile::Open("trackletsDePhi.root");
+ //TFile::Open("tmp/correction_maponly-positive.root");
+ //TFile::Open("tmp/correction_map.root");
+ //tracklets = (TH1*) gFile->Get(Form("fDeltaPhi_%d", 0));
+ tracklets = (TH1*) gFile->Get("DePhiPPTracklets");
+ tracklets->Scale(1.0 / tracklets->GetMaximum() * dPhiHist->GetMaximum());
+ tracklets->SetLineColor(4);
+ tracklets->Draw("SAME");
+}
for (Int_t i=0; i<folderCount; ++i)
{
- Track2Particle1DCreatePlots(fileNames[i], folderNames[i], upperPtLimit);
+ Correction1DCreatePlots(fileNames[i], folderNames[i], upperPtLimit);
- TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_x_div_meas_%s_nTrackToNPart_x", folderNames[i], folderNames[i])));
- TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_y_div_meas_%s_nTrackToNPart_y", folderNames[i], folderNames[i])));
- TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_z_div_meas_%s_nTrackToNPart_z", folderNames[i], folderNames[i])));
+ TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject("generated_x_div_measured_x"));
+ TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject("generated_y_div_measured_y"));
+ TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject("generated_z_div_measured_z"));
Prepare1DPlot(corrX);
Prepare1DPlot(corrY);
break;
// one species enhanced / reduced
- case 2: // + 50% pions
- case 3: // - 50% pions
- case 4: // + 50% kaons
- case 5: // - 50% kaons
- case 6: // + 50% protons
- case 7: // - 50% protons
- Int_t correctionIndex = (index - 2) / 2;
- Double_t scaleFactor = (index % 2 == 0) ? 1.5 : 0.5;
-
- fdNdEtaCorrection[correctionIndex]->GetTrack2ParticleCorrection()->GetMeasuredHistogram()->Scale(scaleFactor);
- fdNdEtaCorrection[correctionIndex]->GetTrack2ParticleCorrection()->GetGeneratedHistogram()->Scale(scaleFactor);
-
+ case 2: // + 50% kaons
+ case 3: // - 50% kaons
+ case 4: // + 50% protons
+ case 5: // - 50% protons
+ case 6: // + 50% kaons + 50% protons
+ case 7: // - 50% kaons - 50% protons
+ case 8: // + 50% kaons - 50% protons
+ case 9: // - 50% kaons + 50% protons
TString* str = new TString;
- str->Form("%s%s", (correctionIndex == 0) ? "Pi" : ((correctionIndex == 1) ? "K" : "p"), (index % 2 == 0) ? "Boosted" : "Reduced");
+ if (index < 6)
+ {
+ Int_t correctionIndex = index / 2;
+ Double_t scaleFactor = (index % 2 == 0) ? 1.5 : 0.5;
+
+ fdNdEtaCorrection[correctionIndex]->GetTrack2ParticleCorrection()->GetTrackCorrection()->Scale(scaleFactor);
+ str->Form("%s%s", (correctionIndex == 0) ? "Pi" : ((correctionIndex == 1) ? "K" : (correctionIndex == 2) ? "p" : "others"), (index % 2 == 0) ? "Boosted" : "Reduced");
+ }
+ else
+ {
+ Double_t scaleFactor = (index % 2 == 0) ? 1.5 : 0.5;
+ fdNdEtaCorrection[1]->GetTrack2ParticleCorrection()->GetTrackCorrection()->Scale(scaleFactor);
+ str->Form("%s%s", "K", (scaleFactor > 1) ? "Boosted" : "Reduced");
+
+ if (index >= 8)
+ scaleFactor = (index % 2 == 0) ? 0.5 : 1.5;
+ fdNdEtaCorrection[2]->GetTrack2ParticleCorrection()->GetTrackCorrection()->Scale(scaleFactor);
+ *str += Form("%s%s", "p", (scaleFactor > 1) ? "Boosted" : "Reduced");
+ }
+
return str->Data();
break;
for (Int_t i=0; i<3; ++i)
{
- ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetMeasuredHistogram(), ptDists[i]);
- ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetGeneratedHistogram(), ptDists[i]);
+ ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram(), ptDists[i]);
+ ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram(), ptDists[i]);
}
TString* str = new TString;
str->Form("%s%s", (functionIndex == 0) ? "Pi" : ((functionIndex == 1) ? "K" : "p"), (index % 2 == 0) ? "Boosted" : "Reduced");
case 999:
TF1* ptDependence = new TF1("simple", "x", 0, 100);
- ScalePtDependent(fdNdEtaCorrection[0]->GetTrack2ParticleCorrection()->GetGeneratedHistogram(), ptDependence);
- ScalePtDependent(fdNdEtaCorrection[0]->GetTrack2ParticleCorrection()->GetMeasuredHistogram(), ptDependence);
+ ScalePtDependent(fdNdEtaCorrection[0]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram(), ptDependence);
+ ScalePtDependent(fdNdEtaCorrection[0]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram(), ptDependence);
break;
}
void Composition()
{
- gSystem->Load("libPWG0base");
+ loadlibs();
gSystem->Unlink("new_compositions.root");
+ gSystem->Unlink("new_compositions_analysis.root");
+
+ const char* names[] = { "pi", "K", "p", "other" };
+ TH1* hRatios[20];
- Int_t nCompositions = 8;
- for (Int_t comp = 0; comp < nCompositions; ++comp)
+ Int_t nCompositions = 10;
+ Int_t counter = 0;
+ for (Int_t comp = 1; comp < nCompositions; ++comp)
{
AlidNdEtaCorrection* fdNdEtaCorrection[4];
- TFile::Open("systematics.root");
+ TFile::Open("correction_mapparticle-species.root");
for (Int_t i=0; i<4; ++i)
{
TString name;
- name.Form("correction_%d", i);
+ name.Form("dndeta_correction_%s", names[i]);
fdNdEtaCorrection[i] = new AlidNdEtaCorrection(name, name);
- fdNdEtaCorrection[i]->LoadHistograms("systematics.root", name);
+ fdNdEtaCorrection[i]->LoadHistograms();
}
const char* newName = ChangeComposition(fdNdEtaCorrection, comp);
for (Int_t i=0; i<4; ++i)
{
- geneCount[i] = fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetGeneratedHistogram()->Integral();
- measCount[i] = fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetMeasuredHistogram()->Integral();
+ geneCount[i] = fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram()->Integral();
+ measCount[i] = fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram()->Integral();
geneCount[4] += geneCount[i];
measCount[4] += measCount[i];
TList* collection = new TList;
- for (Int_t i=0; i<4; ++i)
+ // skip "other" particle correction here
+ // with them has to be dealt differently, maybe just increasing the neutral particles...
+ for (Int_t i=1; i<3; ++i)
collection->Add(fdNdEtaCorrection[i]);
- AlidNdEtaCorrection* newComposition = new AlidNdEtaCorrection(newName, newName);
- newComposition->Merge(collection);
- newComposition->Finish();
+ fdNdEtaCorrection[0]->Merge(collection);
+ fdNdEtaCorrection[0]->Finish();
delete collection;
+ // save everything
TFile* file = TFile::Open("new_compositions.root", "UPDATE");
- newComposition->SaveHistograms();
+ fdNdEtaCorrection[0]->SetName(newName);
+ fdNdEtaCorrection[0]->SaveHistograms();
//file->Write();
file->Close();
+
+ // correct dNdeta distribution with modified correction map
+ TFile::Open("analysis_esd_raw.root");
+
+ dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("fdNdEtaAnalysisESD", "fdNdEtaAnalysisESD");
+ fdNdEtaAnalysis->LoadHistograms();
+
+ fdNdEtaAnalysis->Finish(fdNdEtaCorrection[0], 0.2, 3, newName);
+
+ hRatios[counter] = (TH1F*) fdNdEtaAnalysis->GetdNdEtaHistogram()->Clone(newName);
+ hRatios[counter]->SetTitle(newName);
+ hRatios[counter]->SetYTitle("dN_{ch}/d#eta ratio #frac{default composition}{modified composition}");
+
+ if (counter > 0)
+ hRatios[counter]->Divide(hRatios[0],hRatios[counter],1,1);
+
+ file = TFile::Open("new_compositions_analysis.root", "UPDATE");
+ hRatios[counter]->Write();
+ file->Close();
+
+ delete fdNdEtaAnalysis;
+
+ counter++;
}
+ /*
gROOT->ProcessLine(".L drawPlots.C");
const char* fileNames[] = {"new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root" };
- const char* folderNames[] = { "Pythia", "PythiaRatios", "PiBoosted", "PiReduced", "KBoosted", "KReduced", "pBoosted", "pReduced" };
+ const char* folderNames[] = { "PythiaRatios", "PiBoosted", "PiReduced", "KBoosted", "KReduced", "pBoosted", "pReduced" };
Track2Particle1DComposition(fileNames, nCompositions, folderNames);
+ */
}
- const Char_t* changes[] = { "pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless", "sdmoreddless", "sdlessddmore", "ddmore25","ddless25","sdmore25","sdless25", "dmore25", "dless25", "sdmoreddless25", "sdlessddmore25"};
+ const Char_t* changes[] = { "pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless", "sdlessddmore", "sdmoreddless", "ddmore25","ddless25","sdmore25","sdless25", "dmore25", "dless25", "sdlessddmore25", "sdmoreddless25"};
Float_t scalesND[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
Float_t scalesDD[] = {1.0, 1.5, 0.5, 1.0, 1.0, 1.5, 0.5, 1.5, 0.5, 1.25, 0.75, 1.0, 1.0, 1.25, 0.75, 1.25, 0.75};
Float_t scalesSD[] = {1.0, 1.0, 1.0, 1.5, 0.5, 1.5, 0.5, 0.5, 1.5, 1.0, 1.0, 1.25, 0.75, 1.25, 0.75, 0.75, 1.25};
hRatios[counter] = (TH1F*) fdNdEtaAnalysis->GetdNdEtaHistogram()->Clone(name);
- name.Append(Form(" (DD #times %0.2f, SD #times %0.2f)",scalesDD[i],scalesSD[i]));
+ name.Form("DD #times %0.2f, SD #times %0.2f",scalesDD[i],scalesSD[i]);
hRatios[counter]->SetTitle(name.Data());
- hRatios[counter]->SetYTitle("ratio (Pythia x-sections)/(changed x-sections)");
+ hRatios[counter]->SetYTitle("dN_{ch}/d#eta ratio #frac{default cross-section}{modified cross-sections}");
if (counter > 0)
hRatios[counter]->Divide(hRatios[0],hRatios[counter],1,1);
fout->Close();
}
-
-DrawVertexRecoSyst() {
- // Draws the ratio of the dN/dEta obtained with changed SD and DD
- // cross-sections vertex reco corrections to the dN/dEta obtained
- // from the standard pythia cross-sections
- //
- // The files with the vertex reco corrections for different
- // processes (and with the other standard corrections) are expected
- // to have the names "analysis_esd_X.root", where the Xs are defined
- // in the array changes below.
-
- Char_t* changes[] = {"pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless"};
- Char_t* descr[] = {"",
- "#sigma_{DD}' = 1.5#times#sigma_{DD}",
- "#sigma_{DD}' = 0.5#times#sigma_{DD}",
- "#sigma_{SD}' = 1.5#times#sigma_{SD}",
- "#sigma_{SD}' = 0.5#times#sigma_{SD}",
- "#sigma_{D}' = 1.5#times#sigma_{D}",
- "#sigma_{D}' = 0.5#times#sigma_{D}"};
-
- Float_t scalesDD[] = {1.0, 1.5, 0.5, 1.5, 0.5, 1.5, 0.5};
- Float_t scalesSD[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 0.5};
-
- Int_t markers[] = {20,20,21,22,23,28,29};
- Int_t colors[] = {1,2,3,4,6,8,102};
-
- // cross section from Pythia
- Float_t sigmaND = 55.2;
- Float_t sigmaDD = 9.78;
- Float_t sigmaSD = 14.30;
-
- TH1F* dNdEta[7];
- TH1F* ratios[7];
-
- TFile* fin;
-
- for (Int_t i=0; i<7; i++) {
- // calculating relative
- fin = TFile::Open(Form("analysis_esd_%s.root",changes[i]));
-
- dNdEta[i] = (TH1F*)(fin->Get("dndeta/dndeta_dNdEta_corrected_2"))->Clone();
-
- for (Int_t b=0; b<dNdEta[i]->GetNbinsX(); b++) {
- if (TMath::Abs(dNdEta[i]->GetBinCenter(b))>0.9) {
- dNdEta[i]->SetBinContent(b,0);
- dNdEta[i]->SetBinError(b,0);
- }
- }
-
- dNdEta[i]->Rebin(4);
-
- dNdEta[i]->SetLineWidth(2);
- dNdEta[i]->SetLineColor(colors[i]);
- dNdEta[i]->SetMarkerStyle(markers[i]);
- dNdEta[i]->SetMarkerSize(0.9);
- dNdEta[i]->SetMarkerColor(colors[i]);
-
- ratios[i] = (TH1F*)dNdEta[i]->Clone("ratio");
- ratios[i]->Divide(ratios[i],dNdEta[0],1,1,"B");
-
- ratios[i]->SetName(changes[i]);
- ratios[i]->SetTitle(changes[i]);
- }
-
- //##########################################################
-
- gStyle->SetOptStat(0);
- gStyle->SetOptTitle(0);
- gStyle->SetOptFit(0);
-
- gStyle->SetTextSize(0.2);
- gStyle->SetTitleSize(0.05,"xyz");
- gStyle->SetLabelOffset(0.01, "xyz");
-
-
- gStyle->SetTitleOffset(1.2, "y");
- gStyle->SetTitleOffset(1.2, "x");
- gStyle->SetEndErrorSize(0.0);
-
- //##############################################
-
- //making canvas and pads
- TCanvas *c = new TCanvas(Form("vertex_reco_syst_%s", plot), Form("vertex_reco_syst_%s", plot),600,500);
-
- TPad* p1 = new TPad("pad1","", 0, 0.0, 1.0, 1.0, 0, 0, 0);
-
- p1->SetBottomMargin(0.15);
- p1->SetTopMargin(0.03);
- p1->SetLeftMargin(0.15);
- p1->SetRightMargin(0.03);
-
- p1->SetGridx();
- p1->SetGridy();
-
- p1->Draw();
- p1->cd();
-
-
- TH2F* null = new TH2F("","",100,-1.5,1.5,100,0.9601,1.099);
- null->SetXTitle("#eta");
- null->GetXaxis()->CenterTitle(kTRUE);
- null->SetYTitle("dN/d#eta / dN/d#eta_{pythia}");
- null->GetYaxis()->CenterTitle(kTRUE);
- null->Draw();
-
- for (Int_t i=1; i<7; i++)
- ratios[i]->Draw("same");
-
- TLegend* legend = new TLegend(0.6, 0.6, 0.95, 0.95);
- legend->SetFillColor(0);
-
- TLatex* text[7];
- for (Int_t i=1; i<7; i++) {
- legend->AddEntry(dNdEta[i], descr[i]);
- }
-
- legend->Draw();
- //text(0.2,0.88,"Effect of changing",0.045,1,kTRUE);
- //text(0.2,0.83,"relative cross-sections",0.045,1,kTRUE);
- //text(0.2,0.78,"(vertex reconstruction corr.)",0.043,13,kTRUE);
-
- c->SaveAs(Form("%s.gif", c->GetName()));
- c->SaveAs(Form("%s.eps", c->GetName()));
-}
-
-
-
DrawTriggerEfficiency(Char_t* fileName) {
gStyle->SetOptStat(0);
generatedPt[0]->Draw("same");
}
-void changePtSpectrum(const char* fileName = "analysis_mc.root")
+void changePtSpectrum(const char* fileName = "analysis_mc.root", Float_t ptCutOff = 0.2, const char* fileName2 = 0)
{
+ Float_t factor = 0.5;
+
TFile* file = TFile::Open(fileName);
- TH1F* hist = dynamic_cast<TH1F*> (file->Get("dndeta_check_pt"));
+ TH1F* hist = dynamic_cast<TH1F*> (file->Get("dndeta_check_pt")->Clone());
+
+ TH1* hist2 = 0;
+ if (fileName2)
+ {
+ file2 = TFile::Open(fileName2);
+ hist2 = dynamic_cast<TH1*> (file2->Get("dndeta_check_pt")->Clone());
+ hist2->Scale(hist->GetBinContent(hist->FindBin(ptCutOff)) / hist2->GetBinContent(hist2->FindBin(ptCutOff)));
+ }
+
+ //hist->Scale(1.0 / hist->Integral());
//hist->Rebin(3);
//hist->Scale(1.0/3);
TH1F* scale1 = dynamic_cast<TH1F*> (hist->Clone("scale1"));
TH1F* scale2 = dynamic_cast<TH1F*> (hist->Clone("scale2"));
- Float_t ptCutOff = 0.3;
-
for (Int_t i=1; i <= hist->GetNbinsX(); ++i)
{
if (hist->GetBinCenter(i) > ptCutOff)
else
{
// 90 % at pt = 0, 0% at pt = ptcutoff
- scale1->SetBinContent(i, 1 - (ptCutOff - hist->GetBinCenter(i)) / ptCutOff * 0.3);
+ scale1->SetBinContent(i, 1 - (ptCutOff - hist->GetBinCenter(i)) / ptCutOff * factor);
// 110% at pt = 0, ...
- scale2->SetBinContent(i, 1 + (ptCutOff - hist->GetBinCenter(i)) / ptCutOff * 0.3);
+ scale2->SetBinContent(i, 1 + (ptCutOff - hist->GetBinCenter(i)) / ptCutOff * factor);
}
scale1->SetBinError(i, 0);
scale2->SetBinError(i, 0);
}
+ /*
new TCanvas;
-
scale1->Draw();
scale2->SetLineColor(kRed);
scale2->Draw("SAME");
+ */
clone1->Multiply(scale1);
clone2->Multiply(scale2);
clone2->SetMarkerStyle(markers[0]);*/
hist->SetTitle(";p_{T} in GeV/c;dN_{ch}/dp_{T} in c/GeV");
- hist->GetXaxis()->SetRangeUser(0, 0.7);
+ hist->GetXaxis()->SetRangeUser(0, 0.5);
hist->GetYaxis()->SetRangeUser(0.01, clone2->GetMaximum() * 1.1);
hist->GetYaxis()->SetTitleOffset(1);
- TCanvas* canvas = new TCanvas;
+ TCanvas* canvas = new TCanvas("c", "c", 600, 600);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
gPad->SetBottomMargin(0.12);
hist->Draw("H");
clone1->SetLineColor(kRed);
clone2->SetLineColor(kBlue);
clone2->Draw("HSAME");
hist->Draw("HSAME");
+
+ if (hist2)
+ {
+ Prepare1DPlot(hist2);
+ hist2->SetLineStyle(2);
+ hist2->Draw("HSAME");
+ }
Float_t fraction = hist->Integral(hist->GetXaxis()->FindBin(ptCutOff), hist->GetNbinsX()) / hist->Integral(1, hist->GetNbinsX());
Float_t fraction1 = clone1->Integral(clone1->GetXaxis()->FindBin(ptCutOff), clone1->GetNbinsX()) / clone1->Integral(1, clone1->GetNbinsX());
printf("%f %f %f\n", fraction, fraction1, fraction2);
printf("Rel. %f %f\n", fraction1 / fraction, fraction2 / fraction);
- canvas->SaveAs("changePtSpectrum.gif");
+ //canvas->SaveAs("changePtSpectrum.gif");
canvas->SaveAs("changePtSpectrum.eps");
}
}
+TPad* DrawChange(Bool_t spd, const char* basename, const char** changes, Int_t nChanges, Int_t nDraw, Int_t* colors, const char** names = 0, Float_t scale = 0.10)
+{
+ Float_t etaMax = 1.05;
+ if (spd)
+ etaMax = 1.79;
-void DrawEffectOfChangeInCrossSection(const char* fileName = "systematics_vtxtrigger_compositions.root") {
-
- //get the data
- TFile* fin = TFile::Open(fileName);
-
- const Char_t* changes[] = {"pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless", "sdmoreddless", "sdlessddmore" };
- //const Char_t* changes[] = {"pythia","ddmore25","ddless25","sdmore25","sdless25", "dmore25", "dless25", "sdmoreddless25", "sdlessddmore25" };
- const Int_t nChanges = 9;
- //const Char_t* changes[] = { "pythia", "qgsm", "phojet" };
- //const Int_t nChanges = 3;
- Int_t colors[] = {1,1,kRed,kBlue,kGreen,kPink,1,kRed,kBlue};
-
- TH1F* hRatios[9];
+ TH1F* hRatios[100];
for(Int_t i=0; i<nChanges; i++) {
- hRatios[i] = (TH1F*)fin->Get(Form("ratio_vertexReco_triggerBias_%s",changes[i]));
- hRatios[i]->SetLineWidth(2);
- hRatios[i]->SetLineColor(colors[i]);
+ hRatios[i] = (TH1F*)gFile->Get(Form("%s%s",basename,changes[i]));
+ hRatios[i]->SetLineWidth(1);
hRatios[i]->SetMarkerStyle(22);
hRatios[i]->SetMarkerSize(0.8);
Float_t average = hRatios[i]->Integral(hRatios[i]->FindBin(-1), hRatios[i]->FindBin(1)) / (hRatios[i]->FindBin(1) - hRatios[i]->FindBin(-1) + 1);
Printf("%s: %.2f %%" , hRatios[i]->GetTitle(), (average - 1) * 100);
}
-
+
TPad* p = DrawCanvasAndPad("syst_changeInXsection",700,400);
p->SetRightMargin(0.2);
p->SetLeftMargin(0.13);
-
- TH2F* null = new TH2F("","",100,-1.05,1.05,100,0.9,1.1);
+
+ TH2F* null = new TH2F("","",100,-etaMax, etaMax,100,1. - scale,1. + scale);
null->GetXaxis()->SetTitle("#eta");
- null->GetYaxis()->SetTitle("Ratio pythia/modified cross-sections");
+ null->GetYaxis()->SetTitle(hRatios[0]->GetYaxis()->GetTitle());
null->Draw();
+
+ line = new TLine(-etaMax, 1, etaMax, 1);
+ line->Draw();
- TLatex* text[9];
+ TLatex* text[100];
- for(Int_t i=1; i<nChanges; i++) {
- hRatios[i]->Draw("same");
+ for(Int_t i=1; i<nDraw; i++) {
+ hRatios[i]->SetLineColor(colors[i]);
+ hRatios[i]->SetMarkerColor(colors[i]);
+ hRatios[i]->Draw("HISTPL SAME");
TString str(hRatios[i]->GetTitle());
- str.Remove(0,str.First("DD"));
- str.Remove(str.First(")"),1);
- text[i] = new TLatex(1.08,hRatios[i]->GetBinContent(hRatios[i]->FindBin(0.))-0.002,str.Data());
+
+ if (names)
+ str = names[i];
+
+ text[i] = new TLatex(etaMax + 0.03,hRatios[i]->GetBinContent(hRatios[i]->FindBin(etaMax-0.1))-0.002,str.Data());
+ text[i]->SetTextAlign(11);
text[i]->SetTextColor(colors[i]);
text[i]->Draw();
}
-}
-
-
-void DrawEffectOfChangeInComposition() {
- //get the data
- TFile* fin = TFile::Open("systematics_composition.root");
-
- Int_t colors[] = {1,2,103,102,4,6,1};
-
- TH1F* hRatios[6];
-
- Float_t etaRange = 0.899;
-
- for (Int_t i=0; i<6; i++) {
- hRatios[i] = (TH1F*)fin->Get(Form("ratio_%d",i));
-
- hRatios[i]->SetLineWidth(2);
- hRatios[i]->SetLineColor(colors[i]);
- hRatios[i]->SetMarkerStyle(22);
- hRatios[i]->SetMarkerSize(0.8);
-
- hRatios[i]->GetXaxis()->SetRangeUser(-etaRange, etaRange);
- }
+ return p;
+}
- TPad* p = DrawCanvasAndPad("syst_changeOfComposition",700,400);
- p->SetRightMargin(0.2);
- p->SetLeftMargin(0.13);
+void DrawEffectOfChangeInCrossSection(Bool_t spd = kFALSE, const char* fileName = "systematics_vtxtrigger_compositions.root")
+{
+ TFile::Open(fileName);
- TH2F* null = new TH2F("","",100,-1.05,1.05,100,0.97,1.03);
- null->GetXaxis()->SetTitle("#eta");
- null->GetYaxis()->SetTitle("Ratio pythia/modified composition");
- null->Draw();
+ const Char_t* changes[] = {"pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless", "sdmoreddless", "sdlessddmore", "ddmore25","ddless25","sdmore25","sdless25", "dmore25", "dless25", "sdmoreddless25", "sdlessddmore25" };
+ //const Char_t* changes[] = { "pythia", "qgsm", "phojet" };
+ //const Int_t nChanges = 3;
+ Int_t colors[] = {1,1,4,1,2,2,4,2,1};
- TLatex* text[6];
+ c = DrawChange(spd, "ratio_vertexReco_triggerBias_", changes, 17, 9, colors, 0);
+ c->SaveAs("cross_sections.eps");
+}
- for(Int_t i=0; i<6; i++) {
- hRatios[i]->Draw("same");
-
- TString str(hRatios[i]->GetTitle());
- str.Remove(0,16);
- text[i] = new TLatex(1.08,hRatios[i]->GetBinContent(hRatios[i]->FindBin(0))-0.002,str.Data());
- text[i]->SetTextColor(colors[i]);
- text[i]->SetTextSize(0.053);
-
- text[i]->Draw();
- }
+void DrawEffectOfChangeInComposition(Bool_t spd = kFALSE, const char* fileName = "new_compositions_analysis.root")
+{
+ TFile::Open(fileName);
+ const Char_t* changes[] = { "PythiaRatios", "KBoosted", "KReduced", "pBoosted", "pReduced", "KBoostedpBoosted", "KReducedpReduced", "KBoostedpReduced", "KReducedpBoosted"};
+ const char* names[] = { "", "K #times 1.5", "K #times 0.5", "p #times 1.5", "p #times 0.5", "K #times 1.5, p #times 1.5", "K #times 0.5, p #times 0.5", "K #times 1.5, p #times 0.5", "K #times 0.5, p #times 1.5" };
+ //const Char_t* changes[] = { "PythiaRatios", "PiBoosted", "PiReduced", "KBoosted", "KReduced", "pBoosted", "pReduced", "othersBoosted", "othersReduced" };
+ //const char* names[] = { "", "#pi #times 1.5", "#pi #times 0.5", "K #times 1.5", "K #times 0.5", "p #times 1.5", "p #times 0.5", "others #times 1.5", "others #times 0.5" };
+ Int_t colors[] = {1,1,2,2,1,2,1,4,4};
+ c = DrawChange(spd, "", changes, 9, 9, colors, names, 0.03);
+ c->SaveAs("compositions.eps");
}
TPad* DrawCanvasAndPad(const Char_t* name, Int_t sizeX=600, Int_t sizeY=500) {
// aProof option: 0 no proof
// 1 proof with chain
// 2 proof with dataset
-
+
TString taskName;
if (runWhat == 0 || runWhat == 2)
{
if (aProof)
{
- TProof::Open("lxb6046");
+ TProof::Open("alicecaf");
//gProof->SetParallel(1);
// Enable the needed package
}
else
{
- gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-14-Release/AF-v4-14");
- gProof->EnablePackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-14-Release/AF-v4-14");
+ gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-16-Release/AF-v4-16");
+ gProof->EnablePackage("AF-v4-16");
}
gProof->UploadPackage("$ALICE_ROOT/PWG0base");
}
else
{
+ gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/");
gSystem->Load("libVMC");
gSystem->Load("libTree");
+ gSystem->Load("libProof");
gSystem->Load("libSTEERBase");
gSystem->Load("libESD");
gSystem->Load("libAOD");
esdH->SetInactiveBranches("AliESDACORDE FMD ALIESDTZERO ALIESDVZERO ALIESDZDC AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks Kinks Cascades AliESDTZERO ALIESDACORDE MuonTracks TrdTracks CaloClusters");
mgr->SetInputEventHandler(esdH);
-
AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD;
AliPWG0Helper::Trigger trigger = AliPWG0Helper::kMB1;
//task->SetUseMCVertex();
//task->SetUseMCKine();
//task->SetOnlyPrimaries();
-
+ //task->SetFillPhi();
+
task->SetTrigger(trigger);
task->SetAnalysisMode(analysisMode);
task->SetTrackCuts(esdTrackCuts);
+ task->SetDeltaPhiCut(0.05);
mgr->AddTask(task);
task2 = new AlidNdEtaCorrectionTask(option);
// syst. error flags
+ //task2->SetFillPhi();
//task2->SetOnlyPrimaries();
task2->SetTrigger(trigger);
task2->SetAnalysisMode(analysisMode);
task2->SetTrackCuts(esdTrackCuts);
+ //task2->SetDeltaPhiCut(0.05);
mgr->AddTask(task2);
}
else if (aProof == 3)
{
- ROOT->ProcessLine(".L CreateChainFromDataSet.C");
- ds = gProof->GetDataSet(data);
+ gROOT->ProcessLine(".L CreateChainFromDataSet.C");
+ ds = gProof->GetDataSet(data)->GetStagedSubset();
chain = CreateChainFromDataSet(ds);
mgr->StartAnalysis("local", chain, nRuns, offset);
}
--- /dev/null
+#!/bin/bash
+rm analysis_{mc,esd,esd_raw}.root correction_map.root
+root.exe -b -q 'run.C(2,"'$1'",-1,0,0,2,1,"")'
+aliroot correct.C
+++ /dev/null
-changeProductionCrossSections() {
- //
- // calculates dN/dEta from the standard correction and from
- // corrections that has been evaluated with different relative cross
- // sections (of single diff, double diff and non diff). The ratios
- // (standard to changed x-section) of the different dN/deta
- // distributions are saved to a file.
- //
-
- gSystem->Load("libPWG0base");
-
- // folder names in systematics root file
- const Char_t* folderNames[] = {"triggerBiasDD","triggerBiasSD","triggerBiasND","vertexRecoDD","vertexRecoSD","vertexRecoND"};
-
- const Char_t* changes[] = {"pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless"};
-
- Float_t scalesDD[] = {1.0, 1.5, 0.5, 1.0, 1.0, 1.5, 0.5};
- Float_t scalesSD[] = {1.0, 1.0, 1.0, 1.5, 0.5, 1.5, 0.5};
-
- // cross section from Pythia
- //Float_t sigmaND = 55.2;
- //Float_t sigmaDD = 9.78;
- //Float_t sigmaSD = 14.30;
-
- // getting data
- TFile* finCorr = TFile::Open("analysis_esd.root");
- dNdEtaAnalysis* analysis = new dNdEtaAnalysis("dndeta", "dndeta");
- analysis->LoadHistograms();
-
- // getting corrections
- AlidNdEtaCorrection* correctionStandard = new AlidNdEtaCorrection("dndeta_correction","dndeta_correction");
-
- TFile* finCorr = TFile::Open("correction_map.root");
- correctionStandard->LoadHistograms();
-
- // getting corrections for pure SD, DD and ND
- TFile* finSyst = TFile::Open("systematics.root");
- AlidNdEtaCorrection* correctionsSyst[7];
- for (Int_t i=0; i<6; i++) {
- correctionsSyst[i] = new AlidNdEtaCorrection(folderNames[i],folderNames[i]);
- correctionsSyst[i]->LoadHistograms();
- }
-
- TH1F* hRatios[21];
- for (Int_t j=0; j<3; j++) { // j = 0 (change vtx), j = 1 (change trg), j = 2 (change both)
-
- for (Int_t i=0; i<7; i++) { // changes in cross section
-
- // temporary correction with changed cross sections
- AlidNdEtaCorrection* correctionTmp = (AlidNdEtaCorrection*)correctionStandard->Clone();;
-
- correctionTmp->Reset();
-
- if (j==0 || j==2) {
- //correctionTmp->GetVertexRecoCorrection()->Reset();
- //correctionTmp->GetVertexRecoCorrection()->Add(correctionsSyst[3]->GetVertexRecoCorrection(),scalesDD[i]);
- //correctionTmp->GetVertexRecoCorrection()->Add(correctionsSyst[4]->GetVertexRecoCorrection(),scalesSD[i]);
- //correctionTmp->GetVertexRecoCorrection()->Add(correctionsSyst[5]->GetVertexRecoCorrection(),1);
-
- correctionTmp->Add(correctionsSyst[3], scalesDD[i]);
- correctionTmp->Add(correctionsSyst[4], scalesSD[i]);
- correctionTmp->Add(correctionsSyst[5], 1);
- }
- if (j==1 || j==2) {
- //correctionTmp->GetTriggerBiasCorrectionINEL()->Reset();
- //correctionTmp->GetTriggerBiasCorrectionINEL()->Add(correctionsSyst[0]->GetTriggerBiasCorrectionINEL(),scalesDD[i]);
- //correctionTmp->GetTriggerBiasCorrectionINEL()->Add(correctionsSyst[1]->GetTriggerBiasCorrectionINEL(),scalesSD[i]);
- //correctionTmp->GetTriggerBiasCorrectionINEL()->Add(correctionsSyst[2]->GetTriggerBiasCorrectionINEL(),1);
-
- correctionTmp->Add(correctionsSyst[0], scalesDD[i]);
- correctionTmp->Add(correctionsSyst[1], scalesSD[i]);
- correctionTmp->Add(correctionsSyst[2], 1);
- }
- correctionTmp->Finish();
-
- dNdEtaAnalysis* analysisTmp = (dNdEtaAnalysis*)analysis->Clone();
- analysisTmp->Finish(correctionTmp, 0.3, AlidNdEtaCorrection::kINEL);
-
- Int_t counter = i + j*7;
-
- hRatios[counter] = (TH1F*)analysisTmp->GetdNdEtaHistogram(2)->Clone();
-
- TString name("ratio");
- if (j==0) name.Append("_vetexReco_");
- if (j==1) name.Append("_triggerBias_");
- if (j==2) name.Append("_vertexReco_triggerBias_");
- name.Append(changes[i]);
- hRatios[counter]->SetName(name.Data());
- name.Append(Form(" (DD #times %0.1f, SD #times %0.1f)",scalesDD[i],scalesSD[i]));
- hRatios[counter]->SetTitle(name.Data());
- hRatios[counter]->SetYTitle("ratio (Pythia x-sections)/(changed x-sections)");
-
- delete analysisTmp;
- delete correctionTmp;
- }
- }
-
- for (Int_t i=1; i<21; i++)
- hRatios[i]->Divide(hRatios[0],hRatios[i],1,1);
- hRatios[0]->Divide(hRatios[0],hRatios[0],1,1);
-
- TFile* fout = new TFile("systematics_xsections.root","RECREATE");
-
- for (Int_t i=0; i<21; i++)
- hRatios[i]->Write();
-
- fout->Write();
- fout->Close();
-}
-
-changeParticleComposition() {
- //
- // calculates dN/dEta from the standard correction and from
- // corrections that has been evaluated with different relative
- // abundancies of kaons and protons and save the ratios in a file
-
- gSystem->Load("libPWG0base");
-
- const Char_t* folderNames[] = {"correction_0","correction_1","correction_2","correction_3"};
- Float_t scalesPi[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
- Float_t scalesK[] = {0.5, 1.5, 1.0, 1.0, 0.5, 1.5};
- Float_t scalesP[] = {1.0, 1.0, 0.5, 1.5, 0.5, 1.5};
-
- // getting data
- TFile* finCorr = TFile::Open("analysis_esd.root");
- dNdEtaAnalysis* analysis = new dNdEtaAnalysis("dndeta", "dndeta");
- analysis->LoadHistograms();
-
- // getting corrections for pi, K, p and other particles
- TFile* finSyst = TFile::Open("systematics.root");
- AlidNdEtaCorrection* correctionsSyst[4];
- for (Int_t i=0; i<4; i++) {
- correctionsSyst[i] = new AlidNdEtaCorrection(folderNames[i],folderNames[i]);
- correctionsSyst[i]->LoadHistograms();
- }
- AlidNdEtaCorrection* correctionAll = (AlidNdEtaCorrection*) correctionsSyst[0]->Clone();
- correctionAll->Reset();
- correctionAll->Add(correctionsSyst[0]);
- correctionAll->Add(correctionsSyst[1]);
- correctionAll->Add(correctionsSyst[2]);
- correctionAll->Add(correctionsSyst[3]);
- correctionAll->Finish();
- analysis->Finish(correctionAll, 0.3, AlidNdEtaCorrection::kINEL);
-
- TH1F* hRatios[6];
- for (Int_t i=0; i<6; i++) {
- // temporary correction with changed particle composistion
- AlidNdEtaCorrection* correctionTmp = (AlidNdEtaCorrection*)correctionAll->Clone();
-
- correctionTmp->Reset();
-
- correctionTmp->Add(correctionsSyst[0],scalesPi[i]);
- correctionTmp->Add(correctionsSyst[1],scalesK[i]);
- correctionTmp->Add(correctionsSyst[2],scalesP[i]);
- correctionTmp->Add(correctionsSyst[3],1);
-
- correctionTmp->Finish();
-
- dNdEtaAnalysis* analysisTmp = (dNdEtaAnalysis*)analysis->Clone();
- analysisTmp->Finish(correctionTmp, 0.3, AlidNdEtaCorrection::kINEL);
-
- hRatios[i] = (TH1F*)analysisTmp->GetdNdEtaHistogram(2)->Clone();
- hRatios[i]->Divide((TH1F*)analysis->GetdNdEtaHistogram(2)->Clone(),hRatios[i],1,1,"B");
-
- TString name(Form("ratio_%d",i));
- hRatios[i]->SetName(name.Data());
- name = TString(Form("#pi #times %0.1f, K #times %0.1f, p #times %0.1f",scalesPi[i],scalesK[i],scalesP[i]));
- hRatios[i]->SetTitle(name.Data());
- hRatios[i]->SetYTitle("ratio (standard/changed compositions)");
- }
-
- TFile* fout = new TFile("systematics_composition.root","RECREATE");
-
- for (Int_t i=0; i<6; i++)
- hRatios[i]->Write();
-
- fout->Write();
- fout->Close();
-
-
-}
return kFALSE;
}
- Bool_t eventTriggered = AliPWG0Helper::IsEventTriggered(fESD, AliPWG0Helper::kMB1);
+ Bool_t eventTriggered = AliPWG0Helper::IsEventTriggered(fESD->GetTriggerMask(), AliPWG0Helper::kMB1);
if (!eventTriggered)
{
void AliHighMultiplicitySelector::Contamination()
{
//
- // produces a spectrum created with N triggers
- // number of triggers and thresholds for the moment fixed
//
/*
//Double_t rate = rates[3];
// coll. in 100 ns window
- //Double_t windowSize = 100e-9;
- Double_t windowSize = 25e-9;
+ Double_t windowSize = 100e-9;
+ //Double_t windowSize = 25e-9;
Double_t collPerWindow = windowSize * rate;
Printf("coll/window = %f", collPerWindow);
Double_t windowsPerSecond = 1.0 / windowSize;
Printf("Raw value for 2 collisions is %e", triggerRate2);
- for (Double_t doubleRate = 0; doubleRate <= 0.2; doubleRate += 0.005)
+ for (Double_t doubleRate = 0; doubleRate <= 0.3; doubleRate += 0.005)
{
Float_t totalContamination = (triggerRate2 * doubleRate) / (triggerRate + triggerRate2 * doubleRate);
}
}
+void AliHighMultiplicitySelector::Contamination3()
+{
+ //
+ //
+
+ /*
+
+ gSystem->Load("libANALYSIS");
+ gSystem->Load("libPWG0base");
+ .L AliHighMultiplicitySelector.cxx+g
+ x = new AliHighMultiplicitySelector();
+ x->ReadHistograms("highmult_hijing100k.root");
+ x->Contamination3();
+
+ */
+
+ // get x-sections
+ TFile* file = TFile::Open("crosssectionEx.root");
+ if (!file)
+ return;
+
+ TH1* xSections[2];
+ xSections[0] = dynamic_cast<TH1*> (gFile->Get("xSection2Ex"));
+ xSections[1] = dynamic_cast<TH1*> (gFile->Get("xSection15Ex"));
+
+ // prob for a collision in a bunch crossing
+ Int_t nRates = 3;
+ Float_t rates[] = {0.07, 0.1, 0.2};
+
+ new TCanvas;
+
+ Int_t colors[] = { 2, 3, 4, 6, 7, 8 };
+ Int_t markers[] = { 7, 2, 4, 5, 6, 27 };
+
+ // put to 2 for second layer
+ for (Int_t i=0; i<1; ++i)
+ {
+ if (!xSections[i])
+ continue;
+
+ // relative x-section, once we have a collision
+ xSections[i]->Scale(1.0 / xSections[i]->Integral());
+
+ Int_t max = xSections[i]->GetNbinsX();
+ max = 500;
+
+ Float_t* xSection = new Float_t[max];
+ for (Int_t mult = 0; mult < max; mult++)
+ xSection[mult] = xSections[i]->GetBinContent(mult+1);
+
+ TH2* fMvsL = (i == 0) ? fMvsL1: fMvsL2;
+
+ for (Int_t currentRate = 0; currentRate<nRates; ++currentRate)
+ {
+ TGraph* graph = new TGraph;
+ graph->SetMarkerColor(colors[currentRate]);
+ graph->SetMarkerStyle(markers[currentRate]);
+
+ Float_t rate = rates[currentRate];
+
+ for (Int_t cut = 100; cut <= 201; cut += 10)
+ {
+ Printf("cut at %d", cut);
+
+ TH1* triggerEffHist = (TH1*) GetTriggerEfficiency(fMvsL, cut)->Clone("triggerEff");
+ Float_t* triggerEff = new Float_t[max];
+ for (Int_t mult = 0; mult < max; mult++)
+ triggerEff[mult] = triggerEffHist->GetBinContent(mult+1);
+
+ Double_t triggerRate = 0;
+ for (Int_t mult = 0; mult < max; mult++)
+ triggerRate += xSection[mult] * triggerEff[mult];
+
+ Printf("Raw value for 1 collision is %e", triggerRate);
+
+ Double_t triggerRate2 = 0;
+ for (Int_t mult = 0; mult < max; mult++)
+ for (Int_t mult2 = mult; mult2 < max; mult2++)
+ if (mult+mult2 < max)
+ triggerRate2 += ((mult2 > mult) ? 2. : 1.) * xSection[mult] * xSection[mult2] * triggerEff[mult+mult2];
+
+ Printf("Raw value for 2 collisions is %e", triggerRate2);
+
+ Double_t triggerRate3 = 0;
+ for (Int_t mult = 0; mult < max; mult++)
+ for (Int_t mult2 = 0; mult2 < max; mult2++)
+ for (Int_t mult3 = 0; mult3 < max; mult3++)
+ if (mult+mult2+mult3 < max)
+ triggerRate3 += xSection[mult] * xSection[mult2] * xSection[mult3] * triggerEff[mult+mult2+mult3];
+
+ Printf("Raw value for 3 collisions is %e", triggerRate3);
+
+ Double_t singleRate = TMath::Poisson(1, rate);
+ Double_t doubleRate = TMath::Poisson(2, rate);
+ Double_t tripleRate = TMath::Poisson(3, rate);
+
+ Printf("single = %f, double = %f, triple = %f", singleRate, doubleRate, tripleRate);
+
+ Float_t totalContamination = (triggerRate2 * doubleRate + triggerRate3 * tripleRate) / (triggerRate * singleRate + triggerRate2 * doubleRate + triggerRate3 * tripleRate);
+
+ //Printf("Total contamination is %.1f%%", totalContamination * 100);
+
+ graph->SetPoint(graph->GetN(), cut, totalContamination);
+ }
+
+ graph->Draw((currentRate == 0) ? "A*" : "* SAME");
+ graph->GetXaxis()->SetTitle("layer 1 threshold");
+ graph->GetYaxis()->SetTitle("contamination");
+ graph->GetYaxis()->SetRangeUser(0, 1);
+ }
+ }
+}
+
void AliHighMultiplicitySelector::DrawHistograms()
{
// draws the histograms
TGraph* IntFractRate();
void Contamination();
void Contamination2();
+ void Contamination3();
void MBComparison();
protected:
ClassImp(AliMultiplicityCorrection)
-const Int_t AliMultiplicityCorrection::fgkMaxInput = 250; // bins in measured histogram
-const Int_t AliMultiplicityCorrection::fgkMaxParams = 250; // bins in unfolded histogram = number of fit params
+const Int_t AliMultiplicityCorrection::fgkMaxInput = 120; // bins in measured histogram
+const Int_t AliMultiplicityCorrection::fgkMaxParams = 120; // bins in unfolded histogram = number of fit params
TMatrixD* AliMultiplicityCorrection::fgCorrelationMatrix = 0;
TMatrixD* AliMultiplicityCorrection::fgCorrelationCovarianceMatrix = 0;
TF1* AliMultiplicityCorrection::fgNBD = 0;
Float_t AliMultiplicityCorrection::fgBayesianSmoothing = 1; // smoothing parameter (0 = no smoothing)
-Int_t AliMultiplicityCorrection::fgBayesianIterations = 100; // number of iterations in Bayesian method
+Int_t AliMultiplicityCorrection::fgBayesianIterations = 10; // number of iterations in Bayesian method
// These are the areas where the quality of the unfolding results are evaluated
// Default defined here, call SetQualityRegions to change them
// unit is in multiplicity (not in bin!)
// SPD: peak area - flat area - low stat area
-Int_t AliMultiplicityCorrection::fgQualityRegionsB[kQualityRegions] = {4, 60, 180};
-Int_t AliMultiplicityCorrection::fgQualityRegionsE[kQualityRegions] = {20, 140, 210};
+Int_t AliMultiplicityCorrection::fgQualityRegionsB[kQualityRegions] = {1, 20, 70};
+Int_t AliMultiplicityCorrection::fgQualityRegionsE[kQualityRegions] = {10, 65, 80};
//____________________________________________________________________
void AliMultiplicityCorrection::SetQualityRegions(Bool_t SPDStudy)
if (SPDStudy)
{
// SPD: peak area - flat area - low stat area
- fgQualityRegionsB[0] = 4;
- fgQualityRegionsE[0] = 20;
+ fgQualityRegionsB[0] = 1;
+ fgQualityRegionsE[0] = 10;
- fgQualityRegionsB[1] = 60;
- fgQualityRegionsE[1] = 140;
+ fgQualityRegionsB[1] = 20;
+ fgQualityRegionsE[1] = 65;
- fgQualityRegionsB[2] = 180;
- fgQualityRegionsE[2] = 210;
+ fgQualityRegionsB[2] = 70;
+ fgQualityRegionsE[2] = 80;
Printf("AliMultiplicityCorrection::SetQualityRegions --> Enabled quality regions for SPD");
}
fMultiplicityVtx[i] = 0;
fMultiplicityMB[i] = 0;
fMultiplicityINEL[i] = 0;
+ fMultiplicityNSD[i] = 0;
}
for (Int_t i = 0; i < kCorrHists; ++i)
fQuality[i] = 0;
}
+//____________________________________________________________________
+AliMultiplicityCorrection* AliMultiplicityCorrection::Open(const char* fileName, const char* folderName)
+{
+ // opens the given file, reads the multiplicity from the given folder and returns the object
+
+ TFile* file = TFile::Open(fileName);
+ if (!file)
+ {
+ Printf("ERROR: Could not open %s", fileName);
+ return 0;
+ }
+
+ AliMultiplicityCorrection* mult = new AliMultiplicityCorrection(folderName, folderName);
+ mult->LoadHistograms();
+
+ // TODO closing the file does not work here, because the histograms cannot be read anymore. LoadHistograms need to be adapted
+
+ return mult;
+}
+
//____________________________________________________________________
AliMultiplicityCorrection::AliMultiplicityCorrection(const Char_t* name, const Char_t* title) :
TNamed(name, title),
#define VTXBINNING 10, binLimitsVtx
#define NBINNING fgkMaxParams, binLimitsN*/
- #define NBINNING 501, -0.5, 500.5
- #define VTXBINNING 1, -10, 10
+ #define NBINNING 201, -0.5, 200.5
+ #define VTXBINNING 1, -6, 6
for (Int_t i = 0; i < kESDHists; ++i)
fMultiplicityESD[i] = new TH2F(Form("fMultiplicityESD%d", i), "fMultiplicityESD;vtx-z;Ntracks;Count", VTXBINNING, NBINNING);
fMultiplicityINEL[i] = dynamic_cast<TH2F*> (fMultiplicityVtx[0]->Clone(Form("fMultiplicityINEL%d", i)));
fMultiplicityINEL[i]->SetTitle("fMultiplicityINEL");
+
+ fMultiplicityNSD[i] = dynamic_cast<TH2F*> (fMultiplicityVtx[0]->Clone(Form("fMultiplicityNSD%d", i)));
+ fMultiplicityNSD[i]->SetTitle("fMultiplicityNSD");
}
for (Int_t i = 0; i < kCorrHists; ++i)
if (fMultiplicityINEL[i])
delete fMultiplicityINEL[i];
fMultiplicityINEL[i] = 0;
- }
+
+ if (fMultiplicityNSD[i])
+ delete fMultiplicityNSD[i];
+ fMultiplicityNSD[i] = 0;
+}
for (Int_t i = 0; i < kCorrHists; ++i)
{
TObject* obj;
// collections of all histograms
- TList collections[kESDHists+kMCHists*3+kCorrHists*2];
+ TList collections[kESDHists+kMCHists*4+kCorrHists*2];
Int_t count = 0;
while ((obj = iter->Next())) {
collections[kESDHists+i].Add(entry->fMultiplicityVtx[i]);
collections[kESDHists+kMCHists+i].Add(entry->fMultiplicityMB[i]);
collections[kESDHists+kMCHists*2+i].Add(entry->fMultiplicityINEL[i]);
+ collections[kESDHists+kMCHists*3+i].Add(entry->fMultiplicityNSD[i]);
}
for (Int_t i = 0; i < kCorrHists; ++i)
- collections[kESDHists+kMCHists*3+i].Add(entry->fCorrelation[i]);
+ collections[kESDHists+kMCHists*4+i].Add(entry->fCorrelation[i]);
for (Int_t i = 0; i < kCorrHists; ++i)
- collections[kESDHists+kMCHists*3+kCorrHists+i].Add(entry->fMultiplicityESDCorrected[i]);
+ collections[kESDHists+kMCHists*4+kCorrHists+i].Add(entry->fMultiplicityESDCorrected[i]);
count++;
}
fMultiplicityVtx[i]->Merge(&collections[kESDHists+i]);
fMultiplicityMB[i]->Merge(&collections[kESDHists+kMCHists+i]);
fMultiplicityINEL[i]->Merge(&collections[kESDHists+kMCHists*2+i]);
+ fMultiplicityNSD[i]->Merge(&collections[kESDHists+kMCHists*3+i]);
}
for (Int_t i = 0; i < kCorrHists; ++i)
- fCorrelation[i]->Merge(&collections[kESDHists+kMCHists*3+i]);
+ fCorrelation[i]->Merge(&collections[kESDHists+kMCHists*4+i]);
for (Int_t i = 0; i < kCorrHists; ++i)
- fMultiplicityESDCorrected[i]->Merge(&collections[kESDHists+kMCHists*3+kCorrHists+i]);
+ fMultiplicityESDCorrected[i]->Merge(&collections[kESDHists+kMCHists*4+kCorrHists+i]);
delete iter;
oldObjects.Add(fMultiplicityMB[i]);
if (fMultiplicityINEL[i])
oldObjects.Add(fMultiplicityINEL[i]);
+ if (fMultiplicityNSD[i])
+ oldObjects.Add(fMultiplicityNSD[i]);
}
for (Int_t i = 0; i < kCorrHists; ++i)
fMultiplicityVtx[i] = dynamic_cast<TH2F*> (gDirectory->Get(fMultiplicityVtx[i]->GetName()));
fMultiplicityMB[i] = dynamic_cast<TH2F*> (gDirectory->Get(fMultiplicityMB[i]->GetName()));
fMultiplicityINEL[i] = dynamic_cast<TH2F*> (gDirectory->Get(fMultiplicityINEL[i]->GetName()));
+ fMultiplicityNSD[i] = dynamic_cast<TH2F*> (gDirectory->Get(fMultiplicityNSD[i]->GetName()));
if (!fMultiplicityVtx[i] || !fMultiplicityMB[i] || !fMultiplicityINEL[i])
success = kFALSE;
}
for (Int_t i = 0; i < kESDHists; ++i)
if (fMultiplicityESD[i])
+ {
fMultiplicityESD[i]->Write();
+ fMultiplicityESD[i]->ProjectionY(Form("%s_px", fMultiplicityESD[i]->GetName()), 1, fMultiplicityESD[i]->GetNbinsX())->Write();
+ }
for (Int_t i = 0; i < kMCHists; ++i)
{
if (fMultiplicityVtx[i])
+ {
fMultiplicityVtx[i]->Write();
+ fMultiplicityVtx[i]->ProjectionY(Form("%s_px", fMultiplicityVtx[i]->GetName()), 1, fMultiplicityVtx[i]->GetNbinsX())->Write();
+ }
if (fMultiplicityMB[i])
+ {
fMultiplicityMB[i]->Write();
+ fMultiplicityMB[i]->ProjectionY(Form("%s_px", fMultiplicityMB[i]->GetName()), 1, fMultiplicityMB[i]->GetNbinsX())->Write();
+ }
if (fMultiplicityINEL[i])
+ {
fMultiplicityINEL[i]->Write();
+ fMultiplicityINEL[i]->ProjectionY(Form("%s_px", fMultiplicityINEL[i]->GetName()), 1, fMultiplicityINEL[i]->GetNbinsX())->Write();
+ }
+ if (fMultiplicityNSD[i])
+ {
+ fMultiplicityNSD[i]->Write();
+ fMultiplicityNSD[i]->ProjectionY(Form("%s_px", fMultiplicityNSD[i]->GetName()), 1, fMultiplicityNSD[i]->GetNbinsX())->Write();
+ }
}
for (Int_t i = 0; i < kCorrHists; ++i)
}
//____________________________________________________________________
-void AliMultiplicityCorrection::FillGenerated(Float_t vtx, Bool_t triggered, Bool_t vertex, Int_t generated05, Int_t generated10, Int_t generated15, Int_t generated20, Int_t generatedAll)
+void AliMultiplicityCorrection::FillGenerated(Float_t vtx, Bool_t triggered, Bool_t vertex, AliPWG0Helper::MCProcessType processType, Int_t generated05, Int_t generated10, Int_t generated15, Int_t generated20, Int_t generatedAll)
{
//
// Fills an event from MC
fMultiplicityINEL[2]->Fill(vtx, generated15);
fMultiplicityINEL[3]->Fill(vtx, generated20);
fMultiplicityINEL[4]->Fill(vtx, generatedAll);
+
+ if (processType != AliPWG0Helper::kSD)
+ {
+ fMultiplicityNSD[0]->Fill(vtx, generated05);
+ fMultiplicityNSD[1]->Fill(vtx, generated10);
+ fMultiplicityNSD[2]->Fill(vtx, generated15);
+ fMultiplicityNSD[3]->Fill(vtx, generated20);
+ fMultiplicityNSD[4]->Fill(vtx, generatedAll);
+ }
}
//____________________________________________________________________
//Double_t tmp = params[i] / paramSum;
Double_t tmp = params[i];
if (tmp > 0 && (*fgEntropyAPriori)[i] > 0)
+ {
chi2 += tmp * TMath::Log(tmp / (*fgEntropyAPriori)[i]);
+ }
}
return 100.0 + chi2;
//measGuessVector.Print();
// reduce influence of first bin
- copy(0) *= 0.01;
+ //copy(0) *= 0.01;
// (Ad - m) W (Ad - m)
// the factor 1e6 prevents that a very small number (measGuessVector[i]) is multiplied with a very
measGuessVector -= (*fgCurrentESDVector);
TVectorD copy(measGuessVector);
+ //copy.Print();
// (Ad - m) W
// this step can be optimized because currently only the diagonal elements of fgCorrelationCovarianceMatrix are used
TH1* penalty = new TH1F("penalty", "penalty", fgNParamsMinuit, -0.5, fgNParamsMinuit - 0.5);
- for (Int_t i=2; i<fgNParamsMinuit; ++i)
+ for (Int_t i=2+1; i<fgNParamsMinuit; ++i)
{
if (params[i-1] == 0)
continue;
Double_t diff = (der1 - der2) / middle;
- penalty->SetBinContent(i, diff * diff);
+ penalty->SetBinContent(i-1, diff * diff);
+
+ //Printf("%d %f %f %f %f", i-1, left, middle, right, diff);
}
new TCanvas; penalty->DrawCopy(); gPad->SetLogy();
}
}
fCurrentCorrelation = hist->Project3D("zy");
- //((TH2*) fCurrentCorrelation)->Rebin2D(2, 1);
- //fMultiplicityESDCorrected[correlationID]->Rebin(2);
fCurrentCorrelation->Sumw2();
-
+
Printf("AliMultiplicityCorrection::SetupCurrentHists: Statistics information: %.f entries in correlation map; %.f entries in measured spectrum", fCurrentCorrelation->Integral(), fCurrentESD->Integral());
- if (createBigBin)
+ fLastBinLimit = 0;
+ for (Int_t i=1; i<=fCurrentESD->GetNbinsX(); ++i)
{
- fLastBinLimit = 0;
- for (Int_t i=1; i<=fCurrentESD->GetNbinsX(); ++i)
+ if (fCurrentESD->GetBinContent(i) <= 5)
{
- if (fCurrentESD->GetBinContent(i) <= 5)
- {
- fLastBinLimit = i;
- break;
- }
+ fLastBinLimit = i;
+ break;
}
+ }
+
+ Printf("AliMultiplicityCorrection::SetupCurrentHists: Bin limit in measured spectrum determined to be %d", fLastBinLimit);
+ if (createBigBin)
+ {
if (fLastBinLimit > 0)
{
TCanvas* canvas = 0;
//
// calculates efficiency for given event type
//
-
+
TH1* divisor = 0;
switch (eventType)
{
- case kTrVtx : divisor = fMultiplicityVtx[inputRange]->ProjectionY("divisor", -1, -1, "e"); break;
- case kMB: divisor = fMultiplicityMB[inputRange]->ProjectionY("divisor", -1, -1, "e"); break;
- case kINEL: divisor = fMultiplicityINEL[inputRange]->ProjectionY("divisor", -1, -1, "e"); break;
+ case kTrVtx : break;
+ case kMB: divisor = fMultiplicityMB[inputRange]->ProjectionY("divisor", 1, fMultiplicityMB[inputRange]->GetNbinsX(), "e"); break;
+ case kINEL: divisor = fMultiplicityINEL[inputRange]->ProjectionY("divisor", 1, fMultiplicityINEL[inputRange]->GetNbinsX(), "e"); break;
+ case kNSD: divisor = fMultiplicityNSD[inputRange]->ProjectionY("divisor", 1, fMultiplicityNSD[inputRange]->GetNbinsX(), "e"); break;
+ }
+ TH1* eff = fMultiplicityVtx[inputRange]->ProjectionY("CurrentEfficiency", 1, fMultiplicityVtx[inputRange]->GetNbinsX(), "e");
+
+ if (eventType == kTrVtx)
+ {
+ for (Int_t i=0; i<= eff->GetNbinsX()+1; i++)
+ eff->SetBinContent(i, 1);
}
- TH1* eff = fMultiplicityVtx[inputRange]->ProjectionY("CurrentEfficiency", -1, -1, "e");
+ else
+ eff->Divide(eff, divisor, 1, 1, "B");
+
+ return eff;
+}
+
+//____________________________________________________________________
+TH1* AliMultiplicityCorrection::GetTriggerEfficiency(Int_t inputRange)
+{
+ //
+ // calculates efficiency for given event type
+ //
+
+ TH1* divisor = fMultiplicityINEL[inputRange]->ProjectionY("divisor", 1, fMultiplicityINEL[inputRange]->GetNbinsX(), "e");
+ TH1* eff = fMultiplicityMB[inputRange]->ProjectionY("CurrentEfficiency", 1, fMultiplicityMB[inputRange]->GetNbinsX(), "e");
eff->Divide(eff, divisor, 1, 1, "B");
return eff;
}
Int_t AliMultiplicityCorrection::UnfoldWithMinuit(TH1* correlation, TH1* aEfficiency, TH1* measured, TH1* initialConditions, TH1* result, Bool_t check)
{
//
- // implemenation of unfolding (internal function)
+ // implementation of unfolding (internal function)
//
// unfolds <measured> using response from <correlation> and effiency <aEfficiency>
// output is in <result>
if ((*fgCorrelationCovarianceMatrix)(i, i) > 1e7)
(*fgCorrelationCovarianceMatrix)(i, i) = 0;
+ //Printf("%d, %e", i, (*fgCorrelationCovarianceMatrix)(i, i));
}
Int_t dummy = 0;
Double_t chi2 = 0;
MinuitFitFunction(dummy, 0, chi2, results, 0);
- DrawGuess(results);
printf("Chi2 of initial parameters is = %f\n", chi2);
if (check)
{
+ DrawGuess(results);
delete[] results;
return -1;
}
//printf("!!!!!!!!!!!!!! MIGRAD finished: Starting MINOS !!!!!!!!!!!!!!");
//minuit->ExecuteCommand("MINOS", arglist, 0);
+ //new TCanvas; aEfficiency->Draw();
+
for (Int_t i=0; i<fgNParamsMinuit; ++i)
{
+ results[i] = minuit->GetParameter(i);
if (aEfficiency->GetBinContent(i+1) > 0)
{
- results[i] = minuit->GetParameter(i);
result->SetBinContent(i+1, results[i] * results[i] / aEfficiency->GetBinContent(i+1));
// error is : (relError) * (value) = (minuit->GetParError(i) / minuit->GetParameter(i)) * (minuit->GetParameter(i) * minuit->GetParameter(i))
result->SetBinError(i+1, minuit->GetParError(i) * results[i] / aEfficiency->GetBinContent(i+1));
result->SetBinError(i+1, 0);
}
}
- DrawGuess(results);
+ //DrawGuess(results);
delete[] results;
break;
}
Printf("AliMultiplicityCorrection::DrawComparison: MC bin limit is %d", mcBinLimit);
-
+
// scale to 1
mcHist->Sumw2();
if (mcHist->Integral() > 0)
TCanvas* canvas1 = 0;
if (simple)
{
- canvas1 = new TCanvas(tmpStr, tmpStr, 900, 400);
+ canvas1 = new TCanvas(tmpStr, tmpStr, 1200, 600);
canvas1->Divide(2, 1);
}
else
}
canvas1->cd(1);
+ canvas1->cd(1)->SetGridx();
+ canvas1->cd(1)->SetGridy();
+ canvas1->cd(1)->SetTopMargin(0.05);
+ canvas1->cd(1)->SetRightMargin(0.05);
+ canvas1->cd(1)->SetLeftMargin(0.12);
+ canvas1->cd(1)->SetBottomMargin(0.12);
TH1* proj = (TH1*) mcHist->Clone("proj");
// normalize without 0 bin
proj->Scale(1.0 / proj->Integral(2, proj->GetNbinsX()));
Printf("Normalized without 0 bin!");
proj->GetXaxis()->SetRangeUser(0, 200);
- proj->SetTitle(";true multiplicity;Entries");
+ proj->GetYaxis()->SetTitleOffset(1.4);
+ //proj->SetLabelSize(0.05, "xy");
+ //proj->SetTitleSize(0.05, "xy");
+ proj->SetTitle(Form(";True multiplicity in |#eta| < %.1f;Entries", (inputRange+1)*0.5));
proj->SetStats(kFALSE);
fMultiplicityESDCorrected[esdCorrId]->SetLineColor(2);
+ fMultiplicityESDCorrected[esdCorrId]->SetMarkerColor(2);
+ //fMultiplicityESDCorrected[esdCorrId]->SetMarkerStyle(5);
// normalize without 0 bin
fMultiplicityESDCorrected[esdCorrId]->Scale(1.0 / fMultiplicityESDCorrected[esdCorrId]->Integral(2, fMultiplicityESDCorrected[esdCorrId]->GetNbinsX()));
Printf("Normalized without 0 bin!");
gPad->SetLogy();
TLegend* legend = new TLegend(0.3, 0.8, 0.93, 0.93);
- legend->AddEntry(proj, "true distribution");
- legend->AddEntry(fMultiplicityESDCorrected[esdCorrId], "unfolded distribution");
+ legend->AddEntry(proj, "True distribution");
+ legend->AddEntry(fMultiplicityESDCorrected[esdCorrId], "Unfolded distribution");
legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
legend->Draw();
// unfortunately does not work. maybe a bug? --> legend->SetTextSizePixels(14);
canvas1->cd(2);
+ canvas1->cd(2)->SetGridx();
+ canvas1->cd(2)->SetGridy();
+ canvas1->cd(2)->SetTopMargin(0.05);
+ canvas1->cd(2)->SetRightMargin(0.05);
+ canvas1->cd(2)->SetLeftMargin(0.12);
+ canvas1->cd(2)->SetBottomMargin(0.12);
gPad->SetLogy();
fCurrentESD->GetXaxis()->SetRangeUser(0, 200);
//fCurrentESD->SetLineColor(2);
- fCurrentESD->SetTitle(";measured multiplicity;Entries");
+ fCurrentESD->SetTitle(Form(";Measured multiplicity in |#eta| < %.1f;Entries", (inputRange+1)*0.5));
fCurrentESD->SetStats(kFALSE);
+ fCurrentESD->GetYaxis()->SetTitleOffset(1.4);
+ //fCurrentESD->SetLabelSize(0.05, "xy");
+ //fCurrentESD->SetTitleSize(0.05, "xy");
fCurrentESD->DrawCopy("HIST E");
convolutedProj->SetLineColor(2);
+ convolutedProj->SetMarkerColor(2);
+ convolutedProj->SetMarkerStyle(5);
//proj2->SetMarkerColor(2);
//proj2->SetMarkerStyle(5);
- convolutedProj->DrawCopy("HIST SAME");
+ convolutedProj->DrawCopy("HIST SAME P");
legend = new TLegend(0.3, 0.8, 0.93, 0.93);
- legend->AddEntry(fCurrentESD, "measured distribution");
- legend->AddEntry(convolutedProj, "R #otimes unfolded distribution");
+ legend->AddEntry(fCurrentESD, "Measured distribution");
+ legend->AddEntry(convolutedProj, "R #otimes unfolded distribution", "P");
legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
legend->Draw();
//TH1* diffMCUnfolded = dynamic_cast<TH1*> (proj->Clone("diffMCUnfolded"));
case kTrVtx : return fMultiplicityVtx[i]; break;
case kMB : return fMultiplicityMB[i]; break;
case kINEL : return fMultiplicityINEL[i]; break;
+ case kNSD : return fMultiplicityNSD[i]; break;
}
return 0;
}
+//____________________________________________________________________
+void AliMultiplicityCorrection::SetMultiplicityMC(Int_t i, EventType eventType, TH2F* hist)
+{
+ //
+ // returns the corresponding MC spectrum
+ //
+
+ switch (eventType)
+ {
+ case kTrVtx : fMultiplicityVtx[i] = hist; break;
+ case kMB : fMultiplicityMB[i] = hist; break;
+ case kINEL : fMultiplicityINEL[i] = hist; break;
+ case kNSD : fMultiplicityNSD[i] = hist; break;
+ }
+}
+
//____________________________________________________________________
TH1* AliMultiplicityCorrection::CalculateStdDev(TH1** results, Int_t max)
{
for (Int_t x=1; x<=results[n]->GetNbinsX(); x++)
average->Fill(results[n]->GetXaxis()->GetBinCenter(x), results[n]->GetBinContent(x));
//new TCanvas; average->DrawClone();
-
+
// find cov. matrix
TProfile2D* covMatrix = new TProfile2D("covMatrix", "covMatrix", nBins, lowEdge, upEdge, nBins, lowEdge, upEdge);
Float_t cov = (results[n]->GetBinContent(x) - average->GetBinContent(x)) * (results[n]->GetBinContent(y) - average->GetBinContent(y));
covMatrix->Fill(results[n]->GetXaxis()->GetBinCenter(x), results[n]->GetXaxis()->GetBinCenter(y), cov);
}
- new TCanvas; covMatrix->DrawClone("COLZ");
+ TCanvas* c = new TCanvas; c->cd(); covMatrix->DrawCopy("COLZ");
// // fill 2D histogram that contains deviation from first
// TH2F* deviations = new TH2F("deviations", "deviations", nBins, lowEdge, upEdge, 1000, -0.01, 0.01);
//new TCanvas; results[0]->DrawCopy(); average->SetLineColor(2); average->DrawClone("SAME");
//new TCanvas; averageFirstRatio->DrawCopy();
+ static TH1* temp = 0;
+ if (!temp)
+ {
+ temp = (TH1*) standardDeviation->Clone("temp");
+ for (Int_t x=1; x<=results[0]->GetNbinsX(); x++)
+ temp->SetBinContent(x, temp->GetBinContent(x) * results[0]->GetBinContent(x));
+ }
+ else
+ {
+ // find difference from result[0] as TH2
+ TH2F* pulls = new TH2F("pulls", "pulls;multiplicity;difference", nBins, lowEdge, upEdge, 1000, -10, 10);
+ for (Int_t n=1; n<kErrorIterations; ++n)
+ for (Int_t x=1; x<=results[n]->GetNbinsX(); x++)
+ if (temp->GetBinContent(x) > 0)
+ pulls->Fill(results[n]->GetXaxis()->GetBinCenter(x), (results[0]->GetBinContent(x) - results[n]->GetBinContent(x)) / temp->GetBinContent(x));
+ new TCanvas("pulls", "pulls", 800, 600); pulls->DrawCopy(); pulls->FitSlicesY();
+ }
+
// clean up
for (Int_t n=0; n<kErrorIterations; ++n)
delete results[n];
//
// unfolds a spectrum
//
-
+
if (measured->Integral() <= 0)
{
Printf("AliMultiplicityCorrection::UnfoldWithBayesian: ERROR: The measured spectrum is empty");
}
//TH1F* convergence = new TH1F("convergence", "convergence", 200, 0.5, 200.5);
-
+
// unfold...
for (Int_t i=0; i<nIterations || nIterations < 0; i++)
{
else
result[t] = 0;
}
+
+ // draw intermediate result
+ /*
+ for (Int_t t=0; t<kMaxT; t++)
+ aResult->SetBinContent(t+1, result[t]);
+ aResult->SetMarkerStyle(20+i);
+ aResult->SetMarkerColor(2);
+ aResult->DrawCopy("P SAME HIST");
+ */
Double_t chi2LastIter = 0;
// regularization (simple smoothing)
for (Int_t t=kStartBin; t<kMaxT; t++)
{
Float_t newValue = 0;
+
// 0 bin excluded from smoothing
- if (t > kStartBin+1 && t<kMaxT-1)
+ if (t > kStartBin+2 && t<kMaxT-1)
{
Float_t average = (result[t-1] + result[t] + result[t+1]) / 3;
if (id < 0 || id >= kESDHists)
return;
- TH2F* mc = fMultiplicityVtx[id];
-
+ // fill histogram used for random generation
+ TH1* tmp = fMultiplicityVtx[id]->ProjectionY("tmp");
+ tmp->Reset();
+
+ for (Int_t i=1; i<=tmp->GetNbinsX(); ++i)
+ tmp->SetBinContent(i, inputMC->Eval(tmp->GetXaxis()->GetBinCenter(i)) * tmp->GetXaxis()->GetBinWidth(i));
+
+ TH1* mcRnd = fMultiplicityVtx[id]->ProjectionY("mcRnd");
+ mcRnd->Reset();
+ mcRnd->FillRandom(tmp, tmp->Integral());
+
+ //new TCanvas; tmp->Draw();
+ //new TCanvas; mcRnd->Draw();
+
+ // and move into 2d histogram
+ TH1* mc = fMultiplicityVtx[id];
mc->Reset();
-
for (Int_t i=1; i<=mc->GetNbinsY(); ++i)
{
- mc->SetBinContent(mc->GetNbinsX() / 2 + 1, i, inputMC->Eval(mc->GetYaxis()->GetBinCenter(i)) * mc->GetYaxis()->GetBinWidth(i));
- mc->SetBinError(mc->GetNbinsX() / 2 + 1, i, 0);
+ mc->SetBinContent(mc->GetNbinsX() / 2 + 1, i, mcRnd->GetBinContent(i));
+ mc->SetBinError(mc->GetNbinsX() / 2 + 1, i, TMath::Sqrt(mcRnd->GetBinContent(i)));
+ }
+
+ //new TCanvas; mc->Draw("COLZ");
+
+ // now randomize the measured histogram; funcMeasured is used as pilot function to generated the measured entries
+ TH1* funcMeasured = CalculateMultiplicityESD(tmp, id)->ProjectionY("funcMeasured");
+
+ //new TCanvas; funcMeasured->Draw();
+
+ fMultiplicityESD[id]->Reset();
+
+ TH1* measRnd = fMultiplicityESD[id]->ProjectionY("measRnd");
+ measRnd->FillRandom(funcMeasured, tmp->Integral());
+
+ //new TCanvas; measRnd->Draw();
+
+ fMultiplicityESD[id]->Reset();
+ for (Int_t i=1; i<=fMultiplicityESD[id]->GetNbinsY(); ++i)
+ {
+ fMultiplicityESD[id]->SetBinContent(fMultiplicityESD[id]->GetNbinsX() / 2 + 1, i, measRnd->GetBinContent(i));
+ fMultiplicityESD[id]->SetBinError(fMultiplicityESD[id]->GetNbinsX() / 2 + 1, i, TMath::Sqrt(measRnd->GetBinContent(i)));
}
-
- //new TCanvas;
- //mc->Draw("COLZ");
-
- TH1* proj = mc->ProjectionY();
-
- TString tmp(fMultiplicityESD[id]->GetName());
- delete fMultiplicityESD[id];
- fMultiplicityESD[id] = CalculateMultiplicityESD(proj, id);
- fMultiplicityESD[id]->SetName(tmp);
}
#include <TMatrixD.h>
#include <TVectorD.h>
+#include <AliPWG0Helper.h>
class AliMultiplicityCorrection : public TNamed {
public:
- enum EventType { kTrVtx = 0, kMB, kINEL };
+ enum EventType { kTrVtx = 0, kMB, kINEL, kNSD };
enum RegularizationType { kNone = 0, kPol0, kPol1, kLog, kEntropy, kCurvature };
enum MethodType { kChi2Minimization = 0, kBayesian = 1 };
enum { kESDHists = 4, kMCHists = 5, kCorrHists = 8, kQualityRegions = 3 };
AliMultiplicityCorrection();
AliMultiplicityCorrection(const Char_t* name, const Char_t* title);
virtual ~AliMultiplicityCorrection();
+
+ static AliMultiplicityCorrection* Open(const char* fileName, const char* folderName = "Multiplicity");
virtual Long64_t Merge(TCollection* list);
void FillMeasured(Float_t vtx, Int_t measured05, Int_t measured10, Int_t measured15, Int_t measured20);
- void FillGenerated(Float_t vtx, Bool_t triggered, Bool_t vertex, Int_t generated05, Int_t generated10, Int_t generated15, Int_t generated20, Int_t generatedAll);
+ void FillGenerated(Float_t vtx, Bool_t triggered, Bool_t vertex, AliPWG0Helper::MCProcessType processType, Int_t generated05, Int_t generated10, Int_t generated15, Int_t generated20, Int_t generatedAll);
void FillCorrection(Float_t vtx, Int_t generated05, Int_t generated10, Int_t generated15, Int_t generated20, Int_t generatedAll, Int_t measured05, Int_t measured10, Int_t measured15, Int_t measured20);
TH2F* GetMultiplicityVtx(Int_t i) { return fMultiplicityVtx[i]; }
TH2F* GetMultiplicityMB(Int_t i) { return fMultiplicityMB[i]; }
TH2F* GetMultiplicityINEL(Int_t i) { return fMultiplicityINEL[i]; }
+ TH2F* GetMultiplicityNSD(Int_t i) { return fMultiplicityNSD[i]; }
TH2F* GetMultiplicityMC(Int_t i, EventType eventType);
TH3F* GetCorrelation(Int_t i) { return fCorrelation[i]; }
TH1F* GetMultiplicityESDCorrected(Int_t i) { return fMultiplicityESDCorrected[i]; }
void SetMultiplicityVtx(Int_t i, TH2F* hist) { fMultiplicityVtx[i] = hist; }
void SetMultiplicityMB(Int_t i, TH2F* hist) { fMultiplicityMB[i] = hist; }
void SetMultiplicityINEL(Int_t i, TH2F* hist) { fMultiplicityINEL[i] = hist; }
+ void SetMultiplicityNSD(Int_t i, TH2F* hist) { fMultiplicityNSD[i] = hist; }
+ void SetMultiplicityMC(Int_t i, EventType eventType, TH2F* hist);
void SetCorrelation(Int_t i, TH3F* hist) { fCorrelation[i] = hist; }
void SetMultiplicityESDCorrected(Int_t i, TH1F* hist) { fMultiplicityESDCorrected[i] = hist; }
void GetComparisonResults(Float_t* mc = 0, Int_t* mcLimit = 0, Float_t* residuals = 0, Float_t* ratioAverage = 0) const;
TH1* GetEfficiency(Int_t inputRange, EventType eventType);
+ TH1* GetTriggerEfficiency(Int_t inputRange);
static void SetQualityRegions(Bool_t SPDStudy);
Float_t GetQuality(Int_t region) const { return fQuality[region]; }
static Int_t fgBayesianIterations; //! number of iterations in Bayesian method
// end of configuration
- TH2F* fMultiplicityESD[kESDHists]; // multiplicity histogram: vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2 (0..3)
+ TH2F* fMultiplicityESD[kESDHists]; // multiplicity histogram: vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.5, 2 (0..3)
- TH2F* fMultiplicityVtx[kMCHists]; // multiplicity histogram of events that have a reconstructed vertex : vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2, inf (0..4)
- TH2F* fMultiplicityMB[kMCHists]; // multiplicity histogram of triggered events : vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2, inf (0..4)
- TH2F* fMultiplicityINEL[kMCHists]; // multiplicity histogram of all (inelastic) events : vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2, inf (0..4)
+ TH2F* fMultiplicityVtx[kMCHists]; // multiplicity histogram of events that have a reconstructed vertex : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.5, 2, inf (0..4)
+ TH2F* fMultiplicityMB[kMCHists]; // multiplicity histogram of triggered events : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.5, 2, inf (0..4)
+ TH2F* fMultiplicityINEL[kMCHists]; // multiplicity histogram of all (inelastic) events : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.5, 2, inf (0..4)
+ TH2F* fMultiplicityNSD[kMCHists]; // multiplicity histogram of NSD events : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.5, 2, inf (0..4)
TH3F* fCorrelation[kCorrHists]; // vtx vs. (gene multiplicity (trig+vtx)) vs. (meas multiplicity); array: |eta| < 0.5, 1, 1.5, 2 (0..3 and 4..7), the first corrects to the eta range itself, the second to full phase space
AliMultiplicityCorrection(const AliMultiplicityCorrection&);
AliMultiplicityCorrection& operator=(const AliMultiplicityCorrection&);
- ClassDef(AliMultiplicityCorrection, 2);
+ ClassDef(AliMultiplicityCorrection, 4);
};
#endif
#include <TVector3.h>
#include <TChain.h>
#include <TFile.h>
+#include <TH1D.h>
#include <TH2F.h>
#include <TH3F.h>
#include <TParticle.h>
fOption(opt),
fAnalysisMode(AliPWG0Helper::kSPD),
fTrigger(AliPWG0Helper::kMB1),
+ fDeltaPhiCut(-1),
fReadMC(kFALSE),
fUseMCVertex(kFALSE),
fMultiplicity(0),
fSystSkipParticles(kFALSE),
fSelectProcessType(0),
fParticleSpecies(0),
+ fdNdpT(0),
fPtSpectrum(0),
fOutput(0)
{
// Constructor. Initialization of pointers
//
- for (Int_t i = 0; i<4; i++)
+ for (Int_t i = 0; i<8; i++)
fParticleCorrection[i] = 0;
// Define input and output slots here
Printf("ERROR: Could not read tree from input slot 0");
} else {
// Disable all branches and enable only the needed ones
+ /*
tree->SetBranchStatus("*", 0);
tree->SetBranchStatus("AliESDHeader*", 1);
//AliESDtrackCuts::EnableNeededBranches(tree);
tree->SetBranchStatus("Tracks*", 1);
}
+ */
AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
fMultiplicity = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
fOutput->Add(fMultiplicity);
+
+ fdNdpT = new TH1F("fdNdpT", "fdNdpT", 1000, 0, 10);
+ fdNdpT->Sumw2();
+ fOutput->Add(fdNdpT);
if (fOption.Contains("skip-particles"))
{
}
if (fOption.Contains("particle-efficiency"))
- for (Int_t i = 0; i<4; i++)
+ for (Int_t i = 0; i<8; i++)
{
fParticleCorrection[i] = new AliCorrection(Form("correction_%d", i), Form("correction_%d", i));
fOutput->Add(fParticleCorrection[i]);
TString subStr(fOption(fOption.Index("pt-spectrum")+17, 3));
TString histName(Form("ptspectrum_%s", subStr.Data()));
AliInfo(Form("Pt-Spectrum modification. Using %s.", histName.Data()));
- fPtSpectrum = (TH1*) file->Get(histName);
- if (!fPtSpectrum)
- AliError("Histogram not found");
+ fPtSpectrum = (TH1D*) file->Get(histName);
+ if (!fPtSpectrum)
+ AliError("Histogram not found");
}
else
AliError("Could not open ptspectrum_fit.root. Pt Spectrum study could not be enabled.");
-
- if (fPtSpectrum)
- AliInfo("WARNING: Systematic study enabled. Pt spectrum will be modified");
}
if (fOption.Contains("pt-spectrum-func"))
{
if (fPtSpectrum)
{
- Printf("Using function from input list for systematic p_t study");
+ Printf("Using function for systematic p_t study");
}
else
{
- fPtSpectrum = new TH1F("fPtSpectrum", "fPtSpectrum", 1, 0, 100);
+ Printf("ERROR: Could not find function for systematic p_t study");
+ fPtSpectrum = new TH1D("fPtSpectrum", "fPtSpectrum", 1, 0, 100);
fPtSpectrum->SetBinContent(1, 1);
}
-
- if (fPtSpectrum)
- AliInfo("WARNING: Systematic study enabled. Pt spectrum will be modified");
}
+ if (fPtSpectrum)
+ Printf("WARNING: Systematic study enabled. Pt spectrum will be modified");
+
if (fOption.Contains("particle-species")) {
fParticleSpecies = new TNtuple("fParticleSpecies", "fParticleSpecies", "vtx:Pi_True:K_True:p_True:o_True:Pi_Rec:K_Rec:p_Rec:o_Rec:nolabel:doublePrim:doubleCount");
fOutput->Add(fParticleSpecies);
return;
}
- Bool_t eventTriggered = AliPWG0Helper::IsEventTriggered(fESD->GetTriggerMask(), fTrigger);
+ Bool_t eventTriggered = AliPWG0Helper::IsEventTriggered(fESD, fTrigger);
const AliESDVertex* vtxESD = AliPWG0Helper::GetVertex(fESD, fAnalysisMode);
Bool_t eventVertex = (vtxESD != 0);
// post the data already here
PostData(0, fOutput);
-
+
//const Float_t kPtCut = 0.3;
// create list of (label, eta) tuples
{
//printf("%d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), mult->GetDeltaPhi(i));
- // This removes non-tracklets in PDC06 data. Very bad solution. New solution is implemented for newer data. Keeping this for compatibility.
- if (mult->GetDeltaPhi(i) < -1000)
+ Float_t deltaPhi = mult->GetDeltaPhi(i);
+
+ if (fDeltaPhiCut > 0 && TMath::Abs(deltaPhi) > fDeltaPhiCut)
continue;
etaArr[inputCount] = mult->GetEta(i);
- // TODO add second label array
- labelArr[inputCount] = mult->GetLabel(i, 0);
+ if (mult->GetLabel(i, 0) == mult->GetLabel(i, 1))
+ {
+ labelArr[inputCount] = mult->GetLabel(i, 0);
+ }
+ else
+ labelArr[inputCount] = -1;
+
++inputCount;
}
}
return;
}
- // get multiplicity from ESD tracks
- TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD, (fAnalysisMode == AliPWG0Helper::kTPC));
- Int_t nGoodTracks = list->GetEntries();
-
- labelArr = new Int_t[nGoodTracks];
- etaArr = new Float_t[nGoodTracks];
-
- // loop over esd tracks
- for (Int_t i=0; i<nGoodTracks; i++)
+ if (vtxESD)
{
- AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(i));
- if (!esdTrack)
+ // get multiplicity from ESD tracks
+ TObjArray* list = fEsdTrackCuts->GetAcceptedTracks(fESD, (fAnalysisMode == AliPWG0Helper::kTPC));
+ Int_t nGoodTracks = list->GetEntries();
+
+ labelArr = new Int_t[nGoodTracks];
+ etaArr = new Float_t[nGoodTracks];
+
+ // loop over esd tracks
+ for (Int_t i=0; i<nGoodTracks; i++)
{
- AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", i));
- continue;
+ AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (list->At(i));
+ if (!esdTrack)
+ {
+ AliDebug(AliLog::kError, Form("ERROR: Could not retrieve track %d.", i));
+ continue;
+ }
+
+ etaArr[inputCount] = esdTrack->Eta();
+ labelArr[inputCount] = TMath::Abs(esdTrack->GetLabel());
+ ++inputCount;
}
-
- etaArr[inputCount] = esdTrack->Eta();
- labelArr[inputCount] = TMath::Abs(esdTrack->GetLabel());
- ++inputCount;
+
+ delete list;
}
-
- delete list;
}
// eta range for nMCTracksSpecies, nESDTracksSpecies
case AliPWG0Helper::kInvalid: break;
case AliPWG0Helper::kTPC:
case AliPWG0Helper::kTPCITS:
- etaRange = 0.9; break;
- case AliPWG0Helper::kSPD: etaRange = 2.0; break;
+ etaRange = 1.0; break;
+ case AliPWG0Helper::kSPD: etaRange = 1.0; break;
}
if (!fReadMC) // Processing of ESD information
if (eventTriggered && eventVertex)
{
Int_t nESDTracks05 = 0;
- Int_t nESDTracks09 = 0;
+ Int_t nESDTracks10 = 0;
Int_t nESDTracks15 = 0;
Int_t nESDTracks20 = 0;
if (TMath::Abs(eta) < 0.5)
nESDTracks05++;
- if (TMath::Abs(eta) < 0.9)
- nESDTracks09++;
+ if (TMath::Abs(eta) < 1.0)
+ nESDTracks10++;
if (TMath::Abs(eta) < 1.5)
nESDTracks15++;
nESDTracks20++;
}
- fMultiplicity->FillMeasured(vtx[2], nESDTracks05, nESDTracks09, nESDTracks15, nESDTracks20);
+ fMultiplicity->FillMeasured(vtx[2], nESDTracks05, nESDTracks10, nESDTracks15, nESDTracks20);
}
}
else if (fReadMC) // Processing of MC information
AliDebug(AliLog::kError, "Stack not available");
return;
}
-
+
AliHeader* header = mcEvent->Header();
if (!header)
{
vtx[2] = vtxMC[2];
}
+
+ // get process information
+ AliPWG0Helper::MCProcessType processType = AliPWG0Helper::GetEventProcessType(header);
Bool_t processEvent = kTRUE;
if (fSelectProcessType > 0)
{
- // getting process information; NB: this only works for Pythia
- Int_t processtype = AliPWG0Helper::GetEventProcessType(header);
-
processEvent = kFALSE;
// non diffractive
- if (fSelectProcessType == 1 && processtype == AliPWG0Helper::kND )
+ if (fSelectProcessType == 1 && processType == AliPWG0Helper::kND)
processEvent = kTRUE;
// single diffractive
- if (fSelectProcessType == 2 && processtype == AliPWG0Helper::kSD )
+ if (fSelectProcessType == 2 && processType == AliPWG0Helper::kSD)
processEvent = kTRUE;
// double diffractive
- if (fSelectProcessType == 3 && processtype == AliPWG0Helper::kDD )
+ if (fSelectProcessType == 3 && processType == AliPWG0Helper::kDD)
processEvent = kTRUE;
if (!processEvent)
- AliDebug(AliLog::kDebug, Form("Skipping this event, because it is not of the requested process type (%d)", processtype));
+ Printf("Skipping this event, because it is not of the requested process type (%d)", (Int_t) processType);
}
- // systematic study: 10% lower efficiency
- if (fSystSkipParticles && (gRandom->Uniform() < 0.1))
- processEvent = kFALSE;
-
if (processEvent)
{
// get the MC vertex
// tracks in different eta ranges
Int_t nMCTracks05 = 0;
- Int_t nMCTracks09 = 0;
+ Int_t nMCTracks10 = 0;
Int_t nMCTracks15 = 0;
Int_t nMCTracks20 = 0;
Int_t nMCTracksAll = 0;
if (TMath::Abs(particle->Eta()) < 0.5)
nMCTracks05 += particleWeight;
- if (TMath::Abs(particle->Eta()) < 0.9)
- nMCTracks09 += particleWeight;
+ if (TMath::Abs(particle->Eta()) < 1.0)
+ nMCTracks10 += particleWeight;
if (TMath::Abs(particle->Eta()) < 1.5)
nMCTracks15 += particleWeight;
nMCTracks20 += particleWeight;
nMCTracksAll += particleWeight;
+
+ if (particle->Pt() > 0 && TMath::Abs(particle->Eta()) < 1.0)
+ fdNdpT->Fill(particle->Pt(), 1.0 / particle->Pt());
if (fParticleCorrection[0] || fParticleSpecies)
{
}
} // end of mc particle
- fMultiplicity->FillGenerated(vtxMC[2], eventTriggered, eventVertex, (Int_t) nMCTracks05, (Int_t) nMCTracks09, (Int_t) nMCTracks15, (Int_t) nMCTracks20, (Int_t) nMCTracksAll);
+ fMultiplicity->FillGenerated(vtxMC[2], eventTriggered, eventVertex, processType, (Int_t) nMCTracks05, (Int_t) nMCTracks10, (Int_t) nMCTracks15, (Int_t) nMCTracks20, (Int_t) nMCTracksAll);
if (eventTriggered && eventVertex)
{
Int_t nESDTracks05 = 0;
- Int_t nESDTracks09 = 0;
+ Int_t nESDTracks10 = 0;
Int_t nESDTracks15 = 0;
Int_t nESDTracks20 = 0;
for (Int_t i=0; i<nPrim; i++)
foundPrimaries[i] = kFALSE;
+ Bool_t* foundPrimaries2 = new Bool_t[nPrim]; // to prevent double counting
+ for (Int_t i=0; i<nPrim; i++)
+ foundPrimaries2[i] = kFALSE;
+
Bool_t* foundTracks = new Bool_t[nMCPart]; // to prevent double counting
for (Int_t i=0; i<nMCPart; i++)
foundTracks[i] = kFALSE;
Int_t particleWeight = 1;
+ // systematic study: 5% lower efficiency
+ if (fSystSkipParticles && (gRandom->Uniform() < 0.05))
+ continue;
+
// in case of systematic study, weight according to the change of the pt spectrum
if (fPtSpectrum)
{
if (TMath::Abs(eta) < 0.5)
nESDTracks05 += particleWeight;
- if (TMath::Abs(eta) < 0.9)
- nESDTracks09 += particleWeight;
+ if (TMath::Abs(eta) < 1.0)
+ nESDTracks10 += particleWeight;
if (TMath::Abs(eta) < 1.5)
nESDTracks15 += particleWeight;
nESDTracks20 += particleWeight;
- if (fParticleCorrection[0] || fParticleSpecies)
+ if (fParticleSpecies)
{
Int_t motherLabel = -1;
TParticle* mother = 0;
// count tracks that did not have a label
if (TMath::Abs(eta) < etaRange)
nESDTracksSpecies[4]++;
- continue;
}
-
- // get particle type (pion, proton, kaon, other)
- Int_t id = -1;
- switch (TMath::Abs(mother->GetPdgCode()))
+ else
{
- case 211: id = 0; break;
- case 321: id = 1; break;
- case 2212: id = 2; break;
- default: id = 3; break;
+ // get particle type (pion, proton, kaon, other) of mother
+ Int_t idMother = -1;
+ switch (TMath::Abs(mother->GetPdgCode()))
+ {
+ case 211: idMother = 0; break;
+ case 321: idMother = 1; break;
+ case 2212: idMother = 2; break;
+ default: idMother = 3; break;
+ }
+
+ // double counting is ok for particle ratio study
+ if (TMath::Abs(eta) < etaRange)
+ nESDTracksSpecies[idMother]++;
+
+ // double counting is not ok for efficiency study
+
+ // check if we already counted this particle, this way distinguishes double counted particles (bug/artefact in tracking) or double counted primaries due to secondaries (physics)
+ if (foundTracks[label])
+ {
+ if (TMath::Abs(eta) < etaRange)
+ nESDTracksSpecies[6]++;
+ }
+ else
+ {
+ foundTracks[label] = kTRUE;
+
+ // particle (primary) already counted?
+ if (foundPrimaries[motherLabel])
+ {
+ if (TMath::Abs(eta) < etaRange)
+ nESDTracksSpecies[5]++;
+ }
+ else
+ foundPrimaries[motherLabel] = kTRUE;
+ }
}
+ }
+
+ if (fParticleCorrection[0])
+ {
+ if (label >= 0 && stack->IsPhysicalPrimary(label))
+ {
+ TParticle* particle = stack->Particle(label);
- // double counting is ok for particle ratio study
- if (TMath::Abs(eta) < etaRange)
- nESDTracksSpecies[id]++;
+ // get particle type (pion, proton, kaon, other)
+ Int_t id = -1;
+ switch (TMath::Abs(particle->GetPdgCode()))
+ {
+ case 211: id = 0; break;
+ case 321: id = 1; break;
+ case 2212: id = 2; break;
+ default: id = 3; break;
+ }
- // double counting is not ok for efficiency study
+ // todo check if values are not completely off??
- // check if we already counted this particle, this way distinguishes double counted particles (bug/artefact in tracking) or double counted primaries due to secondaries (physics)
- if (foundTracks[label])
+ // particle (primary) already counted?
+ if (!foundPrimaries2[label])
+ {
+ foundPrimaries2[label] = kTRUE;
+ fParticleCorrection[id]->GetTrackCorrection()->FillMeas(vtxMC[2], particle->Eta(), particle->Pt());
+ }
+ }
+ }
+ }
+
+ if (fParticleCorrection[0])
+ {
+ // if the particle decays/stops before this radius we do not see it
+ // 8cm larger than SPD layer 2
+ // 123cm TPC radius where a track has about 50 clusters (cut limit)
+ const Float_t endRadius = (fAnalysisMode == AliPWG0Helper::kSPD) ? 8. : 123;
+
+ // loop over all primaries that have not been found
+ for (Int_t i=0; i<nPrim; i++)
+ {
+ // already found
+ if (foundPrimaries2[i])
+ continue;
+
+ TParticle* particle = 0;
+ TClonesArray* trackrefs = 0;
+ mcEvent->GetParticleAndTR(i, particle, trackrefs);
+
+ // true primary and charged
+ if (!AliPWG0Helper::IsPrimaryCharged(particle, nPrim))
+ continue;
+
+ //skip particles with larger |eta| than 3, to keep the log clean, is anyway not included in correction map
+ if (TMath::Abs(particle->Eta()) > 3)
+ continue;
+
+ // skipping checking of process type of daughter: Neither kPBrem, kPDeltaRay nor kPCerenkov should appear in the event generation
+
+ // get particle type (pion, proton, kaon, other)
+ Int_t id = -1;
+ switch (TMath::Abs(particle->GetPdgCode()))
{
- if (TMath::Abs(eta) < etaRange)
- nESDTracksSpecies[6]++;
+ case 211: id = 4; break;
+ case 321: id = 5; break;
+ case 2212: id = 6; break;
+ default: id = 7; break;
+ }
+
+ if (!fParticleCorrection[id])
+ continue;
+
+ // get last track reference
+ AliTrackReference* trackref = dynamic_cast<AliTrackReference*> (trackrefs->Last());
+
+ if (!trackref)
+ {
+ Printf("ERROR: Could not get trackref of %d (count %d)", i, trackrefs->GetEntries());
+ particle->Print();
continue;
}
- foundTracks[label] = kTRUE;
-
- // particle (primary) already counted?
- if (foundPrimaries[motherLabel])
+
+ // particle in tracking volume long enough...
+ if (trackref->R() > endRadius)
+ continue;
+
+ if (particle->GetLastDaughter() >= 0)
{
- if (TMath::Abs(eta) < etaRange)
- nESDTracksSpecies[5]++;
+ Int_t uID = stack->Particle(particle->GetLastDaughter())->GetUniqueID();
+ //if (uID != kPBrem && uID != kPDeltaRay && uID < kPCerenkov)
+ if (uID == kPDecay)
+ {
+ // decayed
+
+ Printf("Particle %d (%s) decayed at %f, daugher uniqueID: %d:", i, particle->GetName(), trackref->R(), uID);
+ particle->Print();
+ Printf("Daughers:");
+ for (Int_t d = particle->GetFirstDaughter(); d <= particle->GetLastDaughter(); d++)
+ stack->Particle(d)->Print();
+ Printf("");
+
+ fParticleCorrection[id]->GetTrackCorrection()->FillGene(vtxMC[2], particle->Eta(), particle->Pt());
+ continue;
+ }
+ }
+
+ if (trackref->DetectorId() == -1)
+ {
+ // stopped
+ Printf("Particle %d stopped at %f:", i, trackref->R());
+ particle->Print();
+ Printf("");
+
+ fParticleCorrection[id]->GetTrackCorrection()->FillMeas(vtxMC[2], particle->Eta(), particle->Pt());
continue;
}
- foundPrimaries[motherLabel] = kTRUE;
-
- if (fParticleCorrection[id])
- fParticleCorrection[id]->GetTrackCorrection()->FillMeas(vtxMC[2], mother->Eta(), mother->Pt());
+
+ Printf("Particle %d simply not tracked", i);
+ particle->Print();
+ Printf("");
}
}
-
+
delete[] foundTracks;
delete[] foundPrimaries;
+ delete[] foundPrimaries2;
- if ((Int_t) nMCTracks15 > 15 && nESDTracks15 <= 3)
+ if ((Int_t) nMCTracks15 > 10 && nESDTracks15 <= 3)
{
TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
- printf("WARNING: Event %lld %s (vtx-z = %f) has %d generated and %d reconstructed...\n", tree->GetReadEntry(), tree->GetCurrentFile()->GetName(), vtxMC[2], nMCTracks15, nESDTracks15);
+ printf("WARNING: Event %lld %s (vtx-z = %f, recon: %f, contrib: %d, res: %f) has %d generated and %d reconstructed...\n", tree->GetReadEntry(), tree->GetCurrentFile()->GetName(), vtxMC[2], vtx[2], vtxESD->GetNContributors(), vtxESD->GetZRes(), nMCTracks15, nESDTracks15);
}
// fill response matrix using vtxMC (best guess)
- fMultiplicity->FillCorrection(vtxMC[2], nMCTracks05, nMCTracks09, nMCTracks15, nMCTracks20, nMCTracksAll, nESDTracks05, nESDTracks09, nESDTracks15, nESDTracks20);
+ fMultiplicity->FillCorrection(vtxMC[2], nMCTracks05, nMCTracks10, nMCTracks15, nMCTracks20, nMCTracksAll, nESDTracks05, nESDTracks10, nESDTracks15, nESDTracks20);
- fMultiplicity->FillMeasured(vtx[2], nESDTracks05, nESDTracks09, nESDTracks15, nESDTracks20);
+ fMultiplicity->FillMeasured(vtx[2], nESDTracks05, nESDTracks10, nESDTracks15, nESDTracks20);
if (fParticleSpecies)
fParticleSpecies->Fill(vtxMC[2], nMCTracksSpecies[0], nMCTracksSpecies[1], nMCTracksSpecies[2], nMCTracksSpecies[3], nESDTracksSpecies[0], nESDTracksSpecies[1], nESDTracksSpecies[2], nESDTracksSpecies[3], nESDTracksSpecies[4], nESDTracksSpecies[5], nESDTracksSpecies[6]);
}
}
- delete etaArr;
- delete labelArr;
+ if (etaArr)
+ delete[] etaArr;
+ if (labelArr)
+ delete[] labelArr;
}
void AliMultiplicityTask::Terminate(Option_t *)
}
fMultiplicity = dynamic_cast<AliMultiplicityCorrection*> (fOutput->FindObject("Multiplicity"));
- for (Int_t i = 0; i < 4; ++i)
+ for (Int_t i = 0; i < 8; ++i)
fParticleCorrection[i] = dynamic_cast<AliCorrection*> (fOutput->FindObject(Form("correction_%d", i)));
fParticleSpecies = dynamic_cast<TNtuple*> (fOutput->FindObject("fParticleSpecies"));
+
+ fdNdpT = dynamic_cast<TH1*> (fOutput->FindObject("fdNdpT"));
if (!fMultiplicity)
{
TFile* file = TFile::Open("multiplicity.root", "RECREATE");
fMultiplicity->SaveHistograms();
- for (Int_t i = 0; i < 4; ++i)
+ for (Int_t i = 0; i < 8; ++i)
if (fParticleCorrection[i])
fParticleCorrection[i]->SaveHistograms();
if (fParticleSpecies)
fParticleSpecies->Write();
+ if (fdNdpT)
+ fdNdpT->Write();
TObjString option(fOption);
option.Write();
class TNtuple;
class AliCorrection;
class TH1;
+class TH1D;
class AliESDEvent;
class AliMultiplicityTask : public AliAnalysisTask {
virtual void Terminate(Option_t *);
void SetTrackCuts(AliESDtrackCuts* cuts) { fEsdTrackCuts = cuts; }
- void SetPtSpectrum(TH1* hist) { fPtSpectrum = hist; }
+ void SetPtSpectrum(TH1D* hist) { fPtSpectrum = hist; }
void SetAnalysisMode(AliPWG0Helper::AnalysisMode mode) { fAnalysisMode = mode; }
void SetTrigger(AliPWG0Helper::Trigger trigger) { fTrigger = trigger; }
+ void SetDeltaPhiCut(Float_t cut) { fDeltaPhiCut = cut; }
void SetReadMC(Bool_t flag = kTRUE) { fReadMC = flag; }
void SetUseMCVertex(Bool_t flag = kTRUE) { fUseMCVertex = flag; }
TString fOption; // option string
AliPWG0Helper::AnalysisMode fAnalysisMode; // detector that is used for analysis
AliPWG0Helper::Trigger fTrigger; // trigger that is used
+ Float_t fDeltaPhiCut; // cut in delta phi (only SPD)
Bool_t fReadMC; // if true reads MC data (to build correlation maps)
Bool_t fUseMCVertex; // the MC vtx is used instead of the ESD vertex (for syst. check)
AliESDtrackCuts* fEsdTrackCuts; // Object containing the parameters of the esd track cuts
Bool_t fSystSkipParticles; //! if true skips particles (systematic study)
- AliCorrection* fParticleCorrection[4]; //! correction from measured to generated particles for different particles for trigger, vertex sample in |eta| < 2; switch on with particle-efficiency
- // for each of the species: pi, k, p, other; for systematic study of pt cut off
+ AliCorrection* fParticleCorrection[8]; //! correction from measured to generated particles for different particles for trigger, vertex sample in |eta| < 2; switch on with "particle-efficiency"
+ // for each of the species (0..3): pi, k, p, other; for systematic study of pt cut off
+ // 4..7 counts for the same species the decayed particles (in generated) and stopped (in measured)
Int_t fSelectProcessType; //! 0 = all (default), 1 = ND, 2 = SD, 3 = DD (for systematic study)
- TNtuple *fParticleSpecies; //! per event: vtx_mc, (pi, k, p, rest (in |eta| < 2)) X (true, recon) + (nolabel,
+ TNtuple *fParticleSpecies; //! per event: vtx_mc, (pi, k, p, rest (in |eta| < 1)) X (true, recon) + (nolabel,
// doubleTracks, doublePrimaries) [doubleTracks + doublePrimaries are already part of
- // rec. particles!)
+ // rec. particles!); enable with: particle-species
+ TH1* fdNdpT; //! true pT spectrum (MC)
- TH1* fPtSpectrum; //! function that modifies the pt spectrum (syst. study)
+ TH1D* fPtSpectrum; // function that modifies the pt spectrum (syst. study)
TList* fOutput; //! list send on output slot 0
-
+
private:
AliMultiplicityTask(const AliMultiplicityTask&);
AliMultiplicityTask& operator=(const AliMultiplicityTask&);
AliMultiplicityCorrection::SetQualityRegions(kFALSE);
}
+const char* GetMultLabel(Int_t etaR = -1, Bool_t trueM = kTRUE)
+{
+ if (etaR == -1)
+ etaR = etaRange;
+
+ TString tmpStr((trueM) ? "True " : "Measured ");
+
+ if (etaR == 4)
+ {
+ tmpStr += "multiplicity (full phase space)";
+ }
+ else
+ tmpStr += Form("multiplicity in |#eta| < %.1f", (etaR+1)* 0.5);
+ return Form("%s", tmpStr.Data());
+}
+
void draw(const char* fileName = "multiplicity.root", const char* folder = "Multiplicity")
{
loadlibs();
gSystem->Load("libPWG0base");
}
-void correct(const char* fileNameMC = "multiplicityMC.root", const char* folder = "Multiplicity", const char* fileNameESD = "multiplicityESD.root", Bool_t chi2 = kTRUE, Int_t histID = 2, Bool_t fullPhaseSpace = kFALSE, Float_t beta = 1e3, Int_t eventType = 0 /* AliMultiplicityCorrection::kTrVtx */)
+void correct(const char* fileNameMC = "multiplicityMC.root", const char* folder = "Multiplicity", const char* fileNameESD = "multiplicityESD.root", Bool_t chi2 = kFALSE, Int_t histID = 1, Bool_t fullPhaseSpace = kFALSE, Float_t beta = 1e5, Int_t eventType = 0 /* AliMultiplicityCorrection::kTrVtx */, const char* targetFile = "unfolded.root", const char* folderESD = "Multiplicity")
{
loadlibs();
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection(folder, folder);
- TFile::Open(fileNameMC);
- mult->LoadHistograms();
-
- AliMultiplicityCorrection* esd = new AliMultiplicityCorrection(folder, folder);
- TFile::Open(fileNameESD);
- esd->LoadHistograms();
+ AliMultiplicityCorrection* mult = AliMultiplicityCorrection::Open(fileNameMC, folder);
+ AliMultiplicityCorrection* esd = AliMultiplicityCorrection::Open(fileNameESD, folderESD);
TH2F* hist = esd->GetMultiplicityESD(histID);
TH2F* hist2 = esd->GetMultiplicityMC(histID, eventType);
+ TH1* mcCompare = hist2->ProjectionY("mcmchist", 1, hist2->GetNbinsX());
mult->SetMultiplicityESD(histID, hist);
if (chi2)
{
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, beta);
+ mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol0, beta);
//mult->SetCreateBigBin(kFALSE);
//mult->SetRegularizationParameters(AliMultiplicityCorrection::kNone, 0); //mult->SetCreateBigBin(kFALSE);
//mult->SetRegularizationParameters(AliMultiplicityCorrection::kNone, 0, 125); mult->SetCreateBigBin(kFALSE);
- //mult->SetRegularizationParameters(AliMultiplicityCorrection::kEntropy, 1e5);
+ //mult->SetRegularizationParameters(AliMultiplicityCorrection::kEntropy, 1e4);
//mult->SetRegularizationParameters(AliMultiplicityCorrection::kLog, 1e5);
- //mult->ApplyMinuitFit(histID, fullPhaseSpace, AliMultiplicityCorrection::kTrVtx, kTRUE, hist2->ProjectionY("mymchist"));
+
+ //mult->ApplyMinuitFit(histID, fullPhaseSpace, AliMultiplicityCorrection::kTrVtx, kTRUE, mcCompare);
+ //mult->SetMultiplicityESDCorrected(histID, (TH1F*) mcCompare);
+
mult->ApplyMinuitFit(histID, fullPhaseSpace, eventType, kFALSE); //hist2->ProjectionY("mymchist"));
}
else
{
- mult->ApplyBayesianMethod(histID, fullPhaseSpace, eventType, 0.2, 100);
+ mult->ApplyBayesianMethod(histID, fullPhaseSpace, eventType, 1, 10, 0, kTRUE);
}
- TFile* file = TFile::Open("unfolded.root", "RECREATE");
+ mult->SetMultiplicityMC(histID, eventType, hist2);
+
+ Printf("Writing result to %s", targetFile);
+ TFile* file = TFile::Open(targetFile, "RECREATE");
mult->SaveHistograms();
file->Write();
file->Close();
- mult->DrawComparison((chi2) ? "MinuitChi2" : "Bayesian", histID, fullPhaseSpace, kTRUE, hist2->ProjectionY("mymchist"));
+ mult->DrawComparison((chi2) ? "MinuitChi2" : "Bayesian", histID, fullPhaseSpace, kTRUE, mcCompare);
+}
+
+void DrawBayesianIterations(const char* fileNameMC = "multiplicityMC.root", const char* fileNameESD = "multiplicityESD.root", Int_t histID = 1, Int_t eventType = 0 /* AliMultiplicityCorrection::kTrVtx */)
+{
+ loadlibs();
+
+ const char* folder = "Multiplicity";
+
+ AliMultiplicityCorrection* mult = new AliMultiplicityCorrection(folder, folder);
+ TFile::Open(fileNameMC);
+ mult->LoadHistograms();
+
+ AliMultiplicityCorrection* esd = new AliMultiplicityCorrection(folder, folder);
+ TFile::Open(fileNameESD);
+ esd->LoadHistograms();
+
+ TH2F* hist = esd->GetMultiplicityESD(histID);
+ TH2F* hist2 = esd->GetMultiplicityMC(histID, eventType);
+
+ mult->SetMultiplicityESD(histID, hist);
+ mult->SetMultiplicityMC(histID, eventType, hist2);
+
+ TH1* mcCompare = hist2->ProjectionY("mcmchist", 1, hist2->GetNbinsX());
+ //mcCompare->Scale(1.0 / mcCompare->Integral());
+
+ TH1* esdHist = (TH1*) hist->ProjectionY("myesd", 1, 1)->Clone("myesd");
+ //esdHist->Scale(1.0 / esdHist->Integral());
+
+ c = new TCanvas("c", "c", 1200, 600);
+ c->Divide(2, 1);
+
+ c->cd(1);
+ gPad->SetLeftMargin(0.12);
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
+ gPad->SetLogy();
+ gPad->SetGridx();
+ gPad->SetGridy();
+
+ mcCompare->GetXaxis()->SetRangeUser(0, 80);
+ mcCompare->SetStats(0);
+ mcCompare->SetFillColor(5);
+ mcCompare->SetLineColor(5);
+ mcCompare->SetTitle(Form(";%s;Entries", GetMultLabel(1)));
+ mcCompare->GetYaxis()->SetRangeUser(2, esdHist->GetMaximum() * 2);
+ mcCompare->GetYaxis()->SetTitleOffset(1.3);
+ mcCompare->Draw("HIST");
+ esdHist->SetMarkerStyle(5);
+ esdHist->Draw("P HIST SAME");
+
+ c->cd(2);
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
+ gPad->SetGridx();
+ gPad->SetGridy();
+
+ trueMeasuredRatio = (TH1*) mcCompare->Clone("trueMeasuredRatio");
+ trueMeasuredRatio->Divide(esdHist);
+ trueMeasuredRatio->SetStats(0);
+ trueMeasuredRatio->SetTitle(Form(";%s;Ratio", GetMultLabel(1)));
+ trueMeasuredRatio->GetYaxis()->SetTitleOffset(1.3);
+ trueMeasuredRatio->GetYaxis()->SetRangeUser(0, 2);
+ // ROOT displays all values > 2 at 2 which looks weird
+ for (Int_t i=1; i<=trueMeasuredRatio->GetNbinsX(); i++)
+ if (trueMeasuredRatio->GetBinContent(i) > 2)
+ trueMeasuredRatio->SetBinContent(i, 0);
+ trueMeasuredRatio->SetMarkerStyle(5);
+ trueMeasuredRatio->Draw("P");
+
+ Int_t colors[] = {1, 2, 4, 6};
+
+ legend = new TLegend(0.15, 0.13, 0.5, 0.5);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+
+ legend->AddEntry(mcCompare, "True", "F");
+ legend->AddEntry(esdHist, "Measured", "P");
+
+ legend2 = new TLegend(0.15, 0.13, 0.5, 0.4);
+ legend2->SetFillColor(0);
+ legend2->SetTextSize(0.04);
+
+ legend2->AddEntry(trueMeasuredRatio, "Measured", "P");
+
+ Int_t iters[] = {1, 3, 10, -1};
+ for (Int_t i = 0; i<4; i++)
+ {
+ Int_t iter = iters[i];
+ mult->ApplyBayesianMethod(histID, kFALSE, eventType, 1, iter, 0, 0);
+ corr = mult->GetMultiplicityESDCorrected(histID);
+ corr->Scale(1.0 / corr->Integral());
+ corr->Scale(mcCompare->Integral());
+ corr->GetXaxis()->SetRangeUser(0, 80);
+ //corr->SetMarkerStyle(20+iter);
+ corr->SetLineColor(colors[i]);
+ corr->SetLineStyle(i+1);
+ corr->SetLineWidth(2);
+
+ c->cd(1);
+ corr->DrawCopy("SAME HIST");
+
+ c->cd(2);
+ clone = (TH1*) corr->Clone("clone");
+ clone->Divide(mcCompare, corr);
+ clone->GetYaxis()->SetRangeUser(0, 2);
+ clone->DrawCopy("SAME HIST");
+
+ legend->AddEntry((TH1*) corr->Clone(), (iter > -1) ? Form("%d iteration%s", iter, (iter == 1) ? "" : "s") : "Convergence", "L");
+ legend2->AddEntry((TH1*) corr->Clone(), (iter > -1) ? Form("%d iteration%s", iter, (iter == 1) ? "" : "s") : "Convergence", "L");
+ }
+
+ c->cd(1);
+ legend->Draw();
+
+ c->cd(2);
+ legend2->Draw();
+
+ c->SaveAs("bayesian_iterations.eps");
}
void CompareChi2Bayesian(Int_t histID = 2, const char* chi2File = "chi2.root", const char* bayesianFile = "bayesian.root", const char* label1 = "Chi2", const char* label2 = "Bayesian", const char* mcFile = 0, Float_t simpleCorrect = 0)
return 0;
}
-void EvaluateBayesianMethodIterationsSmoothing(const char* fileNameMC = "multiplicityMC.root", const char* fileNameESD = "multiplicityMC.root", const char* targetDir, Int_t histID = 3)
+void EvaluateBayesianMethodIterationsSmoothing(const char* fileNameMC = "multiplicityMC.root", const char* fileNameESD = "multiplicityESD.root", const char* targetDir = "bayesian", Int_t histID = 1)
{
gSystem->mkdir(targetDir);
TFile* graphFile = TFile::Open(Form("%s/EvaluateBayesianMethodIterationsSmoothing.root", targetDir), "RECREATE");
- Int_t colors[3] = {1, 2, 4};
- Int_t markers[20] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 3, 4, 5, 6};
+ Int_t colors[] = {1, 2, 3, 4, 6};
+ Int_t markers[] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 3, 4, 5, 6};
for (AliMultiplicityCorrection::EventType type = AliMultiplicityCorrection::kTrVtx; type <= AliMultiplicityCorrection::kTrVtx; ++type)
//for (AliMultiplicityCorrection::EventType type = AliMultiplicityCorrection::kTrVtx; type <= AliMultiplicityCorrection::kINEL; ++type)
for (Int_t i = 1; i <= 5; i++)
{
- Int_t iterArray[5] = {5, 20, 50, 100, -1};
- //Int_t iter = i * 40 - 20;
+ Int_t iterArray[5] = {2, 5, 10, 20, -1};
Int_t iter = iterArray[i-1];
TGraph* fitResultsMC[3];
for (Int_t region=0; region<AliMultiplicityCorrection::kQualityRegions; ++region)
{
fitResultsMC[region] = new TGraph;
- fitResultsMC[region]->SetTitle(Form("%d iter. - reg. %d", iter, region+1));
+ fitResultsMC[region]->SetTitle(Form("%d iterations - reg. %d", iter, region+1));
fitResultsMC[region]->GetXaxis()->SetTitle("smoothing parameter #alpha");
fitResultsMC[region]->GetYaxis()->SetTitle(Form("P_{1} in region %d", region));
fitResultsMC[region]->SetName(Form("%s_MC_%d", tmp.Data(), i * AliMultiplicityCorrection::kQualityRegions + region - 2));
fitResultsMC[region]->SetFillColor(0);
//fitResultsMC[region]->SetMarkerStyle(markers[(i-1) * AliMultiplicityCorrection::kQualityRegions + region]);
- fitResultsMC[region]->SetMarkerStyle(markers[(i-1)]);
- fitResultsMC[region]->SetLineColor(colors[region]);
+ fitResultsMC[region]->SetMarkerStyle(markers[i-1]);
+ fitResultsMC[region]->SetLineColor(colors[i-1]);
+ fitResultsMC[region]->SetMarkerColor(colors[i-1]);
}
TGraph* fitResultsRes = new TGraph;
fitResultsRes->GetYaxis()->SetTitle("P_{2}");
fitResultsRes->SetFillColor(0);
- fitResultsRes->SetMarkerStyle(19+i);
- fitResultsRes->SetMarkerColor(1);
- fitResultsRes->SetLineColor(1);
+ fitResultsRes->SetMarkerStyle(markers[i-1]);
+ fitResultsRes->SetMarkerColor(colors[i-1]);
+ fitResultsRes->SetLineColor(colors[i-1]);
for (Float_t weight = 0.0; weight < 1.01; weight += 0.2)
{
void EvaluateDrawResultRegions(const char* targetDir, Int_t type = 0)
{
- gSystem->Load("libPWG0base");
+ loadlibs();
TString name;
TFile* graphFile = 0;
graphFile = TFile::Open(Form("%s/EvaluateBayesianMethodIterationsSmoothing.root", targetDir));
}
- TCanvas* canvas = new TCanvas(name, name, 800, 1200);
+ TCanvas* canvas = new TCanvas(name, name, 1200, 800);
//canvas->Divide(1, AliMultiplicityCorrection::kQualityRegions, 0, 0);
+ canvas->SetTopMargin(0);
+ canvas->SetBottomMargin(0);
+ canvas->SetRightMargin(0.05);
canvas->Range(0, 0, 1, 1);
- TPad* pad[3];
- pad[0] = new TPad(Form("%s_pad1", name.Data()), "", 0.02, 0.05, 0.98, 0.35);
- pad[1] = new TPad(Form("%s_pad2", name.Data()), "", 0.02, 0.35, 0.98, 0.65);
- pad[2] = new TPad(Form("%s_pad3", name.Data()), "", 0.02, 0.65, 0.98, 0.95);
+ TPad* pad[4];
+ pad[3] = new TPad(Form("%s_pad1", name.Data()), "", 0, 0, 0.5, 0.5); pad[3]->SetTopMargin(0); pad[3]->SetBottomMargin(0.15);
+ pad[1] = new TPad(Form("%s_pad2", name.Data()), "", 0, 0.5, 0.5, 1); pad[1]->SetBottomMargin(0);
+ pad[0] = new TPad(Form("%s_pad3", name.Data()), "", 0.5, 0, 1, 0.5); pad[0]->SetTopMargin(0); pad[0]->SetBottomMargin(0.15);
+ pad[2] = new TPad(Form("%s_pad4", name.Data()), "", 0.5, 0.5, 1, 1); pad[2]->SetBottomMargin(0);
Float_t yMinRegion[3];
for (Int_t i=0; i<AliMultiplicityCorrection::kQualityRegions; ++i)
yMinRegion[i] = 1e20;
- for (Int_t region = 1; region <= AliMultiplicityCorrection::kQualityRegions; region++)
+ for (Int_t region = 0; region <= AliMultiplicityCorrection::kQualityRegions; region++)
{
canvas->cd();
- pad[region-1]->Draw();
- pad[region-1]->cd();
- pad[region-1]->SetRightMargin(0.05);
-
- if (region != 1)
- pad[region-1]->SetBottomMargin(0);
- if (region != AliMultiplicityCorrection::kQualityRegions)
- pad[region-1]->SetTopMargin(0);
-
+ pad[region]->Draw();
+ pad[region]->cd();
+ pad[region]->SetRightMargin(0.05);
+
if (type == -1)
{
- pad[region-1]->SetLogx();
- pad[region-1]->SetLogy();
+ pad[region]->SetLogx();
}
- pad[region-1]->SetTopMargin(0.05);
- pad[region-1]->SetGridx();
- pad[region-1]->SetGridy();
+ pad[region]->SetLogy();
+
+ pad[region]->SetGridx();
+ pad[region]->SetGridy();
- TLegend* legend = new TLegend(0.8, 0.15, 0.98, 0.98);
+ TLegend* legend = new TLegend(0.5, 0.4, 0.85, 0.85);
legend->SetFillColor(0);
-
+ //legend->SetNColumns(3);
+ legend->SetTextSize(0.06);
Int_t count = 0;
Float_t xMin = 1e20;
{
count++;
- TGraph* mc = (TGraph*) graphFile->Get(Form("%s_MC_%d", name.Data(), count));
- if (!mc)
- break;
-
- if (TString(mc->GetTitle()).Contains(Form("reg. %d", region)) == kFALSE)
- continue;
+ if (region > 0)
+ {
+ TGraph* mc = (TGraph*) graphFile->Get(Form("%s_MC_%d", name.Data(), count));
+ if (!mc)
+ break;
+
+ if (TString(mc->GetTitle()).Contains(Form("reg. %d", region)) == kFALSE)
+ continue;
+
+ for (Int_t i=0; i<mc->GetN(); ++i)
+ yMinRegion[(count-1) % 3] = TMath::Min(yMinRegion[(count-1) % 3], mc->GetY()[i]);
+ }
+ else
+ {
+ TGraph* mc = (TGraph*) graphFile->Get(Form("%s_Res_%d", name.Data(), count));
+ if (!mc)
+ break;
+ }
xaxis = mc->GetXaxis()->GetTitle();
yaxis = mc->GetYaxis()->GetTitle();
- mc->Print();
+ //mc->Print();
xMin = TMath::Min(xMin, mc->GetXaxis()->GetXmin());
- yMin = TMath::Min(yMin, mc->GetYaxis()->GetXmin());
+ yMin = TMath::Min(yMin, TMath::MinElement(mc->GetN(), mc->GetY()));
xMax = TMath::Max(xMax, mc->GetXaxis()->GetXmax());
yMax = TMath::Max(yMax, mc->GetYaxis()->GetXmax());
-
- for (Int_t i=0; i<mc->GetN(); ++i)
- yMinRegion[(count-1) % 3] = TMath::Min(yMinRegion[(count-1) % 3], mc->GetY()[i]);
+
+ //Printf("%f %f %f %f", xMin, xMax, yMin, yMax);
}
if (type >= 0)
{
- xaxis = "smoothing parameter";
+ xaxis = "Smoothing parameter #alpha";
}
else if (type == -1)
{
- xaxis = "weight parameter";
- xMax *= 5;
+ xaxis = "Weight parameter #beta";
+ //xMax *= 5;
+ }
+ if (region > 0)
+ {
+ yaxis = Form("Q_{1} in region %d ", region); // (2 <= t <= 150)";
}
- yaxis = "P_{1}"; // (2 <= t <= 150)";
+ else
+ yaxis = "Q_{2} ";
printf("%f %f %f %f\n", xMin, xMax, yMin, yMax);
- TGraph* dummy = new TGraph;
- dummy->SetPoint(0, xMin, yMin);
- dummy->SetPoint(1, xMax, yMax);
+ if (region > 0)
+ {
+ if (type == -1)
+ {
+ yMin = 0.534622;
+ yMax = 19.228941;
+ }
+ else
+ {
+ yMin = 0.759109;
+ yMax = 10;
+ }
+ }
+
+ if (type != -1)
+ xMax = 1.0;
+
+ TH1* dummy = new TH2F("dummy", "dummy", 100, xMin, xMax, 100, yMin * 0.9, yMax * 1.1);
dummy->SetTitle(Form(";%s;%s", xaxis.Data(), yaxis.Data()));
- dummy->SetMarkerColor(0);
- dummy->Draw("AP");
- dummy->GetYaxis()->SetMoreLogLabels(1);
+ if (region == 0 && type != -1)
+ dummy->GetYaxis()->SetMoreLogLabels(1);
+ dummy->SetLabelSize(0.06, "xy");
+ dummy->SetTitleSize(0.06, "xy");
+ dummy->GetXaxis()->SetTitleOffset(1.2);
+ dummy->GetYaxis()->SetTitleOffset(0.8);
+ dummy->SetStats(0);
+
+ dummy->DrawCopy();
+
count = 0;
{
count++;
- TGraph* mc = (TGraph*) graphFile->Get(Form("%s_MC_%d", name.Data(), count));
+ if (region > 0)
+ {
+ TGraph* mc = (TGraph*) graphFile->Get(Form("%s_MC_%d", name.Data(), count));
+ if (mc && TString(mc->GetTitle()).Contains(Form("reg. %d", region)) == kFALSE)
+ continue;
+ }
+ else
+ TGraph* mc = (TGraph*) graphFile->Get(Form("%s_Res_%d", name.Data(), count));
+
if (!mc)
break;
- if (TString(mc->GetTitle()).Contains(Form("reg. %d", region)) == kFALSE)
- continue;
-
- printf("Loaded %d sucessful.\n", count);
+ //printf("Loaded %d sucessful.\n", count);
if (type == -1)
{
- legend->AddEntry(mc, Form("Eq. (%d) - reg. %d", 10 + (count-1) / 3, 1+ (count-1) % 3));
+ //legend->AddEntry(mc, Form("Eq. (%d) - reg. %d", 10 + (count-1) / 3, 1+ (count-1) % 3));
+ //legend->AddEntry(mc, Form("Eq. (7.%d)", 11 + (count-1) / 3));
+ const char* names[] = { "Const", "Linear", "Log" };
+ legend->AddEntry(mc, names[(count-1) / 3], "PL");
}
else
- legend->AddEntry(mc);
+ {
+ TString label(mc->GetTitle());
+ TString newLabel(label(0, label.Index(" ")));
+ //Printf("%s", newLabel.Data());
+ if (newLabel.Atoi() == -1)
+ {
+ newLabel = "Convergence";
+ }
+ else
+ newLabel = label(0, label.Index("iterations") + 10);
+
+ legend->AddEntry(mc, newLabel, "PL");
+ }
mc->Draw("SAME PC");
- }
+ }
- legend->Draw();
+ if (region == 2)
+ legend->Draw();
}
for (Int_t i=0; i<AliMultiplicityCorrection::kQualityRegions; ++i)
canvas->SaveAs(Form("%s/%s.eps", targetDir, canvas->GetName()));
}
-void EvaluateChi2Method(const char* fileNameMC = "multiplicityMC_2M.root", const char* fileNameESD = "multiplicityMC_1M_3.root", const char* targetDir, Int_t histID = 3)
+void EvaluateChi2Method(const char* fileNameMC = "multiplicityMC.root", const char* fileNameESD = "multiplicityESD.root", const char* targetDir = "chi2compare", Int_t histID = 1)
{
gSystem->mkdir(targetDir);
mult->SetMultiplicityESD(histID, hist);
Int_t count = 0; // just to order the saved images...
- Int_t colors[3] = {1, 2, 4};
- Int_t markers[12] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 3};
+ Int_t colors[] = {1, 2, 4, 3};
+ Int_t markers[] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 3};
TGraph* fitResultsRes = 0;
TFile* graphFile = TFile::Open(Form("%s/EvaluateChi2Method.root", targetDir), "RECREATE");
- for (AliMultiplicityCorrection::RegularizationType type = AliMultiplicityCorrection::kPol0; type <= AliMultiplicityCorrection::kEntropy; ++type)
-// for (AliMultiplicityCorrection::RegularizationType type = AliMultiplicityCorrection::kEntropy; type <= AliMultiplicityCorrection::kEntropy; ++type)
- //for (AliMultiplicityCorrection::RegularizationType type = AliMultiplicityCorrection::kPol1; type <= AliMultiplicityCorrection::kPol1; ++type)
+ //for (AliMultiplicityCorrection::RegularizationType type = AliMultiplicityCorrection::kPol0; type <= AliMultiplicityCorrection::kLog; ++type)
+ //for (AliMultiplicityCorrection::RegularizationType type = AliMultiplicityCorrection::kEntropy; type <= AliMultiplicityCorrection::kEntropy; ++type)
+ for (AliMultiplicityCorrection::RegularizationType type = AliMultiplicityCorrection::kPol1; type <= AliMultiplicityCorrection::kPol1; ++type)
{
TGraph* fitResultsMC[3];
for (Int_t region=0; region<AliMultiplicityCorrection::kQualityRegions; ++region)
fitResultsMC[region]->GetYaxis()->SetTitle(Form("P_{1} in region %d", region));
fitResultsMC[region]->SetName(Form("EvaluateChi2Method_MC_%d", type * AliMultiplicityCorrection::kQualityRegions + region - 2));
fitResultsMC[region]->SetFillColor(0);
- fitResultsMC[region]->SetMarkerStyle(markers[(type-1) * AliMultiplicityCorrection::kQualityRegions + region]);
- fitResultsMC[region]->SetLineColor(colors[region]);
+ //fitResultsMC[region]->SetMarkerStyle(markers[(type-1) * AliMultiplicityCorrection::kQualityRegions + region]);
+ //fitResultsMC[region]->SetLineColor(colors[region]);
+ fitResultsMC[region]->SetMarkerStyle(markers[type-1]);
+ fitResultsMC[region]->SetMarkerColor(colors[type-1]);
+ fitResultsMC[region]->SetLineColor(colors[type-1]);
}
fitResultsRes = new TGraph;
fitResultsRes->GetXaxis()->SetTitle("Weight Parameter");
fitResultsRes->SetFillColor(0);
- fitResultsRes->SetMarkerStyle(23+type);
- fitResultsRes->SetMarkerColor(kRed);
- fitResultsRes->SetLineColor(kRed);
+ fitResultsRes->SetMarkerStyle(markers[type-1]);
+ fitResultsRes->SetMarkerColor(colors[type-1]);
+ fitResultsRes->SetLineColor(colors[type-1]);
- for (Int_t i=0; i<7; ++i)
+ for (Int_t i=0; i<15; ++i)
{
- Float_t weight = TMath::Power(TMath::Sqrt(10), i+6);
+ Float_t weight = TMath::Power(TMath::Sqrt(10), i+1);
//Float_t weight = TMath::Power(10, i+2);
//if (type == AliMultiplicityCorrection::kEntropy) weight = 1e4 * (i+1) * 1.5;
mult->SetRegularizationParameters(type, weight);
Int_t status = mult->ApplyMinuitFit(histID, kFALSE, AliMultiplicityCorrection::kTrVtx);
- mult->DrawComparison(Form("%s/%s", targetDir, runName.Data()), histID, kFALSE, kTRUE, hist2->ProjectionY());
+ mult->DrawComparison(Form("%s/%s", targetDir, runName.Data()), histID, kFALSE, kTRUE, hist2->ProjectionY("mymc", 1, hist2->GetNbinsX()));
if (status != 0)
{
printf("MINUIT did not succeed. Skipping...\n");
file->Close();
}
-void StartingConditions(const char* fileNameMC = "multiplicityMC_2M.root", Int_t histID = 3)
+void StartingConditions(const char* fileNameMC = "multiplicityMC.root", Int_t histID = 1)
{
- gSystem->Load("libPWG0base");
+ loadlibs();
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
TFile::Open(fileNameMC);
mult->LoadHistograms("Multiplicity");
- const char* files[] = { "multiplicityMC_1M_3.root", "multiplicityMC_100k_1.root", "multiplicityMC_100k_2.root", "multiplicityMC_100k_3.root", "multiplicityMC_100k_4.root" }
+ const char* files[] = { "multiplicityESD.root", "multiplicityESD_100k_1.root", "multiplicityESD_100k_2.root", "multiplicityESD_100k_1.root", "multiplicityESD_100k_2.root" }
// this one we try to unfold
TFile::Open(files[0]);
AliMultiplicityCorrection* multESD = new AliMultiplicityCorrection("MultiplicityESD", "MultiplicityESD");
multESD->LoadHistograms("Multiplicity");
mult->SetMultiplicityESD(histID, multESD->GetMultiplicityESD(histID));
- TH1* mc = multESD->GetMultiplicityMC(histID, AliMultiplicityCorrection::kTrVtx)->ProjectionY("mc");
+ TH1* mc = multESD->GetMultiplicityMC(histID, AliMultiplicityCorrection::kTrVtx)->ProjectionY("mc", 1, 1);
TGraph* fitResultsChi2 = new TGraph;
fitResultsChi2->SetTitle(";Input Dist ID;Chi2");
}
else if (i == 6)
{
- func = new TF1("nbd", "[0] * TMath::Binomial([2]+TMath::Nint(x)-1, [2]-1) * pow([1] / ([1]+[2]), TMath::Nint(x)) * pow(1 + [1]/[2], -[2])", 0, 50);
+ func = new TF1("nbd", "exp(log([0]) + TMath::LnGamma([2]+x) - TMath::LnGamma([2]) - TMath::LnGamma(x+1) + log([1] / ([1]+[2])) * x + log(1.0 + [1]/[2]) * -[2])", 0, 50);
+
func->SetParNames("scaling", "averagen", "k");
func->SetParLimits(0, 1e-3, 1e10);
func->SetParLimits(1, 0.001, 1000);
startCond->SetBinContent(j, 1);
}
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
+ mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol0, 1e5);
mult->ApplyMinuitFit(histID, kFALSE, AliMultiplicityCorrection::kTrVtx, kFALSE, startCond);
- mult->DrawComparison(Form("StartingConditions_%d_MinuitChi2", i), histID, kFALSE, kTRUE, mc);
+ //mult->DrawComparison(Form("StartingConditions_%d_MinuitChi2", i), histID, kFALSE, kTRUE, mc);
Float_t chi2MC = 0;
Int_t chi2MCLimit = 0;
if (!firstChi)
firstChi = (TH1*) chi2Result->Clone("firstChi");
- mult->ApplyBayesianMethod(histID, kFALSE, AliMultiplicityCorrection::kTrVtx, 1, 100, startCond);
- mult->DrawComparison(Form("StartingConditions_%d_Bayesian", i), histID, kFALSE, kTRUE, mc);
+ mult->ApplyBayesianMethod(histID, kFALSE, AliMultiplicityCorrection::kTrVtx, 1, 10, startCond);
+ //mult->DrawComparison(Form("StartingConditions_%d_Bayesian", i), histID, kFALSE, kTRUE, mc);
TH1* bayesResult = (TH1*) mult->GetMultiplicityESDCorrected(histID)->Clone(Form("bayesResult_%d", i));
if (!firstBayesian)
firstBayesian = (TH1*) bayesResult->Clone("firstBayesian");
canvas3->SaveAs(Form("%s.gif", canvas3->GetName()));
}
-void DifferentSamples(const char* fileNameMC = "multiplicityMC_2M.root", Int_t histID = 3)
-{
- gSystem->Load("libPWG0base");
-
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
-
- TFile::Open(fileNameMC);
- mult->LoadHistograms("Multiplicity");
-
- const char* files[] = { "multiplicityMC_100k_1.root", "multiplicityMC_100k_2.root", "multiplicityMC_100k_3.root", "multiplicityMC_100k_4.root", "multiplicityMC_100k_5.root", "multiplicityMC_100k_6.root", "multiplicityMC_100k_7.root", "multiplicityMC_100k_8.root" };
-
- TGraph* fitResultsChi2 = new TGraph;
- fitResultsChi2->SetTitle(";Input Dist ID;Chi2");
- TGraph* fitResultsBayes = new TGraph;
- fitResultsBayes->SetTitle(";Input Dist ID;Chi2");
- TGraph* fitResultsChi2Limit = new TGraph;
- fitResultsChi2Limit->SetTitle(";Input Dist ID;Multiplicity reach");
- TGraph* fitResultsBayesLimit = new TGraph;
- fitResultsBayesLimit->SetTitle(";Input Dist ID;Multiplicity reach");
-
- TCanvas* canvasA = new TCanvas("DifferentSamplesA", "DifferentSamplesA", 1200, 600);
- canvasA->Divide(4, 2);
-
- TCanvas* canvasB = new TCanvas("DifferentSamplesB", "DifferentSamplesB", 1200, 600);
- canvasB->Divide(4, 2);
-
- TCanvas* canvas4 = new TCanvas("DifferentSamples4", "DifferentSamples4", 1000, 400);
- canvas4->Divide(2, 1);
-
- TCanvas* canvas3 = new TCanvas("DifferentSamples3", "DifferentSamples3", 1000, 400);
- canvas3->Divide(2, 1);
-
- Float_t min = 1e10;
- Float_t max = 0;
-
- TH1* firstChi = 0;
- TH1* firstBayesian = 0;
-
- TLegend* legend = new TLegend(0.7, 0.7, 1, 1);
-
- TFile* file = TFile::Open("DifferentSamples.root", "RECREATE");
- file->Close();
-
- for (Int_t i=0; i<8; ++i)
- {
- TFile::Open(files[i]);
- AliMultiplicityCorrection* multESD = new AliMultiplicityCorrection("MultiplicityESD2", "MultiplicityESD2");
- multESD->LoadHistograms("Multiplicity");
- mult->SetMultiplicityESD(histID, multESD->GetMultiplicityESD(histID));
- TH1* mc = multESD->GetMultiplicityMC(histID, AliMultiplicityCorrection::kTrVtx)->ProjectionY(Form("mc_%d", i));
- mc->Sumw2();
-
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
- mult->ApplyMinuitFit(histID, kFALSE, AliMultiplicityCorrection::kTrVtx, kFALSE);
- mult->DrawComparison(Form("DifferentSamples_%d_MinuitChi2", i), histID, kFALSE, kTRUE, mc);
-
- Float_t chi2MC = 0;
- Int_t chi2MCLimit = 0;
- mult->GetComparisonResults(&chi2MC, &chi2MCLimit, 0);
- fitResultsChi2->SetPoint(fitResultsChi2->GetN(), i, chi2MC);
- fitResultsChi2Limit->SetPoint(fitResultsChi2Limit->GetN(), i, chi2MCLimit);
- min = TMath::Min(min, chi2MC);
- max = TMath::Max(max, chi2MC);
-
- TH1* chi2Result = (TH1*) mult->GetMultiplicityESDCorrected(histID)->Clone(Form("chi2Result_%d", i));
- if (!firstChi)
- firstChi = (TH1*) chi2Result->Clone("firstChi");
-
- mult->ApplyBayesianMethod(histID, kFALSE, AliMultiplicityCorrection::kTrVtx, 1, 100);
- mult->DrawComparison(Form("DifferentSamples_%d_Bayesian", i), histID, kFALSE, kTRUE, mc);
- TH1* bayesResult = (TH1*) mult->GetMultiplicityESDCorrected(histID)->Clone(Form("bayesResult_%d", i));
- if (!firstBayesian)
- firstBayesian = (TH1*) bayesResult->Clone("firstBayesian");
-
- TFile* file = TFile::Open("DifferentSamples.root", "UPDATE");
- mc->Write();
- chi2Result->Write();
- bayesResult->Write();
- file->Close();
-
- mult->GetComparisonResults(&chi2MC, &chi2MCLimit, 0);
- fitResultsBayes->SetPoint(fitResultsBayes->GetN(), i, chi2MC);
- fitResultsBayesLimit->SetPoint(fitResultsBayesLimit->GetN(), i, chi2MCLimit);
-
- min = TMath::Min(min, chi2MC);
- max = TMath::Max(max, chi2MC);
- mc->GetXaxis()->SetRangeUser(0, 150);
- chi2Result->GetXaxis()->SetRangeUser(0, 150);
-
- // skip errors for now
- for (Int_t j=0; j<=chi2Result->GetNbinsX(); ++j)
- {
- chi2Result->SetBinError(j, 0);
- bayesResult->SetBinError(j, 0);
- }
-
- canvas4->cd(1);
- TH1* tmp = (TH1*) chi2Result->Clone("tmp");
- tmp->SetTitle("Unfolded/MC;Npart;Ratio");
- tmp->Divide(mc);
- tmp->GetYaxis()->SetRangeUser(0.5, 1.5);
- tmp->GetXaxis()->SetRangeUser(0, 200);
- tmp->SetLineColor(i+1);
- tmp->DrawCopy((i > 0) ? "SAME HIST" : "HIST");
-
- canvas4->cd(2);
- tmp = (TH1*) bayesResult->Clone("tmp");
- tmp->SetTitle("Unfolded/MC;Npart;Ratio");
- tmp->Divide(mc);
- tmp->SetLineColor(i+1);
- tmp->GetYaxis()->SetRangeUser(0.5, 1.5);
- tmp->GetXaxis()->SetRangeUser(0, 200);
- tmp->DrawCopy((i > 0) ? "SAME HIST" : "HIST");
-
- canvas3->cd(1);
- TH1* tmp = (TH1*) chi2Result->Clone("tmp");
- tmp->SetTitle("Ratio to first result;Npart;Ratio");
- tmp->Divide(firstChi);
- tmp->GetYaxis()->SetRangeUser(0.5, 1.5);
- tmp->GetXaxis()->SetRangeUser(0, 200);
- tmp->SetLineColor(i+1);
- legend->AddEntry(tmp, Form("%d", i));
- tmp->DrawCopy((i > 0) ? "SAME HIST" : "HIST");
-
- canvas3->cd(2);
- tmp = (TH1*) bayesResult->Clone("tmp");
- tmp->SetTitle("Ratio to first result;Npart;Ratio");
- tmp->Divide(firstBayesian);
- tmp->SetLineColor(i+1);
- tmp->GetYaxis()->SetRangeUser(0.5, 1.5);
- tmp->GetXaxis()->SetRangeUser(0, 200);
- tmp->DrawCopy((i > 0) ? "SAME HIST" : "HIST");
-
- if (i < 4)
- {
- canvasA->cd(i+1);
- }
- else
- canvasB->cd(i+1-4);
-
- mc->SetFillColor(kYellow);
- mc->DrawCopy();
- chi2Result->SetLineColor(kRed);
- chi2Result->DrawCopy("SAME");
- bayesResult->SetLineColor(kBlue);
- bayesResult->DrawCopy("SAME");
- gPad->SetLogy();
-
- if (i < 4)
- {
- canvasA->cd(i+5);
- }
- else
- canvasB->cd(i+5-4);
-
- chi2Result->Divide(chi2Result, mc, 1, 1, "B");
- bayesResult->Divide(bayesResult, mc, 1, 1, "B");
-
- // skip errors for now
- for (Int_t j=0; j<=chi2Result->GetNbinsX(); ++j)
- {
- chi2Result->SetBinError(j, 0);
- bayesResult->SetBinError(j, 0);
- }
-
- chi2Result->SetTitle("Ratios;Npart;unfolded measured/MC");
- chi2Result->GetYaxis()->SetRangeUser(0.5, 1.5);
-
- chi2Result->DrawCopy("");
- bayesResult->DrawCopy("SAME");
- }
-
- canvas3->cd(1);
- legend->Draw();
-
- canvasA->SaveAs(Form("%s.gif", canvasA->GetName()));
- canvasB->SaveAs(Form("%s.gif", canvasB->GetName()));
-
- TCanvas* canvas2 = new TCanvas("DifferentSamples2", "DifferentSamples2", 800, 400);
- canvas2->Divide(2, 1);
-
- canvas2->cd(1);
- fitResultsChi2->SetMarkerStyle(20);
- fitResultsChi2->GetYaxis()->SetRangeUser(0.5 * min, 1.5 * max);
- fitResultsChi2->Draw("AP");
-
- fitResultsBayes->SetMarkerStyle(3);
- fitResultsBayes->SetMarkerColor(2);
- fitResultsBayes->Draw("P SAME");
-
- gPad->SetLogy();
-
- canvas2->cd(2);
- fitResultsChi2Limit->SetMarkerStyle(20);
- fitResultsChi2Limit->GetYaxis()->SetRangeUser(0.9 * TMath::Min(fitResultsChi2Limit->GetYaxis()->GetXmin(), fitResultsBayesLimit->GetYaxis()->GetXmin()), 1.1 * TMath::Max(fitResultsChi2Limit->GetYaxis()->GetXmax(), fitResultsBayesLimit->GetYaxis()->GetXmax()));
- fitResultsChi2Limit->Draw("AP");
-
- fitResultsBayesLimit->SetMarkerStyle(3);
- fitResultsBayesLimit->SetMarkerColor(2);
- fitResultsBayesLimit->Draw("P SAME");
-
- canvas2->SaveAs(Form("%s.gif", canvas2->GetName()));
- canvas3->SaveAs(Form("%s.gif", canvas3->GetName()));
- canvas4->SaveAs(Form("%s.gif", canvas4->GetName()));
-}
-
void Merge(Int_t n, const char** files, const char* output)
{
// const char* files[] = { "multiplicityMC_100k_1.root", "multiplicityMC_100k_2.root", "multiplicityMC_100k_3.root", "multiplicityMC_100k_4.root", "multiplicityMC_100k_5.root", "multiplicityMC_100k_6.root", "multiplicityMC_100k_7.root", "multiplicityMC_100k_8.root" };
void testMethod(Int_t caseNo, const char* fileName = "multiplicityMC.root")
{
- gSystem->Load("libPWG0base");
+ loadlibs();
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
if (caseNo >= 4)
{
- func = new TF1("nbd", "[0] * TMath::Binomial([2]+TMath::Nint(x)-1, [2]-1) * pow([1] / ([1]+[2]), TMath::Nint(x)) * pow(1 + [1]/[2], -[2])", 0, 500);
+ TF1* func = new TF1("nbd", "exp(log([0]) + TMath::LnGamma([2]+x) - TMath::LnGamma([2]) - TMath::LnGamma(x+1) + log([1] / ([1]+[2])) * x + log(1.0 + [1]/[2]) * -[2])", 0, 200);
+ //func = new TF1("nbd", "[0] * TMath::Binomial([2]+TMath::Nint(x)-1, [2]-1) * pow([1] / ([1]+[2]), TMath::Nint(x)) * pow(1 + [1]/[2], -[2])", 0, 200);
func->SetParNames("scaling", "averagen", "k");
}
case 1: func = new TF1("flat", "501-x"); break;
case 2: func = new TF1("flat", "1000 * 1/(x+1)"); break;
case 3: func = new TF1("flat", "1000 * TMath::Landau(x, 10, 5)"); break;
- case 4: func->SetParameters(1e7, 10, 2); break;
+ case 4: func->SetParameters(2e5, 15, 2); break;
case 5: func->SetParameters(1, 13, 7); break;
case 6: func->SetParameters(1e7, 30, 4); break;
case 7: func->SetParameters(1e7, 30, 2); break; // ***
new TCanvas;
func->Draw();
- mult->SetGenMeasFromFunc(func, 3);
+ mult->SetGenMeasFromFunc(func, 1);
TFile::Open("out.root", "RECREATE");
mult->SaveHistograms();
- new TCanvas; mult->GetMultiplicityESD(3)->ProjectionY()->DrawCopy();
- new TCanvas; mult->GetMultiplicityVtx(3)->ProjectionY()->DrawCopy();
+ new TCanvas; mult->GetMultiplicityESD(1)->ProjectionY()->DrawCopy();
+ new TCanvas; mult->GetMultiplicityVtx(1)->ProjectionY("mc", 1, mult->GetMultiplicityVtx(1)->GetNbinsX())->DrawCopy();
//mult->ApplyBayesianMethod(2, kFALSE);
//mult->ApplyMinuitFit(2, kFALSE);
{
//
// builds several response matrices with different particle ratios (systematic study)
- //
+ //
+ // WARNING doesn't work uncompiled, see test.C
- gSystem->Load("libPWG0base");
+ loadlibs();
TFile::Open(fileName);
TNtuple* fParticleSpecies = (TNtuple*) gFile->Get("fParticleSpecies");
Int_t secondaries = 0;
Int_t doubleCount = 0;
- for (Int_t num = 0; num < 7; num++)
+ for (Int_t num = 0; num < 9; num++)
{
- AliMultiplicityCorrection* fMultiplicity = new AliMultiplicityCorrection(Form("Multiplicity_%d", num), Form("Multiplicity_%d", num));
+ TString name;
+ name.Form("Multiplicity_%d", num);
+ AliMultiplicityCorrection* fMultiplicity = new AliMultiplicityCorrection(name, name);
Float_t ratio[4]; // pi, K, p, other
for (Int_t i = 0; i < 4; i++)
switch (num)
{
case 1 : ratio[1] = 0.5; break;
- case 2 : ratio[2] = 0.5; break;
- case 3 : ratio[1] = 1.5; break;
+ case 2 : ratio[1] = 1.5; break;
+ case 3 : ratio[2] = 0.5; break;
case 4 : ratio[2] = 1.5; break;
case 5 : ratio[1] = 0.5; ratio[2] = 0.5; break;
case 6 : ratio[1] = 1.5; ratio[2] = 1.5; break;
+ case 7 : ratio[1] = 0.5; ratio[2] = 1.5; break;
+ case 8 : ratio[1] = 1.5; ratio[2] = 0.5; break;
}
for (Int_t i=0; i<fParticleSpecies->GetEntries(); i++)
//Printf("%.f %.f %.f %.f %.f", f[5], f[6], f[7], f[8], f[9]);
fMultiplicity->FillCorrection(f[0], gene, gene, gene, gene, 0, meas, meas, meas, meas);
- fMultiplicity->FillGenerated(f[0], kTRUE, kTRUE, gene, gene, gene, gene, 0);
+ // HACK all as kND = 1
+ fMultiplicity->FillGenerated(f[0], kTRUE, kTRUE, 1, gene, gene, gene, gene, 0);
fMultiplicity->FillMeasured(f[0], meas, meas, meas, meas);
}
}
}
-void MergeModifyCrossSection(const char* output)
+void ParticleRatioStudy()
{
- const char* files[] = { "multiplicityMC_400k_syst_nd.root", "multiplicityMC_400k_syst_sd.root", "multiplicityMC_400k_syst_dd.root" };
+ loadlibs();
- gSystem->Load("libPWG0base");
+ for (Int_t num = 0; num < 9; num++)
+ {
+ TString target;
+ target.Form("chi2_species_%d.root", num);
+ correct("species.root", Form("Multiplicity_%d", num), "species.root", 1, 1, 0, 1e5, 0, target, "Multiplicity_0");
+ }
+}
+
+void MergeModifyCrossSection(const char* output = "multiplicityMC_xsection.root")
+{
+ const char* files[] = { "multiplicityMC_nd.root", "multiplicityMC_sd.root", "multiplicityMC_dd.root" };
+
+ loadlibs();
TFile::Open(output, "RECREATE");
gFile->Close();
- for (Int_t num=0; num<7; ++num)
+ for (Int_t num = 0; num < 7; num++)
{
AliMultiplicityCorrection* data[3];
TList list;
data[i]->GetMultiplicityVtx(j)->Scale(ratio[i]);
data[i]->GetMultiplicityMB(j)->Scale(ratio[i]);
data[i]->GetMultiplicityINEL(j)->Scale(ratio[i]);
+ data[i]->GetMultiplicityNSD(j)->Scale(ratio[i]);
}
for (Int_t j=0; j<AliMultiplicityCorrection::kESDHists; j++)
#endif
-const char* correctionFile = "multiplicity.root";
-const char* measuredFile = "multiplicityMC_1M_3.root";
-Int_t etaRange = 2;
-Int_t displayRange = 200; // axis range
+const char* correctionFile = "multiplicityMC.root";
+const char* measuredFile = "multiplicityESD.root";
+Int_t etaRange = 1;
+Int_t displayRange = 80; // axis range
Int_t ratioRange = 151; // range to calculate difference
-Int_t longDisplayRange = 200;
+Int_t longDisplayRange = 120;
const char* correctionFileTPC = "multiplicityMC_TPC_1.4M.root";
const char* measuredFileTPC = "multiplicityMC_TPC_0.6M.root";
longDisplayRange = 100;
}
+const char* GetMultLabel(Int_t etaR = -1, Bool_t trueM = kTRUE)
+{
+ if (etaR == -1)
+ etaR = etaRange;
+
+ TString tmpStr((trueM) ? "True " : "Measured ");
+
+ tmpStr += "multiplicity";
+ //return Form("%s", tmpStr.Data());
+
+ if (etaR == 4)
+ {
+ tmpStr += " (full phase space)";
+ }
+ else
+ tmpStr += Form(" in |#eta| < %.1f", (etaR+1)* 0.5);
+ return Form("%s", tmpStr.Data());
+}
+
void Smooth(TH1* hist, Int_t windowWidth = 20)
{
TH1* clone = (TH1*) hist->Clone("clone");
delete clone;
}
-void responseMatrixPlot()
+void responseMatrixPlot(const char* fileName = 0)
{
- gSystem->Load("libPWG0base");
+ loadlibs();
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
- TFile::Open(correctionFile);
+ if (fileName == 0)
+ fileName = correctionFile;
+
+ TFile::Open(fileName);
mult->LoadHistograms("Multiplicity");
- TH1* hist = mult->GetCorrelation(etaRange)->Project3D("zy");
+ // empty under/overflow bins in x, otherwise Project3D takes them into account
+ TH1* hist = mult->GetCorrelation(etaRange);
+ for (Int_t y=0; y<=hist->GetYaxis()->GetNbins()+1; ++y)
+ {
+ for (Int_t z=0; z<=hist->GetZaxis()->GetNbins()+1; ++z)
+ {
+ hist->SetBinContent(0, y, z, 0);
+ hist->SetBinContent(hist->GetXaxis()->GetNbins()+1, y, z, 0);
+ }
+ }
+ hist = ((TH3*) mult->GetCorrelation(etaRange))->Project3D("zy");
hist->SetStats(kFALSE);
- hist->SetTitle(";true multiplicity;measured multiplicity;Entries");
+ hist->SetTitle(Form(";%s;%s;Entries", GetMultLabel(), GetMultLabel(etaRange, kFALSE)));
hist->GetXaxis()->SetRangeUser(0, longDisplayRange);
hist->GetYaxis()->SetRangeUser(0, longDisplayRange);
+
+ hist->GetYaxis()->SetTitleOffset(1.3);
+ hist->GetZaxis()->SetTitleOffset(1.2);
- TCanvas* canvas = new TCanvas("c1", "c1", 800, 600);
+ TCanvas* canvas = new TCanvas("c1", "c1", 600, 600);
canvas->SetRightMargin(0.15);
canvas->SetTopMargin(0.05);
canvas->SaveAs("responsematrix.eps");
}
+void multPythiaPhojet()
+{
+ loadlibs();
+
+ TFile::Open("LHC08c11_10TeV_0.5T/mb1/spd/multiplicity.root");
+ AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
+ mult->LoadHistograms("Multiplicity");
+ hist1 = mult->GetMultiplicityINEL(1)->ProjectionY();
+ hist1->Sumw2();
+
+ TFile::Open("LHC08c15_10TeV_0.5T_Phojet/mb1/spd/multiplicity.root");
+ AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
+ mult->LoadHistograms("Multiplicity");
+ hist2 = mult->GetMultiplicityINEL(1)->ProjectionY();
+ hist2->Sumw2();
+
+ legend = new TLegend(0.6, 0.7, 0.9, 0.9);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+ legend->AddEntry(hist1, "Pythia", "L");
+ legend->AddEntry(hist2, "Phojet", "L");
+
+ c1 = new TCanvas("c", "c", 600, 600);
+ c1->SetTopMargin(0.05);
+ c1->SetRightMargin(0.05);
+ c1->SetLeftMargin(0.12);
+ c1->SetGridx();
+ c1->SetGridy();
+ c1->SetLogy();
+
+ //hist1->SetMarkerStyle(20);
+ //hist2->SetMarkerStyle(24);
+ //hist2->SetMarkerColor(2);
+ hist1->SetLineWidth(2);
+ hist2->SetLineWidth(2);
+ hist2->SetLineStyle(2);
+ hist2->SetLineColor(2);
+
+ hist1->Scale(1.0 / hist1->Integral());
+ hist2->Scale(1.0 / hist2->Integral());
+
+ hist1->SetStats(0);
+ hist1->GetYaxis()->SetTitleOffset(1.3);
+ hist1->GetXaxis()->SetRangeUser(0, 100);
+ hist1->SetTitle(";N_{ch};P(N_{ch})");
+
+ hist1->Draw("");
+ hist2->Draw("SAME");
+ legend->Draw();
+
+ c1->SaveAs("mult_pythia_phojet.eps");
+}
+
TCanvas* DrawResultRatio(TH1* mcHist, TH1* result, TString epsName)
{
// normalize unfolded result to mc hist
- result->Scale(1.0 / result->Integral(2, 200));
- result->Scale(mcHist->Integral(2, 200));
+ result->Scale(1.0 / result->Integral(2, displayRange));
+ result->Scale(mcHist->Integral(2, displayRange));
TCanvas* canvas = new TCanvas(epsName, epsName, 800, 600);
canvas->Range(0, 0, 1, 1);
pad2->SetTopMargin(0);
pad1->cd();
+ pad1->SetGridx();
+ pad1->SetGridy();
mcHist->GetXaxis()->SetLabelSize(0.06);
mcHist->GetYaxis()->SetLabelSize(0.06);
mcHist->GetXaxis()->SetRangeUser(0, displayRange);
- mcHist->SetTitle(";true multiplicity;Entries");
+ mcHist->SetTitle(Form(";%s;Entries", GetMultLabel()));
mcHist->SetStats(kFALSE);
mcHist->DrawCopy("HIST E");
gPad->SetLogy();
result->SetLineColor(2);
- result->DrawCopy("SAME HISTE");
+ result->SetMarkerColor(2);
+ result->SetMarkerStyle(5);
+ result->DrawCopy("SAME PE");
TLegend* legend = new TLegend(0.6, 0.65, 0.95, 0.9);
- legend->AddEntry(mcHist, "true distribution");
- legend->AddEntry(result, "unfolded distribution");
+ legend->AddEntry(mcHist, "True distribution");
+ legend->AddEntry(result, "Unfolded distribution", "P");
legend->SetFillColor(0);
legend->Draw();
// draws the 3 plots in the upper plot
// draws the ratio between result1 and result2 in the lower plot
+ // normalize unfolded result to mc hist
+ result1->Scale(1.0 / result1->Integral(2, displayRange));
+ result1->Scale(mcHist->Integral(2, displayRange));
+ result2->Scale(1.0 / result2->Integral(2, displayRange));
+ result2->Scale(mcHist->Integral(2, displayRange));
+
+ TCanvas* canvas = new TCanvas(epsName, epsName, 800, 600);
+ canvas->Range(0, 0, 1, 1);
+
+ TPad* pad1 = new TPad(Form("%s_pad1", epsName.Data()), "", 0, 0.5, 0.98, 0.98);
+ pad1->Draw();
+
+ TPad* pad2 = new TPad(Form("%s_pad2", epsName.Data()), "", 0, 0.02, 0.98, 0.5);
+ pad2->Draw();
+
+ pad1->SetRightMargin(0.05);
+ pad2->SetRightMargin(0.05);
+
+ // no border between them
+ pad1->SetBottomMargin(0);
+ pad2->SetTopMargin(0);
+
+ pad1->cd();
+ gPad->SetGridx();
+ gPad->SetGridy();
+
+ mcHist->GetXaxis()->SetLabelSize(0.06);
+ mcHist->GetYaxis()->SetLabelSize(0.06);
+ mcHist->GetXaxis()->SetTitleSize(0.06);
+ mcHist->GetYaxis()->SetTitleSize(0.06);
+ mcHist->GetYaxis()->SetTitleOffset(0.6);
+
+ mcHist->GetXaxis()->SetRangeUser(0, displayRange);
+
+ mcHist->SetTitle(";true multiplicity;Entries");
+ mcHist->SetStats(kFALSE);
+
+ mcHist->DrawCopy("HIST E");
+ gPad->SetLogy();
+
+ result1->SetLineColor(2);
+ result1->SetMarkerStyle(24);
+ result1->DrawCopy("SAME HISTE");
+
+ result2->SetLineColor(4);
+ result2->SetMarkerColor(4);
+ result2->DrawCopy("SAME HISTE");
+
+ TLegend* legend = new TLegend(0.5, 0.6, 0.95, 0.9);
+ legend->AddEntry(mcHist, "True distribution");
+ legend->AddEntry(result1, "Unfolded distribution (syst)", "P");
+ legend->AddEntry(result2, "Unfolded distribution (normal)", "P");
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.06);
+ legend->Draw();
+
+ pad2->cd();
+ pad2->SetBottomMargin(0.15);
+ //gPad->SetGridx();
+ //gPad->SetGridy();
+
+ result1->GetXaxis()->SetLabelSize(0.06);
+ result1->GetYaxis()->SetLabelSize(0.06);
+ result1->GetXaxis()->SetTitleSize(0.06);
+ result1->GetYaxis()->SetTitleSize(0.06);
+ result1->GetYaxis()->SetTitleOffset(0.6);
+
+ result1->GetXaxis()->SetRangeUser(0, displayRange);
+
+ result1->SetTitle(Form(";%s;Entries", GetMultLabel()));
+ result1->SetStats(kFALSE);
+
+ // calculate ratio
+ result1->Sumw2();
+ TH1* ratio = (TH1*) result1->Clone("ratio");
+ result2->Sumw2();
+ ratio->Divide(ratio, result2, 1, 1, "");
+ ratio->SetLineColor(1);
+ ratio->SetMarkerColor(1);
+ ratio->SetMarkerStyle(0);
+ ratio->GetYaxis()->SetTitle("Ratio (syst / normal)");
+ ratio->GetYaxis()->SetRangeUser(0.55, 1.45);
+
+ ratio->DrawCopy();
+
+ // get average of ratio
+ Float_t sum = 0;
+ for (Int_t i=2; i<=ratioRange; ++i)
+ {
+ sum += TMath::Abs(ratio->GetBinContent(i) - 1);
+ }
+ sum /= ratioRange-1;
+
+ printf("Average (2..%d) of |ratio - 1| is %f\n", ratioRange, sum);
+
+ TLine* line = new TLine(0, 1, displayRange, 1);
+ line->SetLineWidth(2);
+ line->Draw();
+
+ line = new TLine(0, 1.1, displayRange, 1.1);
+ line->SetLineWidth(2);
+ line->SetLineStyle(2);
+ line->Draw();
+ line = new TLine(0, 0.9, displayRange, 0.9);
+ line->SetLineWidth(2);
+ line->SetLineStyle(2);
+ line->Draw();
+
+ canvas->Modified();
+
+ canvas->SaveAs(epsName);
+
+ return canvas;
+}
+
+TCanvas* Draw2ResultRatios(TH1* mcHist, TH1* result1, TH1* result2, TH1* ratio2, TH1* ratio3, TString epsName)
+{
+ // draws the 3 plots in the upper plot
+ // draws the ratio between result1 and result2 in the lower plot
+ // also draws ratio2 and ratio3 in the lower plot, uses their name for the legend
+
// normalize unfolded result to mc hist
result1->Scale(1.0 / result1->Integral(2, 200));
result1->Scale(mcHist->Integral(2, 200));
pad2->SetTopMargin(0);
pad1->cd();
+ gPad->SetGridx();
+ gPad->SetGridy();
mcHist->GetXaxis()->SetLabelSize(0.06);
mcHist->GetYaxis()->SetLabelSize(0.06);
mcHist->GetXaxis()->SetRangeUser(0, displayRange);
- mcHist->SetTitle(";true multiplicity;Entries");
+ mcHist->SetTitle(";True multiplicity;Entries");
mcHist->SetStats(kFALSE);
mcHist->DrawCopy("HIST E");
gPad->SetLogy();
result1->SetLineColor(2);
+ result1->SetMarkerColor(2);
+ result1->SetMarkerStyle(24);
result1->DrawCopy("SAME HISTE");
result2->SetLineColor(4);
+ result2->SetMarkerColor(4);
+ result2->SetMarkerStyle(5);
result2->DrawCopy("SAME HISTE");
TLegend* legend = new TLegend(0.55, 0.6, 0.95, 0.9);
- legend->AddEntry(mcHist, "true distribution");
- legend->AddEntry(result1, "unfolded distribution (syst)");
- legend->AddEntry(result2, "unfolded distribution (normal)");
+ legend->AddEntry(mcHist, "True distribution");
+ legend->AddEntry(result1, "Unfolded distribution (5%)", "P");
+ legend->AddEntry(result2, "Unfolded distribution (normal)", "P");
legend->SetFillColor(0);
+ legend->SetTextSize(0.06);
legend->Draw();
pad2->cd();
pad2->SetBottomMargin(0.15);
+ //gPad->SetGridx();
+ //gPad->SetGridy();
result1->GetXaxis()->SetLabelSize(0.06);
result1->GetYaxis()->SetLabelSize(0.06);
result1->GetXaxis()->SetRangeUser(0, displayRange);
- result1->SetTitle(";true multiplicity;Entries");
+ result1->SetTitle(Form(";%s;Entries", GetMultLabel()));
result1->SetStats(kFALSE);
// calculate ratio
TH1* ratio = (TH1*) result1->Clone("ratio");
result2->Sumw2();
ratio->Divide(ratio, result2, 1, 1, "");
- ratio->GetYaxis()->SetTitle("Ratio (syst / normal)");
+ ratio->SetLineColor(1);
+ ratio->SetMarkerColor(1);
+ ratio->SetMarkerStyle(24);
+ ratio->GetYaxis()->SetTitle("Ratio (change / normal)");
ratio->GetYaxis()->SetRangeUser(0.55, 1.45);
+ ratio2->SetLineColor(2);
+ ratio2->SetMarkerColor(2);
+ ratio2->SetMarkerStyle(25);
+
+ ratio3->SetLineColor(4);
+ ratio3->SetMarkerColor(4);
+ ratio3->SetMarkerStyle(26);
+
ratio->DrawCopy();
+ ratio2->DrawCopy("SAME");
+ ratio3->DrawCopy("SAME");
+
+ legend2 = new TLegend(0.3, 0.8, 0.8, 0.95);
+ legend2->SetNColumns(3);
+ legend2->SetFillColor(0);
+ legend2->SetTextSize(0.06);
+ legend2->AddEntry(ratio, "5% change", "P");
+ legend2->AddEntry(ratio2, "2% change", "P");
+ legend2->AddEntry(ratio3, "1% change", "P");
+ legend2->Draw();
// get average of ratio
Float_t sum = 0;
// normalize results
result->Scale(1.0 / result->Integral(2, 200));
- TCanvas* canvas = new TCanvas(epsName, epsName, 800, 400);
+ TCanvas* canvas = new TCanvas(epsName, epsName, 800, 500);
canvas->SetTopMargin(0.05);
canvas->SetRightMargin(0.05);
+ canvas->SetGridx();
+ canvas->SetGridy();
result->GetXaxis()->SetRangeUser(0, displayRange);
result->GetYaxis()->SetRangeUser(0.55, 1.45);
// to get the axis how we want it
TH1* dummy = (TH1*) result->Clone("dummy");
dummy->Reset();
- dummy->SetTitle(";true multiplicity;Ratio");
+ dummy->SetTitle(Form(";%s;Ratio", GetMultLabel()));
dummy->DrawCopy();
delete dummy;
Int_t colors[] = {1, 2, 4, 6, 7, 8, 9, 10};
- TLegend* legend = new TLegend(0.2, 0.75, 0.35, 0.95);
+ TLegend* legend = new TLegend(0.2, 0.7, 0.7, 0.93);
legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+ if (nResultSyst > 6)
+ legend->SetNColumns(2);
for (Int_t n=0; n<nResultSyst; ++n)
{
// calculate ratio
TH1* ratio = (TH1*) result->Clone("ratio");
ratio->Divide(ratio, resultSyst[n], 1, 1, "");
- ratio->GetXaxis()->SetRangeUser(1, displayRange);
+ ratio->GetXaxis()->SetRangeUser(0, displayRange);
if (firstMarker)
ratio->SetMarkerStyle(5);
ratio->DrawCopy(drawStr);
if (legendStrings && legendStrings[n])
- legend->AddEntry(ratio, legendStrings[n]);
+ legend->AddEntry(ratio, legendStrings[n], "L");
// get average of ratio
Float_t sum = 0;
if (legendStrings)
legend->Draw();
- TLine* line = new TLine(0, 1, displayRange, 1);
+ TLine* line = new TLine(-0.5, 1, displayRange, 1);
line->SetLineWidth(2);
line->Draw();
- line = new TLine(0, 1.1, displayRange, 1.1);
+ line = new TLine(-0.5, 1.1, displayRange, 1.1);
line->SetLineWidth(2);
line->SetLineStyle(2);
line->Draw();
- line = new TLine(0, 0.9, displayRange, 0.9);
+ line = new TLine(-0.5, 0.9, displayRange, 0.9);
line->SetLineWidth(2);
line->SetLineStyle(2);
line->Draw();
return canvas;
}
-void DrawResiduals(TH1* measured, TH1* unfoldedFolded, const char* epsName)
+void DrawResiduals(const char* fileName, const char* epsName)
{
+ loadlibs();
+
+ AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
+ TFile::Open(fileName);
+ mult->LoadHistograms("Multiplicity");
+
+ TH1* measured = mult->GetMultiplicityESD(etaRange)->ProjectionY("myesd", 1, 1);
+ TH1* unfoldedFolded = mult->CalculateMultiplicityESD(mult->GetMultiplicityESDCorrected(etaRange), etaRange)->ProjectionY("myfolded", 1, 1);
+
// normalize
- unfoldedFolded->Scale(1.0 / unfoldedFolded->Integral(2, 200));
- unfoldedFolded->Scale(measured->Integral(2, 200));
+ unfoldedFolded->Scale(1.0 / unfoldedFolded->Integral(2, displayRange+1));
+ unfoldedFolded->Scale(measured->Integral(2, displayRange+1));
TCanvas* canvas = new TCanvas(epsName, epsName, 800, 600);
canvas->Range(0, 0, 1, 1);
- TPad* pad1 = new TPad(Form("%s_pad1", epsName), "", 0, 0.5, 0.98, 0.98);
+ TPad* pad1 = new TPad(Form("%s_pad1", epsName), "", 0, 0.5, 1, 1);
pad1->Draw();
pad1->SetGridx();
pad1->SetGridy();
- TPad* pad2 = new TPad(Form("%s_pad2", epsName), "", 0, 0.02, 0.98, 0.5);
+ TPad* pad2 = new TPad(Form("%s_pad2", epsName), "", 0, 0.02, 1, 0.5);
pad2->Draw();
pad2->SetGridx();
pad2->SetGridy();
measured->GetYaxis()->SetTitleSize(0.06);
measured->GetYaxis()->SetTitleOffset(0.6);
- measured->GetXaxis()->SetRangeUser(0, 150);
+ measured->GetXaxis()->SetRangeUser(0, displayRange);
- measured->SetTitle(";measured multiplicity;Entries");
+ measured->SetTitle(Form(";%s;Entries", GetMultLabel(etaRange, kFALSE)));
measured->SetStats(kFALSE);
measured->DrawCopy("HIST");
unfoldedFolded->SetMarkerStyle(5);
unfoldedFolded->SetMarkerColor(2);
- unfoldedFolded->SetLineColor(0);
- unfoldedFolded->DrawCopy("SAME P");
+ unfoldedFolded->SetLineColor(2);
+ unfoldedFolded->DrawCopy("SAME PHIST");
TLegend* legend = new TLegend(0.6, 0.65, 0.95, 0.9);
- legend->AddEntry(measured, "measured distribution");
- legend->AddEntry(unfoldedFolded, "R #otimes unfolded distribution");
+ legend->AddEntry(measured, "Measured distribution", "L");
+ legend->AddEntry(unfoldedFolded, "R #otimes unfolded distribution", "P");
legend->SetFillColor(0);
+ legend->SetTextSize(0.06);
legend->Draw();
pad2->cd();
residual->Add(unfoldedFolded, -1);
// projection
- TH1* residualHist = new TH1F("residualHist", ";", 15, -3, 3);
+ TH1* residualHist = new TH1F("residualHist", ";", 11, -3, 3);
- for (Int_t i=1; i<=residual->GetNbinsX(); ++i)
+ for (Int_t i=1; i<=displayRange+1; ++i)
{
if (measured->GetBinError(i) > 0)
{
}
}
- residual->GetYaxis()->SetTitle("Residuals 1/e (M - R #otimes U)");
+ residual->GetYaxis()->SetTitle("Residuals: (1/e) (M - R #otimes U)");
residual->GetYaxis()->SetRangeUser(-4.5, 4.5);
residual->DrawCopy();
- TLine* line = new TLine(-0.5, 0, 150.5, 0);
+ TLine* line = new TLine(-0.5, 0, displayRange + 0.5, 0);
line->SetLineWidth(2);
line->Draw();
pad3->cd();
residualHist->SetStats(kFALSE);
- residualHist->GetXaxis()->SetLabelSize(0.08);
+ residualHist->SetLabelSize(0.08, "xy");
residualHist->Fit("gaus");
residualHist->Draw();
//canvas->SaveAs(canvas->GetName());
}
-void bayesianExample()
+void chi2FluctuationResult()
{
- TStopwatch watch;
- watch.Start();
-
- gSystem->Load("libPWG0base");
+ loadlibs();
- TFile::Open(correctionFile);
+ TFile::Open("chi2_noregularization.root");
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
mult->LoadHistograms("Multiplicity");
- TFile::Open(measuredFile);
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
-
- mult->ApplyBayesianMethod(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, 1, 100);
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
- TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
-
- //mult->DrawComparison("bayesianExample", etaRange, kFALSE, kTRUE, mcHist, kTRUE);
- DrawResultRatio(mcHist, result, "bayesianExample.eps");
-
- //Printf("KolmogorovTest says PROB = %f", mcHist->KolmogorovTest(result, "D"));
- //Printf("Chi2Test says PROB = %f", mcHist->Chi2Test(result));
-
- // draw residual plot
-
- // TODO take out efficiency correction if other than AliMultiplicityCorrection::kTrVtx
- TH2* convoluted = mult->CalculateMultiplicityESD(result, etaRange);
- TH1* convolutedProj = convoluted->ProjectionY("convolutedProj", -1, -1, "e");
-
- TH1* measured = mult2->GetMultiplicityESD(etaRange)->ProjectionY("measured");
+ TH1* mcHist = mult->GetMultiplicityVtx(etaRange)->ProjectionY("mymc", 1, 1);
- DrawResiduals(measured, convolutedProj, "bayesianResiduals.eps");
+ mult->DrawComparison("MinuitChi2", etaRange, kFALSE, kTRUE, mcHist, kTRUE);
- watch.Stop();
- watch.Print();
+ TCanvas* canvas = (TCanvas*) gROOT->FindObject("MinuitChi2_DrawComparison_1");
+ ((TH1*) canvas->FindObject("proj"))->GetXaxis()->SetRangeUser(0, displayRange);
+ ((TH1*) canvas->FindObject("fCurrentESD"))->GetXaxis()->SetRangeUser(0, displayRange);
+ //((TH1*) canvas->FindObject("proj"))->GetXaxis()->SetTitle(GetMultTitle());
+ //((TH1*) canvas->FindObject("fCurrentESD"))->GetXaxis()->->SetTitle(GetMultTitle(etaRange, kFALSE));
+ canvas->SaveAs("chi2FluctuationResult.eps");
}
-void chi2FluctuationResult()
+void DrawUnfolded(const char* fileName, const char* eps)
{
- gSystem->Load("libPWG0base");
+ loadlibs();
+
+ TFile::Open(fileName);
- TFile::Open(correctionFile);
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
mult->LoadHistograms("Multiplicity");
- TFile::Open(measuredFile);
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kNone, 0);
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx);
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
- //TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
-
- mult->DrawComparison("MinuitChi2", etaRange, kFALSE, kTRUE, mcHist, kTRUE);
+ TH1* mcHist = mult->GetMultiplicityVtx(etaRange)->ProjectionY("mymc", 1, mult->GetMultiplicityVtx(etaRange)->GetNbinsX());
+ TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
- TCanvas* canvas = (TCanvas*) gROOT->FindObject("MinuitChi2_DrawComparison_3");
- canvas->SaveAs("chi2FluctuationResult.eps");
+ DrawResultRatio(mcHist, result, eps);
}
-void chi2Example()
+void minimizationInfluenceAlpha()
{
- TStopwatch watch;
- watch.Start();
-
- gSystem->Load("libPWG0base");
-
- TFile::Open(correctionFile);
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
- mult->LoadHistograms("Multiplicity");
+ loadlibs();
TFile::Open(measuredFile);
AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
mult2->LoadHistograms("Multiplicity");
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx);
+ TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc", 1, mult2->GetMultiplicityVtx(etaRange)->GetNbinsX());
+ mcHist->Scale(1.0 / mcHist->Integral());
+ mcHist->SetStats(kFALSE);
+ mcHist->SetTitle(";True multiplicity n in |#eta| < 1.0;P(n)");
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
- TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
+ TCanvas* canvas = new TCanvas("minimizationInfluenceAlpha", "minimizationInfluenceAlpha", 1000, 350);
+ canvas->Divide(3, 1, 0.005);
+
+ TFile::Open("chi2compare-influencealpha/EvaluateChi2Method.root");
+
+ TH1* hist1 = (TH1*) gFile->Get("MinuitChi2_00_2_3.162278");
+ TH1* hist2 = (TH1*) gFile->Get("MinuitChi2_07_2_10000.000000");
+ TH1* hist3 = (TH1*) gFile->Get("MinuitChi2_13_2_10000000.000000");
+
+ /*mcHist->Rebin(2); mcHist->Scale(0.5);
+ hist1->Rebin(2); hist1->Scale(0.5);
+ hist2->Rebin(2); hist2->Scale(0.5);
+ hist3->Rebin(2); hist3->Scale(0.5);*/
+
+ mcHist->GetXaxis()->SetRangeUser(0, displayRange);
+ mcHist->SetLabelSize(0.06, "xy");
+ mcHist->SetTitleSize(0.06, "xy");
+ mcHist->GetYaxis()->SetTitleOffset(1.5);
+
+ canvas->cd(1);
+
+ gPad->SetLogy();
+ gPad->SetRightMargin(0.03);
+ gPad->SetLeftMargin(0.19);
+ gPad->SetTopMargin(0.05);
+ gPad->SetBottomMargin(0.13);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ mcHist->Draw();
+ hist1->SetMarkerStyle(5);
+ hist1->SetMarkerColor(2);
+ hist1->Draw("SAME PE");
+
+ canvas->cd(2);
+ gPad->SetRightMargin(0.03);
+ gPad->SetLeftMargin(0.19);
+ gPad->SetTopMargin(0.05);
+ gPad->SetBottomMargin(0.13);
+ gPad->SetLogy();
+ gPad->SetGridx();
+ gPad->SetGridy();
+ mcHist->Draw();
+ hist2->SetMarkerStyle(5);
+ hist2->SetMarkerColor(2);
+ hist2->Draw("SAME PE");
- DrawResultRatio(mcHist, result, "chi2Example.eps");
+ canvas->cd(3);
+ gPad->SetRightMargin(0.03);
+ gPad->SetLeftMargin(0.19);
+ gPad->SetTopMargin(0.05);
+ gPad->SetBottomMargin(0.13);
+ gPad->SetLogy();
+ gPad->SetGridx();
+ gPad->SetGridy();
+ mcHist->Draw();
+ hist3->SetMarkerStyle(5);
+ hist3->SetMarkerColor(2);
+ hist3->Draw("SAME PE");
- watch.Stop();
- watch.Print();
+ canvas->SaveAs("minimizationInfluenceAlpha.eps");
}
-void chi2ExampleTPC()
+void NBDFit()
{
- TStopwatch watch;
- watch.Start();
-
gSystem->Load("libPWG0base");
- TFile::Open(correctionFileTPC);
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
- mult->LoadHistograms("Multiplicity");
-
- TFile::Open(measuredFileTPC);
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRangeTPC, mult2->GetMultiplicityESD(etaRangeTPC));
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
- mult->ApplyMinuitFit(etaRangeTPC, kFALSE, AliMultiplicityCorrection::kTrVtx);
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRangeTPC)->ProjectionY("mymc");
- TH1* result = mult->GetMultiplicityESDCorrected(etaRangeTPC);
-
- DrawResultRatio(mcHist, result, "chi2ExampleTPC.eps");
-
- watch.Stop();
- watch.Print();
-}
-
-void bayesianNBD()
-{
- gSystem->Load("libPWG0base");
- TFile::Open("multiplicityMC_3M.root");
-
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
- mult->LoadHistograms("Multiplicity");
-
- TFile::Open("multiplicityMC_3M_NBD.root");
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- mult->ApplyBayesianMethod(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, 1.0, 100);
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
-
- mcHist->Sumw2();
- TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
-
- //mult->DrawComparison("bayesianNBD", etaRange, kFALSE, kTRUE, mcHist);
- DrawResultRatio(mcHist, result, "bayesianNBD.eps");
-}
-
-void minimizationNBD()
-{
- gSystem->Load("libPWG0base");
- TFile::Open("multiplicityMC_3M.root");
-
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
- mult->LoadHistograms("Multiplicity");
-
- TFile::Open("multiplicityMC_3M_NBD.root");
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx);
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
-
- mcHist->Sumw2();
- TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
-
- //mult->DrawComparison("minimizationNBD", etaRange, kFALSE, kTRUE, mcHist);
- DrawResultRatio(mcHist, result, "minimizationNBD.eps");
-}
-
-void minimizationInfluenceAlpha()
-{
- gSystem->Load("libPWG0base");
-
- TFile::Open(measuredFile);
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
- mcHist->Scale(1.0 / mcHist->Integral());
- mcHist->GetXaxis()->SetRangeUser(0, 200);
- mcHist->SetStats(kFALSE);
- mcHist->SetTitle(";true multiplicity;P_{N}");
-
- TCanvas* canvas = new TCanvas("minimizationInfluenceAlpha", "minimizationInfluenceAlpha", 1000, 300);
- canvas->Divide(3, 1);
-
- TFile::Open("eval-2M-1M/EvaluateChi2MethodDetail.root");
-
- TH1* hist1 = (TH1*) gFile->Get("MinuitChi2_00_2_100.000000");
- TH1* hist2 = (TH1*) gFile->Get("MinuitChi2_03_2_100000.000000");
- TH1* hist3 = (TH1*) gFile->Get("MinuitChi2_06_2_100000000.000000");
-
- mcHist->Rebin(2); mcHist->Scale(0.5);
- hist1->Rebin(2); hist1->Scale(0.5);
- hist2->Rebin(2); hist2->Scale(0.5);
- hist3->Rebin(2); hist3->Scale(0.5);
-
- mcHist->GetXaxis()->SetRangeUser(0, 200);
-
- canvas->cd(1);
- gPad->SetLogy();
- mcHist->Draw();
- hist1->SetMarkerStyle(5);
- hist1->SetMarkerColor(2);
- hist1->Draw("SAME PE");
-
- canvas->cd(2);
- gPad->SetLogy();
- mcHist->Draw();
- hist2->SetMarkerStyle(5);
- hist2->SetMarkerColor(2);
- hist2->Draw("SAME PE");
-
- canvas->cd(3);
- gPad->SetLogy();
- mcHist->Draw();
- hist3->SetMarkerStyle(5);
- hist3->SetMarkerColor(2);
- hist3->Draw("SAME PE");
-
- canvas->SaveAs("minimizationInfluenceAlpha.eps");
-}
-
-void NBDFit()
-{
- gSystem->Load("libPWG0base");
-
- TFile::Open(correctionFile);
+ TFile::Open(correctionFile);
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
mult->LoadHistograms("Multiplicity");
canvas->SaveAs("NBDFit.eps");
}
-void DifferentSamples()
-{
- // data generated by runMultiplicitySelector.C DifferentSamples
-
- const char* name = "DifferentSamples";
-
- TFile* file = TFile::Open(Form("%s.root", name));
-
- TCanvas* canvas = new TCanvas(name, name, 800, 600);
- canvas->Divide(2, 2);
-
- for (Int_t i=0; i<4; ++i)
- {
- canvas->cd(i+1);
- gPad->SetTopMargin(0.05);
- gPad->SetRightMargin(0.05);
- TH1* chi2Result = (TH1*) file->Get(Form("chi2Result_%d", i));
- TH1* bayesResult = (TH1*) file->Get(Form("bayesResult_%d", i));
- TH1* mc = (TH1*) file->Get(Form("mc_%d", i));
- mc->Sumw2();
-
- chi2Result->Divide(chi2Result, mc, 1, 1, "");
- bayesResult->Divide(bayesResult, mc, 1, 1, "");
-
- chi2Result->SetTitle(";true multiplicity;unfolded measured/MC");
- chi2Result->GetXaxis()->SetRangeUser(0, 150);
- chi2Result->GetYaxis()->SetRangeUser(0.5, 1.5);
- chi2Result->GetYaxis()->SetTitleOffset(1.2);
- chi2Result->SetLineColor(1);
- chi2Result->SetStats(kFALSE);
-
- bayesResult->SetStats(kFALSE);
- bayesResult->SetLineColor(2);
-
- chi2Result->DrawCopy("HIST");
- bayesResult->DrawCopy("SAME HIST");
-
- TLine* line = new TLine(0, 1, 150, 1);
- line->Draw();
- }
-
- canvas->SaveAs(Form("%s.eps", canvas->GetName()));
-}
-
void StartingConditions()
{
// data generated by runMultiplicitySelector.C StartingConditions
TFile* file = TFile::Open(Form("%s.root", name));
- TCanvas* canvas = new TCanvas(name, name, 800, 400);
+ TCanvas* canvas = new TCanvas(name, name, 1200, 600);
canvas->Divide(2, 1);
TH1* mc = (TH1*) file->Get("mc");
mc->Sumw2();
- mc->Scale(1.0 / mc->Integral());
+ mc->Scale(1.0 / mc->Integral(2, displayRange));
//Int_t marker[] = {24, 25, 26, 27, 28, 2, 3, 4, 5};
- TLegend* legend = new TLegend(0.6, 0.7, 0.95, 0.95);
+ TLegend* legend = new TLegend(0.6, 0.7, 0.99, 0.99);
legend->SetFillColor(0);
-
+ legend->SetTextSize(0.04);
+
const char* names[] = { "True", "Measured 1", "Measured 2", "Measured 3", "NBD", "Flat" };
for (Int_t i=0; i<6; ++i)
TH1* chi2Result = (TH1*) file->Get(Form("chi2Result_%d", id));
TH1* bayesResult = (TH1*) file->Get(Form("bayesResult_%d", id));
+
+ chi2Result->Scale(1.0 / chi2Result->Integral(2, displayRange));
+ bayesResult->Scale(1.0 / bayesResult->Integral(2, displayRange));
- chi2Result->Divide(chi2Result, mc, 1, 1, "");
- bayesResult->Divide(bayesResult, mc, 1, 1, "");
+ chi2Result->Divide(mc, chi2Result, 1, 1, "");
+ bayesResult->Divide(mc, bayesResult, 1, 1, "");
- chi2Result->SetTitle("a) #chi^{2} minimization;true multiplicity;unfolded / MC");
- chi2Result->GetXaxis()->SetRangeUser(0, 150);
- chi2Result->GetYaxis()->SetRangeUser(0.8, 1.2);
- chi2Result->GetYaxis()->SetTitleOffset(1.5);
+ chi2Result->SetTitle(Form("a) #chi^{2}-minimization;%s;MC / unfolded", GetMultLabel()));
+ chi2Result->GetXaxis()->SetRangeUser(0, displayRange);
+ chi2Result->GetYaxis()->SetRangeUser(0.7, 1.3);
+ chi2Result->GetYaxis()->SetTitleOffset(1.7);
//chi2Result->SetMarkerStyle(marker[i]);
chi2Result->SetLineColor(i+1);
chi2Result->SetMarkerColor(i+1);
chi2Result->SetStats(kFALSE);
- bayesResult->SetTitle("b) Bayesian method;true multiplicity;unfolded / MC");
- bayesResult->GetXaxis()->SetRangeUser(0, 150);
- bayesResult->GetYaxis()->SetRangeUser(0.8, 1.2);
- bayesResult->GetYaxis()->SetTitleOffset(1.5);
+ bayesResult->SetTitle(Form("b) Bayesian unfolding;%s;MC / unfolded", GetMultLabel()));
+ bayesResult->GetXaxis()->SetRangeUser(0, displayRange);
+ bayesResult->GetYaxis()->SetRangeUser(0.7, 1.3);
+ bayesResult->GetYaxis()->SetTitleOffset(1.7);
bayesResult->SetStats(kFALSE);
//bayesResult->SetLineColor(2);
bayesResult->SetLineColor(i+1);
canvas->cd(1);
+ gPad->SetRightMargin(0.05);
gPad->SetLeftMargin(0.12);
+ gPad->SetGridx();
+ gPad->SetGridy();
chi2Result->DrawCopy((i == 0) ? "HIST" : "HIST SAME");
canvas->cd(2);
+ gPad->SetRightMargin(0.05);
gPad->SetLeftMargin(0.12);
+ gPad->SetGridx();
+ gPad->SetGridy();
bayesResult->DrawCopy((i == 0) ? "HIST" : "HIST SAME");
//TLine* line = new TLine(0, 1, 150, 1);
canvas->cd(1);
legend->Draw();
+ canvas->cd(2);
+ legend->Draw();
canvas->SaveAs(Form("%s.eps", canvas->GetName()));
}
}
}
-void SystematicLowEfficiency()
+void Draw2Unfolded(const char* file1, const char* file2, const char* output)
{
- gSystem->Load("libPWG0base");
-
- TFile::Open(correctionFile);
+ loadlibs();
+
+ TFile::Open(file1);
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
mult->LoadHistograms("Multiplicity");
- // calculate result with systematic effect
- TFile::Open("multiplicityMC_100k_1_loweff.root");
+ // result with systematic effect
+ TFile::Open(file2);
AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
mult2->LoadHistograms("Multiplicity");
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx);
+ TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc", 1, 1);
+ TH1* result1 = (TH1*) mult2->GetMultiplicityESDCorrected(etaRange)->Clone("result1"); // from file2 (with syst)
+ TH1* result2 = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone("result2"); // from file1 (without syst)
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
- TH1* result1 = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone("result1");
+ DrawResultRatio(mcHist, result1, "tmp1.eps");
+ DrawResultRatio(mcHist, result2, "tmp2.eps");
+ Draw2ResultRatio(mcHist, result1, result2, output);
+}
- DrawResultRatio(mcHist, result1, "SystematicLowEfficiencyLow.eps");
+void PythiaPhojet()
+{
+ loadlibs();
+
+ displayRange = 55;
+ Draw2Unfolded("self.root", "pythia.root", "test.eps");
+
+ canvas = (TCanvas*) gROOT->GetListOfCanvases()->Last();
+ pad1 = (TCanvas*)canvas->GetListOfPrimitives()->First();
+ pad2 = (TCanvas*)canvas->GetListOfPrimitives()->Last();
+ legend = (TLegend*)pad1->GetListOfPrimitives()->Last();
+
+ ((TH1*)pad2->GetListOfPrimitives()->At(1))->GetYaxis()->SetTitle("Ratio (Pythia / Phojet)");
+ ((TLegendEntry*)legend->GetListOfPrimitives()->At(1))->SetLabel("Unfolded distribution (Pythia)");
+ ((TLegendEntry*)legend->GetListOfPrimitives()->At(2))->SetLabel("Unfolded distribution (Phojet)");
+ canvas->SaveAs("PythiaPhojet.eps");
+}
- // calculate normal result
- TFile::Open("multiplicityMC_100k_1.root");
- mult2->LoadHistograms("Multiplicity");
+void Misalignment()
+{
+ loadlibs();
+
+ Draw2Unfolded("chi2_ideal.root", "chi2_misaligned.root", "test.eps");
+
+ canvas = (TCanvas*) gROOT->GetListOfCanvases()->Last();
+ pad1 = (TCanvas*)canvas->GetListOfPrimitives()->First();
+ pad2 = (TCanvas*)canvas->GetListOfPrimitives()->Last();
+ legend = (TLegend*)pad1->GetListOfPrimitives()->Last();
+
+ ((TH1*)pad2->GetListOfPrimitives()->At(1))->GetYaxis()->SetTitle("Ratio (misaligned / realigned)");
+ ((TLegendEntry*)legend->GetListOfPrimitives()->At(1))->SetLabel("Unfolded distribution (misaligned)");
+ ((TLegendEntry*)legend->GetListOfPrimitives()->At(2))->SetLabel("Unfolded distribution (realigned)");
+ canvas->SaveAs("SystematicMisalignment.eps");
+}
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx);
+void SystematicLowEfficiency()
+{
+ Draw2Unfolded("chi2.root", "chi2_loweff_5.root", "SystematicLowEfficiency.eps");
+}
+void SystematicLowEfficiency2()
+{
+ loadlibs();
+
+ AliMultiplicityCorrection* mult = AliMultiplicityCorrection::Open("chi2.root");
TH1* result2 = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone("result2");
-
- DrawResultRatio(mcHist, result2, "SystematicLowEfficiencyOK.eps");
-
- Draw2ResultRatio(mcHist, result1, result2, "SystematicLowEfficiency.eps");
+ TH1* mcHist = mult->GetMultiplicityVtx(etaRange)->ProjectionY("mymc", 1, 1);
+ result2->Scale(1.0 / result2->Integral(2, displayRange));
+ result2->Scale(mcHist->Integral(2, displayRange));
+
+ mult = AliMultiplicityCorrection::Open("chi2_loweff_5.root");
+ TH1* result1 = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone("result1");
+
+ mult = AliMultiplicityCorrection::Open("chi2_loweff_2.root");
+ TH1* ratio2 = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone("ratio2");
+ ratio2->Scale(1.0 / ratio2->Integral(2, displayRange));
+ ratio2->Scale(mcHist->Integral(2, displayRange));
+ ratio2->Divide(result2);
+
+ mult = AliMultiplicityCorrection::Open("chi2_loweff_1.root");
+ TH1* ratio3 = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone("ratio3");
+ ratio3->Scale(1.0 / ratio3->Integral(2, displayRange));
+ ratio3->Scale(mcHist->Integral(2, displayRange));
+ ratio3->Divide(result2);
+
+ Draw2ResultRatios(mcHist, result1, result2, ratio2, ratio3, "SystematicLowEfficiency2.eps");
}
void SystematicMisalignment()
DrawResultRatio(mcHist, result, "SystematicMisalignmentTPC.eps");
}
-void EfficiencySpecies()
+void LowMomentumEffectSPD()
+{
+ // this function increases/reduces the correction as function of pt between 0 and 0.2 gev by +-50% to 0% and checks the effect on the overall correction factor
+ // only a normal acceptance region is considered to not get a bias by the edges
+
+ loadlibs();
+ TFile::Open("multiplicity.root");
+
+
+ AliCorrection* correction[8];
+ Float_t values[3];
+
+ for (Int_t loop=0; loop<3; loop++)
+ {
+ Float_t sumGen = 0;
+ Float_t sumMeas = 0;
+
+ Printf("loop %d", loop);
+ for (Int_t i=0; i<4; ++i)
+ {
+ Printf("correction %d", i);
+
+ TString name; name.Form("correction_%d", i);
+ correction[i] = new AliCorrection(name, name);
+ correction[i]->LoadHistograms();
+
+ TH3* gene = correction[i]->GetTrackCorrection()->GetGeneratedHistogram();
+ TH3* meas = correction[i]->GetTrackCorrection()->GetMeasuredHistogram();
+
+ Float_t vtxRange = 5.9;
+ gene->GetXaxis()->SetRangeUser(-vtxRange, vtxRange);
+ meas->GetXaxis()->SetRangeUser(-vtxRange, vtxRange);
+
+ Float_t etaRange = 0.99;
+ gene->GetYaxis()->SetRangeUser(-etaRange, etaRange);
+ meas->GetYaxis()->SetRangeUser(-etaRange, etaRange);
+
+ TH1* genePt = gene->Project3D(Form("z_%d", i));
+ TH1* measPt = meas->Project3D(Form("z_%d", i));
+
+ if (loop > 0)
+ {
+ for (Int_t x=1; x<=genePt->GetNbinsX(); x++)
+ {
+ Float_t pt = genePt->GetXaxis()->GetBinCenter(x);
+ //Printf("%f", pt);
+ if (pt < 0.2)
+ {
+ Float_t factor = 1;
+ if (loop == 1)
+ factor = 1.5 - pt / 0.2 * 0.5;
+ if (loop == 2)
+ factor = 0.5 + pt / 0.2 * 0.5;
+ //Printf("%f", factor);
+ genePt->SetBinContent(x, genePt->GetBinContent(x) * factor);
+ measPt->SetBinContent(x, measPt->GetBinContent(x) * factor);
+ }
+ }
+ }
+
+ //new TCanvas; genePt->DrawCopy(); measPt->DrawCopy("SAME");
+
+ sumGen += genePt->Integral();
+ sumMeas += measPt->Integral();
+
+ Float_t average = measPt->Integral() / genePt->Integral();
+
+ Printf("The average efficiency of this correction is %f", average);
+ }
+
+ Float_t average = sumMeas / sumGen;
+
+ Printf("The average efficiency of all corrections is %f", average);
+ values[loop] = average;
+ }
+
+ Printf("relative is %f and %f", values[1] / values[0], values[2] / values[0]);
+}
+
+
+void EfficiencySpecies(Bool_t addDecayStopped = kFALSE)
{
loadlibs();
- Int_t marker[] = {24, 25, 26};
- Int_t color[] = {1, 2, 4};
+ Int_t marker[] = {24, 25, 26, 27};
+ Int_t color[] = {1, 2, 4, 3};
// SPD TPC
//const char* fileName[] = { "multiplicityMC_400k_syst.root", "multiplicityMC_TPC_4kfiles_syst.root" };
- const char* fileName[] = { "spd/multiplicity.root", "tpc/multiplicity.root" };
- Float_t etaRange[] = {0.49, 0.9};
+ //const char* fileName[] = { "spd/multiplicity.root", "tpc/multiplicity.root" };
+ const char* fileName[] = { "multiplicity.root", "multiplicity.root" };
+ Float_t etaRangeArr[] = {0.49, 0.9};
const char* titles[] = { "SPD Tracklets", "TPC Tracks" };
TCanvas* canvas = new TCanvas("EfficiencySpecies", "EfficiencySpecies", 1000, 500);
canvas->Divide(2, 1);
- for (Int_t loop=0; loop<2; ++loop)
+ TCanvas* canvas3 = new TCanvas("EfficiencySpecies_comb", "EfficiencySpecies_comb", 600, 600);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ gPad->SetRightMargin(0.05);
+ gPad->SetTopMargin(0.05);
+
+ TLegend* legends[2];
+
+ for (Int_t loop=1; loop<2; ++loop)
{
Printf("%s", fileName[loop]);
- AliCorrection* correction[4];
+ TCanvas* canvas2 = new TCanvas(Form("EfficiencySpecies_%d", loop), Form("EfficiencySpecies_%d", loop), 600, 600);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ gPad->SetRightMargin(0.05);
+ gPad->SetTopMargin(0.05);
+
+ AliCorrection* correction[8];
canvas->cd(loop+1);
gPad->SetGridx();
gPad->SetGridy();
gPad->SetRightMargin(0.05);
- //gPad->SetTopMargin(0.05);
- TLegend* legend = new TLegend(0.7, 0.4, 0.85, 0.6);
+ TLegend* legend = new TLegend(0.6, 0.4, 0.85, 0.6);
legend->SetFillColor(0);
legend->SetEntrySeparation(0.2);
+ legend->SetTextSize(gStyle->GetTextSize());
+
+ legends[loop] = new TLegend(0.4+loop*0.3, 0.2, 0.6+loop*0.3, 0.5);
+ legends[loop]->SetFillColor(0);
+ legends[loop]->SetEntrySeparation(0.2);
+ legends[loop]->SetTextSize(gStyle->GetTextSize());
+ legends[loop]->SetHeader((loop == 0) ? "SPD" : "TPC");
Float_t below = 0;
Float_t total = 0;
TString name; name.Form("correction_%d", i);
correction[i] = new AliCorrection(name, name);
correction[i]->LoadHistograms();
-
+
TH3* gene = correction[i]->GetTrackCorrection()->GetGeneratedHistogram();
TH3* meas = correction[i]->GetTrackCorrection()->GetMeasuredHistogram();
// limit vtx axis
- gene->GetXaxis()->SetRangeUser(-3.9, 3.9);
- meas->GetXaxis()->SetRangeUser(-3.9, 3.9);
+ Float_t vtxRange = 3.9;
+ gene->GetXaxis()->SetRangeUser(-vtxRange, vtxRange);
+ meas->GetXaxis()->SetRangeUser(-vtxRange, vtxRange);
// empty over/underflow bin in eta, setting range to +-2 is not enough because this is the maximum range, Project3D takes them into account then (might be a bug)
/*for (Int_t x = 1; x <= gene->GetNbinsX(); x++)
}*/
// limit eta axis
- gene->GetYaxis()->SetRangeUser(-etaRange[loop], etaRange[loop]);
- meas->GetYaxis()->SetRangeUser(-etaRange[loop], etaRange[loop]);
+ Float_t etaBegin = -etaRangeArr[loop];
+ Float_t etaEnd = etaRangeArr[loop];
+ //etaBegin = 0.01;
+ //etaEnd = -0.01;
+ gene->GetYaxis()->SetRangeUser(etaBegin, etaEnd);
+ meas->GetYaxis()->SetRangeUser(etaBegin, etaEnd);
TH1* genePt = gene->Project3D(Form("z_%d", i));
TH1* measPt = meas->Project3D(Form("z_%d", i));
genePt->Sumw2();
measPt->Sumw2();
-
+
+ for (Int_t x=0; x<=genePt->GetNbinsX()+1; x++)
+ {
+ genePt->SetBinError(x, TMath::Sqrt(genePt->GetBinContent(x)));
+ measPt->SetBinError(x, TMath::Sqrt(measPt->GetBinContent(x)));
+ }
+
sumGen += genePt->Integral();
sumMeas += measPt->Integral();
below += genePt->Integral(1, bin);
total += genePt->Integral();
-
+
effPt->SetLineColor(color[i]);
effPt->SetMarkerColor(color[i]);
effPt->SetMarkerStyle(marker[i]);
+ effPt->SetMarkerSize(2);
- effPt->GetXaxis()->SetRangeUser(0.06, 1);
- effPt->GetYaxis()->SetRangeUser(0, 1);
+ effPt->GetXaxis()->SetRangeUser(0, 1);
+ effPt->GetYaxis()->SetRangeUser(0.001, 1);
effPt->GetXaxis()->SetTitleOffset(1.1);
effPt->GetYaxis()->SetTitleOffset(1.2);
+
+ effPt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
effPt->SetStats(kFALSE);
effPt->SetTitle(titles[loop]);
effPt->GetYaxis()->SetTitle("Efficiency");
+ canvas->cd(loop+1);
+ effPt->DrawCopy((i == 0) ? "" : "SAME");
+
+ canvas2->cd();
+ effPt->SetTitle("");
effPt->DrawCopy((i == 0) ? "" : "SAME");
+
+ canvas3->cd();
+ effPtClone = (TH1*) effPt->Clone("effPtClone");
+ effPtClone->SetMarkerStyle(marker[i]-4*loop);
+ effPtClone->DrawCopy((i == 0 && loop == 0) ? "" : "SAME");
+
+ legend->AddEntry(effPt, ((i == 0) ? "#pi^{#pm}" : ((i == 1) ? "K^{#pm}" : "p,#bar{p}")), "P");
+ legends[loop]->AddEntry(effPtClone, ((i == 0) ? "#pi^{#pm}" : ((i == 1) ? "K^{#pm}" : "p,#bar{p}")), "P");
+ //legend2->AddEntry(effPt, Form("%s %s", (loop == 0) ? "SPD" : "TPC", ((i == 0) ? "#pi^{#pm}" : ((i == 1) ? "K^{#pm}" : "p,#bar{p}"))), "P");
- legend->AddEntry(effPt, ((i == 0) ? "#pi^{#pm}" : ((i == 1) ? "K^{#pm}" : "p,#bar{p}")));
+ if (addDecayStopped)
+ {
+ name.Form("correction_%d", i+4);
+ corr = new AliCorrection(name, name);
+ corr->LoadHistograms();
+
+ TH3* gene = corr->GetTrackCorrection()->GetGeneratedHistogram();
+ TH3* meas = corr->GetTrackCorrection()->GetMeasuredHistogram();
+
+ // limit axes
+ gene->GetXaxis()->SetRangeUser(-vtxRange, vtxRange);
+ meas->GetXaxis()->SetRangeUser(-vtxRange, vtxRange);
+ gene->GetYaxis()->SetRangeUser(-etaRangeArr[loop], etaRangeArr[loop]);
+ meas->GetYaxis()->SetRangeUser(-etaRangeArr[loop], etaRangeArr[loop]);
+
+ TH1* decayed = gene->Project3D(Form("z_%d", i+4));
+ TH1* stopped = meas->Project3D(Form("z_%d", i+4));
+
+ Printf("%d: %d decayed, %d stopped, out of %d", i, (Int_t) decayed->Integral(), (Int_t) stopped->Integral(), (Int_t) genePt->Integral());
+
+ decayed->Divide(decayed, genePt, 1, 1, "B");
+ stopped->Divide(stopped, genePt, 1, 1, "B");
+
+ decayed->SetMarkerStyle(20);
+ stopped->SetMarkerStyle(21);
+ stopped->SetMarkerColor(2);
+
+ new TCanvas(Form("all_%d_%d", loop, i), Form("all_%d_%d", loop, i), 600, 600);
+ effPt->DrawCopy();
+ decayed->DrawCopy("SAME");
+ stopped->DrawCopy("SAME");
+
+ decayed->Add(stopped);
+ decayed->Add(effPt);
+ decayed->SetMarkerStyle(22);
+ decayed->SetMarkerColor(4);
+ decayed->DrawCopy("SAME");
+ }
+
}
Printf("In total %.4f of the particles are below their effective pt cut off", (Float_t) below / total);
Printf("%f measured, %f generated, effiency: %f", sumGen, sumMeas, sumMeas / sumGen);
+ canvas->cd(loop+1);
+ legend->Draw();
+
+ canvas2->cd();
legend->Draw();
+ canvas2->SaveAs(Form("%s.eps", canvas2->GetName()));
}
+ canvas->cd();
canvas->SaveAs(Form("%s.eps", canvas->GetName()));
+
+ canvas3->cd();
+ legends[0]->Draw();
+ legends[1]->Draw();
+ canvas3->SaveAs(Form("%s.eps", canvas3->GetName()));
}
-void ParticleSpeciesComparison1(Bool_t chi2 = kTRUE, const char* fileNameMC = "multiplicityMC_400k_syst_species.root", const char* fileNameESD = "multiplicityMC_100k_syst.root")
+void DrawpTCutOff()
{
- gSystem->Load("libPWG0base");
-
- TFile::Open(fileNameESD);
- TH2F* hist = (TH2F*) gFile->Get(Form("Multiplicity/fMultiplicityESD%d", etaRange));
- TH2F* hist2 = (TH2F*) gFile->Get(Form("Multiplicity/fMultiplicityVtx%d", etaRange));
+/*
+aliroot -b -q $ALICE_ROOT/PWG0/multiplicity/correct.C'("multiplicityMC_pt_ref.root", "Multiplicity", "multiplicityESD.root", kTRUE)'
+mv unfolded.root chi2_ptref.root
+aliroot -b -q $ALICE_ROOT/PWG0/multiplicity/correct.C'("multiplicityMC_pt0.root", "Multiplicity", "multiplicityESD.root", kTRUE)'
+mv unfolded.root chi2_pt0.root
+aliroot -b -q $ALICE_ROOT/PWG0/multiplicity/correct.C'("multiplicityMC_pt1.root", "Multiplicity", "multiplicityESD.root", kTRUE)'
+mv unfolded.root chi2_pt1.root
+aliroot -b -q $ALICE_ROOT/PWG0/multiplicity/correct.C'("multiplicityMC_pt0_25.root", "Multiplicity", "multiplicityESD.root", kTRUE)'
+mv unfolded.root chi2_pt0_25.root
+aliroot -b -q $ALICE_ROOT/PWG0/multiplicity/correct.C'("multiplicityMC_pt1_25.root", "Multiplicity", "multiplicityESD.root", kTRUE)'
+mv unfolded.root chi2_pt1_25.root
+*/
+ loadlibs();
+
TH1* results[10];
-
- // loop over cases (normal, enhanced/reduced ratios)
- Int_t nMax = 7;
+ const char* files[] = { "chi2_ptref.root", "chi2_pt0.root", "chi2_pt1.root", "chi2_pt0_25.root", "chi2_pt1_25.root"};
+
+ Int_t nMax = 5;
for (Int_t i = 0; i<nMax; ++i)
{
- TString folder;
- folder.Form("Multiplicity_%d", i);
-
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection(folder, folder);
-
- TFile::Open(fileNameMC);
- mult->LoadHistograms();
-
- mult->SetMultiplicityESD(etaRange, hist);
-
- if (chi2)
- {
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 1e4);
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, kFALSE);
- //mult->DrawComparison(Form("ParticleSpeciesComparison_MinuitChi2_%d", i), etaRange, kFALSE, kTRUE, hist2->ProjectionY("mymchist"));
- }
- else
- {
- mult->ApplyBayesianMethod(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, 1, 100);
- //mult->DrawComparison(Form("ParticleSpeciesComparison_Bayesian_%d", i), etaRange, kFALSE, kTRUE, hist2->ProjectionY("mymchist2"));
- }
+ AliMultiplicityCorrection* mult = AliMultiplicityCorrection::Open(files[i]);
+ results[i] = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone(Form("result_%d", i));
+ }
+
+ const char* legendStrings[] = { "Reduced 50%", "Enhanced 50%", "Reduced 25%", "Enhanced 25%" };
+ DrawRatio(results[0], nMax-1, results+1, "LowMomentumSyst.eps", kFALSE, legendStrings);
+}
- //Float_t averageRatio = 0;
- //mult->GetComparisonResults(0, 0, 0, &averageRatio);
+void ParticleSpeciesComparison()
+{
+ loadlibs();
+ TH1* results[10];
+ TH1* mc = 0;
+
+ // loop over cases (normal, enhanced/reduced ratios)
+ Int_t nMax = 9;
+ for (Int_t i = 0; i<nMax; ++i)
+ {
+ AliMultiplicityCorrection* mult = AliMultiplicityCorrection::Open(Form("chi2_species_%d.root", i), Form("Multiplicity_%d", i));
+ if (i == 0)
+ mc = mult->GetMultiplicityVtx(etaRange)->ProjectionY("mymchist", 1, 1);
results[i] = (TH1*) mult->GetMultiplicityESDCorrected(etaRange)->Clone(Form("result_%d", i));
-
- //Printf("Case %d. Average ratio is %f", i, averageRatio);
}
- DrawResultRatio(hist2->ProjectionY("mymchist", -1, -1, "e"), results[0], "ParticleSpeciesComparison1_1.eps");
-
- TH1* mc = hist2->ProjectionY("mymchist2", -1, -1, "e");
+ DrawResultRatio(mc, results[0], "ParticleSpeciesComparison1_1.eps");
for (Int_t i=1; i<=results[0]->GetNbinsX(); i++)
{
mc->SetBinError(i, 0);
}
- const char* legendStrings[] = { "#pi^{#pm}", 0, "K^{#pm}", 0, "p,#bar{p}", 0 };
+ const char* legendStrings[] = { "K #times 0.5", "K #times 1.5", "p #times 0.5", "p #times 1.5", "K #times 0.5, p #times 0.5", "K #times 1.5, p #times 1.5", "K #times 0.5, p #times 1.5", "K #times 1.5, p #times 0.5" };
DrawRatio(results[0], nMax-1, results+1, "ParticleSpeciesComparison1_2.eps", kFALSE, legendStrings);
// plots the correction performed on the unfolded spectrum to gain the spectrum for the full inelastic sample
//
- gSystem->Load("libPWG0base");
+ loadlibs();
TFile::Open(correctionFile);
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
mult->LoadHistograms("Multiplicity");
TH1* corrINEL = Invert(mult->GetEfficiency(etaRange, AliMultiplicityCorrection::kINEL));
+ TH1* corrNSD = Invert(mult->GetEfficiency(etaRange, AliMultiplicityCorrection::kNSD));
TH1* corrMB = Invert(mult->GetEfficiency(etaRange, AliMultiplicityCorrection::kMB));
- TCanvas* canvas = new TCanvas("TriggerVertexCorrection", "TriggerVertexCorrection", 800, 600);
+ TCanvas* canvas = new TCanvas("TriggerVertexCorrection", "TriggerVertexCorrection", 800, 500);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
corrINEL->SetStats(kFALSE);
- corrINEL->GetXaxis()->SetRangeUser(0, 20);
- corrINEL->GetYaxis()->SetRangeUser(0.5, 2.5);
- corrINEL->SetTitle(";true multiplicity;correction factor");
+ corrINEL->GetXaxis()->SetRangeUser(0, 12);
+ corrINEL->GetYaxis()->SetRangeUser(0, 8);
+ corrINEL->SetTitle(Form(";%s;Correction factor", GetMultLabel()));
corrINEL->SetMarkerStyle(22);
corrINEL->Draw("PE");
corrMB->SetMarkerStyle(25);
corrMB->SetMarkerColor(2);
corrMB->Draw("SAME PE");
+
+ corrNSD->SetLineColor(4);
+ corrNSD->SetMarkerStyle(24);
+ corrNSD->SetMarkerColor(4);
+ corrNSD->Draw("SAME PE");
+
+ Printf(" MB INEL NSD");
+ Printf("bin 0: %f %f %f", corrMB->GetBinContent(1), corrINEL->GetBinContent(1), corrNSD->GetBinContent(1));
+ Printf("bin 1: %f %f %f", corrMB->GetBinContent(2), corrINEL->GetBinContent(2), corrNSD->GetBinContent(2));
- TLegend* legend = new TLegend(0.3, 0.5, 0.85, 0.65);
+ TLegend* legend = new TLegend(0.3, 0.6, 0.85, 0.85);
legend->SetFillColor(0);
- legend->AddEntry(corrINEL, "correction to inelastic sample");
- legend->AddEntry(corrMB, "correction to minimum bias sample");
+ legend->AddEntry(corrINEL, "Correction to inelastic sample");
+ legend->AddEntry(corrNSD, "Correction to NSD sample");
+ legend->AddEntry(corrMB, "Correction to triggered sample");
+ legend->SetTextSize(0.04);
legend->Draw();
void StatisticalUncertainty(Int_t methodType, Bool_t mc = kFALSE)
{
- gSystem->Load("libPWG0base");
+ loadlibs();
TFile::Open(correctionFile);
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
+ TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc", 1, 1);
+ mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol0, 1e5);
+
+ TH1* errorMeasured = (TH1*) mult->StatisticalUncertainty((AliMultiplicityCorrection::MethodType) methodType, etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, kTRUE, kFALSE, ((mc) ? mcHist : 0))->Clone("errorMeasured");
+
+ return;
+
TH1* errorResponse = (TH1*) mult->StatisticalUncertainty((AliMultiplicityCorrection::MethodType) methodType, etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, kFALSE, kTRUE, ((mc) ? mcHist : 0))->Clone("errorResponse");
- TH1* errorMeasured = (TH1*) mult->StatisticalUncertainty((AliMultiplicityCorrection::MethodType) methodType, etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, kTRUE, kFALSE, ((mc) ? mcHist : 0))->Clone("errorMeasured");
TH1* errorBoth = (TH1*) mult->StatisticalUncertainty((AliMultiplicityCorrection::MethodType) methodType, etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, kTRUE, kTRUE, ((mc) ? mcHist : 0))->Clone("errorBoth");
if (!mc)
DrawResultRatio(mcHist, result, "StatisticalUncertainty2.eps");
}
+ TFile* file = new TFile(Form("StatisticalUncertaintySPD%s.root", (methodType == 0) ? "Chi2" : "Bayesian"), "RECREATE");
+ errorResponse->Write();
+ errorMeasured->Write();
+ errorBoth->Write();
+ file->Close();
+}
+
+void DrawStatisticalUncertainty()
+{
+ TFile::Open("StatisticalUncertainty.root");
+
+ errorResponse = (TH1*) gFile->Get("errorResponse");
+ errorMeasured = (TH1*) gFile->Get("errorMeasured");
+ errorBoth = (TH1*) gFile->Get("errorBoth");
+
TCanvas* canvas = new TCanvas("StatisticalUncertainty", "StatisticalUncertainty", 600, 400);
canvas->SetGridx();
canvas->SetGridy();
canvas->SetTopMargin(0.05);
errorResponse->SetLineColor(1);
- errorResponse->GetXaxis()->SetRangeUser(0, 200);
+ errorResponse->GetXaxis()->SetRangeUser(0, longDisplayRange);
errorResponse->GetYaxis()->SetRangeUser(0, 0.3);
errorResponse->SetStats(kFALSE);
errorResponse->SetTitle(";true multiplicity;Uncertainty");
errorBoth->SetLineColor(4);
errorBoth->Draw("SAME");
- Printf("Average errorResponse: %f", errorResponse->Integral(2, 150) / 149);
- Printf("Average errorMeasured: %f", errorMeasured->Integral(2, 150) / 149);
- Printf("Average errorBoth: %f", errorBoth->Integral(2, 150) / 149);
+ Printf("Average errorResponse: %f", errorResponse->Integral(2, displayRange) / (displayRange - 1));
+ Printf("Average errorMeasured: %f", errorMeasured->Integral(2, displayRange) / (displayRange - 1));
+ Printf("Average errorBoth: %f", errorBoth->Integral(2, displayRange) / (displayRange - 1));
canvas->SaveAs(Form("%s.eps", canvas->GetName()));
-
- TFile* file = new TFile(Form("%s.root", canvas->GetName()), "RECREATE");
- errorResponse->Write();
- errorMeasured->Write();
- errorBoth->Write();
- file->Close();
}
void StatisticalUncertaintyCompare(const char* det = "SPD")
TString str;
str.Form("StatisticalUncertaintyCompare%s", det);
- TCanvas* canvas = new TCanvas(str, str, 600, 400);
+ TCanvas* canvas = new TCanvas(str, str, 800, 500);
canvas->SetGridx();
canvas->SetGridy();
canvas->SetRightMargin(0.05);
canvas->SetTopMargin(0.05);
+
+ errorResponse->Scale(1.0 / sqrt(2));
+ errorMeasured->Scale(1.0 / sqrt(2));
+ errorBoth->Scale(1.0 / sqrt(2));
errorResponse->SetLineColor(1);
- errorResponse->GetXaxis()->SetRangeUser(1, (strcmp(det, "TPC") ? 200 : 100));
- errorResponse->GetYaxis()->SetRangeUser(0, 0.3);
+ errorResponse->GetXaxis()->SetRangeUser(0, displayRange);
+ errorResponse->GetYaxis()->SetRangeUser(0, 0.18);
errorResponse->SetStats(kFALSE);
errorResponse->GetYaxis()->SetTitleOffset(1.2);
- errorResponse->SetTitle(";true multiplicity;#sigma(U-T)/T");
+ errorResponse->SetTitle(Form(";%s;#sqrt{2}^{-1} #sigma(unfolded - unfolded_{0}) / unfolded_{0}", GetMultLabel()));
errorResponse->Draw();
errorBoth->Draw("SAME");
TFile* file2 = TFile::Open(Form("StatisticalUncertainty%sChi2.root", det));
+ TH1* errorResponse2 = (TH1*) file2->Get("errorResponse");
+ TH1* errorMeasured2 = (TH1*) file2->Get("errorMeasured");
TH1* errorBoth2 = (TH1*) file2->Get("errorBoth");
+ errorResponse2->Scale(1.0 / sqrt(2));
+ errorMeasured2->Scale(1.0 / sqrt(2));
+ errorBoth2->Scale(1.0 / sqrt(2));
+
+ errorResponse2->SetLineStyle(2);
+ errorResponse2->Draw("SAME");
+
+ errorMeasured2->SetLineColor(2);
+ errorMeasured2->SetLineStyle(2);
+ errorMeasured2->Draw("SAME");
+
errorBoth2->SetLineColor(4);
errorBoth2->SetLineStyle(2);
errorBoth2->Draw("SAME");
- TLegend* legend = new TLegend(0.2, 0.6, 0.6, 0.9);
+ TLegend* legend = new TLegend(0.2, 0.5, 0.8, 0.9);
legend->SetFillColor(0);
- legend->AddEntry(errorResponse, "response matrix (Bayesian)");
- legend->AddEntry(errorMeasured, "measured (Bayesian)");
- legend->AddEntry(errorBoth, "both (Bayesian)");
- legend->AddEntry(errorBoth2, "both (#chi^{2} minimization)");
+ legend->SetTextSize(0.04);
+ legend->AddEntry(errorBoth, "Both (Bayesian unfolding)");
+ legend->AddEntry(errorMeasured, "Measured (Bayesian unfolding)");
+ legend->AddEntry(errorResponse, "Response matrix (Bayesian unfolding)");
+ legend->AddEntry(errorBoth2, "Both (#chi^{2}-minimization)");
+ legend->AddEntry(errorMeasured2, "Measured (#chi^{2}-minimization)");
+ legend->AddEntry(errorResponse2, "Response matrix (#chi^{2}-minimization)");
legend->Draw();
canvas->SaveAs(Form("%s.eps", canvas->GetName()));
void EfficiencyComparison(Int_t eventType = 2, Bool_t uncertainty = kTRUE)
{
- const char* files[] = { "multiplicityMC_400k_syst_nd.root", "multiplicityMC_400k_syst_sd.root", "multiplicityMC_400k_syst_dd.root", "multiplicityMC_400k_syst_xsection.root" };
+ const char* files[] = { "multiplicityMC_nd.root", "multiplicityMC_sd.root", "multiplicityMC_dd.root", "multiplicityMC_xsection.root" };
- gSystem->Load("libPWG0base");
+ loadlibs();
TCanvas* canvas = new TCanvas("EfficiencyComparison", "EfficiencyComparison", 800, 500);
canvas->SetGridx();
AliMultiplicityCorrection* data[4];
TH1* effArray[4];
+ TH1* effErrorArray[2];
Int_t markers[] = { 24, 25, 26, 5 };
- Int_t colors[] = { 1, 2, 3, 4 };
+ //Int_t markers[] = { 2, 25, 24, 5 };
+ Int_t colors[] = { 1, 2, 4, 6 };
+ //Int_t colors[] = { 1, 1, 1, 1 };
- TLegend* legend = new TLegend(0.45, 0.45, 0.9, 0.7);
+ //TLegend* legend = new TLegend(0.45, 0.45, 0.9, 0.7);
+ TLegend* legend = new TLegend(0.3, 0.3, 0.9, 0.6);
+ legend->SetTextSize(0.04);
legend->SetFillColor(0);
-
- TH1* effError = 0;
-
+
for (Int_t i=0; i<4; ++i)
{
TString name;
else
data[i]->LoadHistograms("Multiplicity_0");
- TH1* eff = (TH1*) data[i]->GetEfficiency(etaRange, (AliMultiplicityCorrection::EventType) eventType)->Clone(Form("eff_%d", i));
+ TH1* eff = 0;
+ if (eventType == -1)
+ {
+ eff = (TH1*) data[i]->GetTriggerEfficiency(etaRange)->Clone(Form("eff_%d", i));
+ }
+ else
+ eff = (TH1*) data[i]->GetEfficiency(etaRange, (AliMultiplicityCorrection::EventType) eventType)->Clone(Form("eff_%d", i));
effArray[i] = eff;
eff->GetXaxis()->SetRangeUser(0, 15);
- eff->GetYaxis()->SetRangeUser(0, 1.1);
+ eff->GetYaxis()->SetRangeUser(0, 1.19);
eff->SetStats(kFALSE);
- eff->SetTitle(";true multiplicity;Efficiency");
+ eff->GetXaxis()->SetTitle(GetMultLabel());
+ eff->GetYaxis()->SetTitle("Efficiency");
+ eff->SetTitle("");
eff->SetLineColor(colors[i]);
eff->SetMarkerColor(colors[i]);
eff->SetMarkerStyle(markers[i]);
if (i == 3)
{
- for (Int_t bin=1; bin<=eff->GetNbinsX(); bin++)
- eff->SetBinError(bin, 0);
-
- // loop over cross section combinations
- for (Int_t j=1; j<7; ++j)
+ // once for INEL, once for NSD
+ for (AliMultiplicityCorrection::EventType eventType2 = AliMultiplicityCorrection::kINEL; eventType2 <= AliMultiplicityCorrection::kNSD; eventType2++)
{
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multtmp", "Multtmp");
- mult->LoadHistograms(Form("Multiplicity_%d", j));
-
- TH1* eff2 = mult->GetEfficiency(etaRange, (AliMultiplicityCorrection::EventType) eventType);
-
- for (Int_t bin=1; bin<=eff->GetNbinsX(); bin++)
+ effDiff = (TH1*) data[i]->GetEfficiency(etaRange, eventType2)->Clone(Form("effDiff_%d", i));
+
+ for (Int_t bin=1; bin<=effDiff->GetNbinsX(); bin++)
+ effDiff->SetBinError(bin, 0);
+
+ // loop over cross section combinations
+ for (Int_t j=1; j<7; ++j)
{
- // TODO we could also do asymmetric errors here
- Float_t deviation = TMath::Abs(eff->GetBinContent(bin) - eff2->GetBinContent(bin));
-
- eff->SetBinError(bin, TMath::Max(eff->GetBinError(bin), (Double_t) deviation));
+ AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multtmp", "Multtmp");
+ mult->LoadHistograms(Form("Multiplicity_%d", j));
+
+ TH1* eff2 = mult->GetEfficiency(etaRange, eventType2);
+
+ for (Int_t bin=1; bin<=effDiff->GetNbinsX(); bin++)
+ {
+ // TODO we could also do asymmetric errors here
+ Float_t deviation = TMath::Abs(effDiff->GetBinContent(bin) - eff2->GetBinContent(bin));
+
+ effDiff->SetBinError(bin, TMath::Max(effDiff->GetBinError(bin), (Double_t) deviation));
+ }
+ }
+
+ for (Int_t bin=1; bin<=effDiff->GetNbinsX(); bin++)
+ {
+ //if (eventType2 == AliMultiplicityCorrection::kINEL)
+ //eff->SetBinError(bin, 0);
+ //eff->SetBinError(bin, effDiff->GetBinError(bin));
+ if (bin < 20 && effDiff->GetBinContent(bin) > 0)
+ Printf("Bin %d: Error: %.2f", bin, 100.0 * effDiff->GetBinError(bin) / effDiff->GetBinContent(bin));
+ }
+
+ if (uncertainty) {
+ TH1* effError = (TH1*) effDiff->Clone(Form("effError_%s", (eventType2 == AliMultiplicityCorrection::kINEL) ? "INEL" : "NSD"));
+ effErrorArray[eventType2 - AliMultiplicityCorrection::kINEL] = effError;
+ effError->Reset();
+
+ for (Int_t bin=1; bin<=effDiff->GetNbinsX(); bin++)
+ if (effDiff->GetBinContent(bin) > 0)
+ effError->SetBinContent(bin, 1.0 * effDiff->GetBinError(bin) / effDiff->GetBinContent(bin));
+
+ effError->SetLineColor(1);
+ effError->SetMarkerStyle(1);
+
+ if (eventType2 == AliMultiplicityCorrection::kNSD)
+ effError->SetLineStyle(2);
+
+ effError->DrawCopy("SAME HIST");
}
- }
-
- for (Int_t bin=1; bin<=20; bin++)
- if (eff->GetBinContent(bin) > 0)
- Printf("Bin %d: Error: %.2f", bin, 100.0 * eff->GetBinError(bin) / eff->GetBinContent(bin));
-
- if (uncertainty) {
- effError = (TH1*) eff->Clone("effError");
- effError->Reset();
-
- for (Int_t bin=2; bin<=eff->GetNbinsX(); bin++)
- if (eff->GetBinContent(bin) > 0)
- effError->SetBinContent(bin, 10.0 * eff->GetBinError(bin) / eff->GetBinContent(bin));
-
- effError->SetLineColor(1);
- effError->SetMarkerStyle(1);
- effError->DrawCopy("SAME HIST");
}
}
- eff->SetBinContent(1, 0);
- eff->SetBinError(1, 0);
-
canvas->cd();
if (i == 0)
{
else
eff->DrawCopy("SAME P");
- legend->AddEntry(eff, (((i == 0) ? "non diffractive" : ((i == 1) ? "single diffractive" : ((i == 2) ? "double diffractive" : "Pythia combined")))));
+ legend->AddEntry(eff, (((i == 0) ? "Non-diffractive" : ((i == 1) ? "Single-diffractive" : ((i == 2) ? "Double-diffractive" : "Pythia combined")))));
}
if (uncertainty)
- legend->AddEntry(effError, "relative syst. uncertainty #times 10");
+ {
+ legend->AddEntry(effErrorArray[0], "Relative syst. uncertainty: inelastic");
+ legend->AddEntry(effErrorArray[1], "Relative syst. uncertainty: NSD");
+
+ file = TFile::Open("uncertainty_xsection.root", "RECREATE");
+ effErrorArray[0]->Write();
+ effErrorArray[1]->Write();
+ file->Close();
+ }
legend->Draw();
void ModelDependencyPlot()
{
- gSystem->Load("libPWG0base");
+ loadlibs();
- TFile::Open("multiplicityMC_3M.root");
+ TFile::Open("multiplicityMC.root");
AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
mult->LoadHistograms("Multiplicity");
+
+ hist = mult->GetCorrelation(etaRange);
+
+ for (Int_t y=0; y<=hist->GetYaxis()->GetNbins()+1; ++y)
+ {
+ for (Int_t z=0; z<=hist->GetZaxis()->GetNbins()+1; ++z)
+ {
+ hist->SetBinContent(0, y, z, 0);
+ hist->SetBinContent(hist->GetXaxis()->GetNbins()+1, y, z, 0);
+ }
+ }
- TH2* proj = (TH2*) mult->GetCorrelation(3)->Project3D("zy");
+ TH2* proj = (TH2*) hist->Project3D("zy");
- TCanvas* canvas = new TCanvas("ModelDependencyPlot", "ModelDependencyPlot", 800, 400);
- canvas->SetGridx();
- canvas->SetGridy();
- //canvas->SetRightMargin(0.05);
- //canvas->SetTopMargin(0.05);
+ TCanvas* canvas = new TCanvas("ModelDependencyPlot", "ModelDependencyPlot", 1200, 600);
canvas->Divide(2, 1);
canvas->cd(2);
gPad->SetLogy();
+ gPad->SetGridx();
+ gPad->SetGridy();
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
Int_t selectedMult = 30;
- Int_t yMax = 200000;
+ Int_t yMax = 9e4;
TH1* full = proj->ProjectionX("full");
TH1* selected = proj->ProjectionY("selected", proj->GetXaxis()->FindBin(selectedMult), proj->GetXaxis()->FindBin(selectedMult));
full->SetStats(kFALSE);
- full->GetXaxis()->SetRangeUser(0, 200);
+ full->GetXaxis()->SetRangeUser(0, displayRange);
full->GetYaxis()->SetRangeUser(5, yMax);
- full->SetTitle(";multiplicity");
+ full->SetTitle(";Multiplicity;Entries");
selected->SetLineColor(0);
selected->SetMarkerColor(2);
- selected->SetMarkerStyle(7);
+ selected->SetMarkerStyle(5);
full->Draw();
selected->Draw("SAME P");
TLegend* legend = new TLegend(0.5, 0.65, 0.85, 0.85);
legend->SetFillColor(0);
- legend->AddEntry(full, "true");
- legend->AddEntry(selected, "measured");
+ legend->AddEntry(full, "True");
+ legend->AddEntry(selected, "Measured");
legend->Draw();
TLine* line = new TLine(selectedMult, 5, selectedMult, yMax);
canvas->cd(1);
gPad->SetLogy();
+ gPad->SetGridx();
+ gPad->SetGridy();
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
full = proj->ProjectionY("full2");
selected = proj->ProjectionX("selected2", proj->GetYaxis()->FindBin(selectedMult), proj->GetYaxis()->FindBin(selectedMult));
full->SetStats(kFALSE);
- full->GetXaxis()->SetRangeUser(0, 200);
+ full->GetXaxis()->SetRangeUser(0, displayRange);
full->GetYaxis()->SetRangeUser(5, yMax);
- full->SetTitle(";multiplicity");
+ full->SetTitle(";Multiplicity;Entries");
full->SetLineColor(0);
full->SetMarkerColor(2);
- full->SetMarkerStyle(7);
+ full->SetMarkerStyle(5);
full->Draw("P");
selected->Draw("SAME");
TFile::Open("multiplicityMC_100k_syst.root");
AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx);
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
- TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
-
- DrawResultRatio(mcHist, result, "SystematicpTSpectrum.eps");
-}
-
-// to be deleted
-/*void covMatrix(Bool_t mc = kTRUE)
-{
- gSystem->Load("libPWG0base");
-
- TFile::Open(correctionFile);
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
- mult->LoadHistograms("Multiplicity");
-
- TFile::Open(measuredFile);
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
-
- TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
-
- mult->BayesianStatisticsEffect(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx, kTRUE, kTRUE, 1, 100, ((mc) ? mcHist : 0));
-}*/
-
-Double_t FitPtFunc(Double_t *x, Double_t *par)
-{
- Double_t xx = x[0];
-
- Float_t val1 = par[1] + par[2] * xx + par[3] * xx * xx;
- Float_t val2 = TMath::Exp(par[4] + par[5] * xx);
-
- const Float_t kTransitionWidth = 0;
-
- // power law part
- if (xx < par[0] - kTransitionWidth)
- {
- return val1;
- }
- /*else if (xx < par[0] + kTransitionWidth)
- {
- // smooth transition
- Float_t factor = (xx - par[0] + kTransitionWidth) / kTransitionWidth / 2;
- return (1 - factor) * val1 + factor * val2;
- }*/
- else
- {
- return val2;
- }
-}
-
-void FitPtNew(const char* fileName = "TruePt14TeV.root")
-{
- gSystem->Load("libANALYSIS");
- gSystem->Load("libPWG0base");
-
- TFile::Open(fileName);
-
- TH1* genePt = (TH1*) gFile->Get("fHistPt");
- genePt->Sumw2();
-
- // normalize by bin width
- for (Int_t x=1; x<genePt->GetNbinsX(); x++)
- genePt->SetBinContent(x, genePt->GetBinContent(x) / genePt->GetBinWidth(x));
-
- genePt->GetXaxis()->SetRangeUser(0.05, 2.0);
-
- genePt->Scale(1.0 / genePt->Integral());
-
- TF1* func = new TF1("func", "[0]*TMath::Exp([1]*x*x)", 0.001, 100);
- //func->SetLineColor(2);
- func->SetParameters(1, -1);
-
- genePt->SetMarkerStyle(25);
- genePt->SetTitle("");
- genePt->SetStats(kFALSE);
- genePt->GetYaxis()->SetRangeUser(1e-4, genePt->GetMaximum() * 1.2);
- //func->Draw("SAME");
-
- genePt->Fit(func, "0", "", 0.05, 1);
-
- new TCanvas;
- genePt->DrawCopy("P");
- func->SetRange(0.02, 8);
- func->DrawCopy("SAME");
- gPad->SetLogy();
-}
-
-void FitPt(const char* fileName = "firstplots100k_truept.root")
-{
- gSystem->Load("libPWG0base");
-
- TFile::Open(fileName);
-
- /*
- // merge corrections
- AliCorrection* correction[4];
- TList list;
-
- for (Int_t i=0; i<4; ++i)
- {
- Printf("correction %d", i);
-
- TString name; name.Form("correction_%d", i);
- correction[i] = new AliCorrection(name, name);
- correction[i]->LoadHistograms();
-
- if (i > 0)
- list.Add(correction[i]);
- }
-
- correction[0]->Merge(&list);
-
- TH3* gene = correction[0]->GetTrackCorrection()->GetGeneratedHistogram();
-
- // limit vtx, eta axis
- gene->GetXaxis()->SetRangeUser(-5.9, 5.9);
- gene->GetYaxis()->SetRangeUser(-1.99, 0.99);
-
- TH1* genePt = gene->Project3D("z");*/
- TH1* genePt = (TH1*) gFile->Get("fdNdpTTrue");
- if (!genePt)
- genePt = (TH1*) gFile->Get("fHistPt");
-
- genePt->Sumw2();
+ mult2->LoadHistograms("Multiplicity");
- //genePt->Scale(1.0 / genePt->Integral());
+ mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
+ mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
+ mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kTrVtx);
- // normalize by bin width
- for (Int_t x=1; x<genePt->GetNbinsX(); x++)
- genePt->SetBinContent(x, genePt->GetBinContent(x) / genePt->GetBinWidth(x));
+ TH1* mcHist = mult2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc");
+ TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
- /// genePt->GetXaxis()->GetBinCenter(x));
+ DrawResultRatio(mcHist, result, "SystematicpTSpectrum.eps");
+}
- genePt->GetXaxis()->SetRangeUser(0, 7.9);
- //genePt->GetYaxis()->SetTitle("a.u.");
+void FitPt(const char* fileName)
+{
+ // needs a MC file from the dNdEta analysis
- //TF1* func = new TF1("func", "[0]*TMath::Exp([1]*x*x)", 0.001, 100);
- TF1* func = new TF1("func", "[0]*TMath::Exp([1]*x)+[2]/(1+(x*[4])**[3])", 0.001, 100);
- //func->SetLineColor(2);
- func->SetParameters(1, -1, 1, 1, 1);
- func->SetParLimits(3, 1, 10);
- func->SetParLimits(4, 0, 10);
+ TFile::Open(fileName);
- //TF1* func = new TF1("func", "[1]*x**[0]", 0.001, 100);
+ TH1* genePt = (TH1*) gFile->Get("fdNdpT");
+
+ genePt->SetTitle(";p_{T} (GeV/c);1/p_{T} dN_{ch}/dp_{T} (GeV/c)^{-2}");
+ // number of events
+ genePt->Scale(1.0 / 287800);
+ // bin width
+ genePt->Scale(1.0 / genePt->GetXaxis()->GetBinWidth(1));
+
+ genePt->GetXaxis()->SetRangeUser(0, 0.4);
- //TF1* func = new TF1("func", &FitPtFunc, 0, 2, 6);
- //func->SetParameters(0.3, -2.34909e-01, 1.54394e+01, -3.04134e+01, 1.41912e+00, -2.79284e+00);
- //func->FixParameter(0, 0.314);
- //func->SetParLimits(0, 0.1, 0.3);
+ TF1* func = new TF1("func", "[1]*x*exp(x*[0])");
+ func->SetParameters(-1, 1);
genePt->SetMarkerStyle(25);
genePt->SetTitle("");
genePt->SetStats(kFALSE);
- genePt->GetYaxis()->SetRangeUser(1e-4, genePt->GetMaximum() * 1.2);
- //func->Draw("SAME");
-
- // fit only exp. part
- func->SetParameters(1, -1);
- func->FixParameter(2, 0);
- func->FixParameter(3, 1);
- func->FixParameter(4, 1);
- genePt->Fit(func, "0", "", 0.2, 1);
-
- new TCanvas;
- genePt->DrawCopy("P");
- func->SetRange(0.02, 8);
- func->DrawCopy("SAME");
- gPad->SetLogy();
-
- // now fix exp. parameters and fit second part
- Double_t param0 = func->GetParameter(0);
- Double_t param1 = func->GetParameter(1);
- func->SetParameters(0, -1, 1, 1, 1);
- func->FixParameter(0, 0);
- func->FixParameter(1, -1);
- func->ReleaseParameter(2);
- func->ReleaseParameter(3);
- func->ReleaseParameter(4);
- func->SetParLimits(3, 1, 10);
- func->SetParLimits(4, 0, 10);
-
- genePt->Fit(func, "0", "", 1.5, 4);
-
- new TCanvas;
- genePt->DrawCopy("P");
- func->SetRange(0.02, 8);
- func->DrawCopy("SAME");
- gPad->SetLogy();
-
- // fit both
- func->SetParameter(0, param0);
- func->SetParameter(1, param1);
- func->ReleaseParameter(0);
- func->ReleaseParameter(1);
new TCanvas;
genePt->DrawCopy("P");
- func->SetRange(0.02, 5);
func->DrawCopy("SAME");
gPad->SetLogy();
- genePt->Fit(func, "0", "", 0.2, 4);
+ genePt->Fit(func, "0", "", 0, 0.25);
+ genePt->Fit(func, "0", "", 0, 0.25);
- TCanvas* canvas = new TCanvas("FitPt", "FitPt", 800, 400);
- canvas->Divide(2, 1);
- canvas->cd(1);
+ TCanvas* canvas = new TCanvas("FitPt", "FitPt", 600, 600);
gPad->SetGridx();
gPad->SetGridy();
gPad->SetRightMargin(0.05);
gPad->SetTopMargin(0.05);
- genePt->GetXaxis()->SetRangeUser(0, 4.9);
- genePt->GetYaxis()->SetRangeUser(1e-2, 1e4);
+ //genePt->GetXaxis()->SetRangeUser(0, 1);
+ genePt->GetYaxis()->SetRangeUser(2, 200);
genePt->GetYaxis()->SetTitleOffset(1.4);
genePt->GetXaxis()->SetTitleOffset(1.1);
genePt->DrawCopy("P");
- func->SetRange(0.02, 5);
- func->DrawCopy("SAME");
- gPad->SetLogy();
-
- canvas->cd(2);
-
- TH1* genePtClone = (TH1*) genePt->Clone("genePtClone");
- genePtClone->Reset();
- genePtClone->DrawCopy("P");
-
- gPad->SetGridx();
- gPad->SetGridy();
- gPad->SetLeftMargin(0.13);
- gPad->SetRightMargin(0.05);
- gPad->SetTopMargin(0.05);
-
+ //func->SetRange(0, 0.3);
func->DrawCopy("SAME");
gPad->SetLogy();
canvas->SaveAs(Form("%s.eps", canvas->GetName()));
-
+
TH1* first = (TH1*) func->GetHistogram()->Clone("first");
TCanvas* canvas2 = new TCanvas("FitPt2", "FitPt2", 600, 400);
TFile* file = TFile::Open("ptspectrum_fit.root", "RECREATE");
- for (Int_t param=0; param<5; param++)
+ for (Int_t param=0; param<2; param++)
{
for (Int_t sign=0; sign<2; sign++)
{
func2->SetParameters(func->GetParameters());
//TF1* func2 = (TF1*) func->Clone(); // SetParameter after this does not work
- Float_t factor = ((sign == 0) ? 0.9 : 1.1);
+ Float_t factor = ((sign == 0) ? 0.75 : 1.25);
func2->SetParameter(param, func2->GetParameter(param) * factor);
//func2->Print();
- canvas->cd(2);
- func2->SetLineWidth(1);
+ canvas->cd();
+ func2->SetLineWidth(2);
func2->SetLineColor(2);
+ func2->SetLineStyle(2);
func2->DrawCopy("SAME");
canvas2->cd();
TH1* second = func2->GetHistogram();
second->Divide(first);
second->SetLineColor(param + 1);
+ // set to 1 above 0.2 GeV
+ for (Int_t bin=second->GetXaxis()->FindBin(0.20001); bin<=second->GetNbinsX(); bin++)
+ second->SetBinContent(bin, 1);
second->GetYaxis()->SetRangeUser(0, 2);
second->DrawCopy((param == 0 && sign == 0) ? "" : "SAME");
second->Clone(Form("ptspectrum_%d_%d", param, sign))->Write();
Draw2ResultRatio(mcHist, result1, syst[1], "SystematicpTCutOff2.eps");
}
-TH1* SystematicsSummary(Bool_t tpc = 1)
+TH1* SystematicsSummary(Bool_t tpc = 0, Bool_t nsd = kTRUE)
{
Int_t nEffects = 7;
TH1* effects[10];
const char** names = 0;
- Int_t colors[] = { 1, 2, 3, 4, 6, 7, 8 };
+ Int_t colors[] = { 1, 2, 4, 1, 2, 4 };
+ Int_t styles[] = { 1, 2, 3, 1, 2, 3 };
+ Int_t widths[] = { 1, 1, 1, 2, 2, 2 };
Int_t markers[] = { 20, 21, 22, 23, 24, 25, 26 };
+
+ TH1* dummy = new TH2F("dummy", Form(";%s;Uncertainty", GetMultLabel()), 202, -1.5, 200.5, 100, 0, 0.4);
+ dummy->SetStats(0);
for (Int_t i=0; i<nEffects; ++i)
- effects[i] = new TH1F("SystematicsSummary", ";true multiplicity;Effect", 201, -0.5, 200.5);
+ effects[i] = new TH1F("SystematicsSummary", Form(";%s;Uncertainty", GetMultLabel()), 201, -0.5, 200.5);
if (tpc)
{
}
else
{
- displayRange = 200;
nEffects = 5;
- const char* namesSPD[] = { "Unfolding Method (#chi^{2})", "Rel. cross-section", "Particle composition", "Secondaries", "p_{t} spectrum"};
+ //const char* namesSPD[] = { "Particle composition", "p_{t} cut-off", "Unfolding Method (#chi^{2})", "Relative cross-sections (INEL)", "Relative cross-sections (NSD)"};
+ const char* namesSPD[] = { "Unfolding Method (#chi^{2})", "Relative cross-sections (INEL)", "Relative cross-sections (NSD)", "Particle composition", "p_{t} cut-off"};
names = namesSPD;
+ currentEffect = 0;
+
// method
TFile* file = TFile::Open("StatisticalUncertaintySPDChi2.root");
TH1* hist = (TH1*) file->Get("errorBoth");
+ hist->Scale(1.0 / sqrt(2));
// smooth a bit, but skip 0 bin
- effects[0]->SetBinContent(2, hist->GetBinContent(2));
- for (Int_t i=3; i<=201; ++i)
- effects[0]->SetBinContent(i, (hist->GetBinContent(i) + hist->GetBinContent(i+1)) / 2);
+ /*effects[currentEffect]->SetBinContent(1, hist->GetBinContent(1));
+ for (Int_t i=2; i<=201; ++i)
+ effects[currentEffect]->SetBinContent(i, (hist->GetBinContent(i) + hist->GetBinContent(i+1)) / 2);*/
+ effects[currentEffect] = hist;
- // relative x-section
- effects[1]->SetBinContent(2, 0.01);
- effects[1]->SetBinContent(3, 0.005);
+ currentEffect++;
+ // relative x-section
+ file = TFile::Open("uncertainty_xsection.root");
+ effects[currentEffect++] = (TH1*) file->Get("effError_INEL");
+ effects[currentEffect] = (TH1*) file->Get("effError_NSD");
+ effects[currentEffect]->SetLineStyle(1);
+ //effects[2]->SetBinContent(1, 0.20);
+ //effects[2]->SetBinContent(2, 0.01);
+ //effects[2]->SetBinContent(3, 0.002);
+
+ currentEffect++;
+
// particle composition
- for (Int_t i=2; i<=201; ++i)
+ effects[currentEffect]->SetBinContent(1, 0.16);
+ for (Int_t i=2; i<=81; ++i)
{
- if (i < 6)
- {
- effects[2]->SetBinContent(i, 0.3);
- }
- else if (i < 11)
- {
- effects[2]->SetBinContent(i, 0.05);
- }
- else if (i < 121)
- {
- effects[2]->SetBinContent(i, 0.02);
- }
- else if (i < 151)
- {
- effects[2]->SetBinContent(i, 0.02 + 0.04 / 30 * (i - 121));
- }
- else
- effects[2]->SetBinContent(i, 0.06 + 0.1 / 30 * (i - 151));
+ effects[currentEffect]->SetBinContent(i, 0.01 + 0.05 * i / 81);
}
-
- // secondaries
- for (Int_t i=2; i<=201; ++i)
- effects[3]->SetBinContent(i, 0.01);
+
+ currentEffect++;
// pt spectrum
- for (Int_t i=2; i<=201; ++i)
+ effects[currentEffect]->SetBinContent(1, 0.06);
+ effects[currentEffect]->SetBinContent(2, 0.03);
+ for (Int_t i=3; i<=81; ++i)
{
- if (i < 6)
+ if (i <= 61)
{
- effects[4]->SetBinContent(i, 1);
+ effects[currentEffect]->SetBinContent(i, 0.01);
}
- else if (i < 121)
+ else if (i <= 81)
{
- effects[4]->SetBinContent(i, 0.03);
+ effects[currentEffect]->SetBinContent(i, 0.01 + 0.05 * (i - 61) / 20);
}
- else if (i < 151)
- {
- effects[4]->SetBinContent(i, 0.03 + 0.07 / 30 * (i - 121));
- }
- else
- effects[4]->SetBinContent(i, 0.1);
}
+
+// currentEffect++;
+//
+// // material budget
+// for (Int_t i=1; i<=81; ++i)
+// {
+// if (i < 5)
+// effects[currentEffect]->SetBinContent(i, 0.05 - 0.01 * i);
+// if (i > 51)
+// effects[currentEffect]->SetBinContent(i, 0.05 * (i - 50) / 30);
+// }
+//
+ currentEffect++;
+
}
- TCanvas* canvas = new TCanvas("SystematicsSummary.eps", "SystematicsSummary.eps", 800, 400);
- canvas->SetRightMargin(0.25);
+ TCanvas* canvas = new TCanvas("SystematicsSummary.eps", "SystematicsSummary.eps", 800, 500);
+ canvas->SetRightMargin(0.05);
canvas->SetTopMargin(0.05);
- TLegend* legend = new TLegend(0.2, 0.4, 0.5, 0.4 + 0.5 * nEffects / 7);
+ //canvas->SetGridx();
+ canvas->SetGridy();
+ TLegend* legend = new TLegend(0.2, 0.4, 0.7, 0.4 + 0.5 * nEffects / 7);
legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+ dummy->Draw();
+ dummy->GetXaxis()->SetRangeUser(0, displayRange);
for (Int_t i=0; i<nEffects; ++i)
{
current->Add(effects[j]);*/
current->SetLineColor(colors[i]);
+ current->SetLineStyle(styles[i]);
+ current->SetLineWidth(widths[i]);
//current->SetFillColor(colors[i]);
current->SetMarkerColor(colors[i]);
//current->SetMarkerStyle(markers[i]);
current->SetStats(kFALSE);
current->GetYaxis()->SetRangeUser(0, 0.4);
- current->GetXaxis()->SetRangeUser(0, displayRange);
- current->DrawCopy(((i == 0) ? "" : "SAME"));
+ current->DrawCopy("SAME");
legend->AddEntry(current, names[i]);
- TLatex* text = new TLatex(displayRange+5, current->GetBinContent(displayRange+1), names[i]);
+ //TLatex* text = new TLatex(displayRange+2, current->GetBinContent(displayRange+1), names[i]);
+ TLatex* text = new TLatex(displayRange+2, 0.1 - i * 0.02, names[i]);
+ text->SetTextSize(0.04);
text->SetTextColor(colors[i]);
- text->Draw();
+ //text->Draw();
}
// add total in square
- TH1* total = (TH1*) effects[0]->Clone("total");
- total->Reset();
+ TH1* totalINEL = (TH1*) effects[0]->Clone("totalINEL");
+ totalINEL->Reset();
+ TH1* totalNSD = (TH1*) totalINEL->Clone("totalNSD");
for (Int_t i=0; i<nEffects; ++i)
{
//Printf("%d %f", i, effects[i]->GetBinContent(20));
effects[i]->Multiply(effects[i]);
- total->Add(effects[i]);
+
+ if (i != 2)
+ totalINEL->Add(effects[i]);
+ if (i != 1)
+ totalNSD->Add(effects[i]);
+ }
+
+ for (Int_t i=1; i<=totalINEL->GetNbinsX(); ++i)
+ {
+ totalINEL->SetBinError(i, 0);
+ if (totalINEL->GetBinContent(i) > 0)
+ totalINEL->SetBinContent(i, TMath::Min(sqrt(totalINEL->GetBinContent(i)), 1.0));
+ totalNSD->SetBinError(i, 0);
+ if (totalNSD->GetBinContent(i) > 0)
+ totalNSD->SetBinContent(i, TMath::Min(sqrt(totalNSD->GetBinContent(i)), 1.0));
}
-
- for (Int_t i=1; i<=total->GetNbinsX(); ++i)
- if (total->GetBinContent(i) > 0)
- total->SetBinContent(i, TMath::Min(sqrt(total->GetBinContent(i)), 1.0));
//Printf("%f", total->GetBinContent(20));
- total->SetMarkerStyle(3);
- total->SetMarkerColor(1);
- legend->AddEntry(total, "total");
- total->DrawCopy("SAME P");
+ totalINEL->SetMarkerStyle(5);
+ totalINEL->SetMarkerColor(1);
+ legend->AddEntry(totalINEL, "Total (INEL)", "P");
+
+ totalNSD->SetMarkerStyle(24);
+ totalNSD->SetMarkerColor(2);
+ legend->AddEntry(totalNSD, "Total (NSD)", "P");
+
+ Printf("total in bin 0 is INEL: %f NSD: %f", totalINEL->GetBinContent(1), totalNSD->GetBinContent(1));
+ totalINEL->DrawCopy("SAME P"); //->SetBinContent(1, 0);
+ totalNSD->DrawCopy("SAME P"); //->SetBinContent(1, 0);
legend->Draw();
canvas->SaveAs(canvas->GetName());
- return total;
+ return (nsd) ? totalNSD : totalINEL;
}
-void finalPlot(Bool_t tpc = kTRUE, Bool_t chi2 = kTRUE, Bool_t small = kFALSE)
+void finalPlot(Bool_t tpc = 0, Bool_t small = kFALSE)
{
- gSystem->Load("libPWG0base");
+ loadlibs();
if (tpc)
SetTPC();
- if (!chi2)
- Printf("WARNING: Bayesian set. This is only for test!");
-
- // systematic error
- TH1* error = SystematicsSummary(tpc);
-
- TFile::Open(correctionFile);
- AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
- mult->LoadHistograms("Multiplicity");
-
- TFile::Open(measuredFile);
- AliMultiplicityCorrection* mult2 = new AliMultiplicityCorrection("Multiplicity2", "Multiplicity2");
- mult2->LoadHistograms("Multiplicity");
-
- mult->SetMultiplicityESD(etaRange, mult2->GetMultiplicityESD(etaRange));
-
- if (chi2)
- {
- mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol1, 10000);
- mult->ApplyMinuitFit(etaRange, kFALSE, AliMultiplicityCorrection::kINEL);
- }
- else
- mult->ApplyBayesianMethod(etaRange, kFALSE, AliMultiplicityCorrection::kINEL, 1, 100, 0, kFALSE);
-
- TH1* mcHist = mult2->GetMultiplicityINEL(etaRange)->ProjectionY("mymc");
- TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
-
- DrawResultRatio(mcHist, result, "finalPlotCheck.eps");
-
- // normalize result
- result->Scale(1.0 / result->Integral(2, 200));
-
- result->GetXaxis()->SetRangeUser(0, ((tpc) ? displayRange : 200));
- result->SetBinContent(1, 0); result->SetBinError(1, 0);
- result->SetTitle(";true multiplicity;Probability");
- result->SetLineColor(1);
- result->SetStats(kFALSE);
-
- TH1* systError = (TH1*) result->Clone("systError");
- for (Int_t i=2; i<=systError->GetNbinsX(); ++i)
- systError->SetBinError(i, systError->GetBinContent(i) * error->GetBinContent(i));
-
- // change error drawing style
- systError->SetFillColor(15);
+ //TH1* errorNSD = SystematicsSummary(tpc, 1);
- TCanvas* canvas = new TCanvas("finalPlot.eps", "finalPlot.eps", (small) ? 600 : 800, 400);
+ TCanvas* canvas = new TCanvas("finalPlot.eps", "finalPlot.eps", (small) ? 600 : 800, 500);
canvas->SetRightMargin(0.05);
canvas->SetTopMargin(0.05);
+ canvas->SetGridx();
+ canvas->SetGridy();
+
+ legend = new TLegend(0.5, 0.6, 0.9, 0.8);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+
+ for (AliMultiplicityCorrection::EventType eventType = AliMultiplicityCorrection::kINEL; eventType <= AliMultiplicityCorrection::kNSD; eventType++)
+ {
+ AliMultiplicityCorrection* mult = AliMultiplicityCorrection::Open((eventType == AliMultiplicityCorrection::kINEL) ? "chi2_inel.root" : "chi2_nsd.root");
+ TH1* mcHist = mult->GetMultiplicityMC(etaRange, eventType)->ProjectionY("mymc");
+ TH1* result = mult->GetMultiplicityESDCorrected(etaRange);
+
+ DrawResultRatio(mcHist, result, Form("finalPlotCheck_%d.eps", (Int_t) eventType));
- systError->Draw("E2 ][");
- result->DrawCopy("SAME E ][");
- canvas->SetLogy();
-
+ // normalize result
+ //result->Scale(1.0 / result->Integral(2, displayRange));
+
+ result->GetXaxis()->SetRangeUser(0, displayRange);
+ //result->SetBinContent(1, 0); result->SetBinError(1, 0);
+ result->SetTitle(Form(";True multiplicity in |#eta| < %.1f;Entries", (etaRange+1) * 0.5));
+ result->SetMarkerStyle(0);
+ result->SetLineColor(1);
+ result->SetStats(kFALSE);
+
+ // systematic error
+ TH1* error = SystematicsSummary(tpc, (eventType == AliMultiplicityCorrection::kNSD));
+
+ TH1* systError = (TH1*) result->Clone("systError");
+ for (Int_t i=1; i<=systError->GetNbinsX(); ++i)
+ systError->SetBinError(i, systError->GetBinContent(i) * error->GetBinContent(i));
+
+ // change error drawing style
+ systError->SetFillColor(15);
+
+ if (eventType == AliMultiplicityCorrection::kNSD)
+ {
+ result->SetLineColor(2);
+ result->SetMarkerColor(2);
+ result->SetMarkerStyle(5);
+ }
+
+ canvas->cd();
+ systError->DrawCopy(Form("E2 ][ %s", (eventType == AliMultiplicityCorrection::kINEL) ? "" : "SAME"));
+ result->DrawCopy("SAME E ][");
+ canvas->SetLogy();
+
+ legend->AddEntry(result, (eventType == AliMultiplicityCorrection::kINEL) ? "Inelastic cross-section" : "NSD cross-section", (eventType == AliMultiplicityCorrection::kINEL) ? "L" : "P");
+ }
+
+ legend->Draw();
+ /*
//TPaveText* text = new TPaveText(10, 1e-3, 50, 1e-4, "B");
TPaveText* text = new TPaveText(0.15, 0.2, 0.5, 0.4, "B NDC");
text->SetFillColor(0);
text2->AddText("|#eta| < 2.0");
text2->AddText("simulated data (PYTHIA)");
text2->Draw("B");
-
+
if (tpc)
{
TText* text3 = new TText(0.75, 0.6, "TPC - full tracking");
img->Draw();
canvas->Modified();
+ */
/* TText* text = new TText(10, 1e-4, "Systematic errors summed quadratically");
text->SetTextSize(0.04);
canvas->SaveAs(canvas->GetName());
}
+TMatrixD* NonInvertable()
+{
+ const Int_t kSize = 5;
+
+ TMatrixD matrix(kSize, kSize);
+ for (Int_t x=0; x<kSize; x++)
+ {
+ for (Int_t y=0; y<kSize; y++)
+ {
+ if (x == y)
+ {
+ if (x == 0 || x == kSize -1)
+ {
+ matrix(x, y) = 0.75;
+ }
+ else
+ matrix(x, y) = 0.5;
+ }
+ else if (TMath::Abs(x - y) == 1)
+ {
+ matrix(x, y) = 0.25;
+ }
+ }
+ }
+
+ matrix.Print();
+
+ //TMatrixD inverted(matrix);
+ //inverted.Invert();
+
+ //inverted.Print();
+
+ return new TMatrixD(matrix);
+}
+
void BlobelUnfoldingExample()
{
const Int_t kSize = 20;
//inverted.Print();
- TH1F* inputDist = new TH1F("inputDist", ";t;#tilde{T}(t)", kSize, -0.5, (Float_t) kSize - 0.5);
+ TH1F* inputDist = new TH1F("inputDist", ";t;Entries", kSize, -0.5, (Float_t) kSize - 0.5);
TVectorD inputDistVector(kSize);
TH1F* unfolded = inputDist->Clone("unfolded");
TH1F* measuredIdealDist = inputDist->Clone("measuredIdealDist");
- measuredIdealDist->SetTitle(";m;#tilde{M}(m)");
+ measuredIdealDist->SetTitle(";m;Entries");
TH1F* measuredDist = measuredIdealDist->Clone("measuredDist");
TF1* gaus = new TF1("func", "gaus(0)", -0.5, kSize);
for (Int_t x=1; x<=unfolded->GetNbinsX(); x++)
unfolded->SetBinContent(x, unfoldedVector(x-1));
- TCanvas* canvas = new TCanvas("BlobelUnfoldingExample", "BlobelUnfoldingExample", 1000, 500);
+ TCanvas* canvas = new TCanvas("BlobelUnfoldingExample", "BlobelUnfoldingExample", 1200, 600);
canvas->SetTopMargin(0.05);
canvas->Divide(2, 1);
canvas->cd(1);
canvas->cd(1)->SetLeftMargin(0.15);
canvas->cd(1)->SetRightMargin(0.05);
- measuredDist->GetYaxis()->SetTitleOffset(1.7);
+ canvas->cd(1)->SetTopMargin(0.05);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ measuredDist->GetYaxis()->SetRangeUser(-600, 2799);
+ measuredDist->GetYaxis()->SetTitleOffset(1.9);
measuredDist->SetStats(0);
measuredDist->DrawCopy();
gaus->Draw("SAME");
canvas->cd(2);
canvas->cd(2)->SetLeftMargin(0.15);
canvas->cd(2)->SetRightMargin(0.05);
- unfolded->GetYaxis()->SetTitleOffset(1.7);
+ canvas->cd(2)->SetTopMargin(0.05);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ unfolded->GetYaxis()->SetRangeUser(-600, 2799);
+ unfolded->GetYaxis()->SetTitleOffset(1.9);
unfolded->SetStats(0);
unfolded->DrawCopy();
gaus->Draw("SAME");
canvas->SaveAs("BlobelUnfoldingExample.eps");
+
+ return;
+
+ // now unfold this with Bayesian
+ loadlibs();
+
+ // fill a multiplicity object
+ mult = new AliMultiplicityCorrection("mult", "mult");
+ for (Int_t x=0; x<kSize; x++)
+ {
+ mult->GetMultiplicityVtx(0)->SetBinContent(1, x+1, inputDistVector(x));
+ mult->GetMultiplicityESD(0)->SetBinContent(1, x+1, measuredDistVector(x)*10000);
+ for (Int_t y=0; y<kSize; y++)
+ mult->GetCorrelation(0)->SetBinContent(1, x+1, y+1, matrix(x, y));
+ }
+
+ //mult->DrawHistograms();
+
+ mult->SetRegularizationParameters(AliMultiplicityCorrection::kPol0, 0);
+ //mult->SetCreateBigBin(kFALSE);
+ mult->ApplyMinuitFit(0, kFALSE, AliMultiplicityCorrection::kTrVtx, kFALSE); //hist2->ProjectionY("mymchist"));
+
+ //mult->ApplyBayesianMethod(0, kFALSE, AliMultiplicityCorrection::kTrVtx, 0, -1, 0, kFALSE);
+
+ mult->DrawComparison("BlobelExample", 0, kFALSE, kTRUE, mult->GetMultiplicityVtx(0)->ProjectionY("mcmchist", 1, mult->GetMultiplicityVtx(0)->GetNbinsX()));
+
+
}
void E735Fit()
TCanvas* canvas = new TCanvas("c1", "c1", 700, 400);
fCurrentESD->SetStats(kFALSE);
+ fCurrentESD->SetMarkerStyle(0);
+ fCurrentESD->SetLineColor(1);
fCurrentESD->GetYaxis()->SetTitleOffset(1.3);
fCurrentESD->SetTitle(";true multiplicity (N);P_{N}");
fCurrentESD->Draw("");
canvas->SaveAs("E735Fit.eps");
}
+
+void DifferentSamples()
+{
+ loadlibs();
+
+ Int_t n = 2;
+ const char* filesChi2[] = { "chi2_100k_1.root", "chi2_100k_2.root" };
+ const char* filesBayesian[] = { "bayesian_100k_1.root", "bayesian_100k_2.root" };
+
+ TCanvas* canvas = new TCanvas("DifferentSamples", "DifferentSamples", 1200, 600);
+ canvas->Divide(2, 1);
+
+ legend = new TLegend(0.15, 0.7, 0.65, 0.9);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+
+ for (Int_t i=0; i<n; i++)
+ {
+ AliMultiplicityCorrection* chi2 = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
+ TFile::Open(filesChi2[i]);
+ chi2->LoadHistograms("Multiplicity");
+
+ AliMultiplicityCorrection* bayesian = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
+ TFile::Open(filesBayesian[i]);
+ bayesian->LoadHistograms("Multiplicity");
+
+ chi2Hist = chi2->GetMultiplicityESDCorrected(etaRange);
+ bayesianHist = bayesian->GetMultiplicityESDCorrected(etaRange);
+
+ mc = chi2->GetMultiplicityVtx(etaRange)->ProjectionY("mymc", 1, 1);
+
+ // normalize and divide
+ chi2Hist->Scale(1.0 / chi2Hist->Integral(2, displayRange+1) * mc->Integral(2, displayRange));
+ bayesianHist->Scale(1.0 / bayesianHist->Integral(2, displayRange+1) * mc->Integral(2, displayRange));
+
+ chi2Hist->Divide(mc, chi2Hist);
+ bayesianHist->Divide(mc, bayesianHist);
+
+ canvas->cd(i+1);
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
+ //gPad->SetLeftMargin(0.12);
+ gPad->SetGridx();
+ gPad->SetGridy();
+
+ chi2Hist->GetXaxis()->SetRangeUser(0, displayRange);
+ chi2Hist->GetYaxis()->SetTitleOffset(1.3);
+ chi2Hist->SetStats(0);
+ chi2Hist->SetTitle(Form(";%s;MC / unfolded", GetMultLabel()));
+ chi2Hist->GetYaxis()->SetRangeUser(0.2, 1.8);
+ chi2Hist->Draw("HIST");
+
+ for (Int_t x=1; x<=bayesianHist->GetNbinsX(); x++)
+ bayesianHist->SetBinError(x, 1e-6);
+
+ bayesianHist->SetLineColor(2);
+ bayesianHist->SetMarkerColor(2);
+ bayesianHist->SetMarkerStyle(5);
+ bayesianHist->Draw("HIST E SAME");
+
+ if (i == 0)
+ {
+ legend->AddEntry(chi2Hist, "#chi^{2}-minimization", "L");
+ legend->AddEntry(bayesianHist, "Bayesian unfolding", "LP");
+ }
+ legend->Draw();
+ }
+
+ canvas->SaveAs("DifferentSamples.eps");
+}
+
+void PileUp()
+{
+ loadlibs();
+
+ AliMultiplicityCorrection* mult = AliMultiplicityCorrection::Open("multiplicityMC.root");
+ hist2d = mult->GetMultiplicityMC(etaRange, AliMultiplicityCorrection::kINEL);
+ mult1 = hist2d->ProjectionY("mult1", 1, hist2d->GetNbinsX());
+
+ conv = (TH1*) mult1->Clone("conv");
+ conv->Reset();
+
+ mult1->Scale(1.0 / mult1->Integral());
+
+ for (Int_t i=1; i<=mult1->GetNbinsX(); i++)
+ for (Int_t j=1; j<=mult1->GetNbinsX(); j++)
+ conv->Fill(mult1->GetBinCenter(i)+mult1->GetBinCenter(j), mult1->GetBinContent(i) * mult1->GetBinContent(j));
+
+ conv->Scale(1.0 / conv->Integral());
+
+ c = new TCanvas("c", "c", 800, 500);
+ gPad->SetLogy();
+ gPad->SetTopMargin(0.05);
+ gPad->SetRightMargin(0.05);
+ mult1->SetTitle(Form(";%s;Probability", GetMultLabel()));
+ mult1->SetStats(0);
+ gPad->SetGridx();
+ gPad->SetGridy();
+ mult1->Draw();
+ mult1->GetYaxis()->SetRangeUser(1e-7, 2 * mult1->GetMaximum());
+ mult1->GetXaxis()->SetRangeUser(0, displayRange);
+ mult1->GetXaxis()->SetTitleOffset(1.15);
+ conv->SetLineColor(2);
+ conv->SetMarkerColor(2);
+ conv->SetMarkerStyle(5);
+ conv->DrawCopy("SAME P");
+
+ conv->Scale(0.00058);
+ conv->DrawCopy("SAME P");
+
+ legend = new TLegend(0.73, 0.73, 0.93, 0.93);
+ legend->SetFillColor(0);
+ legend->SetTextSize(0.04);
+ legend->AddEntry(mult1, "1 collision");
+ legend->AddEntry(conv, "2 collisions", "P");
+ legend->Draw();
+
+ c->SaveAs("pileup.eps");
+
+ new TCanvas;
+ conv->Divide(mult1);
+ conv->Draw();
+}
+
+void TestErrorDetermination(Int_t nRandomizations)
+{
+ TF1* func = new TF1("nbd", "exp(log([0]) + TMath::LnGamma([2]+x) - TMath::LnGamma([2]) - TMath::LnGamma(x+1) + log([1] / ([1]+[2])) * x + log(1.0 + [1]/[2]) * -[2])", 0, 100);
+ func->SetParNames("scaling", "averagen", "k");
+ func->SetParameters(1, 15, 2);
+
+ TF1* func2 = new TF1("nbd2", "exp(log([0]) + TMath::LnGamma([2]+x) - TMath::LnGamma([2]) - TMath::LnGamma(x+1) + log([1] / ([1]+[2])) * x + log(1.0 + [1]/[2]) * -[2])", 0, 100);
+ func2->SetParNames("scaling", "averagen", "k");
+ func2->SetParLimits(0, 0.5, 2);
+ func2->SetParLimits(1, 1, 50);
+ func2->SetParLimits(2, 1, 10);
+ func2->SetParameters(1, 15, 2);
+ //func2->FixParameter(0, 1);
+
+ //new TCanvas; func->Draw("L");
+
+ hist1 = new TH1F("hist1", "", 100, 0.5, 100.5);
+ hist2 = new TH1F("hist2", "", 100, 0.5, 100.5);
+ hist1->Sumw2();
+
+ TH1* params[3];
+ params[0] = new TH1F("param_0", Form("param_%d", 0), 100, 0.95, 1.05);
+ params[1] = new TH1F("param_1", Form("param_%d", 1), 100, 14, 16);
+ params[2] = new TH1F("param_2", Form("param_%d", 2), 100, 1.8, 2.2);
+
+ const Int_t nTries = 1000;
+ for (Int_t i=0; i<nTries; i++)
+ {
+ hist1->Reset();
+
+ if (nRandomizations == 1)
+ {
+ hist1->FillRandom("nbd", 10000);
+ }
+ else if (nRandomizations == 2)
+ {
+ hist2->Reset();
+ hist2->FillRandom("nbd", 10000);
+ hist1->FillRandom(hist2, 10000);
+ }
+ else if (nRandomizations == 3)
+ {
+ hist2->Reset();
+ hist1->FillRandom("nbd", 10000);
+ hist2->FillRandom(hist1, 10000);
+ hist1->Reset();
+ hist1->FillRandom(hist2, 10000);
+ }
+ else
+ return;
+
+ //new TCanvas; hist1->Draw();
+
+ hist1->Scale(1.0 / hist1->Integral());
+ hist1->Fit(func2, "NQ");
+ hist1->Fit(func2, "NQ");
+ for (Int_t j=0; j<3; j++)
+ params[j]->Fill(func2->GetParameter(j));
+ }
+
+ for (Int_t j=0; j<3; j++)
+ {
+ new TCanvas; params[j]->Draw();
+ params[j]->Fit("gaus");
+ Printf("sigma of param %d if %f", j, ((TF1*) params[j]->FindObject("gaus"))->GetParameter(2));
+ }
+}
+
+void DrawRawDistributions(const char* fileName = "multiplicityESD.root")
+{
+ loadlibs();
+
+ AliMultiplicityCorrection* mult = AliMultiplicityCorrection::Open(fileName);
+
+ c = new TCanvas("c", "c", 600, 600);
+
+ dummy = new TH2F("dummy", ";measured multiplicity", 100, -0.5, 149.5, 100, 0.5, 4e4);
+ dummy->SetStats(0);
+ dummy->Draw();
+ gPad->SetGridx();
+ gPad->SetGridy();
+ gPad->SetLogy();
+
+ Int_t colors[] = { 1, 2, 4 };
+
+ for (Int_t i=2; i>=0; i--)
+ {
+ hist = mult->GetMultiplicityESD(i)->ProjectionY();
+
+ hist->SetLineColor(colors[i]);
+ hist->DrawCopy("SAME");
+ }
+
+
+}
if (aProof)
{
- TProof::Open("lxb6046");
+ TProof::Open("alicecaf");
+ //gProof->SetParallel(1);
// Enable the needed package
if (1)
}
else
{
- gProof->UploadPackage("$ALICE_ROOT/AF-v4-12");
- gProof->EnablePackage("$ALICE_ROOT/AF-v4-12");
+ gProof->UploadPackage("$ALICE_ROOT/AF-v4-16");
+ gProof->EnablePackage("$ALICE_ROOT/AF-v4-16");
}
gProof->UploadPackage("$ALICE_ROOT/PWG0base");
// Create the analysis manager
mgr = new AliAnalysisManager;
- AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kTPC;
+ AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD;
AliPWG0Helper::Trigger trigger = AliPWG0Helper::kMB1;
AliPWG0Helper::PrintConf(analysisMode, trigger);
task->SetTrackCuts(esdTrackCuts);
}
+ else
+ task->SetDeltaPhiCut(0.05);
task->SetAnalysisMode(analysisMode);
task->SetTrigger(trigger);
mgr->AddTask(task);
+ TString optionStr(option);
+
if (mc) {
// Enable MC event handler
AliMCEventHandler* handler = new AliMCEventHandler;
- handler->SetReadTR(kFALSE);
+ if (!optionStr.Contains("particle-efficiency"))
+ handler->SetReadTR(kFALSE);
mgr->SetMCtruthEventHandler(handler);
}
// pt study
- TString optionStr(option);
if (optionStr.Contains("pt-spectrum-func"))
{
- //TF1* func = new TF1("func", "0.7 + x", 0, 0.3);
- //TF1* func = new TF1("func", "1.3 - x", 0, 0.3);
- //TF1* func = new TF1("func", "1", 0, 0.3);
+ TF1* func = new TF1("func", "1", 0, 0.2);
+ //TF1* func = new TF1("func", "1.5 - x / 0.2 * 0.5", 0, 0.2);
+ //TF1* func = new TF1("func", "1.25 - x / 0.2 * 0.25", 0, 0.2);
+ //TF1* func = new TF1("func", "0.75 + x / 0.2 * 0.25", 0, 0.2);
+ hist = func->GetHistogram();
//new TCanvas; func->Draw();
//inputList.Add(func->GetHistogram()->Clone("pt-spectrum"));
- TFile* file = TFile::Open("ptspectrum_fit.root");
- if (!file)
- {
- Printf("Could not open ptspectrum_fit.root");
- return;
- }
-
- TString subStr(optionStr(optionStr.Index("pt-spectrum-func")+17, 3));
- TString histName(Form("ptspectrum_%s", subStr.Data()));
- Printf("Pt-Spectrum modification. Using %s.", histName.Data());
- TH1* hist = (TH1*) file->Get(histName);
- if (!hist)
- {
- Printf("Could not read histogram.");
- return;
- }
-
new TCanvas; hist->Draw();
- task->SetPtSpectrum((TH1*) hist->Clone("pt-spectrum"));
+ task->SetPtSpectrum((TH1D*) hist->Clone("pt-spectrum"));
}
// Add ESD handler
AliESDInputHandler* esdH = new AliESDInputHandler;
+ esdH->SetInactiveBranches("AliESDACORDE FMD ALIESDTZERO ALIESDZDC AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks AliESDTZERO ALIESDACORDE MuonTracks TrdTracks");
mgr->SetInputEventHandler(esdH);
// Attach input
mgr->StartAnalysis("proof", data, nRuns, offset);
}
+ else if (aProof == 3)
+ {
+ gROOT->ProcessLine(".L CreateChainFromDataSet.C");
+ ds = gProof->GetDataSet(data)->GetStagedSubset();
+ chain = CreateChainFromDataSet(ds);
+ mgr->StartAnalysis("local", chain, nRuns, offset);
+ }
else
{
// Create chain of input files