Split: fix refs to AddTaskPhysicsSelection.C
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_pp_pi0 / macros / Pi0Spectrum_LHC11a.C
CommitLineData
80355243 1void Pi0Spectrum(const char* dataset="")
2{
3
4070f709 4 gSystem->Load("libTree");
5 gSystem->Load("libGeom");
6 gSystem->Load("libVMC");
7 gSystem->Load("libPhysics");
80355243 8
9 //load analysis framework
10 gSystem->Load("libANALYSIS");
11 gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE
12
13 gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS");
14
15 // A task can be compiled dynamically with AClic
16 gROOT->LoadMacro("AliCaloPhoton.cxx+g");
17 gROOT->LoadMacro("AliAnalysisTaskPi0.cxx+g");
18
19 // Connect to alien
20 TString token = gSystem->Getenv("GRID_TOKEN") ;
21 if ( token == "OK" )
22 TGrid::Connect("alien://");
23 else
24 AliInfo("You are not connected to the GRID") ;
25
26 cout << "Pi0Analysis: processing collection " << dataset << endl;
27
28 // Create the chain
29 TChain* chain = new TChain("esdTree");
30 TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset));
31
32 TAlienResult* result = collection->GetGridResult("",0 ,0);
33 TList* rawFileList = result->GetFileInfoList();
34
35 for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) {
36 TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(counter)) ;
37 const char * rawFile = fi->GetCurrentUrl()->GetUrl() ;
38 printf("Processing %s\n", rawFile) ;
39 chain->Add(rawFile);
40 printf("Chain: %d entries.\n",chain->GetEntries());
41 }
42
43 // Make the analysis manager
44 AliAnalysisManager *mgr = new AliAnalysisManager("Pi0Spectrum");
45
46 // ESD input handler
47 AliESDInputHandler* esdH = new AliESDInputHandler();
48 esdH->SetReadFriends(kFALSE);
49 mgr->SetInputEventHandler(esdH);
50
51 // Debug level
52 mgr->SetDebugLevel(0);
53
54 // Add physics selection
63b6cbd0 55 gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
80355243 56 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
57
58 // Add my task
59 AliAnalysisTaskPi0 *task1 = new AliAnalysisTaskPi0("Pi0Spectrum");
60
61 TFile *fBadMap = TFile::Open("BadMap_LHC11a_pp2760_20130902.root");
62 if(fBadMap->IsOpen()){
63 printf("\n\n...Adding PHOS bad channel map \n") ;
64 gROOT->cd();
65 char key[55] ;
66 for(Int_t mod=1;mod<4; mod++){
67 sprintf(key,"PHOS_BadMap_mod%d",mod) ;
68 TH2I * h = (TH2I*)fBadMap->Get(key) ;
69 if(h)
70 task1->SetPHOSBadMap(mod,h) ;
71 }
72 fBadMap->Close() ;
73 }
74 // Set BC gap for LHC10e in seconds
75 task1->SetBCgap(525.e-09);
76
77 // Set abs.recalibration for LHC11a
78 task1->SetRecalib(1, 0.9942);
79 task1->SetRecalib(2, 0.9822);
80 task1->SetRecalib(3, 1.0072);
81
82 task1->SelectCollisionCandidates(AliVEvent::kMB);
83 mgr->AddTask(task1);
84
85 // Create containers for input/output
86 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
87 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histESD",TList::Class(),AliAnalysisManager::kOutputContainer,"histos.root");
88
89 // Connect input/output
90 mgr->ConnectInput(task1 , 0, cinput);
91 mgr->ConnectOutput(task1, 1, coutput1);
92
93 if (mgr->InitAnalysis()) {
94 mgr->PrintStatus();
95 mgr->StartAnalysis("local", chain);
96 }
97
98}