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