]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | ||
3 | AliEmcalClusterMaker* AddTaskEmcalClusterMaker( | |
4 | const UInt_t nonLinFunct = AliEMCALRecoUtils::kBeamTestCorrected, | |
5 | const Bool_t remExClus = kTRUE, | |
6 | const char *nClusters = 0, | |
7 | const char *outClusName = "EmcCaloClusters", | |
8 | const Double_t emin = 0.3, | |
9 | const Bool_t histo = kFALSE, | |
10 | const char *outputname = "AnalysisResults.root" | |
11 | ) | |
12 | { | |
13 | // Get the pointer to the existing analysis manager via the static access method. | |
14 | //============================================================================== | |
15 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
16 | if (!mgr) | |
17 | { | |
18 | ::Error("AddTaskHadCorr", "No analysis manager to connect to."); | |
19 | return NULL; | |
20 | } | |
21 | ||
22 | // Check the analysis type using the event handlers connected to the analysis manager. | |
23 | //============================================================================== | |
24 | if (!mgr->GetInputEventHandler()) | |
25 | { | |
26 | ::Error("AddTaskHadCorr", "This task requires an input event handler"); | |
27 | return NULL; | |
28 | } | |
29 | ||
30 | TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
31 | ||
32 | TString nCells = "emcalCells"; | |
33 | if (inputDataType == "ESD") | |
34 | nCells = "EMCALCells"; | |
35 | ||
36 | if (nClusters==0) { | |
37 | if (inputDataType != "ESD") | |
38 | nClusters = "caloClusters"; | |
39 | else | |
40 | nClusters = "CaloClusters"; | |
41 | } | |
42 | ||
43 | //------------------------------------------------------- | |
44 | // Init the task and do settings | |
45 | //------------------------------------------------------- | |
46 | ||
47 | TString name(Form("EmcalClusterMaker_%s_%s", nClusters, outClusName)); | |
48 | AliEmcalClusterMaker *ecm = new AliEmcalClusterMaker(name, histo); | |
49 | ecm->SetOutClusName(outClusName); | |
50 | ecm->SetCaloCellsName(nCells); | |
51 | AliEMCALRecoUtils *ru = new AliEMCALRecoUtils; | |
52 | ru->SetNonLinearityFunction(nonLinFunct); | |
53 | if(remExClus) ru->SwitchOnRejectExoticCluster(); | |
54 | ecm->SetRecoUtils(ru); | |
55 | AliClusterContainer *clusCont = ecm->AddClusterContainer(nClusters); | |
56 | clusCont->SetClusECut(emin); | |
57 | ||
58 | //------------------------------------------------------- | |
59 | // Final settings, pass to manager and set the containers | |
60 | //------------------------------------------------------- | |
61 | ||
62 | mgr->AddTask(ecm); | |
63 | ||
64 | // Create containers for input/output | |
65 | mgr->ConnectInput (ecm, 0, mgr->GetCommonInputContainer()); | |
66 | ||
67 | if (histo) { | |
68 | AliAnalysisDataContainer *coecm = mgr->CreateContainer(name, | |
69 | TList::Class(), | |
70 | AliAnalysisManager::kOutputContainer, | |
71 | outputname); | |
72 | mgr->ConnectOutput(ecm,1,coecm); | |
73 | } | |
74 | ||
75 | return ecm; | |
76 | } |