]>
Commit | Line | Data |
---|---|---|
1ea7a921 | 1 | AliPhysicsSelectionTask* AddTaskPhysicsSelection(Bool_t mCAnalysisFlag = kFALSE, Bool_t deprecatedFlag = kTRUE, UInt_t computeBG = 0) |
91bea6e7 | 2 | { |
3 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
4 | if (!mgr) { | |
5 | ::Error("AddTaskPhysicsSelection", "No analysis manager to connect to."); | |
6 | return NULL; | |
7 | } | |
8 | ||
9 | // Check the analysis type using the event handlers connected to the analysis manager. | |
10 | //============================================================================== | |
11 | if (!mgr->GetInputEventHandler()) { | |
12 | ::Error("AddTaskPhysicsSelection", "This task requires an input event handler"); | |
13 | return NULL; | |
14 | } | |
df3ed201 | 15 | |
16 | AliVEventHandler *inputHandler=mgr->GetInputEventHandler(); | |
91bea6e7 | 17 | |
df3ed201 | 18 | TString inputDataType = inputHandler->GetDataType(); // can be "ESD" or "AOD" |
19 | ||
91bea6e7 | 20 | // Configure analysis |
21 | //=========================================================================== | |
91bea6e7 | 22 | AliPhysicsSelectionTask *task = new AliPhysicsSelectionTask(""); |
df3ed201 | 23 | |
24 | // this makes physics selection to work using AliMultiInputEventHandler | |
25 | if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) { | |
26 | AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler; | |
27 | AliInputEventHandler *ih = multiInputHandler->GetFirstInputEventHandler(); | |
28 | if (!ih) { | |
c39e2462 | 29 | ::Error("AddTaskPhysicsSelection","ESD or AOD input handler is missing"); |
df3ed201 | 30 | return NULL; |
31 | } | |
32 | ih->SetEventSelection(multiInputHandler->GetEventSelection()); | |
33 | inputDataType = ih->GetDataType(); // can be "ESD" or "AOD" | |
34 | } | |
35 | ||
78167ba7 | 36 | mgr->AddTask(task); |
91bea6e7 | 37 | |
38 | AliPhysicsSelection* physSel = task->GetPhysicsSelection(); | |
91bea6e7 | 39 | if (mCAnalysisFlag) |
40 | physSel->SetAnalyzeMC(); | |
73cc8654 | 41 | if (computeBG) |
141265a2 | 42 | physSel->SetComputeBG(computeBG); |
78167ba7 | 43 | |
1ea7a921 | 44 | if(!deprecatedFlag) |
45 | AliFatal("The BG ID flag is deprecated. Please use the OADB to configure the cuts"); | |
46 | ||
78167ba7 | 47 | AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer(); |
48 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("cstatsout", | |
91bea6e7 | 49 | TList::Class(), |
50 | AliAnalysisManager::kOutputContainer, | |
51 | "EventStat_temp.root"); | |
ebb6dbd1 | 52 | |
78167ba7 | 53 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); |
54 | mgr->ConnectOutput(task,1,coutput1); | |
55 | ||
56 | return task; | |
78167ba7 | 57 | } |