]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/test/ConfigTaskRsn2010.C
Major upgrade to the package, in order to speed-up the execution and remove some...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / test / ConfigTaskRsn2010.C
1 //
2 // This function configures the entire task for all resonances the user is interested in.
3 // This is done by creating all configuration objects which are defined in the package.
4 //
5 // Generally speaking, one has to define the following objects for each resonance:
6 //
7 //  1 - an AliRsnPairDef to define the resonance decay channel to be studied
8 //  2 - an AliRsnPair{Ntuple|Functions} where the output is stored
9 //  3 - one or more AliRsnCut objects to define track selections
10 //      which will have then to be organized into AliRsnCutSet objects
11 //  4 - an AliRsnCutManager to include all cuts to be applied (see point 3)
12 //  5 - definitions to build the TNtuple or histograms which are returned
13 //
14 // The return value is used to know if the configuration was successful
15 //
16 Bool_t RsnConfigTask(AliRsnAnalysisSE* &task, const char *dataLabel)
17 {
18   // for safety, return if no task is passed
19   if (!task)
20   {
21     Error("ConfigTaskRsn", "Task not found");
22     return kFALSE;
23   }
24   
25   // interpret the useful information from second argument
26   TString strDataLabel(dataLabel);
27   Bool_t isESD   = strDataLabel.Contains("ESD");
28   Bool_t isAOD   = strDataLabel.Contains("AOD");
29   Bool_t isSim   = strDataLabel.Contains("sim");
30   Bool_t isData  = strDataLabel.Contains("data");
31   Bool_t isPass1 = strDataLabel.Contains("pass1");
32   Bool_t isPass2 = strDataLabel.Contains("pass2");
33
34   //
35   // -- Set cuts for events (applied to all analyses) -----------------------------------------------
36   //
37   
38   // primary vertex range
39   AliRsnCutPrimaryVertex *cutVertex   = new AliRsnCutPrimaryVertex("cutVertex", 3);
40   AliRsnCutSet           *cutSetEvent = new AliRsnCutSet("eventCuts", AliRsnCut::kEvent);
41   cutSetEvent->AddCut(cutVertex);
42   cutSetEvent->SetCutScheme("cutVertex");
43   task->SetEventCuts(cutSetEvent);
44
45   //
46   // -- Setup pairs ---------------------------------------------------------------------------------
47   //
48
49   // decay channels
50   AliRsnPairDef         *pairDefPM = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
51   AliRsnPairDef         *pairDefPP = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '+', 333, 1.019455);
52   AliRsnPairDef         *pairDefMM = new AliRsnPairDef(AliPID::kKaon, '-', AliPID::kKaon, '-', 333, 1.019455);
53
54   // computation objects
55   AliRsnPairNtuple      *pairPM = new AliRsnPairNtuple("PairPM" , pairDefPM);
56   AliRsnPairNtuple      *truePM = new AliRsnPairNtuple("TruePM" , pairDefPM);
57   AliRsnPairNtuple      *pairPP = new AliRsnPairNtuple("PairPP" , pairDefPP);
58   AliRsnPairNtuple      *pairMM = new AliRsnPairNtuple("PairMM" , pairDefMM);
59
60   //
61   // -- Setup cuts ----------------------------------------------------------------------------------
62   //
63   
64   // track cut -----------------------
65   // --> global cuts for 2010 analysis
66   AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010("cuts2010");
67   // ----> set the flag for sim/data management
68   cuts2010->SetMC(isSim);
69   // ----> require to check PID
70   cuts2010->SetCheckITS(1);
71   cuts2010->SetCheckTPC(1);
72   cuts2010->SetCheckTOF(1);
73   // ----> set TPC ranges and calibration
74   cuts2010->SetTPCrange(5.0, 3.0);
75   cuts2010->SetTPCpLimit(0.35);
76   cuts2010->SetITSband(4.0);
77   if (isSim) cuts2010->SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
78   else       cuts2010->SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
79   // ----> set standard quality cuts for TPC global tracks
80   cuts2010->GetCutsTPC()->SetRequireTPCStandAlone(kTRUE); // require to have the projection at inner TPC wall
81   cuts2010->GetCutsTPC()->SetMinNClustersTPC(70);
82   cuts2010->GetCutsTPC()->SetMaxChi2PerClusterTPC(4);
83   cuts2010->GetCutsTPC()->SetAcceptKinkDaughters(kFALSE);
84   cuts2010->GetCutsTPC()->SetRequireTPCRefit(kTRUE);
85   cuts2010->GetCutsTPC()->SetRequireITSRefit(kTRUE);
86   cuts2010->GetCutsTPC()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
87   cuts2010->GetCutsTPC()->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9"); // DCA pt dependent: 7*(0.0050+0.0060/pt0.9)
88   cuts2010->GetCutsTPC()->SetMaxDCAToVertexZ(1e6); // disabled
89   cuts2010->GetCutsTPC()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
90   cuts2010->GetCutsTPC()->SetRequireSigmaToVertex(kFALSE);
91   // ----> set standard quality cuts for ITS standalone tracks
92   cuts2010->GetCutsITS()->SetRequireITSStandAlone(kTRUE, kTRUE);
93   cuts2010->GetCutsITS()->SetRequireITSRefit(kTRUE);
94   cuts2010->GetCutsITS()->SetMinNClustersITS(4);
95   cuts2010->GetCutsITS()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
96   cuts2010->GetCutsITS()->SetMaxChi2PerClusterITS(1.);
97   cuts2010->GetCutsITS()->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55"); // DCA pt dependent
98   cuts2010->GetCutsITS()->SetMaxDCAToVertexZ(1e6); // disabled
99   cuts2010->GetCutsITS()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
100   // ----> set the configuration for TOF PID checks
101   if (isData && (isPass1 || isPass2))
102   {
103     cuts2010->SetTOFcalibrateESD(kTRUE);
104     //if (isPass2) cuts2010->SetTOFcalibrateESD(kFALSE); // potrebbe anche essere kFALSE
105     cuts2010->SetTOFcorrectTExp(kTRUE);
106     cuts2010->SetTOFuseT0(kTRUE);
107     cuts2010->SetTOFtuneMC(kFALSE);
108     cuts2010->SetTOFresolution(100.0);
109   }
110   else if (isSim)
111   {
112     cuts2010->SetTOFcalibrateESD(kFALSE);
113     cuts2010->SetTOFcorrectTExp(kTRUE);
114     cuts2010->SetTOFuseT0(kTRUE);
115     cuts2010->SetTOFtuneMC(kTRUE);
116     cuts2010->SetTOFresolution(100.0);
117   }
118   // ----> initialize cut (creates the AliESDpid, AliTOFcalib and AliTOFT0maker inside)
119   cuts2010->Initialize();
120   
121   // cut sets ---------------------------------
122   // --> only common cuts for tracks are needed
123   AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
124   cutSetDaughterCommon->AddCut(cuts2010);
125   cutSetDaughterCommon->SetCutScheme("cuts2010");
126    
127   // configure cut managers -------------------
128   pairPM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
129   truePM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
130   pairPP->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
131   pairMM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
132   
133   // set additional option for true pairs when needed
134   truePM->SetOnlyTrue();
135
136   //
137   // -- Setup functions -----------------------------------------------------------------------------
138   //
139   
140   // function axes
141   AliRsnValue *axisIM   = new AliRsnValue(AliRsnValue::kPairInvMass,   50,  0.9,  1.4);
142   AliRsnValue *axisPt   = new AliRsnValue(AliRsnValue::kPairPt,        50,  0.0, 10.0);
143   AliRsnValue *axisEta  = new AliRsnValue(AliRsnValue::kPairEta,       30, -1.5,  1.5);
144   
145   // the ntuple output requires to get directly the values
146   pairPM->AddValue(axisIM);
147   pairPM->AddValue(axisPt);
148   pairPM->AddValue(axisEta);
149   truePM->AddValue(axisIM);
150   truePM->AddValue(axisPt);
151   truePM->AddValue(axisEta);
152   pairPP->AddValue(axisIM);
153   pairPP->AddValue(axisPt);
154   pairPP->AddValue(axisEta);
155   pairMM->AddValue(axisIM);
156   pairMM->AddValue(axisPt);
157   pairMM->AddValue(axisEta);
158
159   //
160   // -- Conclusion ----------------------------------------------------------------------------------
161   //
162   
163   // add all created AliRsnPair objects to the AliRsnAnalysisManager in the task
164   task->GetAnalysisManager()->Add(pairPM);
165   task->GetAnalysisManager()->Add(truePM);
166   task->GetAnalysisManager()->Add(pairPP);
167   task->GetAnalysisManager()->Add(pairMM);
168
169   return kTRUE;
170 }