]>
Commit | Line | Data |
---|---|---|
83fca002 | 1 | // $Id$ |
2 | ||
3 | AliEmcalClusterMaker* AddTaskEmcalClusterMaker( | |
1b7db93b | 4 | const UInt_t nonLinFunct = AliEMCALRecoUtils::kBeamTestCorrected, |
37fb60a7 | 5 | const Bool_t remExClus = kTRUE, |
83fca002 | 6 | const char *nClusters = 0, |
7 | const char *outClusName = "EmcCaloClusters", | |
3c1723aa | 8 | const Double_t emin = 0.3, |
83fca002 | 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" | |
ea85851e | 31 | |
32 | TString nCells = "emcalCells"; | |
33 | if (inputDataType == "ESD") | |
34 | nCells = "EMCALCells"; | |
35 | ||
83fca002 | 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 | ||
f4a76074 | 47 | TString name(Form("EmcalClusterMaker_%s_%s", nClusters, outClusName)); |
83fca002 | 48 | AliEmcalClusterMaker *ecm = new AliEmcalClusterMaker(name, histo); |
49 | ecm->SetOutClusName(outClusName); | |
ea85851e | 50 | ecm->SetCaloCellsName(nCells); |
1b7db93b | 51 | AliEMCALRecoUtils *ru = new AliEMCALRecoUtils; |
52 | ru->SetNonLinearityFunction(nonLinFunct); | |
37fb60a7 | 53 | if(remExClus) ru->SwitchOnRejectExoticCluster(); |
1b7db93b | 54 | ecm->SetRecoUtils(ru); |
83fca002 | 55 | AliClusterContainer *clusCont = ecm->AddClusterContainer(nClusters); |
802f60b5 | 56 | clusCont->SetClusECut(emin); |
83fca002 | 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 | } |