]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/macros/AddTaskChaoticity.C
Error message fix
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / macros / AddTaskChaoticity.C
1 AliChaoticity *AddTaskChaoticity(
2                                  Bool_t LEGO=kTRUE, 
3                                  Bool_t MCcase=kFALSE, 
4                                  Bool_t PbPbcase=kTRUE, 
5                                  Bool_t GenerateSignal=kFALSE, 
6                                  Bool_t TabulatePairs=kFALSE, 
7                                  Int_t CentBinLowLimit=0, 
8                                  Int_t CentBinHighLimit=1,
9                                  Int_t RMax=11,
10                                  Int_t FixedLambdaBinMomRes=9,
11                                  Int_t FixedLambdaBinr3=10,
12                                  UInt_t FilterBit=7,
13                                  Float_t MaxChi2NDF=10,
14                                  Int_t MinTPCncls=0,
15                                  Float_t MinSepPairEta=0.03,
16                                  Float_t MinSepPairPhi=0.04,
17                                  Float_t SigmaCutTPC=2.0,
18                                  Float_t SigmaCutTOF=2.0,
19                                  TString StWeightName="alien:///alice/cern.ch/user/d/dgangadh/WeightFile.root",
20                                  TString StMomResName="alien:///alice/cern.ch/user/d/dgangadh/MomResFile.root",
21                                  TString StKName="alien:///alice/cern.ch/user/d/dgangadh/KFile.root"
22                                  ) {
23   
24   //===========================================================================
25   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
26   if (!mgr) {
27     ::Error("AddTaskChaoticity", "No analysis manager to connect to.");
28     return NULL;
29   }
30  
31
32   //____________________________________________//
33   // Create task
34   AliChaoticity *ChaoticityTask = new AliChaoticity("ChaoticityTask");
35   if(!ChaoticityTask) return NULL;
36   ChaoticityTask->SetLEGOCase(LEGO);
37   ChaoticityTask->SetMCdecision(MCcase);
38   ChaoticityTask->SetPbPbCase(PbPbcase);
39   ChaoticityTask->SetGenerateSignal(GenerateSignal);
40   ChaoticityTask->SetTabulatePairs(TabulatePairs);
41   ChaoticityTask->SetCentBinRange(CentBinLowLimit, CentBinHighLimit);
42   ChaoticityTask->SetRMax(RMax);
43   ChaoticityTask->SetFixedLambdaBinMomRes(FixedLambdaBinMomRes);
44   ChaoticityTask->SetFixedLambdaBinr3(FixedLambdaBinr3);
45   ChaoticityTask->SetFilterBit(FilterBit);
46   ChaoticityTask->SetMaxChi2NDF(MaxChi2NDF);
47   ChaoticityTask->SetMinTPCncls(MinTPCncls);
48   ChaoticityTask->SetPairSeparationCutEta(MinSepPairEta);
49   ChaoticityTask->SetPairSeparationCutPhi(MinSepPairPhi);
50   ChaoticityTask->SetNsigmaTPC(SigmaCutTPC);
51   ChaoticityTask->SetNsigmaTOF(SigmaCutTOF);
52   mgr->AddTask(ChaoticityTask);
53
54
55   // Create ONLY the output containers for the data produced by the task.
56   // Get and connect other common input/output containers via the manager as below
57   //==============================================================================
58   TString outputFileName = AliAnalysisManager::GetCommonFileName();
59   outputFileName += ":PWGCF.outputChaoticityAnalysis.root";
60   AliAnalysisDataContainer *coutChaoticity = mgr->CreateContainer("ChaoticityOutput", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
61   mgr->ConnectInput(ChaoticityTask, 0, mgr->GetCommonInputContainer());
62   mgr->ConnectOutput(ChaoticityTask, 1, coutChaoticity);
63   
64
65   TFile *inputFileWeight = 0;
66   TFile *inputFileMomRes = 0;
67   TFile *inputFileFSI = 0;
68
69  
70   if(!TabulatePairs){
71     inputFileWeight = TFile::Open(StWeightName,"OLD");
72     if (!inputFileWeight){
73       cout << "Requested file:" << inputFileWeight << " was not opened. ABORT." << endl;
74       return NULL;
75     }
76     ////////////////////////////////////////////////////
77     // C2 Weight File
78     const Int_t ktbins_temp = ChaoticityTask->GetNumKtBins();
79     const Int_t cbins_temp = ChaoticityTask->GetNumCentBins(); 
80     const Int_t ktbins = ktbins_temp;
81     const Int_t cbins = cbins_temp;
82
83     TH3F *weightHisto[ktbins][cbins];
84     for(Int_t i=0; i<ktbins; i++){
85       for(Int_t j=0; j<cbins; j++){
86         TString name = "Weight_Kt_";
87         name += i;
88         name += "_Ky_0_M_";
89         name += j;
90         name += "_ED_0";
91         
92         weightHisto[i][j] = (TH3F*)inputFileWeight->Get(name);
93       }
94     }
95     ChaoticityTask->SetWeightArrays( kTRUE, weightHisto );
96     ////////////////////////////////////////////////////
97   }// TabulatePairs check
98   
99   if(!MCcase && !TabulatePairs){
100     
101     inputFileMomRes = TFile::Open(StMomResName,"OLD");
102     if (!inputFileMomRes){
103       cout << "Requested file:" << inputFileMomRes << " was not opened. ABORT." << endl;
104       return NULL;
105     }
106     ////////////////////////////////////////////////////
107     // Momentum Resolution File
108     TH2D *momResHisto2D = 0;
109     momResHisto2D = (TH2D*)inputFileMomRes->Get("MomResHisto_pp");
110     ChaoticityTask->SetMomResCorrections( kTRUE, momResHisto2D);
111     ////////////////////////////////////////////////////
112   }// MCcase and TabulatePairs check
113   
114
115   ////////////////////////////////////////////////////
116   // FSI File
117   inputFileFSI = TFile::Open(StKName,"OLD");
118   if (!inputFileFSI){
119     cout << "Requested file:" << inputFileFSI << " was not opened. ABORT." << endl;
120     return NULL;
121   }  
122   TH2D *FSI2therm[2];
123   TH3D *FSI3ss[6];
124   TH3D *FSI3os[6];
125   FSI2therm[0] = (TH2D*)inputFileFSI->Get("K2ssT");
126   FSI2therm[1] = (TH2D*)inputFileFSI->Get("K2osT");
127   for(Int_t CB=0; CB<6; CB++) {
128     TString *nameSS=new TString("K3ss_");
129     *nameSS += CB;
130     FSI3ss[CB] = (TH3D*)inputFileFSI->Get(nameSS->Data());
131     TString *nameOS=new TString("K3os_");
132     *nameOS += CB;
133     FSI3os[CB] = (TH3D*)inputFileFSI->Get(nameOS->Data());
134   }
135   //
136   FSI2therm[0]->SetDirectory(0);
137   FSI2therm[1]->SetDirectory(0);
138   for(Int_t CB=0; CB<6; CB++) {
139     FSI3ss[CB]->SetDirectory(0);
140     FSI3os[CB]->SetDirectory(0);
141   }
142   ChaoticityTask->SetFSICorrelations( kTRUE, FSI2therm , FSI3os, FSI3ss);
143   ////////////////////////////////////////////////////
144   
145   
146   // Return the task pointer
147   return ChaoticityTask;
148 }