]>
Commit | Line | Data |
---|---|---|
a6e51e61 | 1 | // $Id: AddTaskJetEmbeddingFromPYTHIA.C $ |
2 | ||
2103dc6a | 3 | THashTable* GenerateFileTable(const char* list); |
4 | ||
a6e51e61 | 5 | AliJetEmbeddingFromPYTHIATask* AddTaskJetEmbeddingFromPYTHIA( |
6 | const char *tracksName = "Tracks", | |
7 | const char *clusName = "", | |
8 | const char *cellsName = "EMCALCells", | |
9 | const char *MCPartName = "", | |
10 | const char *simpath = "/alice/sim/2012/LHC12a15e", | |
11 | Int_t nPtHard = 11, | |
12 | Double_t *ptHardScaling = 0, | |
13 | const char *aodTreeName = "aodTree", | |
14 | const char *aodTracksName = "tracks", | |
15 | const char *aodClusName = "", | |
16 | const char *aodCellsName = "emcalCells", | |
17 | const char *aodMCPartName = "mcparticles", | |
18 | const char *runperiod = "lhc12a15e", | |
19 | Bool_t includeNoITS = kTRUE, | |
20 | Double_t minCent = -1, | |
21 | Double_t maxCent = -1, | |
22 | UInt_t mask = AliVEvent::kAny, | |
4358e58a | 23 | Double_t minJetPt = 0, |
2103dc6a | 24 | const Bool_t copyArray = kTRUE, |
ca5c29fa | 25 | const Bool_t makeQA = kFALSE, |
2103dc6a | 26 | const char *fileTable = "", |
a6e51e61 | 27 | const char *taskName = "JetEmbeddingFromPYTHIATask" |
28 | ) | |
29 | { | |
30 | // Get the pointer to the existing analysis manager via the static access method. | |
31 | //============================================================================== | |
32 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
33 | if (!mgr) | |
34 | { | |
35 | ::Error("AddTaskJetEmbeddingFromPYTHIA", "No analysis manager to connect to."); | |
36 | return NULL; | |
37 | } | |
38 | ||
39 | // Check the analysis type using the event handlers connected to the analysis manager. | |
40 | //============================================================================== | |
41 | if (!mgr->GetInputEventHandler()) | |
42 | { | |
43 | ::Error("AddTaskJetEmbeddingFromPYTHIA", "This task requires an input event handler"); | |
44 | return NULL; | |
45 | } | |
46 | ||
47 | //------------------------------------------------------- | |
48 | // Init the task and do settings | |
49 | //------------------------------------------------------- | |
50 | ||
ca5c29fa | 51 | AliJetEmbeddingFromPYTHIATask *jetEmb = new AliJetEmbeddingFromPYTHIATask(taskName,makeQA); |
a6e51e61 | 52 | jetEmb->SetTracksName(tracksName); |
53 | jetEmb->SetClusName(clusName); | |
54 | jetEmb->SetCellsName(cellsName); | |
55 | jetEmb->SetMCParticlesName(MCPartName); | |
56 | jetEmb->SetAODTreeName(aodTreeName); | |
57 | jetEmb->SetAODTracksName(aodTracksName); | |
58 | jetEmb->SetAODClusName(aodClusName); | |
59 | jetEmb->SetAODCellsName(aodCellsName); | |
60 | jetEmb->SetAODMCParticlesName(aodMCPartName); | |
61 | jetEmb->SetCentralityRange(minCent, maxCent); | |
62 | jetEmb->SetTriggerMask(mask); | |
a6e51e61 | 63 | jetEmb->SetCopyArray(copyArray); |
4358e58a | 64 | jetEmb->SetJetMinPt(minJetPt); |
507f74bc | 65 | jetEmb->SetNClusters(1); |
2103dc6a | 66 | if (strcmp(fileTable, "") != 0) |
67 | jetEmb->SetFileTable(GenerateFileTable(fileTable)); | |
a6e51e61 | 68 | |
69 | jetEmb->SetIncludeNoITS(includeNoITS); | |
70 | TString runPeriod(runperiod); | |
71 | runPeriod.ToLower(); | |
72 | if (runPeriod == "lhc12a15a" || runPeriod == "lhc12a15e") { | |
73 | jetEmb->SetAODfilterBits(256,16); | |
74 | } | |
75 | else { | |
76 | if (runPeriod.IsNull()) | |
77 | ::Warning("Run period %s not known. It will use IsHybridGlobalConstrainedGlobal."); | |
78 | } | |
79 | ||
80 | jetEmb->SetPYTHIAPath(simpath); | |
81 | ||
82 | if (nPtHard > 0) { | |
83 | if (ptHardScaling==0) { | |
84 | ptHardScaling = new Double_t[nPtHard]; | |
85 | for (Int_t i = 0; i < nPtHard; i++) | |
86 | ptHardScaling[i] = 1; | |
87 | } | |
88 | jetEmb->SetPtHardBinScaling(nPtHard, ptHardScaling); | |
89 | } | |
90 | ||
91 | //------------------------------------------------------- | |
92 | // Final settings, pass to manager and set the containers | |
93 | //------------------------------------------------------- | |
94 | ||
95 | mgr->AddTask(jetEmb); | |
96 | ||
97 | // Create containers for input/output | |
98 | mgr->ConnectInput(jetEmb, 0, mgr->GetCommonInputContainer()); | |
99 | ||
ca5c29fa | 100 | if (makeQA) { |
101 | TString contName = taskName; | |
102 | contName += "_histos"; | |
103 | AliAnalysisDataContainer *outc = mgr->CreateContainer(contName, | |
104 | TList::Class(), | |
105 | AliAnalysisManager::kOutputContainer, | |
106 | "AnalysisResults.root"); | |
107 | mgr->ConnectOutput(jetEmb, 1, outc); | |
108 | } | |
109 | ||
a6e51e61 | 110 | return jetEmb; |
111 | } | |
2103dc6a | 112 | |
113 | THashTable* GenerateFileTable(const char* list) | |
114 | { | |
115 | THashTable *table = new THashTable(); | |
116 | ||
117 | TString myList = list; | |
118 | if (myList.Contains("alien:///")) { | |
119 | TFile::Cp(myList,"file:./list.txt"); | |
120 | myList = "./list.txt"; | |
121 | } | |
122 | ||
123 | // Open the input stream | |
124 | ifstream in; | |
125 | in.open(myList.Data()); | |
126 | ||
127 | // Read the input list of files and add them to the chain | |
128 | TString line; | |
129 | while (in.good()) { | |
130 | in >> line; | |
131 | ||
132 | if (line.Length() == 0) | |
133 | continue; | |
134 | ||
135 | TObjString *aodFile = new TObjString(line); | |
136 | table->Add(aodFile); | |
137 | } | |
138 | ||
139 | return table; | |
140 | } |