committing on behalf of Silvia... new macros for HFE analysis on the train (Markus
[u/mrichter/AliRoot.git] / PWG3 / hfe / macros / ConfigHFEstandard.C
1 AliAnalysisTaskHFE* ConfigHFEstandard(Bool_t useMC){
2   //
3   // HFE standard task configuration
4   //
5
6   Bool_t kAnalyseTaggedTracks = kTRUE;
7   
8   AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");
9   hfecuts->CreateStandardCuts();
10   //hfecuts->SetTPCiter1(kTRUE);
11   hfecuts->SetMinNClustersTPC(100);
12   //hfecuts->SetMinNClustersITS(1);
13   hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
14   hfecuts->SetCheckITSLayerStatus(kFALSE);
15   hfecuts->UnsetVertexRequirement();
16   hfecuts->SetVertexRange(10.);
17   //hfecuts->SetSigmaToVertex(10);
18   hfecuts->SetQAOn();
19   //hfecuts->SetMinNTrackletsTRD(5);
20
21   AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE("HFEanalysisStandard");
22   printf("task %p\n", task);
23   task->SetHFECuts(hfecuts);
24   task->SetRemovePileUp(kTRUE);
25
26   // Define Variables
27   AliHFEvarManager *vm = task->GetVarManager();
28   vm->AddVariable("pt");
29   vm->AddVariable("eta");
30   vm->AddVariable("phi");
31   vm->AddVariable("charge");
32   vm->AddVariable("source");
33   //vm->AddVariable("centrality");
34
35   if(!useMC){
36     // New background model (LHC10d pass2)
37     TF1 *hBackground = new TF1("hadronicBackgroundFunction", "TMath::Min(0.99, TMath::Max(0., TMath::Exp([0]+[1]*x) + [2]*TMath::Gaus(x,[3],[4])))", 0., 20.);
38     hBackground->SetParameter(0, -7.267);
39     hBackground->SetParameter(1, 1.442);
40     hBackground->SetParameter(2, 0.02579);
41     hBackground->SetParameter(3, 2.066);
42     hBackground->SetParameter(4, 0.3016);
43 /*
44     TF1 *hBackground = new TF1("hadronicBackgroundFunction", "[0]+[1]*TMath::Erf([2]*x+[3])", 0, 20);
45     hBackground->SetParameter(0, 8.19639e-02);
46     hBackground->SetParameter(1, 7.66857e-02);
47     hBackground->SetParameter(2, 8.74797e-01);
48     hBackground->SetParameter(3, -2.69972e+00);
49 */
50 /*    hBackground->SetParameter(0, 0.1249);
51     hBackground->SetParameter(1, 0.1239);
52     hBackground->SetParameter(2, 0.8156);
53     hBackground->SetParameter(3, -2.867);*/
54     task->SetBackGroundFactorsFunction(hBackground);
55   }
56
57   // Define PID
58   AliHFEpid *pid = task->GetPID();
59   if(useMC) pid->SetHasMCData(kTRUE);
60   pid->AddDetector("TOF", 0);
61   pid->AddDetector("TPC", 1);
62   pid->ConfigureTPCrejection();
63   // Define electron line correction
64   /*TF1 *elelinecorrection = new TF1("elelinecorrection", "[0]*TMath::Exp([1]*x", 0.. 20.);
65   elelinecorrection->SetParameter(0, -1.28330e-01);
66   elelinecorrection->SetParameter(1, -2.53721e-01);
67   AliHFEpidTPC *tpcpid = dynamic_cast<AliHFEpidTPC *>(pid->GetDetPID(AliHFEpid::kTPCpid));
68   tpcpid->SetElectronMeanCorrection(elelinecorrection);*/
69
70   if(kAnalyseTaggedTracks){
71     AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
72     v0trackCuts->CreateStandardCuts();
73     v0trackCuts->SetMinNClustersTPC(60);
74     v0trackCuts->SetMinNClustersITS(1);
75     v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
76     v0trackCuts->SetCheckITSLayerStatus(kFALSE);
77     v0trackCuts->UnsetVertexRequirement();
78     //hfecuts->SetSigmaToVertex(10);
79     v0trackCuts->SetQAOn();
80
81     task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
82     task->SetTaggedTrackCuts(v0trackCuts);
83     task->SetCleanTaggedTrack(kTRUE);
84   }
85
86   // QA
87   printf("task %p\n", task);
88   task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
89   task->SetQAOn(AliAnalysisTaskHFE::kMCqa);    
90   task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
91   task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
92   task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
93
94   printf("*************************************\n");
95   printf("Configuring standard Task:\n");
96   task->PrintStatus();
97   pid->PrintStatus();
98   printf("*************************************\n"); 
99   return task;
100 }