Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / FMD / analysis / RunAliEnFMDAnalysisSE.C
CommitLineData
162637e4 1void RunAliEnFMDAnalysisSE(const Char_t* collectionName="collection.xml", const Char_t* cdbPath="local://$ALICE_ROOT/OCDB") {
7c3e5162 2
3 gSystem->Load("libANALYSIS");
4 gSystem->Load("libANALYSISalice");
5 gSystem->Load("libFMDanalysis");
6
7 TGrid::Connect("alien://",0,0,"t");
8 TChain* chain = CreateChainSingle(collectionName);
9
10 if (!chain) return;
11
12 //
13 // Make the analysis manager
14 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "A test setup for the analysis train");
15 // ESD input handler
16 AliESDInputHandler *esdHandler = new AliESDInputHandler();
17 mgr->SetInputEventHandler(esdHandler);
bb8a464f 18
19 AliMCEventHandler *mcHandler = new AliMCEventHandler();
20 mgr->SetMCtruthEventHandler(mcHandler);
21
7c3e5162 22 AliAODHandler* aodHandler = new AliAODHandler();
23 mgr->SetOutputEventHandler(aodHandler);
24 aodHandler->SetOutputFileName("AliAODs.root");
25
26
27 AliAnalysisDataContainer *cin_esd = mgr->CreateContainer("cESD",TChain::Class(),
28 AliAnalysisManager::kInputContainer);
29 // Output AOD container. Pointer to AOD put here only by filter task.
30 // This container is managed by the AOD handler
31 AliAnalysisDataContainer *cout_aod = mgr->CreateContainer("cAOD", TTree::Class(),
32 AliAnalysisManager::kOutputContainer, "default");
33
34 AliFMDAnalysisTaskSE *fmdana = new AliFMDAnalysisTaskSE("FMDAnalysis");
35 mgr->AddTask(fmdana);
36 // Output histograms list for jet analysis
37 AliAnalysisDataContainer *cout_fmd = mgr->CreateContainer("BackgroundCorrected",
38 TList::Class(),
39 AliAnalysisManager::kOutputContainer, "fmd_analysis.root");
40 // Dummy AOD output container for jet analysis (no client yet)
41 AliAnalysisDataContainer *c_aodfmd = mgr->CreateContainer("cAODfmd",
42 TTree::Class(),
43 AliAnalysisManager::kExchangeContainer);
44 // Connect to data containers
45 mgr->ConnectInput (fmdana, 0, cin_esd );
46 mgr->ConnectOutput (fmdana, 0, c_aodfmd );
47 mgr->ConnectOutput (fmdana, 1, cout_fmd );
48
49
50 AliCDBManager* cdb = AliCDBManager::Instance();
51 cdb->SetDefaultStorage(cdbPath);
52 cdb->SetRun(0);
53
54 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
55 pars->Init();
56 if (AliGeomManager::GetGeometry() == NULL)
57 AliGeomManager::LoadGeometry();
58
59 AliFMDGeometry* geo = AliFMDGeometry::Instance();
60 geo->Init();
61 geo->InitTransformations();
62
63 TStopwatch timer;
64 timer.Start();
65 if (mgr->InitAnalysis()) {
66 mgr->PrintStatus();
bb8a464f 67 mgr->StartAnalysis("local",chain, 100);
7c3e5162 68 }
69 timer.Stop();
70 timer.Print();
71}
72//______________________________________________________________________________
73TChain* CreateChainSingle(const char* xmlfile, const char *treeName="esdTree")
74{
75 printf("*******************************\n");
76 printf("*** Getting the ESD Chain ***\n");
77 printf("*******************************\n");
78 TAlienCollection * myCollection = TAlienCollection::Open(xmlfile);
79
80 if (!myCollection) {
81 ::Error("CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
82 return NULL ;
83 }
84
85 TChain* chain = new TChain(treeName);
86 myCollection->Reset() ;
87 while ( myCollection->Next() ) chain->Add(myCollection->GetTURL("")) ;
88 chain->ls();
89 return chain;
90}