]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Macros for running Et analysis
authorcnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Sep 2010 11:49:46 +0000 (11:49 +0000)
committercnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Sep 2010 11:49:46 +0000 (11:49 +0000)
PWG4/totEt/macros/CreateAlienHandlerCaloEtSim.C [new file with mode: 0644]
PWG4/totEt/macros/CreateAlienHandlerHadEtSim.C [new file with mode: 0644]
PWG4/totEt/macros/runCaloEt.C [new file with mode: 0644]
PWG4/totEt/macros/runHadEt.C [new file with mode: 0644]

diff --git a/PWG4/totEt/macros/CreateAlienHandlerCaloEtSim.C b/PWG4/totEt/macros/CreateAlienHandlerCaloEtSim.C
new file mode 100644 (file)
index 0000000..23b18d3
--- /dev/null
@@ -0,0 +1,76 @@
+ AliAnalysisGrid* CreateAlienHandlerCaloEtSim()
+{
+// Check if user has a valid token, otherwise make one. This has limitations.
+// One can always follow the standard procedure of calling alien-token-init then
+//   source /tmp/gclient_env_$UID in the current shell.
+   if (!AliAnalysisGrid::CreateToken()) return NULL;
+   AliAnalysisAlien *plugin = new AliAnalysisAlien();
+
+// Overwrite all generated files, datasets and output results from a previous session
+   plugin->SetOverwriteMode();
+// Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
+   //plugin->SetRunMode("full");  // VERY IMPORTANT - DECRIBED BELOW
+   plugin->SetRunMode("full");  // VERY IMPORTANT - DECRIBED BELOW
+// Set versions of used packages
+   plugin->SetAPIVersion("V1.1x");
+   plugin->SetROOTVersion("v5-26-00b-6");
+   plugin->SetAliROOTVersion("v4-20-04-AN");
+// Declare input data to be processed.
+
+// Method 1: Create automatically XML collections using alien 'find' command.
+// Define production directory LFN
+//   plugin->SetGridDataDir("/alice/sim/LHC10a18");
+// Set data search pattern
+//   plugin->SetDataPattern("*ESDs.root");  // simulated, tags not used
+//   plugin->SetDataPattern("*ESDs/pass4/*ESDs.root"); // real data check reco pass and data base directory
+//   plugin->SetRunPrefix("000");   // real data
+//   plugin->SetDataPattern("*tag.root");  // Use ESD tags (same applies for AOD's)
+// ...then add run numbers to be considered
+//   plugin->AddRunNumber(125020);    // simulated
+//   plugin->AddRunNumber(104065);  // real data
+
+// Method 2: Declare existing data files (raw collections, xml collections, root file)
+// If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
+// XML collections added via this method can be combined with the first method if
+// the content is compatible (using or not tags)
+   plugin->AddDataFile("tag.xml");
+//   plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
+
+// Define alien work directory where all files will be copied. Relative to alien $HOME.
+   plugin->SetGridWorkingDir("etOystein");
+// Declare alien output directory. Relative to working directory.
+   plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
+// Declare the analysis source files names separated by blancs. To be compiled runtime IN THE SAME ORDER THEY ARE LISTED
+// using ACLiC on the worker nodes.
+   //plugin->SetAnalysisSource("AliAnalysisTaskHadEt.cxx");
+   //plugin->SetAnalysisSource("AliAnalysisEt.cxx AliAnalysisEtMonteCarlo.cxx AliAnalysisEtMonteCarloPhos.cxx AliAnalysisEtReconstructed.cxx AliAnalysisEtReconstructedPhos.cxx AliAnalysisHadEt.cxx AliAnalysisHadEtMonteCarlo.cxx AliAnalysisHadEtReconstructed.cxx AliAnalysisTaskHadEt.cxx AliAnalysisTaskTotEt.cxx");
+   plugin->SetAnalysisSource("AliAnalysisEt.cxx AliAnalysisEtMonteCarlo.cxx AliAnalysisEtMonteCarloPhos.cxx AliAnalysisEtMonteCarloEmcal.cxx AliAnalysisEtReconstructed.cxx AliAnalysisEtReconstructedPhos.cxx AliAnalysisEtReconstructedEmcal.cxx AliAnalysisTaskTotEt.cxx");
+// Declare all libraries (other than the default ones for the framework. These will be
+// loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
+   plugin->SetAdditionalLibs("AliAnalysisEtCuts.h AliAnalysisEt.h AliAnalysisEtMonteCarlo.h AliAnalysisEtMonteCarloPhos.h AliAnalysisEtMonteCarloEmcal.h AliAnalysisEtReconstructed.h AliAnalysisEtReconstructedPhos.h AliAnalysisEtReconstructedEmcal.h AliAnalysisTaskTotEt.h AliAnalysisEt.cxx AliAnalysisEtMonteCarlo.cxx AliAnalysisEtMonteCarloPhos.cxx AliAnalysisEtMonteCarloEmcal.cxx AliAnalysisEtReconstructed.cxx AliAnalysisEtReconstructedPhos.cxx AliAnalysisEtReconstructedEmcal.cxx AliAnalysisTaskTotEt.cxx");
+// No need for output file names. Procedure is automatic. <-- not true
+   plugin->SetDefaultOutputs(kFALSE);
+   plugin->SetOutputFiles("Et.ESD.sim.root");
+// No need define the files to be archived. Note that this is handled automatically by the plugin.
+//   plugin->SetOutputArchive("log_archive.zip:stdout,stderr");
+// Set a name for the generated analysis macro (default MyAnalysis.C) Make this unique !
+   plugin->SetAnalysisMacro("OysteinsEtAnalysis.C");
+// Optionally set maximum number of input files/subjob (default 100, put 0 to ignore). The optimum for an analysis
+// is correlated with the run time - count few hours TTL per job, not minutes !
+   plugin->SetSplitMaxInputFileNumber(100);
+// Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
+   plugin->SetMaxInitFailed(5);
+// Optionally resubmit threshold.
+   plugin->SetMasterResubmitThreshold(90);
+// Optionally set time to live (default 30000 sec)
+   plugin->SetTTL(20000);
+// Optionally set input format (default xml-single)
+   plugin->SetInputFormat("xml-single");
+// Optionally modify the name of the generated JDL (default analysis.jdl)
+   plugin->SetJDLName("TaskEt.jdl");
+// Optionally modify job price (default 1)
+   plugin->SetPrice(1); 
+// Optionally modify split mode (default 'se')    
+   plugin->SetSplitMode("se");
+   return plugin;
+} 
diff --git a/PWG4/totEt/macros/CreateAlienHandlerHadEtSim.C b/PWG4/totEt/macros/CreateAlienHandlerHadEtSim.C
new file mode 100644 (file)
index 0000000..9a749ca
--- /dev/null
@@ -0,0 +1,76 @@
+ AliAnalysisGrid* CreateAlienHandlerHadEtSim()
+{
+// Check if user has a valid token, otherwise make one. This has limitations.
+// One can always follow the standard procedure of calling alien-token-init then
+//   source /tmp/gclient_env_$UID in the current shell.
+   if (!AliAnalysisGrid::CreateToken()) return NULL;
+   AliAnalysisAlien *plugin = new AliAnalysisAlien();
+
+// Overwrite all generated files, datasets and output results from a previous session
+   plugin->SetOverwriteMode();
+// Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
+   //plugin->SetRunMode("full");  // VERY IMPORTANT - DECRIBED BELOW
+   plugin->SetRunMode("full");  // VERY IMPORTANT - DECRIBED BELOW
+// Set versions of used packages
+   plugin->SetAPIVersion("V1.1x");
+   plugin->SetROOTVersion("v5-26-00b-6");
+   plugin->SetAliROOTVersion("v4-20-04-AN");
+// Declare input data to be processed.
+
+// Method 1: Create automatically XML collections using alien 'find' command.
+// Define production directory LFN
+//   plugin->SetGridDataDir("/alice/sim/LHC10a18");
+// Set data search pattern
+//   plugin->SetDataPattern("*ESDs.root");  // simulated, tags not used
+//   plugin->SetDataPattern("*ESDs/pass4/*ESDs.root"); // real data check reco pass and data base directory
+//   plugin->SetRunPrefix("000");   // real data
+//   plugin->SetDataPattern("*tag.root");  // Use ESD tags (same applies for AOD's)
+// ...then add run numbers to be considered
+//   plugin->AddRunNumber(125020);    // simulated
+//   plugin->AddRunNumber(104065);  // real data
+
+// Method 2: Declare existing data files (raw collections, xml collections, root file)
+// If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
+// XML collections added via this method can be combined with the first method if
+// the content is compatible (using or not tags)
+   plugin->AddDataFile("tag.xml");
+//   plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
+
+// Define alien work directory where all files will be copied. Relative to alien $HOME.
+   plugin->SetGridWorkingDir("et");
+// Declare alien output directory. Relative to working directory.
+   plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
+// Declare the analysis source files names separated by blancs. To be compiled runtime IN THE SAME ORDER THEY ARE LISTED
+// using ACLiC on the worker nodes.
+   //plugin->SetAnalysisSource("AliAnalysisTaskHadEt.cxx");
+   //plugin->SetAnalysisSource("AliAnalysisEt.cxx AliAnalysisEtMonteCarlo.cxx AliAnalysisEtMonteCarloPhos.cxx AliAnalysisEtReconstructed.cxx AliAnalysisEtReconstructedPhos.cxx AliAnalysisHadEt.cxx AliAnalysisHadEtMonteCarlo.cxx AliAnalysisHadEtReconstructed.cxx AliAnalysisTaskHadEt.cxx AliAnalysisTaskTotEt.cxx");
+   plugin->SetAnalysisSource("AliAnalysisHadEt.cxx AliAnalysisHadEtMonteCarlo.cxx AliAnalysisHadEtReconstructed.cxx AliAnalysisTaskHadEt.cxx");
+// Declare all libraries (other than the default ones for the framework. These will be
+// loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
+   plugin->SetAdditionalLibs("AliAnalysisEtCuts.h AliAnalysisHadEt.cxx AliAnalysisHadEtMonteCarlo.cxx AliAnalysisHadEtReconstructed.cxx AliAnalysisTaskHadEt.cxx AliAnalysisHadEt.h AliAnalysisHadEtMonteCarlo.h AliAnalysisHadEtReconstructed.h AliAnalysisTaskHadEt.h");
+// No need for output file names. Procedure is automatic. <-- not true
+   plugin->SetDefaultOutputs(kFALSE);
+   plugin->SetOutputFiles("Et.ESD.new.sim.root");
+// No need define the files to be archived. Note that this is handled automatically by the plugin.
+//   plugin->SetOutputArchive("log_archive.zip:stdout,stderr");
+// Set a name for the generated analysis macro (default MyAnalysis.C) Make this unique !
+   plugin->SetAnalysisMacro("ChristinesEtAnalysis.C");
+// Optionally set maximum number of input files/subjob (default 100, put 0 to ignore). The optimum for an analysis
+// is correlated with the run time - count few hours TTL per job, not minutes !
+   plugin->SetSplitMaxInputFileNumber(100);
+// Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
+   plugin->SetMaxInitFailed(5);
+// Optionally resubmit threshold.
+   plugin->SetMasterResubmitThreshold(90);
+// Optionally set time to live (default 30000 sec)
+   plugin->SetTTL(20000);
+// Optionally set input format (default xml-single)
+   plugin->SetInputFormat("xml-single");
+// Optionally modify the name of the generated JDL (default analysis.jdl)
+   plugin->SetJDLName("TaskEt.jdl");
+// Optionally modify job price (default 1)
+   plugin->SetPrice(1); 
+// Optionally modify split mode (default 'se')    
+   plugin->SetSplitMode("se");
+   return plugin;
+} 
diff --git a/PWG4/totEt/macros/runCaloEt.C b/PWG4/totEt/macros/runCaloEt.C
new file mode 100644 (file)
index 0000000..dedba1e
--- /dev/null
@@ -0,0 +1,91 @@
+//Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
+//University of Tennessee at Knoxville
+
+//by default this runs locally
+//With the argument true this submits jobs to the grid
+//As written this requires an xml script tag.xml in the ~/et directory on the grid to submit jobs
+void runCaloEt(bool submit = false) {
+    TStopwatch timer;
+    timer.Start();
+    gSystem->Load("libTree.so");
+    gSystem->Load("libGeom.so");
+    gSystem->Load("libVMC.so");
+    gSystem->Load("libXMLIO.so");
+
+    gSystem->Load("libSTEERBase.so");
+    gSystem->Load("libESD.so");
+    gSystem->Load("libAOD.so");
+
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libANALYSISalice");
+
+    gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+    gROOT->ProcessLine(".L AliAnalysisEt.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtMonteCarlo.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtMonteCarloPhos.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtMonteCarloEmcal.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtReconstructed.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtReconstructedPhos.cxx+g");
+    gROOT->ProcessLine(".L AliAnalysisEtReconstructedEmcal.cxx+g");
+
+    gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g");
+
+
+  char *kTreeName = "esdTree" ;
+  TChain * chain   = new TChain(kTreeName,"myESDTree") ;
+
+  
+  if(submit){      
+    gSystem->Load("libNetx.so") ; 
+    gSystem->Load("libgapiUI.so");
+    gSystem->Load("libRAliEn.so"); 
+    TGrid::Connect("alien://") ;
+  }
+  chain->Add("/data/LHC10d15/1821/AliESDs.root");//CN changed
+
+
+  
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
+  
+  if(submit){
+    gROOT->LoadMacro("CreateAlienHandlerPhosEtSim.C");
+    AliAnalysisGrid *alienHandler = CreateAlienHandlerPhosEtSim();  
+    if (!alienHandler) return;
+    mgr->SetGridHandler(alienHandler);
+  }
+
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);
+  AliMCEventHandler* handler = new AliMCEventHandler;
+  handler->SetReadTR(kFALSE);
+  mgr->SetMCtruthEventHandler(handler);
+  
+  AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt("TaskTotEt");
+  mgr->AddTask(task1);
+
+    // Create containers for input/output
+    //AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1", TChain::Class(),AliAnalysisManager::kInputContainer);
+    AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+
+    //AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer,"Et.ESD.sim.root");
+    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer,"Et.ESD.sim.root");
+
+    //____________________________________________//
+    mgr->ConnectInput(task1,0,cinput1);
+    mgr->ConnectOutput(task1,1,coutput1);
+
+    mgr->SetDebugLevel(0);
+
+    if (!mgr->InitAnalysis()) return;
+    mgr->PrintStatus();
+    if(submit){
+      mgr->StartAnalysis("grid");
+    }
+    else{
+      mgr->StartAnalysis("local",chain);
+    }
+
+    timer.Stop();
+    timer.Print();
+}
diff --git a/PWG4/totEt/macros/runHadEt.C b/PWG4/totEt/macros/runHadEt.C
new file mode 100644 (file)
index 0000000..f41adeb
--- /dev/null
@@ -0,0 +1,73 @@
+//Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
+//University of Tennessee at Knoxville
+
+//by default this runs locally
+//With the argument true this submits jobs to the grid
+//As written this requires an xml script tag.xml in the ~/et directory on the grid to submit jobs
+void runHadEt(bool submit = false) {
+    TStopwatch timer;
+    timer.Start();
+    gSystem->Load("libTree.so");
+    gSystem->Load("libGeom.so");
+    gSystem->Load("libVMC.so");
+    gSystem->Load("libXMLIO.so");
+
+    gSystem->Load("libSTEERBase.so");
+    gSystem->Load("libESD.so");
+    gSystem->Load("libAOD.so");
+
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libANALYSISalice");
+
+    gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+   gROOT->ProcessLine(".L AliAnalysisHadEt.cxx+g");
+   gROOT->ProcessLine(".L AliAnalysisHadEtMonteCarlo.cxx+g");
+   gROOT->ProcessLine(".L AliAnalysisHadEtReconstructed.cxx+g");
+   gROOT->ProcessLine(".L AliAnalysisTaskHadEt.cxx+g");
+
+
+  char *kTreeName = "esdTree" ;
+  TChain * chain   = new TChain(kTreeName,"myESDTree") ;
+  if(submit){      
+    gSystem->Load("libNetx.so") ; 
+    gSystem->Load("libgapiUI.so");
+    gSystem->Load("libRAliEn.so"); 
+    TGrid::Connect("alien://") ;
+  }
+  chain->Add("/data/LHC10d15/1821/AliESDs.root");
+
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
+  if(submit){
+    gROOT->LoadMacro("CreateAlienHandlerHadEtSim.C");
+    AliAnalysisGrid *alienHandler = CreateAlienHandlerHadEtSim();  
+    if (!alienHandler) return;
+    mgr->SetGridHandler(alienHandler);
+  }
+
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);
+  AliMCEventHandler* handler = new AliMCEventHandler;
+  handler->SetReadTR(kFALSE);
+  mgr->SetMCtruthEventHandler(handler);
+  AliAnalysisTaskHadEt *task2 = new AliAnalysisTaskHadEt("TaskHadEt");
+  mgr->AddTask(task2);
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("out2", TList::Class(), AliAnalysisManager::kOutputContainer,"Et.ESD.new.sim.root");
+  mgr->ConnectInput(task2,0,cinput1);
+  mgr->ConnectOutput(task2,1,coutput2);
+  
+  mgr->SetDebugLevel(0);
+  
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  if(submit){
+    mgr->StartAnalysis("grid");
+  }
+  else{
+    mgr->StartAnalysis("local",chain);
+  }
+
+  timer.Stop();
+  timer.Print();
+}