]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FEMTOSCOPY/macros/AddTaskChaoticity.C
changes in .pkg for chaoticity task + remove couts
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / macros / AddTaskChaoticity.C
CommitLineData
f29a70bb 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 inputFileNameCoulomb = "alien:///alice/cern.ch/user/d/dgangadh/cc2_l100_all.txt") {
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
12 AliChaoticity *ChaoticityTask = new AliChaoticity("ChaoticityTask", MCcase, Tabulatecase, PbPbcase, CentLow, CentHigh);
1ccd6f0d 13 if(!ChaoticityTask) exit(-1);
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;
29 TFile *inputFileCoulomb = 0;
30
31 if(!MCcase && !Tabulatecase){
32
33 TGrid::Connect("alien:");
34 inputFileWeight = TFile::Open(inputFileNameWeight,"OLD");
35 inputFileMomRes = TFile::Open(inputFileNameMomRes,"OLD");
36 if (!inputFileWeight){
37 cout << "Requested file:" << inputFileWeight << " was not opened. ABORT." << endl;
38 return;
39 }
40 if (!inputFileMomRes){
41 cout << "Requested file:" << inputFileMomRes << " was not opened. ABORT." << endl;
42 return;
43 }
44
45 //
46
47 Int_t ktbins = ChaoticityTask->GetNumKtbins();
48 Int_t cbins = ChaoticityTask->GetNumCentbins();
49 TH3F *weightHisto[ktbins][cbins] = 0;
50 for(int i=0; i<ktbins; i++){
51 for(int j=0; j<cbins; j++){
52 TString name = "Weight_Kt_";
53 name += i;
54 name += "_0_Ky_0_M_";
55 name += j;
56 name += "_ED_0";
57
58 weightHisto[i][j] = (TH3F*)inputFileWeight->Get(name);
59 }
60 }
61 ChaoticityTask->SetWeightArraysLEGO( weightHisto );
62
63 //
64
65 TH2D *momResHisto = 0;
66 TString name = "MomResHisto_pp";
67 momResHisto = (TH2D*)inputFileMomRes->Get(name);
68 ChaoticityTask->SetMomResCorrectionsLEGO( momResHisto );
69
70 //
71
72 Int_t lines = ChaoticityTask->GetNumCoulLines();
73 Int_t rbins = ChaoticityTask->GetNumRValues();
74 Float_t qCoul[lines];
75 Float_t coulSS[rbins][lines];
76 Float_t coulOS[rbins][lines];
77 // Set default values
78 for(Int_t i=0; i<lines; i++) {
79 qCoul[i]=0;
80 for(Int_t j=0; j<rbins; j++) {// radii columns
81 coulSS[j][i]=-1;
82 coulOS[j][i]=-1;
83 }
84 }
85
86 ifstream mystream(inputFileNameCoulomb);
87 for(Int_t j=0; j<rbins; j++) {// radii columns (3-10fm in cc2_l100_all.txt)
88 for(Int_t i=0; i<lines; i++) {
89 mystream >> qCoul[i];
90 //
91 mystream >> coulSS[j][i];
92 mystream >> coulOS[j][i];
93 }
94 }
95 ChaoticityTask->SetCoulCorrectionsLEGO( qCoul, coulSS, coulOS );
96
97
98
99 }// MCcase and Tabulatecase
100
101
102
103
104
105 // Return the task pointer
106 return ChaoticityTask;
107}