]>
Commit | Line | Data |
---|---|---|
699a38d6 | 1 | void AliAnalysisTaskSEVertexingHFTest()\r |
2 | {\r | |
3 | //\r | |
4 | // Test macro for the AliAnalysisTaskSE for heavy-flavour vertexing\r | |
5 | // A.Dainese, andrea.dainese@lnl.infn.it\r | |
6 | //\r | |
98a12f96 | 7 | \r |
dcb444c9 | 8 | Bool_t inputAOD=kTRUE; // otherwise, ESD\r |
60c07aba | 9 | Bool_t createAOD=kFALSE; // kTRUE: create AOD and use it as input to vertexing\r |
10 | // kFALSE: use ESD as input to vertexing\r | |
11 | Bool_t writeKineToAOD = kTRUE;\r | |
2d0da4bb | 12 | TString mode="local"; // otherwise, "grid" \r |
0345b950 | 13 | Bool_t useParFiles=kFALSE;\r |
699a38d6 | 14 | \r |
1b089c29 | 15 | gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/LoadLibraries.C");\r |
f68c41dc | 16 | LoadLibraries(useParFiles);\r |
699a38d6 | 17 | \r |
2d0da4bb | 18 | TChain *chain = 0;\r |
699a38d6 | 19 | \r |
2d0da4bb | 20 | if(mode=="local") {\r |
21 | // Local files \r | |
22 | TString treeName,fileName;\r | |
23 | if(inputAOD) {\r | |
24 | treeName="aodTree"; \r | |
a8b951a4 | 25 | fileName="AliAOD.root";\r |
2d0da4bb | 26 | } else {\r |
27 | treeName="esdTree"; \r | |
28 | fileName="AliESDs.root";\r | |
29 | }\r | |
30 | chain = new TChain(treeName.Data());\r | |
31 | chain->Add(fileName.Data());\r | |
32 | \r | |
33 | } else if (mode=="grid") {\r | |
34 | //Fetch files with AliEn :\r | |
35 | const char *collectionfile = "Collection.xml";\r | |
36 | TGrid::Connect("alien://") ;\r | |
37 | TAlienCollection *coll = TAlienCollection::Open(collectionfile);\r | |
38 | if(inputAOD) { // input AOD\r | |
39 | chain = new TChain("aodTree");\r | |
40 | while(coll->Next()) chain->Add(coll->GetTURL(""));\r | |
41 | } else { // input ESD\r | |
42 | //Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria\r | |
43 | AliRunTagCuts *runCuts = new AliRunTagCuts();\r | |
44 | AliEventTagCuts *eventCuts = new AliEventTagCuts();\r | |
45 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();\r | |
46 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();\r | |
47 | eventCuts->SetMultiplicityRange(0,20000);\r | |
48 | //Create an AliTagAnalysis Object and chain the tags\r | |
49 | AliTagAnalysis *tagAna = new AliTagAnalysis();\r | |
50 | tagAna->SetType("ESD");\r | |
51 | TGridResult *tagResult = coll->GetGridResult("",0,0);\r | |
52 | tagResult->Print();\r | |
53 | tagAna->ChainGridTags(tagResult);\r | |
54 | //Create a new esd chain and assign the chain that is returned by querying the tags\r | |
55 | chain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts);\r | |
56 | }\r | |
dcb444c9 | 57 | } else {\r |
2d0da4bb | 58 | printf("ERROR: mode has to be \"local\" or \"grid\" \n");\r |
59 | return;\r | |
dcb444c9 | 60 | }\r |
699a38d6 | 61 | \r |
62 | \r | |
63 | // Create the analysis manager\r | |
64 | AliAnalysisManager *mgr = new AliAnalysisManager("My Manager","My Manager");\r | |
65 | mgr->SetDebugLevel(10);\r | |
66 | \r | |
67 | // Input Handler\r | |
dcb444c9 | 68 | AliInputEventHandler *inputHandler = 0;\r |
69 | if(inputAOD) {\r | |
70 | inputHandler = new AliAODInputHandler();\r | |
71 | } else {\r | |
72 | inputHandler = new AliESDInputHandler();\r | |
73 | }\r | |
699a38d6 | 74 | mgr->SetInputEventHandler(inputHandler);\r |
75 | \r | |
76 | // Output \r | |
77 | AliAODHandler *aodHandler = new AliAODHandler();\r | |
a9b75906 | 78 | const char* deltaAODfname="AliAOD.VertexingHF.root";\r |
60c07aba | 79 | if(createAOD) {\r |
e6c84ee3 | 80 | aodHandler->SetOutputFileName("AliAOD.root");\r |
60c07aba | 81 | } else {\r |
2894dc72 | 82 | aodHandler->SetFillAOD(kFALSE);\r |
a9b75906 | 83 | aodHandler->SetOutputFileName(deltaAODfname);\r |
60c07aba | 84 | aodHandler->SetCreateNonStandardAOD();\r |
85 | }\r | |
699a38d6 | 86 | mgr->SetOutputEventHandler(aodHandler);\r |
a9b75906 | 87 | mgr->RegisterExtraFile(deltaAODfname); \r |
2894dc72 | 88 | \r |
60c07aba | 89 | if(!inputAOD && createAOD) {\r |
90 | // MC Truth\r | |
91 | AliMCEventHandler* mcHandler = new AliMCEventHandler();\r | |
92 | if(writeKineToAOD) mgr->SetMCtruthEventHandler(mcHandler);\r | |
93 | AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Filter");\r | |
94 | if(writeKineToAOD) mgr->AddTask(kinefilter); \r | |
95 | // Barrel Tracks\r | |
96 | AliAnalysisTaskESDfilter *filter = new AliAnalysisTaskESDfilter("Filter");\r | |
97 | mgr->AddTask(filter);\r | |
98 | \r | |
99 | AliESDtrackCuts* esdTrackCutsHF = new AliESDtrackCuts("AliESDtrackCuts", "Heavy flavour");\r | |
100 | esdTrackCutsHF->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);\r | |
101 | \r | |
102 | AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");\r | |
103 | trackFilter->AddCuts(esdTrackCutsHF);\r | |
104 | \r | |
105 | filter->SetTrackFilter(trackFilter);\r | |
106 | \r | |
107 | // Pipelining\r | |
108 | mgr->ConnectInput(filter,0,mgr->GetCommonInputContainer());\r | |
109 | mgr->ConnectOutput(filter,0,mgr->GetCommonOutputContainer());\r | |
110 | if(writeKineToAOD) {\r | |
111 | mgr->ConnectInput(kinefilter,0,mgr->GetCommonInputContainer());\r | |
112 | mgr->ConnectOutput(kinefilter,0,mgr->GetCommonOutputContainer());\r | |
113 | }\r | |
114 | \r | |
115 | }\r | |
116 | \r | |
699a38d6 | 117 | // Vertexing analysis task \r |
29f884f0 | 118 | gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/AddTaskVertexingHF.C");\r |
a9b75906 | 119 | AliAnalysisTaskSEVertexingHF *hfTask = AddTaskVertexingHF(deltaAODfname);\r |
699a38d6 | 120 | \r |
699a38d6 | 121 | \r |
699a38d6 | 122 | //\r |
123 | // Run the analysis\r | |
124 | // \r | |
125 | printf("CHAIN HAS %d ENTRIES\n",(Int_t)chain->GetEntries());\r | |
2d0da4bb | 126 | if(!mgr->InitAnalysis()) return;\r |
127 | \r | |
128 | mgr->PrintStatus();\r | |
129 | \r | |
29f884f0 | 130 | TStopwatch watch;\r |
131 | watch.Start();\r | |
2d0da4bb | 132 | mgr->StartAnalysis(mode.Data(),chain);\r |
29f884f0 | 133 | watch.Stop();\r |
134 | watch.Print();\r | |
699a38d6 | 135 | \r |
136 | return;\r | |
137 | }\r |