1 ///////////////////////////////////////////////////////////////////////////////
2 // AddTaskJetFlowToyMC //
3 // Author: Redmer A. Bertens, Utrecht University, 2013/4, rbertens@cern.ch //
4 ///////////////////////////////////////////////////////////////////////////////
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
10 * task can either generate new tracks or use an existing event and
11 * add vn using the afterburner technique
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)
19 class AliAnalysisDataContainer;
20 class AliAnalysisTaskJetFlowMC;
23 AliAnalysisTaskJetFlowMC* AddTaskJetFlowMC(
24 const char *outputTracks = "JetFlowToyMC",
25 const char *inputTracks = "PicoTracks",
26 const char *name ="AliAnalysisTaskJetFlowMC",
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
35 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
37 if (!mgr->GetInputEventHandler()) return 0x0;
38 TString fileName = AliAnalysisManager::GetCommonFileName();
42 AliAnalysisTaskJetFlowMC *task = new AliAnalysisTaskJetFlowMC(name, doQA);
43 task->SetTracksOutName(outputTracks);
44 task->SetTracksInName(inputTracks);
45 // connect input and output
47 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
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()));
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);
59 namespace TaskJetFlowMC {
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);
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);
76 TVirtualDecayer* GetDecayer(Bool_t local = kTRUE) {
78 if(local) gSystem->Load("$ALICE_ROOT/lib/tgt_linuxx8664gcc/libpythia6");
79 TPythia6Decayer* decayer = new TPythia6Decayer();
80 decayer->SetForceDecay(TPythia6Decayer::kHardonicD);
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);
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(
98 outputTracks, // tracks name
99 "JetEmbeddingFromGenTask", // task name
105 TMath::Pi() * 2, // max phi
106 kFALSE, // copy tracks
107 kTRUE); // do qa plots