]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/test/ConfigTaskRsnTest.C
fixed warnings
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / test / ConfigTaskRsnTest.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", 10.0, 0, kFALSE);
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
52   // computation objects
53   AliRsnPairFunctions   *pairPMhist = new AliRsnPairFunctions("pairPMHist", pairDefpm);
54   AliRsnPairNtuple      *pairPMntp  = new AliRsnPairNtuple   ("pairPMNtp" , pairDefpm);
55
56   //
57   // -- Setup cuts ----------------------------------------------------------------------------------
58   //
59   
60   // -- track cut --
61   // --> global cuts for 2010 analysis
62   AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010("cuts2010");
63   // ----> set the flag for sim/data management
64   cuts2010->SetMC(isSim);
65   // ----> require to check PID
66   cuts2010->SetCheckITS(kFALSE);
67   cuts2010->SetCheckTPC(kFALSE);
68   cuts2010->SetCheckTOF(kFALSE);
69   // ----> set TPC ranges and calibration
70   cuts2010->SetTPCrange(5.0, 3.0);
71   cuts2010->SetTPCpLimit(0.35);
72   cuts2010->SetITSband(4.0);
73   if (isSim) cuts2010->SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
74   else       cuts2010->SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
75   // ----> set standard quality cuts for TPC global tracks
76   //cuts2010->GetCutsTPC()->SetRequireTPCStandAlone(kTRUE); // require to have the projection at inner TPC wall
77   cuts2010->GetCutsTPC()->SetMinNClustersTPC(70);
78   cuts2010->GetCutsTPC()->SetMaxChi2PerClusterTPC(4);
79   cuts2010->GetCutsTPC()->SetAcceptKinkDaughters(kFALSE);
80   cuts2010->GetCutsTPC()->SetRequireTPCRefit(kTRUE);
81   cuts2010->GetCutsTPC()->SetRequireITSRefit(kTRUE);
82   cuts2010->GetCutsTPC()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
83   cuts2010->GetCutsTPC()->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9"); // DCA pt dependent: 7*(0.0050+0.0060/pt0.9)
84   cuts2010->GetCutsTPC()->SetMaxDCAToVertexZ(1e6); // disabled
85   cuts2010->GetCutsTPC()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
86   cuts2010->GetCutsTPC()->SetRequireSigmaToVertex(kFALSE);
87   // ----> set standard quality cuts for ITS standalone tracks
88   cuts2010->GetCutsITS()->SetRequireITSStandAlone(kTRUE, kTRUE);
89   cuts2010->GetCutsITS()->SetRequireITSRefit(kTRUE);
90   cuts2010->GetCutsITS()->SetMinNClustersITS(4);
91   cuts2010->GetCutsITS()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
92   cuts2010->GetCutsITS()->SetMaxChi2PerClusterITS(1.);
93   cuts2010->GetCutsITS()->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55"); // DCA pt dependent
94   cuts2010->GetCutsITS()->SetMaxDCAToVertexZ(1e6); // disabled
95   cuts2010->GetCutsITS()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
96   // ----> set the configuration for TOF PID checks
97   if (isData && (isPass1 || isPass2))
98   {
99     cuts2010->SetTOFcalibrateESD(kTRUE);
100     //if (isPass2) cuts2010->SetTOFcalibrateESD(kFALSE); // potrebbe anche essere kFALSE
101     cuts2010->SetTOFcorrectTExp(kTRUE);
102     cuts2010->SetTOFuseT0(kTRUE);
103     cuts2010->SetTOFtuneMC(kFALSE);
104     cuts2010->SetTOFresolution(100.0);
105   }
106   else if (isSim)
107   {
108     cuts2010->SetTOFcalibrateESD(kFALSE);
109     cuts2010->SetTOFcorrectTExp(kTRUE);
110     cuts2010->SetTOFuseT0(kTRUE);
111     cuts2010->SetTOFtuneMC(kTRUE);
112     cuts2010->SetTOFresolution(100.0);
113   }
114   cuts2010->Initialize();
115   
116   // -- tracks --> PID
117   AliRsnCutPID *cutPID = new AliRsnCutPID("cutPID", AliPID::kKaon, 0.0, kTRUE);
118   
119   // cut sets
120   AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
121
122   // --> add related cuts
123   //cutSetDaughterCommon->AddCut(cuts2010);
124   cutSetDaughterCommon->AddCut(cutPID);
125
126   // --> define schemes
127   cutSetDaughterCommon->SetCutScheme("cutPID");
128    
129   // cut managers
130   // define a proper name for each mult bin, to avoid omonyme output histos
131   pairPMhist->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
132   pairPMntp ->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
133
134   // function axes
135   Double_t ybins[] = {-0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8};
136   AliRsnValue *axisIM   = new AliRsnValue("IM"  , AliRsnValue::kPairInvMass, 50,  0.9,  1.4);
137   AliRsnValue *axisPt   = new AliRsnValue("PT"  , AliRsnValue::kPairPt,      0.0, 20.0, 0.1);
138   AliRsnValue *axisY    = new AliRsnValue("Y"   , AliRsnValue::kPairY,       sizeof(ybins)/sizeof(ybins[0]), ybins);
139   AliRsnValue *axisQinv = new AliRsnValue("QInv", AliRsnValue::kQInv,       100,  0.0, 10.0);
140
141   // functions for TH1-like output
142   AliRsnFunction *fcnPt    = new AliRsnFunction;
143   // --> add axes
144   fcnPt   ->AddAxis(axisIM);
145   fcnPt   ->AddAxis(axisPt);
146   fcnPt   ->AddAxis(axisY);
147   fcnPt   ->AddAxis(axisQinv);
148   
149   // add functions to TH1-like output
150   pairPMhist->AddFunction(fcnPt);
151   //pairPMhist->SetOnlyTrue();
152   
153   // add values to TNtuple-like output
154   pairPMntp->AddValue(axisIM);
155   pairPMntp->AddValue(axisPt);
156   pairPMntp->AddValue(axisY);
157   pairPMntp->AddValue(axisQinv);
158   
159   // add everything to analysis manager
160   //task->GetAnalysisManager()->Add(pairPMhist);
161   task->GetAnalysisManager()->Add(pairPMntp);
162
163   return kTRUE;
164 }