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); }
Bool_t AddPair(AliAnalysisTaskSE *task, Bool_t isMC,Bool_t isMixing, AliPID::EParticleType pType1,Int_t listID1, AliPID::EParticleType pType2,Int_t listID2, Int_t pdgMother,Double_t massMother, AliRsnCutSet *commonEventCuts=0,AliRsnCutSet *commonPairCuts=0, TString name = "") { Bool_t valid; Int_t useMCMomentum = AliAnalysisManager::GetGlobalInt("rsnUseMCMomentum",valid); Bool_t typeSame = (pType1 == pType2); Printf("------------- id1=%d id2=%d",pType1,pType2); TList *listLoops = new TList; // pair definition AliRsnPairDef *pairDefPM = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '+', (AliRsnDaughter::ESpecies)pType2, '-', pdgMother, massMother); AliRsnPairDef *pairDefMP = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '-', (AliRsnDaughter::ESpecies)pType2, '+', pdgMother, massMother); AliRsnPairDef *pairDefPP = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '+', (AliRsnDaughter::ESpecies)pType2, '+', pdgMother, massMother); AliRsnPairDef *pairDefMM = new AliRsnPairDef((AliRsnDaughter::ESpecies)pType1, '-', (AliRsnDaughter::ESpecies)pType2, '-', pdgMother, massMother); // loop object creation AliRsnLoopPair *lp = 0; // sets +- lp = new AliRsnLoopPair(Form("%s.RecPM", name.Data()), pairDefPM, kFALSE); listLoops->Add(lp); if (!typeSame) { lp = new AliRsnLoopPair(Form("%s.RecMP", name.Data()), pairDefMP, kFALSE); listLoops->Add(lp); } // sets +- TRUE pairs if (isMC) { lp = new AliRsnLoopPair(Form("%s.RecPM_RecMother", name.Data()), pairDefPM, kFALSE); lp->SetOnlyTrue(kTRUE); lp->SetCheckDecay(kTRUE); listLoops->Add(lp); if (!typeSame) { lp = new AliRsnLoopPair(Form("%s.RecMP_RecMother", name.Data()), pairDefMP, kFALSE); lp->SetOnlyTrue(kTRUE); lp->SetCheckDecay(kTRUE); listLoops->Add(lp); } // sets +- TRUE paris (MC is used for momentum) lp = new AliRsnLoopPair(Form("%s.GenPM_RecMother", name.Data()), pairDefPM, kFALSE); lp->SetTrueMC(kTRUE); listLoops->Add(lp); if (!typeSame) { // sets +- TRUE paris (MC is used for momentum) lp = new AliRsnLoopPair(Form("%s.GenMP_RecMother", name.Data()), pairDefMP, kFALSE); lp->SetTrueMC(kTRUE); listLoops->Add(lp); } } // sets ++ lp = new AliRsnLoopPair(Form("%s.RecPP", name.Data()), pairDefPP, kFALSE); listLoops->Add(lp); // sets -- lp = new AliRsnLoopPair(Form("%s.RecMM", name.Data()), pairDefMM, kFALSE); listLoops->Add(lp); if (isMixing) { // sets +- Mixing (NOT mini) lp = new AliRsnLoopPair(Form("%s.RecPM_mix", name.Data()), pairDefPM, kTRUE); listLoops->Add(lp); // sets -+ Mixing (NOT mini) lp = new AliRsnLoopPair(Form("%s.RecMP_mix", name.Data()), pairDefMP, kTRUE); listLoops->Add(lp); // sets ++ Mixing (NOT mini) lp = new AliRsnLoopPair(Form("%s.RecPP_mix", name.Data()), pairDefPP, kTRUE); listLoops->Add(lp); // sets -- Mixing (NOT mini) lp = new AliRsnLoopPair(Form("%s.RecMM_mix", name.Data()), pairDefMM, kTRUE); listLoops->Add(lp); } // loops over all AliRsnLoops and sets everything (don't touch it if you don't know what you are doing) TIter next(listLoops); while ((lp = (AliRsnLoopPair *)next.Next())) { lp->SetListID(0, listID1); lp->SetListID(1, listID2); lp->SetMCRefInfo(useMCMomentum); if (commonPairCuts) lp->SetPairCuts(commonPairCuts); if (commonEventCuts) lp->SetEventCuts(commonEventCuts); if (name.Contains("phi")) AddPairOutputPhi(lp); else if (name.Contains("kstar")) AddPairOutputKStar(lp); else if (name.Contains("rho")) AddPairOutputRho(lp); else if (name.Contains("lambda")) AddPairOutputLambda(lp); else if (name.Contains("sigma")) AddPairOutputSigma(lp); else continue; ((AliRsnAnalysisTask *)task)->AddLoop(lp); } return kTRUE; }
// // Test config macro for RSN package. // It configures: // 1) a monitor for all tracks passing quality cuts // 2) a monitor for all tracks passing quality + PID cuts // 3) an unlike-sign invariant-mass + pt distribution for K+K- pairs // Bool_t RsnConfigPhiKaonTest ( AliRsnAnalysisTask *task, Bool_t isMC ) { if (!task) { ::Error("RsnConfigPhiKaonTest.C", "NULL task"); return kFALSE; } const char *suffix = "test"; // ---------------------------------------------------------------------------------------------- // -- DEFINITIONS ------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- // daughter definition for monitor loops // since it is intended to loop over all 'track' like objects (in the sense that we exclude V0s and cascades), // we initialize it using the constructor that requires an AliRsnDaughter::EType and a charge, but since // we want to loop over both charges, we set it to anything which is not '+' '-' or '0', which are tokens for // selecting only positive, only negative or only neutral AliRsnDaughterDef *tracks = new AliRsnDaughterDef(AliRsnDaughter::kTrack, 0); // definition of pair decay tree for phi resonance // here we *must* specify a particle species and a charge, in order to check the decay tree // last arguments are the PDG code and nominal mass of the resonance, which are needed when // one wants to select true pairs only and/or he wants to compute rapidity or Mt AliRsnPairDef *pairDef = new AliRsnPairDef(AliRsnDaughter::kKaon, '+', AliRsnDaughter::kKaon, '-', 333, 1.019455); // definition of loop objects: // (a) 1 monitor for all tracks passing quality cuts // (b) 1 monitor for all tracks passing quality+PID cuts // (c) 1 pair filled with all tracks passing same cuts as (b) // (d) 1 pair like (c) but for mixing // (e) 1 pair like (c) but with true pairs only // NOTE: (c) and (d) are instantiated with same settings, they will be made // different after some settings done in second moment AliRsnLoopDaughter *loopQuality = new AliRsnLoopDaughter(Form("%s_mon_quality", suffix), 0, tracks); AliRsnLoopDaughter *loopPID = new AliRsnLoopDaughter(Form("%s_mon_pid" , suffix), 0, tracks); AliRsnLoopPair *loopPhi = new AliRsnLoopPair (Form("%s_unlike" , suffix), pairDef); AliRsnLoopPair *loopPhiMix = new AliRsnLoopPair (Form("%s_unlike" , suffix), pairDef); AliRsnLoopPair *loopPhiTrue = new AliRsnLoopPair (Form("%s_trues" , suffix), pairDef); // set additional option for true pairs (slot [0]) loopPhiTrue->SetOnlyTrue(kTRUE); loopPhiTrue->SetCheckDecay(kTRUE); // set mixing options loopPhi ->SetMixed(kFALSE); loopPhiMix ->SetMixed(kTRUE); loopPhiTrue->SetMixed(kFALSE); // 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 Int_t idQuality, idPID; 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(); idQuality = sel->GetID("qualityTPC", kTRUE); idPID = sel->GetID("kaonTPC", kTRUE); if (idQuality < 0 || idPID < 0) { myError("List problems"); return kFALSE; } loopQuality->SetListID(idQuality); loopPID ->SetListID(idPID); loopPhi ->SetListID(0, idPID); loopPhi ->SetListID(1, idPID); loopPhiMix ->SetListID(0, idPID); loopPhiMix ->SetListID(1, idPID); loopPhiTrue->SetListID(0, idPID); loopPhiTrue->SetListID(1, idPID); // ---------------------------------------------------------------------------------------------- // -- EVENT CUTS -------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- // 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()); // add the event cuts to all loops loopQuality->SetEventCuts(eventCuts); loopPID ->SetEventCuts(eventCuts); loopPhi ->SetEventCuts(eventCuts); loopPhi ->SetEventCuts(eventCuts); loopPhiMix ->SetEventCuts(eventCuts); loopPhiMix ->SetEventCuts(eventCuts); loopPhiTrue->SetEventCuts(eventCuts); loopPhiTrue->SetEventCuts(eventCuts); // ---------------------------------------------------------------------------------------------- // -- PAIR CUTS --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- // 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, isMC); valRapidity->SetSupportObject(pairDef); cutRapidity->SetValueObj(valRapidity); // cut set AliRsnCutSet *pairCuts = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother); pairCuts->AddCut(cutRapidity); pairCuts->SetCutScheme(cutRapidity->GetName()); // add cut to pair loops only loopPhi ->SetPairCuts(pairCuts); loopPhi ->SetPairCuts(pairCuts); loopPhiMix ->SetPairCuts(pairCuts); loopPhiMix ->SetPairCuts(pairCuts); loopPhiTrue->SetPairCuts(pairCuts); loopPhiTrue->SetPairCuts(pairCuts); // ---------------------------------------------------------------------------------------------- // -- COMPUTED VALUES & OUTPUTS ----------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- 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 ); 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 for monitors: // 2D histogram with TPC signal vs TPC momentum AliRsnListOutput *outMonitor = new AliRsnListOutput("mon", AliRsnListOutput::kHistoDefault); outMonitor->AddValue(axisMomTPC); outMonitor->AddValue(axisSigTPC); // output for pairs: // 2D histogram with inv.mass vs pt AliRsnListOutput *outPair = new AliRsnListOutput("pair", AliRsnListOutput::kHistoDefault); outPair->AddValue(axisIM); outPair->AddValue(axisPt); // add outputs to loops loopQuality->AddOutput(outMonitor); loopPID ->AddOutput(outMonitor); loopPhi ->AddOutput(outPair); loopPhiMix ->AddOutput(outPair); loopPhiTrue->AddOutput(outPair); // ---------------------------------------------------------------------------------------------- // -- CONCLUSION -------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- task->Add(loopQuality); task->Add(loopPID ); task->Add(loopPhi ); task->Add(loopPhiMix ); task->Add(loopPhiTrue); return kTRUE; }