Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / FMD / analysis / RunAliEnFMDAnalysis.C
CommitLineData
92ddc227 1void RunAliEnFMDAnalysis(const Char_t* collectionfile = "collection.xml",
162637e4 2 const Char_t* cdbPath = "local://$ALICE_ROOT/OCDB",
92ddc227 3 const Char_t* outFile = "fmd_analysis.root"){
4
5 gSystem->Load("libANALYSIS");
7c3e5162 6 gSystem->Load("libANALYSISalice");
92ddc227 7 gSystem->Load("libFMDanalysis");
8
9 AliCDBManager* cdb = AliCDBManager::Instance();
10 cdb->SetDefaultStorage(cdbPath);
11 cdb->SetRun(0);
12
13 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
14 pars->Init();
15 if (AliGeomManager::GetGeometry() == NULL)
16 AliGeomManager::LoadGeometry();
17 AliFMDGeometry* geo = AliFMDGeometry::Instance();
18 geo->Init();
19 geo->InitTransformations();
20
21 cout<<"Creating task for analysis"<<endl;
22 AliFMDAnalysisTaskESDReader *FMDana0 = new AliFMDAnalysisTaskESDReader("reader");
aedcb4e2 23 FMDana0->SetDebugLevel(10);
92ddc227 24 AliFMDAnalysisTaskSharing *FMDana1 = new AliFMDAnalysisTaskSharing("sharing");
25 AliFMDAnalysisTaskDensity *FMDana2 = new AliFMDAnalysisTaskDensity("density");
26 AliFMDAnalysisTaskBackgroundCorrection *FMDana3 = new AliFMDAnalysisTaskBackgroundCorrection("background");
aedcb4e2 27 AliFMDAnalysisTaskDndeta *FMDana4 = new AliFMDAnalysisTaskDndeta("dNdeta");
28
92ddc227 29 cout<<"Creating the manager"<<endl;
30 AliAnalysisManager* mgr = new AliAnalysisManager("fmd_analysis","fmd_analysis");
31 mgr->AddTask(FMDana0);
32 mgr->AddTask(FMDana1);
33 mgr->AddTask(FMDana2);
34 mgr->AddTask(FMDana3);
aedcb4e2 35 mgr->AddTask(FMDana4);
36
37
92ddc227 38 AliAnalysisDataContainer* cin_esd = mgr->CreateContainer("esdTree",TTree::Class(),AliAnalysisManager::kInputContainer,"AliESDs.root");
aedcb4e2 39 AliAnalysisDataContainer* cexchangevertex = mgr->CreateContainer("esdvertex",AliESDVertex::Class(),AliAnalysisManager::kExchangeContainer);
92ddc227 40 AliAnalysisDataContainer* cexchange0 = mgr->CreateContainer("exchangeESDFMD0",AliESDEvent::Class(),AliAnalysisManager::kExchangeContainer);
7c3e5162 41 AliAnalysisDataContainer* cdiag1 = mgr->CreateContainer("diagSharing1",AliESDEvent::Class(),AliAnalysisManager::kExchangeContainer);
42 AliAnalysisDataContainer* cdiag2 = mgr->CreateContainer("diagSharing2",TList::Class(),AliAnalysisManager::kOutputContainer,"edists.root");
43 AliAnalysisDataContainer* cexchange1 = mgr->CreateContainer("exchangeESDFMD1",AliESDFMD::Class(),AliAnalysisManager::kExchangeContainer);
92ddc227 44 AliAnalysisDataContainer* cexchange2 = mgr->CreateContainer("listOfhists",TList::Class(),AliAnalysisManager::kExchangeContainer);
aedcb4e2 45 AliAnalysisDataContainer* cvertex = mgr->CreateContainer("vertex",TObjString::Class(),AliAnalysisManager::kExchangeContainer);
46 AliAnalysisDataContainer* cexchange3 = mgr->CreateContainer("BackgroundCorrectedperevent",TList::Class(),AliAnalysisManager::kOutputContainer,"testOut.root");
92ddc227 47 AliAnalysisDataContainer* coutput = mgr->CreateContainer("BackgroundCorrected",TList::Class(),AliAnalysisManager::kOutputContainer,outFile);
48
49 mgr->ConnectInput(FMDana0, 0 , cin_esd);
7c3e5162 50 mgr->ConnectOutput(FMDana0, 0 , cexchange0);
aedcb4e2 51
92ddc227 52 mgr->ConnectInput(FMDana1, 0 , cexchange0);
7c3e5162 53
54 mgr->ConnectOutput(FMDana1, 0 , cexchange1);
55 mgr->ConnectOutput(FMDana1, 1 , cexchangevertex);
56 mgr->ConnectOutput(FMDana1, 2 , cdiag1);
57 mgr->ConnectOutput(FMDana1, 3 , cdiag2);
58
59
92ddc227 60 mgr->ConnectInput(FMDana2, 0 , cexchange1);
7c3e5162 61 mgr->ConnectInput(FMDana2, 1 , cexchangevertex);
92ddc227 62 mgr->ConnectOutput(FMDana2, 0 , cexchange2);
7c3e5162 63
92ddc227 64 mgr->ConnectInput(FMDana3, 0 , cexchange2);
aedcb4e2 65 mgr->ConnectOutput(FMDana3, 0 , cexchange3);
66 mgr->ConnectOutput(FMDana3, 1 , cvertex);
67
68 mgr->ConnectInput(FMDana4, 0 , cexchange3);
69 mgr->ConnectInput(FMDana4, 1 , cvertex);
70 mgr->ConnectOutput(FMDana4, 0 , coutput);
92ddc227 71
72 TGrid::Connect("alien://",0,0,"t");
73
74
75 TChain* chain = new TChain("esdTree","esdTree");
76
77 TAlienCollection* coll = TAlienCollection::Open(collectionfile);
78 coll->Reset();
79 Int_t nFiles = 0;
bb8a464f 80 while(coll->Next() && nFiles<2) {
92ddc227 81 cout<<coll->GetTURL("")<<endl;
82 TString test(coll->GetTURL(""));
83 chain->Add(coll->GetTURL(""));
84
85 nFiles++;
86 }
87
88 mgr->InitAnalysis();
89 mgr->PrintStatus();
90 TStopwatch timer;
91 timer.Start();
92 cout<<"Executing analysis"<<endl;
93 mgr->StartAnalysis("local",chain);
94 timer.Stop();
95 timer.Print();
96}