runAnalysis.C 1.59 KB
Newer Older
1
2
void runAnalysis()
{
3
    // Erase output txt files
4
5
6
7
    ofstream summary, detail;
    summary.open ("esd-summary.dat");
    summary << " " << endl;
    summary.close();
8

9
10
11
    detail.open ("esd-detail.dat");
    detail << " " << endl;
    detail.close();
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38



    // since we will compile a class, tell root where to look for headers
    gROOT->ProcessLine(".include $ROOTSYS/include");
    gROOT->ProcessLine(".include $ALICE_ROOT/include");

    // create the analysis manager
    AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
    AliESDInputHandler *esdH = new AliESDInputHandler();
    mgr->SetInputEventHandler(esdH);

    // compile the class (locally)
    gROOT->LoadMacro("AliAnalysisTaskMyTask.cxx++g");
    // load the addtask macro
    gROOT->LoadMacro("AddMyTask.C");
    // create an instance of your analysis task
    AliAnalysisTaskMyTask *task = AddMyTask();

    if(!mgr->InitAnalysis()) return;
    mgr->SetDebugLevel(2);
    mgr->PrintStatus();
    mgr->SetUseProgressBar(1, 25);

    // if you want to run locally, we need to define some input
    TChain* chain = new TChain("esdTree");
    // add a few files to the chain (change this so that your local files are added)
39
40
    chain->Add("AliESDs.root"); // Breno put it on the same directory that was cloned from Pezzi's 					// repository: AliESD_Example

41
42
43
44
45
46
47
48
    //chain->Add("../root_files/AliAOD.Muons2.root");
    //chain->Add("../root_files/AliAOD.Muons3.root");
    //chain->Add("../root_files/AliAOD.Muons4.root");

    // start the analysis locally, reading the events from the tchain
    mgr->StartAnalysis("local", chain);


Lucas Mello Schnorr's avatar
Lucas Mello Schnorr committed
49
    exit();
50
}