adding steering macros for MC on the fly generation on LEGO trains
authorJan Fiete Grosse-Oetringhaus <jgrosseo@cern.ch>
Fri, 6 Dec 2013 16:46:01 +0000 (17:46 +0100)
committerJan Fiete Grosse-Oetringhaus <jgrosseo@cern.ch>
Sun, 8 Dec 2013 09:56:04 +0000 (10:56 +0100)
ANALYSIS/macros/train/AddMCGenHijing.C [new file with mode: 0644]
ANALYSIS/macros/train/AddMCGeneratorHandler.C [new file with mode: 0644]

diff --git a/ANALYSIS/macros/train/AddMCGenHijing.C b/ANALYSIS/macros/train/AddMCGenHijing.C
new file mode 100644 (file)
index 0000000..9e00550
--- /dev/null
@@ -0,0 +1,34 @@
+AliGenerator *AddMCGenHijing()
+{  
+// User defined generator  
+  gSystem->Load("liblhapdf.so");      // Parton density functions
+  gSystem->Load("libEGPythia6.so");   // TGenerator interface
+  gSystem->Load("libpythia6.so");     // Pythia
+  gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
+  gSystem->Load("libhijing");       
+  gSystem->Load("libTHijing");
+  AliGenHijing* gener = new AliGenHijing(-1);
+  // centre of mass energy 
+  gener->SetEnergyCMS(2760.);
+  gener->SetImpactParameterRange(0, 20);  
+  // reference frame
+  gener->SetReferenceFrame("CMS");
+  // projectile
+  gener->SetProjectile("A", 208, 82);
+  gener->SetTarget    ("A", 208, 82);
+  // tell hijing to keep the full parent child chain
+  gener->KeepFullEvent();
+
+  // enable shadowing
+  gener->SetShadowing(1);
+  // Don't track spectators
+  gener->SetSpectators(0);
+  // kinematic selection
+  gener->SetSelectAll(0);   
+
+  gener->SetJetQuenching(0);   
+  gener->SetPtHardMin (2.3);
+  return gener;
+}
+  
+  
diff --git a/ANALYSIS/macros/train/AddMCGeneratorHandler.C b/ANALYSIS/macros/train/AddMCGeneratorHandler.C
new file mode 100644 (file)
index 0000000..73c1333
--- /dev/null
@@ -0,0 +1,35 @@
+void AddMCGeneratorHandler()
+{
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) ::Fatal("handlers", "No analysis manager");
+  AliAnalysisAlien *plugin = (AliAnalysisAlien*)mgr->GetGridHandler();
+  if (!plugin) ::Fatal("handlers", "The method should be called via: AliAnalysisAlien::CreateAnalysisManager()");
+  mgr->SetInputEventHandler(new AliDummyHandler());
+  AliMCGenHandler* mcInputHandler = new AliMCGenHandler();
+
+  TString macroPath;
+  macroPath.Form("$ALICE_ROOT/%s", gSystem->Getenv("GEN_MACRO_PATH"));
+  macroPath = gSystem->ExpandPathName(macroPath.Data());
+
+  TString macroParameters(gSystem->Getenv("GEN_PARAMETERS"));
+
+  TString newlibs;
+  Long64_t retval = AliAnalysisAlien::RunMacroAndExtractLibs(macroPath, macroParameters, newlibs);
+  if (retval<0) {
+    ::Error(Form("The macro %s did not return a valid generator", macroPath.Data()));
+    return;
+  }
+  AliGenerator *gener = reinterpret_cast<AliGenerator*>(retval);
+
+  // customization from LEGO train
+  gROOT->LoadMacro("generator_customization.C");
+  generator_customization(gener);
+
+  mcInputHandler->SetGenerator(gener);
+  mcInputHandler->SetSeedMode(3);
+
+  newlibs += " ";
+  newlibs += gSystem->Getenv("GEN_LIBRARIES");
+  plugin->SetGeneratorLibs(newlibs);
+  mgr->SetMCtruthEventHandler(mcInputHandler);
+}