]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FEMTOSCOPY/macros/AddTaskChaoticity.C
return NULL instead of exit(-1)
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / macros / AddTaskChaoticity.C
CommitLineData
5805524d 1AliChaoticity *AddTaskChaoticity(bool MCcase=kFALSE, bool Tabulatecase=kFALSE, bool PbPbcase=kTRUE, int CentLow=0, int CentHigh=1, TString inputFileNameWeight = "alien:///alice/cern.ch/user/d/dgangadh/WeightFile.root", TString inputFileNameMomRes = "alien:///alice/cern.ch/user/d/dgangadh/MomResFile.root", TString inputFileNameFSI = "alien:///alice/cern.ch/user/d/dgangadh/KFile.root") {
f29a70bb 2
3 //===========================================================================
4 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
5 if (!mgr) {
6 ::Error("AddTaskBF", "No analysis manager to connect to.");
7 return NULL;
8 }
9
10 //____________________________________________//
11 // Create tasks
5805524d 12 AliChaoticity *ChaoticityTask = new AliChaoticity("ChaoticityTask", MCcase, Tabulatecase, PbPbcase, CentLow, CentHigh, kTRUE);
80c4a952 13 if(!ChaoticityTask) return NULL;
f29a70bb 14 mgr->AddTask(ChaoticityTask);
15
16
17 // Create ONLY the output containers for the data produced by the task.
18 // Get and connect other common input/output containers via the manager as below
19 //==============================================================================
20 TString outputFileName = AliAnalysisManager::GetCommonFileName();
21 outputFileName += ":PWGCF.outputChaoticityAnalysis.root";
1ccd6f0d 22 AliAnalysisDataContainer *coutChaoticity = mgr->CreateContainer("ChaoticityOutput", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
f29a70bb 23 mgr->ConnectInput(ChaoticityTask, 0, mgr->GetCommonInputContainer());
24 mgr->ConnectOutput(ChaoticityTask, 1, coutChaoticity);
25
26
27 TFile *inputFileWeight = 0;
28 TFile *inputFileMomRes = 0;
5805524d 29 TFile *inputFileFSI = 0;
f29a70bb 30
b2553bca 31
32 if(!Tabulatecase){
f29a70bb 33 inputFileWeight = TFile::Open(inputFileNameWeight,"OLD");
f29a70bb 34 if (!inputFileWeight){
35 cout << "Requested file:" << inputFileWeight << " was not opened. ABORT." << endl;
80c4a952 36 return NULL;
f29a70bb 37 }
5805524d 38 ////////////////////////////////////////////////////
39 // C2 Weight File
45a8f78f 40 const Int_t ktbins = 3;// ChaoticityTask->GetNumKtbins();
41 const Int_t cbins = 10;// ChaoticityTask->GetNumCentbins();
42 TH3F *weightHisto[ktbins][cbins];
5805524d 43 for(Int_t i=0; i<ktbins; i++){
44 for(Int_t j=0; j<cbins; j++){
f29a70bb 45 TString name = "Weight_Kt_";
46 name += i;
5805524d 47 name += "_Ky_0_M_";
f29a70bb 48 name += j;
49 name += "_ED_0";
50
51 weightHisto[i][j] = (TH3F*)inputFileWeight->Get(name);
52 }
53 }
5805524d 54 ChaoticityTask->SetWeightArrays( kTRUE, weightHisto );
55 ////////////////////////////////////////////////////
b2553bca 56 }// Tabulatecase check
57
58 if(!MCcase && !Tabulatecase){
59
60 inputFileMomRes = TFile::Open(inputFileNameMomRes,"OLD");
61 if (!inputFileMomRes){
62 cout << "Requested file:" << inputFileMomRes << " was not opened. ABORT." << endl;
80c4a952 63 return NULL;
b2553bca 64 }
5805524d 65 ////////////////////////////////////////////////////
66 // Momentum Resolution File
67 TH2D *momResHisto2D = 0;
5805524d 68 momResHisto2D = (TH2D*)inputFileMomRes->Get("MomResHisto_pp");
b2553bca 69 ChaoticityTask->SetMomResCorrections( kTRUE, momResHisto2D);
5805524d 70 ////////////////////////////////////////////////////
b2553bca 71 }// MCcase and Tabulatecase check
f29a70bb 72
f29a70bb 73
5805524d 74 ////////////////////////////////////////////////////
75 // FSI File
76 inputFileFSI = TFile::Open(inputFileNameFSI,"OLD");
77 if (!inputFileFSI){
78 cout << "Requested file:" << inputFileFSI << " was not opened. ABORT." << endl;
80c4a952 79 return NULL;
5805524d 80 }
b2553bca 81 TH2D *FSI2gaus[2];
82 TH2D *FSI2therm[2];
83 TH3D *FSI3ss[6];
84 TH3D *FSI3os[6];
85 FSI2gaus[0] = (TH2D*)inputFileFSI->Get("K2ssG");
86 FSI2gaus[1] = (TH2D*)inputFileFSI->Get("K2osG");
87 FSI2therm[0] = (TH2D*)inputFileFSI->Get("K2ssT");
88 FSI2therm[1] = (TH2D*)inputFileFSI->Get("K2osT");
89 for(Int_t CB=0; CB<6; CB++) {
90 TString *nameSS=new TString("K3ss_");
91 *nameSS += CB;
92 FSI3ss[CB] = (TH3D*)inputFileFSI->Get(nameSS->Data());
93 TString *nameOS=new TString("K3os_");
94 *nameOS += CB;
95 FSI3os[CB] = (TH3D*)inputFileFSI->Get(nameOS->Data());
96 }
97 //
98 FSI2gaus[0]->SetDirectory(0);
99 FSI2gaus[1]->SetDirectory(0);
100 FSI2therm[0]->SetDirectory(0);
101 FSI2therm[1]->SetDirectory(0);
35c34707 102 for(Int_t CB=0; CB<6; CB++) {
b2553bca 103 FSI3ss[CB]->SetDirectory(0);
104 FSI3os[CB]->SetDirectory(0);
35c34707 105 }
b2553bca 106 ChaoticityTask->SetFSICorrelations( kTRUE, FSI2gaus, FSI2therm , FSI3os, FSI3ss);
5805524d 107 ////////////////////////////////////////////////////
35c34707 108
109
f29a70bb 110 // Return the task pointer
111 return ChaoticityTask;
112}