AliPhysics  608b256 (608b256)
AddTaskHFSystPID.C
Go to the documentation of this file.
2  bool readMC = false,
3  TString trigClass = "",
4  AliVEvent::EOfflineTriggerTypes trigMask = AliVEvent::kINT7,
5  TString outputSuffix = "_ppMB_kINT7",
6  float nsigmafortag = 0.02,
7  double fracdownsampl = 1.,
8  double ptmaxdownsampl = 0.) {
9 
10  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
11  if (!mgr) {
12  ::Error("AliAnalysisTaskSEHFSystPID", "No analysis manager found.");
13  return 0;
14  }
15  if (!mgr->GetInputEventHandler()) {
16  ::Error("AliAnalysisTaskSEHFSystPID", "This task requires an input event handler");
17  return NULL;
18  }
19 
20  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
21  if(type.Contains("ESD")){
22  ::Error("AliAnalysisTaskSEHFSystPID", "This task requires to run on AOD");
23  return NULL;
24  }
25 
26  AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts();
27  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
28  esdTrackCuts->SetRequireTPCRefit(kTRUE);
29  esdTrackCuts->SetRequireITSRefit(kTRUE);
30  esdTrackCuts->SetMinNClustersTPC(50);
31  esdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
32  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
33  esdTrackCuts->SetMinDCAToVertexXY(0.);
34  esdTrackCuts->SetMaxDCAToVertexZ(2.5);
35  esdTrackCuts->SetPtRange(0.,1.e10);
36 
37  //========= Add task for standard analysis to the ANALYSIS manager ====
38  AliAnalysisTaskSEHFSystPID *task = new AliAnalysisTaskSEHFSystPID("SystNsigmaPIDtask",system);
39  task->SetReadMC(readMC);
40  task->SetTriggerInfo(trigClass.Data(),trigMask);
41  task->SetESDtrackCuts(esdTrackCuts);
42  task->SetNsigmaKaonForTagging(nsigmafortag);
43  if(fracdownsampl<1.)task->EnableDownSampling(fracdownsampl,ptmaxdownsampl);
44  mgr->AddTask(task);
45 
46  TString outputfile = AliAnalysisManager::GetCommonFileName();
47  outputfile += ":PWGHF_D2H_SystNsigmaPID";
48 
49  //define input container
50  AliAnalysisDataContainer *cinput = mgr->CreateContainer("cinputPID",TChain::Class(),AliAnalysisManager::kInputContainer);
51  //define output containers
52  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("coutputPIDhistos%s",outputSuffix.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
53  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("coutputPIDtree%s",outputSuffix.Data()),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
54 
55  //connect containers
56  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
57  mgr->ConnectOutput (task, 1, coutput1);
58  mgr->ConnectOutput (task, 2, coutput2);
59  return task;
60 }
void SetTriggerInfo(TString trigClass, unsigned long long mask=0)
void EnableDownSampling(double fractokeep=0.1, double ptmax=1.5)
void SetESDtrackCuts(AliESDtrackCuts *trackCuts)
void SetNsigmaKaonForTagging(float nsigmamax=0.02)
AliAnalysisTaskSEHFSystPID * AddTaskHFSystPID(int system=0, bool readMC=false, TString trigClass="", AliVEvent::EOfflineTriggerTypes trigMask=AliVEvent::kINT7, TString outputSuffix="_ppMB_kINT7", float nsigmafortag=0.02, double fracdownsampl=1., double ptmaxdownsampl=0.)