]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
groundwork for embedding pythia jets to thermal events
authorrbertens <rbertens@cern.ch>
Mon, 29 Sep 2014 17:05:22 +0000 (19:05 +0200)
committerrbertens <rbertens@cern.ch>
Mon, 29 Sep 2014 17:06:19 +0000 (19:06 +0200)
PWGCF/FLOW/macros/AddTaskJetFlowMC.C

index fe9964bb32f1d213566f8374cbd4e5d4ca5fc043..62a78ff3e911be5ec101995d044635609895ad17 100644 (file)
@@ -1,24 +1,32 @@
 ///////////////////////////////////////////////////////////////////////////////
 //                         AddTaskJetFlowToyMC                               //
-//   Author: Redmer A. Bertens, Utrecht University, 2013, rbertens@cern.ch   //
+// Author: Redmer A. Bertens, Utrecht University, 2013/4, rbertens@cern.ch   //
 ///////////////////////////////////////////////////////////////////////////////
 
 /* AddTask macro for jet flow toy mc task
  * task uses an afterburner to tune vn in the pico track 
  * selection which can be used by a jet finder 
- * note that this task does not generate MC particles, it changes
- * the azimuthal distribution of already available tracks
+ * 
+ * task can either generate new tracks or use an existing event and 
+ * add vn using the afterburner technique
+ *
+ * the namespace AliAnalysisTaskJetFlowMC contains a number of useful
+ * functions which may be called when doing a local analysis (on an analysis 
+ * train one would like to avoid calling macro's from within this macro, but 
+ * rather load the macros separately using the namespace functions as examples)
 */
 
 class AliAnalysisDataContainer;
 class AliAnalysisTaskJetFlowMC;
+class AliGenerator;
 
 AliAnalysisTaskJetFlowMC* AddTaskJetFlowMC(
   const char *outputTracks      = "JetFlowToyMC",
   const char *inputTracks       = "PicoTracks",
   const char *name              ="AliAnalysisTaskJetFlowMC",
   Bool_t doQA                   = kFALSE,
-  Bool_t doDecay                = kFALSE
+  Bool_t doDecay                = kFALSE,       // be sure to load pythia libs
+  Bool_t doEmbedding            = kFALSE        // not to be used on train
   )
 {  
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
@@ -28,25 +36,28 @@ AliAnalysisTaskJetFlowMC* AddTaskJetFlowMC(
   fileName += ":";
   fileName += name;
         // create the task
-  AliAnalysisTaskJetFlowMC *eTask = new AliAnalysisTaskJetFlowMC(name, doQA);
-  eTask->SetTracksOutName(outputTracks);
-  eTask->SetTracksInName(inputTracks);
+  AliAnalysisTaskJetFlowMC *task = new AliAnalysisTaskJetFlowMC(name, doQA);
+  task->SetTracksOutName(outputTracks);
+  task->SetTracksInName(inputTracks);
         // connect input and output
-  mgr->AddTask(eTask);
-  mgr->ConnectInput  (eTask, 0, mgr->GetCommonInputContainer());
+  mgr->AddTask(task);
+  mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
   if(doQA) {
       // this task only produces output when the qa flag is set to true
-      mgr->ConnectOutput (eTask, 1, mgr->CreateContainer(Form("%s_container", fileName.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName.Data()));
+      mgr->ConnectOutput (task, 1, mgr->CreateContainer(Form("%s_container", fileName.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, fileName.Data()));
   }
+  // to decay tracks using as a default pythia
   if(doDecay) task->SetDecayer(TaskJetFlowMC::GetDecayer(kTRUE));
-  return eTask;
+  // to embed pythia jets to the events
+  if(doEmbedding) AliJetEmbeddingFromGenTask* eTask = TaskJetFlowMC::EmbedGeneratedJets(TaskJetFlowMC::GetPythiaGenerator(), outputTracks);
+  return task;
 }
 
 namespace TaskJetFlowMC {
 
     TF1* GetSpectrum() {
         // thermal spectrum used for ALICE SIMULATION PLOTS ALI-SIMUL-75145 ALI-SIMUL-75171
-        TF1* spectrum = 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.);
+        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.);
         fspectrum->SetParameters(2434401791.20528 ,2.98507 ,10069622.25117 ,5.50000 ,2.80000 ,0.20000 );
         return fspectrum;   
     }
@@ -59,4 +70,30 @@ namespace TaskJetFlowMC {
         return decayer;
     }
 
+    AliGenerator* GetPythiaGenerator(
+            Float_t e_cms = 2760.,
+            Double_t ptHardMin = 0., Double_t ptHardMax = 11.,
+            Int_t tune = 2, Int_t cr = 1) {
+        // setup a pythia6 generator
+        gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddMCGenPythia.C");
+        return AddMCGenPythia(e_cms, ptHardMin, ptHardMax, tune, cr);
+    }
+
+    AliJetEmbeddingFromGenTask* EmbedGeneratedJets(AliGenerator* gen, const char* outputTracks) {
+        // generate pythia evnets on the fly and embed them to the event
+        gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskJetEmbeddingFromGen.C");
+        return AddTaskJetEmbeddingFromGen(
+                gen,                            // generator
+                outputTracks,                   // tracks name
+                "JetEmbeddingFromGenTask",      // task name
+                0.150,                          // min pt
+                200,                            // max pt
+                -0.9,                           // min eta
+                0.9,                            // max eta
+                0,                              // min phi
+                TMath::Pi() * 2,                // max phi
+                kFALSE,                         // copy tracks
+                kTRUE);                         // do qa plots
+    }
+
 }