Small update to distinguish, in the HV plot, channels which are OFF, from channels...
[u/mrichter/AliRoot.git] / PWG3 / hfe / AddTaskHFE.C
CommitLineData
9075f05b 1AliAnalysisTask *AddTaskHFE(){
2 //get the current analysis manager
3 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
4 if (!mgr) {
5 Error("AddTaskHFE", "No analysis manager found.");
6 return NULL;
7 }
8 if (!mgr->GetInputEventHandler()) {
9 ::Error("AddTaskHFE", "This task requires an input event handler");
10 return NULL;
11 }
12 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
13 if (type=="AOD"){
14 ::Error("AddTaskHFE", "The tasks exits because AODs are in input");
15 return NULL;
16 }
bf61b3a5 17 Bool_t MCthere=kTRUE;
aaee8720 18 AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
bf61b3a5 19 if(!mcH){
20 MCthere=kFALSE;
21 }
9075f05b 22
23 //============= Set Task Name ===================
24 //TString taskName=("AliAnalysisTaskHFE.cxx+");
25 //===============================================
26
67fe7bd0 27 AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");
9075f05b 28 hfecuts->CreateStandardCuts();
67fe7bd0 29 hfecuts->SetMinNClustersTPC(110);
9075f05b 30 hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
67fe7bd0 31 hfecuts->SetCheckITSLayerStatus(kFALSE);
32 hfecuts->SetSigmaToVertex(10);
33 hfecuts->SetQAOn();
34 //hfecuts->SetMinNTrackletsTRD(5);
9075f05b 35
67fe7bd0 36 AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE("HFEanalysis");
37 task->SetESDAnalysis();
38 if (MCthere)
39 task->SetHasMCData(kTRUE);
40 else{
41 task->SetHasMCData(kFALSE);
42 task->SelectCollisionCandidates();
43 }
44
45 task->SetPIDStrategy(6);
9075f05b 46 task->SetHFECuts(hfecuts);
67fe7bd0 47 if(!MCthere){
48 TF1 *hBackground = new TF1("hadronicBackgroundFunction", "[0]+[1]*TMath::Erf([2]*x+[3])", 0, 20);
bf61b3a5 49 hBackground->SetParameter(0, 0.2194);
50 hBackground->SetParameter(1, 0.217);
51 hBackground->SetParameter(2, 0.6829);
52 hBackground->SetParameter(3, -2.697);
67fe7bd0 53 task->SetBackGroundFactorsFunction(hBackground);
54 }
55
56 // kPIDqa needs to be off for flat pT spectra !!!
57 task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
9075f05b 58 task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
d2af20c5 59 //task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
67fe7bd0 60 //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
61
9075f05b 62 mgr->AddTask(task);
63
64 //----------------------
65 //create data containers
66 //----------------------
67fe7bd0 67
9075f05b 68 //find input container
69 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
f4f6300d 70 TString containerName = mgr->GetCommonFileName();
71 containerName += ":PWG3_hfe";
9075f05b 72
67fe7bd0 73 task->ConnectOutput(1, mgr->CreateContainer("HFE_nEvents", TH1I::Class(),
f4f6300d 74 AliAnalysisManager::kOutputContainer, containerName.Data()));
67fe7bd0 75 task->ConnectOutput(2, mgr->CreateContainer("HFE_Results", TList::Class(),
f4f6300d 76 AliAnalysisManager::kOutputContainer, containerName.Data()));
67fe7bd0 77 task->ConnectOutput(3, mgr->CreateContainer("HFE_QA", TList::Class(),
f4f6300d 78 AliAnalysisManager::kOutputContainer, containerName.Data()));
9075f05b 79 mgr->ConnectInput (task, 0, cinput );
80
81 return task;
82}