]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/totEt/macros/runCaloEt.C
updates for running with plugin
[u/mrichter/AliRoot.git] / PWG4 / totEt / macros / runCaloEt.C
1 //Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2 //University of Tennessee at Knoxville
3
4 //by default this runs locally
5 //With the argument true this submits jobs to the grid
6 //As written this requires an xml script tag.xml in the ~/et directory on the grid to submit jobs
7 void runCaloEt(bool submit = true, // true or false 
8                const char *dataType="sim", // "sim" or "real" or "simPbPb"
9                const char *det = "EMCAL") // "PHOS" or "EMCAL"
10 {
11   TStopwatch timer;
12   timer.Start();
13   gSystem->Load("libTree.so");
14   gSystem->Load("libGeom.so");
15   gSystem->Load("libVMC.so");
16   gSystem->Load("libXMLIO.so");
17   
18   gSystem->Load("libSTEERBase.so");
19   gSystem->Load("libESD.so");
20   gSystem->Load("libAOD.so");
21   
22   gSystem->Load("libANALYSIS");
23   gSystem->Load("libANALYSISalice");
24   
25   if (!submit) { // assume the stuff you need is compiled
26     cout << "local - no submitting" << endl;
27     gSystem->Load("libPWG4totEt");
28   }
29   else { 
30     cout << "submitting to grid" << endl;
31     gSystem->AddIncludePath("-I$ALICE_ROOT/include");
32     gROOT->ProcessLine(".L AliAnalysisEt.cxx+g");
33     gROOT->ProcessLine(".L AliAnalysisEtMonteCarlo.cxx+g");
34     gROOT->ProcessLine(".L AliAnalysisEtMonteCarloPhos.cxx+g");
35     gROOT->ProcessLine(".L AliAnalysisEtMonteCarloEmcal.cxx+g");
36     gROOT->ProcessLine(".L AliAnalysisEtReconstructed.cxx+g");
37     gROOT->ProcessLine(".L AliAnalysisEtReconstructedPhos.cxx+g");
38     gROOT->ProcessLine(".L AliAnalysisEtReconstructedEmcal.cxx+g");
39     
40     gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g");
41   }
42
43   char *kTreeName = "esdTree" ;
44   TChain * chain   = new TChain(kTreeName,"myESDTree") ;
45   
46   if(submit){      
47     gSystem->Load("libNetx.so") ; 
48     gSystem->Load("libgapiUI.so");
49     gSystem->Load("libRAliEn.so"); 
50     TGrid::Connect("alien://") ;
51   }
52   
53   // Make the analysis manager
54   AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
55   
56   TString detStr(det);
57   TString taskName = "TaskTotEt" + detStr;
58   TString dataStr(dataType);
59   TString outputName = "Et.ESD." + dataStr + "." + detStr + ".root";
60   TString outputDir = "totEt" + dataStr;
61
62   cout << " taskName " << taskName
63        << " outputName " << outputName << endl;
64
65   if(submit){
66     gROOT->LoadMacro("CreateAlienHandlerCaloEtSim.C");
67     AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName);  
68     if (!alienHandler) return;
69     mgr->SetGridHandler(alienHandler);
70   }
71
72   AliVEventHandler* esdH = new AliESDInputHandler;
73   mgr->SetInputEventHandler(esdH);
74   AliMCEventHandler* handler = new AliMCEventHandler;
75   if ( dataStr.Contains("sim") ) {
76     cout << " MC " << endl;
77     chain->Add("/home/dsilverm/data/E_T/sim/LHC10d1/117222/100/AliESDs.root"); // link to local test file
78     if ( dataStr.Contains("PbPb") ) {
79       cout << " PbPb " << endl;
80       chain->Add("/home/dsilverm/data/E_T/sim/LHC10e11/191001/001/AliESDs.root"); // link to local test file
81     }
82     handler->SetReadTR(kFALSE);
83     mgr->SetMCtruthEventHandler(handler);
84   }
85   else {
86   chain->Add("/home/dsilverm/data/E_T/data/2010/LHC10b/000117222/ESDs/pass2/10000117222021.30/AliESDs.root"); // link to local test file
87     cout << " not MC " << endl;
88   }
89
90
91   AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName);
92   mgr->AddTask(task1);
93
94   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
95   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer, outputName);
96   
97   //____________________________________________//
98   mgr->ConnectInput(task1,0,cinput1);
99   mgr->ConnectOutput(task1,1,coutput1);
100   
101   mgr->SetDebugLevel(0);
102   
103   if (!mgr->InitAnalysis()) return;
104   mgr->PrintStatus();
105   if(submit){
106     mgr->StartAnalysis("grid");
107   }
108   else{
109     mgr->StartAnalysis("local",chain);
110   }
111   
112   timer.Stop();
113   timer.Print();
114 }