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 RsnConfigMonitorTPC
(
   AliRsnAnalysisTask *task,
   Bool_t              isMC,
   Bool_t              useCentrality,
   AliRsnCutSet       *eventCuts
)
{
   void myError  (const char *msg) {::Error  ("RsnConfigPhi", msg);}
   void myWarning(const char *msg) {::Warning("RsnConfigPhi", msg);}
   void myInfo   (const char *msg) {::Info   ("RsnConfigPhi", msg);}

   if (!task) myError("NULL task");
   
   const char *suffix = "tpcstd";
      
   // ==================================================================================================================
   // == DEFINITIONS ===================================================================================================
   // ==================================================================================================================
   
   // daughter definitions
   AliRsnDaughterDef *tracks = new AliRsnDaughterDef(AliRsnDaughter::kTrack, 0);

   // 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)
   AliRsnLoopDaughter *loop[3];
   loop[0] = new AliRsnLoopDaughter(Form("%s_quality", suffix), 0, tracks);
   loop[1] = new AliRsnLoopDaughter(Form("%s_pion"   , suffix), 0, tracks);
   loop[2] = new AliRsnLoopDaughter(Form("%s_kaon"   , suffix), 0, tracks);

   // 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[3];
   id[0] = sel->GetID("qualityTPC", kTRUE);
   id[1] = sel->GetID("pionTPC", kTRUE);
   id[2] = sel->GetID("kaonTPC", kTRUE);
   
   // ==================================================================================================================
   // == COMPUTED VALUES & OUTPUTS =====================================================================================
   // ==================================================================================================================
   
   // axes
   AliRsnValueStd *axisMomTPC = new AliRsnValueStd("pTPC", AliRsnValueStd::kTrackPtpc     , 0.0,   5.0, 0.01 );
   AliRsnValueStd *axisSigTPC = new AliRsnValueStd("sTPC", AliRsnValueStd::kTrackTPCsignal, 0.0, 500.0, 2.0  );
   AliRsnValueStd *axisMomTOF = new AliRsnValueStd("pTOF", AliRsnValueStd::kTrackP        , 0.0,   5.0, 0.01 );
   AliRsnValuePID *axisSigTOF = new AliRsnValuePID("sTOF", AliRsnValuePID::kTOFnsigma     , AliPID::kKaon, -200.0, 200.0, 10.0);
   
   // create outputs
   AliRsnListOutput *outTPC = new AliRsnListOutput("outTPC", AliRsnListOutput::kHistoDefault);
   AliRsnListOutput *outTOF = new AliRsnListOutput("outTOF", AliRsnListOutput::kHistoDefault);
   
   // add values to outputs
   outTPC->AddValue(axisMomTPC);
   outTPC->AddValue(axisSigTPC);
   outTOF->AddValue(axisMomTOF);
   outTOF->AddValue(axisSigTOF);
   
   // ==================================================================================================================
   // == CONCLUSION ====================================================================================================
   // ==================================================================================================================
   
   for (Int_t i = 0; i < 3; i++) {
      // list ID
      if (id[i] < 0) {
         myError(Form("Required entry list for loop #%d is not added in the selector", i));
         return kFALSE;
      }
      myInfo(Form("Required entry list for loop #%d [%s] is %d", i, loop[i]->GetName(), id[i]));
      loop[i]->SetListID(id[i]);
      
      // event cuts
      loop[i]->SetEventCuts(eventCuts);
      
      // outputs
      loop[i]->AddOutput(outTPC);
      loop[i]->AddOutput(outTOF);
      
      // add to task
      task->Add(loop[i]);
   }
   
   return kTRUE;
}
 RsnConfigMonitorTPC.C:1
 RsnConfigMonitorTPC.C:2
 RsnConfigMonitorTPC.C:3
 RsnConfigMonitorTPC.C:4
 RsnConfigMonitorTPC.C:5
 RsnConfigMonitorTPC.C:6
 RsnConfigMonitorTPC.C:7
 RsnConfigMonitorTPC.C:8
 RsnConfigMonitorTPC.C:9
 RsnConfigMonitorTPC.C:10
 RsnConfigMonitorTPC.C:11
 RsnConfigMonitorTPC.C:12
 RsnConfigMonitorTPC.C:13
 RsnConfigMonitorTPC.C:14
 RsnConfigMonitorTPC.C:15
 RsnConfigMonitorTPC.C:16
 RsnConfigMonitorTPC.C:17
 RsnConfigMonitorTPC.C:18
 RsnConfigMonitorTPC.C:19
 RsnConfigMonitorTPC.C:20
 RsnConfigMonitorTPC.C:21
 RsnConfigMonitorTPC.C:22
 RsnConfigMonitorTPC.C:23
 RsnConfigMonitorTPC.C:24
 RsnConfigMonitorTPC.C:25
 RsnConfigMonitorTPC.C:26
 RsnConfigMonitorTPC.C:27
 RsnConfigMonitorTPC.C:28
 RsnConfigMonitorTPC.C:29
 RsnConfigMonitorTPC.C:30
 RsnConfigMonitorTPC.C:31
 RsnConfigMonitorTPC.C:32
 RsnConfigMonitorTPC.C:33
 RsnConfigMonitorTPC.C:34
 RsnConfigMonitorTPC.C:35
 RsnConfigMonitorTPC.C:36
 RsnConfigMonitorTPC.C:37
 RsnConfigMonitorTPC.C:38
 RsnConfigMonitorTPC.C:39
 RsnConfigMonitorTPC.C:40
 RsnConfigMonitorTPC.C:41
 RsnConfigMonitorTPC.C:42
 RsnConfigMonitorTPC.C:43
 RsnConfigMonitorTPC.C:44
 RsnConfigMonitorTPC.C:45
 RsnConfigMonitorTPC.C:46
 RsnConfigMonitorTPC.C:47
 RsnConfigMonitorTPC.C:48
 RsnConfigMonitorTPC.C:49
 RsnConfigMonitorTPC.C:50
 RsnConfigMonitorTPC.C:51
 RsnConfigMonitorTPC.C:52
 RsnConfigMonitorTPC.C:53
 RsnConfigMonitorTPC.C:54
 RsnConfigMonitorTPC.C:55
 RsnConfigMonitorTPC.C:56
 RsnConfigMonitorTPC.C:57
 RsnConfigMonitorTPC.C:58
 RsnConfigMonitorTPC.C:59
 RsnConfigMonitorTPC.C:60
 RsnConfigMonitorTPC.C:61
 RsnConfigMonitorTPC.C:62
 RsnConfigMonitorTPC.C:63
 RsnConfigMonitorTPC.C:64
 RsnConfigMonitorTPC.C:65
 RsnConfigMonitorTPC.C:66
 RsnConfigMonitorTPC.C:67
 RsnConfigMonitorTPC.C:68
 RsnConfigMonitorTPC.C:69
 RsnConfigMonitorTPC.C:70
 RsnConfigMonitorTPC.C:71
 RsnConfigMonitorTPC.C:72
 RsnConfigMonitorTPC.C:73
 RsnConfigMonitorTPC.C:74
 RsnConfigMonitorTPC.C:75
 RsnConfigMonitorTPC.C:76
 RsnConfigMonitorTPC.C:77
 RsnConfigMonitorTPC.C:78
 RsnConfigMonitorTPC.C:79
 RsnConfigMonitorTPC.C:80
 RsnConfigMonitorTPC.C:81
 RsnConfigMonitorTPC.C:82
 RsnConfigMonitorTPC.C:83
 RsnConfigMonitorTPC.C:84
 RsnConfigMonitorTPC.C:85
 RsnConfigMonitorTPC.C:86
 RsnConfigMonitorTPC.C:87
 RsnConfigMonitorTPC.C:88
 RsnConfigMonitorTPC.C:89
 RsnConfigMonitorTPC.C:90
 RsnConfigMonitorTPC.C:91
 RsnConfigMonitorTPC.C:92
 RsnConfigMonitorTPC.C:93
 RsnConfigMonitorTPC.C:94
 RsnConfigMonitorTPC.C:95
 RsnConfigMonitorTPC.C:96
 RsnConfigMonitorTPC.C:97
 RsnConfigMonitorTPC.C:98
 RsnConfigMonitorTPC.C:99
 RsnConfigMonitorTPC.C:100
 RsnConfigMonitorTPC.C:101
 RsnConfigMonitorTPC.C:102
 RsnConfigMonitorTPC.C:103
 RsnConfigMonitorTPC.C:104
 RsnConfigMonitorTPC.C:105
 RsnConfigMonitorTPC.C:106
 RsnConfigMonitorTPC.C:107
 RsnConfigMonitorTPC.C:108
 RsnConfigMonitorTPC.C:109