ROOT logo
//
// *** Configuration script for phi->KK analysis with 2010 runs ***
// 
// A configuration script for RSN package needs to define the followings:
//
// (1) decay tree of each resonance to be studied, which is needed to select
//     true pairs and to assign the right mass to all candidate daughters
// (2) cuts at all levels: single daughters, tracks, events
// (3) output objects: histograms or trees
//
Bool_t RsnConfigPhiITS
(
   AliRsnAnalysisTask *task,
   Bool_t              isMC,
   Bool_t              isMix,
   Bool_t              useCentrality
)
{
   void myError  (const char *msg) {::Error  ("RsnConfigPhiITS", msg);}
   void myWarning(const char *msg) {::Warning("RsnConfigPhiITS", msg);}
   void myInfo   (const char *msg) {::Info   ("RsnConfigPhiITS", msg);}

   if (!task) myError("NULL task");
   
   const char *suffix = "itsstd";
      
   // ==================================================================================================================
   // == DEFINITIONS ===================================================================================================
   // ==================================================================================================================
   
   // pair definitions --> decay channels:
   // in our case, unlike-charged KK pairs for the signal, and like-charged ones for background
   AliRsnPairDef *pairDef[3];
   pairDef[0] = new AliRsnPairDef(AliRsnDaughter::kKaon, '+', AliRsnDaughter::kKaon, '-', 333, 1.019455); // unlike
   pairDef[1] = new AliRsnPairDef(AliRsnDaughter::kKaon, '+', AliRsnDaughter::kKaon, '+', 333, 1.019455); // like ++
   pairDef[2] = new AliRsnPairDef(AliRsnDaughter::kKaon, '-', AliRsnDaughter::kKaon, '-', 333, 1.019455); // like --

   // computation objects:
   // these are the objects which drive the computations, whatever it is (histos or tree filling)
   // and all tracks passed to them will be given the mass according to the reference pair definition
   // we create two unlike-sign pair computators, one for all pairs and another for true pairs (useful in MC)
   AliRsnLoopPair *pair[4];
   pair[0] = new AliRsnLoopPair(Form("%s_kaonP_kaonM_phi", suffix), 0, 0, pairDef[0]); // unlike - true
   pair[1] = new AliRsnLoopPair(Form("%s_kaonP_kaonM_all", suffix), 0, 0, pairDef[0]); // unlike - all
   pair[2] = new AliRsnLoopPair(Form("%s_kaonP_kaonP_all", suffix), 0, 0, pairDef[1]); // like ++
   pair[3] = new AliRsnLoopPair(Form("%s_kaonM_kaonM_all", suffix), 0, 0, pairDef[2]); // like --

   // set additional option for true pairs (slot [0])
   pair[0]->SetOnlyTrue(kTRUE);
   pair[0]->SetCheckDecay(kTRUE);
   
   // assign the ID of the entry lists to be used by each pair to get selected daughters
   // in our case, the AliRsnInputHandler contains only one list for selecting kaons
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   AliMultiInputEventHandler *multi = dynamic_cast<AliMultiInputEventHandler*>(mgr->GetInputEventHandler());
   if (!multi) {
      myError("Needed a multi input handler!");
      return kFALSE;
   }
   TObjArray *array = multi->InputEventHandlers();
   AliRsnInputHandler *rsn = (AliRsnInputHandler*)array->FindObject("rsnInputHandler");
   if (!rsn) {
      myError("Needed an RSN event handler");
      return kFALSE;
   }
   AliRsnDaughterSelector *sel = rsn->GetSelector();
   Int_t id = sel->GetID("kaonTPC", kTRUE);
   if (id < 0) {
      myError("Kaons are not added in the selector");
      return kFALSE;
   }
   myInfo(Form("Selected list is in position #%d", id));
   for (Int_t i = 0; i < 4; i++) {
      pair[i]->SetListID(0, id);
      pair[i]->SetListID(1, id);
   }
   
   // ----------------------------------------------------------------------------------------------
   // -- EVENT CUTS --------------------------------------------------------------------------------
   // ----------------------------------------------------------------------------------------------
   
   // in the function for events, we don't cut on centrality or multiplicity, 
   // since it becomes an axis of the output histogram

   // primary vertex:
   // - 2nd argument --> |Vz| range
   // - 3rd argument --> minimum required number of contributors
   // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
   // we switch on the check for pileup
   AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
   cutVertex->SetCheckPileUp(kTRUE);
      
   // primary vertex is always used
   AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
   eventCuts->AddCut(cutVertex);
   eventCuts->SetCutScheme(cutVertex->GetName());
   
   // set cuts for each loop
   for (Int_t i = 0; i < 4; i++) {
      pair[i]->SetEventCuts(eventCuts);
   }
   
   // ==================================================================================================================
   // == PAIR CUTS =====================================================================================================
   // ==================================================================================================================
   
   // Rapidity cut
   // Only thing to consider is that it needs a support object to define mass
   AliRsnCutValue *cutRapidity = new AliRsnCutValue("cutY", AliRsnValue::kPairY, -0.5, 0.5);
   cutRapidity->GetValueObj()->SetSupportObject(pairDef[0]);

   // in this case, we add the cut to the specific cut sets of all pairs
   // and we must then loop over all pairs, to add cuts to the related sets
   for (Int_t ipair = 0; ipair < 4; ipair++) {
      pair[ipair]->GetPairCuts()->AddCut(cutRapidity);
      pair[ipair]->GetPairCuts()->SetCutScheme(cutRapidity->GetName());
   }
   
   // ==================================================================================================================
   // == COMPUTED VALUES & OUTPUTS =====================================================================================
   // ==================================================================================================================
   
   // All values which should be computed are defined here and passed to the computation objects,
   // since they define all that is computed bye each one, and, in case one output is a histogram
   // they define the binning and range for that value
   //
   // NOTE:
   // --> multiplicity bins have variable size
   
   Double_t mult[] = { 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10., 11., 12., 13.,  14.,  15.,  16.,  17.,  18.,  19., 
                      20., 21., 22., 23., 24., 25., 30., 35., 40., 50., 60., 70., 80., 90., 100., 120., 140., 160., 180., 200., 500.};
   Int_t    nmult  = sizeof(mult) / sizeof(mult[0]);
   
   AliRsnValue *axisIM      = new AliRsnValue("IM"  , AliRsnValue::kPairInvMass   ,  0.9, 1.4, 0.001);
   AliRsnValue *axisRes     = new AliRsnValue("RES" , AliRsnValue::kPairInvMassRes, -0.5, 0.5, 0.001);
   AliRsnValue *axisPt      = new AliRsnValue("PT"  , AliRsnValue::kPairPt        ,  0.0, 5.0, 0.1  );
   AliRsnValue *axisMultESD = new AliRsnValue("MESD", AliRsnValue::kEventMultESDCuts, nmult, mult);
   AliRsnValue *axisMultSPD = new AliRsnValue("MSPD", AliRsnValue::kEventMultSPD    , nmult, mult);
   AliRsnValue *axisMultMC  = new AliRsnValue("MMC" , AliRsnValue::kEventMultMC     , nmult, mult);
   AliRsnValue *axisCentV0  = new AliRsnValue("CNT" , AliRsnValue::kEventCentralityV0 , 0.0, 100.0, 10.0);

   // create outputs
   AliRsnListOutput *out[2];
   AliRsnListOutput *out[0] = new AliRsnListOutput("phi", AliRsnListOutput::kHistoSparse);
   AliRsnListOutput *out[1] = new AliRsnListOutput("all", AliRsnListOutput::kHistoSparse);
   
   // add values to outputs
   out[0]->AddValue(axisRes);
   for (Int_t i = 0; i < 2; i++) {
      out[i]->AddValue(axisIM);
      out[i]->AddValue(axisPt);
      if (useCentrality) {
         out[i]->AddValue(axisCentV0);
      } else {
         out[i]->AddValue(axisMultESD);
         out[i]->AddValue(axisMultSPD);
         if (isMC) out[i]->AddValue(axisMultMC);
      }
   }
   
   // add outputs to pairs
   pair[0]->AddOutput(out[0]);
   for (Int_t ipair = 1; ipair < 4; ipair++) {
      pair[ipair]->AddOutput(out[1]);
   }
   
   // ==================================================================================================================
   // == CONCLUSION ====================================================================================================
   // ==================================================================================================================
   
   if (isMC && !isMix) task->Add(pair[0]);
   task->Add(pair[1]);
   if (!isMix) {
      task->Add(pair[2]);
      task->Add(pair[3]);
   }
   
   return kTRUE;
}
 RsnConfigPhiITS.C:1
 RsnConfigPhiITS.C:2
 RsnConfigPhiITS.C:3
 RsnConfigPhiITS.C:4
 RsnConfigPhiITS.C:5
 RsnConfigPhiITS.C:6
 RsnConfigPhiITS.C:7
 RsnConfigPhiITS.C:8
 RsnConfigPhiITS.C:9
 RsnConfigPhiITS.C:10
 RsnConfigPhiITS.C:11
 RsnConfigPhiITS.C:12
 RsnConfigPhiITS.C:13
 RsnConfigPhiITS.C:14
 RsnConfigPhiITS.C:15
 RsnConfigPhiITS.C:16
 RsnConfigPhiITS.C:17
 RsnConfigPhiITS.C:18
 RsnConfigPhiITS.C:19
 RsnConfigPhiITS.C:20
 RsnConfigPhiITS.C:21
 RsnConfigPhiITS.C:22
 RsnConfigPhiITS.C:23
 RsnConfigPhiITS.C:24
 RsnConfigPhiITS.C:25
 RsnConfigPhiITS.C:26
 RsnConfigPhiITS.C:27
 RsnConfigPhiITS.C:28
 RsnConfigPhiITS.C:29
 RsnConfigPhiITS.C:30
 RsnConfigPhiITS.C:31
 RsnConfigPhiITS.C:32
 RsnConfigPhiITS.C:33
 RsnConfigPhiITS.C:34
 RsnConfigPhiITS.C:35
 RsnConfigPhiITS.C:36
 RsnConfigPhiITS.C:37
 RsnConfigPhiITS.C:38
 RsnConfigPhiITS.C:39
 RsnConfigPhiITS.C:40
 RsnConfigPhiITS.C:41
 RsnConfigPhiITS.C:42
 RsnConfigPhiITS.C:43
 RsnConfigPhiITS.C:44
 RsnConfigPhiITS.C:45
 RsnConfigPhiITS.C:46
 RsnConfigPhiITS.C:47
 RsnConfigPhiITS.C:48
 RsnConfigPhiITS.C:49
 RsnConfigPhiITS.C:50
 RsnConfigPhiITS.C:51
 RsnConfigPhiITS.C:52
 RsnConfigPhiITS.C:53
 RsnConfigPhiITS.C:54
 RsnConfigPhiITS.C:55
 RsnConfigPhiITS.C:56
 RsnConfigPhiITS.C:57
 RsnConfigPhiITS.C:58
 RsnConfigPhiITS.C:59
 RsnConfigPhiITS.C:60
 RsnConfigPhiITS.C:61
 RsnConfigPhiITS.C:62
 RsnConfigPhiITS.C:63
 RsnConfigPhiITS.C:64
 RsnConfigPhiITS.C:65
 RsnConfigPhiITS.C:66
 RsnConfigPhiITS.C:67
 RsnConfigPhiITS.C:68
 RsnConfigPhiITS.C:69
 RsnConfigPhiITS.C:70
 RsnConfigPhiITS.C:71
 RsnConfigPhiITS.C:72
 RsnConfigPhiITS.C:73
 RsnConfigPhiITS.C:74
 RsnConfigPhiITS.C:75
 RsnConfigPhiITS.C:76
 RsnConfigPhiITS.C:77
 RsnConfigPhiITS.C:78
 RsnConfigPhiITS.C:79
 RsnConfigPhiITS.C:80
 RsnConfigPhiITS.C:81
 RsnConfigPhiITS.C:82
 RsnConfigPhiITS.C:83
 RsnConfigPhiITS.C:84
 RsnConfigPhiITS.C:85
 RsnConfigPhiITS.C:86
 RsnConfigPhiITS.C:87
 RsnConfigPhiITS.C:88
 RsnConfigPhiITS.C:89
 RsnConfigPhiITS.C:90
 RsnConfigPhiITS.C:91
 RsnConfigPhiITS.C:92
 RsnConfigPhiITS.C:93
 RsnConfigPhiITS.C:94
 RsnConfigPhiITS.C:95
 RsnConfigPhiITS.C:96
 RsnConfigPhiITS.C:97
 RsnConfigPhiITS.C:98
 RsnConfigPhiITS.C:99
 RsnConfigPhiITS.C:100
 RsnConfigPhiITS.C:101
 RsnConfigPhiITS.C:102
 RsnConfigPhiITS.C:103
 RsnConfigPhiITS.C:104
 RsnConfigPhiITS.C:105
 RsnConfigPhiITS.C:106
 RsnConfigPhiITS.C:107
 RsnConfigPhiITS.C:108
 RsnConfigPhiITS.C:109
 RsnConfigPhiITS.C:110
 RsnConfigPhiITS.C:111
 RsnConfigPhiITS.C:112
 RsnConfigPhiITS.C:113
 RsnConfigPhiITS.C:114
 RsnConfigPhiITS.C:115
 RsnConfigPhiITS.C:116
 RsnConfigPhiITS.C:117
 RsnConfigPhiITS.C:118
 RsnConfigPhiITS.C:119
 RsnConfigPhiITS.C:120
 RsnConfigPhiITS.C:121
 RsnConfigPhiITS.C:122
 RsnConfigPhiITS.C:123
 RsnConfigPhiITS.C:124
 RsnConfigPhiITS.C:125
 RsnConfigPhiITS.C:126
 RsnConfigPhiITS.C:127
 RsnConfigPhiITS.C:128
 RsnConfigPhiITS.C:129
 RsnConfigPhiITS.C:130
 RsnConfigPhiITS.C:131
 RsnConfigPhiITS.C:132
 RsnConfigPhiITS.C:133
 RsnConfigPhiITS.C:134
 RsnConfigPhiITS.C:135
 RsnConfigPhiITS.C:136
 RsnConfigPhiITS.C:137
 RsnConfigPhiITS.C:138
 RsnConfigPhiITS.C:139
 RsnConfigPhiITS.C:140
 RsnConfigPhiITS.C:141
 RsnConfigPhiITS.C:142
 RsnConfigPhiITS.C:143
 RsnConfigPhiITS.C:144
 RsnConfigPhiITS.C:145
 RsnConfigPhiITS.C:146
 RsnConfigPhiITS.C:147
 RsnConfigPhiITS.C:148
 RsnConfigPhiITS.C:149
 RsnConfigPhiITS.C:150
 RsnConfigPhiITS.C:151
 RsnConfigPhiITS.C:152
 RsnConfigPhiITS.C:153
 RsnConfigPhiITS.C:154
 RsnConfigPhiITS.C:155
 RsnConfigPhiITS.C:156
 RsnConfigPhiITS.C:157
 RsnConfigPhiITS.C:158
 RsnConfigPhiITS.C:159
 RsnConfigPhiITS.C:160
 RsnConfigPhiITS.C:161
 RsnConfigPhiITS.C:162
 RsnConfigPhiITS.C:163
 RsnConfigPhiITS.C:164
 RsnConfigPhiITS.C:165
 RsnConfigPhiITS.C:166
 RsnConfigPhiITS.C:167
 RsnConfigPhiITS.C:168
 RsnConfigPhiITS.C:169
 RsnConfigPhiITS.C:170
 RsnConfigPhiITS.C:171
 RsnConfigPhiITS.C:172
 RsnConfigPhiITS.C:173
 RsnConfigPhiITS.C:174
 RsnConfigPhiITS.C:175
 RsnConfigPhiITS.C:176
 RsnConfigPhiITS.C:177
 RsnConfigPhiITS.C:178
 RsnConfigPhiITS.C:179
 RsnConfigPhiITS.C:180