TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / ANALYSIS / macros / runProofNormalization.C
1 #define TENDER
2
3 void runProofNormalization(const char * dataset = "LHC09b12_7TeV_0.5T", TString dataSetPath ="/PWG0/jgrosseo/",const char * filename = "LHC09b12_7TeV_0.5T_norm.root", Bool_t isMC = 1,Int_t nev =123456789) {
4
5 #ifdef TENDER
6   TGrid::Connect("alien://");
7 #endif
8   gEnv->SetValue("XSec.GSI.DelegProxy","2");
9   TProof::Open("alice-caf","workers=1x");// limit the number of workers
10   //  gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
11   //  gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/");
12   //  gSystem->AddIncludePath("-I${ALICE_ROOT}/include/");
13     // Use a precompiled tag
14     TString alirootMode="";    // STEERBase,ESD,AOD,ANALYSIS,ANALYSISalice (default aliroot mode)
15     //alirootMode="ALIROOT";     // $ALICE_ROOT/macros/loadlibs.C
16     //  alirootMode="REC";     // $ALICE_ROOT/macros/loadlibsrec.C
17     //  alirootMode="SIM";     // $ALICE_ROOT/macros/loadlibssim.C
18     //  alirootMode="TRAIN";   // $ALICE_ROOT/macros/loadlibstrain.C (not working yet)
19     //  alirootMode="CUSTOM";  // nothing is loaded, but aliroot variables are set (not working yet)
20  
21     TString extraLibs;
22     extraLibs= ""; // not needed in default aliroot mode
23     extraLibs+="CDB:RAWDatabase:STEER:Tender:TRDbase:STAT:TRDrec:VZERObase:VZEROsim:VZEROrec:RAWDatarec:TPCbase:TPCrec:TPCcalib:TenderSupplies:RAWDatabase:RAWDatarec:RAWDatasim:TOFbase:TOFrec";
24     TList *list = new TList();
25     // sets $ALIROOT_MODE on each worker to let proof to know to run in special mode
26     list->Add(new TNamed("ALIROOT_MODE", alirootMode.Data()));
27     // sets $ALIROOT_EXTRA_LIBS on each worker to let proof to know to load extra libs
28     list->Add(new TNamed("ALIROOT_EXTRA_LIBS", extraLibs.Data()));
29 #ifdef TENDER
30     list->Add(new TNamed("ALIROOT_ENABLE_ALIEN", "1"));
31 #endif
32     // connect to proof
33     gProof->EnablePackage("VO_ALICE@AliRoot::v4-21-22-AN", list);
34     //    gProof->Exec("TGrid::Connect(\"alien://\");");
35   // gProof->UploadPackage("$ALICE_ROOT/obj/STEERBase");
36   // gProof->EnablePackage("$ALICE_ROOT/obj/STEERBase");
37   // gProof->UploadPackage("$ALICE_ROOT/obj/ESD");
38   // gProof->EnablePackage("$ALICE_ROOT/obj/ESD");
39   // gProof->UploadPackage("$ALICE_ROOT/obj/AOD");
40   // gProof->EnablePackage("$ALICE_ROOT/obj/AOD");
41   // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSIS");
42   // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSIS");
43   // gProof->UploadPackage("$ALICE_ROOT/obj/OADB");
44   // gProof->EnablePackage("$ALICE_ROOT/obj/OADB");
45   // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSISalice");
46   // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSISalice");
47 //   gProof->UploadPackage("STEERBase.par");
48 //   gProof->EnablePackage("STEERBase");
49 //   gProof->UploadPackage("ESD.par");
50 //   gProof->EnablePackage("ESD");
51 //   gProof->UploadPackage("AOD.par");
52 //   gProof->EnablePackage("AOD");
53 //   gProof->UploadPackage("ANALYSIS.par");
54 //   gProof->EnablePackage("ANALYSIS");
55 //   gProof->UploadPackage("ANALYSISalice.par");
56 //   gProof->EnablePackage("ANALYSISalice");
57 //   gProof->UploadPackage("CORRFW.par");
58 //   gProof->EnablePackage("CORRFW"); 
59
60   // Make the analysis manager
61   AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
62   //  mgr->SetDebugLevel(3);
63   // Add ESD handler
64   AliESDInputHandler* esdH = new AliESDInputHandler; 
65
66   mgr->SetInputEventHandler(esdH);
67         
68   if(isMC) {
69     AliMCEventHandler *mc = new AliMCEventHandler();
70     mc->SetReadTR(kFALSE);
71     mgr->SetMCtruthEventHandler(mc);
72   }
73   //____________________________________________//
74
75 #ifdef TENDER
76   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C");
77   AliAnalysisTask* tender=0x0;
78   if(!isMC)
79     {
80       tender = AddTaskTender(kTRUE);
81       // tender->SetDebugLevel(10);
82     }
83   else
84     {
85       tender = AddTaskTender(kFALSE);
86       // tender->SetDebugLevel(10);
87     }
88 #endif
89
90   gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPhysicsSelection.C");
91   AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC,1,!isMC); // Use Physics Selection. Enable computation of BG if is not MC
92   //  task->SelectCollisionCandidates(); /// This should be disabled, at least for MC: we need all the events
93   physSelTask->GetPhysicsSelection()->SetBin0Callback("TaskNormalization");
94
95   // assign simple task
96   AliCollisionNormalizationTask * task = new AliCollisionNormalizationTask("TaskNormalization");
97   //  task->SetMC();
98   task->SetMC(isMC);
99   mgr->AddTask(task);
100
101
102
103   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();   
104   mgr->ConnectInput(task,0,cinput1);
105
106
107   
108   // Attach output
109   cOutput = mgr->CreateContainer("Norm", TList::Class(), AliAnalysisManager::kOutputContainer,filename);
110   mgr->ConnectOutput(task, 1, cOutput);      
111         
112   if (!mgr->InitAnalysis()) return;
113         
114   mgr->PrintStatus();
115   mgr->StartAnalysis("proof",dataSetPath+dataset+"#esdTree",nev);
116
117 }