ROOT logo
Bool_t RsnConfigTest
(
   AliRsnAnalysisTask *task,
   Bool_t              isMC
)
{
   // find the index of the corresponding list in the RsnInputHandler
   const char *listNameQuality = "qualityTPC";
   const char *listNamePID     = "kaonTPC";
   Int_t       qualityID       = -1;
   Int_t       pidID           = -1;
   AliAnalysisManager        *mgr   = AliAnalysisManager::GetAnalysisManager();
   AliMultiInputEventHandler *multi = dynamic_cast<AliMultiInputEventHandler*>(mgr->GetInputEventHandler());
   if (multi) {
      TObjArray *array = multi->InputEventHandlers();
      TObjArrayIter next(array);
      TObject *obj;
      while ( (obj = next()) ) {
         if (obj->InheritsFrom(AliRsnInputHandler::Class())) {
            AliRsnInputHandler *rsn = (AliRsnInputHandler*)obj;
            AliRsnDaughterSelector *sel = rsn->GetSelector();
            qualityID = sel->GetID(listNameQuality, kTRUE);
            pidID = sel->GetID(listNamePID, kTRUE);
         }
      }
   }
   if (qualityID < 0) {
      ::Error("RsnConfigTest", "Selector does not contain list for quality only");
      return kFALSE;
   }
   if (pidID < 0) {
      ::Error("RsnConfigTest", "Selector does not contain list for quality+PID");
      return kFALSE;
   }
   ::Info("RsnConfigTest", "ID for cut set named '%10s' = %d", listNameQuality, qualityID);
   ::Info("RsnConfigTest", "ID for cut set named '%10s' = %d", listNamePID, pidID);
   
   // add pair computation
   //AddPairLoop(task, isMC, pidID, pidID, "test");
   
   // add monitor computation
   AddMonitorLoop(task, isMC, qualityID, pidID, "test");
   return kTRUE;
}

AliRsnCutSet* EventCuts() 
{
   // 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());
   
   return eventCuts;
}

AliRsnCutSet* PairCuts(AliRsnPairDef *support)
{
   // for pairs we define a rapidity windows, defined through a cut
   // --> NOTE: it needs a support AliRsnPairDef from which it takes the mass
   AliRsnValueStd *valRapidity = new AliRsnValueStd("valY", AliRsnValueStd::kPairY);
   AliRsnCutValue *cutRapidity = new AliRsnCutValue("cutY", -0.5, 0.5, kFALSE);
   valRapidity->SetSupportObject(support);
   cutRapidity->SetValueObj(valRapidity);
   
   // cut set
   AliRsnCutSet *pairCuts = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
   pairCuts->AddCut(cutRapidity);
   pairCuts->SetCutScheme(cutRapidity->GetName());
}

void AddPairOutput(AliRsnLoopPair *pair)
{
   // axes
   AliRsnValueStd *axisIM = new AliRsnValueStd("IM", AliRsnValueStd::kPairInvMass, 0.9, 1.4, 0.001);
   AliRsnValueStd *axisPt = new AliRsnValueStd("PT", AliRsnValueStd::kPairPt     , 0.0, 5.0, 0.1  );
     
   // output: 2D histogram of inv. mass vs. pt
   AliRsnListOutput *outPair = new AliRsnListOutput("pair", AliRsnListOutput::kHistoDefault);
   outPair->AddValue(axisIM);
   outPair->AddValue(axisPt);
   
   // add outputs to loop
   pair->AddOutput(outPair);
}

void AddMonitorOutput(AliRsnLoopDaughter *mon)
{
   // 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  );
   
   // output: 2D histogram of TPC signal vs. TPC momentum
   AliRsnListOutput *outMonitor = new AliRsnListOutput("mon", AliRsnListOutput::kHistoDefault);
   outMonitor->AddValue(axisMomTPC);
   outMonitor->AddValue(axisSigTPC);
   
   // add outputs to loop
   mon->AddOutput(outMonitor);
}

void AddPairLoop(AliRsnAnalysisTask *task, Bool_t isMC, Int_t listID1, Int_t listID2, const char *suffix = "")
{
   // pair definition
   AliRsnPairDef  *pairDef    = new AliRsnPairDef(AliRsnDaughter::kKaon, '+', AliRsnDaughter::kKaon, '-', 333, 1.019455);
   
   // loop object creation
   AliRsnLoopPair *loopPhi    = new AliRsnLoopPair(Form("%s_unlike", suffix), pairDef, kFALSE);
   AliRsnLoopPair *loopPhiMix = new AliRsnLoopPair(Form("%s_unlike", suffix), pairDef, kTRUE );
   
   // assign ID of selector lists to be used (KK --> the same)
   loopPhi->SetListID(0, listID1);
   loopPhi->SetListID(1, listID2);
   loopPhiMix->SetListID(0, listID1);
   loopPhiMix->SetListID(1, listID2);
   
   // assign cuts for events
   AliRsnCutSet *eventCuts = EventCuts();
   loopPhi->SetEventCuts(eventCuts);
   loopPhiMix->SetEventCuts(eventCuts);
   
   // assign cuts for pairs
   AliRsnCutSet *pairCuts = PairCuts(pairDef);
   loopPhi->SetPairCuts(eventCuts);
   loopPhiMix->SetPairCuts(eventCuts);
   
   // add outputs
   AddPairOutput(loopPhi);
   AddPairOutput(loopPhiMix);
   
   // add loops to task
   task->Add(loopPhi);
   task->Add(loopPhiMix);
}

void AddMonitorLoop(AliRsnAnalysisTask *task, Bool_t isMC, Int_t listID1, Int_t listID2, const char *suffix = "")
{
   // monitor definition
   AliRsnDaughterDef *tracks = new AliRsnDaughterDef(AliRsnDaughter::kTrack /*'+' or '-'*/);
   
   // loop object
   AliRsnLoopDaughter *loopMon1 = new AliRsnLoopDaughter(Form("%s_mon1", suffix), listID1, tracks);
   AliRsnLoopDaughter *loopMon2 = new AliRsnLoopDaughter(Form("%s_mon2", suffix), listID2, tracks);
   
   // add cuts on events
   AliRsnCutSet *eventCuts = EventCuts();
   loopMon1->SetEventCuts(eventCuts);
   loopMon2->SetEventCuts(eventCuts);
   
   // add monitors
   AddMonitorOutput(loopMon1);
   AddMonitorOutput(loopMon2);
   
   // add loop to task
   task->Add(loopMon1);
   task->Add(loopMon2);
}
 RsnConfigTest.C:1
 RsnConfigTest.C:2
 RsnConfigTest.C:3
 RsnConfigTest.C:4
 RsnConfigTest.C:5
 RsnConfigTest.C:6
 RsnConfigTest.C:7
 RsnConfigTest.C:8
 RsnConfigTest.C:9
 RsnConfigTest.C:10
 RsnConfigTest.C:11
 RsnConfigTest.C:12
 RsnConfigTest.C:13
 RsnConfigTest.C:14
 RsnConfigTest.C:15
 RsnConfigTest.C:16
 RsnConfigTest.C:17
 RsnConfigTest.C:18
 RsnConfigTest.C:19
 RsnConfigTest.C:20
 RsnConfigTest.C:21
 RsnConfigTest.C:22
 RsnConfigTest.C:23
 RsnConfigTest.C:24
 RsnConfigTest.C:25
 RsnConfigTest.C:26
 RsnConfigTest.C:27
 RsnConfigTest.C:28
 RsnConfigTest.C:29
 RsnConfigTest.C:30
 RsnConfigTest.C:31
 RsnConfigTest.C:32
 RsnConfigTest.C:33
 RsnConfigTest.C:34
 RsnConfigTest.C:35
 RsnConfigTest.C:36
 RsnConfigTest.C:37
 RsnConfigTest.C:38
 RsnConfigTest.C:39
 RsnConfigTest.C:40
 RsnConfigTest.C:41
 RsnConfigTest.C:42
 RsnConfigTest.C:43
 RsnConfigTest.C:44
 RsnConfigTest.C:45
 RsnConfigTest.C:46
 RsnConfigTest.C:47
 RsnConfigTest.C:48
 RsnConfigTest.C:49
 RsnConfigTest.C:50
 RsnConfigTest.C:51
 RsnConfigTest.C:52
 RsnConfigTest.C:53
 RsnConfigTest.C:54
 RsnConfigTest.C:55
 RsnConfigTest.C:56
 RsnConfigTest.C:57
 RsnConfigTest.C:58
 RsnConfigTest.C:59
 RsnConfigTest.C:60
 RsnConfigTest.C:61
 RsnConfigTest.C:62
 RsnConfigTest.C:63
 RsnConfigTest.C:64
 RsnConfigTest.C:65
 RsnConfigTest.C:66
 RsnConfigTest.C:67
 RsnConfigTest.C:68
 RsnConfigTest.C:69
 RsnConfigTest.C:70
 RsnConfigTest.C:71
 RsnConfigTest.C:72
 RsnConfigTest.C:73
 RsnConfigTest.C:74
 RsnConfigTest.C:75
 RsnConfigTest.C:76
 RsnConfigTest.C:77
 RsnConfigTest.C:78
 RsnConfigTest.C:79
 RsnConfigTest.C:80
 RsnConfigTest.C:81
 RsnConfigTest.C:82
 RsnConfigTest.C:83
 RsnConfigTest.C:84
 RsnConfigTest.C:85
 RsnConfigTest.C:86
 RsnConfigTest.C:87
 RsnConfigTest.C:88
 RsnConfigTest.C:89
 RsnConfigTest.C:90
 RsnConfigTest.C:91
 RsnConfigTest.C:92
 RsnConfigTest.C:93
 RsnConfigTest.C:94
 RsnConfigTest.C:95
 RsnConfigTest.C:96
 RsnConfigTest.C:97
 RsnConfigTest.C:98
 RsnConfigTest.C:99
 RsnConfigTest.C:100
 RsnConfigTest.C:101
 RsnConfigTest.C:102
 RsnConfigTest.C:103
 RsnConfigTest.C:104
 RsnConfigTest.C:105
 RsnConfigTest.C:106
 RsnConfigTest.C:107
 RsnConfigTest.C:108
 RsnConfigTest.C:109
 RsnConfigTest.C:110
 RsnConfigTest.C:111
 RsnConfigTest.C:112
 RsnConfigTest.C:113
 RsnConfigTest.C:114
 RsnConfigTest.C:115
 RsnConfigTest.C:116
 RsnConfigTest.C:117
 RsnConfigTest.C:118
 RsnConfigTest.C:119
 RsnConfigTest.C:120
 RsnConfigTest.C:121
 RsnConfigTest.C:122
 RsnConfigTest.C:123
 RsnConfigTest.C:124
 RsnConfigTest.C:125
 RsnConfigTest.C:126
 RsnConfigTest.C:127
 RsnConfigTest.C:128
 RsnConfigTest.C:129
 RsnConfigTest.C:130
 RsnConfigTest.C:131
 RsnConfigTest.C:132
 RsnConfigTest.C:133
 RsnConfigTest.C:134
 RsnConfigTest.C:135
 RsnConfigTest.C:136
 RsnConfigTest.C:137
 RsnConfigTest.C:138
 RsnConfigTest.C:139
 RsnConfigTest.C:140
 RsnConfigTest.C:141
 RsnConfigTest.C:142
 RsnConfigTest.C:143
 RsnConfigTest.C:144
 RsnConfigTest.C:145
 RsnConfigTest.C:146
 RsnConfigTest.C:147
 RsnConfigTest.C:148
 RsnConfigTest.C:149
 RsnConfigTest.C:150
 RsnConfigTest.C:151
 RsnConfigTest.C:152
 RsnConfigTest.C:153
 RsnConfigTest.C:154
 RsnConfigTest.C:155
 RsnConfigTest.C:156
 RsnConfigTest.C:157
 RsnConfigTest.C:158
 RsnConfigTest.C:159
 RsnConfigTest.C:160
 RsnConfigTest.C:161
 RsnConfigTest.C:162
 RsnConfigTest.C:163
 RsnConfigTest.C:164
 RsnConfigTest.C:165