AliPhysics  aaf9c62 (aaf9c62)
AddTaskTriggerRates.C
Go to the documentation of this file.
2 {
4 
5  // Get the pointer to the existing analysis manager via the static access method.
6  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
7  if(!mgr) {
8  Error("AddTaskTriggerRates","AliAnalysisManager not set!");
9  return NULL;
10  }
11 
12  // This task run on ESDs
13  TString type = mgr->GetInputEventHandler()->GetDataType();
14  if (!type.Contains("ESD")) {
15  Error("AddTaskTriggerRates", "ESD input handler needed!");
16  return NULL;
17  }
18 
19  // Create and configure task
20  TString suffix = (!extension.IsNull()) ? Form("_%s",extension.Data()) : "";
21  AliAnalysisTaskTriggerRates *task = new AliAnalysisTaskTriggerRates(Form("TriggerRates%s",suffix.Data()));
22  if (!task) {
23  Error("AddTaskTriggerRates", "Trigger rates task cannot be created!");
24  return NULL;
25  }
26 
27  // Add task to analysis manager
28  mgr->AddTask(task);
29 
30  // Connect input container
31  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
32 
33  // Define output file directory
34  TString outputfile = "Output.root"; // mgr->GetCommonFileName();
35  if ( outputfile.IsNull() ) {
36  Error("AddTaskTriggerRates", "Common output file is not defined!");
37  return NULL;
38  }
39 
40  // Create and connect output containers
41  AliAnalysisDataContainer *trigStat = mgr->CreateContainer(Form("triggerCounters%s",suffix.Data()), AliCounterCollection::Class(), AliAnalysisManager::kOutputContainer, outputfile);
42  mgr->ConnectOutput(task, 1, trigStat);
43 
44  return task;
45 }
46 
task to study online/offline trigger combinations
AliAnalysisTaskTriggerRates * AddTaskTriggerRates(TString extension="")