]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FLOW/macros/AddTaskJetFlowMC.C
add event plane decorrelation histogram (in eta)
[u/mrichter/AliRoot.git] / PWGCF / FLOW / macros / AddTaskJetFlowMC.C
1 ///////////////////////////////////////////////////////////////////////////////
2 //                         AddTaskJetFlowToyMC                               //
3 // Author: Redmer A. Bertens, Utrecht University, 2013/4, rbertens@cern.ch   //
4 ///////////////////////////////////////////////////////////////////////////////
5
6 /* AddTask macro for jet flow toy mc task
7  * task uses an afterburner to tune vn in the pico track 
8  * selection which can be used by a jet finder 
9  * 
10  * task can either generate new tracks or use an existing event and 
11  * add vn using the afterburner technique
12  *
13  * the namespace AliAnalysisTaskJetFlowMC contains a number of useful
14  * functions which may be called when doing a local analysis (on an analysis 
15  * train one would like to avoid calling macro's from within this macro, but 
16  * rather load the macros separately using the namespace functions as examples)
17 */
18
19 class AliAnalysisDataContainer;
20 class AliAnalysisTaskJetFlowMC;
21 class AliGenerator;
22
23 AliAnalysisTaskJetFlowMC* AddTaskJetFlowMC(
24   const char *outputTracks      = "JetFlowToyMC",
25   const char *inputTracks       = "PicoTracks",
26   const char *name              ="AliAnalysisTaskJetFlowMC",
27   Bool_t doQA                   = kFALSE,
28   Bool_t doDecay                = kFALSE,       // be sure to load pythia libs
29   Bool_t doEmbedding            = kFALSE,       // not to be used on train
30   Double_t ptHardPythiaMin      = 0.,           // pt hard bin lower bound
31   Double_t ptHardPythiaMax      = 10.           // pt hard bin upper bound
32
33   )
34 {  
35   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
36   if (!mgr)                             return 0x0;
37   if (!mgr->GetInputEventHandler())     return 0x0;
38   TString fileName = AliAnalysisManager::GetCommonFileName();
39   fileName += ":";
40   fileName += name;
41         // create the task
42   AliAnalysisTaskJetFlowMC *task = new AliAnalysisTaskJetFlowMC(name, doQA);
43   task->SetTracksOutName(outputTracks);
44   task->SetTracksInName(inputTracks);
45         // connect input and output
46   mgr->AddTask(task);
47   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
48   if(doQA) {
49       // this task only produces output when the qa flag is set to true
50       mgr->ConnectOutput (task, 1, mgr->CreateContainer(Form("%s_container", fileName.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName.Data()));
51   }
52   // to decay tracks using as a default pythia
53   if(doDecay) task->SetDecayer(TaskJetFlowMC::GetDecayer(kTRUE));
54   // to embed pythia jets to the events
55   if(doEmbedding) AliJetEmbeddingFromGenTask* eTask = TaskJetFlowMC::EmbedGeneratedJets(TaskJetFlowMC::GetPythiaGenerator(2760., ptHardPythiaMin, ptHardPythiaMax), outputTracks);
56   return task;
57 }
58
59 namespace TaskJetFlowMC {
60
61     TF1* GetSpectrum() {
62         // full spectrum used for ALICE SIMULATION PLOTS ALI-SIMUL-75145 ALI-SIMUL-75171
63         // combination of boltzmann spectrum and hard jet spectrum
64         TF1* fspectrum = new TF1("fspectrum", "[0]*(TMath::Power([1], 2)*x*TMath::Exp(-[1]*x))+(x>1)*[2]*(1.17676e-01*TMath::Sqrt(0.1396*0.1396+x*x)*TMath::Power(1.+1./[3]/8.21795e-01*TMath::Sqrt(0.1396*0.1396+x*x),-1.*[3]))*(1/(1 + TMath::Exp(-(x - [4])/[5])))", .2, 200.);
65         fspectrum->SetParameters(2434401791.20528, 2.98507, 10069622.25117, 5.50000, 2.80000, 0.20000);
66         return fspectrum;   
67     }
68
69     TF1* GetThermalSpectrum() {
70         // pure boltzmann part of thermal spectrum
71         TF1* boltzmann = new TF1("boltzmann", "[0]*(TMath::Power([1], 2)*x*TMath::Exp(-[1]*x))");
72         boltzmann->SetParameters(2434401791.20528, 2.98507);
73         return boltzmann;
74     }
75
76     TVirtualDecayer* GetDecayer(Bool_t local = kTRUE) {
77         // setup a decayer
78         if(local) gSystem->Load("$ALICE_ROOT/lib/tgt_linuxx8664gcc/libpythia6");
79         TPythia6Decayer* decayer = new TPythia6Decayer();
80         decayer->SetForceDecay(TPythia6Decayer::kHardonicD);
81         return decayer;
82     }
83
84     AliGenerator* GetPythiaGenerator(
85             Float_t e_cms = 2760.,
86             Double_t ptHardMin = 0., Double_t ptHardMax = 11.,
87             Int_t tune = 2, Int_t cr = 1) {
88         // setup a pythia6 generator
89         gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddMCGenPythia.C");
90         return AddMCGenPythia(e_cms, ptHardMin, ptHardMax, tune, cr);
91     }
92
93     AliJetEmbeddingFromGenTask* EmbedGeneratedJets(AliGenerator* gen, const char* outputTracks) {
94         // generate pythia evnets on the fly and embed them to the event
95         gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskJetEmbeddingFromGen.C");
96         return AddTaskJetEmbeddingFromGen(
97                 gen,                            // generator
98                 outputTracks,                   // tracks name
99                 "JetEmbeddingFromGenTask",      // task name
100                 0.150,                          // min pt
101                 200,                            // max pt
102                 -0.9,                           // min eta
103                 0.9,                            // max eta
104                 0,                              // min phi
105                 TMath::Pi() * 2,                // max phi
106                 kFALSE,                         // copy tracks
107                 kTRUE);                         // do qa plots
108     }
109
110 }