1 void AliAnalysisTaskSEVertexingHFTest()
4 // Test macro for the AliAnalysisTaskSE for heavy-flavour vertexing
5 // A.Dainese, andrea.dainese@lnl.infn.it
8 Bool_t inputAOD=kFALSE; // otherwise, ESD
9 Bool_t createAOD=kTRUE; // kTRUE: create AOD and use it as input to vertexing
10 // kFALSE: use ESD as input to vertexing
11 Bool_t writeKineToAOD = kFALSE;
12 TString mode="local"; // otherwise, "grid"
13 Bool_t useParFiles=kFALSE;
14 Bool_t doCentrality=kTRUE;
16 gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/macros/LoadLibraries.C");
17 LoadLibraries(useParFiles);
18 gSystem->Load("libPWGmuon");
23 TString treeName,fileName;
26 fileName="AliAOD.root";
29 fileName="AliESDs.root";
31 chain = new TChain(treeName.Data());
32 chain->Add(fileName.Data());
34 } else if (mode=="grid") {
35 //Fetch files with AliEn :
36 const char *collectionfile = "Collection.xml";
37 TGrid::Connect("alien://") ;
38 TAlienCollection *coll = TAlienCollection::Open(collectionfile);
39 if(inputAOD) { // input AOD
40 chain = new TChain("aodTree");
41 while(coll->Next()) chain->Add(coll->GetTURL(""));
43 //Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria
44 AliRunTagCuts *runCuts = new AliRunTagCuts();
45 AliEventTagCuts *eventCuts = new AliEventTagCuts();
46 AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
47 AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
48 eventCuts->SetMultiplicityRange(0,20000);
49 //Create an AliTagAnalysis Object and chain the tags
50 AliTagAnalysis *tagAna = new AliTagAnalysis();
51 tagAna->SetType("ESD");
52 TGridResult *tagResult = coll->GetGridResult("",0,0);
54 tagAna->ChainGridTags(tagResult);
55 //Create a new esd chain and assign the chain that is returned by querying the tags
56 chain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts);
59 printf("ERROR: mode has to be \"local\" or \"grid\" \n");
64 // Create the analysis manager
65 AliAnalysisManager *mgr = new AliAnalysisManager("My Manager","My Manager");
66 mgr->SetDebugLevel(10);
69 AliInputEventHandler *inputHandler = 0;
71 inputHandler = new AliAODInputHandler();
73 inputHandler = new AliESDInputHandler();
75 mgr->SetInputEventHandler(inputHandler);
78 AliAODHandler *aodHandler = new AliAODHandler();
79 const char* deltaAODfname="AliAOD.VertexingHF.root";
81 aodHandler->SetOutputFileName("AliAOD.root");
83 aodHandler->SetOutputFileName(deltaAODfname);
84 aodHandler->SetAODExtensionMode();
86 mgr->SetOutputEventHandler(aodHandler);
87 mgr->RegisterExtraFile(deltaAODfname);
89 if(!inputAOD && createAOD) {
91 AliMCEventHandler* mcHandler = new AliMCEventHandler();
92 if(writeKineToAOD) mgr->SetMCtruthEventHandler(mcHandler);
93 AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Filter");
94 if(writeKineToAOD) mgr->AddTask(kinefilter);
97 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
98 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
101 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
102 AliAnalysisTaskESDfilter *filter = AddTaskESDFilter(writeKineToAOD);
106 // Vertexing analysis task
107 gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C");
108 AliAnalysisTaskSEVertexingHF *hfTask = AddTaskVertexingHF(deltaAODfname);
114 printf("CHAIN HAS %d ENTRIES\n",(Int_t)chain->GetEntries());
115 if(!mgr->InitAnalysis()) return;
121 mgr->StartAnalysis(mode.Data(),chain);