]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/totEt/macros/runCaloEt.C
totEt cuts into their own proper class
[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 = false, // true or false 
8                const char *dataType="simPbPb/LHC10e18a", // "sim" or "real" etc.
9                const char *pluginRunMode="full", // "test" or "full" or "terminate"
10                const char *det = "EMCAL") // "PHOS" or "EMCAL"
11 {
12   TStopwatch timer;
13   timer.Start();
14   gSystem->Load("libTree");
15   gSystem->Load("libGeom");
16   gSystem->Load("libVMC");
17   gSystem->Load("libPhysics");
18
19   gSystem->Load("libMinuit");
20
21   gSystem->AddIncludePath("-I$ALICE_ROOT/include");
22   
23   gSystem->Load("libSTEERBase");
24   gSystem->Load("libESD");
25   gSystem->Load("libAOD");
26   
27   gSystem->Load("libANALYSIS");
28   gSystem->Load("libANALYSISalice");
29   gSystem->Load("libCORRFW");
30
31   if (!submit) { 
32     cout << "local - no submitting" << endl;
33   }
34   else { 
35     cout << "submitting to grid" << endl;
36   }
37    
38   gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
39   gROOT->ProcessLine(".L AliAnalysisEt.cxx+g");
40   gROOT->ProcessLine(".L AliAnalysisEtMonteCarlo.cxx+g");
41   gROOT->ProcessLine(".L AliAnalysisEtMonteCarloPhos.cxx+g");
42   gROOT->ProcessLine(".L AliAnalysisEtMonteCarloEmcal.cxx+g");
43   gROOT->ProcessLine(".L AliAnalysisEtReconstructed.cxx+g");
44   gROOT->ProcessLine(".L AliAnalysisEtReconstructedPhos.cxx+g");
45   gROOT->ProcessLine(".L AliAnalysisEtReconstructedEmcal.cxx+g");  
46   gROOT->ProcessLine(".L AliAnalysisTaskTotEt.cxx+g");
47
48   char *kTreeName = "esdTree" ;
49   TChain * chain   = new TChain(kTreeName,"myESDTree") ;
50   
51   if(submit){      
52     gSystem->Load("libNetx") ; 
53     gSystem->Load("libgapiUI");
54     gSystem->Load("libRAliEn"); 
55     TGrid::Connect("alien://") ;
56   }
57   
58   // Make the analysis manager
59   AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
60   
61   TString detStr(det);
62   TString taskName = "TaskTotEt" + detStr;
63   TString dataStr(dataType);
64   TString dataStrName(dataType);
65   dataStrName.ReplaceAll("/",".");
66   TString outputName = "Et.ESD." + dataStrName + "." + detStr + ".root";
67   TString outputDir = "totEt" + dataStr;
68
69   cout << " taskName " << taskName
70        << " outputName " << outputName 
71        << " outputDir (alien) " << outputDir << endl;
72
73   if (submit) {
74     gROOT->LoadMacro("CreateAlienHandlerCaloEtSim.C");
75     AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName, pluginRunMode);  
76     if (!alienHandler) return;
77     mgr->SetGridHandler(alienHandler);
78   }
79
80   AliVEventHandler* esdH = new AliESDInputHandler;
81   mgr->SetInputEventHandler(esdH);
82   AliMCEventHandler* handler = new AliMCEventHandler;
83   if ( dataStr.Contains("sim") ) {
84     cout << " MC " << endl;
85     if ( dataStr.Contains("PbPb") ) { // a la: simPbPb/LHC10e18a
86       cout << " PbPb " << endl;
87       TString fileLocation = "/home/dsilverm/data/E_T/" + dataStr + "/198000/001/AliESDs.root";
88       cout << "fileLocation " << fileLocation.Data() << endl; 
89       chain->Add(fileLocation.Data()); // link to local test file
90     }
91     else { // pp
92       chain->Add("/home/dsilverm/data/E_T/sim/LHC10d1/117222/100/AliESDs.root"); // link to local test file
93     }
94     handler->SetReadTR(kFALSE);
95     mgr->SetMCtruthEventHandler(handler);
96   }
97   else { // real data
98     chain->Add("/home/dsilverm/data/E_T/data/2010/LHC10b/000117222/ESDs/pass2/10000117222021.30/AliESDs.root"); // link to local test file
99     cout << " not MC " << endl;
100   }
101
102
103   AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName);
104   mgr->AddTask(task1);
105
106   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
107   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("out1", TList::Class(), AliAnalysisManager::kOutputContainer, outputName);
108   
109   //____________________________________________//
110   mgr->ConnectInput(task1,0,cinput1);
111   mgr->ConnectOutput(task1,1,coutput1);
112   
113   mgr->SetDebugLevel(0);
114   
115   if (!mgr->InitAnalysis()) return;
116   mgr->PrintStatus();
117   if(submit){
118     mgr->StartAnalysis("grid");
119   }
120   else{
121     mgr->StartAnalysis("local",chain);
122   }
123   
124   timer.Stop();
125   timer.Print();
126 }