]>
Commit | Line | Data |
---|---|---|
1263f837 | 1 | // $Id$ |
2 | ||
3 | AliEmcalPatchFromCellMaker* AddTaskEmcalPatchFromCellMaker( | |
4 | Int_t patchDim = 32, | |
1900c517 | 5 | Double_t cellMinE = 0.05, |
1263f837 | 6 | Bool_t bSlideL1 = kFALSE, |
7 | const char *patchOutName = "EmcalPatches", | |
8 | const char *cellsName = 0, | |
9 | const char *taskName = "PatchFromCellMaker") | |
10 | { | |
11 | // Get the pointer to the existing analysis manager via the static access method. | |
12 | //============================================================================== | |
13 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
14 | if (!mgr) | |
15 | { | |
16 | ::Error("AddTaskEmcalPatchFromCellMaker", "No analysis manager to connect to."); | |
17 | return NULL; | |
18 | } | |
19 | ||
20 | // Check the analysis type using the event handlers connected to the analysis manager. | |
21 | //============================================================================== | |
22 | AliVEventHandler *evhand = mgr->GetInputEventHandler(); | |
23 | if (!evhand) { | |
24 | ::Error("AddTaskEmcalPatchFromCellMaker", "This task requires an input event handler"); | |
25 | return NULL; | |
26 | } | |
27 | ||
28 | TString strCellsName(cellsName); | |
29 | if(strCellsName.IsNull()) { | |
30 | if (evhand->InheritsFrom("AliESDInputHandler")) { | |
31 | strCellsName = "EMCALCells"; | |
32 | ::Info("AddTaskEmcalPatchFromCellMaker", Form( "ESD analysis, cellsName = \"%s\"", strCellsName.Data() )); | |
33 | } | |
34 | else { | |
35 | strCellsName = "emcalCells"; | |
36 | ::Info("AddTaskEmcalPatchFromCellMaker", Form( "AOD analysis, cellsName = \"%s\"", strCellsName.Data() )); | |
37 | } | |
38 | } | |
39 | ||
40 | TString strPatchOutName = Form("%s%dx%d",patchOutName,patchDim,patchDim); | |
41 | TString name = Form("%s_%s",taskName,strPatchOutName.Data()); | |
42 | ||
43 | //------------------------------------------------------- | |
44 | // Init the task and do settings | |
45 | //------------------------------------------------------- | |
46 | ||
47 | AliEmcalPatchFromCellMaker *eTask = new AliEmcalPatchFromCellMaker(name); | |
48 | eTask->SetCaloTriggersOutName(strPatchOutName.Data()); | |
49 | eTask->SetCaloCellsName(strCellsName.Data()); | |
50 | eTask->SetPatchDimension(patchDim); | |
51 | eTask->SetMinCellE(cellMinE); | |
52 | eTask->ActivateSlidingPatch(bSlideL1); | |
53 | ||
54 | //------------------------------------------------------- | |
55 | // Final settings, pass to manager and set the containers | |
56 | //------------------------------------------------------- | |
57 | mgr->AddTask(eTask); | |
58 | ||
59 | // Create containers for input/output | |
60 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
61 | TString contname(name); | |
62 | contname += "_histos"; | |
63 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), | |
64 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
65 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
66 | ||
67 | mgr->ConnectInput (eTask, 0, cinput1 ); | |
68 | mgr->ConnectOutput (eTask, 1, coutput1 ); | |
69 | ||
70 | return eTask; | |
71 | } |