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