]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/totEt/macros/runCaloEt.C
fixed running with PtQAMC
[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");
99a6613d 22
53992099 23 gSystem->Load("libSTEERBase");
24 gSystem->Load("libESD");
25 gSystem->Load("libAOD");
99a6613d 26
27 gSystem->Load("libANALYSIS");
28 gSystem->Load("libANALYSISalice");
53992099 29 gSystem->Load("libCORRFW");
30
31 if (!submit) {
99a6613d 32 cout << "local - no submitting" << endl;
99a6613d 33 }
34 else {
35 cout << "submitting to grid" << endl;
99a6613d 36 }
53992099 37
4998becf 38 gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
53992099 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
4998bf42 48 char *kTreeName = "esdTree" ;
49 TChain * chain = new TChain(kTreeName,"myESDTree") ;
4998bf42 50
51 if(submit){
53992099 52 gSystem->Load("libNetx") ;
53 gSystem->Load("libgapiUI");
54 gSystem->Load("libRAliEn");
4998bf42 55 TGrid::Connect("alien://") ;
56 }
4998bf42 57
58 // Make the analysis manager
59 AliAnalysisManager *mgr = new AliAnalysisManager("TotEtManager");
60
99a6613d 61 TString detStr(det);
62 TString taskName = "TaskTotEt" + detStr;
63 TString dataStr(dataType);
54f97c57 64 TString dataStrName(dataType);
65 dataStrName.ReplaceAll("/",".");
66 TString outputName = "Et.ESD." + dataStrName + "." + detStr + ".root";
99a6613d 67 TString outputDir = "totEt" + dataStr;
68
69 cout << " taskName " << taskName
54f97c57 70 << " outputName " << outputName
71 << " outputDir (alien) " << outputDir << endl;
99a6613d 72
13b0d3c1 73 if (submit) {
99a6613d 74 gROOT->LoadMacro("CreateAlienHandlerCaloEtSim.C");
53992099 75 AliAnalysisGrid *alienHandler = CreateAlienHandlerCaloEtSim(outputDir, outputName, pluginRunMode);
4998bf42 76 if (!alienHandler) return;
77 mgr->SetGridHandler(alienHandler);
78 }
79
80 AliVEventHandler* esdH = new AliESDInputHandler;
81 mgr->SetInputEventHandler(esdH);
82 AliMCEventHandler* handler = new AliMCEventHandler;
99a6613d 83 if ( dataStr.Contains("sim") ) {
84 cout << " MC " << endl;
54f97c57 85 if ( dataStr.Contains("PbPb") ) { // a la: simPbPb/LHC10e18a
99a6613d 86 cout << " PbPb " << endl;
ce546038 87 TString fileLocation = "/home/dsilverm/data/E_T/" + dataStr + "/dir/AliESDs.root";
54f97c57 88 cout << "fileLocation " << fileLocation.Data() << endl;
89 chain->Add(fileLocation.Data()); // link to local test file
99a6613d 90 }
13b0d3c1 91 else { // pp
92 chain->Add("/home/dsilverm/data/E_T/sim/LHC10d1/117222/100/AliESDs.root"); // link to local test file
93 }
99a6613d 94 handler->SetReadTR(kFALSE);
95 mgr->SetMCtruthEventHandler(handler);
96 }
13b0d3c1 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
99a6613d 99 cout << " not MC " << endl;
100 }
4998bf42 101
4998bf42 102
99a6613d 103 AliAnalysisTaskTotEt *task1 = new AliAnalysisTaskTotEt(taskName);
104 mgr->AddTask(task1);
4998bf42 105
99a6613d 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();
4998bf42 126}