]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/train/RsnConfigPhiITS.C
PWG2/SPECTRA -> PWGLF/SPECTRA migration
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / train / RsnConfigPhiITS.C
1 //
2 // *** Configuration script for phi->KK analysis with 2010 runs ***
3 // 
4 // A configuration script for RSN package needs to define the followings:
5 //
6 // (1) decay tree of each resonance to be studied, which is needed to select
7 //     true pairs and to assign the right mass to all candidate daughters
8 // (2) cuts at all levels: single daughters, tracks, events
9 // (3) output objects: histograms or trees
10 //
11 Bool_t RsnConfigPhiITS
12 (
13    AliRsnAnalysisTask *task,
14    Bool_t              isMC,
15    Bool_t              isMix,
16    Bool_t              useCentrality
17 )
18 {
19    void myError  (const char *msg) {::Error  ("RsnConfigPhiITS", msg);}
20    void myWarning(const char *msg) {::Warning("RsnConfigPhiITS", msg);}
21    void myInfo   (const char *msg) {::Info   ("RsnConfigPhiITS", msg);}
22
23    if (!task) myError("NULL task");
24    
25    const char *suffix = "itsstd";
26       
27    // ==================================================================================================================
28    // == DEFINITIONS ===================================================================================================
29    // ==================================================================================================================
30    
31    // pair definitions --> decay channels:
32    // in our case, unlike-charged KK pairs for the signal, and like-charged ones for background
33    AliRsnPairDef *pairDef[3];
34    pairDef[0] = new AliRsnPairDef(AliRsnDaughter::kKaon, '+', AliRsnDaughter::kKaon, '-', 333, 1.019455); // unlike
35    pairDef[1] = new AliRsnPairDef(AliRsnDaughter::kKaon, '+', AliRsnDaughter::kKaon, '+', 333, 1.019455); // like ++
36    pairDef[2] = new AliRsnPairDef(AliRsnDaughter::kKaon, '-', AliRsnDaughter::kKaon, '-', 333, 1.019455); // like --
37
38    // computation objects:
39    // these are the objects which drive the computations, whatever it is (histos or tree filling)
40    // and all tracks passed to them will be given the mass according to the reference pair definition
41    // we create two unlike-sign pair computators, one for all pairs and another for true pairs (useful in MC)
42    AliRsnLoopPair *pair[4];
43    pair[0] = new AliRsnLoopPair(Form("%s_kaonP_kaonM_phi", suffix), 0, 0, pairDef[0]); // unlike - true
44    pair[1] = new AliRsnLoopPair(Form("%s_kaonP_kaonM_all", suffix), 0, 0, pairDef[0]); // unlike - all
45    pair[2] = new AliRsnLoopPair(Form("%s_kaonP_kaonP_all", suffix), 0, 0, pairDef[1]); // like ++
46    pair[3] = new AliRsnLoopPair(Form("%s_kaonM_kaonM_all", suffix), 0, 0, pairDef[2]); // like --
47
48    // set additional option for true pairs (slot [0])
49    pair[0]->SetOnlyTrue(kTRUE);
50    pair[0]->SetCheckDecay(kTRUE);
51    
52    // assign the ID of the entry lists to be used by each pair to get selected daughters
53    // in our case, the AliRsnInputHandler contains only one list for selecting kaons
54    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
55    AliMultiInputEventHandler *multi = dynamic_cast<AliMultiInputEventHandler*>(mgr->GetInputEventHandler());
56    if (!multi) {
57       myError("Needed a multi input handler!");
58       return kFALSE;
59    }
60    TObjArray *array = multi->InputEventHandlers();
61    AliRsnInputHandler *rsn = (AliRsnInputHandler*)array->FindObject("rsnInputHandler");
62    if (!rsn) {
63       myError("Needed an RSN event handler");
64       return kFALSE;
65    }
66    AliRsnDaughterSelector *sel = rsn->GetSelector();
67    Int_t id = sel->GetID("kaonTPC", kTRUE);
68    if (id < 0) {
69       myError("Kaons are not added in the selector");
70       return kFALSE;
71    }
72    myInfo(Form("Selected list is in position #%d", id));
73    for (Int_t i = 0; i < 4; i++) {
74       pair[i]->SetListID(0, id);
75       pair[i]->SetListID(1, id);
76    }
77    
78    // ----------------------------------------------------------------------------------------------
79    // -- EVENT CUTS --------------------------------------------------------------------------------
80    // ----------------------------------------------------------------------------------------------
81    
82    // in the function for events, we don't cut on centrality or multiplicity, 
83    // since it becomes an axis of the output histogram
84
85    // primary vertex:
86    // - 2nd argument --> |Vz| range
87    // - 3rd argument --> minimum required number of contributors
88    // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
89    // we switch on the check for pileup
90    AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
91    cutVertex->SetCheckPileUp(kTRUE);
92       
93    // primary vertex is always used
94    AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
95    eventCuts->AddCut(cutVertex);
96    eventCuts->SetCutScheme(cutVertex->GetName());
97    
98    // set cuts for each loop
99    for (Int_t i = 0; i < 4; i++) {
100       pair[i]->SetEventCuts(eventCuts);
101    }
102    
103    // ==================================================================================================================
104    // == PAIR CUTS =====================================================================================================
105    // ==================================================================================================================
106    
107    // Rapidity cut
108    // Only thing to consider is that it needs a support object to define mass
109    AliRsnCutValue *cutRapidity = new AliRsnCutValue("cutY", AliRsnValue::kPairY, -0.5, 0.5);
110    cutRapidity->GetValueObj()->SetSupportObject(pairDef[0]);
111
112    // in this case, we add the cut to the specific cut sets of all pairs
113    // and we must then loop over all pairs, to add cuts to the related sets
114    for (Int_t ipair = 0; ipair < 4; ipair++) {
115       pair[ipair]->GetPairCuts()->AddCut(cutRapidity);
116       pair[ipair]->GetPairCuts()->SetCutScheme(cutRapidity->GetName());
117    }
118    
119    // ==================================================================================================================
120    // == COMPUTED VALUES & OUTPUTS =====================================================================================
121    // ==================================================================================================================
122    
123    // All values which should be computed are defined here and passed to the computation objects,
124    // since they define all that is computed bye each one, and, in case one output is a histogram
125    // they define the binning and range for that value
126    //
127    // NOTE:
128    // --> multiplicity bins have variable size
129    
130    Double_t mult[] = { 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10., 11., 12., 13.,  14.,  15.,  16.,  17.,  18.,  19., 
131                       20., 21., 22., 23., 24., 25., 30., 35., 40., 50., 60., 70., 80., 90., 100., 120., 140., 160., 180., 200., 500.};
132    Int_t    nmult  = sizeof(mult) / sizeof(mult[0]);
133    
134    AliRsnValue *axisIM      = new AliRsnValue("IM"  , AliRsnValue::kPairInvMass   ,  0.9, 1.4, 0.001);
135    AliRsnValue *axisRes     = new AliRsnValue("RES" , AliRsnValue::kPairInvMassRes, -0.5, 0.5, 0.001);
136    AliRsnValue *axisPt      = new AliRsnValue("PT"  , AliRsnValue::kPairPt        ,  0.0, 5.0, 0.1  );
137    AliRsnValue *axisMultESD = new AliRsnValue("MESD", AliRsnValue::kEventMultESDCuts, nmult, mult);
138    AliRsnValue *axisMultSPD = new AliRsnValue("MSPD", AliRsnValue::kEventMultSPD    , nmult, mult);
139    AliRsnValue *axisMultMC  = new AliRsnValue("MMC" , AliRsnValue::kEventMultMC     , nmult, mult);
140    AliRsnValue *axisCentV0  = new AliRsnValue("CNT" , AliRsnValue::kEventCentralityV0 , 0.0, 100.0, 10.0);
141
142    // create outputs
143    AliRsnListOutput *out[2];
144    AliRsnListOutput *out[0] = new AliRsnListOutput("phi", AliRsnListOutput::kHistoSparse);
145    AliRsnListOutput *out[1] = new AliRsnListOutput("all", AliRsnListOutput::kHistoSparse);
146    
147    // add values to outputs
148    out[0]->AddValue(axisRes);
149    for (Int_t i = 0; i < 2; i++) {
150       out[i]->AddValue(axisIM);
151       out[i]->AddValue(axisPt);
152       if (useCentrality) {
153          out[i]->AddValue(axisCentV0);
154       } else {
155          out[i]->AddValue(axisMultESD);
156          out[i]->AddValue(axisMultSPD);
157          if (isMC) out[i]->AddValue(axisMultMC);
158       }
159    }
160    
161    // add outputs to pairs
162    pair[0]->AddOutput(out[0]);
163    for (Int_t ipair = 1; ipair < 4; ipair++) {
164       pair[ipair]->AddOutput(out[1]);
165    }
166    
167    // ==================================================================================================================
168    // == CONCLUSION ====================================================================================================
169    // ==================================================================================================================
170    
171    if (isMC && !isMix) task->Add(pair[0]);
172    task->Add(pair[1]);
173    if (!isMix) {
174       task->Add(pair[2]);
175       task->Add(pair[3]);
176    }
177    
178    return kTRUE;
179 }