corrected TRD/TOF MV position
[u/mrichter/AliRoot.git] / TOF / AddTOFAnalysisTaskCalibTree.C
CommitLineData
7cfa8ae2 1AliTOFAnalysisTaskCalibTree *AddTOFAnalysisTaskCalibTree()
2{
3
4 // check analysis manager
5 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
6 if (!mgr) {
7 Error("AddTOFAnalysisTaskCalibTree", "cannot get analysis manager");
8 return NULL;
9 }
10
11 //check input event handler
12 if (!mgr->GetInputEventHandler()) {
13 Error("AddTOFAnalysisTaskCalibTree", "cannot get input event handler");
14 return NULL;
15 }
16
17 // check input data type
18 TString str = mgr->GetInputEventHandler()->GetDataType();
19 if (str.CompareTo("ESD")) {
20 Error("AddTOFAnalysisTaskCalibTree", "input data type is not \"ESD\"");
21 return NULL;
22 }
23
24 // get common input data container
25 AliAnalysisDataContainer *inputc = mgr->GetCommonInputContainer();
26 if (!inputc) {
27 Error("AddTOFAnalysisTaskCalibTree", "cannot get common input container");
28 return NULL;
29 }
30
31 // setup output event handler
228b3dce 32
33 // old way: expecting to use AOD tree
34 // AliAODHandler *outputh = (AliAODHandler *)mgr->GetOutputEventHandler();
35 // outputh->SetCreateNonStandardAOD();
36 // outputh->SetOutputFileName("TOFcalibTree.root");
37
38 // new way:
39 AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("aodTree"), TTree::Class(), AliAnalysisManager::kOutputContainer, "TOFcalibTree.root"); // tree
40 if (!coutput) {
41 Error("AddTOFAnalysisTaskCalibTree", "cannot create output container");
42 return NULL;
43 }
7cfa8ae2 44
45 // create task and connect input/output
46 AliTOFAnalysisTaskCalibTree *task = new AliTOFAnalysisTaskCalibTree();
47 mgr->ConnectInput(task, 0, inputc);
228b3dce 48 mgr->ConnectOutput(task, 1, coutput);
7cfa8ae2 49
50 // setup task
51 task->SetEventSelectionFlag(kFALSE);
52 task->SetVertexSelectionFlag(kTRUE);
53 task->SetVertexCut(50.0);
54 task->SetDiscardPileupEventFlag(kFALSE);
55 task->SetPrimaryDCASelectionFlag(kFALSE);
56 task->SetCalibrateTOFsignal(kTRUE);
57 task->SetComputeT0TOF(kTRUE);
58 task->SetUseT0TOF(kFALSE);
59 task->SetUseLHCClockPhase(kFALSE);
60 // task->SetSpecificStorageParOffline("alien://?folder=/alice/cern.ch/user/r/rpreghen/OCDB");
61 // task->SetSpecificStorageRunParams("alien://?folder=/alice/cern.ch/user/r/rpreghen/OCDB");
62
63 // setup event cuts
64 task->GetEventCuts()->SetAnalyzeMC(kFALSE);
65
66 // setup TOF calib
67 task->GetTOFcalib()->SetRemoveMeanT0(kFALSE);
68 task->GetTOFcalib()->SetCalibrateTOFsignal(kTRUE);
69 task->GetTOFcalib()->SetCorrectTExp(kFALSE);
70
71 //setup resolution
72 Double_t timeReso = 100.;
73
74 // setup TOF response
75 //task->GetESDpid()->GetTOFResponse().SetTimeResolution(timeReso);
76
77 // setup TOF-T0 maker
78 task->GetTOFT0maker()->SetTimeResolution(timeReso);
79
80 // setup track cuts
81 AliESDtrackCuts *trackCuts = task->GetTrackCuts();
82 trackCuts->SetPtRange(0.15, 10.);
83 trackCuts->SetEtaRange(-1.0, 1.0);
84 trackCuts->SetRequireITSRefit(kTRUE);
85 trackCuts->SetMinNClustersITS(1);
86 // trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
87 trackCuts->SetRequireTPCRefit(kTRUE);
88 trackCuts->SetMinNClustersTPC(70);
89 trackCuts->SetMaxChi2PerClusterTPC(4.);
90 trackCuts->SetAcceptKinkDaughters(kFALSE);
91 trackCuts->SetMaxDCAToVertexZ(3.2);
92 trackCuts->SetMaxDCAToVertexXY(2.4);
93 trackCuts->SetDCAToVertex2D(kTRUE);
94
95 // return task
96 return task;
97
98}