From 2a1c76964ec70e2a3df481d30b458763eb997722 Mon Sep 17 00:00:00 2001 From: pulvir Date: Wed, 9 Feb 2011 10:40:29 +0000 Subject: [PATCH] Removed old ME classes, since the nex event mixing has been introduced and is integrated in the new AliRsnAnalysisTask object, while ole AliRsnAnalysiSE is kept for backward compatibility (and new configs work perfectly also there). Removed experimental classes which apply to only one resonance, since they complicate things instead of simplifying. Removed AOD integrated cut, which are managed elsewhere. ESD integrated cuts are kept since they are used currently, and switching to new splitted implementation will be more gradual. All classes have been passed with astyle in order to improve code style and readability. Configuration script is a modified version of that provided by ROOT, with the addition not to break single-line implementations (inline functions implemented in .h file) --- PWG2/CMakelibPWG2resonances.pkg | 5 - PWG2/PWG2resonancesLinkDef.h | 5 - PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx | 1208 ++++++++--------- PWG2/RESONANCES/AliRsnAnalysisEffSE.h | 77 +- PWG2/RESONANCES/AliRsnAnalysisKStarKpi.cxx | 365 ----- PWG2/RESONANCES/AliRsnAnalysisKStarKpi.h | 75 - PWG2/RESONANCES/AliRsnAnalysisME.cxx | 220 --- PWG2/RESONANCES/AliRsnAnalysisME.h | 60 - PWG2/RESONANCES/AliRsnAnalysisManager.cxx | 435 +++--- PWG2/RESONANCES/AliRsnAnalysisManager.h | 49 +- .../AliRsnAnalysisMonitorPairTask.cxx | 408 ------ .../AliRsnAnalysisMonitorPairTask.h | 86 -- PWG2/RESONANCES/AliRsnAnalysisMonitorTask.cxx | 439 +++--- PWG2/RESONANCES/AliRsnAnalysisMonitorTask.h | 103 +- PWG2/RESONANCES/AliRsnAnalysisPhiKK.cxx | 372 ----- PWG2/RESONANCES/AliRsnAnalysisPhiKK.h | 70 - PWG2/RESONANCES/AliRsnAnalysisSE.cxx | 148 +- PWG2/RESONANCES/AliRsnAnalysisSE.h | 63 +- PWG2/RESONANCES/AliRsnAnalysisTask.cxx | 172 ++- PWG2/RESONANCES/AliRsnAnalysisTask.h | 65 +- PWG2/RESONANCES/AliRsnCut.cxx | 192 +-- PWG2/RESONANCES/AliRsnCut.h | 91 +- PWG2/RESONANCES/AliRsnCutAOD2010.cxx | 376 ----- PWG2/RESONANCES/AliRsnCutAOD2010.h | 97 -- PWG2/RESONANCES/AliRsnCutESD2010.cxx | 583 ++++---- PWG2/RESONANCES/AliRsnCutESD2010.h | 251 ++-- PWG2/RESONANCES/AliRsnCutManager.cxx | 48 +- PWG2/RESONANCES/AliRsnCutManager.h | 59 +- PWG2/RESONANCES/AliRsnCutPID.cxx | 365 +++-- PWG2/RESONANCES/AliRsnCutPID.h | 80 +- PWG2/RESONANCES/AliRsnCutPIDITS.cxx | 216 ++- PWG2/RESONANCES/AliRsnCutPIDITS.h | 133 +- PWG2/RESONANCES/AliRsnCutPIDTOF.cxx | 187 ++- PWG2/RESONANCES/AliRsnCutPIDTOF.h | 100 +- PWG2/RESONANCES/AliRsnCutPIDTPC.cxx | 168 ++- PWG2/RESONANCES/AliRsnCutPIDTPC.h | 106 +- PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx | 155 +-- PWG2/RESONANCES/AliRsnCutPrimaryVertex.h | 23 +- PWG2/RESONANCES/AliRsnCutSet.cxx | 332 +++-- PWG2/RESONANCES/AliRsnCutSet.h | 65 +- PWG2/RESONANCES/AliRsnCutTrackQuality.cxx | 527 ++++--- PWG2/RESONANCES/AliRsnCutTrackQuality.h | 119 +- PWG2/RESONANCES/AliRsnCutValue.cxx | 79 +- PWG2/RESONANCES/AliRsnCutValue.h | 49 +- PWG2/RESONANCES/AliRsnDaughter.cxx | 153 +-- PWG2/RESONANCES/AliRsnDaughter.h | 158 ++- PWG2/RESONANCES/AliRsnEvent.cxx | 779 +++++------ PWG2/RESONANCES/AliRsnEvent.h | 149 +- PWG2/RESONANCES/AliRsnExpression.cxx | 453 +++---- PWG2/RESONANCES/AliRsnExpression.h | 57 +- PWG2/RESONANCES/AliRsnFunction.cxx | 432 +++--- PWG2/RESONANCES/AliRsnFunction.h | 63 +- PWG2/RESONANCES/AliRsnMonitorTrack.cxx | 223 ++- PWG2/RESONANCES/AliRsnMonitorTrack.h | 209 ++- PWG2/RESONANCES/AliRsnMother.cxx | 282 ++-- PWG2/RESONANCES/AliRsnMother.h | 71 +- PWG2/RESONANCES/AliRsnPair.cxx | 240 ++-- PWG2/RESONANCES/AliRsnPair.h | 79 +- PWG2/RESONANCES/AliRsnPairDef.cxx | 99 +- PWG2/RESONANCES/AliRsnPairDef.h | 71 +- PWG2/RESONANCES/AliRsnPairFunctions.cxx | 111 +- PWG2/RESONANCES/AliRsnPairFunctions.h | 27 +- PWG2/RESONANCES/AliRsnPairNtuple.cxx | 161 ++- PWG2/RESONANCES/AliRsnPairNtuple.h | 29 +- PWG2/RESONANCES/AliRsnTarget.cxx | 129 +- PWG2/RESONANCES/AliRsnTarget.h | 90 +- PWG2/RESONANCES/AliRsnVATProcessInfo.cxx | 162 ++- PWG2/RESONANCES/AliRsnVATProcessInfo.h | 43 +- PWG2/RESONANCES/AliRsnVAnalysisTask.cxx | 519 ++++--- PWG2/RESONANCES/AliRsnVAnalysisTask.h | 131 +- PWG2/RESONANCES/AliRsnVAnalysisTaskME.cxx | 296 ---- PWG2/RESONANCES/AliRsnVAnalysisTaskME.h | 67 - PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx | 302 ++--- PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h | 105 +- PWG2/RESONANCES/AliRsnValue.cxx | 706 +++++----- PWG2/RESONANCES/AliRsnValue.h | 94 +- PWG2/RESONANCES/AliRsnVariableExpression.cxx | 4 +- PWG2/RESONANCES/AliRsnVariableExpression.h | 15 +- 78 files changed, 6209 insertions(+), 9126 deletions(-) delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisKStarKpi.cxx delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisKStarKpi.h delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisME.cxx delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisME.h delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.cxx delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.h delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisPhiKK.cxx delete mode 100644 PWG2/RESONANCES/AliRsnAnalysisPhiKK.h delete mode 100644 PWG2/RESONANCES/AliRsnCutAOD2010.cxx delete mode 100644 PWG2/RESONANCES/AliRsnCutAOD2010.h delete mode 100644 PWG2/RESONANCES/AliRsnVAnalysisTaskME.cxx delete mode 100644 PWG2/RESONANCES/AliRsnVAnalysisTaskME.h diff --git a/PWG2/CMakelibPWG2resonances.pkg b/PWG2/CMakelibPWG2resonances.pkg index 5ae2063fc12..3aa1b122842 100644 --- a/PWG2/CMakelibPWG2resonances.pkg +++ b/PWG2/CMakelibPWG2resonances.pkg @@ -35,7 +35,6 @@ set ( SRCS RESONANCES/AliRsnDaughter.cxx RESONANCES/AliRsnCutValue.cxx RESONANCES/AliRsnCutPrimaryVertex.cxx RESONANCES/AliRsnCutESD2010.cxx - RESONANCES/AliRsnCutAOD2010.cxx RESONANCES/AliRsnCutTrackQuality.cxx RESONANCES/AliRsnCutPID.cxx RESONANCES/AliRsnCutPIDITS.cxx @@ -52,12 +51,8 @@ set ( SRCS RESONANCES/AliRsnDaughter.cxx RESONANCES/AliRsnAnalysisManager.cxx RESONANCES/AliRsnVATProcessInfo.cxx RESONANCES/AliRsnVAnalysisTaskSE.cxx - RESONANCES/AliRsnVAnalysisTaskME.cxx RESONANCES/AliRsnAnalysisSE.cxx - RESONANCES/AliRsnAnalysisME.cxx RESONANCES/AliRsnAnalysisEffSE.cxx - RESONANCES/AliRsnAnalysisPhiKK.cxx - RESONANCES/AliRsnAnalysisKStarKpi.cxx RESONANCES/AliRsnVAnalysisTask.cxx RESONANCES/AliRsnAnalysisTask.cxx RESONANCES/AliRsnMonitorTrack.cxx diff --git a/PWG2/PWG2resonancesLinkDef.h b/PWG2/PWG2resonancesLinkDef.h index 12acecf0113..7026c41a325 100644 --- a/PWG2/PWG2resonancesLinkDef.h +++ b/PWG2/PWG2resonancesLinkDef.h @@ -12,7 +12,6 @@ #pragma link C++ class AliRsnCutValue+; #pragma link C++ class AliRsnCutPrimaryVertex+; #pragma link C++ class AliRsnCutESD2010+; -#pragma link C++ class AliRsnCutAOD2010+; #pragma link C++ class AliRsnCutTrackQuality+; #pragma link C++ class AliRsnCutPID+; #pragma link C++ class AliRsnCutPIDITS+; @@ -33,13 +32,9 @@ #pragma link C++ class AliRsnVATProcessInfo+; #pragma link C++ class AliRsnVAnalysisTaskSE+; -#pragma link C++ class AliRsnVAnalysisTaskME+; #pragma link C++ class AliRsnAnalysisSE+; -#pragma link C++ class AliRsnAnalysisME+; #pragma link C++ class AliRsnAnalysisEffSE+; -#pragma link C++ class AliRsnAnalysisPhiKK+; -#pragma link C++ class AliRsnAnalysisKStarKpi+; #pragma link C++ class AliRsnVAnalysisTask+; #pragma link C++ class AliRsnAnalysisTask+; diff --git a/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx b/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx index 0761193e8ba..90a86c982a1 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx @@ -24,44 +24,44 @@ ClassImp(AliRsnAnalysisEffSE) //_____________________________________________________________________________ AliRsnAnalysisEffSE::AliRsnAnalysisEffSE(const char *name) : - AliRsnVAnalysisTaskSE(name), - fUseITSSA(kTRUE), - fUseGlobal(kTRUE), - fStepListMC(0), - fStepListESD(0), - fAxisList("AliRsnValue", 0), - fPairDefList(0), - fContainerList(0x0), - fOutList(0x0), - fVar(0), - fPair(), - fEventCuts("eventCuts", AliRsnCut::kEvent) + AliRsnVAnalysisTaskSE(name), + fUseITSSA(kTRUE), + fUseGlobal(kTRUE), + fStepListMC(0), + fStepListESD(0), + fAxisList("AliRsnValue", 0), + fPairDefList(0), + fContainerList(0x0), + fOutList(0x0), + fVar(0), + fPair(), + fEventCuts("eventCuts", AliRsnCut::kEvent) { // // Default constructor. // - AliDebug(AliLog::kDebug+2,"<-"); + AliDebug(AliLog::kDebug + 2, "<-"); - DefineOutput(2, TList::Class()); + DefineOutput(2, TList::Class()); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ AliRsnAnalysisEffSE::AliRsnAnalysisEffSE(const AliRsnAnalysisEffSE& copy) : - AliRsnVAnalysisTaskSE(copy), - fUseITSSA(copy.fUseITSSA), - fUseGlobal(copy.fUseGlobal), - fStepListMC(copy.fStepListMC), - fStepListESD(copy.fStepListESD), - fAxisList(copy.fAxisList), - fPairDefList(copy.fPairDefList), - fContainerList(copy.fContainerList), - fOutList(0x0), - fVar(0), - fPair(), - fEventCuts(copy.fEventCuts) + AliRsnVAnalysisTaskSE(copy), + fUseITSSA(copy.fUseITSSA), + fUseGlobal(copy.fUseGlobal), + fStepListMC(copy.fStepListMC), + fStepListESD(copy.fStepListESD), + fAxisList(copy.fAxisList), + fPairDefList(copy.fPairDefList), + fContainerList(copy.fContainerList), + fOutList(0x0), + fVar(0), + fPair(), + fEventCuts(copy.fEventCuts) { // // Copy constrtuctor @@ -75,28 +75,28 @@ void AliRsnAnalysisEffSE::AddStepMC(AliRsnCutManager *mgr) // Add a step on montecarlo // - fStepListMC.AddLast(mgr); + fStepListMC.AddLast(mgr); } //_____________________________________________________________________________ -void AliRsnAnalysisEffSE::AddStepESD(AliRsnCutManager *mgr) +void AliRsnAnalysisEffSE::AddStepESD(AliRsnCutManager *mgr) { // // Add a step on ESD // - fStepListESD.AddLast(mgr); + fStepListESD.AddLast(mgr); } - + //_____________________________________________________________________________ -void AliRsnAnalysisEffSE::AddAxis(AliRsnValue *axis) +void AliRsnAnalysisEffSE::AddAxis(AliRsnValue *axis) { // // Add a new axis // - Int_t n = fAxisList.GetEntries(); - new (fAxisList[n]) AliRsnValue(*axis); + Int_t n = fAxisList.GetEntries(); + new(fAxisList[n]) AliRsnValue(*axis); } //_____________________________________________________________________________ @@ -109,68 +109,65 @@ void AliRsnAnalysisEffSE::RsnUserCreateOutputObjects() // Each of these lists is added to the main list of this task. // - AliDebug(AliLog::kDebug+2,"<-"); - - // get number of steps and axes - Int_t iaxis = 0; - Int_t nAxes = fAxisList.GetEntries(); - Int_t nSteps = (Int_t)fStepListMC.GetEntries() + (Int_t)fStepListESD.GetEntries(); - - if (!nSteps) { - AliError("No steps defined"); - return; - } - if (!nAxes) { - AliError("No axes defined"); - return; - } - - // initialize variable list - fVar.Set(nAxes); - - // retrieve number of bins for each axis - Int_t *nBins = new Int_t[nAxes]; - for (iaxis = 0; iaxis < nAxes; iaxis++) - { - AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis); - nBins[iaxis] = fcnAxis->GetArray().GetSize() - 1; - } - - // create ouput list of containers - fContainerList = new TList; - fContainerList->SetOwner(); - fContainerList->SetName(Form("%s_containers", GetName())); - - // initialize output list - OpenFile(2); - fOutList = new TList(); - fOutList->SetOwner(); - - // create the containers - Int_t i = 0, nDef = (Int_t)fPairDefList.GetEntries(); - for (i = 0; i < nDef; i++) - { - AliRsnPairDef *def = (AliRsnPairDef*)fPairDefList[i]; - AliCFContainer *cont = new AliCFContainer(Form("%s", def->GetPairName()), "", nSteps, nAxes, nBins); - // set the bin limits for each axis - for (iaxis = 0; iaxis < nAxes; iaxis++) - { - AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis); - cont->SetBinLimits(iaxis, fcnAxis->GetArray().GetArray()); - } - // add the container to output list - fContainerList->Add(cont); - } + AliDebug(AliLog::kDebug + 2, "<-"); + + // get number of steps and axes + Int_t iaxis = 0; + Int_t nAxes = fAxisList.GetEntries(); + Int_t nSteps = (Int_t)fStepListMC.GetEntries() + (Int_t)fStepListESD.GetEntries(); - fOutList->Add(fContainerList); - fOutList->Print(); + if (!nSteps) { + AliError("No steps defined"); + return; + } + if (!nAxes) { + AliError("No axes defined"); + return; + } - PostData(2, fOutList); - - // clear heap - delete [] nBins; + // initialize variable list + fVar.Set(nAxes); - AliDebug(AliLog::kDebug+2,"->"); + // retrieve number of bins for each axis + Int_t *nBins = new Int_t[nAxes]; + for (iaxis = 0; iaxis < nAxes; iaxis++) { + AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis); + nBins[iaxis] = fcnAxis->GetArray().GetSize() - 1; + } + + // create ouput list of containers + fContainerList = new TList; + fContainerList->SetOwner(); + fContainerList->SetName(Form("%s_containers", GetName())); + + // initialize output list + OpenFile(2); + fOutList = new TList(); + fOutList->SetOwner(); + + // create the containers + Int_t i = 0, nDef = (Int_t)fPairDefList.GetEntries(); + for (i = 0; i < nDef; i++) { + AliRsnPairDef *def = (AliRsnPairDef*)fPairDefList[i]; + AliCFContainer *cont = new AliCFContainer(Form("%s", def->GetPairName()), "", nSteps, nAxes, nBins); + // set the bin limits for each axis + for (iaxis = 0; iaxis < nAxes; iaxis++) { + AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis); + cont->SetBinLimits(iaxis, fcnAxis->GetArray().GetArray()); + } + // add the container to output list + fContainerList->Add(cont); + } + + fOutList->Add(fContainerList); + fOutList->Print(); + + PostData(2, fOutList); + + // clear heap + delete [] nBins; + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -182,17 +179,16 @@ void AliRsnAnalysisEffSE::RsnUserExec(Option_t*) // In this case, we NEED to have ESD and MC, otherwise we cannod do anything. // - // process first MC steps and then ESD steps - AliRsnPairDef *pairDef = 0; - TObjArrayIter iter(&fPairDefList); - while ( (pairDef = (AliRsnPairDef*)iter.Next()) ) - { - if (fRsnEvent.IsESD()) ProcessEventESD(pairDef); - if (fRsnEvent.IsAOD()) ProcessEventAOD(pairDef); - } + // process first MC steps and then ESD steps + AliRsnPairDef *pairDef = 0; + TObjArrayIter iter(&fPairDefList); + while ((pairDef = (AliRsnPairDef*)iter.Next())) { + if (fRsnEvent.IsESD()) ProcessEventESD(pairDef); + if (fRsnEvent.IsAOD()) ProcessEventAOD(pairDef); + } - // Post the data - PostData(2, fOutList); + // Post the data + PostData(2, fOutList); } //_____________________________________________________________________________ @@ -204,136 +200,126 @@ void AliRsnAnalysisEffSE::ProcessEventESD(AliRsnPairDef *pairDef) // It is associated with the AliCFContainer with the name of the pair. // - AliStack *stack = fRsnEvent.GetRefMCESD()->Stack(); - AliESDEvent *esd = fRsnEvent.GetRefESD(); - AliMCEvent *mc = fRsnEvent.GetRefMCESD(); - AliMCParticle *mother; - - if (!pairDef) return; - AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName()); - if (!cont) return; - - // get informations from pairDef - Int_t pdgM = 0; - Int_t pdgD[2] = {0, 0}; - Short_t chargeD[2] = {0, 0}; - pdgM = pairDef->GetMotherPDG(); - pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0)); - pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1)); - chargeD[0] = pairDef->GetChargeShort(0); - chargeD[1] = pairDef->GetChargeShort(1); - - // other utility variables - Int_t first, j, ipart; - Int_t label[2] = {-1, -1}; - Short_t charge[2] = {0, 0}; - Short_t pairDefMatch[2] = {-1, -1}; - Int_t esdIndex[2] = {-1, -1}; - TParticle *part[2] = {0, 0}; - - // in this case, we first take the resonance from MC - // and then we find its daughters and compute cuts on them - for (ipart = 0; ipart < stack->GetNprimary(); ipart++) - { - // take a track from the MC event - mother = (AliMCParticle*) fMCEvent->GetTrack(ipart); - - // check that it is a binary decay and the PDG code matches - if (mother->Particle()->GetNDaughters() != 2) continue; - if (mother->Particle()->GetPdgCode() != pdgM) continue; - - // store the labels of the two daughters - label[0] = mother->Particle()->GetFirstDaughter(); - label[1] = mother->Particle()->GetLastDaughter(); - - // retrieve the particles and other stuff - // check if they match the order in the pairDef - for (j = 0; j < 2; j++) - { - if (label[j] < 0) continue; - part[j] = stack->Particle(label[j]); - pdgD[j] = TMath::Abs(part[j]->GetPdgCode()); - charge[j] = (Short_t)(part[j]->GetPDG()->Charge() / 3); - if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0)) - pairDefMatch[j] = 0; - else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1)) - pairDefMatch[j] = 1; - else - pairDefMatch[j] = -1; - - // find corresponding ESD particle: first try rejecting fakes, - // and in case of failure, try accepting fakes - esdIndex[j] = FindESDtrack(label[j], esd, kTRUE); - //TArrayI idx = FindESDtracks(label[j], esd); - //for (Int_t kk = 0; kk < idx.GetSize(); kk++) cout << "DAUGHTER " << j << " --> FOUND INDEX: " << idx[kk] << endl; - if (esdIndex[j] < 0) esdIndex[j] = FindESDtrack(label[j], esd, kFALSE); - //cout << "DAUGHTER " << j << " SINGLE FOUND INDEX = " << esdIndex[j] << endl; - } - - // since each candidate good resonance is taken once, we must check - // that it matches the pair definition in any order, and reject in case - // in none of them the pair is OK - // anyway, we must associate the correct daughter to the correct data member - if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) - { - // 1st track --> 1st member of PairDef - fDaughter[0].SetRef(mc->GetTrack(label[0])); - fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[0])); - fDaughter[0].SetGood(); - // 2nd track --> 2nd member of PairDef - fDaughter[1].SetRef(mc->GetTrack(label[1])); - fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[1])); - fDaughter[1].SetGood(); - } - else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) - { - // 1st track --> 2nd member of PairDef - fDaughter[0].SetRef(mc->GetTrack(label[1])); - fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[1])); - fDaughter[0].SetGood(); - // 2nd track --> 1st member of PairDef - fDaughter[1].SetRef(mc->GetTrack(label[0])); - fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[0])); - fDaughter[1].SetGood(); - } - else - { - fDaughter[0].SetBad(); - fDaughter[1].SetBad(); - } - - // reject the pair if the matching was unsuccessful - if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue; - - // first, we set the internal AliRsnMother object to - // the MC particles and then operate the selections on MC - fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1)); - FillContainer(cont, &fStepListMC, pairDef, 0); - - // then, if both particles found a good match in the ESD - // reassociate the ESD tracks to the pair and fill ESD containers - if (esdIndex[0] < 0 || esdIndex[1] < 0) continue; - if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) - { - // 1st track --> 1st member of PairDef - fDaughter[0].SetRef(esd->GetTrack(esdIndex[0])); - // 2nd track --> 2nd member of PairDef - fDaughter[1].SetRef(esd->GetTrack(esdIndex[1])); - //cout << "****** MATCHING SCHEME 1" << endl; - } - else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) - { - // 1st track --> 2nd member of PairDef - fDaughter[0].SetRef(esd->GetTrack(esdIndex[1])); - // 2nd track --> 1st member of PairDef - fDaughter[1].SetRef(esd->GetTrack(esdIndex[0])); - //cout << "****** MATCHING SCHEME 2" << endl; - } - //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl; - // here we must remember how many steps were already filled - first = (Int_t)fStepListMC.GetEntries(); - FillContainer(cont, &fStepListESD, pairDef, first); - } + AliStack *stack = fRsnEvent.GetRefMCESD()->Stack(); + AliESDEvent *esd = fRsnEvent.GetRefESD(); + AliMCEvent *mc = fRsnEvent.GetRefMCESD(); + AliMCParticle *mother; + + if (!pairDef) return; + AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName()); + if (!cont) return; + + // get informations from pairDef + Int_t pdgM = 0; + Int_t pdgD[2] = {0, 0}; + Short_t chargeD[2] = {0, 0}; + pdgM = pairDef->GetMotherPDG(); + pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0)); + pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1)); + chargeD[0] = pairDef->GetChargeShort(0); + chargeD[1] = pairDef->GetChargeShort(1); + + // other utility variables + Int_t first, j, ipart; + Int_t label[2] = { -1, -1}; + Short_t charge[2] = {0, 0}; + Short_t pairDefMatch[2] = { -1, -1}; + Int_t esdIndex[2] = { -1, -1}; + TParticle *part[2] = {0, 0}; + + // in this case, we first take the resonance from MC + // and then we find its daughters and compute cuts on them + for (ipart = 0; ipart < stack->GetNprimary(); ipart++) { + // take a track from the MC event + mother = (AliMCParticle*) fMCEvent->GetTrack(ipart); + + // check that it is a binary decay and the PDG code matches + if (mother->Particle()->GetNDaughters() != 2) continue; + if (mother->Particle()->GetPdgCode() != pdgM) continue; + + // store the labels of the two daughters + label[0] = mother->Particle()->GetFirstDaughter(); + label[1] = mother->Particle()->GetLastDaughter(); + + // retrieve the particles and other stuff + // check if they match the order in the pairDef + for (j = 0; j < 2; j++) { + if (label[j] < 0) continue; + part[j] = stack->Particle(label[j]); + pdgD[j] = TMath::Abs(part[j]->GetPdgCode()); + charge[j] = (Short_t)(part[j]->GetPDG()->Charge() / 3); + if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0)) + pairDefMatch[j] = 0; + else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1)) + pairDefMatch[j] = 1; + else + pairDefMatch[j] = -1; + + // find corresponding ESD particle: first try rejecting fakes, + // and in case of failure, try accepting fakes + esdIndex[j] = FindESDtrack(label[j], esd, kTRUE); + //TArrayI idx = FindESDtracks(label[j], esd); + //for (Int_t kk = 0; kk < idx.GetSize(); kk++) cout << "DAUGHTER " << j << " --> FOUND INDEX: " << idx[kk] << endl; + if (esdIndex[j] < 0) esdIndex[j] = FindESDtrack(label[j], esd, kFALSE); + //cout << "DAUGHTER " << j << " SINGLE FOUND INDEX = " << esdIndex[j] << endl; + } + + // since each candidate good resonance is taken once, we must check + // that it matches the pair definition in any order, and reject in case + // in none of them the pair is OK + // anyway, we must associate the correct daughter to the correct data member + if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) { + // 1st track --> 1st member of PairDef + fDaughter[0].SetRef(mc->GetTrack(label[0])); + fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[0])); + fDaughter[0].SetGood(); + // 2nd track --> 2nd member of PairDef + fDaughter[1].SetRef(mc->GetTrack(label[1])); + fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[1])); + fDaughter[1].SetGood(); + } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) { + // 1st track --> 2nd member of PairDef + fDaughter[0].SetRef(mc->GetTrack(label[1])); + fDaughter[0].SetRefMC((AliMCParticle*)mc->GetTrack(label[1])); + fDaughter[0].SetGood(); + // 2nd track --> 1st member of PairDef + fDaughter[1].SetRef(mc->GetTrack(label[0])); + fDaughter[1].SetRefMC((AliMCParticle*)mc->GetTrack(label[0])); + fDaughter[1].SetGood(); + } else { + fDaughter[0].SetBad(); + fDaughter[1].SetBad(); + } + + // reject the pair if the matching was unsuccessful + if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue; + + // first, we set the internal AliRsnMother object to + // the MC particles and then operate the selections on MC + fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1)); + FillContainer(cont, &fStepListMC, pairDef, 0); + + // then, if both particles found a good match in the ESD + // reassociate the ESD tracks to the pair and fill ESD containers + if (esdIndex[0] < 0 || esdIndex[1] < 0) continue; + if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) { + // 1st track --> 1st member of PairDef + fDaughter[0].SetRef(esd->GetTrack(esdIndex[0])); + // 2nd track --> 2nd member of PairDef + fDaughter[1].SetRef(esd->GetTrack(esdIndex[1])); + //cout << "****** MATCHING SCHEME 1" << endl; + } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) { + // 1st track --> 2nd member of PairDef + fDaughter[0].SetRef(esd->GetTrack(esdIndex[1])); + // 2nd track --> 1st member of PairDef + fDaughter[1].SetRef(esd->GetTrack(esdIndex[0])); + //cout << "****** MATCHING SCHEME 2" << endl; + } + //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl; + // here we must remember how many steps were already filled + first = (Int_t)fStepListMC.GetEntries(); + FillContainer(cont, &fStepListESD, pairDef, first); + } } //_____________________________________________________________________________ @@ -345,130 +331,120 @@ void AliRsnAnalysisEffSE::ProcessEventAOD(AliRsnPairDef *pairDef) // It is associated with the AliCFContainer with the name of the pair. // - AliAODEvent *aod = fRsnEvent.GetRefAOD(); - AliAODMCParticle *mother; - TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); - if (!mcArray) return; - - if (!pairDef) return; - AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName()); - if (!cont) return; - - // get informations from pairDef - Int_t pdgM = 0; - Int_t pdgD[2] = {0, 0}; - Short_t chargeD[2] = {0, 0}; - pdgM = pairDef->GetMotherPDG(); - pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0)); - pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1)); - chargeD[0] = pairDef->GetChargeShort(0); - chargeD[1] = pairDef->GetChargeShort(1); - - // other utility variables - Int_t first, j; - Int_t label [2] = {-1, -1}; - Short_t charge[2] = {0, 0}; - Short_t pairDefMatch[2] = {-1, -1}; - Int_t aodIndex[2] = {-1, -1}; - AliAODMCParticle *part[2] = {0, 0}; - - // loop on MC particles - TObjArrayIter next(mcArray); - while ( (mother = (AliAODMCParticle*)next()) ) - { - // check that it is a binary decay and the PDG code matches - if (mother->GetNDaughters() != 2) continue; - if (mother->GetPdgCode() != pdgM) continue; - - // store the labels of the two daughters - label[0] = mother->GetDaughter(0); - label[1] = mother->GetDaughter(1); - - // retrieve the particles and other stuff - // check if they match the order in the pairDef - for (j = 0; j < 2; j++) - { - if (label[j] < 0) continue; - part[j] = (AliAODMCParticle*)mcArray->At(label[j]); - pdgD[j] = TMath::Abs(part[j]->GetPdgCode()); - charge[j] = (Short_t)(part[j]->Charge()); - if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0)) - pairDefMatch[j] = 0; - else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1)) - pairDefMatch[j] = 1; - else - pairDefMatch[j] = -1; - - // find corresponding ESD particle: first try rejecting fakes, - // and in case of failure, try accepting fakes - aodIndex[j] = FindAODtrack(label[j], aod, kTRUE); - if (aodIndex[j] < 0) aodIndex[j] = FindAODtrack(label[j], aod, kFALSE); - } - - // since each candidate good resonance is taken once, we must check - // that it matches the pair definition in any order, and reject in case - // in none of them the pair is OK - // anyway, we must associate the correct daughter to the correct data member - if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) - { - // 1st track --> 1st member of PairDef - fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[0])); - fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[0])); - fDaughter[0].SetGood(); - // 2nd track --> 2nd member of PairDef - fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[1])); - fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[1])); - fDaughter[1].SetGood(); - } - else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) - { - // 1st track --> 2nd member of PairDef - fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[1])); - fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[1])); - fDaughter[0].SetGood(); - // 2nd track --> 1st member of PairDef - fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[0])); - fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[0])); - fDaughter[1].SetGood(); - } - else - { - fDaughter[0].SetBad(); - fDaughter[1].SetBad(); - } - - // reject the pair if the matching was unsuccessful - if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue; - - // first, we set the internal AliRsnMother object to - // the MC particles and then operate the selections on MC - fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1)); - FillContainer(cont, &fStepListMC, pairDef, 0); - - // then, if both particles found a good match in the AOD - // reassociate the AOD tracks to the pair and fill AOD containers - if (aodIndex[0] < 0 || aodIndex[1] < 0) continue; - if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) - { - // 1st track --> 1st member of PairDef - fDaughter[0].SetRef(aod->GetTrack(aodIndex[0])); - // 2nd track --> 2nd member of PairDef - fDaughter[1].SetRef(aod->GetTrack(aodIndex[1])); - //cout << "****** MATCHING SCHEME 1" << endl; - } - else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) - { - // 1st track --> 2nd member of PairDef - fDaughter[0].SetRef(aod->GetTrack(aodIndex[1])); - // 2nd track --> 1st member of PairDef - fDaughter[1].SetRef(aod->GetTrack(aodIndex[0])); - //cout << "****** MATCHING SCHEME 2" << endl; - } - //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl; - // here we must remember how many steps were already filled - first = (Int_t)fStepListMC.GetEntries(); - FillContainer(cont, &fStepListESD, pairDef, first); - } + AliAODEvent *aod = fRsnEvent.GetRefAOD(); + AliAODMCParticle *mother; + TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); + if (!mcArray) return; + + if (!pairDef) return; + AliCFContainer *cont = (AliCFContainer*)fContainerList->FindObject(pairDef->GetPairName()); + if (!cont) return; + + // get informations from pairDef + Int_t pdgM = 0; + Int_t pdgD[2] = {0, 0}; + Short_t chargeD[2] = {0, 0}; + pdgM = pairDef->GetMotherPDG(); + pdgD [0] = AliPID::ParticleCode(pairDef->GetPID(0)); + pdgD [1] = AliPID::ParticleCode(pairDef->GetPID(1)); + chargeD[0] = pairDef->GetChargeShort(0); + chargeD[1] = pairDef->GetChargeShort(1); + + // other utility variables + Int_t first, j; + Int_t label [2] = { -1, -1}; + Short_t charge[2] = {0, 0}; + Short_t pairDefMatch[2] = { -1, -1}; + Int_t aodIndex[2] = { -1, -1}; + AliAODMCParticle *part[2] = {0, 0}; + + // loop on MC particles + TObjArrayIter next(mcArray); + while ((mother = (AliAODMCParticle*)next())) { + // check that it is a binary decay and the PDG code matches + if (mother->GetNDaughters() != 2) continue; + if (mother->GetPdgCode() != pdgM) continue; + + // store the labels of the two daughters + label[0] = mother->GetDaughter(0); + label[1] = mother->GetDaughter(1); + + // retrieve the particles and other stuff + // check if they match the order in the pairDef + for (j = 0; j < 2; j++) { + if (label[j] < 0) continue; + part[j] = (AliAODMCParticle*)mcArray->At(label[j]); + pdgD[j] = TMath::Abs(part[j]->GetPdgCode()); + charge[j] = (Short_t)(part[j]->Charge()); + if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(0)) && charge[j] == pairDef->GetChargeShort(0)) + pairDefMatch[j] = 0; + else if (pdgD[j] == AliPID::ParticleCode(pairDef->GetPID(1)) && charge[j] == pairDef->GetChargeShort(1)) + pairDefMatch[j] = 1; + else + pairDefMatch[j] = -1; + + // find corresponding ESD particle: first try rejecting fakes, + // and in case of failure, try accepting fakes + aodIndex[j] = FindAODtrack(label[j], aod, kTRUE); + if (aodIndex[j] < 0) aodIndex[j] = FindAODtrack(label[j], aod, kFALSE); + } + + // since each candidate good resonance is taken once, we must check + // that it matches the pair definition in any order, and reject in case + // in none of them the pair is OK + // anyway, we must associate the correct daughter to the correct data member + if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) { + // 1st track --> 1st member of PairDef + fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[0])); + fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[0])); + fDaughter[0].SetGood(); + // 2nd track --> 2nd member of PairDef + fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[1])); + fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[1])); + fDaughter[1].SetGood(); + } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) { + // 1st track --> 2nd member of PairDef + fDaughter[0].SetRef((AliAODMCParticle*)mcArray->At(label[1])); + fDaughter[0].SetRefMC((AliAODMCParticle*)mcArray->At(label[1])); + fDaughter[0].SetGood(); + // 2nd track --> 1st member of PairDef + fDaughter[1].SetRef((AliAODMCParticle*)mcArray->At(label[0])); + fDaughter[1].SetRefMC((AliAODMCParticle*)mcArray->At(label[0])); + fDaughter[1].SetGood(); + } else { + fDaughter[0].SetBad(); + fDaughter[1].SetBad(); + } + + // reject the pair if the matching was unsuccessful + if (!fDaughter[0].IsOK() || !fDaughter[1].IsOK()) continue; + + // first, we set the internal AliRsnMother object to + // the MC particles and then operate the selections on MC + fPair.SetDaughters(&fDaughter[0], pairDef->GetMass(0), &fDaughter[1], pairDef->GetMass(1)); + FillContainer(cont, &fStepListMC, pairDef, 0); + + // then, if both particles found a good match in the AOD + // reassociate the AOD tracks to the pair and fill AOD containers + if (aodIndex[0] < 0 || aodIndex[1] < 0) continue; + if (pairDefMatch[0] == 0 && pairDefMatch[1] == 1) { + // 1st track --> 1st member of PairDef + fDaughter[0].SetRef(aod->GetTrack(aodIndex[0])); + // 2nd track --> 2nd member of PairDef + fDaughter[1].SetRef(aod->GetTrack(aodIndex[1])); + //cout << "****** MATCHING SCHEME 1" << endl; + } else if ((pairDefMatch[0] == 1 && pairDefMatch[1] == 0)) { + // 1st track --> 2nd member of PairDef + fDaughter[0].SetRef(aod->GetTrack(aodIndex[1])); + // 2nd track --> 1st member of PairDef + fDaughter[1].SetRef(aod->GetTrack(aodIndex[0])); + //cout << "****** MATCHING SCHEME 2" << endl; + } + //cout << "****** IDs = " << fDaughter[0].GetID() << ' ' << fDaughter[1].GetID() << endl; + // here we must remember how many steps were already filled + first = (Int_t)fStepListMC.GetEntries(); + FillContainer(cont, &fStepListESD, pairDef, first); + } } //_____________________________________________________________________________ @@ -478,47 +454,44 @@ void AliRsnAnalysisEffSE::FillContainer(AliCFContainer *cont, const TObjArray *s // Fill the containers // - Int_t iaxis, nAxes = fAxisList.GetEntries(); - Int_t istep, nSteps = stepList->GetEntries(); - Bool_t computeOK; - - // set daughters to pair - fPair.SetDaughters(&fDaughter[0], pd->GetMass(0), &fDaughter[1], pd->GetMass(1)); - - // compute values for all axes - for (iaxis = 0; iaxis < nAxes; iaxis++) - { - AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis); - fVar[iaxis] = -1E10; - switch (fcnAxis->GetTargetType()) - { - case AliRsnTarget::kMother: - fcnAxis->SetSupportObject(pd); - computeOK = fcnAxis->Eval(&fPair); - break; - case AliRsnTarget::kEvent: - computeOK = fcnAxis->Eval(&fRsnEvent); - break; - default: - AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName())); - computeOK = kFALSE; - } - if (computeOK) fVar[iaxis] = ((Float_t)fcnAxis->GetComputedValue()); - } - - // fill all steps - for (istep = 0; istep < nSteps; istep++) - { - AliRsnCutManager *cutMgr = (AliRsnCutManager*)stepList->At(istep); - AliRsnTarget::SwitchToFirst(); - if (!cutMgr->PassCommonDaughterCuts(&fDaughter[0])) break; - if (!cutMgr->PassCommonDaughterCuts(&fDaughter[1])) break; - if (!cutMgr->PassDaughter1Cuts(&fDaughter[0])) break; - if (!cutMgr->PassDaughter2Cuts(&fDaughter[1])) break; - if (!cutMgr->PassMotherCuts(&fPair)) break; - //cout << "**************************************** FILLING STEP " << istep << endl; - cont->Fill(fVar.GetArray(), istep + firstOutStep); - } + Int_t iaxis, nAxes = fAxisList.GetEntries(); + Int_t istep, nSteps = stepList->GetEntries(); + Bool_t computeOK; + + // set daughters to pair + fPair.SetDaughters(&fDaughter[0], pd->GetMass(0), &fDaughter[1], pd->GetMass(1)); + + // compute values for all axes + for (iaxis = 0; iaxis < nAxes; iaxis++) { + AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis); + fVar[iaxis] = -1E10; + switch (fcnAxis->GetTargetType()) { + case AliRsnTarget::kMother: + fcnAxis->SetSupportObject(pd); + computeOK = fcnAxis->Eval(&fPair); + break; + case AliRsnTarget::kEvent: + computeOK = fcnAxis->Eval(&fRsnEvent); + break; + default: + AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName())); + computeOK = kFALSE; + } + if (computeOK) fVar[iaxis] = ((Float_t)fcnAxis->GetComputedValue()); + } + + // fill all steps + for (istep = 0; istep < nSteps; istep++) { + AliRsnCutManager *cutMgr = (AliRsnCutManager*)stepList->At(istep); + AliRsnTarget::SwitchToFirst(); + if (!cutMgr->PassCommonDaughterCuts(&fDaughter[0])) break; + if (!cutMgr->PassCommonDaughterCuts(&fDaughter[1])) break; + if (!cutMgr->PassDaughter1Cuts(&fDaughter[0])) break; + if (!cutMgr->PassDaughter2Cuts(&fDaughter[1])) break; + if (!cutMgr->PassMotherCuts(&fPair)) break; + //cout << "**************************************** FILLING STEP " << istep << endl; + cont->Fill(fVar.GetArray(), istep + firstOutStep); + } } //_____________________________________________________________________________ @@ -529,8 +502,8 @@ void AliRsnAnalysisEffSE::RsnTerminate(Option_t*) // Could be added some monitor histograms here. // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -539,7 +512,7 @@ void AliRsnAnalysisEffSE::AddPairDef(AliRsnPairDef* pairDef) // // Adds pair definition // - fPairDefList.AddLast(pairDef); + fPairDefList.AddLast(pairDef); } //_____________________________________________________________________________ @@ -547,68 +520,64 @@ Int_t AliRsnAnalysisEffSE::FindESDtrack(Int_t label, AliESDEvent *esd, Bool_t re { // // Finds in the ESD a track whose label corresponds to that in argument. -// When global tracks are enabled, tries first to find a global track +// When global tracks are enabled, tries first to find a global track // satisfying that requirement. // If no global tracks are found, if ITS-SA are enable, tries to search among them // otherwise return a negative number. // If global tracks are disabled, search only among ITS SA // - Int_t i = 0; - Int_t ntracks = esd->GetNumberOfTracks(); - ULong_t status; - Bool_t isTPC; - Bool_t isITSSA; - - // loop for global tracks - if (fUseGlobal) - { - for (i = 0; i < ntracks; i++) - { - AliESDtrack *track = esd->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isTPC = ((status & AliESDtrack::kTPCin) != 0); - if (!isTPC) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - // if required, reject fakes - if (rejectFakes && track->GetLabel() < 0) continue; - - // if all checks are passed and we are searching among global - // this means that thie track is a global one with the right label - // then, the return value is set to this, and returned - return i; - } - } - - // loop for ITS-SA tracks (this happens only if no global tracks were found - // or searching among globals is disabled) - if (fUseITSSA) - { - for (i = 0; i < ntracks; i++) - { - AliESDtrack *track = esd->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); - if (!isITSSA) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - // if required, reject fakes - if (rejectFakes && track->GetLabel() < 0) continue; - - // if all checks are passed and we are searching among global - // this means that thie track is a global one with the right label - // then, the return value is set to this, and returned - return i; - } - } - - // if we reach this point, no match were found - return -1; + Int_t i = 0; + Int_t ntracks = esd->GetNumberOfTracks(); + ULong_t status; + Bool_t isTPC; + Bool_t isITSSA; + + // loop for global tracks + if (fUseGlobal) { + for (i = 0; i < ntracks; i++) { + AliESDtrack *track = esd->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isTPC = ((status & AliESDtrack::kTPCin) != 0); + if (!isTPC) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + // if required, reject fakes + if (rejectFakes && track->GetLabel() < 0) continue; + + // if all checks are passed and we are searching among global + // this means that thie track is a global one with the right label + // then, the return value is set to this, and returned + return i; + } + } + + // loop for ITS-SA tracks (this happens only if no global tracks were found + // or searching among globals is disabled) + if (fUseITSSA) { + for (i = 0; i < ntracks; i++) { + AliESDtrack *track = esd->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); + if (!isITSSA) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + // if required, reject fakes + if (rejectFakes && track->GetLabel() < 0) continue; + + // if all checks are passed and we are searching among global + // this means that thie track is a global one with the right label + // then, the return value is set to this, and returned + return i; + } + } + + // if we reach this point, no match were found + return -1; } //_____________________________________________________________________________ @@ -616,58 +585,54 @@ TArrayI AliRsnAnalysisEffSE::FindESDtracks(Int_t label, AliESDEvent *esd) { // // Finds in the ESD a track whose label corresponds to that in argument. -// When global tracks are enabled, tries first to find a global track +// When global tracks are enabled, tries first to find a global track // satisfying that requirement. // If no global tracks are found, if ITS-SA are enable, tries to search among them // otherwise return a negative number. // If global tracks are disabled, search only among ITS SA // - Int_t i = 0; - Int_t ntracks = esd->GetNumberOfTracks(); - ULong_t status; - Bool_t isTPC; - Bool_t isITSSA; - TArrayI array(100); - Int_t nfound = 0; - - // loop for global tracks - if (fUseGlobal) - { - for (i = 0; i < ntracks; i++) - { - AliESDtrack *track = esd->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isTPC = ((status & AliESDtrack::kTPCin) != 0); - if (!isTPC) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - array[nfound++] = i; - } - } - - // loop for ITS-SA tracks (this happens only if no global tracks were found - // or searching among globals is disabled) - if (fUseITSSA) - { - for (i = 0; i < ntracks; i++) - { - AliESDtrack *track = esd->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); - if (!isITSSA) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - array[nfound++] = i; - } - } - - array.Set(nfound); - return array; + Int_t i = 0; + Int_t ntracks = esd->GetNumberOfTracks(); + ULong_t status; + Bool_t isTPC; + Bool_t isITSSA; + TArrayI array(100); + Int_t nfound = 0; + + // loop for global tracks + if (fUseGlobal) { + for (i = 0; i < ntracks; i++) { + AliESDtrack *track = esd->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isTPC = ((status & AliESDtrack::kTPCin) != 0); + if (!isTPC) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + array[nfound++] = i; + } + } + + // loop for ITS-SA tracks (this happens only if no global tracks were found + // or searching among globals is disabled) + if (fUseITSSA) { + for (i = 0; i < ntracks; i++) { + AliESDtrack *track = esd->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); + if (!isITSSA) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + array[nfound++] = i; + } + } + + array.Set(nfound); + return array; } //_____________________________________________________________________________ @@ -675,68 +640,64 @@ Int_t AliRsnAnalysisEffSE::FindAODtrack(Int_t label, AliAODEvent *aod, Bool_t re { // // Finds in the ESD a track whose label corresponds to that in argument. -// When global tracks are enabled, tries first to find a global track +// When global tracks are enabled, tries first to find a global track // satisfying that requirement. // If no global tracks are found, if ITS-SA are enable, tries to search among them // otherwise return a negative number. // If global tracks are disabled, search only among ITS SA // - Int_t i = 0; - Int_t ntracks = aod->GetNumberOfTracks(); - ULong_t status; - Bool_t isTPC; - Bool_t isITSSA; - - // loop for global tracks - if (fUseGlobal) - { - for (i = 0; i < ntracks; i++) - { - AliAODTrack *track = aod->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isTPC = ((status & AliESDtrack::kTPCin) != 0); - if (!isTPC) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - // if required, reject fakes - if (rejectFakes && track->GetLabel() < 0) continue; - - // if all checks are passed and we are searching among global - // this means that thie track is a global one with the right label - // then, the return value is set to this, and returned - return i; - } - } - - // loop for ITS-SA tracks (this happens only if no global tracks were found - // or searching among globals is disabled) - if (fUseITSSA) - { - for (i = 0; i < ntracks; i++) - { - AliAODTrack *track = aod->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); - if (!isITSSA) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - // if required, reject fakes - if (rejectFakes && track->GetLabel() < 0) continue; - - // if all checks are passed and we are searching among global - // this means that thie track is a global one with the right label - // then, the return value is set to this, and returned - return i; - } - } - - // if we reach this point, no match were found - return -1; + Int_t i = 0; + Int_t ntracks = aod->GetNumberOfTracks(); + ULong_t status; + Bool_t isTPC; + Bool_t isITSSA; + + // loop for global tracks + if (fUseGlobal) { + for (i = 0; i < ntracks; i++) { + AliAODTrack *track = aod->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isTPC = ((status & AliESDtrack::kTPCin) != 0); + if (!isTPC) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + // if required, reject fakes + if (rejectFakes && track->GetLabel() < 0) continue; + + // if all checks are passed and we are searching among global + // this means that thie track is a global one with the right label + // then, the return value is set to this, and returned + return i; + } + } + + // loop for ITS-SA tracks (this happens only if no global tracks were found + // or searching among globals is disabled) + if (fUseITSSA) { + for (i = 0; i < ntracks; i++) { + AliAODTrack *track = aod->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); + if (!isITSSA) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + // if required, reject fakes + if (rejectFakes && track->GetLabel() < 0) continue; + + // if all checks are passed and we are searching among global + // this means that thie track is a global one with the right label + // then, the return value is set to this, and returned + return i; + } + } + + // if we reach this point, no match were found + return -1; } //_____________________________________________________________________________ @@ -744,58 +705,54 @@ TArrayI AliRsnAnalysisEffSE::FindAODtracks(Int_t label, AliAODEvent *aod) { // // Finds in the ESD a track whose label corresponds to that in argument. -// When global tracks are enabled, tries first to find a global track +// When global tracks are enabled, tries first to find a global track // satisfying that requirement. // If no global tracks are found, if ITS-SA are enable, tries to search among them // otherwise return a negative number. // If global tracks are disabled, search only among ITS SA // - Int_t i = 0; - Int_t ntracks = aod->GetNumberOfTracks(); - ULong_t status; - Bool_t isTPC; - Bool_t isITSSA; - TArrayI array(100); - Int_t nfound = 0; - - // loop for global tracks - if (fUseGlobal) - { - for (i = 0; i < ntracks; i++) - { - AliAODTrack *track = aod->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isTPC = ((status & AliESDtrack::kTPCin) != 0); - if (!isTPC) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - array[nfound++] = i; - } - } - - // loop for ITS-SA tracks (this happens only if no global tracks were found - // or searching among globals is disabled) - if (fUseITSSA) - { - for (i = 0; i < ntracks; i++) - { - AliAODTrack *track = aod->GetTrack(i); - status = (ULong_t)track->GetStatus(); - isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); - if (!isITSSA) continue; - - // check that label match - if (TMath::Abs(track->GetLabel()) != label) continue; - - array[nfound++] = i; - } - } - - array.Set(nfound); - return array; + Int_t i = 0; + Int_t ntracks = aod->GetNumberOfTracks(); + ULong_t status; + Bool_t isTPC; + Bool_t isITSSA; + TArrayI array(100); + Int_t nfound = 0; + + // loop for global tracks + if (fUseGlobal) { + for (i = 0; i < ntracks; i++) { + AliAODTrack *track = aod->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isTPC = ((status & AliESDtrack::kTPCin) != 0); + if (!isTPC) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + array[nfound++] = i; + } + } + + // loop for ITS-SA tracks (this happens only if no global tracks were found + // or searching among globals is disabled) + if (fUseITSSA) { + for (i = 0; i < ntracks; i++) { + AliAODTrack *track = aod->GetTrack(i); + status = (ULong_t)track->GetStatus(); + isITSSA = ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0); + if (!isITSSA) continue; + + // check that label match + if (TMath::Abs(track->GetLabel()) != label) continue; + + array[nfound++] = i; + } + } + + array.Set(nfound); + return array; } //______________________________________________________________________________ @@ -809,25 +766,24 @@ Bool_t AliRsnAnalysisEffSE::EventProcess() // omonyme function in mother class // - // initially, an event is expected to be bad - fTaskInfo.SetEventUsed(kFALSE); - - // check the event cuts and update the info data accordingly - // events not passing the cuts must be rejected - if (!fEventCuts.IsSelected(&fRsnEvent)) - { - fTaskInfo.SetEventUsed(kFALSE); - return kFALSE; - } - - // if we reach this point, cuts were passed; - // then additional operations can be done - - // find leading particle (without any PID/momentum restriction) - fRsnEvent.SelectLeadingParticle(0); - - // final return value is positive - // but call the mother class method which updates info object - fTaskInfo.SetEventUsed(kTRUE); - return AliRsnVAnalysisTaskSE::EventProcess(); + // initially, an event is expected to be bad + fTaskInfo.SetEventUsed(kFALSE); + + // check the event cuts and update the info data accordingly + // events not passing the cuts must be rejected + if (!fEventCuts.IsSelected(&fRsnEvent)) { + fTaskInfo.SetEventUsed(kFALSE); + return kFALSE; + } + + // if we reach this point, cuts were passed; + // then additional operations can be done + + // find leading particle (without any PID/momentum restriction) + fRsnEvent.SelectLeadingParticle(0); + + // final return value is positive + // but call the mother class method which updates info object + fTaskInfo.SetEventUsed(kTRUE); + return AliRsnVAnalysisTaskSE::EventProcess(); } diff --git a/PWG2/RESONANCES/AliRsnAnalysisEffSE.h b/PWG2/RESONANCES/AliRsnAnalysisEffSE.h index 5e2df07101d..d0d86c5e32e 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisEffSE.h +++ b/PWG2/RESONANCES/AliRsnAnalysisEffSE.h @@ -31,52 +31,51 @@ class AliRsnCutManager; class AliRsnValue; class AliRsnAnalysisManager; -class AliRsnAnalysisEffSE : public AliRsnVAnalysisTaskSE -{ +class AliRsnAnalysisEffSE : public AliRsnVAnalysisTaskSE { - public: - AliRsnAnalysisEffSE(const char *name = "AliRsnAnalysisTaskEffSE"); - AliRsnAnalysisEffSE(const AliRsnAnalysisEffSE& copy); - virtual ~AliRsnAnalysisEffSE() {;}; +public: + AliRsnAnalysisEffSE(const char *name = "AliRsnAnalysisTaskEffSE"); + AliRsnAnalysisEffSE(const AliRsnAnalysisEffSE& copy); + virtual ~AliRsnAnalysisEffSE() {;}; - // Implement this - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnTerminate(Option_t*); - virtual Bool_t EventProcess(); + // Implement this + virtual void RsnUserCreateOutputObjects(); + virtual void RsnUserExec(Option_t*); + virtual void RsnTerminate(Option_t*); + virtual Bool_t EventProcess(); - // settings - AliRsnCutSet* GetEventCuts() {return &fEventCuts;} - void AddPairDef(AliRsnPairDef *pairDef); - void AddStepMC(AliRsnCutManager *mgr); - void AddStepESD(AliRsnCutManager *mgr); - void AddAxis(AliRsnValue *axis); + // settings + AliRsnCutSet* GetEventCuts() {return &fEventCuts;} + void AddPairDef(AliRsnPairDef *pairDef); + void AddStepMC(AliRsnCutManager *mgr); + void AddStepESD(AliRsnCutManager *mgr); + void AddAxis(AliRsnValue *axis); - private: +private: - AliRsnAnalysisEffSE& operator=(const AliRsnAnalysisEffSE& /*copy*/) {return *this;} - void ProcessEventESD(AliRsnPairDef *pairDef); - void ProcessEventAOD(AliRsnPairDef *pairDef); - void FillContainer(AliCFContainer *cont, const TObjArray *stepList, AliRsnPairDef *pd, Int_t firstOutStep); - Int_t FindESDtrack (Int_t label, AliESDEvent *esd, Bool_t rejectFakes); - TArrayI FindESDtracks(Int_t label, AliESDEvent *esd); - Int_t FindAODtrack (Int_t label, AliAODEvent *aod, Bool_t rejectFakes); - TArrayI FindAODtracks(Int_t label, AliAODEvent *aod); + AliRsnAnalysisEffSE& operator=(const AliRsnAnalysisEffSE& /*copy*/) {return *this;} + void ProcessEventESD(AliRsnPairDef *pairDef); + void ProcessEventAOD(AliRsnPairDef *pairDef); + void FillContainer(AliCFContainer *cont, const TObjArray *stepList, AliRsnPairDef *pd, Int_t firstOutStep); + Int_t FindESDtrack(Int_t label, AliESDEvent *esd, Bool_t rejectFakes); + TArrayI FindESDtracks(Int_t label, AliESDEvent *esd); + Int_t FindAODtrack(Int_t label, AliAODEvent *aod, Bool_t rejectFakes); + TArrayI FindAODtracks(Int_t label, AliAODEvent *aod); - Bool_t fUseITSSA; // switch to use ITS standalone tracks - Bool_t fUseGlobal; // switch to use global tracks - TObjArray fStepListMC; // list of cut managers for all steps with MC - TObjArray fStepListESD; // list of cut managers for all steps with ESD - TClonesArray fAxisList; // list of axes of efficiency plots - TObjArray fPairDefList; // decay channels - TList *fContainerList; // list of CF containers - TList *fOutList; // global output list - TArrayD fVar; // list of variables of the container - AliRsnMother fPair; // interface to pair - AliRsnDaughter fDaughter[2]; // interface to tracks - AliRsnCutSet fEventCuts; // event cuts + Bool_t fUseITSSA; // switch to use ITS standalone tracks + Bool_t fUseGlobal; // switch to use global tracks + TObjArray fStepListMC; // list of cut managers for all steps with MC + TObjArray fStepListESD; // list of cut managers for all steps with ESD + TClonesArray fAxisList; // list of axes of efficiency plots + TObjArray fPairDefList; // decay channels + TList *fContainerList; // list of CF containers + TList *fOutList; // global output list + TArrayD fVar; // list of variables of the container + AliRsnMother fPair; // interface to pair + AliRsnDaughter fDaughter[2]; // interface to tracks + AliRsnCutSet fEventCuts; // event cuts - ClassDef(AliRsnAnalysisEffSE, 1) + ClassDef(AliRsnAnalysisEffSE, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisKStarKpi.cxx b/PWG2/RESONANCES/AliRsnAnalysisKStarKpi.cxx deleted file mode 100644 index 0c2bfb4a314..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisKStarKpi.cxx +++ /dev/null @@ -1,365 +0,0 @@ -// -// Class AliRsnAnalysisKStarKpi -// -// Virtual Class derivated from AliRsnVAnalysisTaskSE which will be base class -// for all RSN SE tasks -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// - -#include -#include - -#include "AliRsnFunction.h" -#include "AliRsnAnalysisKStarKpi.h" - -ClassImp(AliRsnAnalysisKStarKpi) - -//_____________________________________________________________________________ -AliRsnAnalysisKStarKpi::AliRsnAnalysisKStarKpi(const char *name, Bool_t useKine) : - AliRsnVAnalysisTaskSE(name, useKine), - fGoodK(0), - fGoodPi(0), - fKaon(), - fPion(), - fMother(), - fPairDef(AliPID::kKaon, '+', AliPID::kPion, '-', 313, 0.896), - fCutEvent(Form("%s_cutEvent", name), AliRsnTarget::kEvent), - fCutTrackCommon(Form("%s_cutTrackCom", name), AliRsnTarget::kDaughter), - fCutTrackKaon(Form("%s_cutTrackKaon", name), AliRsnTarget::kDaughter), - fCutTrackPion(Form("%s_cutTrackPion", name), AliRsnTarget::kDaughter), - fCutPair(Form("%s_cutPair", name), AliRsnTarget::kMother), - fFuncPM("AliRsnFunction", 0), - fFuncMP("AliRsnFunction", 0), - fFuncPP("AliRsnFunction", 0), - fFuncMM("AliRsnFunction", 0), - fFuncTruePM("AliRsnFunction", 0), - fFuncTrueMP("AliRsnFunction", 0), - fOutList(0x0) -{ -// -// Default constructor. -// Defines another output slot for histograms/ntuples -// - - DefineOutput(2, TList::Class()); -} - -//_____________________________________________________________________________ -AliRsnAnalysisKStarKpi::AliRsnAnalysisKStarKpi(const AliRsnAnalysisKStarKpi& copy) : - AliRsnVAnalysisTaskSE(copy), - fGoodK(0), - fGoodPi(0), - fKaon(), - fPion(), - fMother(), - fPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455), - fCutEvent(copy.fCutEvent), - fCutTrackCommon(copy.fCutTrackCommon), - fCutTrackKaon(copy.fCutTrackKaon), - fCutTrackPion(copy.fCutTrackPion), - fCutPair(copy.fCutPair), - fFuncPM(copy.fFuncPM), - fFuncMP(copy.fFuncMP), - fFuncPP(copy.fFuncPP), - fFuncMM(copy.fFuncMM), - fFuncTruePM(copy.fFuncTruePM), - fFuncTrueMP(copy.fFuncTrueMP), - fOutList(0x0) -{ -// -// Copy constructor. -// -} - -//_____________________________________________________________________________ -AliRsnAnalysisKStarKpi& AliRsnAnalysisKStarKpi::operator=(const AliRsnAnalysisKStarKpi& copy) -{ -// -// Assigment operator. -// - - AliRsnVAnalysisTaskSE::operator=(copy); - - fFuncPM = copy.fFuncPM; - fFuncMP = copy.fFuncMP; - fFuncPP = copy.fFuncPP; - fFuncMM = copy.fFuncMM; - fFuncTruePM = copy.fFuncTruePM; - fFuncTrueMP = copy.fFuncTrueMP; - - fCutEvent = copy.fCutEvent; - fCutTrackCommon = copy.fCutTrackCommon; - fCutTrackPion = copy.fCutTrackPion; - fCutTrackKaon = copy.fCutTrackKaon; - fCutPair = copy.fCutPair; - - if (fOutList) fOutList->Clear(); - - return (*this); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisKStarKpi::AddFunction(AliRsnFunction* const fcn) -{ -// -// Adds a new computing function to each collection, -// in order to have exactly the sames for each kind of pair. -// - - Int_t size = fFuncPM.GetEntries(); - - new (fFuncPM [size]) AliRsnFunction(*fcn); - new (fFuncMP [size]) AliRsnFunction(*fcn); - new (fFuncPP [size]) AliRsnFunction(*fcn); - new (fFuncMM [size]) AliRsnFunction(*fcn); - new (fFuncTruePM[size]) AliRsnFunction(*fcn); - new (fFuncTrueMP[size]) AliRsnFunction(*fcn); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisKStarKpi::RsnUserCreateOutputObjects() -{ -// -// Creation of output objects. -// These are created through the utility methods in the analysis manager, -// which asks all the AliRsnPair objects to initialize their output which -// is then linked to the TList data member of this, which will contain all the output. -// - - if (!fOutList) fOutList = new TList; - fOutList->Clear(); - - Int_t i, j, nFunc = fFuncPM.GetEntries(); - TString hName(""), suf[6] = {"PM", "MP", "PP", "MM", "TruePM", "TrueMP"}; - AliRsnFunction *fcn[6] = {0, 0, 0, 0}; - - for (i = 0; i < nFunc; i++) - { - fcn[0] = (AliRsnFunction*)fFuncPM.At(i); - fcn[1] = (AliRsnFunction*)fFuncMP.At(i); - fcn[2] = (AliRsnFunction*)fFuncPP.At(i); - fcn[3] = (AliRsnFunction*)fFuncMM.At(i); - fcn[4] = (AliRsnFunction*)fFuncTruePM.At(i); - fcn[5] = (AliRsnFunction*)fFuncTrueMP.At(i); - for (j = 0; j < 6; j++) - { - fcn[j]->SetPairDef(&fPairDef); - fcn[j]->SetPair(&fMother); - - hName = GetName(); - hName += '_'; - hName += suf[j]; - hName += '_'; - hName += fcn[j]->GetName(); - if (fcn[j]->IsUsingTH1()) fOutList->Add(fcn[j]->CreateHistogram(hName.Data(), "")); - else fOutList->Add(fcn[j]->CreateHistogramSparse(hName.Data(), "")); - } - } - - PostData(2, fOutList); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisKStarKpi::RsnUserExec(Option_t*) -{ -// -// Execution of the analysis task. -// Recovers the input event and processes it with all included pair objects, -// using 'reconstructed' or 'MonteCarlo' functions depending on MC-only flag. -// - - // skip if the global event pointers are NULL - // and point to first event in the target - AliRsnEvent *event = AliRsnEvent::GetCurrentEvent1(); - if (!event) return; - AliRsnTarget::SwitchToFirst(); - - // select good tracks, applying all cuts - // in this point we use only the 'fPion' data member - // but it holds for both kinds of particles - Int_t i, index, tot = event->GetAbsoluteSum(), ngoodK = 0, ngoodPi = 0; - Bool_t assignOK; - AliRsnDaughter::ERefType type; - fGoodK.Set(tot); - fGoodPi.Set(tot); - for (i = 0; i < tot; i++) - { - // assign track and skip all that are not charged tracks - assignOK = event->ConvertAbsoluteIndex(i, index, type); - if (!assignOK || type != AliRsnDaughter::kTrack) continue; - event->SetDaughter(fPion, index, AliRsnDaughter::kTrack); - - // skip tracks which don't pass common cuts - if (!fCutTrackCommon.IsSelected(&fPion)) continue; - - // accept tracks which pass also charge-related cuts - if (fCutTrackPion.IsSelected(&fPion)) - { - fGoodPi[ngoodPi] = index; - ++ngoodPi; - } - else if (fCutTrackKaon.IsSelected(&fPion)) - { - fGoodK[ngoodK] = index; - ++ngoodK; - } - } - fGoodK.Set(ngoodK); - fGoodPi.Set(ngoodPi); - - // now that the 'tot' value is useless, set it to - // the total number of functions, which by construction is THE SAME - // for all collections - tot = fFuncPM.GetEntries(); - - // loop on selected tracks and fill histograms - // external loop is on kaons (first element in pairDef) - // internal loop is on pions (second element in pairDef) - Int_t i0, i1, m0, m1, motherPDG; - const Double_t kaonMass = 0.493677; - const Double_t pionMass = 0.13957; - const Int_t kstarPDG = 313; - const Int_t kaonPDG = 313; - const Int_t pionPDG = 211; - AliRsnFunction *fcn; - for (i0 = 0; i0 < ngoodK; i0++) - { - index = fGoodK[i0]; - event->SetDaughter(fKaon, index, AliRsnDaughter::kTrack); - - for (i1 = 0; i1 < ngoodPi; i1++) - { - index = fGoodPi[i1]; - event->SetDaughter(fPion, index, AliRsnDaughter::kTrack); - - // skip in case the two indexes match - if (fPion.GetID() == fKaon.GetID()) continue; - - // adjust charges of pair def - fPairDef.SetDaughters(AliPID::kKaon, fKaon.ChargeChar(), AliPID::kPion, fPion.ChargeChar()); - - // fill the pair using the kaon masses and the passed daughters - fMother.SetDaughters(&fKaon, kaonMass, &fPion, pionMass); - - // check pair cuts - if (!fCutPair.IsSelected(&fMother)) continue; - - // if pair is like-sign, fill appropriate histos - if (fPairDef.IsLikeSign()) - { - if (fKaon.Charge() > 0) - { - for (i = 0; i < tot; i++) - { - fcn = (AliRsnFunction*)fFuncPP[i]; - fcn->Fill(); - } - } - else - { - for (i = 0; i < tot; i++) - { - fcn = (AliRsnFunction*)fFuncMM[i]; - fcn->Fill(); - } - } - } - else - { - // if pair is unlike-sign, check that it is true - motherPDG = fMother.CommonMother(m0, m1); - if (motherPDG == kstarPDG) - { - if (m0 < 0 || m1 < 0) motherPDG = 0; - if (TMath::Abs(fKaon.GetPDG()) != kaonPDG) motherPDG = 0; - if (TMath::Abs(fPion.GetPDG()) != pionPDG) motherPDG = 0; - } - - // fill unlike-sign histo (the appropriate one) - if (fKaon.Charge() > 0) - { - for (i = 0; i < tot; i++) - { - fcn = (AliRsnFunction*)fFuncPM[i]; - fcn->Fill(); - if (motherPDG == kstarPDG) - { - fcn = (AliRsnFunction*)fFuncTruePM[i]; - fcn->Fill(); - } - } - } - else - { - for (i = 0; i < tot; i++) - { - fcn = (AliRsnFunction*)fFuncMP[i]; - fcn->Fill(); - if (motherPDG == kstarPDG) - { - fcn = (AliRsnFunction*)fFuncTrueMP[i]; - fcn->Fill(); - } - } - } - } - } // for (i1) - } // for (i0) - - PostData(2, fOutList); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisKStarKpi::RsnTerminate(Option_t*) -{ -// -// Termination. -// Could be added some monitor histograms here. -// -} - -//______________________________________________________________________________ -Bool_t AliRsnAnalysisKStarKpi::EventProcess() -{ -// -// Customized event pre-processing. -// First checks if the current event passes all cuts, -// and if it does, updates the informations and then -// call the operations which are already defined in the -// omonyme function in mother class -// - - // initially, an event is expected to be bad - fTaskInfo.SetEventUsed(kFALSE); - - // check #1: number of tracks in event (reject empty events) - Int_t ntracks = fRsnEvent.GetMultiplicity(); - if (ntracks < 1) - { - // empty events are rejected by default - fTaskInfo.SetEventUsed(kFALSE); - AliDebug(AliLog::kDebug, "Empty event. Skipping..."); - return kFALSE; - } - - // check the event cuts and update the info data accordingly - // events not passing the cuts must be rejected - if (!fCutEvent.IsSelected(&fRsnEvent)) - { - fTaskInfo.SetEventUsed(kFALSE); - return kFALSE; - } - - // if we reach this point, cuts were passed; - // then additional operations can be done - - // find leading particle (without any PID/momentum restriction) - fRsnEvent.SelectLeadingParticle(0); - - // final return value is positive - // but call the mother class method which updates info object - fTaskInfo.SetEventUsed(kTRUE); - return AliRsnVAnalysisTaskSE::EventProcess(); -} diff --git a/PWG2/RESONANCES/AliRsnAnalysisKStarKpi.h b/PWG2/RESONANCES/AliRsnAnalysisKStarKpi.h deleted file mode 100644 index 40c1aa1148e..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisKStarKpi.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// Class AliRsnAnalysisKStarKpi -// -// Virtual Class derivated from AliRsnVAnalysisTaskSE which will be base class -// for all RSN SE tasks -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// -#ifndef AliRsnAnalysisKStarKpi_H -#define AliRsnAnalysisKStarKpi_H - -#include "TClonesArray.h" - -#include "AliRsnVAnalysisTaskSE.h" - -#include "AliRsnDaughter.h" -#include "AliRsnMother.h" -#include "AliRsnPairDef.h" -#include "AliRsnEvent.h" -#include "AliRsnCutSet.h" - -class AliRsnPIDDefESD; - -class AliRsnAnalysisKStarKpi : public AliRsnVAnalysisTaskSE -{ - public: - - AliRsnAnalysisKStarKpi(const char *name = "RSNphi", Bool_t useKine = kFALSE); - AliRsnAnalysisKStarKpi(const AliRsnAnalysisKStarKpi& copy); - AliRsnAnalysisKStarKpi& operator=(const AliRsnAnalysisKStarKpi& copy); - virtual ~AliRsnAnalysisKStarKpi() {} - - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnTerminate(Option_t*); - virtual Bool_t EventProcess(); - - AliRsnCutSet* GetEventCuts() {return &fCutEvent;} - AliRsnCutSet* GetCommonDaughterCuts() {return &fCutTrackCommon;} - AliRsnCutSet* GetKaonDaughterCuts() {return &fCutTrackKaon;} - AliRsnCutSet* GetPionDaughterCuts() {return &fCutTrackPion;} - AliRsnCutSet* GetMotherCuts() {return &fCutPair;} - - void AddFunction(AliRsnFunction* const fcn); - TList* GenerateHistograms(); - - private: - - TArrayI fGoodK; // indexes of good tracks (kaons) - TArrayI fGoodPi; // indexes of good tracks (pions) - AliRsnDaughter fKaon; // daughter data-member (pion) - AliRsnDaughter fPion; // daughter data-member (pion) - AliRsnMother fMother; // mother data-member (to save memory) - AliRsnPairDef fPairDef; // resonance decay tree (fixed) - - AliRsnCutSet fCutEvent; // cut set for events - AliRsnCutSet fCutTrackCommon; // cut set for tracks (common) - AliRsnCutSet fCutTrackKaon; // cut set for tracks (only pos) - AliRsnCutSet fCutTrackPion; // cut set for tracks (only neg) - AliRsnCutSet fCutPair; // cut set for pairs - - TClonesArray fFuncPM; // collection of functions for unlike-sign (K+ pi-) - TClonesArray fFuncMP; // collection of functions for unlike-sign (K- pi+) - TClonesArray fFuncPP; // collection of functions for like-sign ++ - TClonesArray fFuncMM; // collection of functions for like-sign -- - TClonesArray fFuncTruePM; // collection of functions for unlike-sign true pairs (K+ pi-) - TClonesArray fFuncTrueMP; // collection of functions for unlike-sign true pairs (K- pi+) - - TList *fOutList; // list of output events - - ClassDef(AliRsnAnalysisKStarKpi, 1) -}; - -#endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisME.cxx b/PWG2/RESONANCES/AliRsnAnalysisME.cxx deleted file mode 100644 index 951b10a51af..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisME.cxx +++ /dev/null @@ -1,220 +0,0 @@ -// -// Class AliRsnAnalysisME -// -// -// Virtual Class derivated from AliRsnVAnalysisTaskME which will be base class -// for all RSN SE tasks -// -// authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// Martin Vala (martin.vala@cern.ch) -// - -#include "AliESDEvent.h" -#include "AliMCEvent.h" -#include "AliAODEvent.h" -#include "AliMultiEventInputHandler.h" -#include "AliRsnAnalysisME.h" - -ClassImp(AliRsnAnalysisME) - -//_____________________________________________________________________________ -AliRsnAnalysisME::AliRsnAnalysisME(const char *name) : - AliRsnVAnalysisTaskME(name), - fRsnAnalysisManager(), - fEvent(), - fEventMix(), - fOutList(0x0) -{ -// -// Default constructor -// - AliDebug(AliLog::kDebug+2, "<-"); - - DefineOutput(2, TList::Class()); - AliDebug(AliLog::kDebug+2,"->"); -} - -AliRsnAnalysisME::AliRsnAnalysisME(const AliRsnAnalysisME& copy) : AliRsnVAnalysisTaskME(copy), - fRsnAnalysisManager(copy.fRsnAnalysisManager), - fEvent(copy.fEvent), - fEventMix(copy.fEvent), - fOutList(0x0) -{ - AliDebug(AliLog::kDebug+2, "<-"); - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisME::RsnUserCreateOutputObjects() -{ -// -// Creation of output objects. -// These are created through the utility methods in the analysis manager, -// which produces a list of histograms for each specified set of pairs. -// Each of these lists is added to the main list of this task. -// - - AliDebug(AliLog::kDebug+2, "<-"); - - fOutList = new TList(); - fOutList->SetOwner(); - - fRsnAnalysisManager.InitAllPairs(fOutList); - - PostData(2, fOutList); - - AliDebug(AliLog::kDebug+2,"->"); -} - -void AliRsnAnalysisME::RsnUserExec(Option_t*) -{ -// -// Rsn User Exec -// - - fTaskInfo.SetEventUsed(kFALSE); - - AliDebug(AliLog::kDebug+2, "<-"); - if (!CheckAndPrintEvents()) return; - - DoMixing(GetEvent(0)); - - - // if cuts are passed or not cuts were defined, - // update the task info... - fTaskInfo.SetEventUsed(kTRUE); - - PostData(2, fOutList); - - AliDebug(AliLog::kDebug+2,"->"); -} - - -//_____________________________________________________________________________ -void AliRsnAnalysisME::DoMixing(AliVEvent* ev) -{ -// -// Do Mixing -// - - Int_t nEvents = fInputHandler->GetBufferSize(); - fESDEvent = dynamic_cast(ev); - fAODEvent = dynamic_cast(ev); - - if (fESDEvent) { - AliESDEvent **esdEvent = new AliESDEvent*[nEvents]; - for (Int_t i = 0; i < nEvents; i++) { - esdEvent[i] = dynamic_cast(GetEvent(i)); - if (!esdEvent[i]) { - AliWarning(Form("Null ESD event in index %d", i)); - continue; - } - if (i > 0) - DoESDMixing(esdEvent[0], esdEvent[i]); - } - } else if (fAODEvent) { - AliAODEvent **aodEvent = new AliAODEvent*[nEvents]; - for (Int_t i = 0; i < nEvents; i++) { - aodEvent[i] = dynamic_cast(GetEvent(i)); - if (!aodEvent[i]) { - AliWarning(Form("Null AOD event in index %d", i)); - continue; - } - if (i > 0) - DoAODMixing(aodEvent[0], aodEvent[i]); - } - } - -} - - -//_____________________________________________________________________________ -void AliRsnAnalysisME::DoAODMixing(AliAODEvent* aod1, AliAODEvent* aod2) -{ -// -// mixing of two aod events -// - - // assign events - fEvent.SetRef(aod1); - fEventMix.SetRef(aod2); - if (fEvent.GetMultiplicity() < 2) return; - if (fEventMix.GetMultiplicity() < 2) return; - - AliRsnEvent::SetCurrentEvent1(&fEvent); - AliRsnEvent::SetCurrentEvent2(&fEventMix); - - fRsnAnalysisManager.ProcessAllPairs(); - PostData(2, fOutList); - - AliDebug(AliLog::kDebug, Form("AOD tracks %d", aod1->GetNumberOfTracks())); - AliDebug(AliLog::kDebug, Form("AOD tracks %d", aod2->GetNumberOfTracks())); - -} - - -//_____________________________________________________________________________ -void AliRsnAnalysisME::DoESDMixing(AliESDEvent* esd1, AliESDEvent* esd2) -{ -// -// mixing of two esd events -// - - AliWarning(Form("ESD mixing not supported yet !!! (%p,%p)", esd1, esd2)); - return; -} - - - -//_____________________________________________________________________________ -void AliRsnAnalysisME::RsnTerminate(Option_t*) -{ -// -// Rsn Terminate -// - - AliDebug(AliLog::kDebug+2, "<-"); - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisME::SetPriorProbability(AliPID::EParticleType type, Double_t p) -{ -// -// Sets the prior probability for Realistic PID, for a -// given particle species. -// - - if (type >= 0 && type < (Int_t)AliPID::kSPECIES) { - fPrior[type] = p; - } - -} - -//_____________________________________________________________________________ -void AliRsnAnalysisME::DumpPriors() -{ - // - // Print all prior probabilities - // - - Int_t i; - for (i = 0; i < AliPID::kSPECIES; i++) { - AliInfo(Form("Prior probability for %10s = %3.5f", AliPID::ParticleName((AliPID::EParticleType)i), fPrior[i])); - } -} - -//_____________________________________________________________________________ -void AliRsnAnalysisME::GetPriorProbability(Double_t *out) const -{ -// -// Gets all prior probabilities to out -// - - Int_t i; - for (i = 0;i < AliPID::kSPECIES;i++) { - out[i] = fPrior[i]; - } -} - - diff --git a/PWG2/RESONANCES/AliRsnAnalysisME.h b/PWG2/RESONANCES/AliRsnAnalysisME.h deleted file mode 100644 index 70072b720ce..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisME.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// Class AliRsnAnalysisME -// -// Virtual Class derivated from AliRsnVAnalysisTaskME which will be base class -// for all RSN SE tasks -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// - -#ifndef ALIRSNANALYSISME_H -#define ALIRSNANALYSISME_H - -#include "AliPID.h" -#include "AliRsnVAnalysisTaskME.h" -#include "AliRsnAnalysisManager.h" -#include "AliRsnEvent.h" - -class AliPID; -class AliESDtrackCuts; -class AliRsnAnalysisME : public AliRsnVAnalysisTaskME -{ - - public: - AliRsnAnalysisME(const char *name = "AliRsnAnalysisME"); - AliRsnAnalysisME(const AliRsnAnalysisME& copy); - virtual ~AliRsnAnalysisME() { ; }; - - // Implement this - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnTerminate(Option_t*); - - AliRsnAnalysisManager *GetAnalysisManager() {return &fRsnAnalysisManager;} - void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name); }; - - // Prior probs - void SetPriorProbability(AliPID::EParticleType type, Double_t p); - void DumpPriors(); - void GetPriorProbability(Double_t *out)const; - - private: - - AliRsnAnalysisME& operator=(const AliRsnAnalysisME& /*copy*/) { return *this; } - - AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine - AliRsnEvent fEvent; // utility --> event interface - AliRsnEvent fEventMix; // utility --> event interface (mixed event) - TList *fOutList; // outputs - - Double_t fPrior[AliPID::kSPECIES]; // prior probabilities - - void DoMixing(AliVEvent *ev); - void DoAODMixing(AliAODEvent* aod1, AliAODEvent* aod2); - void DoESDMixing(AliESDEvent* esd1, AliESDEvent* esd2); - - ClassDef(AliRsnAnalysisME, 1) -}; - -#endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisManager.cxx b/PWG2/RESONANCES/AliRsnAnalysisManager.cxx index 8f923e67201..b709022f497 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisManager.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisManager.cxx @@ -33,10 +33,10 @@ ClassImp(AliRsnAnalysisManager) //_____________________________________________________________________________ AliRsnAnalysisManager::AliRsnAnalysisManager(const char*name) : - TNamed(name, ""), - fList(0x0), - fPairs(0), - fGlobalTrackCuts() + TNamed(name, ""), + fList(0x0), + fPairs(0), + fGlobalTrackCuts() { // // Default constructor @@ -44,11 +44,11 @@ AliRsnAnalysisManager::AliRsnAnalysisManager(const char*name) : } //_____________________________________________________________________________ -AliRsnAnalysisManager::AliRsnAnalysisManager(const AliRsnAnalysisManager& copy) : - TNamed(copy), - fList(copy.fList), - fPairs(copy.fPairs), - fGlobalTrackCuts(copy.fGlobalTrackCuts) +AliRsnAnalysisManager::AliRsnAnalysisManager(const AliRsnAnalysisManager& copy) : + TNamed(copy), + fList(copy.fList), + fPairs(copy.fPairs), + fGlobalTrackCuts(copy.fGlobalTrackCuts) { // // Copy constructor @@ -61,14 +61,14 @@ AliRsnAnalysisManager& AliRsnAnalysisManager::operator=(const AliRsnAnalysisMana // // Assignment operator // - - TNamed::operator=(copy); - - fList = copy.fList; - fPairs = copy.fPairs; - fGlobalTrackCuts = copy.fGlobalTrackCuts; - - return (*this); + + TNamed::operator=(copy); + + fList = copy.fList; + fPairs = copy.fPairs; + fGlobalTrackCuts = copy.fGlobalTrackCuts; + + return (*this); } //_____________________________________________________________________________ @@ -78,18 +78,17 @@ void AliRsnAnalysisManager::Add(AliRsnPair *pair) // Adds a new pair manager to the list. // - AliDebug(AliLog::kDebug+2,"<-"); + AliDebug(AliLog::kDebug + 2, "<-"); - if (!pair) - { - AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair)); - return; - } + if (!pair) { + AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair)); + return; + } - AliDebug(AliLog::kDebug+1, Form("Adding %s [%d]...", pair->GetName(), fPairs.GetEntries())); - fPairs.Add(pair); + AliDebug(AliLog::kDebug + 1, Form("Adding %s [%d]...", pair->GetName(), fPairs.GetEntries())); + fPairs.Add(pair); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -99,8 +98,8 @@ void AliRsnAnalysisManager::Print(Option_t* /*dummy*/) const // Overload of the TObject::Print() method // - AliInfo(Form("\t======== Analysis Manager %s ========", GetName())); - PrintArray(); + AliInfo(Form("\t======== Analysis Manager %s ========", GetName())); + PrintArray(); } //_____________________________________________________________________________ @@ -110,13 +109,13 @@ void AliRsnAnalysisManager::PrintArray() const // Calls the "Print" method of all included pair managers // - AliDebug(AliLog::kDebug+2,"<-"); + AliDebug(AliLog::kDebug + 2, "<-"); - AliRsnPair *pair = 0; - TObjArrayIter next(&fPairs); - while ((pair = (AliRsnPair*)next())) pair->Print(); + AliRsnPair *pair = 0; + TObjArrayIter next(&fPairs); + while ((pair = (AliRsnPair*)next())) pair->Print(); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -127,25 +126,24 @@ void AliRsnAnalysisManager::InitAllPairs(TList *list) // generated by each one into a unique final output TList // - AliDebug(AliLog::kDebug+2,"<-"); + AliDebug(AliLog::kDebug + 2, "<-"); - AliRsnPair *pair = 0; - TObjArrayIter next(&fPairs); - Int_t i = 0; - while ((pair = (AliRsnPair*)next())) - { - AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetName(), i++)); + AliRsnPair *pair = 0; + TObjArrayIter next(&fPairs); + Int_t i = 0; + while ((pair = (AliRsnPair*)next())) { + AliDebug(AliLog::kDebug + 1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetName(), i++)); // pair->Init("", list); - pair->Init(GetName(), list); - - // add a counter for used/unused events for each pair - TH1I *hPairUsed = new TH1I(Form("%s_%s_USED", GetName(),pair->GetName()), "Used events for pair", 2, 0, 2); - list->Add(hPairUsed); - } - - fList = list; - - AliDebug(AliLog::kDebug+2, "->"); + pair->Init(GetName(), list); + + // add a counter for used/unused events for each pair + TH1I *hPairUsed = new TH1I(Form("%s_%s_USED", GetName(), pair->GetName()), "Used events for pair", 2, 0, 2); + list->Add(hPairUsed); + } + + fList = list; + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -155,101 +153,93 @@ void AliRsnAnalysisManager::ProcessAllPairs() // Process one or two events for all pair managers. // - static Int_t evnum = 0; - evnum++; - - AliDebug(AliLog::kDebug+2,"<-"); - - // skip if the global event pointers are NULL - if (!AliRsnEvent::IsCurrentEvent1()) return; - if (!AliRsnEvent::IsCurrentEvent2()) return; - - // for better readability, reference two pointers to the current events - AliRsnEvent *ev0 = AliRsnEvent::GetCurrentEvent1(); - AliRsnEvent *ev1 = AliRsnEvent::GetCurrentEvent2(); - - // count total number of candidates per event - // (sum of tracks, V0s and cascades) - Int_t nTot[2]; - nTot[0] = AliRsnEvent::GetCurrentEvent1()->GetAbsoluteSum(); - nTot[1] = AliRsnEvent::GetCurrentEvent2()->GetAbsoluteSum(); - - // variables - Int_t i0, i1, i, start, index0, index1; - AliRsnDaughter daughter0, daughter1; - AliRsnPair *pair = 0x0; - TObjArrayIter next(&fPairs); - AliRsnDaughter::ERefType type0, type1; - - // reset all counters which tell us - // how many entries were added now - while ((pair = (AliRsnPair*)next())) - { - pair->ResetCount(); - } - - // external loop - for (i0 = 0; i0 < nTot[0]; i0++) - { - // assign first track - if (!ev0->ConvertAbsoluteIndex(i0, index0, type0)) continue; - ev0->SetDaughter(daughter0, index0, type0); - - // check global cuts - if (!fGlobalTrackCuts.IsSelected(&daughter0)) continue; - - // define start depending if we are processing one or two events - start = (AliRsnEvent::SameEvent() ? i0 + 1 : 0); - - // internal loop (same criterion) - for (i1 = start; i1 < nTot[1]; i1++) - { - // if looking same event, skip the case when the two indexes are equal - // if (AliRsnEvent::SameEvent() && i0 == i1) continue; - - // assign second track - if (!ev1->ConvertAbsoluteIndex(i1, index1, type1)) continue; - ev1->SetDaughter(daughter1, index1, type1); - + static Int_t evnum = 0; + evnum++; + + AliDebug(AliLog::kDebug + 2, "<-"); + + // skip if the global event pointers are NULL + if (!AliRsnEvent::IsCurrentEvent1()) return; + if (!AliRsnEvent::IsCurrentEvent2()) return; + + // for better readability, reference two pointers to the current events + AliRsnEvent *ev0 = AliRsnEvent::GetCurrentEvent1(); + AliRsnEvent *ev1 = AliRsnEvent::GetCurrentEvent2(); + + // count total number of candidates per event + // (sum of tracks, V0s and cascades) + Int_t nTot[2]; + nTot[0] = AliRsnEvent::GetCurrentEvent1()->GetAbsoluteSum(); + nTot[1] = AliRsnEvent::GetCurrentEvent2()->GetAbsoluteSum(); + + // variables + Int_t i0, i1, i, start, index0, index1; + AliRsnDaughter daughter0, daughter1; + AliRsnPair *pair = 0x0; + TObjArrayIter next(&fPairs); + AliRsnDaughter::ERefType type0, type1; + + // reset all counters which tell us + // how many entries were added now + while ((pair = (AliRsnPair*)next())) { + pair->ResetCount(); + } + + // external loop + for (i0 = 0; i0 < nTot[0]; i0++) { + // assign first track + if (!ev0->ConvertAbsoluteIndex(i0, index0, type0)) continue; + ev0->SetDaughter(daughter0, index0, type0); + // check global cuts - if (!fGlobalTrackCuts.IsSelected(&daughter1)) continue; - - // loop over all pairs and make computations - next.Reset(); - i = 0; - while ((pair = (AliRsnPair*)next())) - { - AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++)); - - // if the pair is a like-sign, skip the case when i1 < i0, - // in order not to double count each like-sign pair - // (equivalent to looping from i0+1 to ntracks) - // if (AliRsnEvent::SameEvent() && pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; - - // process the two tracks - if (pair->Fill(&daughter0, &daughter1)) - { - pair->Compute(); - } - else if (pair->Fill(&daughter1, &daughter0)) - { - pair->Compute(); - } + if (!fGlobalTrackCuts.IsSelected(&daughter0)) continue; + + // define start depending if we are processing one or two events + start = (AliRsnEvent::SameEvent() ? i0 + 1 : 0); + + // internal loop (same criterion) + for (i1 = start; i1 < nTot[1]; i1++) { + // if looking same event, skip the case when the two indexes are equal + // if (AliRsnEvent::SameEvent() && i0 == i1) continue; + + // assign second track + if (!ev1->ConvertAbsoluteIndex(i1, index1, type1)) continue; + ev1->SetDaughter(daughter1, index1, type1); + + // check global cuts + if (!fGlobalTrackCuts.IsSelected(&daughter1)) continue; + + // loop over all pairs and make computations + next.Reset(); + i = 0; + while ((pair = (AliRsnPair*)next())) { + AliDebug(AliLog::kDebug + 1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++)); + + // if the pair is a like-sign, skip the case when i1 < i0, + // in order not to double count each like-sign pair + // (equivalent to looping from i0+1 to ntracks) + // if (AliRsnEvent::SameEvent() && pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; + + // process the two tracks + if (pair->Fill(&daughter0, &daughter1)) { + pair->Compute(); + } else if (pair->Fill(&daughter1, &daughter0)) { + pair->Compute(); + } + } } - } - } - - // update all count histograms counters - next.Reset(); - if (!fList) return; - while ((pair = (AliRsnPair*)next())) - { - TH1I *hist = (TH1I*)fList->FindObject(Form("_%s_USED", pair->GetName())); - if (!hist) continue; - if (pair->GetCount() > 0) hist->Fill(1); else hist->Fill(0); - } - - AliDebug(AliLog::kDebug+2,"->"); + } + + // update all count histograms counters + next.Reset(); + if (!fList) return; + while ((pair = (AliRsnPair*)next())) { + TH1I *hist = (TH1I*)fList->FindObject(Form("_%s_USED", pair->GetName())); + if (!hist) continue; + if (pair->GetCount() > 0) hist->Fill(1); else hist->Fill(0); + } + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -259,89 +249,84 @@ void AliRsnAnalysisManager::ProcessAllPairsMC() // Process one or two events for all pair managers. // - AliDebug(AliLog::kDebug+2,"<-"); - - // skip if the global event pointers are NULL - if (!AliRsnEvent::IsCurrentEvent1()) return; - if (!AliRsnEvent::IsCurrentEvent2()) return; - - // for better readability, reference two pointers to the current events - AliRsnEvent *ev0 = AliRsnEvent::GetCurrentEvent1(); - AliRsnEvent *ev1 = AliRsnEvent::GetCurrentEvent2(); - - // this time the number of tracks comes from MC - Int_t nTracks[2]; - nTracks[0] = ev0->GetRefMC()->GetNumberOfTracks(); - nTracks[1] = ev1->GetRefMC()->GetNumberOfTracks(); - - // external loop - // joins the loop on tracks and v0s, by looping the indexes from 0 - // to the sum of them, and checking what to take depending of its value - Int_t i0, i1, start, i; - Bool_t filled; - AliRsnDaughter daughter0, daughter1; - AliRsnPair *pair = 0x0; - TObjArrayIter next(&fPairs); - - // reset all counters - while ((pair = (AliRsnPair*)next())) - { - pair->ResetCount(); - } - - for (i0 = 0; i0 < nTracks[0]; i0++) - { - // skip not physical primaries - if (!ev0->GetRefMCESD()->Stack()->IsPhysicalPrimary(i0)) continue; - - // assign first track - ev0->SetDaughterMC(daughter0, i0); - - // define start depending if we are processing one or two events - start = (AliRsnEvent::SameEvent() ? i0 + 1 : 0); - - // internal loop (same criterion) - for (i1 = start; i1 < nTracks[1]; i1++) - { - // if looking same event, skip the case when the two indexes are equal - if (AliRsnEvent::SameEvent() && i0 == i1) continue; - + AliDebug(AliLog::kDebug + 2, "<-"); + + // skip if the global event pointers are NULL + if (!AliRsnEvent::IsCurrentEvent1()) return; + if (!AliRsnEvent::IsCurrentEvent2()) return; + + // for better readability, reference two pointers to the current events + AliRsnEvent *ev0 = AliRsnEvent::GetCurrentEvent1(); + AliRsnEvent *ev1 = AliRsnEvent::GetCurrentEvent2(); + + // this time the number of tracks comes from MC + Int_t nTracks[2]; + nTracks[0] = ev0->GetRefMC()->GetNumberOfTracks(); + nTracks[1] = ev1->GetRefMC()->GetNumberOfTracks(); + + // external loop + // joins the loop on tracks and v0s, by looping the indexes from 0 + // to the sum of them, and checking what to take depending of its value + Int_t i0, i1, start, i; + Bool_t filled; + AliRsnDaughter daughter0, daughter1; + AliRsnPair *pair = 0x0; + TObjArrayIter next(&fPairs); + + // reset all counters + while ((pair = (AliRsnPair*)next())) { + pair->ResetCount(); + } + + for (i0 = 0; i0 < nTracks[0]; i0++) { // skip not physical primaries - if (!ev1->GetRefMCESD()->Stack()->IsPhysicalPrimary(i1)) continue; - - // assign second track - ev1->SetDaughterMC(daughter1, i1); - - // loop over all pairs and make computations - next.Reset(); - i = 0; - while ((pair = (AliRsnPair*)next())) - { - AliDebug(AliLog::kDebug+1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++)); - - // if the pair is a like-sign, skip the case when i1 < i0, - // in order not to double count each like-sign pair - // (equivalent to looping from i0+1 to ntracks) - if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; - - // process the two tracks - filled = pair->Fill(&daughter0, &daughter1); - if (!filled) continue; - pair->Compute(); + if (!ev0->GetRefMCESD()->Stack()->IsPhysicalPrimary(i0)) continue; + + // assign first track + ev0->SetDaughterMC(daughter0, i0); + + // define start depending if we are processing one or two events + start = (AliRsnEvent::SameEvent() ? i0 + 1 : 0); + + // internal loop (same criterion) + for (i1 = start; i1 < nTracks[1]; i1++) { + // if looking same event, skip the case when the two indexes are equal + if (AliRsnEvent::SameEvent() && i0 == i1) continue; + + // skip not physical primaries + if (!ev1->GetRefMCESD()->Stack()->IsPhysicalPrimary(i1)) continue; + + // assign second track + ev1->SetDaughterMC(daughter1, i1); + + // loop over all pairs and make computations + next.Reset(); + i = 0; + while ((pair = (AliRsnPair*)next())) { + AliDebug(AliLog::kDebug + 1, Form("ProcessAllPairs of the AnalysisManager(%s) [%d] ...", pair->GetName(), i++)); + + // if the pair is a like-sign, skip the case when i1 < i0, + // in order not to double count each like-sign pair + // (equivalent to looping from i0+1 to ntracks) + if (pair->GetPairDef()->IsLikeSign() && i1 < i0) continue; + + // process the two tracks + filled = pair->Fill(&daughter0, &daughter1); + if (!filled) continue; + pair->Compute(); + } } - } - } - - // update all count histograms counters - next.Reset(); - if (!fList) return; - while ((pair = (AliRsnPair*)next())) - { - TH1I *hist = (TH1I*)fList->FindObject(Form("_%s_USED", pair->GetName())); - if (!hist) continue; - if (pair->GetCount() > 0) hist->Fill(1); else hist->Fill(0); - } - - AliDebug(AliLog::kDebug+2,"->"); + } + + // update all count histograms counters + next.Reset(); + if (!fList) return; + while ((pair = (AliRsnPair*)next())) { + TH1I *hist = (TH1I*)fList->FindObject(Form("_%s_USED", pair->GetName())); + if (!hist) continue; + if (pair->GetCount() > 0) hist->Fill(1); else hist->Fill(0); + } + + AliDebug(AliLog::kDebug + 2, "->"); } diff --git a/PWG2/RESONANCES/AliRsnAnalysisManager.h b/PWG2/RESONANCES/AliRsnAnalysisManager.h index 98f08d9cd76..c12123c8cf8 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisManager.h +++ b/PWG2/RESONANCES/AliRsnAnalysisManager.h @@ -26,31 +26,30 @@ class AliRsnEvent; class AliRsnPair; -class AliRsnAnalysisManager : public TNamed -{ - public: - - AliRsnAnalysisManager(const char*name = "RSN"); - AliRsnAnalysisManager(const AliRsnAnalysisManager& copy); - AliRsnAnalysisManager& operator=(const AliRsnAnalysisManager& copy); - virtual ~AliRsnAnalysisManager() { } - - virtual void Add(AliRsnPair *pair); - virtual void PrintArray() const; - virtual void Print(Option_t *option = "") const; - - void InitAllPairs(TList*list); - void ProcessAllPairs(); - void ProcessAllPairsMC(); - AliRsnCutSet* GetGlobalTrackCuts() {return &fGlobalTrackCuts;} - - private: - - TList *fList; // container for output histograms (external object) - TObjArray fPairs; // collection of pair objects for the different outputs - AliRsnCutSet fGlobalTrackCuts; // a set of cuts which are applied to all tracks for all analysis - - ClassDef(AliRsnAnalysisManager, 1) +class AliRsnAnalysisManager : public TNamed { +public: + + AliRsnAnalysisManager(const char*name = "RSN"); + AliRsnAnalysisManager(const AliRsnAnalysisManager& copy); + AliRsnAnalysisManager& operator=(const AliRsnAnalysisManager& copy); + virtual ~AliRsnAnalysisManager() { } + + virtual void Add(AliRsnPair *pair); + virtual void PrintArray() const; + virtual void Print(Option_t *option = "") const; + + void InitAllPairs(TList*list); + void ProcessAllPairs(); + void ProcessAllPairsMC(); + AliRsnCutSet* GetGlobalTrackCuts() {return &fGlobalTrackCuts;} + +private: + + TList *fList; // container for output histograms (external object) + TObjArray fPairs; // collection of pair objects for the different outputs + AliRsnCutSet fGlobalTrackCuts; // a set of cuts which are applied to all tracks for all analysis + + ClassDef(AliRsnAnalysisManager, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.cxx b/PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.cxx deleted file mode 100644 index e62ba0fb327..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.cxx +++ /dev/null @@ -1,408 +0,0 @@ -// -// Implementation file for implementation of data analysis aft 900 GeV -// -// Author: A. Pulvirenti -// - -#include "Riostream.h" -#include - -#include "TH1.h" -#include "TTree.h" -#include "TParticle.h" -#include "TRandom.h" -#include "TLorentzVector.h" - -#include "AliLog.h" -#include "AliESDpid.h" -#include "AliESDEvent.h" -#include "AliESDVertex.h" -#include "AliESDtrack.h" -#include "AliStack.h" -#include "AliMCEvent.h" -#include "AliTOFT0maker.h" -#include "AliTOFcalib.h" -#include "AliCDBManager.h" -#include "AliITSPIDResponse.h" -#include "AliRsnMonitorTrack.h" -#include "AliRsnDaughter.h" -#include "AliRsnEvent.h" - -#include "AliRsnAnalysisMonitorPairTask.h" - -ClassImp(AliRsnAnalysisMonitorPairTask) - -//__________________________________________________________________________________________________ -AliRsnAnalysisMonitorPairTask::AliRsnAnalysisMonitorPairTask(const char *name) : - AliAnalysisTaskSE(name), - fOut(0x0), - fInvMass(0.0), - fRangeMin(0.0), - fRangeMax(100.0), - fESDpid(0x0), - fTOFmaker(0x0), - fTOFcalib(0x0), - fTOFcalibrateESD(kFALSE), - fTOFcorrectTExp(kFALSE), - fTOFuseT0(kFALSE), - fTOFtuneMC(kFALSE), - fTOFresolution(0.0), - fEventCuts("eventCuts", AliRsnCut::kEvent), - fTrackCuts("trackCuts", AliRsnCut::kDaughter) - -{ -// -// Constructor -// - - DefineOutput(1, TTree::Class()); -} - -//__________________________________________________________________________________________________ -AliRsnAnalysisMonitorPairTask::AliRsnAnalysisMonitorPairTask(const AliRsnAnalysisMonitorPairTask& copy) : - AliAnalysisTaskSE(copy), - fOut(0x0), - fInvMass(0.0), - fRangeMin(copy.fRangeMin), - fRangeMax(copy.fRangeMax), - fESDpid(0x0), - fTOFmaker(0x0), - fTOFcalib(0x0), - fTOFcalibrateESD(kFALSE), - fTOFcorrectTExp(kFALSE), - fTOFuseT0(kFALSE), - fTOFtuneMC(kFALSE), - fTOFresolution(0.0), - fEventCuts(copy.fEventCuts), - fTrackCuts(copy.fTrackCuts) -{ -// -// Copy constructor -// -} - -//__________________________________________________________________________________________________ -AliRsnAnalysisMonitorPairTask& AliRsnAnalysisMonitorPairTask::operator=(const AliRsnAnalysisMonitorPairTask& copy) -{ -// -// Assignment operator -// - - fMass[0] = copy.fMass[0]; - fMass[1] = copy.fMass[1]; - - fRangeMin = copy.fRangeMin; - fRangeMax = copy.fRangeMax; - - fTOFcalibrateESD = copy.fTOFcalibrateESD; - fTOFcorrectTExp = copy.fTOFcorrectTExp; - fTOFuseT0 = copy.fTOFuseT0; - fTOFtuneMC = copy.fTOFtuneMC; - fTOFresolution = copy.fTOFresolution; - - return (*this); -} - -//__________________________________________________________________________________________________ -AliRsnAnalysisMonitorPairTask::~AliRsnAnalysisMonitorPairTask() -{ -// -// Destructor -// - - if (fOut) delete fOut; - if (fESDpid) delete fESDpid; - if (fTrack) delete fTrack; -} - -//__________________________________________________________________________________________________ -void AliRsnAnalysisMonitorPairTask::UserCreateOutputObjects() -{ -// -// Create the output data container -// - - // setup TPC response - fESDpid = new AliESDpid; - fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0], fTPCpar[1], fTPCpar[2], fTPCpar[3], fTPCpar[4]); - - // setup TOF maker & calibration - fTOFcalib = new AliTOFcalib; - fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib); - fTOFmaker->SetTimeResolution(fTOFresolution); - - // create output branch object - fTrack[0] = new AliRsnMonitorTrack; - fTrack[1] = new AliRsnMonitorTrack; - - // create output tree - OpenFile(1); - fOut = new TTree("rsnPairMonitor", "Informations on pairs for cut checking"); - fOut->Branch("track1", "AliRsnMonitorTrack", &fTrack[0]); - fOut->Branch("track2", "AliRsnMonitorTrack", &fTrack[1]); - fOut->Branch("minv" , &fInvMass, "minv/F"); -} - -//__________________________________________________________________________________________________ -void AliRsnAnalysisMonitorPairTask::UserExec(Option_t *) -{ -// -// Main execution function. -// Fills the fHEvents data member with the following legenda: -// 0 -- event OK, prim vertex with tracks -// 1 -- event OK, prim vertex with SPD -// 2 -- event OK but vz large -// 3 -- event bad -// - - // retrieve ESD event and related stack (if available) - AliESDEvent *esd = dynamic_cast(fInputEvent); - AliStack *stack = 0x0; - - // skip NULL events - if (!esd) return; - if (fMCEvent) stack = fMCEvent->Stack(); - - // create interface objects to AliRsnEvent to check event cuts - AliRsnEvent event; - event.SetRef(esd); - event.SetRefMC(fMCEvent); - if (!fEventCuts.IsSelected(&event)) return; - - // check the event - Int_t type = EventEval(esd); - - // if processable, then process it - if (type == 0) ProcessESD(esd, esd->GetPrimaryVertexTracks()); - else if (type == 1) ProcessESD(esd, esd->GetPrimaryVertexSPD()); - else return; - - // update histogram container - PostData(1, fOut); -} - -//__________________________________________________________________________________________________ -void AliRsnAnalysisMonitorPairTask::Terminate(Option_t *) -{ -// -// Terminate -// -} - -//__________________________________________________________________________________________________ -Int_t AliRsnAnalysisMonitorPairTask::EventEval(AliESDEvent *esd) -{ -// -// Checks if the event is good for analysis. -// Returns: -// ---> 0 if a good primary vertex with tracks was found, -// ---> 1 if a good SPD primary vertex was found -// ---> 2 otherwise (event to be rejected) -// In any case, adds an entry to the TTree, to keep trace of all events. -// - - // get the best primary vertex: - // first try that with tracks, then the SPD one - const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks(); - const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD(); - if(vTrk->GetNContributors() > 0) - { - return 0; - } - else if (vSPD->GetNContributors() > 0) - { - return 1; - } - else - { - return 2; - } -} - -//__________________________________________________________________________________________________ -void AliRsnAnalysisMonitorPairTask::ProcessESD(AliESDEvent *esd, const AliESDVertex *v) -{ -// -// Process the ESD container, to read all tracks and copy their useful values. -// All info are stored into an AliRsnMonitorTrack object and saved into the -// TClonesArray which is one of the branches of the output TTree. -// - - // TOF stuff #1: init OCDB - Int_t run = esd->GetRunNumber(); - AliCDBManager *cdb = AliCDBManager::Instance(); - cdb->SetDefaultStorage("raw://"); - cdb->SetRun(run); - // TOF stuff #2: init calibration - fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); - fTOFcalib->Init(); - // TOF stuff #3: calibrate - if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(esd); - if (fTOFtuneMC) fTOFmaker->TuneForMC(esd); - if (fTOFuseT0) - { - fTOFmaker->ComputeT0TOF(esd); - fTOFmaker->ApplyT0TOF(esd); - fESDpid->MakePID(esd, kFALSE, 0.); - } - - // loop on all tracks - Int_t i0 , i1, ch0, ch1, ntracks = esd->GetNumberOfTracks(); - TLorentzVector v0, v1, sum; - - // two nested loops on tracks - for (i0 = 0; i0 < ntracks; i0++) - { - if (!ProcessTrack(0, i0, esd, v)) continue; - ch0 = fTrack[0]->Charge(); - v0.SetXYZM(fTrack[0]->PrecX(), fTrack[0]->PrecY(), fTrack[0]->PrecZ(), fMass[0]); - - for (i1 = i0 + 1; i1 < ntracks; i1++) - { - if (!ProcessTrack(1, i1, esd, v)) continue; - ch1 = fTrack[1]->Charge(); - - // skip like-sign pairs - if (ch1 == ch0) continue; - - // check invmass range - v1.SetXYZM(fTrack[1]->PrecX(), fTrack[1]->PrecY(), fTrack[1]->PrecZ(), fMass[1]); - sum = v0 + v1; - fInvMass = sum.M(); - if (fInvMass < fRangeMin || fInvMass > fRangeMax) continue; - - // if here, add an entry to the tree - fOut->Fill(); - } - } -} - -//__________________________________________________________________________________________________ -Bool_t AliRsnAnalysisMonitorPairTask::ProcessTrack(Int_t myIndex, Int_t esdIndex, AliESDEvent *esd, const AliESDVertex *v) -{ -// -// Process a single track, and stores all its info into one of the two branch objects -// defined by the first index, while the second chooses the track in the owner ESD -// - - if (myIndex < 0 || myIndex > 1) return kFALSE; - - // ITS stuff #1 - // create the response function and initialize it to MC or not - // depending if the AliStack object is there or not - AliStack *stack = 0x0; - if (fMCEvent) stack = fMCEvent->Stack(); - Bool_t isMC = (stack != 0x0); - AliITSPIDResponse itsrsp(isMC); - - // create interfacr objects - AliRsnEvent event; - event.SetRef(esd); - event.SetRefMC(fMCEvent); - AliRsnDaughter daughter; - AliESDtrack *track = esd->GetTrack(esdIndex); - event.SetDaughter(daughter, esdIndex, AliRsnDaughter::kTrack); - - // skip NULL pointers, kink daughters and tracks which - // cannot be propagated to primary vertex - if (!track) return kFALSE; - if ((Int_t)track->GetKinkIndex(0) > 0) return kFALSE; - if (!track->RelateToVertex(v, esd->GetMagneticField(), kVeryBig)) return kFALSE; - - // useful variables - Int_t k, nITS; - Bool_t isTPC, isITSSA, isTOF; - Float_t b[2], bCov[3]; - Double_t time[10]; - - // reset the output object - // 'usable' flag will need to be set to 'ok' - fTrack[myIndex]->Reset(); - - // check cuts - fTrack[myIndex]->CutsPassed() = fTrackCuts.IsSelected(&daughter); - - // get MC info if possible - if (stack) fTrack[myIndex]->AdoptMC(TMath::Abs(track->GetLabel()), stack); - - // copy general info - fTrack[myIndex]->Status() = (UInt_t)track->GetStatus(); - fTrack[myIndex]->Length() = (Double_t)track->GetIntegratedLength(); - fTrack[myIndex]->Charge() = (Int_t)track->Charge(); - fTrack[myIndex]->PrecX() = (Double_t)track->Px(); - fTrack[myIndex]->PrecY() = (Double_t)track->Py(); - fTrack[myIndex]->PrecZ() = (Double_t)track->Pz(); - - // evaluate some flags from the status to decide what to do next in some points - isTPC = ((fTrack[myIndex]->Status() & AliESDtrack::kTPCin) != 0); - isITSSA = ((fTrack[myIndex]->Status() & AliESDtrack::kTPCin) == 0 && (fTrack[myIndex]->Status() & AliESDtrack::kITSrefit) != 0 && (fTrack[myIndex]->Status() & AliESDtrack::kITSpureSA) == 0 && (fTrack[myIndex]->Status() & AliESDtrack::kITSpid) != 0); - isTOF = ((fTrack[myIndex]->Status() & AliESDtrack::kTOFout) != 0 && (fTrack[myIndex]->Status() & AliESDtrack::kTIME) != 0); - - // accept only tracks which are TPC+ITS or ITS standalone - if (isITSSA) - { - fTrack[myIndex]->ITSsa() = kTRUE; - fTrack[myIndex]->TOFok() = kFALSE; - } - else if (isTPC) - { - fTrack[myIndex]->ITSsa() = kFALSE; - fTrack[myIndex]->TOFok() = isTOF; - } - else - return kFALSE; - - // get DCA to primary vertex - track->GetImpactParameters(b, bCov); - fTrack[myIndex]->DCAr() = (Double_t)b[0]; - fTrack[myIndex]->DCAz() = (Double_t)b[1]; - - // get ITS info - for (k = 0; k < 6; k++) - { - fTrack[myIndex]->ITSmap(k) = track->HasPointOnITSLayer(k); - } - if (isITSSA) - { - fTrack[myIndex]->ITSchi2() = track->GetITSchi2(); - fTrack[myIndex]->ITSsignal() = track->GetITSsignal(); - nITS = fTrack[myIndex]->SSDcount() + fTrack[myIndex]->SDDcount(); - for (k = 0; k < AliPID::kSPECIES; k++) - { - fTrack[myIndex]->ITSnsigma(k) = itsrsp.GetNumberOfSigmas(fTrack[myIndex]->Prec(), fTrack[myIndex]->ITSsignal(), (AliPID::EParticleType)k, nITS, kTRUE); - } - } - - // get TPC info - if (isTPC) - { - fTrack[myIndex]->TPCcount() = (Int_t)track->GetTPCclusters(0); - fTrack[myIndex]->TPCchi2() = (Double_t)track->GetTPCchi2(); - fTrack[myIndex]->TPCsignal() = (Double_t)track->GetTPCsignal(); - fTrack[myIndex]->PtpcX() = fTrack[myIndex]->PtpcY() = fTrack[myIndex]->PtpcZ() = 1E10; - if (track->GetInnerParam()) - { - fTrack[myIndex]->PtpcX() = track->GetInnerParam()->Px(); - fTrack[myIndex]->PtpcY() = track->GetInnerParam()->Py(); - fTrack[myIndex]->PtpcZ() = track->GetInnerParam()->Pz(); - for (k = 0; k < AliPID::kSPECIES; k++) - { - fTrack[myIndex]->TPCnsigma(k) = fESDpid->NumberOfSigmasTPC(track, (AliPID::EParticleType)k); - } - } - } - - // get TOF info - if (isTOF) - { - track->GetIntegratedTimes(time); - fTrack[myIndex]->TOFsignal() = (Double_t)track->GetTOFsignal(); - for (k = 0; k < AliPID::kSPECIES; k++) - { - fTrack[myIndex]->TOFref(k) = time[k]; - fTrack[myIndex]->TOFsigma(k) = (Double_t)fTOFmaker->GetExpectedSigma(fTrack[myIndex]->Prec(), time[k], AliPID::ParticleMass(k)); - } - } - - return kTRUE; -} diff --git a/PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.h b/PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.h deleted file mode 100644 index 423b97b49cb..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisMonitorPairTask.h +++ /dev/null @@ -1,86 +0,0 @@ -// -// Header file for implementation of data analysis aft 900 GeV -// -// Author: A. Pulvirenti -// - -#ifndef ALIRSNANALYSISMONITORPAIRTASK_H -#define ALIRSNANALYSISMONITORPAIRTASK_H - -#include "AliAnalysisTaskSE.h" -#include "AliRsnCutSet.h" - -class TH1I; -class TH1F; -class TTree; - -class AliStack; -class AliESDEvent; -class AliESDVertex; -class AliESDpid; -class AliTOFT0maker; -class AliTOFcalib; - -class AliRsnAnalysisMonitorPairTask : public AliAnalysisTaskSE -{ - public: - - AliRsnAnalysisMonitorPairTask(const char *name = "Phi7TeV"); - AliRsnAnalysisMonitorPairTask(const AliRsnAnalysisMonitorPairTask& copy); - AliRsnAnalysisMonitorPairTask& operator=(const AliRsnAnalysisMonitorPairTask& copy); - virtual ~AliRsnAnalysisMonitorPairTask(); - - void SetMasses(Double_t m1, Double_t m2) {fMass[0] = m1; fMass[1] = m2;} - void SetInvMassRange(Double_t m1, Double_t m2) {fRangeMin = m1, fRangeMax = m2;} - - void SetTPCpar(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) - {fTPCpar[0]=p0;fTPCpar[1]=p1;fTPCpar[2]=p2;fTPCpar[3]=p3;fTPCpar[4]=p4;} - - void SetTOFcalibrateESD(Bool_t yn = kTRUE) {fTOFcalibrateESD = yn;} - void SetTOFcorrectTExp (Bool_t yn = kTRUE) {fTOFcorrectTExp = yn;} - void SetTOFuseT0 (Bool_t yn = kTRUE) {fTOFuseT0 = yn;} - void SetTOFtuneMC (Bool_t yn = kTRUE) {fTOFtuneMC = yn;} - void SetTOFresolution (Double_t v = 100.0) {fTOFresolution = v;} - - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t *option = ""); - virtual void Terminate(Option_t *option = ""); - - Int_t EventEval(AliESDEvent *esd); - Bool_t IsTPCtrack(AliESDtrack *track); - Bool_t IsITSSAtrack(AliESDtrack *track); - void ProcessESD(AliESDEvent *esd, const AliESDVertex *v); - Bool_t ProcessTrack(Int_t myIndex, Int_t esdIndex, AliESDEvent *esd, const AliESDVertex *v); - - AliRsnCutSet* GetEventCuts() {return &fEventCuts;} - AliRsnCutSet* GetTrackCuts() {return &fTrackCuts;} - - private: - - TTree *fOut; // output TTree - AliRsnMonitorTrack *fTrack[2]; // branch objects for output TTree - Double_t fMass[2]; // masses assigned to daughters - Float_t fInvMass; // pair inv mass (computed with above masses) - Double_t fRangeMin; // minimum accepted invmass - Double_t fRangeMax; // maximum accepted invmass - - Double_t fTPCpar[5]; // parameters for TPC bethe-Bloch - - AliESDpid *fESDpid; //! PID manager - - AliTOFT0maker *fTOFmaker; //! TOF time0 computator - AliTOFcalib *fTOFcalib; //! TOF calibration - Bool_t fTOFcalibrateESD; // TOF settings - Bool_t fTOFcorrectTExp; // TOF settings - Bool_t fTOFuseT0; // TOF settings - Bool_t fTOFtuneMC; // TOF settings - Double_t fTOFresolution; // TOF settings - - AliRsnCutSet fEventCuts; // event cuts - AliRsnCutSet fTrackCuts; // track cuts - - // ROOT dictionary - ClassDef(AliRsnAnalysisMonitorPairTask,1) -}; - -#endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.cxx b/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.cxx index 9a36ddf5010..ad5f843eee0 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.cxx @@ -34,43 +34,43 @@ ClassImp(AliRsnAnalysisMonitorTask) //__________________________________________________________________________________________________ AliRsnAnalysisMonitorTask::AliRsnAnalysisMonitorTask(const char *name) : - AliAnalysisTaskSE(name), - fOut(0x0), - fTrack(0x0), - fESDpid(0x0), - fTOFmaker(0x0), - fTOFcalib(0x0), - fTOFcalibrateESD(kFALSE), - fTOFcorrectTExp(kFALSE), - fTOFuseT0(kFALSE), - fTOFtuneMC(kFALSE), - fTOFresolution(0.0), - fEventCuts("eventCuts", AliRsnCut::kEvent), - fTrackCuts("trackCuts", AliRsnCut::kDaughter) - + AliAnalysisTaskSE(name), + fOut(0x0), + fTrack(0x0), + fESDpid(0x0), + fTOFmaker(0x0), + fTOFcalib(0x0), + fTOFcalibrateESD(kFALSE), + fTOFcorrectTExp(kFALSE), + fTOFuseT0(kFALSE), + fTOFtuneMC(kFALSE), + fTOFresolution(0.0), + fEventCuts("eventCuts", AliRsnCut::kEvent), + fTrackCuts("trackCuts", AliRsnCut::kDaughter) + { // // Constructor // - DefineOutput(1, TTree::Class()); + DefineOutput(1, TTree::Class()); } //__________________________________________________________________________________________________ AliRsnAnalysisMonitorTask::AliRsnAnalysisMonitorTask(const AliRsnAnalysisMonitorTask& copy) : - AliAnalysisTaskSE(copy), - fOut(0x0), - fTrack(0x0), - fESDpid(0x0), - fTOFmaker(0x0), - fTOFcalib(0x0), - fTOFcalibrateESD(kFALSE), - fTOFcorrectTExp(kFALSE), - fTOFuseT0(kFALSE), - fTOFtuneMC(kFALSE), - fTOFresolution(0.0), - fEventCuts(copy.fEventCuts), - fTrackCuts(copy.fTrackCuts) + AliAnalysisTaskSE(copy), + fOut(0x0), + fTrack(0x0), + fESDpid(0x0), + fTOFmaker(0x0), + fTOFcalib(0x0), + fTOFcalibrateESD(kFALSE), + fTOFcorrectTExp(kFALSE), + fTOFuseT0(kFALSE), + fTOFtuneMC(kFALSE), + fTOFresolution(0.0), + fEventCuts(copy.fEventCuts), + fTrackCuts(copy.fTrackCuts) { // // Copy constructor @@ -84,13 +84,13 @@ AliRsnAnalysisMonitorTask& AliRsnAnalysisMonitorTask::operator=(const AliRsnAnal // Assignment operator // - fTOFcalibrateESD = copy.fTOFcalibrateESD; - fTOFcorrectTExp = copy.fTOFcorrectTExp; - fTOFuseT0 = copy.fTOFuseT0; - fTOFtuneMC = copy.fTOFtuneMC; - fTOFresolution = copy.fTOFresolution; + fTOFcalibrateESD = copy.fTOFcalibrateESD; + fTOFcorrectTExp = copy.fTOFcorrectTExp; + fTOFuseT0 = copy.fTOFuseT0; + fTOFtuneMC = copy.fTOFtuneMC; + fTOFresolution = copy.fTOFresolution; - return (*this); + return (*this); } //__________________________________________________________________________________________________ @@ -100,9 +100,9 @@ AliRsnAnalysisMonitorTask::~AliRsnAnalysisMonitorTask() // Destructor // - if (fOut) delete fOut; - if (fESDpid) delete fESDpid; - if (fTrack) delete fTrack; + if (fOut) delete fOut; + if (fESDpid) delete fESDpid; + if (fTrack) delete fTrack; } //__________________________________________________________________________________________________ @@ -112,22 +112,22 @@ void AliRsnAnalysisMonitorTask::UserCreateOutputObjects() // Create the output data container // - // setup TPC response - fESDpid = new AliESDpid; - fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0], fTPCpar[1], fTPCpar[2], fTPCpar[3], fTPCpar[4]); - - // setup TOF maker & calibration - fTOFcalib = new AliTOFcalib; - fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib); - fTOFmaker->SetTimeResolution(fTOFresolution); - - // create output branch object - fTrack = new AliRsnMonitorTrack; - - // create output tree - OpenFile(1); - fOut = new TTree("rsnMonitor", "Informations on single tracks for cut checking"); - fOut->Branch("tracks", "AliRsnMonitorTrack", &fTrack); + // setup TPC response + fESDpid = new AliESDpid; + fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0], fTPCpar[1], fTPCpar[2], fTPCpar[3], fTPCpar[4]); + + // setup TOF maker & calibration + fTOFcalib = new AliTOFcalib; + fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib); + fTOFmaker->SetTimeResolution(fTOFresolution); + + // create output branch object + fTrack = new AliRsnMonitorTrack; + + // create output tree + OpenFile(1); + fOut = new TTree("rsnMonitor", "Informations on single tracks for cut checking"); + fOut->Branch("tracks", "AliRsnMonitorTrack", &fTrack); } //__________________________________________________________________________________________________ @@ -142,30 +142,30 @@ void AliRsnAnalysisMonitorTask::UserExec(Option_t *) // 3 -- event bad // - // retrieve ESD event and related stack (if available) - AliESDEvent *esd = dynamic_cast(fInputEvent); - AliStack *stack = 0x0; - - // skip NULL events - if (!esd) return; - if (fMCEvent) stack = fMCEvent->Stack(); - - // create interface objects to AliRsnEvent to check event cuts - AliRsnEvent event; - event.SetRef(esd); - event.SetRefMC(fMCEvent); - if (!fEventCuts.IsSelected(&event)) return; - - // check the event - Int_t type = EventEval(esd); - - // if processable, then process it - if (type == 0) ProcessESD(esd, esd->GetPrimaryVertexTracks(), stack); - else if (type == 1) ProcessESD(esd, esd->GetPrimaryVertexSPD() , stack); - else return; - - // update histogram container - PostData(1, fOut); + // retrieve ESD event and related stack (if available) + AliESDEvent *esd = dynamic_cast(fInputEvent); + AliStack *stack = 0x0; + + // skip NULL events + if (!esd) return; + if (fMCEvent) stack = fMCEvent->Stack(); + + // create interface objects to AliRsnEvent to check event cuts + AliRsnEvent event; + event.SetRef(esd); + event.SetRefMC(fMCEvent); + if (!fEventCuts.IsSelected(&event)) return; + + // check the event + Int_t type = EventEval(esd); + + // if processable, then process it + if (type == 0) ProcessESD(esd, esd->GetPrimaryVertexTracks(), stack); + else if (type == 1) ProcessESD(esd, esd->GetPrimaryVertexSPD() , stack); + else return; + + // update histogram container + PostData(1, fOut); } //__________________________________________________________________________________________________ @@ -188,22 +188,17 @@ Int_t AliRsnAnalysisMonitorTask::EventEval(AliESDEvent *esd) // In any case, adds an entry to the TTree, to keep trace of all events. // - // get the best primary vertex: - // first try that with tracks, then the SPD one - const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks(); - const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD(); - if(vTrk->GetNContributors() > 0) - { - return 0; - } - else if (vSPD->GetNContributors() > 0) - { - return 1; - } - else - { - return 2; - } + // get the best primary vertex: + // first try that with tracks, then the SPD one + const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks(); + const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD(); + if (vTrk->GetNContributors() > 0) { + return 0; + } else if (vSPD->GetNContributors() > 0) { + return 1; + } else { + return 2; + } } //__________________________________________________________________________________________________ @@ -216,143 +211,129 @@ void AliRsnAnalysisMonitorTask::ProcessESD // TClonesArray which is one of the branches of the output TTree. // - // create interfacr objects - AliRsnEvent event; - AliRsnDaughter daughter; - event.SetRef(esd); - event.SetRefMC(fMCEvent); - - // ITS stuff #1 - // create the response function and initialize it to MC or not - // depending if the AliStack object is there or not - Bool_t isMC = (stack != 0x0); - AliITSPIDResponse itsrsp(isMC); - - // TOF stuff #1: init OCDB - Int_t run = esd->GetRunNumber(); - AliCDBManager *cdb = AliCDBManager::Instance(); - cdb->SetDefaultStorage("raw://"); - cdb->SetRun(run); - // TOF stuff #2: init calibration - fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); - fTOFcalib->Init(); - // TOF stuff #3: calibrate - if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(esd); - if (fTOFtuneMC) fTOFmaker->TuneForMC(esd); - if (fTOFuseT0) - { - fTOFmaker->ComputeT0TOF(esd); - fTOFmaker->ApplyT0TOF(esd); - fESDpid->MakePID(esd, kFALSE, 0.); - } - - // loop on all tracks - Int_t i, k, nITS, ntracks = esd->GetNumberOfTracks();; - Bool_t isTPC, isITSSA, isTOF; - Float_t b[2], bCov[3]; - Double_t time[10]; - - for (i = 0; i < ntracks; i++) - { - AliESDtrack *track = esd->GetTrack(i); - event.SetDaughter(daughter, i, AliRsnDaughter::kTrack); - - // reset the output object - // 'usable' flag will need to be set to 'ok' - fTrack->Reset(); - - // check cuts - fTrack->CutsPassed() = fTrackCuts.IsSelected(&daughter); - - // skip NULL pointers, kink daughters and tracks which - // cannot be propagated to primary vertex - if (!track) continue; - if ((Int_t)track->GetKinkIndex(0) > 0) continue; - if (!track->RelateToVertex(v, esd->GetMagneticField(), kVeryBig)) continue; - - // get MC info if possible - if (stack) fTrack->AdoptMC(TMath::Abs(track->GetLabel()), stack); - - // copy general info - fTrack->Status() = (UInt_t)track->GetStatus(); - fTrack->Length() = (Double_t)track->GetIntegratedLength(); - fTrack->Charge() = (Int_t)track->Charge(); - fTrack->PrecX() = (Double_t)track->Px(); - fTrack->PrecY() = (Double_t)track->Py(); - fTrack->PrecZ() = (Double_t)track->Pz(); - - // evaluate some flags from the status to decide what to do next in some points - isTPC = ((fTrack->Status() & AliESDtrack::kTPCin) != 0); - isITSSA = ((fTrack->Status() & AliESDtrack::kTPCin) == 0 && (fTrack->Status() & AliESDtrack::kITSrefit) != 0 && (fTrack->Status() & AliESDtrack::kITSpureSA) == 0 && (fTrack->Status() & AliESDtrack::kITSpid) != 0); - isTOF = ((fTrack->Status() & AliESDtrack::kTOFout) != 0 && (fTrack->Status() & AliESDtrack::kTIME) != 0); - - // accept only tracks which are TPC+ITS or ITS standalone - if (isITSSA) - { - fTrack->ITSsa() = kTRUE; - fTrack->TOFok() = kFALSE; - } - else if (isTPC) - { - fTrack->ITSsa() = kFALSE; - fTrack->TOFok() = isTOF; - } - else - continue; - - // get DCA to primary vertex - track->GetImpactParameters(b, bCov); - fTrack->DCAr() = (Double_t)b[0]; - fTrack->DCAz() = (Double_t)b[1]; - - // get ITS info - for (k = 0; k < 6; k++) - { - fTrack->ITSmap(k) = track->HasPointOnITSLayer(k); - } - if (isITSSA) - { - fTrack->ITSchi2() = track->GetITSchi2(); - fTrack->ITSsignal() = track->GetITSsignal(); - nITS = fTrack->SSDcount() + fTrack->SDDcount(); - for (k = 0; k < AliPID::kSPECIES; k++) - { - fTrack->ITSnsigma(k) = itsrsp.GetNumberOfSigmas(fTrack->Prec(), fTrack->ITSsignal(), (AliPID::EParticleType)k, nITS, kTRUE); + // create interfacr objects + AliRsnEvent event; + AliRsnDaughter daughter; + event.SetRef(esd); + event.SetRefMC(fMCEvent); + + // ITS stuff #1 + // create the response function and initialize it to MC or not + // depending if the AliStack object is there or not + Bool_t isMC = (stack != 0x0); + AliITSPIDResponse itsrsp(isMC); + + // TOF stuff #1: init OCDB + Int_t run = esd->GetRunNumber(); + AliCDBManager *cdb = AliCDBManager::Instance(); + cdb->SetDefaultStorage("raw://"); + cdb->SetRun(run); + // TOF stuff #2: init calibration + fTOFcalib->SetCorrectTExp(fTOFcorrectTExp); + fTOFcalib->Init(); + // TOF stuff #3: calibrate + if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(esd); + if (fTOFtuneMC) fTOFmaker->TuneForMC(esd); + if (fTOFuseT0) { + fTOFmaker->ComputeT0TOF(esd); + fTOFmaker->ApplyT0TOF(esd); + fESDpid->MakePID(esd, kFALSE, 0.); + } + + // loop on all tracks + Int_t i, k, nITS, ntracks = esd->GetNumberOfTracks();; + Bool_t isTPC, isITSSA, isTOF; + Float_t b[2], bCov[3]; + Double_t time[10]; + + for (i = 0; i < ntracks; i++) { + AliESDtrack *track = esd->GetTrack(i); + event.SetDaughter(daughter, i, AliRsnDaughter::kTrack); + + // reset the output object + // 'usable' flag will need to be set to 'ok' + fTrack->Reset(); + + // check cuts + fTrack->CutsPassed() = fTrackCuts.IsSelected(&daughter); + + // skip NULL pointers, kink daughters and tracks which + // cannot be propagated to primary vertex + if (!track) continue; + if ((Int_t)track->GetKinkIndex(0) > 0) continue; + if (!track->RelateToVertex(v, esd->GetMagneticField(), kVeryBig)) continue; + + // get MC info if possible + if (stack) fTrack->AdoptMC(TMath::Abs(track->GetLabel()), stack); + + // copy general info + fTrack->Status() = (UInt_t)track->GetStatus(); + fTrack->Length() = (Double_t)track->GetIntegratedLength(); + fTrack->Charge() = (Int_t)track->Charge(); + fTrack->PrecX() = (Double_t)track->Px(); + fTrack->PrecY() = (Double_t)track->Py(); + fTrack->PrecZ() = (Double_t)track->Pz(); + + // evaluate some flags from the status to decide what to do next in some points + isTPC = ((fTrack->Status() & AliESDtrack::kTPCin) != 0); + isITSSA = ((fTrack->Status() & AliESDtrack::kTPCin) == 0 && (fTrack->Status() & AliESDtrack::kITSrefit) != 0 && (fTrack->Status() & AliESDtrack::kITSpureSA) == 0 && (fTrack->Status() & AliESDtrack::kITSpid) != 0); + isTOF = ((fTrack->Status() & AliESDtrack::kTOFout) != 0 && (fTrack->Status() & AliESDtrack::kTIME) != 0); + + // accept only tracks which are TPC+ITS or ITS standalone + if (isITSSA) { + fTrack->ITSsa() = kTRUE; + fTrack->TOFok() = kFALSE; + } else if (isTPC) { + fTrack->ITSsa() = kFALSE; + fTrack->TOFok() = isTOF; + } else + continue; + + // get DCA to primary vertex + track->GetImpactParameters(b, bCov); + fTrack->DCAr() = (Double_t)b[0]; + fTrack->DCAz() = (Double_t)b[1]; + + // get ITS info + for (k = 0; k < 6; k++) { + fTrack->ITSmap(k) = track->HasPointOnITSLayer(k); + } + if (isITSSA) { + fTrack->ITSchi2() = track->GetITSchi2(); + fTrack->ITSsignal() = track->GetITSsignal(); + nITS = fTrack->SSDcount() + fTrack->SDDcount(); + for (k = 0; k < AliPID::kSPECIES; k++) { + fTrack->ITSnsigma(k) = itsrsp.GetNumberOfSigmas(fTrack->Prec(), fTrack->ITSsignal(), (AliPID::EParticleType)k, nITS, kTRUE); + } } - } - - // get TPC info - if (isTPC) - { - fTrack->TPCcount() = (Int_t)track->GetTPCclusters(0); - fTrack->TPCchi2() = (Double_t)track->GetTPCchi2(); - fTrack->TPCsignal() = (Double_t)track->GetTPCsignal(); - fTrack->PtpcX() = fTrack->PtpcY() = fTrack->PtpcZ() = 1E10; - if (track->GetInnerParam()) - { - fTrack->PtpcX() = track->GetInnerParam()->Px(); - fTrack->PtpcY() = track->GetInnerParam()->Py(); - fTrack->PtpcZ() = track->GetInnerParam()->Pz(); - for (k = 0; k < AliPID::kSPECIES; k++) - { - fTrack->TPCnsigma(k) = fESDpid->NumberOfSigmasTPC(track, (AliPID::EParticleType)k); - } + + // get TPC info + if (isTPC) { + fTrack->TPCcount() = (Int_t)track->GetTPCclusters(0); + fTrack->TPCchi2() = (Double_t)track->GetTPCchi2(); + fTrack->TPCsignal() = (Double_t)track->GetTPCsignal(); + fTrack->PtpcX() = fTrack->PtpcY() = fTrack->PtpcZ() = 1E10; + if (track->GetInnerParam()) { + fTrack->PtpcX() = track->GetInnerParam()->Px(); + fTrack->PtpcY() = track->GetInnerParam()->Py(); + fTrack->PtpcZ() = track->GetInnerParam()->Pz(); + for (k = 0; k < AliPID::kSPECIES; k++) { + fTrack->TPCnsigma(k) = fESDpid->NumberOfSigmasTPC(track, (AliPID::EParticleType)k); + } + } } - } - - // get TOF info - if (isTOF) - { - track->GetIntegratedTimes(time); - fTrack->TOFsignal() = (Double_t)track->GetTOFsignal(); - for (k = 0; k < AliPID::kSPECIES; k++) - { - fTrack->TOFref(k) = time[k]; - fTrack->TOFsigma(k) = (Double_t)fTOFmaker->GetExpectedSigma(fTrack->Prec(), time[k], AliPID::ParticleMass(k)); + + // get TOF info + if (isTOF) { + track->GetIntegratedTimes(time); + fTrack->TOFsignal() = (Double_t)track->GetTOFsignal(); + for (k = 0; k < AliPID::kSPECIES; k++) { + fTrack->TOFref(k) = time[k]; + fTrack->TOFsigma(k) = (Double_t)fTOFmaker->GetExpectedSigma(fTrack->Prec(), time[k], AliPID::ParticleMass(k)); + } } - } - - // add entry to TTree - fOut->Fill(); - } + + // add entry to TTree + fOut->Fill(); + } } diff --git a/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.h b/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.h index 66d1c75759f..642293b047a 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.h +++ b/PWG2/RESONANCES/AliRsnAnalysisMonitorTask.h @@ -21,58 +21,57 @@ class AliESDpid; class AliTOFT0maker; class AliTOFcalib; -class AliRsnAnalysisMonitorTask : public AliAnalysisTaskSE -{ - public: - - AliRsnAnalysisMonitorTask(const char *name = "Phi7TeV"); - AliRsnAnalysisMonitorTask(const AliRsnAnalysisMonitorTask& copy); - AliRsnAnalysisMonitorTask& operator=(const AliRsnAnalysisMonitorTask& copy); - virtual ~AliRsnAnalysisMonitorTask(); - - void SetTPCpar(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) - {fTPCpar[0]=p0;fTPCpar[1]=p1;fTPCpar[2]=p2;fTPCpar[3]=p3;fTPCpar[4]=p4;} - - void SetTOFcalibrateESD(Bool_t yn = kTRUE) {fTOFcalibrateESD = yn;} - void SetTOFcorrectTExp (Bool_t yn = kTRUE) {fTOFcorrectTExp = yn;} - void SetTOFuseT0 (Bool_t yn = kTRUE) {fTOFuseT0 = yn;} - void SetTOFtuneMC (Bool_t yn = kTRUE) {fTOFtuneMC = yn;} - void SetTOFresolution (Double_t v = 100.0) {fTOFresolution = v;} - - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t *option = ""); - virtual void Terminate(Option_t *option = ""); - - Int_t EventEval(AliESDEvent *esd); - Bool_t IsTPCtrack(AliESDtrack *track); - Bool_t IsITSSAtrack(AliESDtrack *track); - void ProcessESD(AliESDEvent *esd, const AliESDVertex *v, AliStack *stack); - - AliRsnCutSet* GetEventCuts() {return &fEventCuts;} - AliRsnCutSet* GetTrackCuts() {return &fTrackCuts;} - - private: - - TTree *fOut; // output TTree - AliRsnMonitorTrack *fTrack; // branch object for output TTree - - Double_t fTPCpar[5]; // parameters for TPC bethe-Bloch - - AliESDpid *fESDpid; //! PID manager - - AliTOFT0maker *fTOFmaker; //! TOF time0 computator - AliTOFcalib *fTOFcalib; //! TOF calibration - Bool_t fTOFcalibrateESD; // TOF settings - Bool_t fTOFcorrectTExp; // TOF settings - Bool_t fTOFuseT0; // TOF settings - Bool_t fTOFtuneMC; // TOF settings - Double_t fTOFresolution; // TOF settings - - AliRsnCutSet fEventCuts; // event cuts - AliRsnCutSet fTrackCuts; // track cuts - - // ROOT dictionary - ClassDef(AliRsnAnalysisMonitorTask,1) +class AliRsnAnalysisMonitorTask : public AliAnalysisTaskSE { +public: + + AliRsnAnalysisMonitorTask(const char *name = "Phi7TeV"); + AliRsnAnalysisMonitorTask(const AliRsnAnalysisMonitorTask& copy); + AliRsnAnalysisMonitorTask& operator=(const AliRsnAnalysisMonitorTask& copy); + virtual ~AliRsnAnalysisMonitorTask(); + + void SetTPCpar(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) + {fTPCpar[0] = p0; fTPCpar[1] = p1; fTPCpar[2] = p2; fTPCpar[3] = p3; fTPCpar[4] = p4;} + + void SetTOFcalibrateESD(Bool_t yn = kTRUE) {fTOFcalibrateESD = yn;} + void SetTOFcorrectTExp(Bool_t yn = kTRUE) {fTOFcorrectTExp = yn;} + void SetTOFuseT0(Bool_t yn = kTRUE) {fTOFuseT0 = yn;} + void SetTOFtuneMC(Bool_t yn = kTRUE) {fTOFtuneMC = yn;} + void SetTOFresolution(Double_t v = 100.0) {fTOFresolution = v;} + + virtual void UserCreateOutputObjects(); + virtual void UserExec(Option_t *option = ""); + virtual void Terminate(Option_t *option = ""); + + Int_t EventEval(AliESDEvent *esd); + Bool_t IsTPCtrack(AliESDtrack *track); + Bool_t IsITSSAtrack(AliESDtrack *track); + void ProcessESD(AliESDEvent *esd, const AliESDVertex *v, AliStack *stack); + + AliRsnCutSet* GetEventCuts() {return &fEventCuts;} + AliRsnCutSet* GetTrackCuts() {return &fTrackCuts;} + +private: + + TTree *fOut; // output TTree + AliRsnMonitorTrack *fTrack; // branch object for output TTree + + Double_t fTPCpar[5]; // parameters for TPC bethe-Bloch + + AliESDpid *fESDpid; //! PID manager + + AliTOFT0maker *fTOFmaker; //! TOF time0 computator + AliTOFcalib *fTOFcalib; //! TOF calibration + Bool_t fTOFcalibrateESD; // TOF settings + Bool_t fTOFcorrectTExp; // TOF settings + Bool_t fTOFuseT0; // TOF settings + Bool_t fTOFtuneMC; // TOF settings + Double_t fTOFresolution; // TOF settings + + AliRsnCutSet fEventCuts; // event cuts + AliRsnCutSet fTrackCuts; // track cuts + + // ROOT dictionary + ClassDef(AliRsnAnalysisMonitorTask, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisPhiKK.cxx b/PWG2/RESONANCES/AliRsnAnalysisPhiKK.cxx deleted file mode 100644 index 4d0ef086e35..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisPhiKK.cxx +++ /dev/null @@ -1,372 +0,0 @@ -// -// Class AliRsnAnalysisPhiKK -// -// Virtual Class derivated from AliRsnVAnalysisTaskSE which will be base class -// for all RSN SE tasks -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// - -#include -#include - -#include "AliRsnFunction.h" -#include "AliRsnAnalysisPhiKK.h" - -ClassImp(AliRsnAnalysisPhiKK) - -//_____________________________________________________________________________ -AliRsnAnalysisPhiKK::AliRsnAnalysisPhiKK(const char *name, Bool_t useKine) : - AliRsnVAnalysisTaskSE(name, useKine), - - fPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455), - - fCutEvent (Form("%s_cutEvent" , name), AliRsnTarget::kEvent), - fCutTrackCommon(Form("%s_cutTrackCom", name), AliRsnTarget::kDaughter), - fCutTrackPos (Form("%s_cutTrackPos", name), AliRsnTarget::kDaughter), - fCutTrackNeg (Form("%s_cutTrackNeg", name), AliRsnTarget::kDaughter), - fCutPair (Form("%s_cutPair", name), AliRsnTarget::kMother), - - fFuncPM ("AliRsnFunction", 0), - fFuncPP ("AliRsnFunction", 0), - fFuncMM ("AliRsnFunction", 0), - fFuncTrue("AliRsnFunction", 0), - - fOutList(0x0) -{ -// -// Default constructor. -// Defines another output slot for histograms/ntuples -// - - DefineOutput(2, TList::Class()); -} - -//_____________________________________________________________________________ -AliRsnAnalysisPhiKK::AliRsnAnalysisPhiKK(const AliRsnAnalysisPhiKK& copy) : - AliRsnVAnalysisTaskSE(copy), - - fPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455), - - fCutEvent (copy.fCutEvent), - fCutTrackCommon(copy.fCutTrackCommon), - fCutTrackPos (copy.fCutTrackPos), - fCutTrackNeg (copy.fCutTrackNeg), - fCutPair (copy.fCutPair), - - fFuncPM (copy.fFuncPM), - fFuncPP (copy.fFuncPP), - fFuncMM (copy.fFuncMM), - fFuncTrue(copy.fFuncTrue), - - fOutList(0x0) -{ -// -// Copy constructor. -// -} - -//_____________________________________________________________________________ -AliRsnAnalysisPhiKK& AliRsnAnalysisPhiKK::operator=(const AliRsnAnalysisPhiKK& copy) -{ -// -// Assigment operator. -// - - AliRsnVAnalysisTaskSE::operator=(copy); - - fFuncPM = copy.fFuncPM; - fFuncPP = copy.fFuncPP; - fFuncMM = copy.fFuncMM; - fFuncTrue = copy.fFuncTrue; - - fCutEvent = copy.fCutEvent; - fCutTrackCommon = copy.fCutTrackCommon; - fCutTrackPos = copy.fCutTrackPos; - fCutTrackNeg = copy.fCutTrackNeg; - fCutPair = copy.fCutPair; - - if (fOutList) fOutList->Clear(); - - return (*this); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisPhiKK::AddFunction(AliRsnFunction* const fcn) -{ -// -// Adds a new computing function to each collection, -// in order to have exactly the sames for each kind of pair. -// - - Int_t size = fFuncPM.GetEntries(); - - new (fFuncPM [size]) AliRsnFunction(*fcn); - new (fFuncPP [size]) AliRsnFunction(*fcn); - new (fFuncMM [size]) AliRsnFunction(*fcn); - new (fFuncTrue[size]) AliRsnFunction(*fcn); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisPhiKK::RsnUserCreateOutputObjects() -{ -// -// Creation of output objects. -// These are created through the utility methods in the analysis manager, -// which asks all the AliRsnPair objects to initialize their output which -// is then linked to the TList data member of this, which will contain all the output. -// - - if (!fOutList) fOutList = new TList; - fOutList->Clear(); - - Int_t i, j, nFunc = fFuncPM.GetEntries(); - TString hName(""), suf[4] = {"PM", "PP", "MM", "True"}; - AliRsnFunction *fcn[4] = {0, 0, 0, 0}; - - for (i = 0; i < nFunc; i++) - { - fcn[0] = (AliRsnFunction*)fFuncPM.At(i); - fcn[1] = (AliRsnFunction*)fFuncPP.At(i); - fcn[2] = (AliRsnFunction*)fFuncMM.At(i); - fcn[3] = (AliRsnFunction*)fFuncTrue.At(i); - for (j = 0; j < 4; j++) - { - hName = GetName(); - hName += '_'; - hName += suf[j]; - hName += '_'; - hName += fcn[j]->GetName(); - if (fcn[j]->IsUsingTH1()) fOutList->Add(fcn[j]->CreateHistogram(hName.Data(), "")); - else fOutList->Add(fcn[j]->CreateHistogramSparse(hName.Data(), "")); - } - } - - PostData(2, fOutList); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisPhiKK::RsnUserExec(Option_t*) -{ -// -// Execution of the analysis task. -// Recovers the input event and processes it with all included pair objects, -// using 'reconstructed' or 'MonteCarlo' functions depending on MC-only flag. -// - - // allocate statically all class objects used here - static TArrayI good(0); - static AliRsnDaughter kaon[2], temp; - static AliRsnMother phi; - static AliRsnDaughter::ERefType type; - static AliRsnFunction *fcn = 0x0; - static TClonesArray *ref = 0x0; - - // define constants used for kinematics - static const Double_t kaonMass = 0.493677; - - // simpler variables are declared non static - Int_t i, j, k, index, ngood = 0; - Int_t tot = AliRsnTarget::GetCurrentEvent()->GetAbsoluteSum(); - Bool_t assignOK, truePair; - - // point to first event in the target - AliRsnTarget::SwitchToFirst(); - if (!AliRsnTarget::GetCurrentEvent()) return; - - // initially, set the array of good indexes - // to the full number of tracks and reset the counter - good.Set(tot); - ngood = 0; - - // loop on tracks and get those which satisfy cuts - for (i = 0; i < tot; i++) - { - // assign track and skip all that are not charged tracks - assignOK = AliRsnTarget::GetCurrentEvent()->ConvertAbsoluteIndex(i, index, type); - if (!assignOK) continue; - if (type != AliRsnDaughter::kTrack) continue; - AliRsnTarget::GetCurrentEvent()->SetDaughter(temp, index, AliRsnDaughter::kTrack); - - // skip tracks which don't pass common cuts - if (!fCutTrackCommon.IsSelected(&temp)) continue; - - // accept tracks which pass also charge-related cuts - if ( (temp.Charge() > 0) && (fCutTrackPos.IsSelected(&temp)) ) - { - good[ngood] = index; - ++ngood; - } - else if ( (temp.Charge() < 0) && (fCutTrackNeg.IsSelected(&temp)) ) - { - good[ngood] = index; - ++ngood; - } - } - - // rese the arrays to the real counts - good.Set(ngood); - - // now that the 'tot' value is useless, set it to - // the total number of functions, which by construction - // is THE SAME for all collections - tot = fFuncPM.GetEntries(); - - // fill histograms: do a unique loop on all good indexes - // and choose the histogram to fill from track charges - for (i = 0; i < ngood; i++) - { - AliRsnTarget::GetCurrentEvent()->SetDaughter(kaon[0], good[i], AliRsnDaughter::kTrack); - - for (j = 0; j < ngood; j++) - { - // reject equal indexes - if (good[i] == good[j]) continue; - AliRsnTarget::GetCurrentEvent()->SetDaughter(kaon[1], good[j], AliRsnDaughter::kTrack); - - // adjust charges of pair def - fPairDef.SetDaughters(AliPID::kKaon, kaon[0].ChargeChar(), AliPID::kKaon, kaon[1].ChargeChar()); - - // fill the pair using the kaon masses and the passed daughters - phi.SetDaughters(&kaon[0], kaonMass, &kaon[1], kaonMass); - - // check pair cuts - if (!fCutPair.IsSelected(&phi)) continue; - - // choose the functions to fill according to charges - if (fPairDef.IsLikeSign()) - { - if (kaon[0].IsPos()) ref = &fFuncPP; else ref = &fFuncMM; - truePair = kFALSE; - } - else - { - ref = &fFuncPM; - truePair = IsTruePair(&kaon[0], &kaon[1]); - } - - // loop on functions in chosen collection and fill - for (k = 0; k < tot; k++) - { - // fill standard histogram - fcn = (AliRsnFunction*)fFuncPP[k]; - fcn->SetPairDef(&fPairDef); - fcn->SetPair(&phi); - fcn->Fill(); - - // in case of true pair, fill its histogram - if (truePair) - { - fcn = (AliRsnFunction*)fFuncTrue[k]; - fcn->Fill(); - } - } - } // end internal loop - } // end external loop - - PostData(2, fOutList); -} - -//_____________________________________________________________________________ -void AliRsnAnalysisPhiKK::RsnTerminate(Option_t*) -{ -// -// Termination. -// Could be added some monitor histograms here. -// -} - -//______________________________________________________________________________ -Bool_t AliRsnAnalysisPhiKK::EventProcess() -{ -// -// Customized event pre-processing. -// First checks if the current event passes all cuts, -// and if it does, updates the informations and then -// call the operations which are already defined in the -// omonyme function in mother class -// - - // initially, an event is expected to be bad - fTaskInfo.SetEventUsed(kFALSE); - - // check #1: number of tracks in event (reject empty events) - Int_t ntracks = fRsnEvent.GetMultiplicity(); - if (ntracks < 1) - { - // empty events are rejected by default - fTaskInfo.SetEventUsed(kFALSE); - AliDebug(AliLog::kDebug, "Empty event. Skipping..."); - return kFALSE; - } - - // check the event cuts and update the info data accordingly - // events not passing the cuts must be rejected - if (!fCutEvent.IsSelected(&fRsnEvent)) - { - fTaskInfo.SetEventUsed(kFALSE); - return kFALSE; - } - - // if we reach this point, cuts were passed; - // then additional operations can be done - - // find leading particle (without any PID/momentum restriction) - fRsnEvent.SelectLeadingParticle(0); - - // final return value is positive - // but call the mother class method which updates info object - fTaskInfo.SetEventUsed(kTRUE); - return AliRsnVAnalysisTaskSE::EventProcess(); -} - -//______________________________________________________________________________ -Bool_t AliRsnAnalysisPhiKK::IsTruePair(AliRsnDaughter *d1, AliRsnDaughter *d2) -{ -// -// Checks if the two daughters in argument come from the same phi resonance -// and, if they do, check also that they are both kaons -// - - // constants related to PDG - static const Int_t phiPDG = 333; - static const Int_t kaonPDG = 321; - - // check #1: is MC present? - if (!d1->GetRefMC() || !d2->GetRefMC()) return kFALSE; - - // check #2: same mother? - Int_t m1 = -1; - Int_t m2 = -2; - if (d1->IsESD() && d2->IsESD() ) - { - if (d1->GetRefMCESD() && d2->GetRefMCESD()) - { - m1 = d1->GetRefMCESD()->Particle()->GetFirstMother(); - m2 = d2->GetRefMCESD()->Particle()->GetFirstMother(); - } - } - if (d1->IsAOD() && d2->IsAOD()) - { - if (d1->GetRefMCAOD() && d2->GetRefMCAOD()) - { - m1 = d1->GetRefMCAOD()->GetMother(); - m2 = d2->GetRefMCAOD()->GetMother(); - } - } - if (m1 < 0 || m2 < 0 || (m1 > 0 && m2 > 0 && m1 != m2)) return kFALSE; - - // check #3: is the common mother a phi (PDG = 333)? - if (d1->GetMotherPDG() != phiPDG) return kFALSE; - - // check #4: are the two particles a K+K- pair? - m1 = d1->GetPDG(); - m2 = d2->GetPDG(); - if (m1 == kaonPDG && m2 == -kaonPDG) - return kTRUE; - else if (m1 == -kaonPDG && m2 == kaonPDG) - return kTRUE; - else - return kFALSE; -} diff --git a/PWG2/RESONANCES/AliRsnAnalysisPhiKK.h b/PWG2/RESONANCES/AliRsnAnalysisPhiKK.h deleted file mode 100644 index 06cf0e3598f..00000000000 --- a/PWG2/RESONANCES/AliRsnAnalysisPhiKK.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// Class AliRsnAnalysisPhiKK -// -// Virtual Class derivated from AliRsnVAnalysisTaskSE which will be base class -// for all RSN SE tasks -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// -#ifndef ALIRSNANALYSISPHIKK_H -#define ALIRSNANALYSISPHIKK_H - -#include "TClonesArray.h" - -#include "AliRsnVAnalysisTaskSE.h" - -#include "AliRsnDaughter.h" -#include "AliRsnMother.h" -#include "AliRsnPairDef.h" -#include "AliRsnEvent.h" -#include "AliRsnCutSet.h" - -class AliRsnPIDDefESD; - -class AliRsnAnalysisPhiKK : public AliRsnVAnalysisTaskSE -{ - public: - - AliRsnAnalysisPhiKK(const char *name = "RSNphi", Bool_t useKine = kFALSE); - AliRsnAnalysisPhiKK(const AliRsnAnalysisPhiKK& copy); - AliRsnAnalysisPhiKK& operator=(const AliRsnAnalysisPhiKK& copy); - virtual ~AliRsnAnalysisPhiKK() {} - - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnTerminate(Option_t*); - virtual Bool_t EventProcess(); - - AliRsnCutSet* GetEventCuts() {return &fCutEvent;} - AliRsnCutSet* GetCommonDaughterCuts() {return &fCutTrackCommon;} - AliRsnCutSet* GetPosDaughterCuts() {return &fCutTrackPos;} - AliRsnCutSet* GetNegDaughterCuts() {return &fCutTrackNeg;} - AliRsnCutSet* GetMotherCuts() {return &fCutPair;} - AliRsnPairDef* GetPairDef() {return &fPairDef;} - - static Bool_t IsTruePair(AliRsnDaughter *d1, AliRsnDaughter *d2); - void AddFunction(AliRsnFunction* const fcn); - TList* GenerateHistograms(); - - private: - - AliRsnPairDef fPairDef; // resonance decay tree (fixed) - - AliRsnCutSet fCutEvent; // cut set for events - AliRsnCutSet fCutTrackCommon; // cut set for tracks (common) - AliRsnCutSet fCutTrackPos; // cut set for tracks (only pos) - AliRsnCutSet fCutTrackNeg; // cut set for tracks (only neg) - AliRsnCutSet fCutPair; // cut set for pairs - - TClonesArray fFuncPM; // collection of functions for unlike-sign - TClonesArray fFuncPP; // collection of functions for like-sign ++ - TClonesArray fFuncMM; // collection of functions for like-sign -- - TClonesArray fFuncTrue; // collection of functions for unlike-sign true pairs - - TList *fOutList; // list of output events - - ClassDef(AliRsnAnalysisPhiKK, 1) -}; - -#endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisSE.cxx b/PWG2/RESONANCES/AliRsnAnalysisSE.cxx index e37b1697fcf..99b3726906e 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisSE.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisSE.cxx @@ -22,29 +22,29 @@ ClassImp(AliRsnAnalysisSE) //_____________________________________________________________________________ AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name, Bool_t useKine) : - AliRsnVAnalysisTaskSE(name, useKine), - fRsnAnalysisManager(), - fEventCuts("eventCuts", AliRsnCut::kEvent), - fOutList(0x0), - fZeroEventPercentWarning(100), - fUseZeroEventWarning(kTRUE) + AliRsnVAnalysisTaskSE(name, useKine), + fRsnAnalysisManager(), + fEventCuts("eventCuts", AliRsnCut::kEvent), + fOutList(0x0), + fZeroEventPercentWarning(100), + fUseZeroEventWarning(kTRUE) { // // Default constructor. // Defines another output slot for histograms/ntuples // - DefineOutput(2, TList::Class()); + DefineOutput(2, TList::Class()); } //_____________________________________________________________________________ AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) : - AliRsnVAnalysisTaskSE(copy), - fRsnAnalysisManager(copy.fRsnAnalysisManager), - fEventCuts(copy.fEventCuts), - fOutList(0x0), - fZeroEventPercentWarning(copy.fZeroEventPercentWarning), - fUseZeroEventWarning(copy.fUseZeroEventWarning) + AliRsnVAnalysisTaskSE(copy), + fRsnAnalysisManager(copy.fRsnAnalysisManager), + fEventCuts(copy.fEventCuts), + fOutList(0x0), + fZeroEventPercentWarning(copy.fZeroEventPercentWarning), + fUseZeroEventWarning(copy.fUseZeroEventWarning) { // // Copy constructor. @@ -58,15 +58,15 @@ AliRsnAnalysisSE& AliRsnAnalysisSE::operator=(const AliRsnAnalysisSE& copy) // Assigment operator. // - AliRsnVAnalysisTaskSE::operator=(copy); - - fRsnAnalysisManager = copy.fRsnAnalysisManager; - fEventCuts = copy.fEventCuts; - if (fOutList) fOutList->Clear(); - fZeroEventPercentWarning = copy.fZeroEventPercentWarning; - fUseZeroEventWarning = copy.fUseZeroEventWarning; - - return (*this); + AliRsnVAnalysisTaskSE::operator=(copy); + + fRsnAnalysisManager = copy.fRsnAnalysisManager; + fEventCuts = copy.fEventCuts; + if (fOutList) fOutList->Clear(); + fZeroEventPercentWarning = copy.fZeroEventPercentWarning; + fUseZeroEventWarning = copy.fUseZeroEventWarning; + + return (*this); } //_____________________________________________________________________________ @@ -79,12 +79,12 @@ void AliRsnAnalysisSE::RsnUserCreateOutputObjects() // is then linked to the TList data member of this, which will contain all the output. // - if (!fOutList) fOutList = new TList; - fOutList->Clear(); - - fRsnAnalysisManager.InitAllPairs(fOutList); + if (!fOutList) fOutList = new TList; + fOutList->Clear(); + + fRsnAnalysisManager.InitAllPairs(fOutList); - PostData(2, fOutList); + PostData(2, fOutList); } //_____________________________________________________________________________ @@ -96,12 +96,12 @@ void AliRsnAnalysisSE::RsnUserExec(Option_t*) // using 'reconstructed' or 'MonteCarlo' functions depending on MC-only flag. // - if (fMCOnly) - fRsnAnalysisManager.ProcessAllPairsMC(); - else - fRsnAnalysisManager.ProcessAllPairs(); - - PostData(2, fOutList); + if (fMCOnly) + fRsnAnalysisManager.ProcessAllPairsMC(); + else + fRsnAnalysisManager.ProcessAllPairs(); + + PostData(2, fOutList); } //_____________________________________________________________________________ @@ -124,48 +124,44 @@ Bool_t AliRsnAnalysisSE::EventProcess() // omonyme function in mother class // - // initially, an event is expected to be bad - fTaskInfo.SetEventUsed(kFALSE); - - // check #1: number of tracks in event (reject empty events) - Int_t ntracks = fRsnEvent.GetMultiplicity(); - Double_t zeroEventPercent = 0.0; - if (ntracks < 1) - { - // if using the checker for amount of empty events, update it - if (fUseZeroEventWarning) - { - TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName()); - if (hist) - { - if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100; - if ((zeroEventPercent > fZeroEventPercentWarning) && (fEntry > 100)) - AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!", zeroEventPercent, fEntry)); + // initially, an event is expected to be bad + fTaskInfo.SetEventUsed(kFALSE); + + // check #1: number of tracks in event (reject empty events) + Int_t ntracks = fRsnEvent.GetMultiplicity(); + Double_t zeroEventPercent = 0.0; + if (ntracks < 1) { + // if using the checker for amount of empty events, update it + if (fUseZeroEventWarning) { + TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName()); + if (hist) { + if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100; + if ((zeroEventPercent > fZeroEventPercentWarning) && (fEntry > 100)) + AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!", zeroEventPercent, fEntry)); + } } - } - - // empty events are rejected by default - fTaskInfo.SetEventUsed(kFALSE); - AliDebug(AliLog::kDebug, "Empty event. Skipping..."); - return kFALSE; - } - - // check the event cuts and update the info data accordingly - // events not passing the cuts must be rejected - if (!fEventCuts.IsSelected(&fRsnEvent)) - { - fTaskInfo.SetEventUsed(kFALSE); - return kFALSE; - } - - // if we reach this point, cuts were passed; - // then additional operations can be done - - // find leading particle (without any PID/momentum restriction) - fRsnEvent.SelectLeadingParticle(0); - - // final return value is positive - // but call the mother class method which updates info object - fTaskInfo.SetEventUsed(kTRUE); - return AliRsnVAnalysisTaskSE::EventProcess(); + + // empty events are rejected by default + fTaskInfo.SetEventUsed(kFALSE); + AliDebug(AliLog::kDebug, "Empty event. Skipping..."); + return kFALSE; + } + + // check the event cuts and update the info data accordingly + // events not passing the cuts must be rejected + if (!fEventCuts.IsSelected(&fRsnEvent)) { + fTaskInfo.SetEventUsed(kFALSE); + return kFALSE; + } + + // if we reach this point, cuts were passed; + // then additional operations can be done + + // find leading particle (without any PID/momentum restriction) + fRsnEvent.SelectLeadingParticle(0); + + // final return value is positive + // but call the mother class method which updates info object + fTaskInfo.SetEventUsed(kTRUE); + return AliRsnVAnalysisTaskSE::EventProcess(); } diff --git a/PWG2/RESONANCES/AliRsnAnalysisSE.h b/PWG2/RESONANCES/AliRsnAnalysisSE.h index 0b3b51ac605..9493c4683b9 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisSE.h +++ b/PWG2/RESONANCES/AliRsnAnalysisSE.h @@ -18,38 +18,37 @@ class AliRsnPIDDefESD; -class AliRsnAnalysisSE : public AliRsnVAnalysisTaskSE -{ - public: - - AliRsnAnalysisSE(const char *name = "AliRsnAnalysisSE", Bool_t useKine = kFALSE); - AliRsnAnalysisSE(const AliRsnAnalysisSE& copy); - AliRsnAnalysisSE& operator=(const AliRsnAnalysisSE& copy); - virtual ~AliRsnAnalysisSE() {} - - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnTerminate(Option_t*); - virtual Bool_t EventProcess(); - - AliRsnCutSet* GetEventCuts() {return &fEventCuts;} - AliRsnAnalysisManager* GetAnalysisManager() {return &fRsnAnalysisManager;} - void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name);} - - Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;} - void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;} - void UseZeroEventWarning(Bool_t b = kTRUE) {fUseZeroEventWarning = b;} - - private: - - AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine - AliRsnCutSet fEventCuts; // event cuts - TList *fOutList; // list of output events - - Double_t fZeroEventPercentWarning; // Percent Number for Zero Event Warning - Bool_t fUseZeroEventWarning; // flag if Zero Event Warning is used (default is true) - - ClassDef(AliRsnAnalysisSE, 1) +class AliRsnAnalysisSE : public AliRsnVAnalysisTaskSE { +public: + + AliRsnAnalysisSE(const char *name = "AliRsnAnalysisSE", Bool_t useKine = kFALSE); + AliRsnAnalysisSE(const AliRsnAnalysisSE& copy); + AliRsnAnalysisSE& operator=(const AliRsnAnalysisSE& copy); + virtual ~AliRsnAnalysisSE() {} + + virtual void RsnUserCreateOutputObjects(); + virtual void RsnUserExec(Option_t*); + virtual void RsnTerminate(Option_t*); + virtual Bool_t EventProcess(); + + AliRsnCutSet* GetEventCuts() {return &fEventCuts;} + AliRsnAnalysisManager* GetAnalysisManager() {return &fRsnAnalysisManager;} + void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name);} + + Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;} + void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;} + void UseZeroEventWarning(Bool_t b = kTRUE) {fUseZeroEventWarning = b;} + +private: + + AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine + AliRsnCutSet fEventCuts; // event cuts + TList *fOutList; // list of output events + + Double_t fZeroEventPercentWarning; // Percent Number for Zero Event Warning + Bool_t fUseZeroEventWarning; // flag if Zero Event Warning is used (default is true) + + ClassDef(AliRsnAnalysisSE, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisTask.cxx b/PWG2/RESONANCES/AliRsnAnalysisTask.cxx index f3cb77aca25..b2681aa079b 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisTask.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisTask.cxx @@ -22,29 +22,29 @@ ClassImp(AliRsnAnalysisTask) //_____________________________________________________________________________ AliRsnAnalysisTask::AliRsnAnalysisTask(const char *name, Bool_t useKine) : - AliRsnVAnalysisTask(name, useKine), - fRsnAnalysisManager(), - fEventCuts("eventCuts", AliRsnCut::kEvent), - fOutList(0x0), - fZeroEventPercentWarning(100), - fUseZeroEventWarning(kTRUE) + AliRsnVAnalysisTask(name, useKine), + fRsnAnalysisManager(), + fEventCuts("eventCuts", AliRsnCut::kEvent), + fOutList(0x0), + fZeroEventPercentWarning(100), + fUseZeroEventWarning(kTRUE) { // // Default constructor. // Defines another output slot for histograms/ntuples // - DefineOutput(2, TList::Class()); + DefineOutput(2, TList::Class()); } //_____________________________________________________________________________ AliRsnAnalysisTask::AliRsnAnalysisTask(const AliRsnAnalysisTask& copy) : - AliRsnVAnalysisTask(copy), - fRsnAnalysisManager(copy.fRsnAnalysisManager), - fEventCuts(copy.fEventCuts), - fOutList(0x0), - fZeroEventPercentWarning(copy.fZeroEventPercentWarning), - fUseZeroEventWarning(copy.fUseZeroEventWarning) + AliRsnVAnalysisTask(copy), + fRsnAnalysisManager(copy.fRsnAnalysisManager), + fEventCuts(copy.fEventCuts), + fOutList(0x0), + fZeroEventPercentWarning(copy.fZeroEventPercentWarning), + fUseZeroEventWarning(copy.fUseZeroEventWarning) { // // Copy constructor. @@ -58,15 +58,15 @@ AliRsnAnalysisTask& AliRsnAnalysisTask::operator=(const AliRsnAnalysisTask& copy // Assigment operator. // - AliRsnVAnalysisTask::operator=(copy); - - fRsnAnalysisManager = copy.fRsnAnalysisManager; - fEventCuts = copy.fEventCuts; - if (fOutList) fOutList->Clear(); - fZeroEventPercentWarning = copy.fZeroEventPercentWarning; - fUseZeroEventWarning = copy.fUseZeroEventWarning; - - return (*this); + AliRsnVAnalysisTask::operator=(copy); + + fRsnAnalysisManager = copy.fRsnAnalysisManager; + fEventCuts = copy.fEventCuts; + if (fOutList) fOutList->Clear(); + fZeroEventPercentWarning = copy.fZeroEventPercentWarning; + fUseZeroEventWarning = copy.fUseZeroEventWarning; + + return (*this); } //_____________________________________________________________________________ @@ -79,12 +79,12 @@ void AliRsnAnalysisTask::RsnUserCreateOutputObjects() // is then linked to the TList data member of this, which will contain all the output. // - if (!fOutList) fOutList = new TList; - fOutList->Clear(); - - fRsnAnalysisManager.InitAllPairs(fOutList); + if (!fOutList) fOutList = new TList; + fOutList->Clear(); - PostData(2, fOutList); + fRsnAnalysisManager.InitAllPairs(fOutList); + + PostData(2, fOutList); } //_____________________________________________________________________________ @@ -95,27 +95,27 @@ void AliRsnAnalysisTask::RsnUserExec(Option_t*) // Recovers the input event and processes it with all included pair objects, // using 'reconstructed' or 'MonteCarlo' functions depending on MC-only flag. // - if (IsMixing()) return; - - if (fMCOnly) - fRsnAnalysisManager.ProcessAllPairsMC(); - else - fRsnAnalysisManager.ProcessAllPairs(); + if (IsMixing()) return; + + if (fMCOnly) + fRsnAnalysisManager.ProcessAllPairsMC(); + else + fRsnAnalysisManager.ProcessAllPairs(); - PostData(2, fOutList); + PostData(2, fOutList); } void AliRsnAnalysisTask::RsnUserExecMix(Option_t* /*opt*/) { - if (!IsMixing()) return; - AliDebug(AliLog::kDebug,Form("RSN Mixing %lld %d [%lld,%lld] %d",fMixedEH->CurrentEntry(),fMixedEH->NumberMixed(),fMixedEH->CurrentEntryMain(),fMixedEH->CurrentEntryMix(),fMixedEH->CurrentBinIndex())); - - // the virtual class has already sorted tracks in the PID index - // so we need here just to call the execution of analysis - if (!fMCOnly) - fRsnAnalysisManager.ProcessAllPairs(); - else - fRsnAnalysisManager.ProcessAllPairsMC(); + if (!IsMixing()) return; + AliDebug(AliLog::kDebug, Form("RSN Mixing %lld %d [%lld,%lld] %d", fMixedEH->CurrentEntry(), fMixedEH->NumberMixed(), fMixedEH->CurrentEntryMain(), fMixedEH->CurrentEntryMix(), fMixedEH->CurrentBinIndex())); + + // the virtual class has already sorted tracks in the PID index + // so we need here just to call the execution of analysis + if (!fMCOnly) + fRsnAnalysisManager.ProcessAllPairs(); + else + fRsnAnalysisManager.ProcessAllPairsMC(); } //_____________________________________________________________________________ @@ -138,50 +138,46 @@ Bool_t AliRsnAnalysisTask::EventProcess() // omonyme function in mother class // - // initially, an event is expected to be bad - fTaskInfo.SetEventUsed(kFALSE); - - if (!AliRsnVAnalysisTask::EventProcess()) return kFALSE; - - // check #1: number of tracks in event (reject empty events) - Int_t ntracks = fRsnEvent[0].GetMultiplicity(); - Double_t zeroEventPercent = 0.0; - if (ntracks < 1) - { - // if using the checker for amount of empty events, update it - if (fUseZeroEventWarning) - { - TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName()); - if (hist) - { - if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100; - if ((zeroEventPercent > fZeroEventPercentWarning) && (fEntry > 100)) - AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!", zeroEventPercent, fEntry)); + // initially, an event is expected to be bad + fTaskInfo.SetEventUsed(kFALSE); + + if (!AliRsnVAnalysisTask::EventProcess()) return kFALSE; + + // check #1: number of tracks in event (reject empty events) + Int_t ntracks = fRsnEvent[0].GetMultiplicity(); + Double_t zeroEventPercent = 0.0; + if (ntracks < 1) { + // if using the checker for amount of empty events, update it + if (fUseZeroEventWarning) { + TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName()); + if (hist) { + if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100; + if ((zeroEventPercent > fZeroEventPercentWarning) && (fEntry > 100)) + AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!", zeroEventPercent, fEntry)); + } } - } - - // empty events are rejected by default - fTaskInfo.SetEventUsed(kFALSE); - AliDebug(AliLog::kDebug, "Empty event. Skipping..."); - return kFALSE; - } - - // check the event cuts and update the info data accordingly - // events not passing the cuts must be rejected - if (!fEventCuts.IsSelected(&fRsnEvent[0])) - { - fTaskInfo.SetEventUsed(kFALSE); - return kFALSE; - } - - // if we reach this point, cuts were passed; - // then additional operations can be done - - // find leading particle (without any PID/momentum restriction) - fRsnEvent[0].SelectLeadingParticle(0); - - // final return value is positive - // but call the mother class method which updates info object - fTaskInfo.SetEventUsed(kTRUE); - return kTRUE; + + // empty events are rejected by default + fTaskInfo.SetEventUsed(kFALSE); + AliDebug(AliLog::kDebug, "Empty event. Skipping..."); + return kFALSE; + } + + // check the event cuts and update the info data accordingly + // events not passing the cuts must be rejected + if (!fEventCuts.IsSelected(&fRsnEvent[0])) { + fTaskInfo.SetEventUsed(kFALSE); + return kFALSE; + } + + // if we reach this point, cuts were passed; + // then additional operations can be done + + // find leading particle (without any PID/momentum restriction) + fRsnEvent[0].SelectLeadingParticle(0); + + // final return value is positive + // but call the mother class method which updates info object + fTaskInfo.SetEventUsed(kTRUE); + return kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnAnalysisTask.h b/PWG2/RESONANCES/AliRsnAnalysisTask.h index 21bfb3c70e0..3c71c387c4a 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisTask.h +++ b/PWG2/RESONANCES/AliRsnAnalysisTask.h @@ -18,39 +18,38 @@ class AliRsnPIDDefESD; -class AliRsnAnalysisTask : public AliRsnVAnalysisTask -{ - public: - - AliRsnAnalysisTask(const char *name = "AliRsnAnalysisTask", Bool_t useKine = kFALSE); - AliRsnAnalysisTask(const AliRsnAnalysisTask& copy); - AliRsnAnalysisTask& operator=(const AliRsnAnalysisTask& copy); - virtual ~AliRsnAnalysisTask() {} - - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnUserExecMix(Option_t* ); - virtual void RsnTerminate(Option_t*); - virtual Bool_t EventProcess(); - - AliRsnCutSet* GetEventCuts() {return &fEventCuts;} - AliRsnAnalysisManager* GetAnalysisManager() {return &fRsnAnalysisManager;} - void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name);} - - Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;} - void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;} - void UseZeroEventWarning(Bool_t b = kTRUE) {fUseZeroEventWarning = b;} - - private: - - AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine - AliRsnCutSet fEventCuts; // event cuts - TList *fOutList; // list of output events - - Double_t fZeroEventPercentWarning; // Percent Number for Zero Event Warning - Bool_t fUseZeroEventWarning; // flag if Zero Event Warning is used (default is true) - - ClassDef(AliRsnAnalysisTask, 1) +class AliRsnAnalysisTask : public AliRsnVAnalysisTask { +public: + + AliRsnAnalysisTask(const char *name = "AliRsnAnalysisTask", Bool_t useKine = kFALSE); + AliRsnAnalysisTask(const AliRsnAnalysisTask& copy); + AliRsnAnalysisTask& operator=(const AliRsnAnalysisTask& copy); + virtual ~AliRsnAnalysisTask() {} + + virtual void RsnUserCreateOutputObjects(); + virtual void RsnUserExec(Option_t*); + virtual void RsnUserExecMix(Option_t*); + virtual void RsnTerminate(Option_t*); + virtual Bool_t EventProcess(); + + AliRsnCutSet* GetEventCuts() {return &fEventCuts;} + AliRsnAnalysisManager* GetAnalysisManager() {return &fRsnAnalysisManager;} + void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name);} + + Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;} + void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;} + void UseZeroEventWarning(Bool_t b = kTRUE) {fUseZeroEventWarning = b;} + +private: + + AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine + AliRsnCutSet fEventCuts; // event cuts + TList *fOutList; // list of output events + + Double_t fZeroEventPercentWarning; // Percent Number for Zero Event Warning + Bool_t fUseZeroEventWarning; // flag if Zero Event Warning is used (default is true) + + ClassDef(AliRsnAnalysisTask, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnCut.cxx b/PWG2/RESONANCES/AliRsnCut.cxx index c2a4ba5e4f0..17a67f29cdd 100644 --- a/PWG2/RESONANCES/AliRsnCut.cxx +++ b/PWG2/RESONANCES/AliRsnCut.cxx @@ -23,14 +23,14 @@ ClassImp(AliRsnCut) //______________________________________________________________________________ AliRsnCut::AliRsnCut(const char *name, RSNTARGET target) : - AliRsnTarget(name, target), - fMinI(0), - fMaxI(0), - fMinD(0.), - fMaxD(0.), - fCutValueI(0), - fCutValueD(0.0), - fCutResult(kTRUE) + AliRsnTarget(name, target), + fMinI(0), + fMaxI(0), + fMinD(0.), + fMaxD(0.), + fCutValueI(0), + fCutValueD(0.0), + fCutResult(kTRUE) { // // Default constructor. @@ -40,14 +40,14 @@ AliRsnCut::AliRsnCut(const char *name, RSNTARGET target) : //______________________________________________________________________________ AliRsnCut::AliRsnCut (const char *name, RSNTARGET target, Int_t imin, Int_t imax, Double_t dmin, Double_t dmax) : - AliRsnTarget(name, target), - fMinI(imin), - fMaxI(imax), - fMinD(dmin), - fMaxD(dmax), - fCutValueI(0), - fCutValueD(0.0), - fCutResult(kTRUE) + AliRsnTarget(name, target), + fMinI(imin), + fMaxI(imax), + fMinD(dmin), + fMaxD(dmax), + fCutValueI(0), + fCutValueD(0.0), + fCutResult(kTRUE) { // // Constructor with arguments. @@ -58,14 +58,14 @@ AliRsnCut::AliRsnCut //______________________________________________________________________________ AliRsnCut::AliRsnCut (const char *name, RSNTARGET target, Double_t dmin, Double_t dmax, Int_t imin, Int_t imax) : - AliRsnTarget(name, target), - fMinI(imin), - fMaxI(imax), - fMinD(dmin), - fMaxD(dmax), - fCutValueI(0), - fCutValueD(0.0), - fCutResult(kTRUE) + AliRsnTarget(name, target), + fMinI(imin), + fMaxI(imax), + fMinD(dmin), + fMaxD(dmax), + fCutValueI(0), + fCutValueD(0.0), + fCutResult(kTRUE) { // // Constructor with arguments. @@ -75,14 +75,14 @@ AliRsnCut::AliRsnCut //______________________________________________________________________________ AliRsnCut::AliRsnCut(const AliRsnCut& copy) : - AliRsnTarget(copy), - fMinI(copy.fMinI), - fMaxI(copy.fMaxI), - fMinD(copy.fMinD), - fMaxD(copy.fMaxD), - fCutValueI(copy.fCutValueI), - fCutValueD(copy.fCutValueD), - fCutResult(copy.fCutResult) + AliRsnTarget(copy), + fMinI(copy.fMinI), + fMaxI(copy.fMaxI), + fMinD(copy.fMinD), + fMaxD(copy.fMaxD), + fCutValueI(copy.fCutValueI), + fCutValueD(copy.fCutValueD), + fCutResult(copy.fCutResult) { // // Copy constructor. @@ -98,16 +98,16 @@ AliRsnCut& AliRsnCut::operator=(const AliRsnCut& copy) // Don't duplicate memory occupancy for pointer // - AliRsnTarget::operator=(copy); - - fMinI = copy.fMinI; - fMaxI = copy.fMaxI; - fMinD = copy.fMinD; - fMaxD = copy.fMaxD; - fCutValueI = copy.fCutValueI; - fCutValueD = copy.fCutValueD; + AliRsnTarget::operator=(copy); - return (*this); + fMinI = copy.fMinI; + fMaxI = copy.fMaxI; + fMinD = copy.fMinD; + fMaxD = copy.fMaxD; + fCutValueI = copy.fCutValueI; + fCutValueD = copy.fCutValueD; + + return (*this); } //______________________________________________________________________________ @@ -120,8 +120,8 @@ Bool_t AliRsnCut::IsSelected(TObject* /*object*/) // which must return kTRUE if the cut is passed, and kFALSE otherwise. // - AliWarning("This virtual function must be implemented properly"); - return kTRUE; + AliWarning("This virtual function must be implemented properly"); + return kTRUE; } //______________________________________________________________________________ @@ -132,18 +132,18 @@ Bool_t AliRsnCut::OkValueI() // with a reference integer value to which it must be equal. // - // eval result - fCutResult = (fCutValueI == fMinI); - - // print debug message - AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); - AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); - AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI)); - AliDebug(AliLog::kDebug + 2, Form("Cut value : %d", fMinI)); - AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); - AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); - - return fCutResult; + // eval result + fCutResult = (fCutValueI == fMinI); + + // print debug message + AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); + AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); + AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI)); + AliDebug(AliLog::kDebug + 2, Form("Cut value : %d", fMinI)); + AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); + AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); + + return fCutResult; } //______________________________________________________________________________ @@ -154,18 +154,18 @@ Bool_t AliRsnCut::OkValueD() // with a reference double value to which it must be equal (or at least, almost). // - // eval result - fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6); - - // print debug message - AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); - AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); - AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD)); - AliDebug(AliLog::kDebug + 2, Form("Cut value : %f", fMinD)); - AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); - AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); - - return fCutResult; + // eval result + fCutResult = (TMath::Abs(fCutValueD - fMinD) < 1E-6); + + // print debug message + AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); + AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); + AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD)); + AliDebug(AliLog::kDebug + 2, Form("Cut value : %f", fMinD)); + AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); + AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); + + return fCutResult; } //______________________________________________________________________________ @@ -177,18 +177,18 @@ Bool_t AliRsnCut::OkRangeI() // Then, the cut result is kTRUE if the cut value is inside this range. // - // eval result - fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI)); - - // print debug message - AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); - AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); - AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI)); - AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinI, fMaxI)); - AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); - AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); - - return fCutResult; + // eval result + fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI)); + + // print debug message + AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); + AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); + AliDebug(AliLog::kDebug + 2, Form("Checked value: %d", fCutValueI)); + AliDebug(AliLog::kDebug + 2, Form("Cut range : %d , %d", fMinI, fMaxI)); + AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); + AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); + + return fCutResult; } //______________________________________________________________________________ @@ -200,18 +200,18 @@ Bool_t AliRsnCut::OkRangeD() // Then, the cut result is kTRUE if the cut value is inside this range. // - // eval result - fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD)); - - // print debug message - AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); - AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); - AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD)); - AliDebug(AliLog::kDebug + 2, Form("Cut range : %f , %f", fMinD, fMaxD)); - AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); - AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); + // eval result + fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD)); + + // print debug message + AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ===================================="); + AliDebug(AliLog::kDebug + 2, Form("Cut name : %s", GetName())); + AliDebug(AliLog::kDebug + 2, Form("Checked value: %f", fCutValueD)); + AliDebug(AliLog::kDebug + 2, Form("Cut range : %f , %f", fMinD, fMaxD)); + AliDebug(AliLog::kDebug + 2, Form("Cut result : %s", (fCutResult ? "PASSED" : "NOT PASSED"))); + AliDebug(AliLog::kDebug + 2, "=== END CUT DEBUG ================================"); - return fCutResult; + return fCutResult; } //______________________________________________________________________________ @@ -222,10 +222,10 @@ void AliRsnCut::Print(Option_t*) const // and print some useful info about the cut general parameters. // - AliInfo("=== CUT DETAILS ===================================="); - AliInfo(Form("Cut name : [%s]", GetName())); - AliInfo(Form("Cut target : [%s]", GetTargetTypeName())); - AliInfo(Form("Cut edges [D]: [%f - %f]", fMinD, fMaxD)); - AliInfo(Form("Cut edges [I]: [%d - %d]", fMinI, fMaxI)); - AliInfo("===================================================="); + AliInfo("=== CUT DETAILS ===================================="); + AliInfo(Form("Cut name : [%s]", GetName())); + AliInfo(Form("Cut target : [%s]", GetTargetTypeName())); + AliInfo(Form("Cut edges [D]: [%f - %f]", fMinD, fMaxD)); + AliInfo(Form("Cut edges [I]: [%d - %d]", fMinI, fMaxI)); + AliInfo("===================================================="); } diff --git a/PWG2/RESONANCES/AliRsnCut.h b/PWG2/RESONANCES/AliRsnCut.h index c9771938122..a8f60a933e9 100644 --- a/PWG2/RESONANCES/AliRsnCut.h +++ b/PWG2/RESONANCES/AliRsnCut.h @@ -20,52 +20,51 @@ class AliRsnEvent; -class AliRsnCut : public AliRsnTarget -{ - public: - - AliRsnCut(const char *name = "dummy", RSNTARGET target = AliRsnTarget::kTargetTypes); - AliRsnCut(const char *name, RSNTARGET target, Int_t imin, Int_t imax=0 , Double_t dmin=0., Double_t dmax=0.); - AliRsnCut(const char *name, RSNTARGET target, Double_t dmin, Double_t dmax=0., Int_t imin=0 , Int_t imax=0 ); - AliRsnCut(const AliRsnCut& copy); - AliRsnCut& operator=(const AliRsnCut& copy); - virtual ~AliRsnCut() { }; - - Int_t GetMinI() {return fMinI;} - Int_t GetMaxI() {return fMaxI;} - Double_t GetMinD() {return fMinD;} - Double_t GetMaxD() {return fMaxD;} - Int_t GetCutValueI() {return fCutValueI;} - Double_t GetCutValueD() {return fCutValueD;} - Bool_t GetCutResult() {return fCutResult;} - - void SetRangeI(Int_t min, Int_t max) {fMinI = min; fMaxI = max;} - void SetRangeD(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} - - void SetValueI(Int_t value) {fMinI = value;} - void SetValueD(Double_t value) {fMinD = value;} - - Bool_t OkValueI(); - Bool_t OkRangeI(); - Bool_t OkValueD(); - Bool_t OkRangeD(); - - virtual Bool_t IsSelected(TObject *object); - virtual void Print(Option_t *opt = "") const; - - protected: - - Int_t fMinI; // lower edge of INT range or ref. value for INT CUT - Int_t fMaxI; // upper edge of INT range (not used for value cuts) - Double_t fMinD; // lower edge of DOUBLE range or ref. value for DOUBLE CUT - Double_t fMaxD; // upper edge of DOUBLE range (not used for value cuts) - - Int_t fCutValueI; // cut value INT - Double_t fCutValueD; // cut value DOUBLE - - Bool_t fCutResult; // tells if the cut is passed or not - - ClassDef(AliRsnCut, 1) +class AliRsnCut : public AliRsnTarget { +public: + + AliRsnCut(const char *name = "dummy", RSNTARGET target = AliRsnTarget::kTargetTypes); + AliRsnCut(const char *name, RSNTARGET target, Int_t imin, Int_t imax = 0 , Double_t dmin = 0., Double_t dmax = 0.); + AliRsnCut(const char *name, RSNTARGET target, Double_t dmin, Double_t dmax = 0., Int_t imin = 0 , Int_t imax = 0); + AliRsnCut(const AliRsnCut& copy); + AliRsnCut& operator=(const AliRsnCut& copy); + virtual ~AliRsnCut() { }; + + Int_t GetMinI() {return fMinI;} + Int_t GetMaxI() {return fMaxI;} + Double_t GetMinD() {return fMinD;} + Double_t GetMaxD() {return fMaxD;} + Int_t GetCutValueI() {return fCutValueI;} + Double_t GetCutValueD() {return fCutValueD;} + Bool_t GetCutResult() {return fCutResult;} + + void SetRangeI(Int_t min, Int_t max) {fMinI = min; fMaxI = max;} + void SetRangeD(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} + + void SetValueI(Int_t value) {fMinI = value;} + void SetValueD(Double_t value) {fMinD = value;} + + Bool_t OkValueI(); + Bool_t OkRangeI(); + Bool_t OkValueD(); + Bool_t OkRangeD(); + + virtual Bool_t IsSelected(TObject *object); + virtual void Print(Option_t *opt = "") const; + +protected: + + Int_t fMinI; // lower edge of INT range or ref. value for INT CUT + Int_t fMaxI; // upper edge of INT range (not used for value cuts) + Double_t fMinD; // lower edge of DOUBLE range or ref. value for DOUBLE CUT + Double_t fMaxD; // upper edge of DOUBLE range (not used for value cuts) + + Int_t fCutValueI; // cut value INT + Double_t fCutValueD; // cut value DOUBLE + + Bool_t fCutResult; // tells if the cut is passed or not + + ClassDef(AliRsnCut, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnCutAOD2010.cxx b/PWG2/RESONANCES/AliRsnCutAOD2010.cxx deleted file mode 100644 index fd639de0ff8..00000000000 --- a/PWG2/RESONANCES/AliRsnCutAOD2010.cxx +++ /dev/null @@ -1,376 +0,0 @@ -// -// Class AliRsnCutAOD2010 -// -// General implementation of a single cut strategy, which can be: -// - a value contained in a given interval [--> IsBetween() ] -// - a value equal to a given reference [--> MatchesValue()] -// -// In all cases, the reference value(s) is (are) given as data members -// and each kind of cut requires a given value type (Int, UInt, Double), -// but the cut check procedure is then automatized and chosen thanks to -// an enumeration of the implemented cut types. -// At the end, the user (or any other point which uses this object) has -// to use the method IsSelected() to check if this cut has been passed. -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// - -#include - -#include - -#include "AliESDtrack.h" -#include "AliAODTrack.h" - -#include "AliRsnEvent.h" -#include "AliRsnDaughter.h" -#include "AliRsnCutAOD2010.h" - -ClassImp(AliRsnCutAOD2010) - - -//_________________________________________________________________________________________________ -AliRsnCutAOD2010::AliRsnCutAOD2010(const char *name, Bool_t isMC) : - AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0), - - fIsMC(kFALSE), - fCheckITS(kTRUE), - fCheckTPC(kTRUE), - fCheckTOF(kTRUE), - fUseGlobal(kTRUE), - fUseITSSA(kTRUE), - - fMaxEta(1E6), - - fPIDtype(AliPID::kKaon), - - fTPCminNclusters(70), - fTPCmaxChi2(4.0), - fTPCmaxNSigmaDCA(7.0), - fTPClowBand(5.0), - fTPChighBand(3.0), - fTPClowLimit(0.35), - - fITSminNclusters(4), - fITSmaxChi2(2.5), - fITSmaxNSigmaDCA(7.0), - fITSband(3.0), - - fTOFlowLimit(-2.5), - fTOFhighLimit(3.5), - - fPID() -{ -// -// Default constructor. -// Sets all parameters to the currently used values, and requires -// to know if we are running on data or MonteCarlo to set some others. -// - - fTPCparamDCA[0] = 0.0050; - fTPCparamDCA[1] = 0.0070; - fTPCparamDCA[2] = 1.0000; - - fITSparamDCA[0] = 0.0085; - fITSparamDCA[1] = 0.0026; - fITSparamDCA[2] = 1.5500; - - SetMC(isMC); -} - -//_________________________________________________________________________________________________ -AliRsnCutAOD2010::AliRsnCutAOD2010 -(const AliRsnCutAOD2010& copy) : - AliRsnCut(copy), - - fIsMC(copy.fIsMC), - fCheckITS(copy.fCheckITS), - fCheckTPC(copy.fCheckTPC), - fCheckTOF(copy.fCheckTOF), - fUseGlobal(copy.fUseGlobal), - fUseITSSA(copy.fUseITSSA), - - fMaxEta(copy.fMaxEta), - - fPIDtype(copy.fPIDtype), - - fTPCminNclusters(copy.fTPCminNclusters), - fTPCmaxChi2(copy.fTPCmaxChi2), - fTPCmaxNSigmaDCA(copy.fTPCmaxNSigmaDCA), - fTPClowBand(copy.fTPClowBand), - fTPChighBand(copy.fTPChighBand), - fTPClowLimit(copy.fTPClowLimit), - - fITSminNclusters(copy.fITSminNclusters), - fITSmaxChi2(copy.fITSmaxChi2), - fITSmaxNSigmaDCA(copy.fITSmaxNSigmaDCA), - fITSband(copy.fITSband), - - fTOFlowLimit(copy.fTOFlowLimit), - fTOFhighLimit(copy.fTOFhighLimit), - - fPID(copy.fPID) -{ -// -// Copy constructor -// - - Int_t i = 0; - for (i = 0; i < 3; i++) - { - fTPCparamDCA[i] = copy.fTPCparamDCA[i]; - fITSparamDCA[i] = copy.fITSparamDCA[i]; - } -} - -//_________________________________________________________________________________________________ -void AliRsnCutAOD2010::SetMC(Bool_t yn) -{ -// -// Sets some parameters depending on MC or dataanalysis -// - - fIsMC = yn; - - if (fIsMC) - { - AliDebug(AliLog::kDebug + 2, "Setting for MC"); - fPID.GetTPCResponse().SetBetheBlochParameters(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720); - } - else - { - AliDebug(AliLog::kDebug + 2, "Setting for DATA"); - fPID.GetTPCResponse().SetBetheBlochParameters(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663); - } - - AliITSPIDResponse itsrsp(fIsMC); - fPID.GetITSResponse() = itsrsp; -} - -//_________________________________________________________________________________________________ -Bool_t AliRsnCutAOD2010::IsSelected(TObject *object) -{ -// -// Cut checker. -// - - // coherence check: require an AOD track - AliRsnDaughter *daughter = dynamic_cast(object); - if (!daughter) return kFALSE; - AliAODTrack *track = daughter->GetRefAODtrack(); - if (!track) return kFALSE; - - // step #0: check presence of an SPD cluster - Int_t nITS = 0, nSPD = 0; - nSPD = TESTBIT(track->GetITSClusterMap(), 0); - nSPD += TESTBIT(track->GetITSClusterMap(), 1); - nITS = track->GetITSNcls() - nSPD; - if (nSPD <= 0) - { - AliDebug(AliLog::kDebug + 2, "No SPD clusters in this track. Rejected"); - return kFALSE; - } - - // step #1: check status flags and reject track if it does not match any possibility - Bool_t isTPC, isTOF; - if (!track->IsOn(AliESDtrack::kTPCin) && track->IsOn(AliESDtrack::kITSrefit) && (!track->IsOn(AliESDtrack::kITSpureSA))) - { - isTPC = kFALSE; - isTOF = kFALSE; - if (!fUseITSSA) - { - AliDebug(AliLog::kDebug + 2, "ITS standalone not used. Rejected"); - return kFALSE; - } - } - else if (track->IsOn(AliESDtrack::kTPCin) && track->IsOn(AliESDtrack::kTPCrefit) && track->IsOn(AliESDtrack::kITSrefit)) - { - isTPC = kTRUE; - if (!fUseGlobal) - { - AliDebug(AliLog::kDebug + 2, "ITS standalone not used. Rejected"); - return kFALSE; - } - if (track->IsOn(AliESDtrack::kTOFout) && track->IsOn(AliESDtrack::kTIME)) - isTOF = kTRUE; - else - isTOF = kFALSE; - } - else - { - AliDebug(AliLog::kDebug + 2, "Track is not either a TPC track or a ITS standalone. Rejected"); - return kFALSE; - } - - // step #2: check number of clusters - if (isTPC) - { - if (track->GetTPCNcls() < fTPCminNclusters) - { - AliDebug(AliLog::kDebug + 2, "Too few clusters. Rejected"); - return kFALSE; - } - } - else - { - if (track->GetITSNcls() < fITSminNclusters) - { - AliDebug(AliLog::kDebug + 2, "Too few clusters. Rejected"); - return kFALSE; - } - } - - // step #3: check chi square - if (isTPC) - { - if (track->Chi2perNDF() > fTPCmaxChi2) - { - AliDebug(AliLog::kDebug + 2, "Bad chi2. Rejected"); - return kFALSE; - } - } - else - { - if (track->Chi2perNDF() > fITSmaxChi2) - { - AliDebug(AliLog::kDebug + 2, "Bad chi2. Rejected"); - return kFALSE; - } - } - - // step #4: reject kink daughters - AliAODVertex *vertex = track->GetProdVertex(); - if (isTPC && vertex != 0x0) - { - if (vertex->GetType() == AliAODVertex::kKink) - { - AliDebug(AliLog::kDebug + 2, "Kink daughter. Rejected"); - return kFALSE; - } - } - - // step #5: DCA cut (transverse) - Double_t dz[2], cov[3], sigmaDCA = 0.0, nsigma = 0.0; - vertex = AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetPrimaryVertex(); - if (!vertex) - { - AliDebug(AliLog::kDebug + 2, "NULL vertex"); - return kFALSE; - } - if (!track->PropagateToDCA(vertex, AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetMagneticField(), kVeryBig, dz, cov)) - { - AliDebug(AliLog::kDebug + 2, "Failed propagation to vertex"); - return kFALSE; - } - // compute the pt-dependent sigma - if (isTPC) - { - sigmaDCA = fTPCparamDCA[0] + fTPCparamDCA[1] / TMath::Power(track->Pt(), fTPCparamDCA[2]); - nsigma = fTPCmaxNSigmaDCA; - } - else - { - sigmaDCA = fITSparamDCA[0] + fITSparamDCA[1] / TMath::Power(track->Pt(), fITSparamDCA[2]); - nsigma = fITSmaxNSigmaDCA; - } - // check the DCA - if (dz[0] > nsigma * sigmaDCA) - { - AliDebug(AliLog::kDebug + 2, "Excceeded cut in DCA. Rejected"); - return kFALSE; - } - - // step #6: check eta range - if (TMath::Abs(track->Eta()) >= fMaxEta) - { - AliDebug(AliLog::kDebug + 2, "Outside ETA acceptance"); - return kFALSE; - } - - // step #7: PID cuts - if (isTPC) - { - if (fCheckTPC) - { - AliAODPid *pidObj = track->GetDetPid(); - Double_t mom = pidObj->GetTPCmomentum(); - Double_t nsigmaTPC = fPID.NumberOfSigmasTPC(track, fPIDtype); - Double_t bandTPC = fTPChighBand; - if (mom <= fTPClowLimit) bandTPC = fTPClowBand; - if (TMath::Abs(nsigmaTPC) > bandTPC) - { - AliDebug(AliLog::kDebug + 2, "Bad TPC PID. Rejected"); - return kFALSE; - } - else - { - AliDebug(AliLog::kDebug + 2, "Good TPC PID"); - if (fCheckTOF && isTOF) - { - Double_t nsigmaTOF = (Double_t)fPID.NumberOfSigmasTOF(track, fPIDtype); - if (nsigmaTOF < fTOFlowLimit || nsigmaTOF > fTOFhighLimit) - { - AliDebug(AliLog::kDebug + 2, "Bad TOF PID. Rejected"); - return kFALSE; - } - else - { - AliDebug(AliLog::kDebug + 2, "Good TOF PID. Accepted"); - return kFALSE; - } - } - else - { - AliDebug(AliLog::kDebug + 2, "TOF not checked. Accepted"); - return kTRUE; - } - } - } - else - { - if (fCheckTOF && isTOF) - { - Double_t nsigmaTOF = (Double_t)fPID.NumberOfSigmasTOF(track, fPIDtype); - if (nsigmaTOF < fTOFlowLimit || nsigmaTOF > fTOFhighLimit) - { - AliDebug(AliLog::kDebug + 2, "Bad TOF PID. Rejected"); - return kFALSE; - } - else - { - AliDebug(AliLog::kDebug + 2, "Good TOF PID. Accepted"); - return kFALSE; - } - } - else - { - AliDebug(AliLog::kDebug + 2, "No PID checked. Accepted"); - return kTRUE; - } - } - } - else - { - if (fCheckITS) - { - if (nITS < 3 || !track->IsOn(AliESDtrack::kITSpid)) return kFALSE; - Double_t nsigmaITS = (Double_t)fPID.NumberOfSigmasITS(track, fPIDtype); - if (TMath::Abs(nsigmaITS) > fITSband) - { - AliDebug(AliLog::kDebug + 2, "Bad ITS PID. Rejected"); - return kFALSE; - } - else - { - AliDebug(AliLog::kDebug + 2, "Good ITS PID. Accepted"); - return kFALSE; - } - } - else - { - AliDebug(AliLog::kDebug + 2, "No PID checked. Accepted"); - return kTRUE; - } - } -} diff --git a/PWG2/RESONANCES/AliRsnCutAOD2010.h b/PWG2/RESONANCES/AliRsnCutAOD2010.h deleted file mode 100644 index 869efb6f1bd..00000000000 --- a/PWG2/RESONANCES/AliRsnCutAOD2010.h +++ /dev/null @@ -1,97 +0,0 @@ -// -// Class AliRsnCutRange -// -// General implementation of cuts which check a value inside a range. -// This range can be defined by two integers or two doubles. -// A user-friendly enumeration allows to define what is checked. -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// - -#ifndef ALIRSNCUTAOD2010_H -#define ALIRSNCUTAOD2010_H - -#include "AliPID.h" -#include "AliAODTrack.h" -#include "AliAODpidUtil.h" - -#include "AliRsnCut.h" - -class AliRsnCutAOD2010 : public AliRsnCut -{ - public: - - AliRsnCutAOD2010(const char *name = "cutAOD2010", Bool_t isMC = kFALSE); - AliRsnCutAOD2010(const AliRsnCutAOD2010& copy); - virtual ~AliRsnCutAOD2010() {;}; - - virtual Bool_t IsSelected(TObject *object); - - void SetMC (Bool_t yn = kTRUE); - void SetCheckITS (Bool_t yn = kTRUE) {fCheckITS = yn;} - void SetCheckTPC (Bool_t yn = kTRUE) {fCheckTPC = yn;} - void SetCheckTOF (Bool_t yn = kTRUE) {fCheckTOF = yn;} - void SetUseGlobal(Bool_t yn = kTRUE) {fUseGlobal = yn;} - void SetUseITSSA (Bool_t yn = kTRUE) {fUseITSSA = yn;} - void SetPIDtype (AliPID::EParticleType pid) {fPIDtype = pid;} - void SetMaxEta (Double_t eta) {fMaxEta = eta;} - - void SetTPCminNclusters(Int_t v) {fTPCminNclusters = v;} - void SetTPCmaxChi2(Double_t v) {fTPCmaxChi2 = v;} - void SetTPCmaxNSigmaDCA(Double_t v) {fTPCmaxNSigmaDCA = v;} - void SetTPCparamDCA(Int_t i, Double_t v) {if (i >= 0 && i < 3) fTPCparamDCA[i] = v;} - void SetTPClowBand(Double_t v) {fTPClowBand = v;} - void SetTPChighBand(Double_t v) {fTPChighBand = v;} - void SetTPClowLimit(Double_t v) {fTPClowLimit = v;} - - void SetITSminNclusters(Int_t v) {fITSminNclusters = v;} - void SetITSmaxChi2(Double_t v) {fITSmaxChi2 = v;} - void SetITSmaxNSigmaDCA(Double_t v) {fITSmaxNSigmaDCA = v;} - void SetITSparamDCA(Int_t i, Double_t v) {if (i >= 0 && i < 3) fITSparamDCA[i] = v;} - void SetITSparamBB(Int_t i, Double_t v) {if (i >= 0 && i < 3) fITSparamBB[i] = v;} - void SetITSband(Double_t v) {fITSband = v;} - - void SetTOFrange(Double_t v1, Double_t v2) {fTOFlowLimit = v1; fTOFhighLimit = v2;} - - AliAODpidUtil* GetPIDUtil() {return &fPID;} - - protected: - - AliRsnCutAOD2010& operator=(const AliRsnCutAOD2010& /*copy*/) {return (*this);} - - Bool_t fIsMC; // switch for MC analysis - Bool_t fCheckITS; // switch for ITS dE/dx check - Bool_t fCheckTPC; // switch for TPC dE/dx check - Bool_t fCheckTOF; // switch for TOF time check - Bool_t fUseGlobal; // switch to use TPC global tracks - Bool_t fUseITSSA; // switch to use ITS standalone tracks - - Double_t fMaxEta; // eta range for tracks - - AliPID::EParticleType fPIDtype; // particle type for which PID is checked - - Int_t fTPCminNclusters; // minimum number of clusters in TPC - Double_t fTPCmaxChi2; // maximum chi2 / number of clusters in TPC - Double_t fTPCmaxNSigmaDCA; // cut in DCA (transv) in numbers of sigma (pt-dependent) - Double_t fTPCparamDCA[3]; // parameters to compute sigma for DCA - Double_t fTPClowBand; // large band for low momentum PID - Double_t fTPChighBand; // large band for low momentum PID - Double_t fTPClowLimit; // limit of low momentum region - - Int_t fITSminNclusters; // minimum number of clusters in TPC - Double_t fITSmaxChi2; // maximum chi2 / number of clusters in TPC - Double_t fITSmaxNSigmaDCA; // cut in DCA (transv) in numbers of sigma (pt-dependent) - Double_t fITSparamDCA[3]; // parameters to compute sigma for DCA - Double_t fITSparamBB[5]; // parameters for TPC Bethe-Bloch parameterization - Double_t fITSband; // fiducial region for selection of PID - - Double_t fTOFlowLimit; // low limit in asymmetric TOF PID cut - Double_t fTOFhighLimit; // low limit in asymmetric TOF PID cut - - AliAODpidUtil fPID; // PID utility - - ClassDef(AliRsnCutAOD2010, 1) -}; - -#endif diff --git a/PWG2/RESONANCES/AliRsnCutESD2010.cxx b/PWG2/RESONANCES/AliRsnCutESD2010.cxx index 8ef753d7311..bc2314460e3 100644 --- a/PWG2/RESONANCES/AliRsnCutESD2010.cxx +++ b/PWG2/RESONANCES/AliRsnCutESD2010.cxx @@ -43,62 +43,64 @@ Int_t AliRsnCutESD2010::fgLastEventID = -1; //_________________________________________________________________________________________________ AliRsnCutESD2010::AliRsnCutESD2010 (const char *name, Bool_t isMC) : - AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0), - fIsMC(isMC), - fCheckITS(kTRUE), - fCheckTPC(kTRUE), - fCheckTOF(kTRUE), - fUseITSTPC(kTRUE), - fUseITSSA(kTRUE), - fPID(AliPID::kKaon), - fMaxITSPIDmom(0.0), - fMaxITSband(3.0), - fTPCpLimit(0.35), - fMinTPCband(3.0), - fMaxTPCband(5.0), - fESDpid(), - fESDtrackCutsTPC(), - fESDtrackCutsITS(), - fMinTOF(-3.0), - fMaxTOF( 3.0) + AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0), + fIsMC(isMC), + fCheckITS(kTRUE), + fCheckTPC(kTRUE), + fCheckTOF(kTRUE), + fUseITSTPC(kTRUE), + fUseITSSA(kTRUE), + fPID(AliPID::kKaon), + fMaxITSPIDmom(0.0), + fMaxITSband(3.0), + fTPCpLimit(0.35), + fMinTPCband(3.0), + fMaxTPCband(5.0), + fESDpid(), + fESDtrackCutsTPC(), + fESDtrackCutsITS(), + fMinTOF(-3.0), + fMaxTOF(3.0), + fOCDBDefaultStorage("raw://") { // // Main constructor. // - SetMC(isMC); + SetMC(isMC); } //_________________________________________________________________________________________________ AliRsnCutESD2010::AliRsnCutESD2010 (const AliRsnCutESD2010& copy) : - AliRsnCut(copy), - fIsMC(copy.fIsMC), - fCheckITS(copy.fCheckITS), - fCheckTPC(copy.fCheckTPC), - fCheckTOF(copy.fCheckTOF), - fUseITSTPC(copy.fUseITSTPC), - fUseITSSA(copy.fUseITSSA), - fPID(copy.fPID), - fMaxITSPIDmom(copy.fMaxITSPIDmom), - fMaxITSband(copy.fMaxITSband), - fTPCpLimit(copy.fTPCpLimit), - fMinTPCband(copy.fMinTPCband), - fMaxTPCband(copy.fMaxTPCband), - fESDpid(copy.fESDpid), - fESDtrackCutsTPC(copy.fESDtrackCutsTPC), - fESDtrackCutsITS(copy.fESDtrackCutsITS), - fMinTOF(copy.fMinTOF), - fMaxTOF(copy.fMaxTOF) + AliRsnCut(copy), + fIsMC(copy.fIsMC), + fCheckITS(copy.fCheckITS), + fCheckTPC(copy.fCheckTPC), + fCheckTOF(copy.fCheckTOF), + fUseITSTPC(copy.fUseITSTPC), + fUseITSSA(copy.fUseITSSA), + fPID(copy.fPID), + fMaxITSPIDmom(copy.fMaxITSPIDmom), + fMaxITSband(copy.fMaxITSband), + fTPCpLimit(copy.fTPCpLimit), + fMinTPCband(copy.fMinTPCband), + fMaxTPCband(copy.fMaxTPCband), + fESDpid(copy.fESDpid), + fESDtrackCutsTPC(copy.fESDtrackCutsTPC), + fESDtrackCutsITS(copy.fESDtrackCutsITS), + fMinTOF(copy.fMinTOF), + fMaxTOF(copy.fMaxTOF), + fOCDBDefaultStorage(copy.fOCDBDefaultStorage) { // // Copy constructor. // - SetMC(copy.fIsMC); + SetMC(copy.fIsMC); - Int_t i = 0; - for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i]; + Int_t i = 0; + for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i]; } //_________________________________________________________________________________________________ @@ -108,33 +110,33 @@ AliRsnCutESD2010& AliRsnCutESD2010::operator=(const AliRsnCutESD2010& copy) // Assignment operator // - AliRsnCut::operator=(copy); - - SetMC(copy.fIsMC); - - fCheckITS = copy.fCheckITS; - fCheckTPC = copy.fCheckTPC; - fCheckTOF = copy.fCheckTOF; - fUseITSTPC = copy.fUseITSTPC; - fUseITSSA = copy.fUseITSSA; - fPID = copy.fPID; - fMaxITSPIDmom = copy.fMaxITSPIDmom; - fMaxITSband = copy.fMaxITSband; - fTPCpLimit = copy.fTPCpLimit; - fMinTPCband = copy.fMinTPCband; - fMaxTPCband = copy.fMaxTPCband; - fMinTOF = copy.fMinTOF; - fMaxTOF = copy.fMaxTOF; - fESDpid = copy.fESDpid; - - Int_t i = 0; - for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i]; - - - fESDtrackCutsTPC = copy.fESDtrackCutsTPC; - fESDtrackCutsITS = copy.fESDtrackCutsITS; - - return (*this); + AliRsnCut::operator=(copy); + + SetMC(copy.fIsMC); + + fCheckITS = copy.fCheckITS; + fCheckTPC = copy.fCheckTPC; + fCheckTOF = copy.fCheckTOF; + fUseITSTPC = copy.fUseITSTPC; + fUseITSSA = copy.fUseITSSA; + fPID = copy.fPID; + fMaxITSPIDmom = copy.fMaxITSPIDmom; + fMaxITSband = copy.fMaxITSband; + fTPCpLimit = copy.fTPCpLimit; + fMinTPCband = copy.fMinTPCband; + fMaxTPCband = copy.fMaxTPCband; + fMinTOF = copy.fMinTOF; + fMaxTOF = copy.fMaxTOF; + fESDpid = copy.fESDpid; + fOCDBDefaultStorage = copy.fOCDBDefaultStorage; + Int_t i = 0; + for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i]; + + + fESDtrackCutsTPC = copy.fESDtrackCutsTPC; + fESDtrackCutsITS = copy.fESDtrackCutsITS; + + return (*this); } //_________________________________________________________________________________________________ @@ -144,69 +146,61 @@ void AliRsnCutESD2010::SetMC(Bool_t isMC) // Sets some aspects of cuts depending on the fact that runs on MC or not // - fIsMC = isMC; - - AliITSPIDResponse itsresponse(fIsMC); - fESDpid.GetITSResponse() = itsresponse; - - if (isMC) - { - //fgTOFcalibrateESD = kFALSE; - fgTOFtuneMC = kTRUE; - } - else - { - //fgTOFcalibrateESD = kTRUE; - fgTOFtuneMC = kFALSE; - } + fIsMC = isMC; + + AliITSPIDResponse itsresponse(fIsMC); + fESDpid.GetITSResponse() = itsresponse; + + if (isMC) { + //fgTOFcalibrateESD = kFALSE; + fgTOFtuneMC = kTRUE; + } else { + //fgTOFcalibrateESD = kTRUE; + fgTOFtuneMC = kFALSE; + } } //_________________________________________________________________________________________________ void AliRsnCutESD2010::ProcessEvent(AliESDEvent *esd) { - // get current run - Int_t run = esd->GetRunNumber(); - - // if the run number has changed, update it now and give a message - if (run != fgLastRun) - { - AliInfo("============================================================================================"); - AliInfo(Form("*** CHANGING RUN NUMBER: PREVIOUS = %d --> CURRENT = %d ***", fgLastRun, run)); - AliInfo("============================================================================================"); - fgLastRun = run; - - AliCDBManager::Instance()->SetDefaultStorage("raw://"); - AliCDBManager::Instance()->SetRun(fgLastRun); - - if (fgTOFmaker) delete fgTOFmaker; - if (fgTOFcalib) delete fgTOFcalib; - - fgTOFcalib = new AliTOFcalib(); - if (fIsMC) - { - fgTOFcalib->SetRemoveMeanT0(kFALSE); - fgTOFcalib->SetCalibrateTOFsignal(kFALSE); - } - else - { - fgTOFcalib->SetRemoveMeanT0(kTRUE); - fgTOFcalib->SetCalibrateTOFsignal(kTRUE); - } - if (fgTOFcorrectTExp) fgTOFcalib->SetCorrectTExp(kTRUE); - fgTOFcalib->Init(); - - fgTOFmaker = new AliTOFT0maker(&fESDpid, fgTOFcalib); - fgTOFmaker->SetTimeResolution(fgTOFresolution); - } - - /*if (fgTOFcalibrateESD)*/ fgTOFcalib->CalibrateESD(esd); - if (fgTOFtuneMC) fgTOFmaker->TuneForMC(esd); - if (fgTOFuseT0) - { - fgTOFmaker->ComputeT0TOF(esd); - fgTOFmaker->ApplyT0TOF(esd); - fESDpid.MakePID(esd, kFALSE, 0.); - } + // get current run + Int_t run = esd->GetRunNumber(); + + // if the run number has changed, update it now and give a message + if (run != fgLastRun) { + AliInfo("============================================================================================"); + AliInfo(Form("*** CHANGING RUN NUMBER: PREVIOUS = %d --> CURRENT = %d ***", fgLastRun, run)); + AliInfo("============================================================================================"); + fgLastRun = run; + + AliCDBManager::Instance()->SetDefaultStorage(fOCDBDefaultStorage.Data()); + AliCDBManager::Instance()->SetRun(fgLastRun); + + if (fgTOFmaker) delete fgTOFmaker; + if (fgTOFcalib) delete fgTOFcalib; + + fgTOFcalib = new AliTOFcalib(); + if (fIsMC) { + fgTOFcalib->SetRemoveMeanT0(kFALSE); + fgTOFcalib->SetCalibrateTOFsignal(kFALSE); + } else { + fgTOFcalib->SetRemoveMeanT0(kTRUE); + fgTOFcalib->SetCalibrateTOFsignal(kTRUE); + } + if (fgTOFcorrectTExp) fgTOFcalib->SetCorrectTExp(kTRUE); + fgTOFcalib->Init(); + + fgTOFmaker = new AliTOFT0maker(&fESDpid, fgTOFcalib); + fgTOFmaker->SetTimeResolution(fgTOFresolution); + } + + /*if (fgTOFcalibrateESD)*/ fgTOFcalib->CalibrateESD(esd); + if (fgTOFtuneMC) fgTOFmaker->TuneForMC(esd); + if (fgTOFuseT0) { + fgTOFmaker->ComputeT0TOF(esd); + fgTOFmaker->ApplyT0TOF(esd); + fESDpid.MakePID(esd, kFALSE, 0.); + } } //_________________________________________________________________________________________________ @@ -216,84 +210,73 @@ Bool_t AliRsnCutESD2010::IsSelected(TObject *object) // Cut checker. // - // coherence check: require an ESD track - AliRsnDaughter *daughter = dynamic_cast(object); - if (!daughter) return kFALSE; - AliESDtrack *track = daughter->GetRefESDtrack(); - if (!track) return kFALSE; - - // if no reference event, skip - AliRsnEvent *rsn = AliRsnTarget::GetCurrentEvent(); - if (!rsn) return kFALSE; - if (fgLastEventID != rsn->GetLocalID()) - { - ProcessEvent(rsn->GetRefESD()); - fgLastEventID = rsn->GetLocalID(); - } - - // check quality and track type and reject tracks not passing this step - if (!OkQuality(track)) - { - AliDebug(AliLog::kDebug+2, "Failed quality cut"); - return kFALSE; - } - - // ITS PID can be checked always - // if PID is not required, the flag is sed as - // if the cut was alsways passed - Bool_t okITSpid = OkITSPID(track); - if (!fCheckITS) okITSpid = kTRUE; - - // TPC PID can be checked only for TPC+ITS tracks - // if PID is not required, the flag is sed as - // if the cut was alsways passed - Bool_t okTPCpid = kFALSE; - if (IsITSTPC(track)) okTPCpid = OkTPCPID(track); - if (!fCheckTPC) okTPCpid = kTRUE; - - // TOF PID can be checked only if TOF is matched - // if PID is not required, the flag is sed as - // if the cut was alsways passed - Bool_t okTOFpid = kFALSE; - if (IsITSTPC(track) && MatchTOF(track)) okTOFpid = OkTOFPID(track); - if (!fCheckTOF) okTOFpid = kTRUE; - - // now combine all outcomes according to the different possibilities: - // -- ITS standalone: - // --> only ITS PID, always - // -- ITS + TPC: - // --> ITS PID, only for momenta lower than 'fMaxITSPIDmom' and when the ITSpid flag is active - // --> TPC PID, always --> MASTER (first to be checked, if fails, track is rejected) - // --> TOF PID, only if matched - if (IsITSSA(track)) - { - if (!okITSpid) - { - AliDebug(AliLog::kDebug+2, "ITS standalone track --> ITS PID failed"); - return kFALSE; - } - } - else // checking IsITSTPC() is redundant due to OkQuality() cut check - { - if (!okTPCpid) - { - AliDebug(AliLog::kDebug+2, "ITS+TPC track --> TPC PID failed"); + // coherence check: require an ESD track + AliRsnDaughter *daughter = dynamic_cast(object); + if (!daughter) return kFALSE; + AliESDtrack *track = daughter->GetRefESDtrack(); + if (!track) return kFALSE; + + // if no reference event, skip + AliRsnEvent *rsn = AliRsnTarget::GetCurrentEvent(); + if (!rsn) return kFALSE; + if (fgLastEventID != rsn->GetLocalID()) { + ProcessEvent(rsn->GetRefESD()); + fgLastEventID = rsn->GetLocalID(); + } + + // check quality and track type and reject tracks not passing this step + if (!OkQuality(track)) { + AliDebug(AliLog::kDebug + 2, "Failed quality cut"); return kFALSE; - } - else if (MatchTOF(track) && !okTOFpid) - { - AliDebug(AliLog::kDebug+2, "ITS+TPC track --> TOF matched but TOF PID failed"); - return kFALSE; - } - else if (track->IsOn(AliESDtrack::kITSpid) && track->P() <= fMaxITSPIDmom && !okITSpid) - { - AliDebug(AliLog::kDebug+2, Form("ITS+TPC track --> Momentum lower than limit (%.2f) and ITS PID failed", fMaxITSPIDmom)); - return kFALSE; - } - } - - // arriving here, the track has survived all checks - return kTRUE; + } + + // ITS PID can be checked always + // if PID is not required, the flag is sed as + // if the cut was alsways passed + Bool_t okITSpid = OkITSPID(track); + if (!fCheckITS) okITSpid = kTRUE; + + // TPC PID can be checked only for TPC+ITS tracks + // if PID is not required, the flag is sed as + // if the cut was alsways passed + Bool_t okTPCpid = kFALSE; + if (IsITSTPC(track)) okTPCpid = OkTPCPID(track); + if (!fCheckTPC) okTPCpid = kTRUE; + + // TOF PID can be checked only if TOF is matched + // if PID is not required, the flag is sed as + // if the cut was alsways passed + Bool_t okTOFpid = kFALSE; + if (IsITSTPC(track) && MatchTOF(track)) okTOFpid = OkTOFPID(track); + if (!fCheckTOF) okTOFpid = kTRUE; + + // now combine all outcomes according to the different possibilities: + // -- ITS standalone: + // --> only ITS PID, always + // -- ITS + TPC: + // --> ITS PID, only for momenta lower than 'fMaxITSPIDmom' and when the ITSpid flag is active + // --> TPC PID, always --> MASTER (first to be checked, if fails, track is rejected) + // --> TOF PID, only if matched + if (IsITSSA(track)) { + if (!okITSpid) { + AliDebug(AliLog::kDebug + 2, "ITS standalone track --> ITS PID failed"); + return kFALSE; + } + } else { // checking IsITSTPC() is redundant due to OkQuality() cut check + if (!okTPCpid) { + AliDebug(AliLog::kDebug + 2, "ITS+TPC track --> TPC PID failed"); + return kFALSE; + } else if (MatchTOF(track) && !okTOFpid) { + AliDebug(AliLog::kDebug + 2, "ITS+TPC track --> TOF matched but TOF PID failed"); + return kFALSE; + } else if (track->IsOn(AliESDtrack::kITSpid) && track->P() <= fMaxITSPIDmom && !okITSpid) { + AliDebug(AliLog::kDebug + 2, Form("ITS+TPC track --> Momentum lower than limit (%.2f) and ITS PID failed", fMaxITSPIDmom)); + return kFALSE; + } + } + + // arriving here, the track has survived all checks + return kTRUE; } //______________________________________________________________________________ @@ -305,116 +288,114 @@ Bool_t AliRsnCutESD2010::OkQuality(AliESDtrack *track) // If tracks of any type are not flagged to be used, they are rejected anyway. // - if (IsITSTPC(track)) return (fUseITSTPC && fESDtrackCutsTPC.IsSelected(track)); - if (IsITSSA (track)) return (fUseITSSA && fESDtrackCutsITS.IsSelected(track)); + if (IsITSTPC(track)) return (fUseITSTPC && fESDtrackCutsTPC.IsSelected(track)); + if (IsITSSA(track)) return (fUseITSSA && fESDtrackCutsITS.IsSelected(track)); - return kFALSE; + return kFALSE; } //______________________________________________________________________________ -Bool_t AliRsnCutESD2010::OkITSPID (AliESDtrack *track) +Bool_t AliRsnCutESD2010::OkITSPID(AliESDtrack *track) { // // Check ITS particle identification with 3sigma cut // - // count PID layers and reject if they are too few - Int_t k, nITSpidLayers = 0; - UChar_t itsCluMap = track->GetITSClusterMap(); - for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITSpidLayers; - if (nITSpidLayers < 3) - { - AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers"); - return kFALSE; - } - - // check the track type (ITS+TPC or ITS standalone) - // and reject it if it is of none of the allowed types - Bool_t isSA = kFALSE; - if (IsITSTPC(track)) isSA = kFALSE; - else if (IsITSSA(track)) isSA = kTRUE; - else - { - AliWarning("Track is neither ITS+TPC nor ITS standalone"); - return kFALSE; - } - - // create the PID response object and compute nsigma - AliITSPIDResponse &itsrsp = fESDpid.GetITSResponse(); - Double_t mom = track->P(); - Double_t nSigma = itsrsp.GetNumberOfSigmas(mom, track->GetITSsignal(), fPID, nITSpidLayers, isSA); - - // evaluate the cut - Bool_t ok = (TMath::Abs(nSigma) <= fMaxITSband); - - // debug message - AliDebug(AliLog::kDebug + 2, Form("ITS nsigma = %f -- max = %f -- cut %s", nSigma, fMaxITSband, (ok ? "passed" : "failed"))); - - // outcome - return ok; + // count PID layers and reject if they are too few + Int_t k, nITSpidLayers = 0; + UChar_t itsCluMap = track->GetITSClusterMap(); + for (k = 2; k < 6; k++) if (itsCluMap & (1 << k)) ++nITSpidLayers; + if (nITSpidLayers < 3) { + AliDebug(AliLog::kDebug + 2, "Rejecting track with too few ITS pid layers"); + return kFALSE; + } + + // check the track type (ITS+TPC or ITS standalone) + // and reject it if it is of none of the allowed types + Bool_t isSA = kFALSE; + if (IsITSTPC(track)) isSA = kFALSE; + else if (IsITSSA(track)) isSA = kTRUE; + else { + AliWarning("Track is neither ITS+TPC nor ITS standalone"); + return kFALSE; + } + + // create the PID response object and compute nsigma + AliITSPIDResponse &itsrsp = fESDpid.GetITSResponse(); + Double_t mom = track->P(); + Double_t nSigma = itsrsp.GetNumberOfSigmas(mom, track->GetITSsignal(), fPID, nITSpidLayers, isSA); + + // evaluate the cut + Bool_t ok = (TMath::Abs(nSigma) <= fMaxITSband); + + // debug message + AliDebug(AliLog::kDebug + 2, Form("ITS nsigma = %f -- max = %f -- cut %s", nSigma, fMaxITSband, (ok ? "passed" : "failed"))); + + // outcome + return ok; } //______________________________________________________________________________ -Bool_t AliRsnCutESD2010::OkTPCPID (AliESDtrack *track) +Bool_t AliRsnCutESD2010::OkTPCPID(AliESDtrack *track) { // // Check TPC particle identification with {3|5}sigmacut, // depending on the track total momentum. // - // setup TPC PID response - AliTPCPIDResponse &tpcrsp = fESDpid.GetTPCResponse(); - //tpcrsp.SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]); - - // get momentum and number of sigmas and choose the reference band - Double_t mom = track->GetInnerParam()->P(); - Double_t nSigma = tpcrsp.GetNumberOfSigmas(mom, track->GetTPCsignal(), track->GetTPCsignalN(), fPID); - Double_t maxNSigma = fMaxTPCband; - if (mom < fTPCpLimit) maxNSigma = fMinTPCband; - - // evaluate the cut - Bool_t ok = (TMath::Abs(nSigma) <= maxNSigma); - - // debug message - AliDebug(AliLog::kDebug + 2, Form("TPC nsigma = %f -- max = %f -- cut %s", nSigma, maxNSigma, (ok ? "passed" : "failed"))); - - // outcome - return ok; + // setup TPC PID response + AliTPCPIDResponse &tpcrsp = fESDpid.GetTPCResponse(); + //tpcrsp.SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]); + + // get momentum and number of sigmas and choose the reference band + Double_t mom = track->GetInnerParam()->P(); + Double_t nSigma = tpcrsp.GetNumberOfSigmas(mom, track->GetTPCsignal(), track->GetTPCsignalN(), fPID); + Double_t maxNSigma = fMaxTPCband; + if (mom < fTPCpLimit) maxNSigma = fMinTPCband; + + // evaluate the cut + Bool_t ok = (TMath::Abs(nSigma) <= maxNSigma); + + // debug message + AliDebug(AliLog::kDebug + 2, Form("TPC nsigma = %f -- max = %f -- cut %s", nSigma, maxNSigma, (ok ? "passed" : "failed"))); + + // outcome + return ok; } //______________________________________________________________________________ -Bool_t AliRsnCutESD2010::OkTOFPID (AliESDtrack *track) +Bool_t AliRsnCutESD2010::OkTOFPID(AliESDtrack *track) { // // Check TOF particle identification if matched there. // - // reject not TOF-matched tracks - if (!MatchTOF(track)) return kFALSE; - - // setup TOF PID response - AliTOFPIDResponse &tofrsp = fESDpid.GetTOFResponse(); - - // get info for computation - Double_t momentum = track->P(); - Double_t time = track->GetTOFsignal(); - Double_t timeint[AliPID::kSPECIES]; - tofrsp.GetStartTime(momentum); - track->GetIntegratedTimes(timeint); - - // check the cut - Double_t timeDiff = time - timeint[(Int_t)fPID]; - Double_t sigmaRef = tofrsp.GetExpectedSigma(momentum, timeint[(Int_t)fPID], AliPID::ParticleMass(fPID)); - Double_t nSigma = timeDiff / sigmaRef; - - // evaluate the cut - Bool_t ok = (nSigma >= fMinTOF && nSigma <= fMaxTOF); - - // debug message - AliDebug(AliLog::kDebug + 2, Form("TOF nsigma = %f -- range = %f - %f -- cut %s", nSigma, fMinTOF, fMaxTOF, (ok ? "passed" : "failed"))); - - // outcome - return ok; + // reject not TOF-matched tracks + if (!MatchTOF(track)) return kFALSE; + + // setup TOF PID response + AliTOFPIDResponse &tofrsp = fESDpid.GetTOFResponse(); + + // get info for computation + Double_t momentum = track->P(); + Double_t time = track->GetTOFsignal(); + Double_t timeint[AliPID::kSPECIES]; + tofrsp.GetStartTime(momentum); + track->GetIntegratedTimes(timeint); + + // check the cut + Double_t timeDiff = time - timeint[(Int_t)fPID]; + Double_t sigmaRef = tofrsp.GetExpectedSigma(momentum, timeint[(Int_t)fPID], AliPID::ParticleMass(fPID)); + Double_t nSigma = timeDiff / sigmaRef; + + // evaluate the cut + Bool_t ok = (nSigma >= fMinTOF && nSigma <= fMaxTOF); + + // debug message + AliDebug(AliLog::kDebug + 2, Form("TOF nsigma = %f -- range = %f - %f -- cut %s", nSigma, fMinTOF, fMaxTOF, (ok ? "passed" : "failed"))); + + // outcome + return ok; } //_________________________________________________________________________________________________ @@ -424,19 +405,19 @@ void AliRsnCutESD2010::Print(const Option_t *) const // Print information on this cut // - AliInfo(Form("Cut name : %s", GetName())); - AliInfo(Form("Using MC settings : %s", (fIsMC ? "YES" : "NO"))); - AliInfo(Form("Using TPC+ITS tracks : %s", (fUseITSTPC ? "YES" : "NO"))); - AliInfo(Form("Using ITS SA tracks : %s", (fUseITSSA ? "YES" : "NO"))); - AliInfo(Form("Check ITS PID : %s", (fCheckITS ? "YES" : "NO"))); - AliInfo(Form("Check TPC PID : %s", (fCheckTPC ? "YES" : "NO"))); - AliInfo(Form("Check TOF PID : %s", (fCheckTOF ? "YES" : "NO"))); - AliInfo(Form("Reference particle : %s", AliPID::ParticleName(fPID))); - AliInfo(Form("ITS PID range (sigmas): %f", fMaxITSband)); - AliInfo(Form("ITS PID range (pt) : %f", fMaxITSPIDmom)); - AliInfo(Form("TPC PID ranges (sigmas): %f %f", fMinTPCband, fMaxTPCband)); - AliInfo(Form("TPC PID limit (p) : %f", fTPCpLimit)); - AliInfo(Form("TOF resolution : %f", fgTOFresolution)); - AliInfo(Form("TOF range (sigmas) : %f - %f", fMinTOF, fMaxTOF)); - AliInfo(Form("TOF PID tuning from MC : %s", (fgTOFtuneMC ? "YES" : "NO"))); + AliInfo(Form("Cut name : %s", GetName())); + AliInfo(Form("Using MC settings : %s", (fIsMC ? "YES" : "NO"))); + AliInfo(Form("Using TPC+ITS tracks : %s", (fUseITSTPC ? "YES" : "NO"))); + AliInfo(Form("Using ITS SA tracks : %s", (fUseITSSA ? "YES" : "NO"))); + AliInfo(Form("Check ITS PID : %s", (fCheckITS ? "YES" : "NO"))); + AliInfo(Form("Check TPC PID : %s", (fCheckTPC ? "YES" : "NO"))); + AliInfo(Form("Check TOF PID : %s", (fCheckTOF ? "YES" : "NO"))); + AliInfo(Form("Reference particle : %s", AliPID::ParticleName(fPID))); + AliInfo(Form("ITS PID range (sigmas): %f", fMaxITSband)); + AliInfo(Form("ITS PID range (pt) : %f", fMaxITSPIDmom)); + AliInfo(Form("TPC PID ranges (sigmas): %f %f", fMinTPCband, fMaxTPCband)); + AliInfo(Form("TPC PID limit (p) : %f", fTPCpLimit)); + AliInfo(Form("TOF resolution : %f", fgTOFresolution)); + AliInfo(Form("TOF range (sigmas) : %f - %f", fMinTOF, fMaxTOF)); + AliInfo(Form("TOF PID tuning from MC : %s", (fgTOFtuneMC ? "YES" : "NO"))); } diff --git a/PWG2/RESONANCES/AliRsnCutESD2010.h b/PWG2/RESONANCES/AliRsnCutESD2010.h index 83f28c3f3aa..7eecce3bb7b 100644 --- a/PWG2/RESONANCES/AliRsnCutESD2010.h +++ b/PWG2/RESONANCES/AliRsnCutESD2010.h @@ -23,94 +23,96 @@ class AliESDpid; class AliTOFT0maker; class AliTOFcalib; -class AliRsnCutESD2010 : public AliRsnCut -{ - public: - - AliRsnCutESD2010(const char *name = "cutESD2010", Bool_t isMC = kFALSE); - AliRsnCutESD2010(const AliRsnCutESD2010& copy); - AliRsnCutESD2010& operator=(const AliRsnCutESD2010& copy); - virtual ~AliRsnCutESD2010() {;}; - - AliESDpid* GetESDpid() {return &fESDpid;} - AliESDtrackCuts* GetCutsTPC() {return &fESDtrackCutsTPC;} - AliESDtrackCuts* GetCutsITS() {return &fESDtrackCutsITS;} - void CopyCutsTPC(const AliESDtrackCuts *cuts) {fESDtrackCutsTPC = (*cuts);} - void CopyCutsITS(const AliESDtrackCuts *cuts) {fESDtrackCutsITS = (*cuts);} - void CopyCutsTPC(AliESDtrackCuts cuts) {fESDtrackCutsTPC = cuts;} - void CopyCutsITS(AliESDtrackCuts cuts) {fESDtrackCutsITS = cuts;} - virtual Bool_t IsSelected(TObject *object); - virtual void Print(const Option_t *option = "") const; - - void SetMC (Bool_t yn = kTRUE); - void SetCheckITS (Bool_t yn = kTRUE) {fCheckITS = yn;} - void SetCheckTPC (Bool_t yn = kTRUE) {fCheckTPC = yn;} - void SetCheckTOF (Bool_t yn = kTRUE) {fCheckTOF = yn;} - void SetUseITSTPC(Bool_t yn = kTRUE) {fUseITSTPC = yn;} - void SetUseITSSA (Bool_t yn = kTRUE) {fUseITSSA = yn;} - void SetPID (AliPID::EParticleType t) {fPID = t;} - - void SetMaxITSPIDmom(Double_t v) {fMaxITSPIDmom = v;} - void SetITSband(Double_t v) {fMaxITSband = v;} - - void SetTPCpLimit(Double_t v) {fTPCpLimit = v;} - void SetTPCrange(Double_t min, Double_t max) {fMinTPCband = min; fMaxTPCband = max;} - void SetTPCpar(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) - {fTPCpar[0]=p0;fTPCpar[1]=p1;fTPCpar[2]=p2;fTPCpar[3]=p3;fTPCpar[4]=p4;} - - void SetTOFrange (Double_t v1, Double_t v2) {fMinTOF = v1; fMaxTOF = v2;} - - virtual void ProcessEvent(AliESDEvent *esd); - - //static void SetTOFcalibrateESD(Bool_t yn) {fgTOFcalibrateESD = yn;} - static void SetTOFcorrectTExp (Bool_t yn) {fgTOFcorrectTExp = yn;} - static void SetTOFuseT0 (Bool_t yn) {fgTOFuseT0 = yn;} - static void SetTOFtuneMC (Bool_t yn) {fgTOFtuneMC = yn;} - static void SetTOFresolution (Double_t r) {fgTOFresolution = r;} - - protected: - - Bool_t OkQuality(AliESDtrack *d); // check track quality parameters and DCA - Bool_t OkITSPID (AliESDtrack *d); // check ITS PID - Bool_t OkTPCPID (AliESDtrack *d); // check TPC PID - Bool_t OkTOFPID (AliESDtrack *d); // check TOF PID - Bool_t IsITSTPC (AliESDtrack *d); // check that the track is TPC+ITS - Bool_t IsITSSA (AliESDtrack *d); // check that the track is ITS standalone - Bool_t MatchTOF (AliESDtrack *d); // check that the track matches the TOF - - Bool_t fIsMC; // switch for MC analysis - Bool_t fCheckITS; // switch for ITS dE/dx check - Bool_t fCheckTPC; // switch for TPC dE/dx check - Bool_t fCheckTOF; // switch for TOF time check - Bool_t fUseITSTPC; // switch to use TPC global tracks - Bool_t fUseITSSA; // switch to use ITS standalone tracks - AliPID::EParticleType fPID; // PID reference type used for checks - - Double_t fMaxITSPIDmom; // maximum momentum where ITS PID is used for TPC+ITS tracks - Double_t fMaxITSband; // range for ITS de/dx band - - Double_t fTPCpLimit; // limit to choose what band to apply - Double_t fTPCpar[5]; // parameters for TPC bethe-Bloch - Double_t fMinTPCband; // range for TPC de/dx band - min - Double_t fMaxTPCband; // range for TPC de/dx band - max - - AliESDpid fESDpid; // ESD PID object - AliESDtrackCuts fESDtrackCutsTPC; // ESD standard defined track cuts for TPC tracks - AliESDtrackCuts fESDtrackCutsITS; // ESD standard defined track cuts for ITS-SA tracks - Double_t fMinTOF; // range for TOF PID (min) - Double_t fMaxTOF; // range for TOF PID (max) - - //static Bool_t fgTOFcalibrateESD; //! TOF settings - static Bool_t fgTOFcorrectTExp; //! TOF settings - static Bool_t fgTOFuseT0; //! TOF settings - static Bool_t fgTOFtuneMC; //! TOF settings - static Double_t fgTOFresolution; //! TOF settings - static AliTOFT0maker *fgTOFmaker; //! TOF time0 computator - static AliTOFcalib *fgTOFcalib; //! TOF calibration - static Int_t fgLastRun; //! last run number - static Int_t fgLastEventID; //! ID of last event processed - - ClassDef(AliRsnCutESD2010, 1) +class AliRsnCutESD2010 : public AliRsnCut { +public: + + AliRsnCutESD2010(const char *name = "cutESD2010", Bool_t isMC = kFALSE); + AliRsnCutESD2010(const AliRsnCutESD2010& copy); + AliRsnCutESD2010& operator=(const AliRsnCutESD2010& copy); + virtual ~AliRsnCutESD2010() {;}; + + AliESDpid* GetESDpid() {return &fESDpid;} + AliESDtrackCuts* GetCutsTPC() {return &fESDtrackCutsTPC;} + AliESDtrackCuts* GetCutsITS() {return &fESDtrackCutsITS;} + void CopyCutsTPC(const AliESDtrackCuts *cuts) {fESDtrackCutsTPC = (*cuts);} + void CopyCutsITS(const AliESDtrackCuts *cuts) {fESDtrackCutsITS = (*cuts);} + void CopyCutsTPC(AliESDtrackCuts cuts) {fESDtrackCutsTPC = cuts;} + void CopyCutsITS(AliESDtrackCuts cuts) {fESDtrackCutsITS = cuts;} + virtual Bool_t IsSelected(TObject *object); + virtual void Print(const Option_t *option = "") const; + + void SetMC(Bool_t yn = kTRUE); + void SetCheckITS(Bool_t yn = kTRUE) {fCheckITS = yn;} + void SetCheckTPC(Bool_t yn = kTRUE) {fCheckTPC = yn;} + void SetCheckTOF(Bool_t yn = kTRUE) {fCheckTOF = yn;} + void SetUseITSTPC(Bool_t yn = kTRUE) {fUseITSTPC = yn;} + void SetUseITSSA(Bool_t yn = kTRUE) {fUseITSSA = yn;} + void SetPID(AliPID::EParticleType t) {fPID = t;} + + void SetMaxITSPIDmom(Double_t v) {fMaxITSPIDmom = v;} + void SetITSband(Double_t v) {fMaxITSband = v;} + + void SetTPCpLimit(Double_t v) {fTPCpLimit = v;} + void SetTPCrange(Double_t min, Double_t max) {fMinTPCband = min; fMaxTPCband = max;} + void SetTPCpar(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) + {fTPCpar[0] = p0; fTPCpar[1] = p1; fTPCpar[2] = p2; fTPCpar[3] = p3; fTPCpar[4] = p4;} + + void SetTOFrange(Double_t v1, Double_t v2) {fMinTOF = v1; fMaxTOF = v2;} + void SetOCDBDefaultStorage(TString s = "raw://") { fOCDBDefaultStorage = s;} + + virtual void ProcessEvent(AliESDEvent *esd); + + //static void SetTOFcalibrateESD(Bool_t yn) {fgTOFcalibrateESD = yn;} + static void SetTOFcorrectTExp(Bool_t yn) {fgTOFcorrectTExp = yn;} + static void SetTOFuseT0(Bool_t yn) {fgTOFuseT0 = yn;} + static void SetTOFtuneMC(Bool_t yn) {fgTOFtuneMC = yn;} + static void SetTOFresolution(Double_t r) {fgTOFresolution = r;} + +protected: + + Bool_t OkQuality(AliESDtrack *d); // check track quality parameters and DCA + Bool_t OkITSPID(AliESDtrack *d); // check ITS PID + Bool_t OkTPCPID(AliESDtrack *d); // check TPC PID + Bool_t OkTOFPID(AliESDtrack *d); // check TOF PID + Bool_t IsITSTPC(AliESDtrack *d); // check that the track is TPC+ITS + Bool_t IsITSSA(AliESDtrack *d); // check that the track is ITS standalone + Bool_t MatchTOF(AliESDtrack *d); // check that the track matches the TOF + + Bool_t fIsMC; // switch for MC analysis + Bool_t fCheckITS; // switch for ITS dE/dx check + Bool_t fCheckTPC; // switch for TPC dE/dx check + Bool_t fCheckTOF; // switch for TOF time check + Bool_t fUseITSTPC; // switch to use TPC global tracks + Bool_t fUseITSSA; // switch to use ITS standalone tracks + AliPID::EParticleType fPID; // PID reference type used for checks + + Double_t fMaxITSPIDmom; // maximum momentum where ITS PID is used for TPC+ITS tracks + Double_t fMaxITSband; // range for ITS de/dx band + + Double_t fTPCpLimit; // limit to choose what band to apply + Double_t fTPCpar[5]; // parameters for TPC bethe-Bloch + Double_t fMinTPCband; // range for TPC de/dx band - min + Double_t fMaxTPCband; // range for TPC de/dx band - max + + AliESDpid fESDpid; // ESD PID object + AliESDtrackCuts fESDtrackCutsTPC; // ESD standard defined track cuts for TPC tracks + AliESDtrackCuts fESDtrackCutsITS; // ESD standard defined track cuts for ITS-SA tracks + Double_t fMinTOF; // range for TOF PID (min) + Double_t fMaxTOF; // range for TOF PID (max) + + TString fOCDBDefaultStorage;// default storage for OCDB (raw://) + + //static Bool_t fgTOFcalibrateESD; //! TOF settings + static Bool_t fgTOFcorrectTExp; //! TOF settings + static Bool_t fgTOFuseT0; //! TOF settings + static Bool_t fgTOFtuneMC; //! TOF settings + static Double_t fgTOFresolution; //! TOF settings + static AliTOFT0maker *fgTOFmaker; //! TOF time0 computator + static AliTOFcalib *fgTOFcalib; //! TOF calibration + static Int_t fgLastRun; //! last run number + static Int_t fgLastEventID; //! ID of last event processed + + ClassDef(AliRsnCutESD2010, 1) }; inline Bool_t AliRsnCutESD2010::IsITSTPC(AliESDtrack *vtrack) @@ -119,15 +121,14 @@ inline Bool_t AliRsnCutESD2010::IsITSTPC(AliESDtrack *vtrack) // Checks if the track has the status flags required for a global track // - if (!vtrack) - { - AliWarning("NULL argument: impossible to check status"); - return kFALSE; - } - - return vtrack->IsOn(AliESDtrack::kTPCin); - - return kTRUE; + if (!vtrack) { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + return vtrack->IsOn(AliESDtrack::kTPCin); + + return kTRUE; } inline Bool_t AliRsnCutESD2010::IsITSSA(AliESDtrack *vtrack) @@ -136,20 +137,19 @@ inline Bool_t AliRsnCutESD2010::IsITSSA(AliESDtrack *vtrack) // Checks if the track has the status flags required for an ITS standalone track // - if (!vtrack) - { - AliWarning("NULL argument: impossible to check status"); - return kFALSE; - } - - Bool_t isTPCin = vtrack->IsOn(AliESDtrack::kTPCin); - Bool_t isITSrefit = vtrack->IsOn(AliESDtrack::kITSrefit); - Bool_t isITSpureSA = vtrack->IsOn(AliESDtrack::kITSpureSA); - Bool_t isITSpid = vtrack->IsOn(AliESDtrack::kITSpid); - - return ( (!isTPCin) && isITSrefit && (!isITSpureSA) && isITSpid ); - - return kTRUE; + if (!vtrack) { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + Bool_t isTPCin = vtrack->IsOn(AliESDtrack::kTPCin); + Bool_t isITSrefit = vtrack->IsOn(AliESDtrack::kITSrefit); + Bool_t isITSpureSA = vtrack->IsOn(AliESDtrack::kITSpureSA); + Bool_t isITSpid = vtrack->IsOn(AliESDtrack::kITSpid); + + return ((!isTPCin) && isITSrefit && (!isITSpureSA) && isITSpid); + + return kTRUE; } @@ -159,21 +159,20 @@ inline Bool_t AliRsnCutESD2010::MatchTOF(AliESDtrack *vtrack) // Checks if the track has matched the TOF detector // - if (!vtrack) - { - AliWarning("NULL argument: impossible to check status"); - return kFALSE; - } - - // require a minimum length to have meaningful match - if (vtrack->GetIntegratedLength() < 350.) return kFALSE; - - Bool_t isTOFout = vtrack->IsOn(AliESDtrack::kTOFout); - Bool_t isTIME = vtrack->IsOn(AliESDtrack::kTIME); - - return ( isTOFout && isTIME ); - - return kTRUE; + if (!vtrack) { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + // require a minimum length to have meaningful match + if (vtrack->GetIntegratedLength() < 350.) return kFALSE; + + Bool_t isTOFout = vtrack->IsOn(AliESDtrack::kTOFout); + Bool_t isTIME = vtrack->IsOn(AliESDtrack::kTIME); + + return (isTOFout && isTIME); + + return kTRUE; } #endif diff --git a/PWG2/RESONANCES/AliRsnCutManager.cxx b/PWG2/RESONANCES/AliRsnCutManager.cxx index f150d874ba1..b0ed6600b6e 100644 --- a/PWG2/RESONANCES/AliRsnCutManager.cxx +++ b/PWG2/RESONANCES/AliRsnCutManager.cxx @@ -26,11 +26,11 @@ ClassImp(AliRsnCutManager) //_____________________________________________________________________________ AliRsnCutManager::AliRsnCutManager() : - TNamed("defaultName", "defaultTitle"), - fDaughterCutsCommon("defaultCommon", AliRsnTarget::kDaughter), - fDaughterCuts1("defaultD1", AliRsnTarget::kDaughter), - fDaughterCuts2("defaultD2", AliRsnTarget::kDaughter), - fMotherCuts("defaultPair", AliRsnTarget::kMother) + TNamed("defaultName", "defaultTitle"), + fDaughterCutsCommon("defaultCommon", AliRsnTarget::kDaughter), + fDaughterCuts1("defaultD1", AliRsnTarget::kDaughter), + fDaughterCuts2("defaultD2", AliRsnTarget::kDaughter), + fMotherCuts("defaultPair", AliRsnTarget::kMother) { // // Constructor without arguments. @@ -39,11 +39,11 @@ AliRsnCutManager::AliRsnCutManager() : //_____________________________________________________________________________ AliRsnCutManager::AliRsnCutManager(const char *name, const char *title) : - TNamed(name, title), - fDaughterCutsCommon(Form("common_%s", name), AliRsnTarget::kDaughter), - fDaughterCuts1(Form("d1_%s", name), AliRsnTarget::kDaughter), - fDaughterCuts2(Form("d2_%s", name), AliRsnTarget::kDaughter), - fMotherCuts(Form("pair_%s", name), AliRsnTarget::kMother) + TNamed(name, title), + fDaughterCutsCommon(Form("common_%s", name), AliRsnTarget::kDaughter), + fDaughterCuts1(Form("d1_%s", name), AliRsnTarget::kDaughter), + fDaughterCuts2(Form("d2_%s", name), AliRsnTarget::kDaughter), + fMotherCuts(Form("pair_%s", name), AliRsnTarget::kMother) { // // Constructor with name and title. @@ -52,11 +52,11 @@ AliRsnCutManager::AliRsnCutManager(const char *name, const char *title) : //_____________________________________________________________________________ AliRsnCutManager::AliRsnCutManager(const AliRsnCutManager &cut) : - TNamed(cut), - fDaughterCutsCommon(cut.fDaughterCutsCommon), - fDaughterCuts1(cut.fDaughterCuts1), - fDaughterCuts2(cut.fDaughterCuts2), - fMotherCuts(cut.fMotherCuts) + TNamed(cut), + fDaughterCutsCommon(cut.fDaughterCutsCommon), + fDaughterCuts1(cut.fDaughterCuts1), + fDaughterCuts2(cut.fDaughterCuts2), + fMotherCuts(cut.fMotherCuts) { // // Constructor with name and title. @@ -70,15 +70,15 @@ AliRsnCutManager& AliRsnCutManager::operator=(const AliRsnCutManager &cut) // Assign operator // - SetName(cut.GetName()); - SetTitle(cut.GetTitle()); - - fDaughterCuts2 = cut.fDaughterCuts2; - fDaughterCuts1 = cut.fDaughterCuts1; - fDaughterCutsCommon = cut.fDaughterCutsCommon; - fMotherCuts = cut.fMotherCuts; - - return (*this); + SetName(cut.GetName()); + SetTitle(cut.GetTitle()); + + fDaughterCuts2 = cut.fDaughterCuts2; + fDaughterCuts1 = cut.fDaughterCuts1; + fDaughterCutsCommon = cut.fDaughterCutsCommon; + fMotherCuts = cut.fMotherCuts; + + return (*this); } //_____________________________________________________________________________ diff --git a/PWG2/RESONANCES/AliRsnCutManager.h b/PWG2/RESONANCES/AliRsnCutManager.h index 7de65dd12fe..b4829e6b49c 100644 --- a/PWG2/RESONANCES/AliRsnCutManager.h +++ b/PWG2/RESONANCES/AliRsnCutManager.h @@ -28,36 +28,35 @@ class AliRsnCut; -class AliRsnCutManager : public TNamed -{ - public: - - AliRsnCutManager(); - AliRsnCutManager(const char *name, const char* title = ""); - AliRsnCutManager(const AliRsnCutManager &cut); - AliRsnCutManager& operator=(const AliRsnCutManager& cut); - ~AliRsnCutManager(); - - AliRsnCutSet* GetCommonDaughterCuts() {return &fDaughterCutsCommon;} - AliRsnCutSet* GetDaughter1Cuts() {return &fDaughterCuts1;} - AliRsnCutSet* GetDaughter2Cuts() {return &fDaughterCuts2;} - AliRsnCutSet* GetMotherCuts() {return &fMotherCuts;} - - Bool_t PassCommonDaughterCuts(AliRsnDaughter *daughter) {return fDaughterCutsCommon.IsSelected(daughter);} - Bool_t PassDaughter1Cuts(AliRsnDaughter *daughter) {return fDaughterCuts1.IsSelected(daughter);} - Bool_t PassDaughter2Cuts(AliRsnDaughter *daughter) {return fDaughterCuts2.IsSelected(daughter);} - Bool_t PassMotherCuts(AliRsnMother *mother) {return fMotherCuts.IsSelected(mother);} - Bool_t PassSpecificDaughterCuts(Bool_t first, AliRsnDaughter *daughter) - {if (first) return PassDaughter1Cuts(daughter); else return PassDaughter2Cuts(daughter);} - - private: - - AliRsnCutSet fDaughterCutsCommon; // single-track cuts common to both daughters - AliRsnCutSet fDaughterCuts1; // single-track cuts for only first daughter - AliRsnCutSet fDaughterCuts2; // single-track cuts for only second daughter - AliRsnCutSet fMotherCuts; // mother cuts (on relations between daughters) - - ClassDef(AliRsnCutManager, 2) // dictionary +class AliRsnCutManager : public TNamed { +public: + + AliRsnCutManager(); + AliRsnCutManager(const char *name, const char* title = ""); + AliRsnCutManager(const AliRsnCutManager &cut); + AliRsnCutManager& operator=(const AliRsnCutManager& cut); + ~AliRsnCutManager(); + + AliRsnCutSet* GetCommonDaughterCuts() {return &fDaughterCutsCommon;} + AliRsnCutSet* GetDaughter1Cuts() {return &fDaughterCuts1;} + AliRsnCutSet* GetDaughter2Cuts() {return &fDaughterCuts2;} + AliRsnCutSet* GetMotherCuts() {return &fMotherCuts;} + + Bool_t PassCommonDaughterCuts(AliRsnDaughter *daughter) {return fDaughterCutsCommon.IsSelected(daughter);} + Bool_t PassDaughter1Cuts(AliRsnDaughter *daughter) {return fDaughterCuts1.IsSelected(daughter);} + Bool_t PassDaughter2Cuts(AliRsnDaughter *daughter) {return fDaughterCuts2.IsSelected(daughter);} + Bool_t PassMotherCuts(AliRsnMother *mother) {return fMotherCuts.IsSelected(mother);} + Bool_t PassSpecificDaughterCuts(Bool_t first, AliRsnDaughter *daughter) + {if (first) return PassDaughter1Cuts(daughter); else return PassDaughter2Cuts(daughter);} + +private: + + AliRsnCutSet fDaughterCutsCommon; // single-track cuts common to both daughters + AliRsnCutSet fDaughterCuts1; // single-track cuts for only first daughter + AliRsnCutSet fDaughterCuts2; // single-track cuts for only second daughter + AliRsnCutSet fMotherCuts; // mother cuts (on relations between daughters) + + ClassDef(AliRsnCutManager, 2) // dictionary }; #endif diff --git a/PWG2/RESONANCES/AliRsnCutPID.cxx b/PWG2/RESONANCES/AliRsnCutPID.cxx index 16ca58577a9..b88389d6738 100644 --- a/PWG2/RESONANCES/AliRsnCutPID.cxx +++ b/PWG2/RESONANCES/AliRsnCutPID.cxx @@ -26,9 +26,9 @@ ClassImp(AliRsnCutPID) //_________________________________________________________________________________________________ AliRsnCutPID::AliRsnCutPID() : - AliRsnCut(), - fPerfect(kFALSE), - fUseDefault(kTRUE) + AliRsnCut(), + fPerfect(kFALSE), + fUseDefault(kTRUE) { // // Default constructor. @@ -37,29 +37,27 @@ AliRsnCutPID::AliRsnCutPID() : // to which we want to compare this object. // - Int_t i; - - for (i = 0; i < kDetectors; i++) - { - fUseDetector[i] = kFALSE; - fPtThreshold[i] = 0.0; - fGoAboveThreshold[i] = kTRUE; - } - - for (i = 0; i < AliPID::kSPECIES; i++) - { - fWeight[i] = 0.0; - fPrior[i] = 1.0; - } - - SetTargetType(AliRsnTarget::kDaughter); + Int_t i; + + for (i = 0; i < kDetectors; i++) { + fUseDetector[i] = kFALSE; + fPtThreshold[i] = 0.0; + fGoAboveThreshold[i] = kTRUE; + } + + for (i = 0; i < AliPID::kSPECIES; i++) { + fWeight[i] = 0.0; + fPrior[i] = 1.0; + } + + SetTargetType(AliRsnTarget::kDaughter); } //_________________________________________________________________________________________________ AliRsnCutPID::AliRsnCutPID(const char *name, AliPID::EParticleType pid, Double_t probMin, Bool_t perfectPID) : - AliRsnCut(name, AliRsnCut::kDaughter, (Int_t)pid), - fPerfect(perfectPID), - fUseDefault(kTRUE) + AliRsnCut(name, AliRsnCut::kDaughter, (Int_t)pid), + fPerfect(perfectPID), + fUseDefault(kTRUE) { // // Default constructor. @@ -68,39 +66,37 @@ AliRsnCutPID::AliRsnCutPID(const char *name, AliPID::EParticleType pid, Double_t // to which we want to compare this object. // - Int_t i; - - for (i = 0; i < kDetectors; i++) - { - fUseDetector[i] = kFALSE; - fPtThreshold[i] = 0.0; - fGoAboveThreshold[i] = kTRUE; - } - - for (i = 0; i < AliPID::kSPECIES; i++) - { - fWeight[i] = 0.0; - fPrior[i] = 1.0; - } - - fMinD = probMin; - fMaxD = 1.000001; - - SetTargetType(AliRsnTarget::kDaughter); + Int_t i; + + for (i = 0; i < kDetectors; i++) { + fUseDetector[i] = kFALSE; + fPtThreshold[i] = 0.0; + fGoAboveThreshold[i] = kTRUE; + } + + for (i = 0; i < AliPID::kSPECIES; i++) { + fWeight[i] = 0.0; + fPrior[i] = 1.0; + } + + fMinD = probMin; + fMaxD = 1.000001; + + SetTargetType(AliRsnTarget::kDaughter); } //_____________________________________________________________________________ Bool_t AliRsnCutPID::CheckThreshold(EDetector det, Double_t value) { // -// Checks if the passed value (track pT) stays in the +// Checks if the passed value (track pT) stays in the // interval where the detector should be accepted // - if (!CheckBounds(det)) return kFALSE; - - if (fGoAboveThreshold[det]) return (value >= fPtThreshold[det]); - else return (value <= fPtThreshold[det]); + if (!CheckBounds(det)) return kFALSE; + + if (fGoAboveThreshold[det]) return (value >= fPtThreshold[det]); + else return (value <= fPtThreshold[det]); } //_________________________________________________________________________________________________ @@ -114,67 +110,61 @@ Bool_t AliRsnCutPID::ComputeWeights(AliRsnDaughter *daughter) // The return value tells if the operation was successful. // - Int_t i, j; - Bool_t useDefault = fUseDefault; - Bool_t perfectPID = fPerfect; - if (perfectPID && !daughter->GetRefMC()) return kFALSE; - if (!daughter->GetRefESDtrack()) useDefault = kTRUE; - if (!daughter->GetRefESDtrack() && !daughter->GetRefAODtrack()) return kFALSE; - - // if perfect PID ise required, - // compare the PDG code of the type stored in 'fMinI' of the cut - // and that of the particle which is checked, looking at its MC - if (perfectPID) - { - i = TMath::Abs(AliPID::ParticleCode(fMinI)); - j = daughter->GetPDG(); - return (i == j); - } - - // if default weights are (or need to be) used, - // they are taken directly and function exits - if (useDefault) - { - if (daughter->GetRefESDtrack()) - daughter->GetRefESDtrack()->GetESDpid(fWeight); - else - { - for (i = 0; i < AliPID::kSPECIES; i++) - fWeight[i] = daughter->GetRefAODtrack()->PID()[i]; - } - return kTRUE; - } - - // if we arrive here, this means that we have an ESD track - // and we want to customize the PID - AliESDtrack *track = daughter->GetRefESDtrack(); - Double_t w[kDetectors][AliPID::kSPECIES]; - track->GetITSpid(w[kITS]); - track->GetTPCpid(w[kTPC]); - track->GetTRDpid(w[kTRD]); - track->GetTOFpid(w[kTOF]); - track->GetHMPIDpid(w[kHMPID]); - - // if a detector is excluded or the track has not the right pT - // all related weights are set to 1 in order not to contribute - // to final multiplication - for (i = 0; i < kDetectors; i++) - { - if (!fUseDetector[i] || !CheckThreshold((EDetector)i, track->Pt())) - { - for (j = 0; j < AliPID::kSPECIES; j++) { - w[i][j] = 1.0; + Int_t i, j; + Bool_t useDefault = fUseDefault; + Bool_t perfectPID = fPerfect; + if (perfectPID && !daughter->GetRefMC()) return kFALSE; + if (!daughter->GetRefESDtrack()) useDefault = kTRUE; + if (!daughter->GetRefESDtrack() && !daughter->GetRefAODtrack()) return kFALSE; + + // if perfect PID ise required, + // compare the PDG code of the type stored in 'fMinI' of the cut + // and that of the particle which is checked, looking at its MC + if (perfectPID) { + i = TMath::Abs(AliPID::ParticleCode(fMinI)); + j = daughter->GetPDG(); + return (i == j); + } + + // if default weights are (or need to be) used, + // they are taken directly and function exits + if (useDefault) { + if (daughter->GetRefESDtrack()) + daughter->GetRefESDtrack()->GetESDpid(fWeight); + else { + for (i = 0; i < AliPID::kSPECIES; i++) + fWeight[i] = daughter->GetRefAODtrack()->PID()[i]; } - } - } - - // multiplicate all weights to compute final one - for (i = 0; i < AliPID::kSPECIES; i++) - { - fWeight[i] = w[kITS][i] * w[kTPC][i] * w[kTRD][i] * w[kTOF][i] * w[kHMPID][i]; - } - - return kTRUE; + return kTRUE; + } + + // if we arrive here, this means that we have an ESD track + // and we want to customize the PID + AliESDtrack *track = daughter->GetRefESDtrack(); + Double_t w[kDetectors][AliPID::kSPECIES]; + track->GetITSpid(w[kITS]); + track->GetTPCpid(w[kTPC]); + track->GetTRDpid(w[kTRD]); + track->GetTOFpid(w[kTOF]); + track->GetHMPIDpid(w[kHMPID]); + + // if a detector is excluded or the track has not the right pT + // all related weights are set to 1 in order not to contribute + // to final multiplication + for (i = 0; i < kDetectors; i++) { + if (!fUseDetector[i] || !CheckThreshold((EDetector)i, track->Pt())) { + for (j = 0; j < AliPID::kSPECIES; j++) { + w[i][j] = 1.0; + } + } + } + + // multiplicate all weights to compute final one + for (i = 0; i < AliPID::kSPECIES; i++) { + fWeight[i] = w[kITS][i] * w[kTPC][i] * w[kTRD][i] * w[kTOF][i] * w[kHMPID][i]; + } + + return kTRUE; } //_________________________________________________________________________________________________ @@ -188,46 +178,41 @@ Int_t AliRsnCutPID::RealisticPID(AliRsnDaughter * const daughter, Double_t &prob // since the cut could require that it is larger than a threshold. // - // try to compute the weights - if (!ComputeWeights(daughter)) - { - prob = -1.0; - return AliPID::kUnknown; - } - - // combine with priors and normalize - Int_t i; - Double_t sum = 0.0, w[AliPID::kSPECIES]; - for (i = 0; i < AliPID::kSPECIES; i++) - { - w[i] = fWeight[i] * fPrior[i]; - sum += w[i]; - } - if (sum <= 0.0) - { - AliError("Sum = 0"); - prob = -1.0; - return AliPID::kUnknown; - } - for (i = 0; i < AliPID::kSPECIES; i++) w[i] /= sum; - - // find the largest probability and related PID - Int_t ibest = 0; - prob = w[0]; - for (i = 1; i < AliPID::kSPECIES; i++) - { - if (w[i] > prob) - { - prob = w[i]; - ibest = i; - } - } - - // return the value, while the probability - // will be consequentially set - return ibest; + // try to compute the weights + if (!ComputeWeights(daughter)) { + prob = -1.0; + return AliPID::kUnknown; + } + + // combine with priors and normalize + Int_t i; + Double_t sum = 0.0, w[AliPID::kSPECIES]; + for (i = 0; i < AliPID::kSPECIES; i++) { + w[i] = fWeight[i] * fPrior[i]; + sum += w[i]; + } + if (sum <= 0.0) { + AliError("Sum = 0"); + prob = -1.0; + return AliPID::kUnknown; + } + for (i = 0; i < AliPID::kSPECIES; i++) w[i] /= sum; + + // find the largest probability and related PID + Int_t ibest = 0; + prob = w[0]; + for (i = 1; i < AliPID::kSPECIES; i++) { + if (w[i] > prob) { + prob = w[i]; + ibest = i; + } + } + + // return the value, while the probability + // will be consequentially set + return ibest; } - + //_________________________________________________________________________________________________ Int_t AliRsnCutPID::PerfectPID(AliRsnDaughter * const daughter) { @@ -238,20 +223,19 @@ Int_t AliRsnCutPID::PerfectPID(AliRsnDaughter * const daughter) // into the enumeration from AliPID object. // - // works only if the MC is present - if (!daughter->GetRefMC()) return AliPID::kUnknown; - - // get the PDG code of the particle - Int_t pdg = daughter->GetPDG(); - - // loop over all species listed in AliPID to find the match - Int_t i; - for (i = 0; i < AliPID::kSPECIES; i++) - { - if (AliPID::ParticleCode(i) == pdg) return i; - } - - return AliPID::kUnknown; + // works only if the MC is present + if (!daughter->GetRefMC()) return AliPID::kUnknown; + + // get the PDG code of the particle + Int_t pdg = daughter->GetPDG(); + + // loop over all species listed in AliPID to find the match + Int_t i; + for (i = 0; i < AliPID::kSPECIES; i++) { + if (AliPID::ParticleCode(i) == pdg) return i; + } + + return AliPID::kUnknown; } //_________________________________________________________________________________________________ @@ -260,35 +244,30 @@ Bool_t AliRsnCutPID::IsSelected(TObject *object) // // Cut checker. // - - // convert the object into the unique correct type - - if (!TargetOK(object)) - { - AliError(Form("[%s]: this cut works only with AliRsnDaughter objects", GetName())); - return kTRUE; - } - - // if target is OK, do a dynamic cast - AliRsnDaughter *daughter = fDaughter; - - // depending on the PID type, recalls the appropriate method: - // in case of perfect PID, checks only if the PID type is - // corresponding to the request in the cut (fMinI) - // while in case of realistic PID checks also the probability - // to be within the required interval - if (fPerfect && daughter) - { - fCutValueI = PerfectPID(daughter); - return OkValueI(); - } - else if (daughter) - { - fCutValueI = RealisticPID(daughter, fCutValueD); - return OkValueI() && OkRangeD(); - } - else - return kFALSE; + + // convert the object into the unique correct type + + if (!TargetOK(object)) { + AliError(Form("[%s]: this cut works only with AliRsnDaughter objects", GetName())); + return kTRUE; + } + + // if target is OK, do a dynamic cast + AliRsnDaughter *daughter = fDaughter; + + // depending on the PID type, recalls the appropriate method: + // in case of perfect PID, checks only if the PID type is + // corresponding to the request in the cut (fMinI) + // while in case of realistic PID checks also the probability + // to be within the required interval + if (fPerfect && daughter) { + fCutValueI = PerfectPID(daughter); + return OkValueI(); + } else if (daughter) { + fCutValueI = RealisticPID(daughter, fCutValueD); + return OkValueI() && OkRangeD(); + } else + return kFALSE; } //__________________________________________________________________________________________________ @@ -301,9 +280,9 @@ void AliRsnCutPID::IncludeDetector(EDetector det, Double_t threshold, Bool_t goA // By default the threshold is zero and detector is always used. // - if (!CheckBounds(det)) return; - - fUseDetector[det] = kTRUE; - fPtThreshold[det] = threshold; - fGoAboveThreshold[det] = goAbove; + if (!CheckBounds(det)) return; + + fUseDetector[det] = kTRUE; + fPtThreshold[det] = threshold; + fGoAboveThreshold[det] = goAbove; } diff --git a/PWG2/RESONANCES/AliRsnCutPID.h b/PWG2/RESONANCES/AliRsnCutPID.h index baf07489e53..ac231895eb5 100644 --- a/PWG2/RESONANCES/AliRsnCutPID.h +++ b/PWG2/RESONANCES/AliRsnCutPID.h @@ -17,53 +17,51 @@ class AliRsnDaughter; -class AliRsnCutPID : public AliRsnCut -{ - public: - - enum EDetector - { +class AliRsnCutPID : public AliRsnCut { +public: + + enum EDetector { kITS, kTPC, kTRD, kTOF, kHMPID, kDetectors - }; - - AliRsnCutPID(); - AliRsnCutPID(const char *name, AliPID::EParticleType pid, Double_t probMin = 0.0, Bool_t perfectPID = kFALSE); - virtual ~AliRsnCutPID() {;}; - - void SetDefault(Bool_t yn = kTRUE) {fUseDefault = yn;} - void SetPrior(Int_t i, Double_t value) {if (i >= 0 && i < AliPID::kSPECIES) fPrior[i] = value;} - void SetPerfect(Bool_t yn = kTRUE) {fPerfect = yn;} - - void IncludeDetector(EDetector det, Double_t threshold = 0., Bool_t goAbove = kTRUE); - void ExcludeDetector(EDetector det) {if (CheckBounds(det)) fUseDetector[det] = kFALSE;} - - Bool_t ComputeWeights(AliRsnDaughter *daughter); - Int_t RealisticPID(AliRsnDaughter * const daughter, Double_t &prob); - Int_t PerfectPID(AliRsnDaughter * const daughter); - Double_t GetWeight(Int_t i) {if (i>=0&&i= kITS && det < kDetectors);} - Bool_t CheckThreshold(EDetector det, Double_t value); - - Double_t fPrior[AliPID::kSPECIES]; // prior probability - Double_t fWeight[AliPID::kSPECIES]; // PID weights used for combinations - - Bool_t fPerfect; // choice to use perfect PID - Bool_t fUseDefault; // choice to use default combined PID weights (or customized) - Bool_t fUseDetector[kDetectors]; // flag to include/exclude each single detector - Double_t fPtThreshold[kDetectors]; // pT threshold above/below which a detector is considered - Double_t fGoAboveThreshold[kDetectors]; // to choose if detector is used balow or above threshold - - ClassDef(AliRsnCutPID, 1) + }; + + AliRsnCutPID(); + AliRsnCutPID(const char *name, AliPID::EParticleType pid, Double_t probMin = 0.0, Bool_t perfectPID = kFALSE); + virtual ~AliRsnCutPID() {;}; + + void SetDefault(Bool_t yn = kTRUE) {fUseDefault = yn;} + void SetPrior(Int_t i, Double_t value) {if (i >= 0 && i < AliPID::kSPECIES) fPrior[i] = value;} + void SetPerfect(Bool_t yn = kTRUE) {fPerfect = yn;} + + void IncludeDetector(EDetector det, Double_t threshold = 0., Bool_t goAbove = kTRUE); + void ExcludeDetector(EDetector det) {if (CheckBounds(det)) fUseDetector[det] = kFALSE;} + + Bool_t ComputeWeights(AliRsnDaughter *daughter); + Int_t RealisticPID(AliRsnDaughter * const daughter, Double_t &prob); + Int_t PerfectPID(AliRsnDaughter * const daughter); + Double_t GetWeight(Int_t i) {if (i >= 0 && i < AliPID::kSPECIES) return fWeight[i]; return 0.0;} + + virtual Bool_t IsSelected(TObject *object); + +protected: + + Bool_t CheckBounds(EDetector det) const {return (det >= kITS && det < kDetectors);} + Bool_t CheckThreshold(EDetector det, Double_t value); + + Double_t fPrior[AliPID::kSPECIES]; // prior probability + Double_t fWeight[AliPID::kSPECIES]; // PID weights used for combinations + + Bool_t fPerfect; // choice to use perfect PID + Bool_t fUseDefault; // choice to use default combined PID weights (or customized) + Bool_t fUseDetector[kDetectors]; // flag to include/exclude each single detector + Double_t fPtThreshold[kDetectors]; // pT threshold above/below which a detector is considered + Double_t fGoAboveThreshold[kDetectors]; // to choose if detector is used balow or above threshold + + ClassDef(AliRsnCutPID, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnCutPIDITS.cxx b/PWG2/RESONANCES/AliRsnCutPIDITS.cxx index ddec49ae1ed..82b2699d9a4 100644 --- a/PWG2/RESONANCES/AliRsnCutPIDITS.cxx +++ b/PWG2/RESONANCES/AliRsnCutPIDITS.cxx @@ -26,14 +26,14 @@ ClassImp(AliRsnCutPIDITS) //_________________________________________________________________________________________________ AliRsnCutPIDITS::AliRsnCutPIDITS (const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectOutside) : - AliRsnCut(name, AliRsnCut::kDaughter, min, max), - fInitialized(kFALSE), - fRejectOutside(rejectOutside), - fMomMin(0.0), - fMomMax(1E+20), - fRefType(ref), - fESDpid(), - fAODpid() + AliRsnCut(name, AliRsnCut::kDaughter, min, max), + fInitialized(kFALSE), + fRejectOutside(rejectOutside), + fMomMin(0.0), + fMomMax(1E+20), + fRefType(ref), + fESDpid(), + fAODpid() { // // Main constructor. @@ -43,14 +43,14 @@ AliRsnCutPIDITS::AliRsnCutPIDITS //_________________________________________________________________________________________________ AliRsnCutPIDITS::AliRsnCutPIDITS (const AliRsnCutPIDITS& copy) : - AliRsnCut(copy), - fInitialized(kFALSE), - fRejectOutside(copy.fRejectOutside), - fMomMin(copy.fMomMin), - fMomMax(copy.fMomMax), - fRefType(copy.fRefType), - fESDpid(copy.fESDpid), - fAODpid(copy.fAODpid) + AliRsnCut(copy), + fInitialized(kFALSE), + fRejectOutside(copy.fRejectOutside), + fMomMin(copy.fMomMin), + fMomMax(copy.fMomMax), + fRefType(copy.fRefType), + fESDpid(copy.fESDpid), + fAODpid(copy.fAODpid) { // // Copy constructor. @@ -64,17 +64,17 @@ AliRsnCutPIDITS& AliRsnCutPIDITS::operator=(const AliRsnCutPIDITS& copy) // Assignment operator // - AliRsnCut::operator=(copy); + AliRsnCut::operator=(copy); - fInitialized = kFALSE; - fRejectOutside = copy.fRejectOutside; - fMomMin = copy.fMomMin; - fMomMax = copy.fMomMax; - fRefType = copy.fRefType; - fESDpid = copy.fESDpid; - fAODpid = copy.fAODpid; - - return (*this); + fInitialized = kFALSE; + fRejectOutside = copy.fRejectOutside; + fMomMin = copy.fMomMin; + fMomMax = copy.fMomMax; + fRefType = copy.fRefType; + fESDpid = copy.fESDpid; + fAODpid = copy.fAODpid; + + return (*this); } //_________________________________________________________________________________________________ @@ -84,10 +84,10 @@ void AliRsnCutPIDITS::SetMC(Bool_t yn) // Properly set the PID response // - AliITSPIDResponse itsresponse(yn); - - fESDpid.GetITSResponse() = itsresponse; - fAODpid.GetITSResponse() = itsresponse; + AliITSPIDResponse itsresponse(yn); + + fESDpid.GetITSResponse() = itsresponse; + fAODpid.GetITSResponse() = itsresponse; } //_________________________________________________________________________________________________ @@ -97,76 +97,67 @@ Bool_t AliRsnCutPIDITS::IsSelected(TObject *object) // Cut checker. // - // initialize if needed - if (!fInitialized) Initialize(); - - // coherence check - if (!TargetOK(object)) return kFALSE; - - // reject not ITS tracks - // status is checked in the same way for all tracks - AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); - if (!vtrack) - { - AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); - return kFALSE; - } - - // check status, to know it track is an ITS+TPC or ITS standalone - // and reject it if it is of none of them - Bool_t isSA = kFALSE; - if (IsTPC(vtrack)) isSA = kFALSE; - else if (IsSA(vtrack)) isSA = kTRUE; - else - { - AliDebug(AliLog::kDebug + 2, "Status flags unmatched"); - return kFALSE; - } - - // common evaluation variables - Int_t k, nITSpidLayers = 0; - Double_t mom = vtrack->P(); - AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); - AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); - - // check momentum - if (mom < fMomMin || mom > fMomMax) - { - AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom)); - return (!fRejectOutside); - } - - // count number of PID layers... - if (esdTrack) - { - UChar_t itsCluMap = esdTrack->GetITSClusterMap(); - for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITSpidLayers; - } - else if (aodTrack) - { - for(k = 2; k < 6; k++) if (TESTBIT(aodTrack->GetITSClusterMap(), k)) ++nITSpidLayers; - } - else - { - AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); - return kFALSE; - } - // ...and reject tracks where it is smaller than 3 - if (nITSpidLayers < 3) - { - AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers"); - return kFALSE; - } - - // assign PID nsigmas to default cut check value - // since bad object types are rejected before, here we have an ESD track or AOD track - if (esdTrack) - fCutValueD = fESDpid.GetITSResponse().GetNumberOfSigmas(mom, esdTrack->GetITSsignal(), fRefType, nITSpidLayers, isSA); - else - fCutValueD = fAODpid.NumberOfSigmasITS(aodTrack, fRefType); - - // use default cut checking method - return OkRangeD(); + // initialize if needed + if (!fInitialized) Initialize(); + + // coherence check + if (!TargetOK(object)) return kFALSE; + + // reject not ITS tracks + // status is checked in the same way for all tracks + AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); + if (!vtrack) { + AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); + return kFALSE; + } + + // check status, to know it track is an ITS+TPC or ITS standalone + // and reject it if it is of none of them + Bool_t isSA = kFALSE; + if (IsTPC(vtrack)) isSA = kFALSE; + else if (IsSA(vtrack)) isSA = kTRUE; + else { + AliDebug(AliLog::kDebug + 2, "Status flags unmatched"); + return kFALSE; + } + + // common evaluation variables + Int_t k, nITSpidLayers = 0; + Double_t mom = vtrack->P(); + AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); + AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); + + // check momentum + if (mom < fMomMin || mom > fMomMax) { + AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom)); + return (!fRejectOutside); + } + + // count number of PID layers... + if (esdTrack) { + UChar_t itsCluMap = esdTrack->GetITSClusterMap(); + for (k = 2; k < 6; k++) if (itsCluMap & (1 << k)) ++nITSpidLayers; + } else if (aodTrack) { + for (k = 2; k < 6; k++) if (TESTBIT(aodTrack->GetITSClusterMap(), k)) ++nITSpidLayers; + } else { + AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); + return kFALSE; + } + // ...and reject tracks where it is smaller than 3 + if (nITSpidLayers < 3) { + AliDebug(AliLog::kDebug + 2, "Rejecting track with too few ITS pid layers"); + return kFALSE; + } + + // assign PID nsigmas to default cut check value + // since bad object types are rejected before, here we have an ESD track or AOD track + if (esdTrack) + fCutValueD = fESDpid.GetITSResponse().GetNumberOfSigmas(mom, esdTrack->GetITSsignal(), fRefType, nITSpidLayers, isSA); + else + fCutValueD = fAODpid.NumberOfSigmasITS(aodTrack, fRefType); + + // use default cut checking method + return OkRangeD(); } //_________________________________________________________________________________________________ @@ -176,10 +167,10 @@ void AliRsnCutPIDITS::Print(const Option_t *) const // Print information on this cut // - AliInfo(Form("Cut name : %s", GetName())); - AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD)); - AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax)); - AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted"))); + AliInfo(Form("Cut name : %s", GetName())); + AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD)); + AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax)); + AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted"))); } //_________________________________________________________________________________________________ @@ -189,13 +180,12 @@ void AliRsnCutPIDITS::Initialize() // Initialize ESD pid object from global one // - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - AliESDInputHandler *handler = dynamic_cast(mgr->GetInputEventHandler()); - if (handler) - { - AliESDpid *pid = handler->GetESDpid(); - fESDpid = (*pid); - } - - fInitialized = kTRUE; + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + AliESDInputHandler *handler = dynamic_cast(mgr->GetInputEventHandler()); + if (handler) { + AliESDpid *pid = handler->GetESDpid(); + fESDpid = (*pid); + } + + fInitialized = kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnCutPIDITS.h b/PWG2/RESONANCES/AliRsnCutPIDITS.h index 207cee891d9..7b5ae5adf44 100644 --- a/PWG2/RESONANCES/AliRsnCutPIDITS.h +++ b/PWG2/RESONANCES/AliRsnCutPIDITS.h @@ -24,47 +24,46 @@ #include "AliRsnDaughter.h" #include "AliRsnCut.h" -class AliRsnCutPIDITS : public AliRsnCut -{ - public: - - AliRsnCutPIDITS(const char *name = "cutITS", - EPARTYPE ref = AliPID::kKaon, - Double_t nSigmaMin = -3., - Double_t nSigmaMax = 3., - Bool_t rejectOutside = kTRUE); - - AliRsnCutPIDITS(const AliRsnCutPIDITS& copy); - AliRsnCutPIDITS& operator=(const AliRsnCutPIDITS& copy); - virtual ~AliRsnCutPIDITS() { } - - AliESDpid* ESDpid() {return &fESDpid;} - AliAODpidUtil* AODpid() {return &fAODpid;} - - void SetMC(Bool_t mc = kTRUE); - void SetRejectOutside(Bool_t yn = kTRUE) {fRejectOutside = yn;} - void SetMomentumRange(Double_t min, Double_t max) {fMomMin = min; fMomMax = max;} - void SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} - void SetRefType(EPARTYPE type) {fRefType = type;} - - Bool_t IsTPC(AliVTrack *vtrack); - Bool_t IsSA(AliVTrack *vtrack); - virtual Bool_t IsSelected(TObject *object); - virtual void Print(const Option_t *option = "") const; - - private: - - void Initialize(); - - Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object - Bool_t fRejectOutside; // choose if tracks outside momentum range are rejected or not - Double_t fMomMin; // min p in range where this cut is checked - Double_t fMomMax; // max p in range where this cut is checked - EPARTYPE fRefType; // particle type for which PID is checked - AliESDpid fESDpid; // ESD PID object - AliAODpidUtil fAODpid; // AOD PID object - - ClassDef(AliRsnCutPIDITS, 1) +class AliRsnCutPIDITS : public AliRsnCut { +public: + + AliRsnCutPIDITS(const char *name = "cutITS", + EPARTYPE ref = AliPID::kKaon, + Double_t nSigmaMin = -3., + Double_t nSigmaMax = 3., + Bool_t rejectOutside = kTRUE); + + AliRsnCutPIDITS(const AliRsnCutPIDITS& copy); + AliRsnCutPIDITS& operator=(const AliRsnCutPIDITS& copy); + virtual ~AliRsnCutPIDITS() { } + + AliESDpid* ESDpid() {return &fESDpid;} + AliAODpidUtil* AODpid() {return &fAODpid;} + + void SetMC(Bool_t mc = kTRUE); + void SetRejectOutside(Bool_t yn = kTRUE) {fRejectOutside = yn;} + void SetMomentumRange(Double_t min, Double_t max) {fMomMin = min; fMomMax = max;} + void SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} + void SetRefType(EPARTYPE type) {fRefType = type;} + + Bool_t IsTPC(AliVTrack *vtrack); + Bool_t IsSA(AliVTrack *vtrack); + virtual Bool_t IsSelected(TObject *object); + virtual void Print(const Option_t *option = "") const; + +private: + + void Initialize(); + + Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object + Bool_t fRejectOutside; // choose if tracks outside momentum range are rejected or not + Double_t fMomMin; // min p in range where this cut is checked + Double_t fMomMax; // max p in range where this cut is checked + EPARTYPE fRefType; // particle type for which PID is checked + AliESDpid fESDpid; // ESD PID object + AliAODpidUtil fAODpid; // AOD PID object + + ClassDef(AliRsnCutPIDITS, 1) }; inline Bool_t AliRsnCutPIDITS::IsTPC(AliVTrack *vtrack) @@ -73,19 +72,18 @@ inline Bool_t AliRsnCutPIDITS::IsTPC(AliVTrack *vtrack) // Checks if the track has the status flags required for a global track // - if (!vtrack) - { - AliWarning("NULL argument: impossible to check status"); - return kFALSE; - } - - Bool_t isTPCin = ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0); - Bool_t isITSrefit = ((vtrack->GetStatus() & AliESDtrack::kITSrefit) != 0); - Bool_t isITSpid = ((vtrack->GetStatus() & AliESDtrack::kITSpid) != 0); - - return ( isTPCin && isITSrefit && isITSpid ); - - return kTRUE; + if (!vtrack) { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + Bool_t isTPCin = ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0); + Bool_t isITSrefit = ((vtrack->GetStatus() & AliESDtrack::kITSrefit) != 0); + Bool_t isITSpid = ((vtrack->GetStatus() & AliESDtrack::kITSpid) != 0); + + return (isTPCin && isITSrefit && isITSpid); + + return kTRUE; } inline Bool_t AliRsnCutPIDITS::IsSA(AliVTrack *vtrack) @@ -94,20 +92,19 @@ inline Bool_t AliRsnCutPIDITS::IsSA(AliVTrack *vtrack) // Checks if the track has the status flags required for an ITS standalone track // - if (!vtrack) - { - AliWarning("NULL argument: impossible to check status"); - return kFALSE; - } - - Bool_t isTPCin = ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0); - Bool_t isITSrefit = ((vtrack->GetStatus() & AliESDtrack::kITSrefit) != 0); - Bool_t isITSpureSA = ((vtrack->GetStatus() & AliESDtrack::kITSpureSA) != 0); - Bool_t isITSpid = ((vtrack->GetStatus() & AliESDtrack::kITSpid) != 0); - - return ( (!isTPCin) && isITSrefit && (!isITSpureSA) && isITSpid ); - - return kTRUE; + if (!vtrack) { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + Bool_t isTPCin = ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0); + Bool_t isITSrefit = ((vtrack->GetStatus() & AliESDtrack::kITSrefit) != 0); + Bool_t isITSpureSA = ((vtrack->GetStatus() & AliESDtrack::kITSpureSA) != 0); + Bool_t isITSpid = ((vtrack->GetStatus() & AliESDtrack::kITSpid) != 0); + + return ((!isTPCin) && isITSrefit && (!isITSpureSA) && isITSpid); + + return kTRUE; } #endif diff --git a/PWG2/RESONANCES/AliRsnCutPIDTOF.cxx b/PWG2/RESONANCES/AliRsnCutPIDTOF.cxx index 6b47b272a3e..fd4b560b98e 100644 --- a/PWG2/RESONANCES/AliRsnCutPIDTOF.cxx +++ b/PWG2/RESONANCES/AliRsnCutPIDTOF.cxx @@ -21,13 +21,13 @@ ClassImp(AliRsnCutPIDTOF) //_________________________________________________________________________________________________ AliRsnCutPIDTOF::AliRsnCutPIDTOF (const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectUnmatched) : - AliRsnCut(name, AliRsnCut::kDaughter, min, max), - fInitialized(kFALSE), - fRejectUnmatched(rejectUnmatched), - fRefType(AliPID::kUnknown), - fRefMass(0.0), - fESDpid(), - fAODpid() + AliRsnCut(name, AliRsnCut::kDaughter, min, max), + fInitialized(kFALSE), + fRejectUnmatched(rejectUnmatched), + fRefType(AliPID::kUnknown), + fRefMass(0.0), + fESDpid(), + fAODpid() { // // Default constructor. @@ -35,18 +35,18 @@ AliRsnCutPIDTOF::AliRsnCutPIDTOF // which sets the mass accordingly and coherently. // - SetRefType(ref); + SetRefType(ref); } //_________________________________________________________________________________________________ AliRsnCutPIDTOF::AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy) : - AliRsnCut(copy), - fInitialized(kFALSE), - fRejectUnmatched(copy.fRejectUnmatched), - fRefType(AliPID::kUnknown), - fRefMass(0.0), - fESDpid(copy.fESDpid), - fAODpid(copy.fAODpid) + AliRsnCut(copy), + fInitialized(kFALSE), + fRejectUnmatched(copy.fRejectUnmatched), + fRefType(AliPID::kUnknown), + fRefMass(0.0), + fESDpid(copy.fESDpid), + fAODpid(copy.fAODpid) { // // Copy constructor. @@ -54,7 +54,7 @@ AliRsnCutPIDTOF::AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy) : // which sets the mass accordingly and coherently. // - SetRefType(copy.fRefType); + SetRefType(copy.fRefType); } //_________________________________________________________________________________________________ @@ -66,14 +66,14 @@ AliRsnCutPIDTOF& AliRsnCutPIDTOF::operator=(const AliRsnCutPIDTOF& copy) // which sets the mass accordingly and coherently. // - fInitialized = kFALSE; - fRejectUnmatched = copy.fRejectUnmatched; - fESDpid = copy.fESDpid; - fAODpid = copy.fAODpid; + fInitialized = kFALSE; + fRejectUnmatched = copy.fRejectUnmatched; + fESDpid = copy.fESDpid; + fAODpid = copy.fAODpid; - SetRefType(copy.fRefType); - - return (*this); + SetRefType(copy.fRefType); + + return (*this); } //_________________________________________________________________________________________________ @@ -83,70 +83,62 @@ Bool_t AliRsnCutPIDTOF::IsSelected(TObject *object) // Cut checker. // - // initialize if needed - if (!fInitialized) Initialize(); - - // coherence check - if (!TargetOK(object)) return kFALSE; - - // reject always non-track objects - AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); - if (!vtrack) - { - AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); - return kFALSE; - } - - // checks that track is matched in TOF: - // if not, the track is accepted or rejected - // depending on the 'fRejectUnmatched' data member: - // -- kTRUE --> all unmatched tracks are rejected - // -- kFALSE --> all unmatched tracks are accepted (it is assumed that other PIDs are done) - if (!IsMatched(vtrack)) - { - AliDebug(AliLog::kDebug + 2, "Track is not matched with TOF"); - return (!fRejectUnmatched); - } - - // retrieve real object type and - // prepare some useful variables - Double_t tof, sigma, times[5]; - Double_t &ref = times[(Int_t)fRefType]; - AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); - AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); - - // cut check depends on the object type - if (esdTrack) - { - // setup the ESD PID object - AliESDEvent *esd = AliRsnTarget::GetCurrentEvent()->GetRefESD(); - if (!esd) - { - AliError("Processing an ESD track, but target is not an ESD event"); + // initialize if needed + if (!fInitialized) Initialize(); + + // coherence check + if (!TargetOK(object)) return kFALSE; + + // reject always non-track objects + AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); + if (!vtrack) { + AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); return kFALSE; - } - fESDpid.SetTOFResponse(esd, AliESDpid::kTOF_T0); - - // get time of flight, reference times and sigma - esdTrack->GetIntegratedTimes(times); - tof = (Double_t)(esdTrack->GetTOFsignal() - fESDpid.GetTOFResponse().GetStartTime(esdTrack->P())); - sigma = (Double_t)fESDpid.GetTOFResponse().GetExpectedSigma(esdTrack->P(), ref, fRefMass); - - // port values to standard AliRsnCut checker - fCutValueD = (tof - ref) / sigma; - return OkRangeD(); - } - else if (aodTrack) - { - // for AOD tracks, all operations are done by the AOD PID utility - fCutValueD = (Double_t)fAODpid.NumberOfSigmasTOF(aodTrack, fRefType); - return OkRangeD(); - } - else - { - AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); - return kFALSE; - } + } + + // checks that track is matched in TOF: + // if not, the track is accepted or rejected + // depending on the 'fRejectUnmatched' data member: + // -- kTRUE --> all unmatched tracks are rejected + // -- kFALSE --> all unmatched tracks are accepted (it is assumed that other PIDs are done) + if (!IsMatched(vtrack)) { + AliDebug(AliLog::kDebug + 2, "Track is not matched with TOF"); + return (!fRejectUnmatched); + } + + // retrieve real object type and + // prepare some useful variables + Double_t tof, sigma, times[5]; + Double_t &ref = times[(Int_t)fRefType]; + AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); + AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); + + // cut check depends on the object type + if (esdTrack) { + // setup the ESD PID object + AliESDEvent *esd = AliRsnTarget::GetCurrentEvent()->GetRefESD(); + if (!esd) { + AliError("Processing an ESD track, but target is not an ESD event"); + return kFALSE; + } + fESDpid.SetTOFResponse(esd, AliESDpid::kTOF_T0); + + // get time of flight, reference times and sigma + esdTrack->GetIntegratedTimes(times); + tof = (Double_t)(esdTrack->GetTOFsignal() - fESDpid.GetTOFResponse().GetStartTime(esdTrack->P())); + sigma = (Double_t)fESDpid.GetTOFResponse().GetExpectedSigma(esdTrack->P(), ref, fRefMass); + + // port values to standard AliRsnCut checker + fCutValueD = (tof - ref) / sigma; + return OkRangeD(); + } else if (aodTrack) { + // for AOD tracks, all operations are done by the AOD PID utility + fCutValueD = (Double_t)fAODpid.NumberOfSigmasTOF(aodTrack, fRefType); + return OkRangeD(); + } else { + AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); + return kFALSE; + } } //_________________________________________________________________________________________________ @@ -156,9 +148,9 @@ void AliRsnCutPIDTOF::Print(const Option_t *) const // Print information on this cut // - AliInfo(Form("Cut name, type : %s %s", GetName(), ClassName())); - AliInfo(Form("TOF PID cut range (sigmas): %.3f %.3f", fMinD, fMaxD)); - AliInfo(Form("Unmatched tracks are : %s", (fRejectUnmatched ? "rejected" : "accepted"))); + AliInfo(Form("Cut name, type : %s %s", GetName(), ClassName())); + AliInfo(Form("TOF PID cut range (sigmas): %.3f %.3f", fMinD, fMaxD)); + AliInfo(Form("Unmatched tracks are : %s", (fRejectUnmatched ? "rejected" : "accepted"))); } //_________________________________________________________________________________________________ @@ -168,13 +160,12 @@ void AliRsnCutPIDTOF::Initialize() // Initialize ESD pid object from global one // - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - AliESDInputHandler *handler = dynamic_cast(mgr->GetInputEventHandler()); - if (handler) - { - AliESDpid *pid = handler->GetESDpid(); - fESDpid = (*pid); - } - - fInitialized = kTRUE; + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + AliESDInputHandler *handler = dynamic_cast(mgr->GetInputEventHandler()); + if (handler) { + AliESDpid *pid = handler->GetESDpid(); + fESDpid = (*pid); + } + + fInitialized = kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnCutPIDTOF.h b/PWG2/RESONANCES/AliRsnCutPIDTOF.h index 1c92c3b2274..67dc986f54e 100644 --- a/PWG2/RESONANCES/AliRsnCutPIDTOF.h +++ b/PWG2/RESONANCES/AliRsnCutPIDTOF.h @@ -23,43 +23,42 @@ #include "AliRsnDaughter.h" #include "AliRsnCut.h" -class AliRsnCutPIDTOF : public AliRsnCut -{ - public: - - AliRsnCutPIDTOF(const char *name = "cutTOF", - EPARTYPE particle = AliPID::kKaon, - Double_t nSigmaMin = -3., - Double_t nSigmaMax = 3., - Bool_t rejectUnmatched = kFALSE); - - AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy); - AliRsnCutPIDTOF& operator=(const AliRsnCutPIDTOF& copy); - virtual ~AliRsnCutPIDTOF() { } - - AliESDpid* ESDpid() {return &fESDpid;} - AliAODpidUtil* AODpid() {return &fAODpid;} - - void SetRejectUnmatched(Bool_t yn = kTRUE) {fRejectUnmatched = yn;} - void SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} - void SetRefType(EPARTYPE type) {fRefType = type; fRefMass = AliPID::ParticleMass(type);} - - Bool_t IsMatched(AliVTrack *vtrack); - virtual Bool_t IsSelected(TObject *object); - virtual void Print(const Option_t *option = "") const; - - private: - - void Initialize(); - - Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object - Bool_t fRejectUnmatched; // decide if non TOF matched tracks pass the cut or not - EPARTYPE fRefType; // particle type for which PID is checked - Double_t fRefMass; // reference mass used for computations - AliESDpid fESDpid; // PID utility for ESD - AliAODpidUtil fAODpid; // PID utility for AOD - - ClassDef(AliRsnCutPIDTOF, 1) +class AliRsnCutPIDTOF : public AliRsnCut { +public: + + AliRsnCutPIDTOF(const char *name = "cutTOF", + EPARTYPE particle = AliPID::kKaon, + Double_t nSigmaMin = -3., + Double_t nSigmaMax = 3., + Bool_t rejectUnmatched = kFALSE); + + AliRsnCutPIDTOF(const AliRsnCutPIDTOF& copy); + AliRsnCutPIDTOF& operator=(const AliRsnCutPIDTOF& copy); + virtual ~AliRsnCutPIDTOF() { } + + AliESDpid* ESDpid() {return &fESDpid;} + AliAODpidUtil* AODpid() {return &fAODpid;} + + void SetRejectUnmatched(Bool_t yn = kTRUE) {fRejectUnmatched = yn;} + void SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} + void SetRefType(EPARTYPE type) {fRefType = type; fRefMass = AliPID::ParticleMass(type);} + + Bool_t IsMatched(AliVTrack *vtrack); + virtual Bool_t IsSelected(TObject *object); + virtual void Print(const Option_t *option = "") const; + +private: + + void Initialize(); + + Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object + Bool_t fRejectUnmatched; // decide if non TOF matched tracks pass the cut or not + EPARTYPE fRefType; // particle type for which PID is checked + Double_t fRefMass; // reference mass used for computations + AliESDpid fESDpid; // PID utility for ESD + AliAODpidUtil fAODpid; // PID utility for AOD + + ClassDef(AliRsnCutPIDTOF, 1) }; inline Bool_t AliRsnCutPIDTOF::IsMatched(AliVTrack *vtrack) @@ -68,24 +67,23 @@ inline Bool_t AliRsnCutPIDTOF::IsMatched(AliVTrack *vtrack) // Checks if the track has the status flags required for an ITS standalone track // - if (!vtrack) - { - AliWarning("NULL argument: impossible to check status"); - return kFALSE; - } + if (!vtrack) { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } - Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0); - Bool_t isTIME = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0); + Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0); + Bool_t isTIME = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0); - // if flags are not set, track is not matched - if ( !isTOFout || !isTIME ) return kFALSE; + // if flags are not set, track is not matched + if (!isTOFout || !isTIME) return kFALSE; - // do an additional check on integrated length for ESD tracks - AliESDtrack *esdTrack = dynamic_cast(vtrack); - if (esdTrack) if (esdTrack->GetIntegratedLength() < 350.) return kFALSE; + // do an additional check on integrated length for ESD tracks + AliESDtrack *esdTrack = dynamic_cast(vtrack); + if (esdTrack) if (esdTrack->GetIntegratedLength() < 350.) return kFALSE; - // if we are here, flags are OK and length also - return kTRUE; + // if we are here, flags are OK and length also + return kTRUE; } #endif diff --git a/PWG2/RESONANCES/AliRsnCutPIDTPC.cxx b/PWG2/RESONANCES/AliRsnCutPIDTPC.cxx index 5e9aa7e52e8..aaf928c9ecf 100644 --- a/PWG2/RESONANCES/AliRsnCutPIDTPC.cxx +++ b/PWG2/RESONANCES/AliRsnCutPIDTPC.cxx @@ -25,14 +25,14 @@ ClassImp(AliRsnCutPIDTPC) //_________________________________________________________________________________________________ AliRsnCutPIDTPC::AliRsnCutPIDTPC (const char *name, AliPID::EParticleType type, Double_t min, Double_t max, Bool_t rejectOutside) : - AliRsnCut(name, AliRsnCut::kDaughter, min, max), - fInitialized(kFALSE), - fRejectOutside(rejectOutside), - fMomMin(0.0), - fMomMax(1E+20), - fRefType(type), - fESDpid(), - fAODpid() + AliRsnCut(name, AliRsnCut::kDaughter, min, max), + fInitialized(kFALSE), + fRejectOutside(rejectOutside), + fMomMin(0.0), + fMomMax(1E+20), + fRefType(type), + fESDpid(), + fAODpid() { // // Main constructor. @@ -42,14 +42,14 @@ AliRsnCutPIDTPC::AliRsnCutPIDTPC //_________________________________________________________________________________________________ AliRsnCutPIDTPC::AliRsnCutPIDTPC (const AliRsnCutPIDTPC& copy) : - AliRsnCut(copy), - fInitialized(kFALSE), - fRejectOutside(copy.fRejectOutside), - fMomMin(copy.fMomMin), - fMomMax(copy.fMomMax), - fRefType(copy.fRefType), - fESDpid(copy.fESDpid), - fAODpid(copy.fAODpid) + AliRsnCut(copy), + fInitialized(kFALSE), + fRejectOutside(copy.fRejectOutside), + fMomMin(copy.fMomMin), + fMomMax(copy.fMomMax), + fRefType(copy.fRefType), + fESDpid(copy.fESDpid), + fAODpid(copy.fAODpid) { // // Copy constructor. @@ -63,17 +63,17 @@ AliRsnCutPIDTPC& AliRsnCutPIDTPC::operator=(const AliRsnCutPIDTPC& copy) // Assignment operator // - AliRsnCut::operator=(copy); + AliRsnCut::operator=(copy); - fInitialized = kFALSE; - fRejectOutside = copy.fRejectOutside; - fMomMin = copy.fMomMin; - fMomMax = copy.fMomMax; - fRefType = copy.fRefType; - fESDpid = copy.fESDpid; - fAODpid = copy.fAODpid; - - return (*this); + fInitialized = kFALSE; + fRejectOutside = copy.fRejectOutside; + fMomMin = copy.fMomMin; + fMomMax = copy.fMomMax; + fRefType = copy.fRefType; + fESDpid = copy.fESDpid; + fAODpid = copy.fAODpid; + + return (*this); } //_________________________________________________________________________________________________ @@ -83,8 +83,8 @@ void AliRsnCutPIDTPC::SetBBParam(Double_t p0, Double_t p1, Double_t p2, Double_t // Properly set the Bethe-Bloch parameters in all places where it is needed. // - fESDpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4); - fAODpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4); + fESDpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4); + fAODpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4); } //_________________________________________________________________________________________________ @@ -94,52 +94,49 @@ Bool_t AliRsnCutPIDTPC::IsSelected(TObject *object) // Cut checker. // - // initialize if needed - if (!fInitialized) Initialize(); - - // coherence check - if (!TargetOK(object)) return kFALSE; - - // reject not TPC tracks - AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); - if (!vtrack) return kFALSE; - if (!IsTPC(vtrack)) - { - AliDebug(AliLog::kDebug + 2, "Track is not found in TPC"); - return kFALSE; - } - - // common evaluation variables - Double_t mom; - AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); - AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); - - // get inner momentum and check it w.r. to allowed range: - // all tracks outside it will pass the cut or not, depending on 'fRejectOutside' - if (esdTrack) - mom = esdTrack->GetInnerParam()->P(); - else if (aodTrack) - mom = aodTrack->GetDetPid()->GetTPCmomentum(); - else - { - AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); - return kFALSE; - } - if ((mom < fMomMin || mom > fMomMax)) - { - AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom)); - return (!fRejectOutside); - } - - // assign PID nsigmas to default cut check value - // since bad object types are rejected before, here we have an ESD track or AOD track - if (esdTrack) - fCutValueD = fESDpid.GetTPCResponse().GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fRefType); - else - fCutValueD = fAODpid.NumberOfSigmasTPC(aodTrack, fRefType); - - // use AliRsnCut default method to check cut - return OkRangeD(); + // initialize if needed + if (!fInitialized) Initialize(); + + // coherence check + if (!TargetOK(object)) return kFALSE; + + // reject not TPC tracks + AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); + if (!vtrack) return kFALSE; + if (!IsTPC(vtrack)) { + AliDebug(AliLog::kDebug + 2, "Track is not found in TPC"); + return kFALSE; + } + + // common evaluation variables + Double_t mom; + AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); + AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); + + // get inner momentum and check it w.r. to allowed range: + // all tracks outside it will pass the cut or not, depending on 'fRejectOutside' + if (esdTrack) + mom = esdTrack->GetInnerParam()->P(); + else if (aodTrack) + mom = aodTrack->GetDetPid()->GetTPCmomentum(); + else { + AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); + return kFALSE; + } + if ((mom < fMomMin || mom > fMomMax)) { + AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom)); + return (!fRejectOutside); + } + + // assign PID nsigmas to default cut check value + // since bad object types are rejected before, here we have an ESD track or AOD track + if (esdTrack) + fCutValueD = fESDpid.GetTPCResponse().GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fRefType); + else + fCutValueD = fAODpid.NumberOfSigmasTPC(aodTrack, fRefType); + + // use AliRsnCut default method to check cut + return OkRangeD(); } //_________________________________________________________________________________________________ @@ -149,10 +146,10 @@ void AliRsnCutPIDTPC::Print(const Option_t *) const // Print information on this cut // - AliInfo(Form("Cut name : %s", GetName())); - AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD)); - AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax)); - AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted"))); + AliInfo(Form("Cut name : %s", GetName())); + AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD)); + AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax)); + AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted"))); } //_________________________________________________________________________________________________ @@ -162,13 +159,12 @@ void AliRsnCutPIDTPC::Initialize() // Initialize ESD pid object from global one // - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - AliESDInputHandler *handler = dynamic_cast(mgr->GetInputEventHandler()); - if (handler) - { - AliESDpid *pid = handler->GetESDpid(); - fESDpid = (*pid); - } + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + AliESDInputHandler *handler = dynamic_cast(mgr->GetInputEventHandler()); + if (handler) { + AliESDpid *pid = handler->GetESDpid(); + fESDpid = (*pid); + } - fInitialized = kTRUE; + fInitialized = kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnCutPIDTPC.h b/PWG2/RESONANCES/AliRsnCutPIDTPC.h index 1d80f7e9d1f..1adf97064ae 100644 --- a/PWG2/RESONANCES/AliRsnCutPIDTPC.h +++ b/PWG2/RESONANCES/AliRsnCutPIDTPC.h @@ -24,47 +24,46 @@ #include "AliRsnDaughter.h" #include "AliRsnCut.h" -class AliRsnCutPIDTPC : public AliRsnCut -{ - public: - - AliRsnCutPIDTPC(const char *name = "cutTPC", - EPARTYPE type = AliPID::kKaon, - Double_t nSigmaMin = -3., - Double_t nSigmaMax = 3., - Bool_t rejectOutside = kTRUE); - - AliRsnCutPIDTPC(const AliRsnCutPIDTPC& copy); - AliRsnCutPIDTPC& operator=(const AliRsnCutPIDTPC& copy); - virtual ~AliRsnCutPIDTPC() { } - - AliESDpid* ESDpid() {return &fESDpid;} - AliAODpidUtil* AODpid() {return &fAODpid;} - - void SetRejectOutside(Bool_t yn = kTRUE) {fRejectOutside = yn;} - void SetMomentumRange(Double_t min, Double_t max) {fMomMin = min; fMomMax = max;} - void SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} - void SetRefType(EPARTYPE type) {fRefType = type;} - void SetBBParam(Double_t *p) {SetBBParam(p[0], p[1], p[2], p[3], p[4]);} - void SetBBParam(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4); - - Bool_t IsTPC(AliVTrack *vtrack); - virtual Bool_t IsSelected(TObject *object); - virtual void Print(const Option_t *option = "") const; - - private: - - void Initialize(); - - Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object - Bool_t fRejectOutside; // choose if tracks outside momentum range are rejected or not - Double_t fMomMin; // min p in range where this cut is checked - Double_t fMomMax; // max p in range where this cut is checked - EPARTYPE fRefType; // particle type for which PID is checked - AliESDpid fESDpid; // ESD PID object - AliAODpidUtil fAODpid; // AOD PID object - - ClassDef(AliRsnCutPIDTPC, 1) +class AliRsnCutPIDTPC : public AliRsnCut { +public: + + AliRsnCutPIDTPC(const char *name = "cutTPC", + EPARTYPE type = AliPID::kKaon, + Double_t nSigmaMin = -3., + Double_t nSigmaMax = 3., + Bool_t rejectOutside = kTRUE); + + AliRsnCutPIDTPC(const AliRsnCutPIDTPC& copy); + AliRsnCutPIDTPC& operator=(const AliRsnCutPIDTPC& copy); + virtual ~AliRsnCutPIDTPC() { } + + AliESDpid* ESDpid() {return &fESDpid;} + AliAODpidUtil* AODpid() {return &fAODpid;} + + void SetRejectOutside(Bool_t yn = kTRUE) {fRejectOutside = yn;} + void SetMomentumRange(Double_t min, Double_t max) {fMomMin = min; fMomMax = max;} + void SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;} + void SetRefType(EPARTYPE type) {fRefType = type;} + void SetBBParam(Double_t *p) {SetBBParam(p[0], p[1], p[2], p[3], p[4]);} + void SetBBParam(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4); + + Bool_t IsTPC(AliVTrack *vtrack); + virtual Bool_t IsSelected(TObject *object); + virtual void Print(const Option_t *option = "") const; + +private: + + void Initialize(); + + Bool_t fInitialized; // a mono-usage flag which initializes the ESD pid object + Bool_t fRejectOutside; // choose if tracks outside momentum range are rejected or not + Double_t fMomMin; // min p in range where this cut is checked + Double_t fMomMax; // max p in range where this cut is checked + EPARTYPE fRefType; // particle type for which PID is checked + AliESDpid fESDpid; // ESD PID object + AliAODpidUtil fAODpid; // AOD PID object + + ClassDef(AliRsnCutPIDTPC, 1) }; inline Bool_t AliRsnCutPIDTPC::IsTPC(AliVTrack *vtrack) @@ -73,19 +72,18 @@ inline Bool_t AliRsnCutPIDTPC::IsTPC(AliVTrack *vtrack) // Checks if the track has the status flags required for a global track // - if (!vtrack) - { - AliWarning("NULL argument: impossible to check status"); - return kFALSE; - } - - Bool_t isTPCin = ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0); - Bool_t isITSrefit = ((vtrack->GetStatus() & AliESDtrack::kITSrefit) != 0); - Bool_t isITSpid = ((vtrack->GetStatus() & AliESDtrack::kITSpid) != 0); - - return ( isTPCin && isITSrefit && isITSpid ); - - return kTRUE; + if (!vtrack) { + AliWarning("NULL argument: impossible to check status"); + return kFALSE; + } + + Bool_t isTPCin = ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0); + Bool_t isITSrefit = ((vtrack->GetStatus() & AliESDtrack::kITSrefit) != 0); + Bool_t isITSpid = ((vtrack->GetStatus() & AliESDtrack::kITSpid) != 0); + + return (isTPCin && isITSrefit && isITSpid); + + return kTRUE; } #endif diff --git a/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx b/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx index afc75ebe7b7..48ac81e2fcf 100644 --- a/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx +++ b/PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx @@ -15,9 +15,9 @@ ClassImp(AliRsnCutPrimaryVertex) //_________________________________________________________________________________________________ AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex (const char *name, Double_t maxVz, Int_t nContributors, Bool_t acceptTPC) : - AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1, 0.0, maxVz), - fAcceptTPC(acceptTPC), - fCheckPileUp(kFALSE) + AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1, 0.0, maxVz), + fAcceptTPC(acceptTPC), + fCheckPileUp(kFALSE) { // // Main constructor. @@ -34,8 +34,8 @@ AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex // must be decreased by 1 to get the right behaviour, since this is integer. // - fMinD = 0.0; - fMaxD = maxVz + 1E-6; + fMinD = 0.0; + fMaxD = maxVz + 1E-6; } //_________________________________________________________________________________________________ @@ -44,84 +44,71 @@ Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *object) // // Cut checker // - - // retrieve ESD event - AliRsnEvent *rsn = dynamic_cast(object); - if (!rsn) return kFALSE; - AliESDEvent *esd = rsn->GetRefESD(); - AliAODEvent *aod = rsn->GetRefAOD(); - - if (esd) - { - // pile-up check - if (fCheckPileUp) - { - if (esd->IsPileupFromSPD()) return kFALSE; - } - - // get the best primary vertex: - // first try the one with tracks - const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks(); - const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD(); - const AliESDVertex *vTPC = esd->GetPrimaryVertexTPC(); - Int_t ncTrk = -1; - Int_t ncSPD = -1; - Int_t ncTPC = -1; - Double_t vzTrk = 1000000.0; - Double_t vzSPD = 1000000.0; - Double_t vzTPC = 1000000.0; - if (vTrk) vzTrk = TMath::Abs(vTrk->GetZv()); - if (vSPD) vzSPD = TMath::Abs(vSPD->GetZv()); - if (vTPC) vzTPC = TMath::Abs(vTPC->GetZv()); - if (vTrk) ncTrk = (Int_t)vTrk->GetNContributors(); - if (vSPD) ncSPD = (Int_t)vSPD->GetNContributors(); - if (vTPC) ncTPC = (Int_t)vTPC->GetNContributors(); - if(vTrk && ncTrk > 0) - { - fCutValueI = ncTrk; - fCutValueD = vzTrk; - } - else if (vSPD && ncSPD > 0) - { - fCutValueI = ncSPD; - fCutValueD = vzSPD; - } - else if (vTPC && ncTPC > 0) - { - if (!fAcceptTPC) - return kFALSE; - else - { - fCutValueI = ncTPC; - fCutValueD = vzTPC; + + // retrieve ESD event + AliRsnEvent *rsn = dynamic_cast(object); + if (!rsn) return kFALSE; + AliESDEvent *esd = rsn->GetRefESD(); + AliAODEvent *aod = rsn->GetRefAOD(); + + if (esd) { + // pile-up check + if (fCheckPileUp) { + if (esd->IsPileupFromSPD()) return kFALSE; } - } - else + + // get the best primary vertex: + // first try the one with tracks + const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks(); + const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD(); + const AliESDVertex *vTPC = esd->GetPrimaryVertexTPC(); + Int_t ncTrk = -1; + Int_t ncSPD = -1; + Int_t ncTPC = -1; + Double_t vzTrk = 1000000.0; + Double_t vzSPD = 1000000.0; + Double_t vzTPC = 1000000.0; + if (vTrk) vzTrk = TMath::Abs(vTrk->GetZv()); + if (vSPD) vzSPD = TMath::Abs(vSPD->GetZv()); + if (vTPC) vzTPC = TMath::Abs(vTPC->GetZv()); + if (vTrk) ncTrk = (Int_t)vTrk->GetNContributors(); + if (vSPD) ncSPD = (Int_t)vSPD->GetNContributors(); + if (vTPC) ncTPC = (Int_t)vTPC->GetNContributors(); + if (vTrk && ncTrk > 0) { + fCutValueI = ncTrk; + fCutValueD = vzTrk; + } else if (vSPD && ncSPD > 0) { + fCutValueI = ncSPD; + fCutValueD = vzSPD; + } else if (vTPC && ncTPC > 0) { + if (!fAcceptTPC) + return kFALSE; + else { + fCutValueI = ncTPC; + fCutValueD = vzTPC; + } + } else + return kFALSE; + } else if (aod) { + // pile-up check is not yet available for AODs + + // lines suggested by Andrea to reject TPC-only events + if (!fAcceptTPC) { + if (!aod->GetPrimaryVertexSPD()) return kFALSE; + else if (aod->GetPrimaryVertexSPD()->GetNContributors() < 1) return kFALSE; + } + + AliAODVertex *prim = (AliAODVertex*)aod->GetPrimaryVertex(); + if (!prim) return kFALSE; + + fCutValueI = prim->GetNContributors(); + fCutValueD = prim->GetZ(); + } else return kFALSE; - } - else if (aod) - { - // pile-up check is not yet available for AODs - - // lines suggested by Andrea to reject TPC-only events - if(!fAcceptTPC) - { - if (!aod->GetPrimaryVertexSPD()) return kFALSE; - else if(aod->GetPrimaryVertexSPD()->GetNContributors() < 1) return kFALSE; - } - - AliAODVertex *prim = (AliAODVertex*)aod->GetPrimaryVertex(); - if (!prim) return kFALSE; - fCutValueI = prim->GetNContributors(); - fCutValueD = prim->GetZ(); - } - else - return kFALSE; - - // output - Bool_t result = ((!OkRangeI()) && OkRangeD()); - return result; + // output + Bool_t result = ((!OkRangeI()) && OkRangeD()); + return result; } //_________________________________________________________________________________________________ @@ -131,8 +118,8 @@ void AliRsnCutPrimaryVertex::Print(const Option_t *) const // Print information on this cut // - AliInfo(Form("Cut name : %s", GetName())); - AliInfo(Form("Accepting TPC primary vertex : %s", (fAcceptTPC ? "YES" : "NO"))); - AliInfo(Form("Contributors range (outside) : %d - %d", fMinI, fMaxI)); - AliInfo(Form("Z-vertex range (inside) : %f - %f", fMinD, fMaxD)); + AliInfo(Form("Cut name : %s", GetName())); + AliInfo(Form("Accepting TPC primary vertex : %s", (fAcceptTPC ? "YES" : "NO"))); + AliInfo(Form("Contributors range (outside) : %d - %d", fMinI, fMaxI)); + AliInfo(Form("Z-vertex range (inside) : %f - %f", fMinD, fMaxD)); } diff --git a/PWG2/RESONANCES/AliRsnCutPrimaryVertex.h b/PWG2/RESONANCES/AliRsnCutPrimaryVertex.h index 360b1b8a843..faf6803b75e 100644 --- a/PWG2/RESONANCES/AliRsnCutPrimaryVertex.h +++ b/PWG2/RESONANCES/AliRsnCutPrimaryVertex.h @@ -26,23 +26,22 @@ class AliRsnEvent; class AliRsnDaughter; class AliRsnPairParticle; -class AliRsnCutPrimaryVertex : public AliRsnCut -{ - public: +class AliRsnCutPrimaryVertex : public AliRsnCut { +public: - AliRsnCutPrimaryVertex(const char *name = "cutPrimVert", Double_t maxVz = 10.0, Int_t minContributors = 1, Bool_t acceptTPC = kFALSE); - virtual ~AliRsnCutPrimaryVertex() {;}; + AliRsnCutPrimaryVertex(const char *name = "cutPrimVert", Double_t maxVz = 10.0, Int_t minContributors = 1, Bool_t acceptTPC = kFALSE); + virtual ~AliRsnCutPrimaryVertex() {;}; - void SetCheckPileUp(Bool_t doit = kTRUE) {fCheckPileUp = doit;} - virtual Bool_t IsSelected(TObject *object); - virtual void Print(const Option_t *option = "") const; + void SetCheckPileUp(Bool_t doit = kTRUE) {fCheckPileUp = doit;} + virtual Bool_t IsSelected(TObject *object); + virtual void Print(const Option_t *option = "") const; - protected: +protected: - Bool_t fAcceptTPC; // if kTRUE, the TPC primary vertexes are accepted - Bool_t fCheckPileUp; // check and reject pileupped events (pp) + Bool_t fAcceptTPC; // if kTRUE, the TPC primary vertexes are accepted + Bool_t fCheckPileUp; // check and reject pileupped events (pp) - ClassDef(AliRsnCutPrimaryVertex, 1) + ClassDef(AliRsnCutPrimaryVertex, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnCutSet.cxx b/PWG2/RESONANCES/AliRsnCutSet.cxx index 69037bb178e..39aea35e746 100644 --- a/PWG2/RESONANCES/AliRsnCutSet.cxx +++ b/PWG2/RESONANCES/AliRsnCutSet.cxx @@ -17,66 +17,65 @@ ClassImp(AliRsnCutSet) //_____________________________________________________________________________ AliRsnCutSet::AliRsnCutSet() : - AliRsnTarget(), - fCuts(0), - fNumOfCuts(0), - fCutScheme(""), - fCutSchemeIndexed(""), - fBoolValues(0), - fIsScheme(kFALSE), - fExpression(0) + AliRsnTarget(), + fCuts(0), + fNumOfCuts(0), + fCutScheme(""), + fCutSchemeIndexed(""), + fBoolValues(0), + fIsScheme(kFALSE), + fExpression(0) { // // Constructor without name (not recommended) // - fBoolValues = new Bool_t[1]; - AliRsnExpression::fgCutSet = this; + fBoolValues = new Bool_t[1]; + AliRsnExpression::fgCutSet = this; } //_____________________________________________________________________________ AliRsnCutSet::AliRsnCutSet(const char *name, RSNTARGET target) : - AliRsnTarget(name, target), - fCuts(0), - fNumOfCuts(0), - fCutScheme(""), - fCutSchemeIndexed(""), - fBoolValues(0), - fIsScheme(kFALSE), - fExpression(0) + AliRsnTarget(name, target), + fCuts(0), + fNumOfCuts(0), + fCutScheme(""), + fCutSchemeIndexed(""), + fBoolValues(0), + fIsScheme(kFALSE), + fExpression(0) { // // Constructor with argument name (recommended) // - fBoolValues = new Bool_t[1]; - fExpression = 0; - AliRsnExpression::fgCutSet = this; + fBoolValues = new Bool_t[1]; + fExpression = 0; + AliRsnExpression::fgCutSet = this; } //_____________________________________________________________________________ AliRsnCutSet::AliRsnCutSet(const AliRsnCutSet & copy) : - AliRsnTarget(copy), - fCuts(copy.fCuts), - fNumOfCuts(copy.fNumOfCuts), - fCutScheme(copy.fCutScheme), - fCutSchemeIndexed(copy.fCutSchemeIndexed), - fBoolValues(0), - fIsScheme(copy.fIsScheme), - fExpression(copy.fExpression) + AliRsnTarget(copy), + fCuts(copy.fCuts), + fNumOfCuts(copy.fNumOfCuts), + fCutScheme(copy.fCutScheme), + fCutSchemeIndexed(copy.fCutSchemeIndexed), + fBoolValues(0), + fIsScheme(copy.fIsScheme), + fExpression(copy.fExpression) { // // Copy constructor // - Int_t i; - fBoolValues = new Bool_t[fNumOfCuts]; - for (i = 0; i < fNumOfCuts; ++i) - { - fBoolValues[i] = copy.fBoolValues[i]; - } - - AliRsnExpression::fgCutSet = this; + Int_t i; + fBoolValues = new Bool_t[fNumOfCuts]; + for (i = 0; i < fNumOfCuts; ++i) { + fBoolValues[i] = copy.fBoolValues[i]; + } + + AliRsnExpression::fgCutSet = this; } //_____________________________________________________________________________ @@ -85,28 +84,27 @@ AliRsnCutSet& AliRsnCutSet::operator=(const AliRsnCutSet & copy) // // Assignment operator. // - - AliRsnTarget::operator=(copy); - - fCuts = copy.fCuts; - fNumOfCuts = copy.fNumOfCuts; - fCutScheme = copy.fCutScheme; - fCutSchemeIndexed = copy.fCutSchemeIndexed; - fIsScheme = copy.fIsScheme; - fExpression = copy.fExpression; - - if (fBoolValues) delete [] fBoolValues; - - Int_t i; - fBoolValues = new Bool_t[fNumOfCuts]; - for (i = 0; i < fNumOfCuts; ++i) - { - fBoolValues[i] = copy.fBoolValues[i]; - } - - AliRsnExpression::fgCutSet = this; - - return (*this); + + AliRsnTarget::operator=(copy); + + fCuts = copy.fCuts; + fNumOfCuts = copy.fNumOfCuts; + fCutScheme = copy.fCutScheme; + fCutSchemeIndexed = copy.fCutSchemeIndexed; + fIsScheme = copy.fIsScheme; + fExpression = copy.fExpression; + + if (fBoolValues) delete [] fBoolValues; + + Int_t i; + fBoolValues = new Bool_t[fNumOfCuts]; + for (i = 0; i < fNumOfCuts; ++i) { + fBoolValues[i] = copy.fBoolValues[i]; + } + + AliRsnExpression::fgCutSet = this; + + return (*this); } //_____________________________________________________________________________ @@ -116,8 +114,8 @@ AliRsnCutSet::~AliRsnCutSet() // Destructor // - delete fExpression; - delete [] fBoolValues; + delete fExpression; + delete [] fBoolValues; } //_____________________________________________________________________________ @@ -130,30 +128,28 @@ void AliRsnCutSet::AddCut(AliRsnCut *cut) // the cut is not added. // - if (!cut->IsTarget(GetTargetType())) - { - AliError(Form("Cannot add this cut (cut set name,target = [%s],[%s] --- cut name,target = [%s],[%s]", GetName(), GetTargetTypeName(), cut->GetName(), cut->GetTargetTypeName())); - return; - } + if (!cut->IsTarget(GetTargetType())) { + AliError(Form("Cannot add this cut (cut set name,target = [%s],[%s] --- cut name,target = [%s],[%s]", GetName(), GetTargetTypeName(), cut->GetName(), cut->GetTargetTypeName())); + return; + } - Int_t i; + Int_t i; - AliDebug(AliLog::kDebug,"<-"); - fCuts.Add(cut); - AliInfo(Form("====> Adding a new cut: [%s]", cut->GetName())); - cut->Print(); - fNumOfCuts++; + AliDebug(AliLog::kDebug, "<-"); + fCuts.Add(cut); + AliInfo(Form("====> Adding a new cut: [%s]", cut->GetName())); + cut->Print(); + fNumOfCuts++; - if (fBoolValues) delete [] fBoolValues; + if (fBoolValues) delete [] fBoolValues; - fBoolValues = new Bool_t[fNumOfCuts]; - for (i = 0; i < fNumOfCuts; i++) - { - fBoolValues[i] = kTRUE; - } + fBoolValues = new Bool_t[fNumOfCuts]; + for (i = 0; i < fNumOfCuts; i++) { + fBoolValues[i] = kTRUE; + } - AliDebug(AliLog::kDebug,Form("%d",fCuts.GetEntriesFast())); - AliDebug(AliLog::kDebug,"->"); + AliDebug(AliLog::kDebug, Form("%d", fCuts.GetEntriesFast())); + AliDebug(AliLog::kDebug, "->"); } //_____________________________________________________________________________ @@ -162,13 +158,12 @@ void AliRsnCutSet::ShowCuts() const // // Prints all cuts // - AliRsnCut *cut; - - for (Int_t i = 0; i < fCuts.GetEntriesFast() ;i++) - { - cut = (AliRsnCut*)fCuts.At (i); - cut->Print(); - } + AliRsnCut *cut; + + for (Int_t i = 0; i < fCuts.GetEntriesFast() ; i++) { + cut = (AliRsnCut*)fCuts.At(i); + cut->Print(); + } } //_____________________________________________________________________________ @@ -178,19 +173,19 @@ Bool_t AliRsnCutSet::IsSelected(TObject *object) // Checks an object according to the cut expression defined here. // - Int_t i; - - if (!fNumOfCuts) return kTRUE; + Int_t i; + + if (!fNumOfCuts) return kTRUE; - Bool_t boolReturn = kTRUE; - AliRsnCut *cut; - for (i = 0; i < fNumOfCuts; i++) { - cut = (AliRsnCut*)fCuts.At(i); - fBoolValues[i] = cut->IsSelected(object); - } + Bool_t boolReturn = kTRUE; + AliRsnCut *cut; + for (i = 0; i < fNumOfCuts; i++) { + cut = (AliRsnCut*)fCuts.At(i); + fBoolValues[i] = cut->IsSelected(object); + } - if (fIsScheme) boolReturn = Passed(); - return boolReturn; + if (fIsScheme) boolReturn = Passed(); + return boolReturn; } //_____________________________________________________________________________ @@ -201,12 +196,12 @@ void AliRsnCutSet::SetCutScheme(const char *theValue) // and using the names given to all defined cuts. // - AliDebug(AliLog::kDebug,"<-"); - - fCutScheme = theValue; - SetCutSchemeIndexed(theValue); - fIsScheme = kTRUE; - AliDebug(AliLog::kDebug,"->"); + AliDebug(AliLog::kDebug, "<-"); + + fCutScheme = theValue; + SetCutSchemeIndexed(theValue); + fIsScheme = kTRUE; + AliDebug(AliLog::kDebug, "->"); } //_____________________________________________________________________________ @@ -216,11 +211,11 @@ void AliRsnCutSet::SetCutSchemeIndexed(TString theValue) // Internal method which indexes all cuts to organize their combo // - AliDebug(AliLog::kDebug,"<-"); - theValue.Append(" "); - // fCutSchemeIndexed = theValue; - fCutSchemeIndexed = GetCutSchemeIndexed(); - AliDebug(AliLog::kDebug,"->"); + AliDebug(AliLog::kDebug, "<-"); + theValue.Append(" "); + // fCutSchemeIndexed = theValue; + fCutSchemeIndexed = GetCutSchemeIndexed(); + AliDebug(AliLog::kDebug, "->"); } //_____________________________________________________________________________ @@ -230,15 +225,15 @@ Int_t AliRsnCutSet::GetIndexByCutName(TString s) // Retrieve the cut index from its name // - Int_t i; - AliRsnCut *cut; + Int_t i; + AliRsnCut *cut; - for (i = 0; i < fCuts.GetEntriesFast(); i++) { - cut = (AliRsnCut*) fCuts.At(i); - if (!s.CompareTo(cut->GetName())) return i; - } + for (i = 0; i < fCuts.GetEntriesFast(); i++) { + cut = (AliRsnCut*) fCuts.At(i); + if (!s.CompareTo(cut->GetName())) return i; + } - return -1; + return -1; } //_____________________________________________________________________________ @@ -249,16 +244,15 @@ Bool_t AliRsnCutSet::Passed() // and gives a global response to the cut check // - AliRsnExpression::fgCutSet = this; - if (!fExpression) - { - fExpression = new AliRsnExpression(fCutSchemeIndexed); - AliDebug(AliLog::kDebug,"fExpression was created."); - } + AliRsnExpression::fgCutSet = this; + if (!fExpression) { + fExpression = new AliRsnExpression(fCutSchemeIndexed); + AliDebug(AliLog::kDebug, "fExpression was created."); + } + + if (fCuts.IsEmpty()) return kTRUE; - if (fCuts.IsEmpty()) return kTRUE; - - return fExpression->Value(*GetCuts()); + return fExpression->Value(*GetCuts()); } //_____________________________________________________________________________ @@ -268,24 +262,24 @@ Bool_t AliRsnCutSet::IsValidScheme() // Validity check on cut expression specified by user // - TString str(fCutScheme); - AliRsnCut *cut; - for (Int_t i = 0; i < fNumOfCuts; i++) { - cut = (AliRsnCut*)fCuts.At(i); - str.ReplaceAll(cut->GetName(),""); - } - str.ReplaceAll("&",""); - str.ReplaceAll("!",""); - str.ReplaceAll("|",""); - str.ReplaceAll("(",""); - str.ReplaceAll(")",""); - - if (!str.IsNull()) { - AliError(Form("Cut scheme '%s' is not valid !!!",fCutScheme.Data())); - return kFALSE; - } - - return kTRUE; + TString str(fCutScheme); + AliRsnCut *cut; + for (Int_t i = 0; i < fNumOfCuts; i++) { + cut = (AliRsnCut*)fCuts.At(i); + str.ReplaceAll(cut->GetName(), ""); + } + str.ReplaceAll("&", ""); + str.ReplaceAll("!", ""); + str.ReplaceAll("|", ""); + str.ReplaceAll("(", ""); + str.ReplaceAll(")", ""); + + if (!str.IsNull()) { + AliError(Form("Cut scheme '%s' is not valid !!!", fCutScheme.Data())); + return kFALSE; + } + + return kTRUE; // return (!(ShowCutScheme().Contains("Error"))); } @@ -296,7 +290,7 @@ TString AliRsnCutSet::ShowCutScheme() // Utility method to check validity of expression // - return fCutScheme; + return fCutScheme; // return fExpression->Unparse(); } @@ -320,8 +314,8 @@ Int_t AliRsnCutSet::TestExpression(TString opt) // // set->ShowCuts (); - AliDebug(1, opt.Data()); - return 0; + AliDebug(1, opt.Data()); + return 0; } //_____________________________________________________________________________ @@ -331,19 +325,19 @@ void AliRsnCutSet::PrintSetInfo() // Show data about the cut set // - Int_t i; + Int_t i; - AliInfo("========== Rsn Cut Set info =============="); - AliInfo(Form("Scheme : %s",fCutScheme.Data())); - AliInfo(Form("Scheme : %s",fCutSchemeIndexed.Data())); - AliInfo(Form("Num of Cuts: %d", fCuts.GetEntriesFast())); - AliInfo("====== Cuts ======"); - AliRsnCut *cut; - for (i = 0; i < fCuts.GetEntriesFast(); i++) { - cut = (AliRsnCut*) fCuts.At(i); - if (cut) AliInfo(Form("%d %d",i,fBoolValues[i])); - } - AliInfo("========== END Rsn Cut Mgr info =============="); + AliInfo("========== Rsn Cut Set info =============="); + AliInfo(Form("Scheme : %s", fCutScheme.Data())); + AliInfo(Form("Scheme : %s", fCutSchemeIndexed.Data())); + AliInfo(Form("Num of Cuts: %d", fCuts.GetEntriesFast())); + AliInfo("====== Cuts ======"); + AliRsnCut *cut; + for (i = 0; i < fCuts.GetEntriesFast(); i++) { + cut = (AliRsnCut*) fCuts.At(i); + if (cut) AliInfo(Form("%d %d", i, fBoolValues[i])); + } + AliInfo("========== END Rsn Cut Mgr info =============="); } //_____________________________________________________________________________ @@ -354,15 +348,15 @@ TString AliRsnCutSet::GetCutSchemeIndexed() // for evaluation of cut expression // - AliDebug(AliLog::kDebug,"<-"); - Int_t i; - TString str(fCutScheme); - AliDebug(AliLog::kDebug,Form("Num of cuts %d",fCuts.GetEntriesFast())); - AliRsnCut *cut; - for (i = 0; i < fCuts.GetEntriesFast(); i++) { - cut = (AliRsnCut*) fCuts.At(i); - str.ReplaceAll(cut->GetName(),Form("%d",i)); - } - AliDebug(AliLog::kDebug,"->"); - return str; + AliDebug(AliLog::kDebug, "<-"); + Int_t i; + TString str(fCutScheme); + AliDebug(AliLog::kDebug, Form("Num of cuts %d", fCuts.GetEntriesFast())); + AliRsnCut *cut; + for (i = 0; i < fCuts.GetEntriesFast(); i++) { + cut = (AliRsnCut*) fCuts.At(i); + str.ReplaceAll(cut->GetName(), Form("%d", i)); + } + AliDebug(AliLog::kDebug, "->"); + return str; } diff --git a/PWG2/RESONANCES/AliRsnCutSet.h b/PWG2/RESONANCES/AliRsnCutSet.h index c029c8b8da1..dd216f34295 100644 --- a/PWG2/RESONANCES/AliRsnCutSet.h +++ b/PWG2/RESONANCES/AliRsnCutSet.h @@ -23,52 +23,51 @@ class AliRsnExpression; class AliRsnPairParticle; class AliRsnEvent; -class AliRsnCutSet : public AliRsnTarget -{ - public: +class AliRsnCutSet : public AliRsnTarget { +public: - AliRsnCutSet(); - AliRsnCutSet(const char *name, RSNTARGET target); - AliRsnCutSet(const AliRsnCutSet ©); - AliRsnCutSet& operator=(const AliRsnCutSet& copy); - ~AliRsnCutSet(); + AliRsnCutSet(); + AliRsnCutSet(const char *name, RSNTARGET target); + AliRsnCutSet(const AliRsnCutSet ©); + AliRsnCutSet& operator=(const AliRsnCutSet& copy); + ~AliRsnCutSet(); - void AddCut(AliRsnCut* cut); + void AddCut(AliRsnCut* cut); - void ShowCuts() const; - Int_t GetIndexByCutName(TString s); - Bool_t Passed(); - Bool_t IsValidScheme(); - TString ShowCutScheme(); - Int_t TestExpression(TString opt="short"); - void PrintSetInfo(); + void ShowCuts() const; + Int_t GetIndexByCutName(TString s); + Bool_t Passed(); + Bool_t IsValidScheme(); + TString ShowCutScheme(); + Int_t TestExpression(TString opt = "short"); + void PrintSetInfo(); - Bool_t IsSelected(TObject *object); + Bool_t IsSelected(TObject *object); - void SetBoolValue(Bool_t theValue,Int_t index) { fBoolValues[index] = theValue; } - Bool_t GetBoolValue(Int_t index) const { return fBoolValues[index]; } + void SetBoolValue(Bool_t theValue, Int_t index) { fBoolValues[index] = theValue; } + Bool_t GetBoolValue(Int_t index) const { return fBoolValues[index]; } - void SetCutScheme(const char *theValue); - TString GetCutScheme() const { return fCutScheme; } + void SetCutScheme(const char *theValue); + TString GetCutScheme() const { return fCutScheme; } - void SetCutSchemeIndexed(TString theValue); - TString GetCutSchemeIndexed(); + void SetCutSchemeIndexed(TString theValue); + TString GetCutSchemeIndexed(); - TObjArray *GetCuts() { return &fCuts; } + TObjArray *GetCuts() { return &fCuts; } - private: +private: - TObjArray fCuts; // array of cuts - Int_t fNumOfCuts; // number of cuts - TString fCutScheme; // cut scheme - TString fCutSchemeIndexed; // cut scheme indexed + TObjArray fCuts; // array of cuts + Int_t fNumOfCuts; // number of cuts + TString fCutScheme; // cut scheme + TString fCutSchemeIndexed; // cut scheme indexed - Bool_t *fBoolValues; //[fNumOfCuts] - Bool_t fIsScheme; // is scheme + Bool_t *fBoolValues; //[fNumOfCuts] + Bool_t fIsScheme; // is scheme - AliRsnExpression *fExpression; // pointer to AliRsnExpression + AliRsnExpression *fExpression; // pointer to AliRsnExpression - ClassDef(AliRsnCutSet,1) // ROOT dictionary + ClassDef(AliRsnCutSet, 1) // ROOT dictionary }; #endif diff --git a/PWG2/RESONANCES/AliRsnCutTrackQuality.cxx b/PWG2/RESONANCES/AliRsnCutTrackQuality.cxx index 2c18a66540f..957a5bde739 100644 --- a/PWG2/RESONANCES/AliRsnCutTrackQuality.cxx +++ b/PWG2/RESONANCES/AliRsnCutTrackQuality.cxx @@ -33,56 +33,56 @@ ClassImp(AliRsnCutTrackQuality) //_________________________________________________________________________________________________ AliRsnCutTrackQuality::AliRsnCutTrackQuality(const char *name) : - AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0), - fFlagsOn(0x0), - fFlagsOff(0x0), - fRejectKinkDaughters(kTRUE), - fDCARfixed(kTRUE), - fDCARptFormula(""), - fDCARmax(fgkVeryBig), - fDCAZfixed(kTRUE), - fDCAZptFormula(""), - fDCAZmax(fgkVeryBig), - fSPDminNClusters(0), - fITSminNClusters(0), - fITSmaxChi2(fgkVeryBig), - fTPCminNClusters(0), - fTPCmaxChi2(fgkVeryBig) + AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0), + fFlagsOn(0x0), + fFlagsOff(0x0), + fRejectKinkDaughters(kTRUE), + fDCARfixed(kTRUE), + fDCARptFormula(""), + fDCARmax(fgkVeryBig), + fDCAZfixed(kTRUE), + fDCAZptFormula(""), + fDCAZmax(fgkVeryBig), + fSPDminNClusters(0), + fITSminNClusters(0), + fITSmaxChi2(fgkVeryBig), + fTPCminNClusters(0), + fTPCmaxChi2(fgkVeryBig) { // // Default constructor. // Initializes all cuts in such a way that all of them are disabled. // - SetPtRange(0.0, fgkVeryBig); - SetEtaRange(-fgkVeryBig, fgkVeryBig); + SetPtRange(0.0, fgkVeryBig); + SetEtaRange(-fgkVeryBig, fgkVeryBig); } //_________________________________________________________________________________________________ AliRsnCutTrackQuality::AliRsnCutTrackQuality(const AliRsnCutTrackQuality ©) : - AliRsnCut(copy), - fFlagsOn(copy.fFlagsOn), - fFlagsOff(copy.fFlagsOff), - fRejectKinkDaughters(copy.fRejectKinkDaughters), - fDCARfixed(copy.fDCARfixed), - fDCARptFormula(copy.fDCARptFormula), - fDCARmax(copy.fDCARmax), - fDCAZfixed(copy.fDCAZfixed), - fDCAZptFormula(copy.fDCAZptFormula), - fDCAZmax(copy.fDCAZmax), - fSPDminNClusters(copy.fSPDminNClusters), - fITSminNClusters(copy.fITSminNClusters), - fITSmaxChi2(copy.fITSmaxChi2), - fTPCminNClusters(copy.fTPCminNClusters), - fTPCmaxChi2(copy.fTPCmaxChi2) + AliRsnCut(copy), + fFlagsOn(copy.fFlagsOn), + fFlagsOff(copy.fFlagsOff), + fRejectKinkDaughters(copy.fRejectKinkDaughters), + fDCARfixed(copy.fDCARfixed), + fDCARptFormula(copy.fDCARptFormula), + fDCARmax(copy.fDCARmax), + fDCAZfixed(copy.fDCAZfixed), + fDCAZptFormula(copy.fDCAZptFormula), + fDCAZmax(copy.fDCAZmax), + fSPDminNClusters(copy.fSPDminNClusters), + fITSminNClusters(copy.fITSminNClusters), + fITSmaxChi2(copy.fITSmaxChi2), + fTPCminNClusters(copy.fTPCminNClusters), + fTPCmaxChi2(copy.fTPCmaxChi2) { // // Copy constructor. // Just copy all data member values. // - SetPtRange(copy.fPt[0], copy.fPt[1]); - SetEtaRange(copy.fEta[0], copy.fEta[1]); + SetPtRange(copy.fPt[0], copy.fPt[1]); + SetEtaRange(copy.fEta[0], copy.fEta[1]); } //_________________________________________________________________________________________________ @@ -93,26 +93,26 @@ AliRsnCutTrackQuality& AliRsnCutTrackQuality::operator=(const AliRsnCutTrackQual // Just copy all data member values. // - - fFlagsOn = copy.fFlagsOn; - fFlagsOff = copy.fFlagsOff; - fRejectKinkDaughters = copy.fRejectKinkDaughters; - fDCARfixed = copy.fDCARfixed; - fDCARptFormula = copy.fDCARptFormula; - fDCARmax = copy.fDCARmax; - fDCAZfixed = copy.fDCAZfixed; - fDCAZptFormula = copy.fDCAZptFormula; - fDCAZmax = copy.fDCAZmax; - fSPDminNClusters = copy.fSPDminNClusters; - fITSminNClusters = copy.fITSminNClusters; - fITSmaxChi2 = copy.fITSmaxChi2; - fTPCminNClusters = copy.fTPCminNClusters; - fTPCmaxChi2 = copy.fTPCmaxChi2; - - SetPtRange(copy.fPt[0], copy.fPt[1]); - SetEtaRange(copy.fEta[0], copy.fEta[1]); - - return (*this); + + fFlagsOn = copy.fFlagsOn; + fFlagsOff = copy.fFlagsOff; + fRejectKinkDaughters = copy.fRejectKinkDaughters; + fDCARfixed = copy.fDCARfixed; + fDCARptFormula = copy.fDCARptFormula; + fDCARmax = copy.fDCARmax; + fDCAZfixed = copy.fDCAZfixed; + fDCAZptFormula = copy.fDCAZptFormula; + fDCAZmax = copy.fDCAZmax; + fSPDminNClusters = copy.fSPDminNClusters; + fITSminNClusters = copy.fITSminNClusters; + fITSmaxChi2 = copy.fITSmaxChi2; + fTPCminNClusters = copy.fTPCminNClusters; + fTPCmaxChi2 = copy.fTPCmaxChi2; + + SetPtRange(copy.fPt[0], copy.fPt[1]); + SetEtaRange(copy.fEta[0], copy.fEta[1]); + + return (*this); } //_________________________________________________________________________________________________ @@ -121,24 +121,24 @@ void AliRsnCutTrackQuality::DisableAll() // // Disable all cuts // - - fFlagsOn = 0x0; - fFlagsOff = 0x0; - fRejectKinkDaughters = kFALSE; - fDCARfixed = kTRUE; - fDCARptFormula = ""; - fDCARmax = fgkVeryBig; - fDCAZfixed = kTRUE; - fDCAZptFormula = ""; - fDCAZmax = fgkVeryBig; - fSPDminNClusters = 0; - fITSminNClusters = 0; - fITSmaxChi2 = fgkVeryBig; - fTPCminNClusters = 0; - fTPCmaxChi2 = fgkVeryBig; - - SetPtRange(0.0, fgkVeryBig); - SetEtaRange(-fgkVeryBig, fgkVeryBig); + + fFlagsOn = 0x0; + fFlagsOff = 0x0; + fRejectKinkDaughters = kFALSE; + fDCARfixed = kTRUE; + fDCARptFormula = ""; + fDCARmax = fgkVeryBig; + fDCAZfixed = kTRUE; + fDCAZptFormula = ""; + fDCAZmax = fgkVeryBig; + fSPDminNClusters = 0; + fITSminNClusters = 0; + fITSmaxChi2 = fgkVeryBig; + fTPCminNClusters = 0; + fTPCmaxChi2 = fgkVeryBig; + + SetPtRange(0.0, fgkVeryBig); + SetEtaRange(-fgkVeryBig, fgkVeryBig); } //_________________________________________________________________________________________________ @@ -150,51 +150,43 @@ Bool_t AliRsnCutTrackQuality::IsSelected(TObject *object) // and then calls the appropriate sub-function (for ESD or AOD) // - // coherence check - if (!TargetOK(object)) return kFALSE; - - // status is checked in the same way for all tracks, using AliVTrack - // as a convention, if a the collection of 'on' flags is '0x0', it - // is assumed that no flags are required, and this check is skipped; - // for the collection of 'off' flags this is not needed - AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); - if (!vtrack) - { - AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName())); - return kFALSE; - } - ULong_t status = (ULong_t)vtrack->GetStatus(); - ULong_t checkOn = status & fFlagsOn; - ULong_t checkOff = status & fFlagsOff; - if (fFlagsOn != 0x0 && checkOn != fFlagsOn) - { - AliDebug(AliLog::kDebug + 2, Form("Not all required flags are present: required %lx, track has %lx", fFlagsOn, status)); - return kFALSE; - } - if (checkOff != 0) - { - AliDebug(AliLog::kDebug + 2, Form("Some forbidden flags are present: required %lx, track has %lx", fFlagsOff, status)); - return kFALSE; - } - - // retrieve real object type - AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); - AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); - if (esdTrack) - { - AliDebug(AliLog::kDebug + 2, "Checking an ESD track"); - return CheckESD(esdTrack); - } - else if (aodTrack) - { - AliDebug(AliLog::kDebug + 2, "Checking an AOD track"); - return CheckAOD(aodTrack); - } - else - { - AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName())); - return kFALSE; - } + // coherence check + if (!TargetOK(object)) return kFALSE; + + // status is checked in the same way for all tracks, using AliVTrack + // as a convention, if a the collection of 'on' flags is '0x0', it + // is assumed that no flags are required, and this check is skipped; + // for the collection of 'off' flags this is not needed + AliVTrack *vtrack = dynamic_cast(fDaughter->GetRef()); + if (!vtrack) { + AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName())); + return kFALSE; + } + ULong_t status = (ULong_t)vtrack->GetStatus(); + ULong_t checkOn = status & fFlagsOn; + ULong_t checkOff = status & fFlagsOff; + if (fFlagsOn != 0x0 && checkOn != fFlagsOn) { + AliDebug(AliLog::kDebug + 2, Form("Not all required flags are present: required %lx, track has %lx", fFlagsOn, status)); + return kFALSE; + } + if (checkOff != 0) { + AliDebug(AliLog::kDebug + 2, Form("Some forbidden flags are present: required %lx, track has %lx", fFlagsOff, status)); + return kFALSE; + } + + // retrieve real object type + AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); + AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); + if (esdTrack) { + AliDebug(AliLog::kDebug + 2, "Checking an ESD track"); + return CheckESD(esdTrack); + } else if (aodTrack) { + AliDebug(AliLog::kDebug + 2, "Checking an AOD track"); + return CheckAOD(aodTrack); + } else { + AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName())); + return kFALSE; + } } //_________________________________________________________________________________________________ @@ -206,39 +198,39 @@ Bool_t AliRsnCutTrackQuality::CheckESD(AliESDtrack *track) // It is declared static, not to recreate it every time. // - static AliESDtrackCuts cuts; - - // general acceptance/pt cuts - cuts.SetPtRange (fPt[0], fPt[1]); - cuts.SetEtaRange(fEta[0], fEta[1]); - - // transverse DCA cuts - if (fDCARfixed) - cuts.SetMaxDCAToVertexXY(fDCARmax); - else - cuts.SetMaxDCAToVertexXYPtDep(fDCARptFormula.Data()); - - // longitudinal DCA cuts - if (fDCAZfixed) - cuts.SetMaxDCAToVertexZ(fDCAZmax); - else - cuts.SetMaxDCAToVertexZPtDep(fDCAZptFormula.Data()); - - // these options are always disabled in current version - cuts.SetDCAToVertex2D(kFALSE); - cuts.SetRequireSigmaToVertex(kFALSE); - - // TPC related cuts for TPC+ITS tracks - cuts.SetMinNClustersTPC(fTPCminNClusters); - cuts.SetMaxChi2PerClusterTPC(fTPCmaxChi2); - cuts.SetAcceptKinkDaughters(!fRejectKinkDaughters); - - // ITS related cuts for TPC+ITS tracks - if (fSPDminNClusters > 0) - cuts.SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); - - // now that all is initialized, do the check - return cuts.IsSelected(track); + static AliESDtrackCuts cuts; + + // general acceptance/pt cuts + cuts.SetPtRange(fPt[0], fPt[1]); + cuts.SetEtaRange(fEta[0], fEta[1]); + + // transverse DCA cuts + if (fDCARfixed) + cuts.SetMaxDCAToVertexXY(fDCARmax); + else + cuts.SetMaxDCAToVertexXYPtDep(fDCARptFormula.Data()); + + // longitudinal DCA cuts + if (fDCAZfixed) + cuts.SetMaxDCAToVertexZ(fDCAZmax); + else + cuts.SetMaxDCAToVertexZPtDep(fDCAZptFormula.Data()); + + // these options are always disabled in current version + cuts.SetDCAToVertex2D(kFALSE); + cuts.SetRequireSigmaToVertex(kFALSE); + + // TPC related cuts for TPC+ITS tracks + cuts.SetMinNClustersTPC(fTPCminNClusters); + cuts.SetMaxChi2PerClusterTPC(fTPCmaxChi2); + cuts.SetAcceptKinkDaughters(!fRejectKinkDaughters); + + // ITS related cuts for TPC+ITS tracks + if (fSPDminNClusters > 0) + cuts.SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); + + // now that all is initialized, do the check + return cuts.IsSelected(track); } //_________________________________________________________________________________________________ @@ -249,111 +241,96 @@ Bool_t AliRsnCutTrackQuality::CheckAOD(AliAODTrack *track) // This is done doing directly all checks, since there is not // an equivalend checker for AOD tracks // - - // step #0: check SPD and ITS clusters - Int_t nSPD = 0; - nSPD = TESTBIT(track->GetITSClusterMap(), 0); - nSPD += TESTBIT(track->GetITSClusterMap(), 1); - if (nSPD < fSPDminNClusters) - { - AliDebug(AliLog::kDebug + 2, "Not enough SPD clusters in this track. Rejected"); - return kFALSE; - } - - // step #1: check number of clusters in TPC - if (track->GetTPCNcls() < fTPCminNClusters) - { - AliDebug(AliLog::kDebug + 2, "Too few TPC clusters. Rejected"); - return kFALSE; - } - if (track->GetITSNcls() < fITSminNClusters) - { - AliDebug(AliLog::kDebug + 2, "Too few ITS clusters. Rejected"); - return kFALSE; - } - - // step #2: check chi square - if (track->Chi2perNDF() > fTPCmaxChi2) - { - AliDebug(AliLog::kDebug + 2, "Bad chi2. Rejected"); - return kFALSE; - } - if (track->Chi2perNDF() > fITSmaxChi2) - { - AliDebug(AliLog::kDebug + 2, "Bad chi2. Rejected"); - return kFALSE; - } - - // step #3: reject kink daughters - AliAODVertex *vertex = track->GetProdVertex(); - if (vertex && fRejectKinkDaughters) - { - if (vertex->GetType() == AliAODVertex::kKink) - { - AliDebug(AliLog::kDebug + 2, "Kink daughter. Rejected"); + + // step #0: check SPD and ITS clusters + Int_t nSPD = 0; + nSPD = TESTBIT(track->GetITSClusterMap(), 0); + nSPD += TESTBIT(track->GetITSClusterMap(), 1); + if (nSPD < fSPDminNClusters) { + AliDebug(AliLog::kDebug + 2, "Not enough SPD clusters in this track. Rejected"); return kFALSE; - } - } - - // step #4: DCA cut (transverse) - Double_t b[2], cov[3]; - vertex = AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetPrimaryVertex(); - if (!vertex) - { - AliDebug(AliLog::kDebug + 2, "NULL vertex"); - return kFALSE; - } - if (!track->PropagateToDCA(vertex, AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetMagneticField(), kVeryBig, b, cov)) - { - AliDebug(AliLog::kDebug + 2, "Failed propagation to vertex"); - return kFALSE; - } - // if the DCA cut is not fixed, compute current value - if (!fDCARfixed) - { - static TString str(fDCARptFormula); - str.ReplaceAll("pt", "x"); - static const TFormula dcaXY(Form("%s_dcaXY", GetName()), str.Data()); - fDCARmax = dcaXY.Eval(track->Pt()); - } - // check the cut - if (TMath::Abs(b[0]) > fDCARmax) - { - AliDebug(AliLog::kDebug + 2, "Too large transverse DCA"); - return kFALSE; - } - - // step #5: DCA cut (longitudinal) - // the DCA has already been computed above - // if the DCA cut is not fixed, compute current value - if (!fDCAZfixed) - { - static TString str(fDCAZptFormula); - str.ReplaceAll("pt", "x"); - static const TFormula dcaZ(Form("%s_dcaXY", GetName()), str.Data()); - fDCAZmax = dcaZ.Eval(track->Pt()); - } - // check the cut - if (TMath::Abs(b[1]) > fDCAZmax) - { - AliDebug(AliLog::kDebug + 2, "Too large longitudinal DCA"); - return kFALSE; - } - - // step #6: check eta/pt range - if (track->Eta() < fEta[0] || track->Eta() > fEta[1]) - { - AliDebug(AliLog::kDebug + 2, "Outside ETA acceptance"); - return kFALSE; - } - if (track->Pt() < fPt[0] || track->Pt() > fPt[1]) - { - AliDebug(AliLog::kDebug + 2, "Outside PT acceptance"); - return kFALSE; - } - - // if we are here, all cuts were passed and no exit point was got - return kTRUE; + } + + // step #1: check number of clusters in TPC + if (track->GetTPCNcls() < fTPCminNClusters) { + AliDebug(AliLog::kDebug + 2, "Too few TPC clusters. Rejected"); + return kFALSE; + } + if (track->GetITSNcls() < fITSminNClusters) { + AliDebug(AliLog::kDebug + 2, "Too few ITS clusters. Rejected"); + return kFALSE; + } + + // step #2: check chi square + if (track->Chi2perNDF() > fTPCmaxChi2) { + AliDebug(AliLog::kDebug + 2, "Bad chi2. Rejected"); + return kFALSE; + } + if (track->Chi2perNDF() > fITSmaxChi2) { + AliDebug(AliLog::kDebug + 2, "Bad chi2. Rejected"); + return kFALSE; + } + + // step #3: reject kink daughters + AliAODVertex *vertex = track->GetProdVertex(); + if (vertex && fRejectKinkDaughters) { + if (vertex->GetType() == AliAODVertex::kKink) { + AliDebug(AliLog::kDebug + 2, "Kink daughter. Rejected"); + return kFALSE; + } + } + + // step #4: DCA cut (transverse) + Double_t b[2], cov[3]; + vertex = AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetPrimaryVertex(); + if (!vertex) { + AliDebug(AliLog::kDebug + 2, "NULL vertex"); + return kFALSE; + } + if (!track->PropagateToDCA(vertex, AliRsnTarget::GetCurrentEvent()->GetRefAOD()->GetMagneticField(), kVeryBig, b, cov)) { + AliDebug(AliLog::kDebug + 2, "Failed propagation to vertex"); + return kFALSE; + } + // if the DCA cut is not fixed, compute current value + if (!fDCARfixed) { + static TString str(fDCARptFormula); + str.ReplaceAll("pt", "x"); + static const TFormula dcaXY(Form("%s_dcaXY", GetName()), str.Data()); + fDCARmax = dcaXY.Eval(track->Pt()); + } + // check the cut + if (TMath::Abs(b[0]) > fDCARmax) { + AliDebug(AliLog::kDebug + 2, "Too large transverse DCA"); + return kFALSE; + } + + // step #5: DCA cut (longitudinal) + // the DCA has already been computed above + // if the DCA cut is not fixed, compute current value + if (!fDCAZfixed) { + static TString str(fDCAZptFormula); + str.ReplaceAll("pt", "x"); + static const TFormula dcaZ(Form("%s_dcaXY", GetName()), str.Data()); + fDCAZmax = dcaZ.Eval(track->Pt()); + } + // check the cut + if (TMath::Abs(b[1]) > fDCAZmax) { + AliDebug(AliLog::kDebug + 2, "Too large longitudinal DCA"); + return kFALSE; + } + + // step #6: check eta/pt range + if (track->Eta() < fEta[0] || track->Eta() > fEta[1]) { + AliDebug(AliLog::kDebug + 2, "Outside ETA acceptance"); + return kFALSE; + } + if (track->Pt() < fPt[0] || track->Pt() > fPt[1]) { + AliDebug(AliLog::kDebug + 2, "Outside PT acceptance"); + return kFALSE; + } + + // if we are here, all cuts were passed and no exit point was got + return kTRUE; } //_________________________________________________________________________________________________ @@ -363,28 +340,22 @@ void AliRsnCutTrackQuality::Print(const Option_t *) const // Print information on this cut // - AliInfo(Form("Cut name : %s", GetName())); - AliInfo(Form("Required flags (off, on): %lx %lx", fFlagsOn, fFlagsOff)); - AliInfo(Form("Ranges in eta, pt : %.2f - %.2f, %.2f - %.2f", fEta[0], fEta[1], fPt[0], fPt[1])); - AliInfo(Form("Kink daughters are : %s", (fRejectKinkDaughters ? "rejected" : "accepted"))); - AliInfo(Form("TPC requirements : min. cluster = %d, max chi2 = %f", fTPCminNClusters, fTPCmaxChi2)); - AliInfo(Form("ITS requirements : min. cluster = %d (all), %d (SPD), max chi2 = %f", fITSminNClusters, fSPDminNClusters, fITSmaxChi2)); - - if (fDCARfixed) - { - AliInfo(Form("DCA r cut : fixed to %f cm", fDCARmax)); - } - else - { - AliInfo(Form("DCA r cut formula : %s", fDCARptFormula.Data())); - } - - if (fDCAZfixed) - { - AliInfo(Form("DCA z cut : fixed to %f cm", fDCAZmax)); - } - else - { - AliInfo(Form("DCA z cut formula : %s", fDCAZptFormula.Data())); - } + AliInfo(Form("Cut name : %s", GetName())); + AliInfo(Form("Required flags (off, on): %lx %lx", fFlagsOn, fFlagsOff)); + AliInfo(Form("Ranges in eta, pt : %.2f - %.2f, %.2f - %.2f", fEta[0], fEta[1], fPt[0], fPt[1])); + AliInfo(Form("Kink daughters are : %s", (fRejectKinkDaughters ? "rejected" : "accepted"))); + AliInfo(Form("TPC requirements : min. cluster = %d, max chi2 = %f", fTPCminNClusters, fTPCmaxChi2)); + AliInfo(Form("ITS requirements : min. cluster = %d (all), %d (SPD), max chi2 = %f", fITSminNClusters, fSPDminNClusters, fITSmaxChi2)); + + if (fDCARfixed) { + AliInfo(Form("DCA r cut : fixed to %f cm", fDCARmax)); + } else { + AliInfo(Form("DCA r cut formula : %s", fDCARptFormula.Data())); + } + + if (fDCAZfixed) { + AliInfo(Form("DCA z cut : fixed to %f cm", fDCAZmax)); + } else { + AliInfo(Form("DCA z cut formula : %s", fDCAZptFormula.Data())); + } } diff --git a/PWG2/RESONANCES/AliRsnCutTrackQuality.h b/PWG2/RESONANCES/AliRsnCutTrackQuality.h index 7b66e5f7be0..5110b34ffe0 100644 --- a/PWG2/RESONANCES/AliRsnCutTrackQuality.h +++ b/PWG2/RESONANCES/AliRsnCutTrackQuality.h @@ -20,66 +20,65 @@ class AliESDtrack; class AliAODTrack; -class AliRsnCutTrackQuality : public AliRsnCut -{ - public: - - AliRsnCutTrackQuality(const char *name = "AliRsncutTrackQuality"); - AliRsnCutTrackQuality(const AliRsnCutTrackQuality& copy); - AliRsnCutTrackQuality& operator=(const AliRsnCutTrackQuality& copy); - virtual ~AliRsnCutTrackQuality() { } - - void DisableAll(); - - void AddStatusFlag(ULong_t f, Bool_t on) {if (on) fFlagsOn = fFlagsOn | f; else fFlagsOff = fFlagsOff | f;} - void SetStatusFlags(ULong_t f, Bool_t on) {if (on) fFlagsOn = f; else fFlagsOff = f;} - void SetPtRange(Double_t a, Double_t b) {fPt[0] = TMath::Min(a, b); fPt[1] = TMath::Max(a, b);} - void SetEtaRange(Double_t a, Double_t b) {fEta[0] = TMath::Min(a, b); fEta[1] = TMath::Max(a, b);} - - void SetDCARPtFormula(const char *formula) {fDCARptFormula = formula; fDCARfixed = kFALSE;} - void SetDCARmax(Double_t value) {fDCARmax = value; fDCARptFormula = ""; fDCARfixed = kTRUE;} - void SetDCAZPtFormula(const char *formula) {fDCAZptFormula = formula; fDCAZfixed = kFALSE;} - void SetDCAZmax(Double_t value) {fDCAZmax = value; fDCAZptFormula = ""; fDCAZfixed = kTRUE;} - - void SetSPDminNClusters(Int_t value) {fSPDminNClusters = value;} - void SetITSminNClusters(Int_t value) {fITSminNClusters = value;} - void SetITSmaxChi2(Double_t value) {fITSmaxChi2 = value;} - - void SetTPCminNClusters(Int_t value) {fTPCminNClusters = value;} - void SetTPCmaxChi2(Double_t value) {fTPCmaxChi2 = value;} - - void SetRejectKinkDaughters(Bool_t yn = kTRUE) {fRejectKinkDaughters = yn;} - - virtual Bool_t IsSelected(TObject *obj); - virtual void Print(const Option_t *option = "") const; - - protected: - - Bool_t CheckESD(AliESDtrack *track); - Bool_t CheckAOD(AliAODTrack *track); - - ULong_t fFlagsOn; // status flags which must be ON (used AliESDtrack ones, connected with '|') - ULong_t fFlagsOff; // status flags which must be OFF (used AliESDtrack ones, connected with '|') - Double_t fPt[2]; // pt range - Double_t fEta[2]; // eta range - Bool_t fRejectKinkDaughters; // switch to kTRUE if daughters of kinks must be rejected - - Bool_t fDCARfixed; // flag to switch between fixed and pt-dependent DCA cut - TString fDCARptFormula; // expression to compute transverse DCA sigma w.r. to pt - Double_t fDCARmax; // maximum value for transverse DCA - - Bool_t fDCAZfixed; // flag to switch between fixed and pt-dependent DCA cut - TString fDCAZptFormula; // expression to compute longitudinal DCA sigma w.r. to pt - Double_t fDCAZmax; // maximum value for longitudinal DCA - - Int_t fSPDminNClusters; // minimum number of required clusters in SPD - Int_t fITSminNClusters; // minimum number of required clusters in ITS - Double_t fITSmaxChi2; // maximum chi2 / number of clusters in ITS - - Int_t fTPCminNClusters; // minimum number of required clusters in TPC - Double_t fTPCmaxChi2; // maximum chi2 / number of clusters in TPC - - ClassDef(AliRsnCutTrackQuality, 1) +class AliRsnCutTrackQuality : public AliRsnCut { +public: + + AliRsnCutTrackQuality(const char *name = "AliRsncutTrackQuality"); + AliRsnCutTrackQuality(const AliRsnCutTrackQuality& copy); + AliRsnCutTrackQuality& operator=(const AliRsnCutTrackQuality& copy); + virtual ~AliRsnCutTrackQuality() { } + + void DisableAll(); + + void AddStatusFlag(ULong_t f, Bool_t on) {if (on) fFlagsOn = fFlagsOn | f; else fFlagsOff = fFlagsOff | f;} + void SetStatusFlags(ULong_t f, Bool_t on) {if (on) fFlagsOn = f; else fFlagsOff = f;} + void SetPtRange(Double_t a, Double_t b) {fPt[0] = TMath::Min(a, b); fPt[1] = TMath::Max(a, b);} + void SetEtaRange(Double_t a, Double_t b) {fEta[0] = TMath::Min(a, b); fEta[1] = TMath::Max(a, b);} + + void SetDCARPtFormula(const char *formula) {fDCARptFormula = formula; fDCARfixed = kFALSE;} + void SetDCARmax(Double_t value) {fDCARmax = value; fDCARptFormula = ""; fDCARfixed = kTRUE;} + void SetDCAZPtFormula(const char *formula) {fDCAZptFormula = formula; fDCAZfixed = kFALSE;} + void SetDCAZmax(Double_t value) {fDCAZmax = value; fDCAZptFormula = ""; fDCAZfixed = kTRUE;} + + void SetSPDminNClusters(Int_t value) {fSPDminNClusters = value;} + void SetITSminNClusters(Int_t value) {fITSminNClusters = value;} + void SetITSmaxChi2(Double_t value) {fITSmaxChi2 = value;} + + void SetTPCminNClusters(Int_t value) {fTPCminNClusters = value;} + void SetTPCmaxChi2(Double_t value) {fTPCmaxChi2 = value;} + + void SetRejectKinkDaughters(Bool_t yn = kTRUE) {fRejectKinkDaughters = yn;} + + virtual Bool_t IsSelected(TObject *obj); + virtual void Print(const Option_t *option = "") const; + +protected: + + Bool_t CheckESD(AliESDtrack *track); + Bool_t CheckAOD(AliAODTrack *track); + + ULong_t fFlagsOn; // status flags which must be ON (used AliESDtrack ones, connected with '|') + ULong_t fFlagsOff; // status flags which must be OFF (used AliESDtrack ones, connected with '|') + Double_t fPt[2]; // pt range + Double_t fEta[2]; // eta range + Bool_t fRejectKinkDaughters; // switch to kTRUE if daughters of kinks must be rejected + + Bool_t fDCARfixed; // flag to switch between fixed and pt-dependent DCA cut + TString fDCARptFormula; // expression to compute transverse DCA sigma w.r. to pt + Double_t fDCARmax; // maximum value for transverse DCA + + Bool_t fDCAZfixed; // flag to switch between fixed and pt-dependent DCA cut + TString fDCAZptFormula; // expression to compute longitudinal DCA sigma w.r. to pt + Double_t fDCAZmax; // maximum value for longitudinal DCA + + Int_t fSPDminNClusters; // minimum number of required clusters in SPD + Int_t fITSminNClusters; // minimum number of required clusters in ITS + Double_t fITSmaxChi2; // maximum chi2 / number of clusters in ITS + + Int_t fTPCminNClusters; // minimum number of required clusters in TPC + Double_t fTPCmaxChi2; // maximum chi2 / number of clusters in TPC + + ClassDef(AliRsnCutTrackQuality, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnCutValue.cxx b/PWG2/RESONANCES/AliRsnCutValue.cxx index 94d8a0c3b23..68714b272d3 100644 --- a/PWG2/RESONANCES/AliRsnCutValue.cxx +++ b/PWG2/RESONANCES/AliRsnCutValue.cxx @@ -1,7 +1,7 @@ // // *** Class AliRsnCutValue *** // -// This cut implementation can be used to cut generically on +// This cut implementation can be used to cut generically on // any value which can be computed from AliRsnValue class. // Since that value is implemented always as a Double_t one, // then this cut operates only with the Double_t data members @@ -26,23 +26,23 @@ ClassImp(AliRsnCutValue) //_________________________________________________________________________________________________ AliRsnCutValue::AliRsnCutValue() : - AliRsnCut(), - fValue(), - fPairDef(0x0) + AliRsnCut(), + fValue(), + fPairDef(0x0) { // // Default constructor. // - SetTargetType(fValue.GetTargetType()); + SetTargetType(fValue.GetTargetType()); } //_________________________________________________________________________________________________ AliRsnCutValue::AliRsnCutValue (const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd) : - AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max), - fValue(Form("val_%s", name), type), - fPairDef(pd) + AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max), + fValue(Form("val_%s", name), type), + fPairDef(pd) { // // Main constructor. @@ -50,21 +50,21 @@ AliRsnCutValue::AliRsnCutValue // which determines also the type of target to be expected // - SetTargetType(fValue.GetTargetType()); + SetTargetType(fValue.GetTargetType()); } //_________________________________________________________________________________________________ AliRsnCutValue::AliRsnCutValue(const AliRsnCutValue& copy) : - AliRsnCut(copy), - fValue(copy.fValue), - fPairDef(copy.fPairDef) + AliRsnCut(copy), + fValue(copy.fValue), + fPairDef(copy.fPairDef) { // // Copy constructor. // Does not duplicate memory allocation. // - SetTargetType(fValue.GetTargetType()); + SetTargetType(fValue.GetTargetType()); } //_________________________________________________________________________________________________ @@ -75,13 +75,13 @@ AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy) // Does not duplicate memory allocation. // - AliRsnCut::operator=(copy); - - fValue = copy.fValue; - fPairDef = copy.fPairDef; - SetTargetType(fValue.GetTargetType()); - - return (*this); + AliRsnCut::operator=(copy); + + fValue = copy.fValue; + fPairDef = copy.fPairDef; + SetTargetType(fValue.GetTargetType()); + + return (*this); } //_________________________________________________________________________________________________ @@ -92,23 +92,22 @@ Bool_t AliRsnCutValue::IsSelected(TObject *object) // Calls the AliRsnValue::Eval() method and then checks its output. // - // make sure that target of this object matches that - // of the inserted value object - SetTargetType(fValue.GetTargetType()); - - // try to compute values - Bool_t success = fValue.Eval(object); - - // check success - if (!success) - { - AliWarning(Form("[%s] Failed to compute value", GetName())); - return kFALSE; - } - - // check in range - fCutValueD = fValue.GetComputedValue(); - return OkRangeD(); + // make sure that target of this object matches that + // of the inserted value object + SetTargetType(fValue.GetTargetType()); + + // try to compute values + Bool_t success = fValue.Eval(object); + + // check success + if (!success) { + AliWarning(Form("[%s] Failed to compute value", GetName())); + return kFALSE; + } + + // check in range + fCutValueD = fValue.GetComputedValue(); + return OkRangeD(); } //_________________________________________________________________________________________________ @@ -118,7 +117,7 @@ void AliRsnCutValue::Print(const Option_t *) const // Print information on this cut // - AliInfo(Form("Cut name : %s", GetName())); - AliInfo(Form("Cut value : %s", fValue.GetValueTypeName())); - AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD)); + AliInfo(Form("Cut name : %s", GetName())); + AliInfo(Form("Cut value : %s", fValue.GetValueTypeName())); + AliInfo(Form("Cut range : %f - %f", fMinD, fMaxD)); } diff --git a/PWG2/RESONANCES/AliRsnCutValue.h b/PWG2/RESONANCES/AliRsnCutValue.h index 32232376a00..714be8a37de 100644 --- a/PWG2/RESONANCES/AliRsnCutValue.h +++ b/PWG2/RESONANCES/AliRsnCutValue.h @@ -1,7 +1,7 @@ // // *** Class AliRsnCutValue *** // -// This cut implementation can be used to cut generically on +// This cut implementation can be used to cut generically on // any value which can be computed from AliRsnValue class. // Since that value is implemented always as a Double_t one, // then this cut operates only with the Double_t data members @@ -23,30 +23,29 @@ class AliRsnPairDef; -class AliRsnCutValue : public AliRsnCut -{ - public: - - AliRsnCutValue(); - AliRsnCutValue(const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd = 0x0); - AliRsnCutValue(const AliRsnCutValue& copy); - AliRsnCutValue& operator=(const AliRsnCutValue& copy); - virtual ~AliRsnCutValue() { } - - void SetPairDef(AliRsnPairDef *pd) {fPairDef = pd;} - AliRsnPairDef* GetPairDef() {return fPairDef;} - Double_t GetValue() {return fValue.GetComputedValue();} - AliRsnValue* GetValueObj() {return &fValue;} - - virtual Bool_t IsSelected(TObject *object); - virtual void Print(const Option_t *option = "") const; - - protected: - - AliRsnValue fValue; - AliRsnPairDef *fPairDef; - - ClassDef(AliRsnCutValue, 1) +class AliRsnCutValue : public AliRsnCut { +public: + + AliRsnCutValue(); + AliRsnCutValue(const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd = 0x0); + AliRsnCutValue(const AliRsnCutValue& copy); + AliRsnCutValue& operator=(const AliRsnCutValue& copy); + virtual ~AliRsnCutValue() { } + + void SetPairDef(AliRsnPairDef *pd) {fPairDef = pd;} + AliRsnPairDef* GetPairDef() {return fPairDef;} + Double_t GetValue() {return fValue.GetComputedValue();} + AliRsnValue* GetValueObj() {return &fValue;} + + virtual Bool_t IsSelected(TObject *object); + virtual void Print(const Option_t *option = "") const; + +protected: + + AliRsnValue fValue; + AliRsnPairDef *fPairDef; + + ClassDef(AliRsnCutValue, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnDaughter.cxx b/PWG2/RESONANCES/AliRsnDaughter.cxx index 2a7ab26d845..544bcaf3ff0 100644 --- a/PWG2/RESONANCES/AliRsnDaughter.cxx +++ b/PWG2/RESONANCES/AliRsnDaughter.cxx @@ -20,13 +20,13 @@ ClassImp(AliRsnDaughter) //_____________________________________________________________________________ AliRsnDaughter::AliRsnDaughter() : - fOK(kFALSE), - fLabel(-1), - fMotherPDG(0), - fPrec(0.0, 0.0, 0.0, 0.0), - fPsim(0.0, 0.0, 0.0, 0.0), - fRef(0x0), - fRefMC(0x0) + fOK(kFALSE), + fLabel(-1), + fMotherPDG(0), + fPrec(0.0, 0.0, 0.0, 0.0), + fPsim(0.0, 0.0, 0.0, 0.0), + fRef(0x0), + fRefMC(0x0) { // // Default constructor. @@ -35,14 +35,14 @@ AliRsnDaughter::AliRsnDaughter() : //_____________________________________________________________________________ AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) : - TObject(copy), - fOK(copy.fOK), - fLabel(copy.fLabel), - fMotherPDG(copy.fMotherPDG), - fPrec(copy.fPrec), - fPsim(copy.fPsim), - fRef(copy.fRef), - fRefMC(copy.fRefMC) + TObject(copy), + fOK(copy.fOK), + fLabel(copy.fLabel), + fMotherPDG(copy.fMotherPDG), + fPrec(copy.fPrec), + fPsim(copy.fPsim), + fRef(copy.fRef), + fRefMC(copy.fRefMC) { // // Copy constructor. @@ -60,15 +60,15 @@ AliRsnDaughter& AliRsnDaughter::operator=(const AliRsnDaughter ©) // statement, but from just referencing something in the data source. // - fOK = copy.fOK; - fLabel = copy.fLabel; - fMotherPDG = copy.fMotherPDG; - fPrec = copy.fPrec; - fPsim = copy.fPsim; - fRef = copy.fRef; - fRefMC = copy.fRefMC; + fOK = copy.fOK; + fLabel = copy.fLabel; + fMotherPDG = copy.fMotherPDG; + fPrec = copy.fPrec; + fPsim = copy.fPsim; + fRef = copy.fRef; + fRefMC = copy.fRefMC; - return (*this); + return (*this); } //_____________________________________________________________________________ @@ -80,14 +80,14 @@ void AliRsnDaughter::Reset() // for analysis unless initialized properly. // - fOK = kFALSE; - fLabel = -1; - fMotherPDG = 0; - fRef = 0x0; - fRefMC = 0x0; - - fPrec.SetXYZM(0.0, 0.0, 0.0, 0.0); - fPsim.SetXYZM(0.0, 0.0, 0.0, 0.0); + fOK = kFALSE; + fLabel = -1; + fMotherPDG = 0; + fRef = 0x0; + fRefMC = 0x0; + + fPrec.SetXYZM(0.0, 0.0, 0.0, 0.0); + fPsim.SetXYZM(0.0, 0.0, 0.0, 0.0); } //_____________________________________________________________________________ @@ -98,19 +98,19 @@ Int_t AliRsnDaughter::GetPDG(Bool_t abs) // If argument is kTRUE, returns its absolute value. // - Int_t pdg = 0; + Int_t pdg = 0; + + // ESD + AliMCParticle *esd = GetRefMCESD(); + if (esd) pdg = esd->Particle()->GetPdgCode(); + + // AOD + AliAODMCParticle *aod = GetRefMCAOD(); + if (aod) pdg = aod->GetPdgCode(); - // ESD - AliMCParticle *esd = GetRefMCESD(); - if (esd) pdg = esd->Particle()->GetPdgCode(); - - // AOD - AliAODMCParticle *aod = GetRefMCAOD(); - if (aod) pdg = aod->GetPdgCode(); - - // abs value if required - if (abs) pdg = TMath::Abs(pdg); - return pdg; + // abs value if required + if (abs) pdg = TMath::Abs(pdg); + return pdg; } //_____________________________________________________________________________ @@ -122,34 +122,34 @@ Int_t AliRsnDaughter::GetID() // In case of V0s, since this method is unsuccessful, return the label. // - // ESD tracks - AliESDtrack *esd = GetRefESDtrack(); - if (esd) return esd->GetID(); + // ESD tracks + AliESDtrack *esd = GetRefESDtrack(); + if (esd) return esd->GetID(); - // AOD tracks - AliAODTrack *aod = GetRefAODtrack(); - if (aod) return aod->GetID(); + // AOD tracks + AliAODTrack *aod = GetRefAODtrack(); + if (aod) return aod->GetID(); - // whatever else - return GetLabel(); + // whatever else + return GetLabel(); } //_____________________________________________________________________________ Bool_t AliRsnDaughter::HasFlag(ULong_t flag) { // -// Checks that the 'status' flag of the source object has one or +// Checks that the 'status' flag of the source object has one or // a combination of status flags specified in argument. // Works only with track-like objects, irrespectively if they // are ESD or AOD tracks, since it refers to their AliVTrack base class. // - AliVTrack *track = dynamic_cast(fRef); - if (!track) return kFALSE; - - ULong_t status = (ULong_t)track->GetStatus(); - - return ((status & flag) != 0); + AliVTrack *track = dynamic_cast(fRef); + if (!track) return kFALSE; + + ULong_t status = (ULong_t)track->GetStatus(); + + return ((status & flag) != 0); } //_____________________________________________________________________________ @@ -164,12 +164,12 @@ Bool_t AliRsnDaughter::SetMass(Double_t mass) // a meaningful positive number, and the pointers are properly initialized. // - if (mass < 0.) return kFALSE; - - if (fRef) fPrec.SetXYZM(fRef ->Px(), fRef ->Py(), fRef ->Pz(), mass); - if (fRefMC) fPsim.SetXYZM(fRefMC->Px(), fRefMC->Py(), fRefMC->Pz(), mass); - - return kTRUE; + if (mass < 0.) return kFALSE; + + if (fRef) fPrec.SetXYZM(fRef ->Px(), fRef ->Py(), fRef ->Pz(), mass); + if (fRefMC) fPsim.SetXYZM(fRefMC->Px(), fRefMC->Py(), fRefMC->Pz(), mass); + + return kTRUE; } //_____________________________________________________________________________ @@ -182,18 +182,15 @@ Bool_t AliRsnDaughter::IsKinkDaughter() // this is done here in order to have a unique outcome. // - AliESDtrack *etrack = GetRefESDtrack(); - AliAODTrack *atrack = GetRefAODtrack(); - - if (etrack) - { - return (etrack->GetKinkIndex(0) > 0); - } - else if (atrack) - { - AliAODVertex *vertex = atrack->GetProdVertex(); - if (vertex) if (vertex->GetType() == AliAODVertex::kKink) return kTRUE; - } - - return kFALSE; + AliESDtrack *etrack = GetRefESDtrack(); + AliAODTrack *atrack = GetRefAODtrack(); + + if (etrack) { + return (etrack->GetKinkIndex(0) > 0); + } else if (atrack) { + AliAODVertex *vertex = atrack->GetProdVertex(); + if (vertex) if (vertex->GetType() == AliAODVertex::kKink) return kTRUE; + } + + return kFALSE; } diff --git a/PWG2/RESONANCES/AliRsnDaughter.h b/PWG2/RESONANCES/AliRsnDaughter.h index 9ea337a5dcb..660320f07d8 100644 --- a/PWG2/RESONANCES/AliRsnDaughter.h +++ b/PWG2/RESONANCES/AliRsnDaughter.h @@ -29,90 +29,88 @@ typedef AliPID::EParticleType EPARTYPE; -class AliRsnDaughter : public TObject -{ - public: - - enum ERefType - { +class AliRsnDaughter : public TObject { +public: + + enum ERefType { kTrack = 0, kV0, kCascade, kNoType - }; - - AliRsnDaughter(); - AliRsnDaughter(const AliRsnDaughter ©); - AliRsnDaughter& operator= (const AliRsnDaughter& copy); - virtual ~AliRsnDaughter() { /*nothing*/ } - - // basic getters (for data members) - Bool_t IsOK() const {return fOK;} - Int_t GetLabel() const {return fLabel;} - Int_t GetMotherPDG() const {return fMotherPDG;} - TLorentzVector& Prec() {return fPrec;} - TLorentzVector& Psim() {return fPsim;} - TLorentzVector& P(Bool_t mc = kFALSE) {return (mc ? fPsim : fPrec);} - AliVParticle* GetRef() {return fRef;} - AliVParticle* GetRefMC() {return fRefMC;} - - // basic setters (for data members) - void SetBad() {fOK = kFALSE;} - void SetGood() {fOK = kTRUE;} - void SetLabel(Int_t label) {fLabel = label;} - void SetMotherPDG(Int_t value) {fMotherPDG = value;} - void SetRef(AliVParticle *p) {fRef = p;} - void SetRefMC(AliVParticle *p = 0x0) {fRefMC = p;} - - // charge checkers - Bool_t IsPos() const {return (fRef->Charge() > 0);} - Bool_t IsNeg() const {return (fRef->Charge() < 0);} - Bool_t IsNeutral() const {return (!IsPos() && !IsNeg());} - Bool_t IsSign(Char_t sign) const {if (sign=='+') return IsPos(); else if (sign=='-') return IsNeg(); else return IsNeutral();} - Short_t Charge() const {if (IsPos()) return 1 ; else if (IsNeg()) return -1 ; else return 0 ;} - Char_t ChargeChar() const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';} - - // utilities - void Reset(); - Int_t GetPDG(Bool_t abs = kTRUE); - Int_t GetID(); - Bool_t HasFlag(ULong_t flag); - Bool_t SetMass(Double_t mass); - Bool_t IsKinkDaughter(); - - // getters which automatically convert refs into allowed types - AliESDtrack* GetRefESDtrack() {return dynamic_cast(fRef);} - AliESDv0* GetRefESDv0() {return dynamic_cast(fRef);} - AliESDcascade* GetRefESDcascade() {return dynamic_cast(fRef);} - AliAODTrack* GetRefAODtrack() {return dynamic_cast(fRef);} - AliAODv0* GetRefAODv0() {return dynamic_cast(fRef);} - AliAODcascade* GetRefAODcascade() {return dynamic_cast(fRef);} - AliMCParticle* GetRefMCtrack() {return dynamic_cast(fRef);} - AliMCParticle* GetRefMCESD() {return dynamic_cast(fRefMC);} - AliAODMCParticle* GetRefMCAOD() {return dynamic_cast(fRefMC);} - - // check the input type - Bool_t IsMC() {if (GetRefMCtrack()) return kTRUE; return kFALSE;} - Bool_t IsAOD() {if (GetRefAODtrack() || GetRefAODv0()) return kTRUE; return kFALSE;} - Bool_t IsESD() {if (GetRefESDtrack() || GetRefESDv0()) return kTRUE; return kFALSE;} - Bool_t IsTrack() {if (GetRefESDtrack() || GetRefAODtrack() || GetRefMCtrack()) return kTRUE; return kFALSE;} - Bool_t IsV0() {if (GetRefESDv0() || GetRefAODv0()) return kTRUE; return kFALSE;} - Bool_t IsCascade() {if (GetRefESDcascade() || GetRefAODcascade()) return kTRUE; return kFALSE;} - ERefType RefType() {if (IsTrack()) return kTrack; if (IsV0()) return kV0; if (IsCascade()) return kCascade; return kNoType;} - - private: - - Bool_t fOK; // internal utility flag which is kFALSE when this object should not be used - Int_t fLabel; // GEANT label of corresponding MC - Int_t fMotherPDG; // PDG code of mother (makes sense only if fRefMC is defined) - - TLorentzVector fPrec; // 4-vector filled with track info from default ref (if present) - TLorentzVector fPsim; // 4-vector filled with track info from MC ref (if present) - - AliVParticle *fRef; // reference to reconstructed track in ESD/AOD - AliVParticle *fRefMC; // reference to corresponding MC particle - - ClassDef(AliRsnDaughter, 8) + }; + + AliRsnDaughter(); + AliRsnDaughter(const AliRsnDaughter ©); + AliRsnDaughter& operator= (const AliRsnDaughter& copy); + virtual ~AliRsnDaughter() { /*nothing*/ } + + // basic getters (for data members) + Bool_t IsOK() const {return fOK;} + Int_t GetLabel() const {return fLabel;} + Int_t GetMotherPDG() const {return fMotherPDG;} + TLorentzVector& Prec() {return fPrec;} + TLorentzVector& Psim() {return fPsim;} + TLorentzVector& P(Bool_t mc = kFALSE) {return (mc ? fPsim : fPrec);} + AliVParticle* GetRef() {return fRef;} + AliVParticle* GetRefMC() {return fRefMC;} + + // basic setters (for data members) + void SetBad() {fOK = kFALSE;} + void SetGood() {fOK = kTRUE;} + void SetLabel(Int_t label) {fLabel = label;} + void SetMotherPDG(Int_t value) {fMotherPDG = value;} + void SetRef(AliVParticle *p) {fRef = p;} + void SetRefMC(AliVParticle *p = 0x0) {fRefMC = p;} + + // charge checkers + Bool_t IsPos() const {return (fRef->Charge() > 0);} + Bool_t IsNeg() const {return (fRef->Charge() < 0);} + Bool_t IsNeutral() const {return (!IsPos() && !IsNeg());} + Bool_t IsSign(Char_t sign) const {if (sign == '+') return IsPos(); else if (sign == '-') return IsNeg(); else return IsNeutral();} + Short_t Charge() const {if (IsPos()) return 1 ; else if (IsNeg()) return -1 ; else return 0 ;} + Char_t ChargeChar() const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';} + + // utilities + void Reset(); + Int_t GetPDG(Bool_t abs = kTRUE); + Int_t GetID(); + Bool_t HasFlag(ULong_t flag); + Bool_t SetMass(Double_t mass); + Bool_t IsKinkDaughter(); + + // getters which automatically convert refs into allowed types + AliESDtrack* GetRefESDtrack() {return dynamic_cast(fRef);} + AliESDv0* GetRefESDv0() {return dynamic_cast(fRef);} + AliESDcascade* GetRefESDcascade() {return dynamic_cast(fRef);} + AliAODTrack* GetRefAODtrack() {return dynamic_cast(fRef);} + AliAODv0* GetRefAODv0() {return dynamic_cast(fRef);} + AliAODcascade* GetRefAODcascade() {return dynamic_cast(fRef);} + AliMCParticle* GetRefMCtrack() {return dynamic_cast(fRef);} + AliMCParticle* GetRefMCESD() {return dynamic_cast(fRefMC);} + AliAODMCParticle* GetRefMCAOD() {return dynamic_cast(fRefMC);} + + // check the input type + Bool_t IsMC() {if (GetRefMCtrack()) return kTRUE; return kFALSE;} + Bool_t IsAOD() {if (GetRefAODtrack() || GetRefAODv0()) return kTRUE; return kFALSE;} + Bool_t IsESD() {if (GetRefESDtrack() || GetRefESDv0()) return kTRUE; return kFALSE;} + Bool_t IsTrack() {if (GetRefESDtrack() || GetRefAODtrack() || GetRefMCtrack()) return kTRUE; return kFALSE;} + Bool_t IsV0() {if (GetRefESDv0() || GetRefAODv0()) return kTRUE; return kFALSE;} + Bool_t IsCascade() {if (GetRefESDcascade() || GetRefAODcascade()) return kTRUE; return kFALSE;} + ERefType RefType() {if (IsTrack()) return kTrack; if (IsV0()) return kV0; if (IsCascade()) return kCascade; return kNoType;} + +private: + + Bool_t fOK; // internal utility flag which is kFALSE when this object should not be used + Int_t fLabel; // GEANT label of corresponding MC + Int_t fMotherPDG; // PDG code of mother (makes sense only if fRefMC is defined) + + TLorentzVector fPrec; // 4-vector filled with track info from default ref (if present) + TLorentzVector fPsim; // 4-vector filled with track info from MC ref (if present) + + AliVParticle *fRef; // reference to reconstructed track in ESD/AOD + AliVParticle *fRefMC; // reference to corresponding MC particle + + ClassDef(AliRsnDaughter, 8) }; #endif diff --git a/PWG2/RESONANCES/AliRsnEvent.cxx b/PWG2/RESONANCES/AliRsnEvent.cxx index cf9e2b891ce..ed8e4224b87 100644 --- a/PWG2/RESONANCES/AliRsnEvent.cxx +++ b/PWG2/RESONANCES/AliRsnEvent.cxx @@ -31,10 +31,10 @@ AliRsnEvent* AliRsnEvent::fgRsnEvent2 = 0; //_____________________________________________________________________________ AliRsnEvent::AliRsnEvent(AliVEvent *ref, AliVEvent *refMC) : - fRef(ref), - fRefMC(refMC), - fLeading(-1), - fLocalID(-1) + fRef(ref), + fRefMC(refMC), + fLeading(-1), + fLocalID(-1) { // // Default constructor. @@ -43,11 +43,11 @@ AliRsnEvent::AliRsnEvent(AliVEvent *ref, AliVEvent *refMC) : //_____________________________________________________________________________ AliRsnEvent::AliRsnEvent(const AliRsnEvent &event) : - TObject(event), - fRef(event.fRef), - fRefMC(event.fRefMC), - fLeading(event.fLeading), - fLocalID(event.fLocalID) + TObject(event), + fRef(event.fRef), + fRefMC(event.fRefMC), + fLeading(event.fLeading), + fLocalID(event.fLocalID) { // // Copy constructor. @@ -61,13 +61,13 @@ AliRsnEvent& AliRsnEvent::operator= (const AliRsnEvent & event) // Works in the same way as the copy constructor. // - (TObject)(*this) = (TObject)event; - fRef = event.fRef; - fRefMC = event.fRefMC; - fLeading = event.fLeading; - fLocalID = event.fLocalID; + (TObject)(*this) = (TObject)event; + fRef = event.fRef; + fRefMC = event.fRefMC; + fLeading = event.fLeading; + fLocalID = event.fLocalID; - return (*this); + return (*this); } //_____________________________________________________________________________ @@ -78,8 +78,8 @@ AliRsnEvent::~AliRsnEvent() // Dereferences global pointer, if needed. // - //if (gRsnCurrentEvent == this) gRsnCurrentEvent = 0; - //if (gRsnMixedEvent == this) gRsnMixedEvent = 0; + //if (gRsnCurrentEvent == this) gRsnCurrentEvent = 0; + //if (gRsnMixedEvent == this) gRsnMixedEvent = 0; } //_____________________________________________________________________________ @@ -94,15 +94,15 @@ Bool_t AliRsnEvent::SetDaughter(AliRsnDaughter &out, Int_t i, AliRsnDaughter::ER // of the V0 point to the same mother. // Returns kFALSE whenever the operation fails (out of range, NULL references). // - - if (IsESD() && type == AliRsnDaughter::kTrack ) return SetDaughterESDtrack (out, i); - if (IsAOD() && type == AliRsnDaughter::kTrack ) return SetDaughterAODtrack (out, i); - if (IsESD() && type == AliRsnDaughter::kV0 ) return SetDaughterESDv0 (out, i); - if (IsAOD() && type == AliRsnDaughter::kV0 ) return SetDaughterAODv0 (out, i); - if (IsESD() && type == AliRsnDaughter::kCascade) return SetDaughterESDcascade(out, i); - if (IsAOD() && type == AliRsnDaughter::kCascade) return SetDaughterAODcascade(out, i); - - return kFALSE; + + if (IsESD() && type == AliRsnDaughter::kTrack) return SetDaughterESDtrack(out, i); + if (IsAOD() && type == AliRsnDaughter::kTrack) return SetDaughterAODtrack(out, i); + if (IsESD() && type == AliRsnDaughter::kV0) return SetDaughterESDv0(out, i); + if (IsAOD() && type == AliRsnDaughter::kV0) return SetDaughterAODv0(out, i); + if (IsESD() && type == AliRsnDaughter::kCascade) return SetDaughterESDcascade(out, i); + if (IsAOD() && type == AliRsnDaughter::kCascade) return SetDaughterAODcascade(out, i); + + return kFALSE; } //_____________________________________________________________________________ @@ -115,79 +115,70 @@ Bool_t AliRsnEvent::SetDaughterMC(AliRsnDaughter &out, Int_t label) // (used for MC-only analysis). // - if (!fRefMC) - { - out.SetBad(); - return kFALSE; - } - - // try to convert into both types - Int_t imum; - AliMCEvent *esd = GetRefMCESD(); - AliAODEvent *aod = GetRefMCAOD(); - - // ESD - if (esd) - { - // if the MC track exists, assign it - AliMCParticle *track = (AliMCParticle*)fRef->GetTrack(label); - if (!track) - { - out.SetBad(); - return kFALSE; - } - out.SetRef(track); - out.SetRefMC(track); - out.SetLabel(label); - out.SetGood(); - - // search for its mother in stack - imum = track->GetMother(); - if (imum >= 0 && imum < esd->Stack()->GetNtrack()) - { - TParticle *mum = esd->Stack()->Particle(imum); - if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode())); - } - } - - // AOD - if (aod) - { - // checks that array of MC particles exists - TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); - if(!mcArray) - { + if (!fRefMC) { out.SetBad(); return kFALSE; - } - - // in this case one has to loop over the sample to find the good one - TObjArrayIter next(mcArray); - AliAODMCParticle *part = 0x0; - while ( (part = (AliAODMCParticle*)next()) ) - { - if (TMath::Abs(part->GetLabel()) == label) - { - // if the MC track exists, assign it - out.SetRef(part); - out.SetRefMC(part); - out.SetLabel(label); - out.SetGood(); - - // search for the mother - imum = part->GetMother(); - if (imum >= 0 && imum < mcArray->GetEntriesFast()) - { - AliAODMCParticle *mum = (AliAODMCParticle*)mcArray->At(imum); - if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode())); - } - break; + } + + // try to convert into both types + Int_t imum; + AliMCEvent *esd = GetRefMCESD(); + AliAODEvent *aod = GetRefMCAOD(); + + // ESD + if (esd) { + // if the MC track exists, assign it + AliMCParticle *track = (AliMCParticle*)fRef->GetTrack(label); + if (!track) { + out.SetBad(); + return kFALSE; + } + out.SetRef(track); + out.SetRefMC(track); + out.SetLabel(label); + out.SetGood(); + + // search for its mother in stack + imum = track->GetMother(); + if (imum >= 0 && imum < esd->Stack()->GetNtrack()) { + TParticle *mum = esd->Stack()->Particle(imum); + if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode())); + } + } + + // AOD + if (aod) { + // checks that array of MC particles exists + TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); + if (!mcArray) { + out.SetBad(); + return kFALSE; + } + + // in this case one has to loop over the sample to find the good one + TObjArrayIter next(mcArray); + AliAODMCParticle *part = 0x0; + while ((part = (AliAODMCParticle*)next())) { + if (TMath::Abs(part->GetLabel()) == label) { + // if the MC track exists, assign it + out.SetRef(part); + out.SetRefMC(part); + out.SetLabel(label); + out.SetGood(); + + // search for the mother + imum = part->GetMother(); + if (imum >= 0 && imum < mcArray->GetEntriesFast()) { + AliAODMCParticle *mum = (AliAODMCParticle*)mcArray->At(imum); + if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode())); + } + break; + } } - } - return kTRUE; - } - - return kFALSE; + return kTRUE; + } + + return kFALSE; } //_____________________________________________________________________________ @@ -196,10 +187,10 @@ AliRsnDaughter AliRsnEvent::GetDaughter(Int_t i, AliRsnDaughter::ERefType type) // // Returns a daughter set using same criteria as SetDaughter // - - AliRsnDaughter d; - SetDaughter(d, i, type); - return d; + + AliRsnDaughter d; + SetDaughter(d, i, type); + return d; } //_____________________________________________________________________________ @@ -208,10 +199,10 @@ AliRsnDaughter AliRsnEvent::GetDaughterMC(Int_t i) // // Returns a daughter set using same criteria as SetDaughterMC // - - AliRsnDaughter d; - SetDaughterMC(d, i); - return d; + + AliRsnDaughter d; + SetDaughterMC(d, i); + return d; } //_____________________________________________________________________________ @@ -222,13 +213,13 @@ Int_t AliRsnEvent::GetAbsoluteSum() // tracks, V0s and cascades // - Int_t total = 0; - - total += fRef->GetNumberOfTracks(); - total += fRef->GetNumberOfV0s(); - total += fRef->GetNumberOfCascades(); - - return total; + Int_t total = 0; + + total += fRef->GetNumberOfTracks(); + total += fRef->GetNumberOfV0s(); + total += fRef->GetNumberOfCascades(); + + return total; } //_____________________________________________________________________________ @@ -251,32 +242,27 @@ Bool_t AliRsnEvent::ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDa // meaning that the absolute index reached the end. // - Int_t nTracks = fRef->GetNumberOfTracks(); - Int_t nV0s = fRef->GetNumberOfV0s(); - Int_t nCascades = fRef->GetNumberOfCascades(); - - if (index < nTracks) - { - realIndex = index; - type = AliRsnDaughter::kTrack; - return kTRUE; - } - else if (index >= nTracks && index < nTracks + nV0s) - { - realIndex = index - nTracks; - type = AliRsnDaughter::kV0; - return kTRUE; - } - else if (index >= nTracks + nV0s && index < nTracks + nV0s + nCascades) - { - realIndex = index - nTracks - nV0s; - type = AliRsnDaughter::kCascade; - return kTRUE; - } - - realIndex = -1; - type = AliRsnDaughter::kNoType; - return kFALSE; + Int_t nTracks = fRef->GetNumberOfTracks(); + Int_t nV0s = fRef->GetNumberOfV0s(); + Int_t nCascades = fRef->GetNumberOfCascades(); + + if (index < nTracks) { + realIndex = index; + type = AliRsnDaughter::kTrack; + return kTRUE; + } else if (index >= nTracks && index < nTracks + nV0s) { + realIndex = index - nTracks; + type = AliRsnDaughter::kV0; + return kTRUE; + } else if (index >= nTracks + nV0s && index < nTracks + nV0s + nCascades) { + realIndex = index - nTracks - nV0s; + type = AliRsnDaughter::kCascade; + return kTRUE; + } + + realIndex = -1; + type = AliRsnDaughter::kNoType; + return kFALSE; } //_____________________________________________________________________________ @@ -284,15 +270,15 @@ Int_t AliRsnEvent::GetMultiplicity(AliESDtrackCuts *cuts) { // // Returns event multiplicity as the number of tracks. -// If the argument is not NULL, returns instead the +// If the argument is not NULL, returns instead the // number of tracks passing the cuts hereby defined. // - if (!fRef) return 0; - - AliESDEvent *esd = GetRefESD(); - if (cuts && esd) return cuts->CountAcceptedTracks(esd); - else return fRef->GetNumberOfTracks(); + if (!fRef) return 0; + + AliESDEvent *esd = GetRefESD(); + if (cuts && esd) return cuts->CountAcceptedTracks(esd); + else return fRef->GetNumberOfTracks(); } //_____________________________________________________________________________ @@ -302,7 +288,7 @@ Double_t AliRsnEvent::GetVz() // Return Z coord of primary vertex // - return fRef->GetPrimaryVertex()->GetZ(); + return fRef->GetPrimaryVertex()->GetZ(); } //_____________________________________________________________________________ @@ -318,27 +304,25 @@ Int_t AliRsnEvent::SelectLeadingParticle // otherwise it is done irrespectively of the charge. // - Int_t i, nTracks = fRef->GetNumberOfTracks(); - fLeading = -1; - AliRsnDaughter leading; - leading.SetBad(); - - for (i = 0; i < nTracks; i++) - { - AliRsnDaughter track = GetDaughter(i); - if (cutPID) if (!cutPID->IsSelected(&track)) continue; - const AliVParticle *ref = track.GetRef(); - if (ref->Pt() < ptMin) continue; - //double pt = track.P().Perp(); - //Printf("track %d %g", i, pt); - if (!leading.IsOK() || ref->Pt() > ptMin) - { - fLeading = i; - //leading = track; - ptMin = ref->Pt(); - } - } - return fLeading; + Int_t i, nTracks = fRef->GetNumberOfTracks(); + fLeading = -1; + AliRsnDaughter leading; + leading.SetBad(); + + for (i = 0; i < nTracks; i++) { + AliRsnDaughter track = GetDaughter(i); + if (cutPID) if (!cutPID->IsSelected(&track)) continue; + const AliVParticle *ref = track.GetRef(); + if (ref->Pt() < ptMin) continue; + //double pt = track.P().Perp(); + //Printf("track %d %g", i, pt); + if (!leading.IsOK() || ref->Pt() > ptMin) { + fLeading = i; + //leading = track; + ptMin = ref->Pt(); + } + } + return fLeading; } //_________________________________________________________________________________________________ @@ -348,20 +332,20 @@ Double_t AliRsnEvent::GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID) // Loops on the list of tracks and computes average total momentum. // - Int_t i, nTracks = fRef->GetNumberOfTracks(); - Double_t pmean = 0.0; + Int_t i, nTracks = fRef->GetNumberOfTracks(); + Double_t pmean = 0.0; - for (i = 0, count = 0; i < nTracks; i++) { - AliRsnDaughter track = GetDaughter(i); - if (cutPID) if (!cutPID->IsSelected(&track)) continue; - pmean += track.P().Mag(); - count++; - } + for (i = 0, count = 0; i < nTracks; i++) { + AliRsnDaughter track = GetDaughter(i); + if (cutPID) if (!cutPID->IsSelected(&track)) continue; + pmean += track.P().Mag(); + count++; + } - if (count > 0) pmean /= (Double_t)count; - else pmean = 0.0; + if (count > 0) pmean /= (Double_t)count; + else pmean = 0.0; - return pmean; + return pmean; } //_____________________________________________________________________________ @@ -374,31 +358,31 @@ Bool_t AliRsnEvent::GetAngleDistr // with respect to the direction of leading particle. // - if (!leading.IsOK()) return kFALSE; + if (!leading.IsOK()) return kFALSE; - Int_t i, count, nTracks = fRef->GetNumberOfTracks(); - Double_t angle, angle2Mean = 0.0; + Int_t i, count, nTracks = fRef->GetNumberOfTracks(); + Double_t angle, angle2Mean = 0.0; - angleMean = angle2Mean = 0.0; + angleMean = angle2Mean = 0.0; - for (i = 0, count = 0; i < nTracks; i++) { - AliRsnDaughter trk = GetDaughter(i); - if (trk.GetID() == leading.GetID()) continue; + for (i = 0, count = 0; i < nTracks; i++) { + AliRsnDaughter trk = GetDaughter(i); + if (trk.GetID() == leading.GetID()) continue; - angle = leading.P().Angle(trk.P().Vect()); + angle = leading.P().Angle(trk.P().Vect()); - angleMean += angle; - angle2Mean += angle * angle; - count++; - } + angleMean += angle; + angle2Mean += angle * angle; + count++; + } - if (!count) return kFALSE; + if (!count) return kFALSE; - angleMean /= (Double_t)count; - angle2Mean /= (Double_t)count; - angleRMS = TMath::Sqrt(angle2Mean - angleMean * angleMean); + angleMean /= (Double_t)count; + angle2Mean /= (Double_t)count; + angleRMS = TMath::Sqrt(angle2Mean - angleMean * angleMean); - return kTRUE; + return kTRUE; } //_____________________________________________________________________________ @@ -410,30 +394,28 @@ Bool_t AliRsnEvent::SetDaughterESDtrack(AliRsnDaughter &out, Int_t i) // --- // Version #1: ESD tracks // - - // check 1: index in good range - if (i < 0 || i >= fRef->GetNumberOfTracks()) - { - out.SetBad(); - return kFALSE; - } - - // check 2: not NULL object - AliVTrack *track = (AliVTrack*)fRef->GetTrack(i); - if (!track) - { - out.SetBad(); - return kFALSE; - } - - // assign references of reconstructed track - Int_t label = TMath::Abs(track->GetLabel()); - out.SetRef(track); - out.SetLabel(label); - out.SetGood(); - - // assign MC info, if available - return SetMCInfoESD(out); + + // check 1: index in good range + if (i < 0 || i >= fRef->GetNumberOfTracks()) { + out.SetBad(); + return kFALSE; + } + + // check 2: not NULL object + AliVTrack *track = (AliVTrack*)fRef->GetTrack(i); + if (!track) { + out.SetBad(); + return kFALSE; + } + + // assign references of reconstructed track + Int_t label = TMath::Abs(track->GetLabel()); + out.SetRef(track); + out.SetLabel(label); + out.SetGood(); + + // assign MC info, if available + return SetMCInfoESD(out); } //_____________________________________________________________________________ @@ -445,30 +427,28 @@ Bool_t AliRsnEvent::SetDaughterAODtrack(AliRsnDaughter &out, Int_t i) // --- // Version #2: AOD tracks // - - // check 1: index in good range - if (i < 0 || i >= fRef->GetNumberOfTracks()) - { - out.SetBad(); - return kFALSE; - } - - // check 2: not NULL object - AliVTrack *track = (AliVTrack*)fRef->GetTrack(i); - if (!track) - { - out.SetBad(); - return kFALSE; - } - - // assign references of reconstructed track - Int_t label = TMath::Abs(track->GetLabel()); - out.SetRef(track); - out.SetLabel(label); - out.SetGood(); - - // assign MC info, if available - return SetMCInfoAOD(out); + + // check 1: index in good range + if (i < 0 || i >= fRef->GetNumberOfTracks()) { + out.SetBad(); + return kFALSE; + } + + // check 2: not NULL object + AliVTrack *track = (AliVTrack*)fRef->GetTrack(i); + if (!track) { + out.SetBad(); + return kFALSE; + } + + // assign references of reconstructed track + Int_t label = TMath::Abs(track->GetLabel()); + out.SetRef(track); + out.SetLabel(label); + out.SetGood(); + + // assign MC info, if available + return SetMCInfoAOD(out); } //_____________________________________________________________________________ @@ -481,45 +461,42 @@ Bool_t AliRsnEvent::SetDaughterESDv0(AliRsnDaughter &out, Int_t i) // Version #3: ESD v0 // - // check 1: index in good range - if (i > fRef->GetNumberOfV0s()) - { - out.SetBad(); - return 1; - } - - // check 2: not NULL object - AliESDEvent *ev = GetRefESD(); - AliESDv0 *v0 = ev->GetV0(i); - if (!v0) - { - out.SetBad(); - return 2; - } - - // assign references of reconstructed track - out.SetRef(v0); - out.SetGood(); - - // this time, assigning label is not trivial, - // it is done only if MC is present and both - // daughters come from a true particle - AliMCEvent *mc = GetRefMCESD(); - AliESDtrack *tp = ev->GetTrack(v0->GetPindex()); - AliESDtrack *tn = ev->GetTrack(v0->GetNindex()); - if (mc && tp && tn) - { - Int_t lp = TMath::Abs(tp->GetLabel()); - Int_t ln = TMath::Abs(tn->GetLabel()); - TParticle *pp = mc->Stack()->Particle(lp); - TParticle *pn = mc->Stack()->Particle(ln); - // if their first mothers are the same, the V0 is true - // otherwise no label can be assigned - if (pp->GetFirstMother() == pn->GetFirstMother()) out.SetLabel(pp->GetFirstMother()); - } - - // assign MC info, if available - return SetMCInfoESD(out); + // check 1: index in good range + if (i > fRef->GetNumberOfV0s()) { + out.SetBad(); + return 1; + } + + // check 2: not NULL object + AliESDEvent *ev = GetRefESD(); + AliESDv0 *v0 = ev->GetV0(i); + if (!v0) { + out.SetBad(); + return 2; + } + + // assign references of reconstructed track + out.SetRef(v0); + out.SetGood(); + + // this time, assigning label is not trivial, + // it is done only if MC is present and both + // daughters come from a true particle + AliMCEvent *mc = GetRefMCESD(); + AliESDtrack *tp = ev->GetTrack(v0->GetPindex()); + AliESDtrack *tn = ev->GetTrack(v0->GetNindex()); + if (mc && tp && tn) { + Int_t lp = TMath::Abs(tp->GetLabel()); + Int_t ln = TMath::Abs(tn->GetLabel()); + TParticle *pp = mc->Stack()->Particle(lp); + TParticle *pn = mc->Stack()->Particle(ln); + // if their first mothers are the same, the V0 is true + // otherwise no label can be assigned + if (pp->GetFirstMother() == pn->GetFirstMother()) out.SetLabel(pp->GetFirstMother()); + } + + // assign MC info, if available + return SetMCInfoESD(out); } //_____________________________________________________________________________ @@ -532,52 +509,53 @@ Bool_t AliRsnEvent::SetDaughterAODv0(AliRsnDaughter &out, Int_t i) // Version #4: AOD v0 // - // check 1: index in good range - if (i > fRef->GetNumberOfV0s()) - { - out.SetBad(); - return kFALSE; - } - - // check 2: not NULL object - AliAODEvent *ev = GetRefAOD(); - AliAODv0 *v0 = ev->GetV0(i); - if (!v0) - { - out.SetBad(); - return kFALSE; - } - - // assign references of reconstructed track - out.SetRef(v0); - out.SetGood(); - out.SetLabel(-1); - - // this time, assigning label is not trivial, - // it is done only if MC is present and both - // daughters come from a true particle - TClonesArray *mcArray = (TClonesArray*)ev->GetList()->FindObject(AliAODMCParticle::StdBranchName()); - AliAODTrack *tp = ev->GetTrack(v0->GetPosID()); - AliAODTrack *tn = ev->GetTrack(v0->GetNegID()); - if (mcArray && tp && tn) - { - Int_t lp = TMath::Abs(tp->GetLabel()); - Int_t ln = TMath::Abs(tn->GetLabel()); - // loop on array to find MC daughters - AliAODMCParticle *pp = 0x0, *pn = 0x0; - TObjArrayIter next(mcArray); - AliAODMCParticle *part = 0x0; - while ( (part = (AliAODMCParticle*)next()) ) - { - if (TMath::Abs(part->GetLabel()) == lp) pp = (AliAODMCParticle*)mcArray->IndexOf(part); - if (TMath::Abs(part->GetLabel()) == ln) pn = (AliAODMCParticle*)mcArray->IndexOf(part); - } - // assign a MC reference and a label only to true V0s - if (pp->GetMother() == pn->GetMother()) out.SetLabel(pp->GetMother()); - } - - // assign MC info, if available - return SetMCInfoAOD(out); + // check 1: index in good range + if (i > fRef->GetNumberOfV0s()) { + out.SetBad(); + return kFALSE; + } + + // check 2: not NULL object + AliAODEvent *ev = GetRefAOD(); + AliAODv0 *v0 = ev->GetV0(i); + if (!v0) { + out.SetBad(); + return kFALSE; + } + + TClonesArray *mcArray = (TClonesArray*)ev->GetList()->FindObject(AliAODMCParticle::StdBranchName()); + if (!mcArray) { + out.SetBad(); + return kFALSE; + } + + // assign references of reconstructed track + out.SetRef(v0); + out.SetGood(); + out.SetLabel(-1); + + // this time, assigning label is not trivial, + // it is done only if MC is present and both + // daughters come from a true particle + AliAODTrack *tp = ev->GetTrack(v0->GetPosID()); + AliAODTrack *tn = ev->GetTrack(v0->GetNegID()); + if (mcArray && tp && tn) { + Int_t lp = TMath::Abs(tp->GetLabel()); + Int_t ln = TMath::Abs(tn->GetLabel()); + // loop on array to find MC daughters + AliAODMCParticle *pp = 0x0, *pn = 0x0; + TObjArrayIter next(mcArray); + AliAODMCParticle *part = 0x0; + while ((part = (AliAODMCParticle*)next())) { + if (TMath::Abs(part->GetLabel()) == lp) pp = (AliAODMCParticle*)mcArray->IndexOf(part); + if (TMath::Abs(part->GetLabel()) == ln) pn = (AliAODMCParticle*)mcArray->IndexOf(part); + } + // assign a MC reference and a label only to true V0s + if (pp->GetMother() == pn->GetMother()) out.SetLabel(pp->GetMother()); + } + + // assign MC info, if available + return SetMCInfoAOD(out); } //_____________________________________________________________________________ @@ -590,7 +568,7 @@ Bool_t AliRsnEvent::SetDaughterESDcascade(AliRsnDaughter &, Int_t) // Version #3: ESD cascade // - return kTRUE; + return kTRUE; } //_____________________________________________________________________________ @@ -603,7 +581,7 @@ Bool_t AliRsnEvent::SetDaughterAODcascade(AliRsnDaughter &, Int_t) // Version #4: AOD cascade // - return kTRUE; + return kTRUE; } //_____________________________________________________________________________ @@ -615,48 +593,44 @@ Bool_t AliRsnEvent::SetMCInfoESD(AliRsnDaughter &out) // -- mother // - Int_t label = out.GetLabel(); - if (label < 0) return kFALSE; - - // if no MC reference is available, exit here (successfully) - AliMCEvent *mc = GetRefMCESD(); - if (!mc) return kTRUE; - Int_t nMC = mc->GetNumberOfTracks(); - - // assign MC reference, being aware of eventual - // overflows in the array (sometimes happened) - if (label < 0 || label >= nMC) - { - AliWarning(Form("Stack overflow: track label = %d -- stack maximum = %d", label, nMC)); - return kFALSE; - } - AliMCParticle *mcPart = (AliMCParticle*)mc->GetTrack(label); - if (!mcPart) - { - AliWarning(Form("Stack discontinuity: label %d refers to a NULL object", label)); - return kFALSE; - } - out.SetRefMC(mcPart); - - // if this is a primary track, exit here (successfully) - Int_t imum = mcPart->Particle()->GetFirstMother(); - if (imum < 0) return kTRUE; - - // if didn't stop there, search for the mother - if (imum >= nMC) - { - AliWarning(Form("Stack overflow: track mother label = %d -- stack maximum = %d", label, nMC)); - return kFALSE; - } - AliMCParticle *mcMother = (AliMCParticle*)mc->GetTrack(imum); - if (!mcMother) - { - AliWarning(Form("Stack discontinuity: label %d refers to a NULL object", imum)); - return kFALSE; - } - out.SetMotherPDG(TMath::Abs(mcMother->Particle()->GetPdgCode())); - - return kTRUE; + Int_t label = out.GetLabel(); + if (label < 0) return kFALSE; + + // if no MC reference is available, exit here (successfully) + AliMCEvent *mc = GetRefMCESD(); + if (!mc) return kTRUE; + Int_t nMC = mc->GetNumberOfTracks(); + + // assign MC reference, being aware of eventual + // overflows in the array (sometimes happened) + if (label < 0 || label >= nMC) { + AliWarning(Form("Stack overflow: track label = %d -- stack maximum = %d", label, nMC)); + return kFALSE; + } + AliMCParticle *mcPart = (AliMCParticle*)mc->GetTrack(label); + if (!mcPart) { + AliWarning(Form("Stack discontinuity: label %d refers to a NULL object", label)); + return kFALSE; + } + out.SetRefMC(mcPart); + + // if this is a primary track, exit here (successfully) + Int_t imum = mcPart->Particle()->GetFirstMother(); + if (imum < 0) return kTRUE; + + // if didn't stop there, search for the mother + if (imum >= nMC) { + AliWarning(Form("Stack overflow: track mother label = %d -- stack maximum = %d", label, nMC)); + return kFALSE; + } + AliMCParticle *mcMother = (AliMCParticle*)mc->GetTrack(imum); + if (!mcMother) { + AliWarning(Form("Stack discontinuity: label %d refers to a NULL object", imum)); + return kFALSE; + } + out.SetMotherPDG(TMath::Abs(mcMother->Particle()->GetPdgCode())); + + return kTRUE; } //_____________________________________________________________________________ @@ -668,40 +642,35 @@ Bool_t AliRsnEvent::SetMCInfoAOD(AliRsnDaughter &out) // -- mother // - Int_t label = out.GetLabel(); - if (label < 0) return kFALSE; - - // if no MC reference is available, exit here (successfully) - AliAODEvent *mc = GetRefMCAOD(); - if (!mc) return kTRUE; - - // loop on particles using the track label as reference - // and then assign also the mother type, if found - TClonesArray *mcArray = (TClonesArray*)mc->GetList()->FindObject(AliAODMCParticle::StdBranchName()); - if(!mcArray) return kFALSE; - TObjArrayIter next(mcArray); - AliAODMCParticle *part = 0x0; - while ( (part = (AliAODMCParticle*)next()) ) - { - if (TMath::Abs(part->GetLabel()) == label) - { - out.SetRefMC(part); - Int_t imum = part->GetMother(); - if (imum >= 0 && imum <= mcArray->GetEntriesFast()) - { - AliAODMCParticle *mum = (AliAODMCParticle*)mcArray->At(imum); - if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode())); - } - else - { - AliWarning(Form("Array overflow: track mother label = %d -- stack maximum = %d", imum, mcArray->GetEntriesFast())); - return kFALSE; + Int_t label = out.GetLabel(); + if (label < 0) return kFALSE; + + // if no MC reference is available, exit here (successfully) + AliAODEvent *mc = GetRefMCAOD(); + if (!mc) return kTRUE; + + // loop on particles using the track label as reference + // and then assign also the mother type, if found + TClonesArray *mcArray = (TClonesArray*)mc->GetList()->FindObject(AliAODMCParticle::StdBranchName()); + if (!mcArray) return kFALSE; + TObjArrayIter next(mcArray); + AliAODMCParticle *part = 0x0; + while ((part = (AliAODMCParticle*)next())) { + if (TMath::Abs(part->GetLabel()) == label) { + out.SetRefMC(part); + Int_t imum = part->GetMother(); + if (imum >= 0 && imum <= mcArray->GetEntriesFast()) { + AliAODMCParticle *mum = (AliAODMCParticle*)mcArray->At(imum); + if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode())); + } else { + AliWarning(Form("Array overflow: track mother label = %d -- stack maximum = %d", imum, mcArray->GetEntriesFast())); + return kFALSE; + } + + // if a MC reference is found, there is no need to go on with the loop + break; } - - // if a MC reference is found, there is no need to go on with the loop - break; - } - } - - return kTRUE; + } + + return kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnEvent.h b/PWG2/RESONANCES/AliRsnEvent.h index f24a3a591b7..162c960646c 100644 --- a/PWG2/RESONANCES/AliRsnEvent.h +++ b/PWG2/RESONANCES/AliRsnEvent.h @@ -23,81 +23,80 @@ class AliVEvent; class AliRsnCutPID; class AliESDtrackCuts; -class AliRsnEvent : public TObject -{ - public: - - AliRsnEvent(AliVEvent *ref = 0, AliVEvent *refMC = 0); - AliRsnEvent(const AliRsnEvent& copy); - AliRsnEvent& operator= (const AliRsnEvent& copy); - virtual ~AliRsnEvent(); - - // basic setters/getters - void SetRef (AliVEvent *ref) {fRef = ref;} - void SetRefMC(AliVEvent *refmc) {fRefMC = refmc;} - void SetLeadingIndex(Int_t i) {fLeading = i;} - void SetLocalID(Int_t i) {fLocalID = i;} - AliVEvent* GetRef() {return fRef;} - AliVEvent* GetRefMC() {return fRefMC;} - Int_t GetLeadingIndex() const {return fLeading;} - Int_t GetLeadingParticleID() const {return fLeading;} - Int_t GetLocalID() const {return fLocalID;} - - // getters which convert into allowed input types - AliESDEvent* GetRefESD() {return dynamic_cast(fRef);} - AliAODEvent* GetRefAOD() {return dynamic_cast(fRef);} - AliMCEvent* GetRefMCESD() {return dynamic_cast (fRefMC);} - AliAODEvent* GetRefMCAOD() {return dynamic_cast(fRefMC);} - Bool_t IsESD() {return (GetRefESD() != 0x0);} - Bool_t IsAOD() {return (GetRefAOD() != 0x0);} - - // advanced getters - Double_t GetVz(); - Int_t GetMultiplicity(AliESDtrackCuts *cuts = 0x0); - - // setters for a daughter - Bool_t SetDaughter (AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack); - Bool_t SetDaughterMC(AliRsnDaughter &daughter, Int_t index); - AliRsnDaughter GetDaughter (Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack); - AliRsnDaughter GetDaughterMC(Int_t i); - Int_t GetAbsoluteSum(); - Bool_t ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type); - - // leading particle stuff - void SetLeadingParticle(AliRsnDaughter &leading) {if (fLeading >= 0) SetDaughter(leading, fLeading);} - Int_t SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0); - Double_t GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID = 0x0); - Bool_t GetAngleDistr(Double_t &angleMean, Double_t &angleRMS, AliRsnDaughter reference); - - // statig getters - static AliRsnEvent *GetCurrentEvent1() {return fgRsnEvent1;} - static AliRsnEvent *GetCurrentEvent2() {return fgRsnEvent2;} - static void SetCurrentEvent1(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent1 = event; fgRsnEvent1->SetLocalID(id);} - static void SetCurrentEvent2(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent2 = event; fgRsnEvent2->SetLocalID(id);} - static Bool_t IsCurrentEvent1() {if (fgRsnEvent1 != 0x0) return kTRUE; return kFALSE;} - static Bool_t IsCurrentEvent2() {if (fgRsnEvent2 != 0x0) return kTRUE; return kFALSE;} - static Bool_t SameEvent() {if (fgRsnEvent1 == fgRsnEvent2) return kTRUE; return kFALSE;} - - private: - - Bool_t SetDaughterESDtrack (AliRsnDaughter &target, Int_t index); - Bool_t SetDaughterAODtrack (AliRsnDaughter &target, Int_t index); - Bool_t SetDaughterESDv0 (AliRsnDaughter &target, Int_t index); - Bool_t SetDaughterAODv0 (AliRsnDaughter &target, Int_t index); - Bool_t SetDaughterESDcascade(AliRsnDaughter &target, Int_t index); - Bool_t SetDaughterAODcascade(AliRsnDaughter &target, Int_t index); - Bool_t SetMCInfoESD (AliRsnDaughter &target); - Bool_t SetMCInfoAOD (AliRsnDaughter &target); - - AliVEvent *fRef; // pointer to input event - AliVEvent *fRefMC; // pointer to reference MC event (if any) - Int_t fLeading; // index of leading track - Int_t fLocalID; // identification number used locally - - static AliRsnEvent *fgRsnEvent1; //! pointer to current event #1 (default current event) - static AliRsnEvent *fgRsnEvent2; //! pointer to current event #2 (different from the other when doing mixing) - - ClassDef(AliRsnEvent, 4); +class AliRsnEvent : public TObject { +public: + + AliRsnEvent(AliVEvent *ref = 0, AliVEvent *refMC = 0); + AliRsnEvent(const AliRsnEvent& copy); + AliRsnEvent& operator= (const AliRsnEvent& copy); + virtual ~AliRsnEvent(); + + // basic setters/getters + void SetRef(AliVEvent *ref) {fRef = ref;} + void SetRefMC(AliVEvent *refmc) {fRefMC = refmc;} + void SetLeadingIndex(Int_t i) {fLeading = i;} + void SetLocalID(Int_t i) {fLocalID = i;} + AliVEvent* GetRef() {return fRef;} + AliVEvent* GetRefMC() {return fRefMC;} + Int_t GetLeadingIndex() const {return fLeading;} + Int_t GetLeadingParticleID() const {return fLeading;} + Int_t GetLocalID() const {return fLocalID;} + + // getters which convert into allowed input types + AliESDEvent* GetRefESD() {return dynamic_cast(fRef);} + AliAODEvent* GetRefAOD() {return dynamic_cast(fRef);} + AliMCEvent* GetRefMCESD() {return dynamic_cast(fRefMC);} + AliAODEvent* GetRefMCAOD() {return dynamic_cast(fRefMC);} + Bool_t IsESD() {return (GetRefESD() != 0x0);} + Bool_t IsAOD() {return (GetRefAOD() != 0x0);} + + // advanced getters + Double_t GetVz(); + Int_t GetMultiplicity(AliESDtrackCuts *cuts = 0x0); + + // setters for a daughter + Bool_t SetDaughter(AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack); + Bool_t SetDaughterMC(AliRsnDaughter &daughter, Int_t index); + AliRsnDaughter GetDaughter(Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack); + AliRsnDaughter GetDaughterMC(Int_t i); + Int_t GetAbsoluteSum(); + Bool_t ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type); + + // leading particle stuff + void SetLeadingParticle(AliRsnDaughter &leading) {if (fLeading >= 0) SetDaughter(leading, fLeading);} + Int_t SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0); + Double_t GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID = 0x0); + Bool_t GetAngleDistr(Double_t &angleMean, Double_t &angleRMS, AliRsnDaughter reference); + + // statig getters + static AliRsnEvent *GetCurrentEvent1() {return fgRsnEvent1;} + static AliRsnEvent *GetCurrentEvent2() {return fgRsnEvent2;} + static void SetCurrentEvent1(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent1 = event; fgRsnEvent1->SetLocalID(id);} + static void SetCurrentEvent2(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent2 = event; fgRsnEvent2->SetLocalID(id);} + static Bool_t IsCurrentEvent1() {if (fgRsnEvent1 != 0x0) return kTRUE; return kFALSE;} + static Bool_t IsCurrentEvent2() {if (fgRsnEvent2 != 0x0) return kTRUE; return kFALSE;} + static Bool_t SameEvent() {if (fgRsnEvent1 == fgRsnEvent2) return kTRUE; return kFALSE;} + +private: + + Bool_t SetDaughterESDtrack(AliRsnDaughter &target, Int_t index); + Bool_t SetDaughterAODtrack(AliRsnDaughter &target, Int_t index); + Bool_t SetDaughterESDv0(AliRsnDaughter &target, Int_t index); + Bool_t SetDaughterAODv0(AliRsnDaughter &target, Int_t index); + Bool_t SetDaughterESDcascade(AliRsnDaughter &target, Int_t index); + Bool_t SetDaughterAODcascade(AliRsnDaughter &target, Int_t index); + Bool_t SetMCInfoESD(AliRsnDaughter &target); + Bool_t SetMCInfoAOD(AliRsnDaughter &target); + + AliVEvent *fRef; // pointer to input event + AliVEvent *fRefMC; // pointer to reference MC event (if any) + Int_t fLeading; // index of leading track + Int_t fLocalID; // identification number used locally + + static AliRsnEvent *fgRsnEvent1; //! pointer to current event #1 (default current event) + static AliRsnEvent *fgRsnEvent2; //! pointer to current event #2 (different from the other when doing mixing) + + ClassDef(AliRsnEvent, 4); }; #endif diff --git a/PWG2/RESONANCES/AliRsnExpression.cxx b/PWG2/RESONANCES/AliRsnExpression.cxx index ebf696beae4..3d0d033b1d8 100644 --- a/PWG2/RESONANCES/AliRsnExpression.cxx +++ b/PWG2/RESONANCES/AliRsnExpression.cxx @@ -22,187 +22,187 @@ AliRsnCutSet *AliRsnExpression::fgCutSet = 0; //______________________________________________________________________________ AliRsnExpression::AliRsnExpression(TString exp) : - TObject(), - fVname(""), - fArg1(0x0), - fArg2(0x0), - fOperator(0) + TObject(), + fVname(""), + fArg1(0x0), + fArg2(0x0), + fOperator(0) { - // Default constructor - TObjArray* tokens = Tokenize(exp); - - Int_t i = -1; - AliRsnExpression* e = Expression(*tokens, i); - // Copy !!! - fArg1 = e->fArg1; e->fArg1 = 0; - fArg2 = e->fArg2; e->fArg2 = 0; - fOperator = e->fOperator; - fVname = e->fVname; - delete e; - delete tokens; + // Default constructor + TObjArray* tokens = Tokenize(exp); + + Int_t i = -1; + AliRsnExpression* e = Expression(*tokens, i); + // Copy !!! + fArg1 = e->fArg1; e->fArg1 = 0; + fArg2 = e->fArg2; e->fArg2 = 0; + fOperator = e->fOperator; + fVname = e->fVname; + delete e; + delete tokens; } //______________________________________________________________________________ AliRsnExpression::~AliRsnExpression() { - if (fArg1) delete fArg1; - if (fArg2) delete fArg2; + if (fArg1) delete fArg1; + if (fArg2) delete fArg2; } AliRsnExpression::AliRsnExpression(const AliRsnExpression & exp) : TObject(exp), - fVname(exp.fVname), - fArg1(exp.fArg1), - fArg2(exp.fArg2), - fOperator(exp.fOperator) + fVname(exp.fVname), + fArg1(exp.fArg1), + fArg2(exp.fArg2), + fOperator(exp.fOperator) {} //______________________________________________________________________________ AliRsnExpression& AliRsnExpression::operator= (const AliRsnExpression& e) { - // AliRsnExpression assignment operator. - - if (this != &e) { - TObject::operator= (e); - fArg1 = e.fArg1; - fArg2 = e.fArg2; - fOperator = e.fOperator; - fVname = e.fVname; - } - return *this; + // AliRsnExpression assignment operator. + + if (this != &e) { + TObject::operator= (e); + fArg1 = e.fArg1; + fArg2 = e.fArg2; + fOperator = e.fOperator; + fVname = e.fVname; + } + return *this; } //______________________________________________________________________________ AliRsnExpression::AliRsnExpression(int op, AliRsnExpression* a, AliRsnExpression* b) : - TObject(), - fVname(""), - fArg1(a), - fArg2(b), - fOperator(op) + TObject(), + fVname(""), + fArg1(a), + fArg2(b), + fOperator(op) { - // Create a new expression + // Create a new expression } //______________________________________________________________________________ AliRsnExpression::AliRsnExpression(int op, AliRsnExpression* a) : - TObject(), - fVname(""), - fArg1(0), - fArg2(a), - fOperator(op) + TObject(), + fVname(""), + fArg1(0), + fArg2(a), + fOperator(op) { - // Create a unary expression. + // Create a unary expression. } //______________________________________________________________________________ Bool_t AliRsnExpression::Value(TObjArray &vars) { - // Evaluate the expression - if (fArg2 == 0 && fVname.IsNull()) { - AliError("Expression undefined."); - return kFALSE; - } + // Evaluate the expression + if (fArg2 == 0 && fVname.IsNull()) { + AliError("Expression undefined."); + return kFALSE; + } // AliDebug(AliLog::kDebug,Form("fOperator %d",fOperator)); - switch (fOperator) { + switch (fOperator) { - case kOpOR : - return fArg1->Value(vars) || fArg2->Value(vars); + case kOpOR : + return fArg1->Value(vars) || fArg2->Value(vars); - case kOpAND : - return fArg1->Value(vars) && fArg2->Value(vars); + case kOpAND : + return fArg1->Value(vars) && fArg2->Value(vars); - case kOpNOT : - return !(fArg2->Value(vars)); + case kOpNOT : + return !(fArg2->Value(vars)); - case 0 : { + case 0 : { // Int_t indexx = fgCutSet->GetIndexByCutName ( fVname.Data() ); - AliDebug(AliLog::kDebug,Form("Vname %s",fVname.Data())); + AliDebug(AliLog::kDebug, Form("Vname %s", fVname.Data())); // return fgCutSet->GetBoolValue ( indexx ); - return fgCutSet->GetBoolValue(fVname.Atoi()); - } + return fgCutSet->GetBoolValue(fVname.Atoi()); + } - default: - AliError("Illegal operator in expression!"); + default: + AliError("Illegal operator in expression!"); - } - return kFALSE; + } + return kFALSE; } //______________________________________________________________________________ TString AliRsnExpression::Unparse() const { - // Unparse the expression + // Unparse the expression - TString opVals[4] = { "", "&", "|","!" }; - if (fArg2 == 0 && fVname.IsNull()) { - AliError("Expression undefined."); - return "Error"; - } + TString opVals[4] = { "", "&", "|", "!" }; + if (fArg2 == 0 && fVname.IsNull()) { + AliError("Expression undefined."); + return "Error"; + } - if (fArg2 == 0 && !fVname.IsNull()) return fVname; + if (fArg2 == 0 && !fVname.IsNull()) return fVname; - if (fArg1 == 0 && fArg2) { - return opVals[fOperator]+fArg2->Unparse(); - } - return "("+fArg1->Unparse() +" "+opVals[fOperator]+" "+fArg2->Unparse() +")"; + if (fArg1 == 0 && fArg2) { + return opVals[fOperator] + fArg2->Unparse(); + } + return "(" + fArg1->Unparse() + " " + opVals[fOperator] + " " + fArg2->Unparse() + ")"; } //______________________________________________________________________________ TObjArray* AliRsnExpression::Tokenize(TString str) const { - // tokenize the expression - - // Remove spaces - TString str1; - for (Int_t i=0; iGetEntriesFast(); - TString sumval; - for (Int_t i=0; iAt(i); - sumval.Append(val->String()); - } - // get the operator tokens - TObjArray* optok = str1.Tokenize(sumval.Data()); - // put all operator in one string - TString operators; - Int_t nopt = optok->GetEntriesFast(); - for (Int_t i=0; iAt(i); - operators.Append(val1->String()); - } - // add more room to be safe - TObjString* blank = new TObjString(" "); - operators.Append(" "); - valtok->AddLast(blank); - // Now put var. and oper. together - TObjArray* tokens = new TObjArray(valtok->GetEntriesFast() + operators.Length()); - int io = 0,iv = 0; - int index = 0; - while (1) { - TString so = operators[io]; - int indexO = str1.Index(so, index); - TString val2 = ((TObjString*) valtok->At(iv))->String(); - int indexV = str1.Index(val2, index); - if ((indexO < indexV || indexV < 0) && indexO >=0) { - tokens->AddLast(new TObjString(so)); - index += so.Length(); - io++; - } - if ((indexV < indexO || indexO < 0) && indexV >=0) { - tokens->AddLast(new TObjString(val2)); - index += val2.Length(); - iv++; - } - if (index >= str1.Length()) break; - } + // tokenize the expression + + // Remove spaces + TString str1; + for (Int_t i = 0; i < str.Length(); i++) { + if (str[i] == ' ') continue; + str1.Append(str[i]); + } + // get variable tokens + TObjArray* valtok = str1.Tokenize("!&|()"); + // put all variables together + Int_t nvt = valtok->GetEntriesFast(); + TString sumval; + for (Int_t i = 0; i < nvt; i++) { + TObjString* val = (TObjString*) valtok->At(i); + sumval.Append(val->String()); + } + // get the operator tokens + TObjArray* optok = str1.Tokenize(sumval.Data()); + // put all operator in one string + TString operators; + Int_t nopt = optok->GetEntriesFast(); + for (Int_t i = 0; i < nopt; i++) { + TObjString* val1 = (TObjString*) optok->At(i); + operators.Append(val1->String()); + } + // add more room to be safe + TObjString* blank = new TObjString(" "); + operators.Append(" "); + valtok->AddLast(blank); + // Now put var. and oper. together + TObjArray* tokens = new TObjArray(valtok->GetEntriesFast() + operators.Length()); + int io = 0, iv = 0; + int index = 0; + while (1) { + TString so = operators[io]; + int indexO = str1.Index(so, index); + TString val2 = ((TObjString*) valtok->At(iv))->String(); + int indexV = str1.Index(val2, index); + if ((indexO < indexV || indexV < 0) && indexO >= 0) { + tokens->AddLast(new TObjString(so)); + index += so.Length(); + io++; + } + if ((indexV < indexO || indexO < 0) && indexV >= 0) { + tokens->AddLast(new TObjString(val2)); + index += val2.Length(); + iv++; + } + if (index >= str1.Length()) break; + } // // Debug -> Print the tokens // Int_t nt = tokens->GetEntriesFast(); @@ -213,132 +213,131 @@ TObjArray* AliRsnExpression::Tokenize(TString str) const // } // // - delete valtok; - delete optok; + delete valtok; + delete optok; - return tokens; + return tokens; } //______________________________________________________________________________ AliRsnExpression* AliRsnExpression::Element(TObjArray &st, Int_t &i) { - // create an element - - AliRsnExpression* result = 0; - - Int_t nt = st.GetEntriesFast(); - TString token = "@"; - TObjString* valt; - // next token - if (i < nt-1) { - i++; - valt = (TObjString*) st.At(i); - token = valt->String(); - } - // token type - char ttok = (token[0]!='|' && token[0]!='&' && - token[0]!='!' && token[0]!='('&& token[0]!=')') ? 'w' : token[0]; - switch (ttok) { - case 'w' : { - result = new AliRsnVariableExpression(token); - break; - } - case '(' : - result = Expression(st, i); - // next token - if (i < nt-1) { + // create an element + + AliRsnExpression* result = 0; + + Int_t nt = st.GetEntriesFast(); + TString token = "@"; + TObjString* valt; + // next token + if (i < nt - 1) { i++; valt = (TObjString*) st.At(i); token = valt->String(); - } - if (token[0] != ')') { - // i--; // push back - AliErrorGeneral("AliRsnExpression::Element", "Mismatched parenthesis."); - delete result; - result = new AliRsnExpression; - } - break; - default: - i--; // push back - AliErrorGeneral("AliRsnExpression::Element", Form("Unexpected symbol on input. %s", token.Data())); - //if (result) delete result; - result = new AliRsnExpression; - } - return result; + } + // token type + char ttok = (token[0] != '|' && token[0] != '&' && + token[0] != '!' && token[0] != '(' && token[0] != ')') ? 'w' : token[0]; + switch (ttok) { + case 'w' : { + result = new AliRsnVariableExpression(token); + break; + } + case '(' : + result = Expression(st, i); + // next token + if (i < nt - 1) { + i++; + valt = (TObjString*) st.At(i); + token = valt->String(); + } + if (token[0] != ')') { + // i--; // push back + AliErrorGeneral("AliRsnExpression::Element", "Mismatched parenthesis."); + delete result; + result = new AliRsnExpression; + } + break; + default: + i--; // push back + AliErrorGeneral("AliRsnExpression::Element", Form("Unexpected symbol on input. %s", token.Data())); + //if (result) delete result; + result = new AliRsnExpression; + } + return result; } //______________________________________________________________________________ AliRsnExpression* AliRsnExpression::Primary(TObjArray &st, Int_t &i) { - // create a primary - - Int_t nt = st.GetEntriesFast(); - TString token = "@"; - TObjString* valt; - // next token - if (i < nt-1) { - i++; - valt = (TObjString*) st.At(i); - token = valt->String(); - } - - switch (token[0]) { - case '!' : - return new AliRsnExpression(kOpNOT, Primary(st, i)); - default: - i--; // push back - return Element(st, i); - } + // create a primary + + Int_t nt = st.GetEntriesFast(); + TString token = "@"; + TObjString* valt; + // next token + if (i < nt - 1) { + i++; + valt = (TObjString*) st.At(i); + token = valt->String(); + } + + switch (token[0]) { + case '!' : + return new AliRsnExpression(kOpNOT, Primary(st, i)); + default: + i--; // push back + return Element(st, i); + } } //______________________________________________________________________________ -AliRsnExpression* AliRsnExpression::Expression(TObjArray &st,Int_t &i) +AliRsnExpression* AliRsnExpression::Expression(TObjArray &st, Int_t &i) { - // create an expression + // create an expression - AliRsnExpression* result = 0; - Bool_t done = kFALSE; - TString token; - TObjString* valt; + AliRsnExpression* result = 0; + Bool_t done = kFALSE; + TString token; + TObjString* valt; - static int stack = 0; - stack++; - Int_t nt = st.GetEntriesFast(); + static int stack = 0; + stack++; + Int_t nt = st.GetEntriesFast(); - result = Primary(st, i); + result = Primary(st, i); // cout <<"i "<Unparse() << endl; - while (! done) { - // next token - if (i < nt-1) i++; - else break; - valt = (TObjString*) st.At(i); - token = valt->String(); - switch (token[0]) { - case '&' : - result = new AliRsnExpression(kOpAND, result, Primary(st, i)); + while (! done) { + // next token + if (i < nt - 1) i++; + else break; + valt = (TObjString*) st.At(i); + token = valt->String(); + switch (token[0]) { + case '&' : + result = new AliRsnExpression(kOpAND, result, Primary(st, i)); // cout <<"i "<Unparse() << endl; - break; - case '|' : - result = new AliRsnExpression(kOpOR, result, Primary(st, i)); + break; + case '|' : + result = new AliRsnExpression(kOpOR, result, Primary(st, i)); // cout <<"i "<Unparse() << endl; - break; - default: - done = kTRUE; - i--; // push back - break; - } - } - stack--; - if (stack == 0 && !token.IsNull() && token[0] == ')') { - AliErrorGeneral("AliRsnExpression::Expression", "To many closing parenthesis."); - delete result; - result = new AliRsnExpression; - } else - if (stack == 0 && i< nt-1) { + break; + default: + done = kTRUE; + i--; // push back + break; + } + } + stack--; + if (stack == 0 && !token.IsNull() && token[0] == ')') { + AliErrorGeneral("AliRsnExpression::Expression", "To many closing parenthesis."); + delete result; + result = new AliRsnExpression; + } else if (stack == 0 && i < nt - 1) { AliErrorGeneral("AliRsnExpression::Expression", Form("Unexpected symbol on input. %s", token.Data())); delete result; result = new AliRsnExpression; - } - return result; + } + return result; } diff --git a/PWG2/RESONANCES/AliRsnExpression.h b/PWG2/RESONANCES/AliRsnExpression.h index cd9e42310f1..27dfb1521ba 100644 --- a/PWG2/RESONANCES/AliRsnExpression.h +++ b/PWG2/RESONANCES/AliRsnExpression.h @@ -16,48 +16,47 @@ class TObjArray; #include "AliRsnCutSet.h" class AliRsnVariableExpression; -class AliRsnExpression : public TObject -{ +class AliRsnExpression : public TObject { - public: +public: - // operators for complex cut expressions - enum ECutOp { - kOpAND=1, // AND '&' + // operators for complex cut expressions + enum ECutOp { + kOpAND = 1, // AND '&' kOpOR, // OR '|' kOpNOT // Unary negation '!' - }; + }; - AliRsnExpression() : fVname(0), fArg1(0), fArg2(0), fOperator(0) {} - AliRsnExpression(TString exp); - virtual ~AliRsnExpression(); - AliRsnExpression(const AliRsnExpression& exp); - AliRsnExpression& operator= (const AliRsnExpression& exp); + AliRsnExpression() : fVname(0), fArg1(0), fArg2(0), fOperator(0) {} + AliRsnExpression(TString exp); + virtual ~AliRsnExpression(); + AliRsnExpression(const AliRsnExpression& exp); + AliRsnExpression& operator= (const AliRsnExpression& exp); - virtual Bool_t Value(TObjArray & vars); - virtual TString Unparse() const; + virtual Bool_t Value(TObjArray & vars); + virtual TString Unparse() const; - void SetCutSet(AliRsnCutSet* const theValue) { fgCutSet = theValue; } - AliRsnCutSet* GetCutSet() const { return fgCutSet; } + void SetCutSet(AliRsnCutSet* const theValue) { fgCutSet = theValue; } + AliRsnCutSet* GetCutSet() const { return fgCutSet; } - TString fVname; // Variable name - static AliRsnCutSet *fgCutSet; // global cutset + TString fVname; // Variable name + static AliRsnCutSet *fgCutSet; // global cutset - private: - AliRsnExpression* fArg1; // left argument - AliRsnExpression* fArg2; // right argument - Int_t fOperator; // operator +private: + AliRsnExpression* fArg1; // left argument + AliRsnExpression* fArg2; // right argument + Int_t fOperator; // operator - AliRsnExpression(int op, AliRsnExpression* a); - AliRsnExpression(int op, AliRsnExpression* a, AliRsnExpression* b); + AliRsnExpression(int op, AliRsnExpression* a); + AliRsnExpression(int op, AliRsnExpression* a, AliRsnExpression* b); - TObjArray* Tokenize(TString str) const; - static AliRsnExpression* Element(TObjArray &st, Int_t &i); - static AliRsnExpression* Primary(TObjArray &st, Int_t &i); - static AliRsnExpression* Expression(TObjArray &st, Int_t &i); + TObjArray* Tokenize(TString str) const; + static AliRsnExpression* Element(TObjArray &st, Int_t &i); + static AliRsnExpression* Primary(TObjArray &st, Int_t &i); + static AliRsnExpression* Expression(TObjArray &st, Int_t &i); - ClassDef(AliRsnExpression, 1); // Class to evaluate an expression + ClassDef(AliRsnExpression, 1); // Class to evaluate an expression }; #endif diff --git a/PWG2/RESONANCES/AliRsnFunction.cxx b/PWG2/RESONANCES/AliRsnFunction.cxx index c4edb0f2b94..b5df2a5646a 100644 --- a/PWG2/RESONANCES/AliRsnFunction.cxx +++ b/PWG2/RESONANCES/AliRsnFunction.cxx @@ -36,15 +36,15 @@ ClassImp(AliRsnFunction) //________________________________________________________________________________________ AliRsnFunction::AliRsnFunction(Bool_t useTH1) : - TObject(), - fPairDef(0x0), - fAxisList("AliRsnValue", 0), - fPair(0x0), - fEvent(0x0), - fUseTH1(useTH1), - fSize(0), - fH1(0x0), - fHSparse(0x0) + TObject(), + fPairDef(0x0), + fAxisList("AliRsnValue", 0), + fPair(0x0), + fEvent(0x0), + fUseTH1(useTH1), + fSize(0), + fH1(0x0), + fHSparse(0x0) { // // Constructor. @@ -53,15 +53,15 @@ AliRsnFunction::AliRsnFunction(Bool_t useTH1) : //________________________________________________________________________________________ AliRsnFunction::AliRsnFunction(const AliRsnFunction ©) : - TObject(copy), - fPairDef(copy.fPairDef), - fAxisList(copy.fAxisList), - fPair(copy.fPair), - fEvent(copy.fEvent), - fUseTH1(copy.fUseTH1), - fSize(copy.fSize), - fH1(0x0), - fHSparse(0x0) + TObject(copy), + fPairDef(copy.fPairDef), + fAxisList(copy.fAxisList), + fPair(copy.fPair), + fEvent(copy.fEvent), + fUseTH1(copy.fUseTH1), + fSize(copy.fSize), + fH1(0x0), + fHSparse(0x0) { // // Copy constructor. @@ -75,19 +75,19 @@ const AliRsnFunction& AliRsnFunction::operator=(const AliRsnFunction& copy) // Assignment operator. // - fPairDef = copy.fPairDef; - fPair = copy.fPair; - fEvent = copy.fEvent; - fUseTH1 = copy.fUseTH1; - fSize = copy.fSize; + fPairDef = copy.fPairDef; + fPair = copy.fPair; + fEvent = copy.fEvent; + fUseTH1 = copy.fUseTH1; + fSize = copy.fSize; - if (fH1) delete fH1; - fH1 = 0x0; - - if (fHSparse) delete fHSparse; - fHSparse = 0x0; + if (fH1) delete fH1; + fH1 = 0x0; - return (*this); + if (fHSparse) delete fHSparse; + fHSparse = 0x0; + + return (*this); } //________________________________________________________________________________________ @@ -98,18 +98,17 @@ const char* AliRsnFunction::GetName() const // the function type and binning // - TString name(""); + TString name(""); - TObjArrayIter next(&fAxisList); - AliRsnValue *axis = 0; + TObjArrayIter next(&fAxisList); + AliRsnValue *axis = 0; - while ((axis = (AliRsnValue*)next())) - { - if (name.Length() > 1) name += '_'; - name += axis->GetName(); - } + while ((axis = (AliRsnValue*)next())) { + if (name.Length() > 1) name += '_'; + name += axis->GetName(); + } - return name.Data(); + return name.Data(); } //________________________________________________________________________________________ @@ -125,23 +124,21 @@ Bool_t AliRsnFunction::AddAxis(AliRsnValue *const axis) // NOTE: this can cause large files and high memory occupancy. // - RSNTARGET target = axis->GetTargetType(); - if (target != AliRsnTarget::kMother && target != AliRsnTarget::kEvent) - { - AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", axis->GetName(), axis->GetTargetTypeName())); - return kFALSE; - } - - Int_t size = fAxisList.GetEntries(); - new (fAxisList[size]) AliRsnValue(*axis); - - if (fAxisList.GetEntries() > 3) - { - AliWarning("Adding more than 3 axes will produce a THnSparseD output."); - fUseTH1 = kFALSE; - } - - return kTRUE; + RSNTARGET target = axis->GetTargetType(); + if (target != AliRsnTarget::kMother && target != AliRsnTarget::kEvent) { + AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", axis->GetName(), axis->GetTargetTypeName())); + return kFALSE; + } + + Int_t size = fAxisList.GetEntries(); + new(fAxisList[size]) AliRsnValue(*axis); + + if (fAxisList.GetEntries() > 3) { + AliWarning("Adding more than 3 axes will produce a THnSparseD output."); + fUseTH1 = kFALSE; + } + + return kTRUE; } //________________________________________________________________________________________ @@ -157,54 +154,46 @@ TH1* AliRsnFunction::CreateHistogram(const char *histoName, const char *histoTit // This version produces a THnSparseF. // - fSize = fAxisList.GetEntries(); - if (!fSize) - { - AliError("No axes defined"); - return 0x0; - } - else if (fSize > 3) - { - AliError("Too many axes defined for a TH1 object"); - return 0x0; - } - - // retrieve binnings for main and secondary axes - AliRsnValue *fcnAxis; - TArrayD array[3]; - for (Int_t i = 0; i < fSize; i++) - { - fcnAxis = (AliRsnValue*)fAxisList.At(i); - if (!fcnAxis) - { - AliError("Empty axis"); - array[i].Set(2); - array[i][0] = -1E5; - array[i][1] = -1E5; - continue; - } - else - { - array[i] = fcnAxis->GetArray(); - } - } - - // create histogram depending on the number of axes - switch (fSize) - { - case 1: - fH1 = new TH1F(histoName, histoTitle, array[0].GetSize() - 1, array[0].GetArray()); - break; - case 2: - fH1 = new TH2F(histoName, histoTitle, array[0].GetSize() - 1, array[0].GetArray(), array[1].GetSize() - 1, array[1].GetArray()); - break; - case 3: - fH1 = new TH3F(histoName, histoTitle, array[0].GetSize() - 1, array[0].GetArray(), array[1].GetSize() - 1, array[1].GetArray(), array[2].GetSize() - 1, array[2].GetArray()); - break; - } - fH1->Sumw2(); - - return fH1; + fSize = fAxisList.GetEntries(); + if (!fSize) { + AliError("No axes defined"); + return 0x0; + } else if (fSize > 3) { + AliError("Too many axes defined for a TH1 object"); + return 0x0; + } + + // retrieve binnings for main and secondary axes + AliRsnValue *fcnAxis; + TArrayD array[3]; + for (Int_t i = 0; i < fSize; i++) { + fcnAxis = (AliRsnValue*)fAxisList.At(i); + if (!fcnAxis) { + AliError("Empty axis"); + array[i].Set(2); + array[i][0] = -1E5; + array[i][1] = -1E5; + continue; + } else { + array[i] = fcnAxis->GetArray(); + } + } + + // create histogram depending on the number of axes + switch (fSize) { + case 1: + fH1 = new TH1F(histoName, histoTitle, array[0].GetSize() - 1, array[0].GetArray()); + break; + case 2: + fH1 = new TH2F(histoName, histoTitle, array[0].GetSize() - 1, array[0].GetArray(), array[1].GetSize() - 1, array[1].GetArray()); + break; + case 3: + fH1 = new TH3F(histoName, histoTitle, array[0].GetSize() - 1, array[0].GetArray(), array[1].GetSize() - 1, array[1].GetArray(), array[2].GetSize() - 1, array[2].GetArray()); + break; + } + fH1->Sumw2(); + + return fH1; } //________________________________________________________________________________________ @@ -220,49 +209,45 @@ THnSparseF* AliRsnFunction::CreateHistogramSparse(const char *histoName, const c // This version produces a THnSparseF. // - fSize = fAxisList.GetEntries(); - if (!fSize) - { - AliError("No axes defined"); - return 0x0; - } - - // initialize the array of number of bins for each axis - // taking it from the stored values, while for the bins - // they are set as summied and defined later - Double_t dummyD; - Int_t *nbins = new Int_t[fSize]; - AliRsnValue *fcnAxis = 0; - for (Int_t i = 0; i < fSize; i++) - { - fcnAxis = (AliRsnValue*)fAxisList.At(i); - if (!fcnAxis) - { - nbins[i] = 1; - AliError("Empty axis"); - continue; - } - nbins[i] = fcnAxis->GetArray().GetSize() - 1; - } - - // create histogram - fHSparse = new THnSparseF(histoName, histoTitle, fSize, nbins, &dummyD, &dummyD); - fHSparse->Sumw2(); - - // update the various axes using the definitions given in the array of axes here - for (Int_t i = 0; i < fSize; i++) - { - fcnAxis = (AliRsnValue*)fAxisList.At(i); - if (!fcnAxis) { - AliError("Empty axis: doing unique bin betweeen -100000 and 100000"); - continue; - } - fHSparse->SetBinEdges(i, fcnAxis->GetArray().GetArray()); - } - - delete [] nbins; - - return fHSparse; + fSize = fAxisList.GetEntries(); + if (!fSize) { + AliError("No axes defined"); + return 0x0; + } + + // initialize the array of number of bins for each axis + // taking it from the stored values, while for the bins + // they are set as summied and defined later + Double_t dummyD; + Int_t *nbins = new Int_t[fSize]; + AliRsnValue *fcnAxis = 0; + for (Int_t i = 0; i < fSize; i++) { + fcnAxis = (AliRsnValue*)fAxisList.At(i); + if (!fcnAxis) { + nbins[i] = 1; + AliError("Empty axis"); + continue; + } + nbins[i] = fcnAxis->GetArray().GetSize() - 1; + } + + // create histogram + fHSparse = new THnSparseF(histoName, histoTitle, fSize, nbins, &dummyD, &dummyD); + fHSparse->Sumw2(); + + // update the various axes using the definitions given in the array of axes here + for (Int_t i = 0; i < fSize; i++) { + fcnAxis = (AliRsnValue*)fAxisList.At(i); + if (!fcnAxis) { + AliError("Empty axis: doing unique bin betweeen -100000 and 100000"); + continue; + } + fHSparse->SetBinEdges(i, fcnAxis->GetArray().GetArray()); + } + + delete [] nbins; + + return fHSparse; } @@ -273,87 +258,76 @@ Bool_t AliRsnFunction::Fill() // Fill function histogram with values computed from given input object. // - AliDebug(AliLog::kDebug +2,"->"); - - Int_t i; - Double_t *values = new Double_t[fSize]; - Bool_t computeOK = kFALSE; - - AliRsnValue *fcnAxis = 0; - for (i = 0; i < fSize; i++) - { - values[i] = 0.0; - fcnAxis = (AliRsnValue*)fAxisList.At(i); - if (!fcnAxis) continue; - switch (fcnAxis->GetTargetType()) - { - case AliRsnTarget::kMother: - fcnAxis->SetSupportObject(fPairDef); - computeOK = fcnAxis->Eval(fPair); - break; - case AliRsnTarget::kEvent: - computeOK = fcnAxis->Eval(fEvent); - break; - default: - AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName())); - computeOK = kFALSE; - } - if (computeOK) values[i] = ((Float_t)fcnAxis->GetComputedValue()); - } - - // fill histogram - if (fUseTH1) - { - // check presence of output histogram - if (!fH1) - { - AliError("Required a TH1 which is not initialized"); - delete [] values; - return kFALSE; - } - - // fill according to dimensions - switch (fSize) - { - case 1: - { - TH1F *h1 = (TH1F*)fH1; - h1->Fill(values[0]); - } - break; - case 2: - { - TH2F *h2 = (TH2F*)fH1; - h2->Fill(values[0], values[1]); - } - break; - case 3: - { - TH3F *h3 = (TH3F*)fH1; - h3->Fill(values[0], values[1], values[2]); - } - break; - default: - AliError(Form("Wrong size : %d", fSize)); - delete [] values; - return kFALSE; - } - } - else - { - // check presence of output histogram - if (!fHSparse) - { - AliError("Required a THnSparseF which is not initialized"); - delete [] values; - return kFALSE; - } - - fHSparse->Fill(values); - } - - delete [] values; - - AliDebug(AliLog::kDebug +2,"->"); - return kTRUE; + AliDebug(AliLog::kDebug + 2, "->"); + + Int_t i; + Double_t *values = new Double_t[fSize]; + Bool_t computeOK = kFALSE; + + AliRsnValue *fcnAxis = 0; + for (i = 0; i < fSize; i++) { + values[i] = 0.0; + fcnAxis = (AliRsnValue*)fAxisList.At(i); + if (!fcnAxis) continue; + switch (fcnAxis->GetTargetType()) { + case AliRsnTarget::kMother: + fcnAxis->SetSupportObject(fPairDef); + computeOK = fcnAxis->Eval(fPair); + break; + case AliRsnTarget::kEvent: + computeOK = fcnAxis->Eval(fEvent); + break; + default: + AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName())); + computeOK = kFALSE; + } + if (computeOK) values[i] = ((Float_t)fcnAxis->GetComputedValue()); + } + + // fill histogram + if (fUseTH1) { + // check presence of output histogram + if (!fH1) { + AliError("Required a TH1 which is not initialized"); + delete [] values; + return kFALSE; + } + + // fill according to dimensions + switch (fSize) { + case 1: { + TH1F *h1 = (TH1F*)fH1; + h1->Fill(values[0]); + } + break; + case 2: { + TH2F *h2 = (TH2F*)fH1; + h2->Fill(values[0], values[1]); + } + break; + case 3: { + TH3F *h3 = (TH3F*)fH1; + h3->Fill(values[0], values[1], values[2]); + } + break; + default: + AliError(Form("Wrong size : %d", fSize)); + delete [] values; + return kFALSE; + } + } else { + // check presence of output histogram + if (!fHSparse) { + AliError("Required a THnSparseF which is not initialized"); + delete [] values; + return kFALSE; + } + + fHSparse->Fill(values); + } + + delete [] values; + + AliDebug(AliLog::kDebug + 2, "->"); + return kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnFunction.h b/PWG2/RESONANCES/AliRsnFunction.h index f59a35e1ba1..5521d34aa88 100644 --- a/PWG2/RESONANCES/AliRsnFunction.h +++ b/PWG2/RESONANCES/AliRsnFunction.h @@ -35,49 +35,48 @@ class AliRsnValue; class AliRsnMother; class AliRsnPairDef; -class AliRsnFunction : public TObject -{ +class AliRsnFunction : public TObject { - public: +public: - AliRsnFunction(Bool_t useTH1 = kTRUE); - AliRsnFunction(const AliRsnFunction ©); - virtual ~AliRsnFunction() { delete fH1; delete fHSparse; } - const AliRsnFunction& operator=(const AliRsnFunction ©); + AliRsnFunction(Bool_t useTH1 = kTRUE); + AliRsnFunction(const AliRsnFunction ©); + virtual ~AliRsnFunction() { delete fH1; delete fHSparse; } + const AliRsnFunction& operator=(const AliRsnFunction ©); - void SetPairDef(AliRsnPairDef * const def) {fPairDef = def;} - void SetPair(AliRsnMother * const pair) {fPair = pair;} + void SetPairDef(AliRsnPairDef * const def) {fPairDef = def;} + void SetPair(AliRsnMother * const pair) {fPair = pair;} - AliRsnPairDef* GetPairDef() const {return fPairDef;} - AliRsnMother* GetPair() const {return fPair;} - AliRsnEvent* GetEvent() const {return fEvent;} - virtual const char* GetName() const; + AliRsnPairDef* GetPairDef() const {return fPairDef;} + AliRsnMother* GetPair() const {return fPair;} + AliRsnEvent* GetEvent() const {return fEvent;} + virtual const char* GetName() const; - Bool_t IsUsingTH1() {return fUseTH1;} - void UseTH1() {fUseTH1 = kTRUE;} - void UseSparse() {fUseTH1 = kFALSE;} - Bool_t AddAxis(AliRsnValue* const axis); - Int_t GetNumberOfAxes() {return fAxisList.GetEntries();} - TH1* CreateHistogram(const char *histoName, const char *histoTitle); - THnSparseF* CreateHistogramSparse(const char *histoName, const char *histoTitle); + Bool_t IsUsingTH1() {return fUseTH1;} + void UseTH1() {fUseTH1 = kTRUE;} + void UseSparse() {fUseTH1 = kFALSE;} + Bool_t AddAxis(AliRsnValue* const axis); + Int_t GetNumberOfAxes() {return fAxisList.GetEntries();} + TH1* CreateHistogram(const char *histoName, const char *histoTitle); + THnSparseF* CreateHistogramSparse(const char *histoName, const char *histoTitle); - Bool_t Fill(); + Bool_t Fill(); - protected: +protected: - AliRsnPairDef *fPairDef; // reference to used pair definition - TClonesArray fAxisList; // list of axis + AliRsnPairDef *fPairDef; // reference to used pair definition + TClonesArray fAxisList; // list of axis - AliRsnMother *fPair; // processed pair - AliRsnEvent *fEvent; // processed event + AliRsnMother *fPair; // processed pair + AliRsnEvent *fEvent; // processed event - Bool_t fUseTH1; // use TH1 or not? - Int_t fSize; // number of dim of output histogram - TH1 *fH1; // output histogram (standard type) - THnSparseF *fHSparse; // output histogram (sparse type) + Bool_t fUseTH1; // use TH1 or not? + Int_t fSize; // number of dim of output histogram + TH1 *fH1; // output histogram (standard type) + THnSparseF *fHSparse; // output histogram (sparse type) - // ROOT dictionary - ClassDef(AliRsnFunction, 3) + // ROOT dictionary + ClassDef(AliRsnFunction, 3) }; #endif diff --git a/PWG2/RESONANCES/AliRsnMonitorTrack.cxx b/PWG2/RESONANCES/AliRsnMonitorTrack.cxx index 9385e45e5fb..339141a13ca 100644 --- a/PWG2/RESONANCES/AliRsnMonitorTrack.cxx +++ b/PWG2/RESONANCES/AliRsnMonitorTrack.cxx @@ -10,22 +10,22 @@ ClassImp(AliRsnMonitorTrack) AliRsnMonitorTrack::AliRsnMonitorTrack() : - fCutsPassed(kFALSE), - fPrim(kFALSE), - fPDG(0), - fPDGM(0), - fMother(-1), - fStatus(0), - fLength(0.0), - fCharge(0), - fITSsa(kFALSE), - fTOFok(kFALSE), - fITSchi2(1E10), - fITSsignal(0.0), - fTPCcount(0), - fTPCchi2(1E10), - fTPCsignal(1E10), - fTOFsignal(0.0) + fCutsPassed(kFALSE), + fPrim(kFALSE), + fPDG(0), + fPDGM(0), + fMother(-1), + fStatus(0), + fLength(0.0), + fCharge(0), + fITSsa(kFALSE), + fTOFok(kFALSE), + fITSchi2(1E10), + fITSsignal(0.0), + fTPCcount(0), + fTPCchi2(1E10), + fTPCsignal(1E10), + fTOFsignal(0.0) { // // Unique constructor @@ -33,45 +33,43 @@ AliRsnMonitorTrack::AliRsnMonitorTrack() : } AliRsnMonitorTrack::AliRsnMonitorTrack(const AliRsnMonitorTrack& copy) : - TObject(copy), - fCutsPassed(copy.fCutsPassed), - fPrim(copy.fPrim), - fPDG(copy.fPDG), - fPDGM(copy.fPDGM), - fMother(copy.fMother), - fStatus(copy.fStatus), - fLength(copy.fLength), - fCharge(copy.fCharge), - fITSsa(copy.fITSsa), - fTOFok(copy.fTOFok), - fITSchi2(copy.fITSchi2), - fITSsignal(copy.fITSsignal), - fTPCcount(copy.fTPCcount), - fTPCchi2(copy.fTPCchi2), - fTPCsignal(copy.fTPCsignal), - fTOFsignal(copy.fTOFsignal) + TObject(copy), + fCutsPassed(copy.fCutsPassed), + fPrim(copy.fPrim), + fPDG(copy.fPDG), + fPDGM(copy.fPDGM), + fMother(copy.fMother), + fStatus(copy.fStatus), + fLength(copy.fLength), + fCharge(copy.fCharge), + fITSsa(copy.fITSsa), + fTOFok(copy.fTOFok), + fITSchi2(copy.fITSchi2), + fITSsignal(copy.fITSsignal), + fTPCcount(copy.fTPCcount), + fTPCchi2(copy.fTPCchi2), + fTPCsignal(copy.fTPCsignal), + fTOFsignal(copy.fTOFsignal) { // // Copy constructor // - Int_t k; - - for (k = 0; k < 2; k++) fDCA[k] = copy.fDCA[k]; - for (k = 0; k < 6; k++) fITSmap[k] = copy.fITSmap[k]; - for (k = 0; k < AliPID::kSPECIES; k++) - { - fITSnsigma[k] = copy.fITSnsigma[k]; - fTPCnsigma[k] = copy.fTPCnsigma[k]; - fTOFref [k] = copy.fTOFref [k]; - fTOFsigma [k] = copy.fTOFsigma [k]; - } - for (k = 0; k < 3; k++) - { - fPsim[k] = copy.fPsim[k]; - fPrec[k] = copy.fPrec[k]; - fPtpc[k] = copy.fPtpc[k]; - } + Int_t k; + + for (k = 0; k < 2; k++) fDCA[k] = copy.fDCA[k]; + for (k = 0; k < 6; k++) fITSmap[k] = copy.fITSmap[k]; + for (k = 0; k < AliPID::kSPECIES; k++) { + fITSnsigma[k] = copy.fITSnsigma[k]; + fTPCnsigma[k] = copy.fTPCnsigma[k]; + fTOFref [k] = copy.fTOFref [k]; + fTOFsigma [k] = copy.fTOFsigma [k]; + } + for (k = 0; k < 3; k++) { + fPsim[k] = copy.fPsim[k]; + fPrec[k] = copy.fPrec[k]; + fPtpc[k] = copy.fPtpc[k]; + } } //_____________________________________________________________________________________________ @@ -80,41 +78,40 @@ void AliRsnMonitorTrack::Reset() // // Generic reset method, to set all fields to meaningless values // - - Int_t k; - - fCutsPassed = kFALSE; - fITSsa = kFALSE; - fTOFok = kFALSE; - fPrim = kFALSE; - fPDG = 0; - fMother = -1; - fPDGM = 0; - fStatus = 0; - fLength = 0.0; - fCharge = 0; - - for (k = 0; k < 2; k++) fDCA[k] = 1E10; - - for (k = 0; k < 6; k++) fITSmap[k] = kFALSE; - fITSchi2 = 1E10; - fITSsignal = 0.0; - - fTPCchi2 = 1E10; - fTPCsignal = 1E10; - fTPCcount = 0; - - fTOFsignal = 1E10; - - for (k = 0; k < AliPID::kSPECIES; k++) - { - fITSnsigma[k] = 1E10; - fTPCnsigma[k] = 1E10; - fTOFref [k] = 1E10; - fTOFsigma [k] = 1E10; - } - - for (k = 0; k < 3; k++) fPsim[k] = fPrec[k] = fPtpc[k] = 0.0; + + Int_t k; + + fCutsPassed = kFALSE; + fITSsa = kFALSE; + fTOFok = kFALSE; + fPrim = kFALSE; + fPDG = 0; + fMother = -1; + fPDGM = 0; + fStatus = 0; + fLength = 0.0; + fCharge = 0; + + for (k = 0; k < 2; k++) fDCA[k] = 1E10; + + for (k = 0; k < 6; k++) fITSmap[k] = kFALSE; + fITSchi2 = 1E10; + fITSsignal = 0.0; + + fTPCchi2 = 1E10; + fTPCsignal = 1E10; + fTPCcount = 0; + + fTOFsignal = 1E10; + + for (k = 0; k < AliPID::kSPECIES; k++) { + fITSnsigma[k] = 1E10; + fTPCnsigma[k] = 1E10; + fTOFref [k] = 1E10; + fTOFsigma [k] = 1E10; + } + + for (k = 0; k < 3; k++) fPsim[k] = fPrec[k] = fPtpc[k] = 0.0; } //__________________________________________________________________________________________________ @@ -124,33 +121,31 @@ Bool_t AliRsnMonitorTrack::AdoptMC(Int_t label, AliStack *stack) // Get info from MC for a given track in the stack // - if (!stack) return kFALSE; - - Int_t nPart = stack->GetNtrack(); - if (label < 0 || label > nPart) - { - AliError(Form("Label = %d -- MAX = %d", label, nPart)); - return kFALSE; - } - - TParticle *mc = stack->Particle(label); - if (!mc) return kFALSE; - - // 'direct' data - fPDG = (Int_t)mc->GetPdgCode(); - fMother = (Int_t)mc->GetFirstMother(); - fPrim = (Bool_t)stack->IsPhysicalPrimary(label); - fPDGM = 0; - fPsim[0] = mc->Px(); - fPsim[1] = mc->Py(); - fPsim[2] = mc->Pz(); - - // assign mother (if any) - if (fMother >= 0 && fMother < nPart) - { - TParticle *m = stack->Particle(fMother); - if (m) fPDGM = (Int_t)TMath::Abs(m->GetPdgCode()); - } - - return kTRUE; + if (!stack) return kFALSE; + + Int_t nPart = stack->GetNtrack(); + if (label < 0 || label > nPart) { + AliError(Form("Label = %d -- MAX = %d", label, nPart)); + return kFALSE; + } + + TParticle *mc = stack->Particle(label); + if (!mc) return kFALSE; + + // 'direct' data + fPDG = (Int_t)mc->GetPdgCode(); + fMother = (Int_t)mc->GetFirstMother(); + fPrim = (Bool_t)stack->IsPhysicalPrimary(label); + fPDGM = 0; + fPsim[0] = mc->Px(); + fPsim[1] = mc->Py(); + fPsim[2] = mc->Pz(); + + // assign mother (if any) + if (fMother >= 0 && fMother < nPart) { + TParticle *m = stack->Particle(fMother); + if (m) fPDGM = (Int_t)TMath::Abs(m->GetPdgCode()); + } + + return kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnMonitorTrack.h b/PWG2/RESONANCES/AliRsnMonitorTrack.h index 02304973daf..9d4c62a140d 100644 --- a/PWG2/RESONANCES/AliRsnMonitorTrack.h +++ b/PWG2/RESONANCES/AliRsnMonitorTrack.h @@ -1,4 +1,4 @@ -// +// // Class AliRsnMonitorTrack // // Monitor object used @@ -17,110 +17,109 @@ class AliESDtrack; class AliTOFT0maker; class AliStack; -class AliRsnMonitorTrack : public TObject -{ - public: - - AliRsnMonitorTrack(); - AliRsnMonitorTrack(const AliRsnMonitorTrack& copy); - //AliRsnMonitorTrack& operator=(const AliRsnMonitorTrack& copy) {MakeCopy(copy); return (*this);} - virtual ~AliRsnMonitorTrack() { /*nothing*/ } - - void Reset(); - Bool_t AdoptMC(Int_t label, AliStack *stack); - - Bool_t& CutsPassed() {return fCutsPassed;} - - Double_t& PsimX() {return fPsim[0];} - Double_t& PrecX() {return fPrec[0];} - Double_t& PtpcX() {return fPtpc[0];} - - Double_t& PsimY() {return fPsim[1];} - Double_t& PrecY() {return fPrec[1];} - Double_t& PtpcY() {return fPtpc[1];} - - Double_t& PsimZ() {return fPsim[2];} - Double_t& PrecZ() {return fPrec[2];} - Double_t& PtpcZ() {return fPtpc[2];} - - Double_t PsimT() {return TMath::Sqrt(fPsim[0]*fPsim[0] + fPsim[1]*fPsim[1]);} - Double_t PrecT() {return TMath::Sqrt(fPrec[0]*fPrec[0] + fPrec[1]*fPrec[1]);} - Double_t PtpcT() {return TMath::Sqrt(fPtpc[0]*fPtpc[0] + fPtpc[1]*fPtpc[1]);} - - Double_t Psim() {return TMath::Sqrt(PsimT()*PsimT() + fPsim[2]*fPsim[2]);} - Double_t Prec() {return TMath::Sqrt(PrecT()*PrecT() + fPrec[2]*fPrec[2]);} - Double_t Ptpc() {return TMath::Sqrt(PtpcT()*PtpcT() + fPtpc[2]*fPtpc[2]);} - - Bool_t& Prim() {return fPrim;} - Int_t& PDG() {return fPDG;} - Int_t& PDGM() {return fPDGM;} - Int_t& Mother() {return fMother;} - - Bool_t OkFlag(UInt_t f) {return ((fStatus & f) != 0);} - UInt_t& Status() {return fStatus;} - Double_t& Length() {return fLength;} - Int_t& Charge() {return fCharge;} - Double_t& DCAr() {return fDCA[0];} - Double_t& DCAz() {return fDCA[1];} - - Bool_t& ITSsa() {return fITSsa;} - Bool_t& TOFok() {return fTOFok;} - - Bool_t& ITSmap(Int_t i) {if (i>=0 && i<6) return fITSmap[i]; else return fITSmap[0];} - Int_t ITScount() {return (SPDcount() + SDDcount() + SSDcount());} - Int_t SPDcount() {Int_t count=0; if (fITSmap[0]) count++; if (fITSmap[1]) count++; return count;} - Int_t SDDcount() {Int_t count=0; if (fITSmap[2]) count++; if (fITSmap[3]) count++; return count;} - Int_t SSDcount() {Int_t count=0; if (fITSmap[4]) count++; if (fITSmap[5]) count++; return count;} - Double_t& ITSchi2() {return fITSchi2;} - Double_t& ITSsignal() {return fITSsignal;} - Double_t& ITSnsigma(Int_t i) {if (i>=0 && i=0 && i=0 && i=0 && i=0 && i= 0 && i < 6) return fITSmap[i]; else return fITSmap[0];} + Int_t ITScount() {return (SPDcount() + SDDcount() + SSDcount());} + Int_t SPDcount() {Int_t count = 0; if (fITSmap[0]) count++; if (fITSmap[1]) count++; return count;} + Int_t SDDcount() {Int_t count = 0; if (fITSmap[2]) count++; if (fITSmap[3]) count++; return count;} + Int_t SSDcount() {Int_t count = 0; if (fITSmap[4]) count++; if (fITSmap[5]) count++; return count;} + Double_t& ITSchi2() {return fITSchi2;} + Double_t& ITSsignal() {return fITSsignal;} + Double_t& ITSnsigma(Int_t i) {if (i >= 0 && i < AliPID::kSPECIES) return fITSnsigma[i]; else return fITSnsigma[0];} + + Int_t& TPCcount() {return fTPCcount;} + Double_t& TPCchi2() {return fTPCchi2;} + Double_t& TPCsignal() {return fTPCsignal;} + Double_t& TPCnsigma(Int_t i) {if (i >= 0 && i < AliPID::kSPECIES) return fTPCnsigma[i]; else return fTPCnsigma[0];} + + Double_t& TOFsignal() {return fTOFsignal;} + Double_t& TOFsigma(Int_t i) {if (i >= 0 && i < AliPID::kSPECIES) return fTOFsigma[i]; else return fTOFsigma[0];} + Double_t& TOFref(Int_t i) {if (i >= 0 && i < AliPID::kSPECIES) return fTOFref[i]; else return fTOFref[0];} + Double_t TOFnsigma(Int_t i) {if (i >= 0 && i < AliPID::kSPECIES) return ((fTOFsignal - fTOFref[i]) / fTOFsigma[i]); return 1E6;} + +private: + + Bool_t fCutsPassed; // did it pass all defined cuts? + + Bool_t fPrim; // is physical primary? + Int_t fPDG; // true PDG code + Int_t fPDGM; // PDG code of mother (if any) + Int_t fMother; // label of mother (if any) + + UInt_t fStatus; // 'status' flag of track in ESD (0 = none) + Double_t fLength; // integrated length + Int_t fCharge; // track charge + Double_t fDCA[2]; // DCA ([0] = xy, [1] = z) + + Bool_t fITSsa; // to know if its is ITS standalone (otherwise it is TPC) + Bool_t fTOFok; // to know if track has a TOF match + + Bool_t fITSmap[6]; // ITS cluster map + Double_t fITSchi2; // chi2 in ITS + Double_t fITSsignal; // ITS signal used for PID + Double_t fITSnsigma[AliPID::kSPECIES]; // number of sigmas ITS + + Int_t fTPCcount; // # TPC clusters + Double_t fTPCchi2; // TPC chi 2 + Double_t fTPCsignal; // TPC dEdx signal + Double_t fTPCnsigma[AliPID::kSPECIES]; // number of sigmas TPC for: e, mu, pi, K, p + + Double_t fTOFsignal; // TOF signal + Double_t fTOFsigma[AliPID::kSPECIES]; // TOF sigma for: e, mu, pi, K, p + Double_t fTOFref[AliPID::kSPECIES]; // expected times for: e, mu, pi, K, p + + Double_t fPsim[3]; // simulated momentum + Double_t fPrec[3]; // reconstructed momentum + Double_t fPtpc[3]; // reconstructed momentum at the TPC inner wall + + ClassDef(AliRsnMonitorTrack, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnMother.cxx b/PWG2/RESONANCES/AliRsnMother.cxx index be1fc657ee2..3214f5af262 100644 --- a/PWG2/RESONANCES/AliRsnMother.cxx +++ b/PWG2/RESONANCES/AliRsnMother.cxx @@ -20,26 +20,26 @@ ClassImp(AliRsnMother) //_____________________________________________________________________________ -AliRsnMother::AliRsnMother() : - fUseMC(kFALSE), - fSum(), - fSumMC() +AliRsnMother::AliRsnMother() : + fUseMC(kFALSE), + fSum(), + fSumMC() { // // Constructor. // Initializes all variables to meaningless values. // - Int_t i; - for (i = 0; i < 2; i++) fDaughter[i] = 0x0; + Int_t i; + for (i = 0; i < 2; i++) fDaughter[i] = 0x0; } //_____________________________________________________________________________ -AliRsnMother::AliRsnMother(const AliRsnMother &obj) : - TObject(obj), - fUseMC(obj.fUseMC), - fSum(obj.fSum), - fSumMC(obj.fSumMC) +AliRsnMother::AliRsnMother(const AliRsnMother &obj) : + TObject(obj), + fUseMC(obj.fUseMC), + fSum(obj.fSum), + fSumMC(obj.fSumMC) { // // Copy constructor. @@ -47,8 +47,8 @@ AliRsnMother::AliRsnMother(const AliRsnMother &obj) : // Does not duplicate pointers. // - Int_t i; - for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i]; + Int_t i; + for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i]; } //_____________________________________________________________________________ @@ -60,14 +60,14 @@ AliRsnMother& AliRsnMother::operator=(const AliRsnMother &obj) // Does not duplicate pointers. // - Int_t i; - - fSum = obj.fSum; - fSumMC = obj.fSumMC; - - for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i]; + Int_t i; - return (*this); + fSum = obj.fSum; + fSumMC = obj.fSumMC; + + for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i]; + + return (*this); } //_____________________________________________________________________________ @@ -90,37 +90,32 @@ Int_t AliRsnMother::CommonMother(Int_t &m0, Int_t &m1) const // In the two arguments passed by reference, the mothers of the two daghters are stored // - // if MC info is not available, the pairs is not true by default - if (!fDaughter[0]->GetRefMC() || !fDaughter[1]->GetRefMC()) - { - AliInfo("Cannot know if the pairs is true or not because MC Info is not present"); - return 0; - } - - // check that labels are the same - m0 = -1; - m1 = -2; - if (fDaughter[0]->IsESD() && fDaughter[1]->IsESD() ) - { - if (fDaughter[0]->GetRefMCESD() && fDaughter[1]->GetRefMCESD()) - { - m0 = fDaughter[0]->GetRefMCESD()->Particle()->GetFirstMother(); - m1 = fDaughter[1]->GetRefMCESD()->Particle()->GetFirstMother(); - } - } - if (fDaughter[0]->IsAOD() && fDaughter[1]->IsAOD()) - { - if (fDaughter[0]->GetRefMCAOD() && fDaughter[1]->GetRefMCAOD()) - { - m0 = fDaughter[0]->GetRefMCAOD()->GetMother(); - m1 = fDaughter[1]->GetRefMCAOD()->GetMother(); - } - } - if (m0 != m1) return 0; - - // if we reach this point, the two tracks have the same mother - // let's check now the PDG code of this common mother - return TMath::Abs(fDaughter[0]->GetMotherPDG()); + // if MC info is not available, the pairs is not true by default + if (!fDaughter[0]->GetRefMC() || !fDaughter[1]->GetRefMC()) { + AliInfo("Cannot know if the pairs is true or not because MC Info is not present"); + return 0; + } + + // check that labels are the same + m0 = -1; + m1 = -2; + if (fDaughter[0]->IsESD() && fDaughter[1]->IsESD()) { + if (fDaughter[0]->GetRefMCESD() && fDaughter[1]->GetRefMCESD()) { + m0 = fDaughter[0]->GetRefMCESD()->Particle()->GetFirstMother(); + m1 = fDaughter[1]->GetRefMCESD()->Particle()->GetFirstMother(); + } + } + if (fDaughter[0]->IsAOD() && fDaughter[1]->IsAOD()) { + if (fDaughter[0]->GetRefMCAOD() && fDaughter[1]->GetRefMCAOD()) { + m0 = fDaughter[0]->GetRefMCAOD()->GetMother(); + m1 = fDaughter[1]->GetRefMCAOD()->GetMother(); + } + } + if (m0 != m1) return 0; + + // if we reach this point, the two tracks have the same mother + // let's check now the PDG code of this common mother + return TMath::Abs(fDaughter[0]->GetMotherPDG()); } //_____________________________________________________________________________ @@ -133,16 +128,16 @@ void AliRsnMother::SetDaughters // and sum them into the datamembers of this object. // - if (d0) fDaughter[0] = d0; - if (d1) fDaughter[1] = d1; - - if (!d0 || !d1) return; - - fDaughter[0]->SetMass(mass0); - fDaughter[1]->SetMass(mass1); - - fSum = fDaughter[0]->P(kFALSE) + fDaughter[1]->P(kFALSE); - fSumMC = fDaughter[0]->P(kTRUE) + fDaughter[1]->P(kTRUE); + if (d0) fDaughter[0] = d0; + if (d1) fDaughter[1] = d1; + + if (!d0 || !d1) return; + + fDaughter[0]->SetMass(mass0); + fDaughter[1]->SetMass(mass1); + + fSum = fDaughter[0]->P(kFALSE) + fDaughter[1]->P(kFALSE); + fSumMC = fDaughter[0]->P(kTRUE) + fDaughter[1]->P(kTRUE); } //_____________________________________________________________________________ @@ -152,45 +147,45 @@ void AliRsnMother::ResetPair() // Resets the mother, nullifying all data members // - Int_t i; - for (i = 0; i < 2; i++) fDaughter[i] = 0x0; - - fSum .SetXYZM(0.0, 0.0, 0.0, 0.0); - fSumMC.SetXYZM(0.0, 0.0, 0.0, 0.0); + Int_t i; + for (i = 0; i < 2; i++) fDaughter[i] = 0x0; + + fSum .SetXYZM(0.0, 0.0, 0.0, 0.0); + fSumMC.SetXYZM(0.0, 0.0, 0.0, 0.0); } //_____________________________________________________________________________ Double_t AliRsnMother::CosThetaStar(Bool_t first, Bool_t useMC) { - TLorentzVector mother = (useMC ? fSumMC : fSum); - TLorentzVector daughter0 = (first ? fDaughter[0]->P() : fDaughter[1]->P()); - TLorentzVector daughter1 = (first ? fDaughter[1]->P() : fDaughter[0]->P()); - TVector3 momentumM (mother.Vect()); - TVector3 normal (mother.Y()/momentumM.Mag(), -mother.X()/momentumM.Mag(), 0.0); - - // Computes first the invariant mass of the mother - Double_t mass0 = fDaughter[0]->P().M(); - Double_t mass1 = fDaughter[1]->P().M(); - Double_t p0 = daughter0.Vect().Mag(); - Double_t p1 = daughter1.Vect().Mag(); - Double_t E0 = TMath::Sqrt(mass0*mass0+p0*p0); - Double_t E1 = TMath::Sqrt(mass1*mass1+p1*p1); - Double_t MotherMass = TMath::Sqrt((E0+E1)*(E0+E1)-(p0*p0+2.0*daughter0.Vect().Dot(daughter1.Vect())+p1*p1)); - MotherMass = fSum.M(); - - // Computes components of beta - Double_t betaX = -mother.X()/mother.E(); - Double_t betaY = -mother.Y()/mother.E(); - Double_t betaZ = -mother.Z()/mother.E(); - - // Computes Lorentz transformation of the momentum of the first daughter - // into the rest frame of the mother and theta* - daughter0.Boost(betaX,betaY,betaZ); - TVector3 momentumD = daughter0.Vect(); - - Double_t cosThetaStar = normal.Dot(momentumD)/momentumD.Mag(); - - return cosThetaStar; + TLorentzVector mother = (useMC ? fSumMC : fSum); + TLorentzVector daughter0 = (first ? fDaughter[0]->P() : fDaughter[1]->P()); + TLorentzVector daughter1 = (first ? fDaughter[1]->P() : fDaughter[0]->P()); + TVector3 momentumM(mother.Vect()); + TVector3 normal(mother.Y() / momentumM.Mag(), -mother.X() / momentumM.Mag(), 0.0); + + // Computes first the invariant mass of the mother + Double_t mass0 = fDaughter[0]->P().M(); + Double_t mass1 = fDaughter[1]->P().M(); + Double_t p0 = daughter0.Vect().Mag(); + Double_t p1 = daughter1.Vect().Mag(); + Double_t E0 = TMath::Sqrt(mass0 * mass0 + p0 * p0); + Double_t E1 = TMath::Sqrt(mass1 * mass1 + p1 * p1); + Double_t MotherMass = TMath::Sqrt((E0 + E1) * (E0 + E1) - (p0 * p0 + 2.0 * daughter0.Vect().Dot(daughter1.Vect()) + p1 * p1)); + MotherMass = fSum.M(); + + // Computes components of beta + Double_t betaX = -mother.X() / mother.E(); + Double_t betaY = -mother.Y() / mother.E(); + Double_t betaZ = -mother.Z() / mother.E(); + + // Computes Lorentz transformation of the momentum of the first daughter + // into the rest frame of the mother and theta* + daughter0.Boost(betaX, betaY, betaZ); + TVector3 momentumD = daughter0.Vect(); + + Double_t cosThetaStar = normal.Dot(momentumD) / momentumD.Mag(); + + return cosThetaStar; } //_____________________________________________________________________________ @@ -201,12 +196,12 @@ void AliRsnMother::PrintInfo(const Option_t * /*option*/) const // The options are passed to the AliRsnDaughter::Print() method // - AliInfo("======== BEGIN PAIR INFO ==========="); - AliInfo("Track #1"); - fDaughter[0]->Print(); - AliInfo("Track #2"); - fDaughter[1]->Print(); - AliInfo("========= END PAIR INFO ==========="); + AliInfo("======== BEGIN PAIR INFO ==========="); + AliInfo("Track #1"); + fDaughter[0]->Print(); + AliInfo("Track #2"); + fDaughter[1]->Print(); + AliInfo("========= END PAIR INFO ==========="); } //_____________________________________________________________________________ @@ -218,22 +213,19 @@ Bool_t AliRsnMother::CheckPair() const // - if MC is required, both daughters have a MC reference // - if (!fDaughter[0] || !fDaughter[1]) - { - AliError("One of the two tracks is NULL in this pair!"); - return kFALSE; - } - - if (fUseMC) - { - if (fDaughter[0]->GetRefMC() == 0x0 || fDaughter[1]->GetRefMC() == 0x0) - { - AliError("Required MC info but not all MC refs are available"); + if (!fDaughter[0] || !fDaughter[1]) { + AliError("One of the two tracks is NULL in this pair!"); return kFALSE; - } - } - - return kTRUE; + } + + if (fUseMC) { + if (fDaughter[0]->GetRefMC() == 0x0 || fDaughter[1]->GetRefMC() == 0x0) { + AliError("Required MC info but not all MC refs are available"); + return kFALSE; + } + } + + return kTRUE; } //_____________________________________________________________________________ @@ -245,34 +237,32 @@ Bool_t AliRsnMother::MatchesDef(AliRsnPairDef *def) // or the 'realistic' one only. // - if (!def) return kFALSE; - if (!fDaughter[0]->GetRefMC()) return kFALSE; - if (!fDaughter[1]->GetRefMC()) return kFALSE; - - Bool_t decayMatch = kFALSE; - Int_t pdg[2], ref[2]; - pdg[0] = fDaughter[0]->GetPDG(); - pdg[1] = fDaughter[1]->GetPDG(); - ref[0] = TMath::Abs(AliPID::ParticleCode(def->GetPID(0))); - ref[1] = TMath::Abs(AliPID::ParticleCode(def->GetPID(1))); - - // check #1: - // if first member of pairDef has same sign as first member of this, - // daughter[0] perfect PID must match first member of pairDef - // daughter[1] perfect PID must march second member of pairDef - if (fDaughter[0]->IsSign(def->GetCharge(0)) && fDaughter[1]->IsSign(def->GetCharge(1))) - { - decayMatch = (pdg[0] == ref[0] && pdg[1] == ref[1]); - } - - // check #2: - // if first member of pairDef has same sign as second member of this, - // daughter[0] perfect PID must match second member of pairDef - // daughter[1] perfect PID must march first member of pairDef - if (fDaughter[1]->IsSign(def->GetCharge(0)) && fDaughter[0]->IsSign(def->GetCharge(1))) - { - decayMatch = (pdg[0] == ref[1] && pdg[1] == ref[0]); - } - - return (decayMatch && (CommonMother() == def->GetMotherPDG())); + if (!def) return kFALSE; + if (!fDaughter[0]->GetRefMC()) return kFALSE; + if (!fDaughter[1]->GetRefMC()) return kFALSE; + + Bool_t decayMatch = kFALSE; + Int_t pdg[2], ref[2]; + pdg[0] = fDaughter[0]->GetPDG(); + pdg[1] = fDaughter[1]->GetPDG(); + ref[0] = TMath::Abs(AliPID::ParticleCode(def->GetPID(0))); + ref[1] = TMath::Abs(AliPID::ParticleCode(def->GetPID(1))); + + // check #1: + // if first member of pairDef has same sign as first member of this, + // daughter[0] perfect PID must match first member of pairDef + // daughter[1] perfect PID must march second member of pairDef + if (fDaughter[0]->IsSign(def->GetCharge(0)) && fDaughter[1]->IsSign(def->GetCharge(1))) { + decayMatch = (pdg[0] == ref[0] && pdg[1] == ref[1]); + } + + // check #2: + // if first member of pairDef has same sign as second member of this, + // daughter[0] perfect PID must match second member of pairDef + // daughter[1] perfect PID must march first member of pairDef + if (fDaughter[1]->IsSign(def->GetCharge(0)) && fDaughter[0]->IsSign(def->GetCharge(1))) { + decayMatch = (pdg[0] == ref[1] && pdg[1] == ref[0]); + } + + return (decayMatch && (CommonMother() == def->GetMotherPDG())); } diff --git a/PWG2/RESONANCES/AliRsnMother.h b/PWG2/RESONANCES/AliRsnMother.h index cdfe3a46a9a..7d14b926dc7 100644 --- a/PWG2/RESONANCES/AliRsnMother.h +++ b/PWG2/RESONANCES/AliRsnMother.h @@ -20,42 +20,41 @@ class AliRsnPairDef; -class AliRsnMother : public TObject -{ - public: - - AliRsnMother(); - AliRsnMother(const AliRsnMother &obj); - AliRsnMother& operator=(const AliRsnMother &obj); - virtual ~AliRsnMother(); - - TLorentzVector& Sum() {return fSum;} - TLorentzVector& SumMC() {return fSumMC;} - Double_t AngleTo(AliRsnDaughter track, Bool_t mc = kFALSE) const {return fSum.Angle(track.P(mc).Vect());} - Double_t CosThetaStar(Bool_t first = kTRUE, Bool_t useMC = kFALSE); - - AliRsnDaughter* GetDaughter (const Int_t &index) const {if (index==0||index==1) return fDaughter[index]; return 0x0;} - AliRsnDaughter& GetDaughterRef(const Int_t &index) const {if (index==1) return (*fDaughter[1]); return (*fDaughter[0]);} - - Bool_t IsLabelEqual() const {return abs(fDaughter[0]->GetLabel()) == abs(fDaughter[1]->GetLabel());} - Bool_t IsIndexEqual() const {return (fDaughter[0]->GetID() == fDaughter[1]->GetID());} - Int_t CommonMother(Int_t &m0, Int_t &m1) const; - Int_t CommonMother() const {Int_t d0, d1; return CommonMother(d0,d1);} - - void SetDaughters(AliRsnDaughter * const daughter1, Double_t mass1, AliRsnDaughter * const daughter2, Double_t mass2); - void ResetPair(); - void PrintInfo(const Option_t *option = "ALL") const; - Bool_t CheckPair() const; - Bool_t MatchesDef(AliRsnPairDef *pairDef); - - private: - - Bool_t fUseMC; // choose if momenta are taken from ESD/AOD or MC - AliRsnDaughter *fDaughter[2]; // elements of the pair - TLorentzVector fSum; // sum computed from the two daughters - TLorentzVector fSumMC; // sum computed from the two daughters - - ClassDef(AliRsnMother,1) +class AliRsnMother : public TObject { +public: + + AliRsnMother(); + AliRsnMother(const AliRsnMother &obj); + AliRsnMother& operator=(const AliRsnMother &obj); + virtual ~AliRsnMother(); + + TLorentzVector& Sum() {return fSum;} + TLorentzVector& SumMC() {return fSumMC;} + Double_t AngleTo(AliRsnDaughter track, Bool_t mc = kFALSE) const {return fSum.Angle(track.P(mc).Vect());} + Double_t CosThetaStar(Bool_t first = kTRUE, Bool_t useMC = kFALSE); + + AliRsnDaughter* GetDaughter(const Int_t &index) const {if (index == 0 || index == 1) return fDaughter[index]; return 0x0;} + AliRsnDaughter& GetDaughterRef(const Int_t &index) const {if (index == 1) return (*fDaughter[1]); return (*fDaughter[0]);} + + Bool_t IsLabelEqual() const {return abs(fDaughter[0]->GetLabel()) == abs(fDaughter[1]->GetLabel());} + Bool_t IsIndexEqual() const {return (fDaughter[0]->GetID() == fDaughter[1]->GetID());} + Int_t CommonMother(Int_t &m0, Int_t &m1) const; + Int_t CommonMother() const {Int_t d0, d1; return CommonMother(d0, d1);} + + void SetDaughters(AliRsnDaughter * const daughter1, Double_t mass1, AliRsnDaughter * const daughter2, Double_t mass2); + void ResetPair(); + void PrintInfo(const Option_t *option = "ALL") const; + Bool_t CheckPair() const; + Bool_t MatchesDef(AliRsnPairDef *pairDef); + +private: + + Bool_t fUseMC; // choose if momenta are taken from ESD/AOD or MC + AliRsnDaughter *fDaughter[2]; // elements of the pair + TLorentzVector fSum; // sum computed from the two daughters + TLorentzVector fSumMC; // sum computed from the two daughters + + ClassDef(AliRsnMother, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnPair.cxx b/PWG2/RESONANCES/AliRsnPair.cxx index 8b551133c6e..d9f9a86688c 100644 --- a/PWG2/RESONANCES/AliRsnPair.cxx +++ b/PWG2/RESONANCES/AliRsnPair.cxx @@ -29,14 +29,14 @@ ClassImp(AliRsnPair) //_____________________________________________________________________________ AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) : - TNamed(name, ""), - fOnlyTrue(kFALSE), - fCheckDecay(kFALSE), - fIsMixed(kFALSE), - fCount(0), - fPairDef(def), - fCutManager(Form("cutMgr_%s", name)), - fMother() + TNamed(name, ""), + fOnlyTrue(kFALSE), + fCheckDecay(kFALSE), + fIsMixed(kFALSE), + fCount(0), + fPairDef(def), + fCutManager(Form("cutMgr_%s", name)), + fMother() { // // Default constructor @@ -45,14 +45,14 @@ AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) : //_____________________________________________________________________________ AliRsnPair::AliRsnPair(const AliRsnPair& copy) : - TNamed(copy), - fOnlyTrue(copy.fOnlyTrue), - fCheckDecay(copy.fCheckDecay), - fIsMixed(copy.fIsMixed), - fCount(copy.fCount), - fPairDef(copy.fPairDef), - fCutManager(copy.fCutManager), - fMother(copy.fMother) + TNamed(copy), + fOnlyTrue(copy.fOnlyTrue), + fCheckDecay(copy.fCheckDecay), + fIsMixed(copy.fIsMixed), + fCount(copy.fCount), + fPairDef(copy.fPairDef), + fCutManager(copy.fCutManager), + fMother(copy.fMother) { // // Default constructor @@ -62,15 +62,15 @@ AliRsnPair::AliRsnPair(const AliRsnPair& copy) : //_____________________________________________________________________________ AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy) { - fOnlyTrue = copy.fOnlyTrue; - fCheckDecay = copy.fCheckDecay; - fIsMixed = copy.fIsMixed; - fCount = copy.fCount; - fPairDef = copy.fPairDef; - fMother = copy.fMother; - fCutManager = copy.fCutManager; - - return (*this); + fOnlyTrue = copy.fOnlyTrue; + fCheckDecay = copy.fCheckDecay; + fIsMixed = copy.fIsMixed; + fCount = copy.fCount; + fPairDef = copy.fPairDef; + fMother = copy.fMother; + fCutManager = copy.fCutManager; + + return (*this); } //_____________________________________________________________________________ @@ -88,8 +88,8 @@ void AliRsnPair::Print(Option_t* /*option*/) const // Prints info about pair // - AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1)))); - AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1))); + AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1)))); + AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1))); } //_____________________________________________________________________________ @@ -106,106 +106,96 @@ Bool_t AliRsnPair::Fill // Finally, if a true pair is required, this is checked at the end. // - AliDebug(AliLog::kDebug+2,"<-"); - - // first of all, compute the 4-momenta of the daughters - // and that of the mother, according to current pair def - // this could be needed for some cuts - fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1)); - - // check for correct type-charge match for first element - if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE; - if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE; - - // check for correct type-charge match for second element - if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE; - if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE; - - // cuts on track #1 & common - AliRsnTarget::SwitchToFirst(); - if (!fCutManager.PassDaughter1Cuts(daughter0)) - { - AliDebug(AliLog::kDebug+2, "Specific cuts for track #1 not passed"); - return kFALSE; - } - if (!fCutManager.PassCommonDaughterCuts(daughter0)) - { - AliDebug(AliLog::kDebug+2, "Common cuts for track #1 not passed"); - return kFALSE; - } - - // cuts on track #2 & common - AliRsnTarget::SwitchToSecond(); - if (!fCutManager.PassDaughter2Cuts(daughter1)) - { - AliDebug(AliLog::kDebug+2, "Specific cuts for track #2 not passed"); - return kFALSE; - } - if (!fCutManager.PassCommonDaughterCuts(daughter1)) - { - AliDebug(AliLog::kDebug+2, "Common cuts for track #2 not passed"); - return kFALSE; - } - - // point again to first event as reference - // and for checking the pair cuts - AliRsnTarget::SwitchToFirst(); - if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE; - - // if required a true pair, check this here and eventually return a fail message - if (fOnlyTrue) - { - // are the daughters really secondaries (in MC)? - Int_t m0, m1; - if (!fMother.CommonMother(m0, m1)) return kFALSE; - if (m0 < 0 || m1 < 0) return kFALSE; - - AliDebug(AliLog::kDebug+2, "Checking a true pair..."); - - // if they do, is this mother the correct type? - Int_t mpdg0 = TMath::Abs(daughter0->GetMotherPDG()); - Int_t mpdg1 = TMath::Abs(daughter1->GetMotherPDG()); - Int_t mpdg = TMath::Abs(fPairDef->GetMotherPDG()); - if (mpdg0 != mpdg) - { - AliDebug(AliLog::kDebug+2, Form("Mother of d0 is %d instead of %d", mpdg0, mpdg)); + AliDebug(AliLog::kDebug + 2, "<-"); + + // first of all, compute the 4-momenta of the daughters + // and that of the mother, according to current pair def + // this could be needed for some cuts + fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1)); + + // check for correct type-charge match for first element + if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE; + if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE; + + // check for correct type-charge match for second element + if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE; + if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE; + + // cuts on track #1 & common + AliRsnTarget::SwitchToFirst(); + if (!fCutManager.PassDaughter1Cuts(daughter0)) { + AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed"); + return kFALSE; + } + if (!fCutManager.PassCommonDaughterCuts(daughter0)) { + AliDebug(AliLog::kDebug + 2, "Common cuts for track #1 not passed"); + return kFALSE; + } + + // cuts on track #2 & common + AliRsnTarget::SwitchToSecond(); + if (!fCutManager.PassDaughter2Cuts(daughter1)) { + AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed"); return kFALSE; - } - if (mpdg1 != mpdg) - { - AliDebug(AliLog::kDebug+2, Form("Mother of d1 is %d instead of %d", mpdg1, mpdg)); + } + if (!fCutManager.PassCommonDaughterCuts(daughter1)) { + AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed"); return kFALSE; - } - - // do they match the expected decay channel (that is, are they the expected types)? - if (fCheckDecay) - { - AliDebug(AliLog::kDebug, "Checking decay tree..."); - Int_t pdg0 = TMath::Abs(daughter0->GetPDG()); - Int_t pdg1 = TMath::Abs(daughter1->GetPDG()); - if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) - { - AliDebug(AliLog::kDebug+2, Form("PDG0 is %d instead of %d", pdg0, fPairDef->GetPID(0))); - return kFALSE; + } + + // point again to first event as reference + // and for checking the pair cuts + AliRsnTarget::SwitchToFirst(); + if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE; + + // if required a true pair, check this here and eventually return a fail message + if (fOnlyTrue) { + // are the daughters really secondaries (in MC)? + Int_t m0, m1; + if (!fMother.CommonMother(m0, m1)) return kFALSE; + if (m0 < 0 || m1 < 0) return kFALSE; + + AliDebug(AliLog::kDebug + 2, "Checking a true pair..."); + + // if they do, is this mother the correct type? + Int_t mpdg0 = TMath::Abs(daughter0->GetMotherPDG()); + Int_t mpdg1 = TMath::Abs(daughter1->GetMotherPDG()); + Int_t mpdg = TMath::Abs(fPairDef->GetMotherPDG()); + if (mpdg0 != mpdg) { + AliDebug(AliLog::kDebug + 2, Form("Mother of d0 is %d instead of %d", mpdg0, mpdg)); + return kFALSE; } - if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) - { - AliDebug(AliLog::kDebug+2, Form("PDG1 is %d instead of %d", pdg1, fPairDef->GetPID(1))); - return kFALSE; + if (mpdg1 != mpdg) { + AliDebug(AliLog::kDebug + 2, Form("Mother of d1 is %d instead of %d", mpdg1, mpdg)); + return kFALSE; } - AliDebug(AliLog::kDebug, "Decay tree accepted"); - } - - // ok... if we arrive here that must really be a true pair! :-) - AliDebug(AliLog::kDebug+2, "Pair accepted"); - } - - AliDebug(AliLog::kDebug+2,"->"); - - // if pair is accepted, increment counter - ++fCount; - - return kTRUE; + + // do they match the expected decay channel (that is, are they the expected types)? + if (fCheckDecay) { + AliDebug(AliLog::kDebug, "Checking decay tree..."); + Int_t pdg0 = TMath::Abs(daughter0->GetPDG()); + Int_t pdg1 = TMath::Abs(daughter1->GetPDG()); + if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) { + AliDebug(AliLog::kDebug + 2, Form("PDG0 is %d instead of %d", pdg0, fPairDef->GetPID(0))); + return kFALSE; + } + if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) { + AliDebug(AliLog::kDebug + 2, Form("PDG1 is %d instead of %d", pdg1, fPairDef->GetPID(1))); + return kFALSE; + } + AliDebug(AliLog::kDebug, "Decay tree accepted"); + } + + // ok... if we arrive here that must really be a true pair! :-) + AliDebug(AliLog::kDebug + 2, "Pair accepted"); + } + + AliDebug(AliLog::kDebug + 2, "->"); + + // if pair is accepted, increment counter + ++fCount; + + return kTRUE; } //_____________________________________________________________________________ @@ -215,7 +205,7 @@ void AliRsnPair::Compute() // Virtual method to compute pair quantities of interest // - AliWarning("Implement this method in derived classes"); + AliWarning("Implement this method in derived classes"); } //_____________________________________________________________________________ @@ -225,5 +215,5 @@ void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/) // Virtual method to compute pair quantities of interest // - AliWarning("Implement this method in derived classes"); + AliWarning("Implement this method in derived classes"); } diff --git a/PWG2/RESONANCES/AliRsnPair.h b/PWG2/RESONANCES/AliRsnPair.h index f95c99131f9..1915329bae2 100644 --- a/PWG2/RESONANCES/AliRsnPair.h +++ b/PWG2/RESONANCES/AliRsnPair.h @@ -28,46 +28,45 @@ class AliRsnCutSet; class AliRsnFunction; class AliRsnValue; -class AliRsnPair : public TNamed -{ - public: - - AliRsnPair(const char *name = "default", AliRsnPairDef *def = 0); - AliRsnPair(const AliRsnPair ©); - AliRsnPair& operator=(const AliRsnPair&); - ~AliRsnPair(); - - void SetOnlyTrue(Bool_t onlyTrue = kTRUE) {fOnlyTrue = onlyTrue;} - void SetCheckDecay(Bool_t check = kTRUE) {fCheckDecay = check;} - - void Print(Option_t *option = "") const; - void SetMixed(Bool_t doit = kTRUE) {fIsMixed = doit;} - Bool_t IsMixed() const {return fIsMixed;} - - AliRsnCutManager* GetCutManager() {return &fCutManager;} - AliRsnMother* GetMother() {return &fMother;} - AliRsnPairDef* GetPairDef() {return fPairDef;} - Bool_t Fill(AliRsnDaughter *d0, AliRsnDaughter *d1); - Int_t GetCount() const {return fCount;} - void ResetCount() {fCount = 0;} - - virtual void Compute(); - virtual void Init(const char *prefix, TList *list); - - protected: - - Bool_t fOnlyTrue; // select true pairs only? - Bool_t fCheckDecay; // is the decay channel correct in a true pair? - Bool_t fIsMixed; // is this an event-mixing? - Int_t fCount; // counter incremented for each added pair - - AliRsnPairDef *fPairDef; // pair definition (particles, charges) - AliRsnCutManager fCutManager; // collection of all cuts - AliRsnMother fMother; // mother candidate (to avoid creating it continuously) - - private: - - ClassDef(AliRsnPair, 2) +class AliRsnPair : public TNamed { +public: + + AliRsnPair(const char *name = "default", AliRsnPairDef *def = 0); + AliRsnPair(const AliRsnPair ©); + AliRsnPair& operator=(const AliRsnPair&); + ~AliRsnPair(); + + void SetOnlyTrue(Bool_t onlyTrue = kTRUE) {fOnlyTrue = onlyTrue;} + void SetCheckDecay(Bool_t check = kTRUE) {fCheckDecay = check;} + + void Print(Option_t *option = "") const; + void SetMixed(Bool_t doit = kTRUE) {fIsMixed = doit;} + Bool_t IsMixed() const {return fIsMixed;} + + AliRsnCutManager* GetCutManager() {return &fCutManager;} + AliRsnMother* GetMother() {return &fMother;} + AliRsnPairDef* GetPairDef() {return fPairDef;} + Bool_t Fill(AliRsnDaughter *d0, AliRsnDaughter *d1); + Int_t GetCount() const {return fCount;} + void ResetCount() {fCount = 0;} + + virtual void Compute(); + virtual void Init(const char *prefix, TList *list); + +protected: + + Bool_t fOnlyTrue; // select true pairs only? + Bool_t fCheckDecay; // is the decay channel correct in a true pair? + Bool_t fIsMixed; // is this an event-mixing? + Int_t fCount; // counter incremented for each added pair + + AliRsnPairDef *fPairDef; // pair definition (particles, charges) + AliRsnCutManager fCutManager; // collection of all cuts + AliRsnMother fMother; // mother candidate (to avoid creating it continuously) + +private: + + ClassDef(AliRsnPair, 2) }; #endif diff --git a/PWG2/RESONANCES/AliRsnPairDef.cxx b/PWG2/RESONANCES/AliRsnPairDef.cxx index 292a71f231d..9a71bd75125 100644 --- a/PWG2/RESONANCES/AliRsnPairDef.cxx +++ b/PWG2/RESONANCES/AliRsnPairDef.cxx @@ -27,41 +27,41 @@ AliRsnPairDef::AliRsnPairDef() : fMotherMass(0.0), fMotherPDG(0) // must be defined before starting event processing. // - Int_t i; - for (i = 0; i < 2; i++) { - fCharge[i] = '0'; - fMass[i] = 0.0; - fPID[i] = AliPID::kUnknown; - fDaughterType[i] = AliRsnDaughter::kTrack; - } + Int_t i; + for (i = 0; i < 2; i++) { + fCharge[i] = '0'; + fMass[i] = 0.0; + fPID[i] = AliPID::kUnknown; + fDaughterType[i] = AliRsnDaughter::kTrack; + } } //_____________________________________________________________________________ AliRsnPairDef::AliRsnPairDef (AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG, Double_t motherMass) : - fMotherMass(motherMass), - fMotherPDG(motherPDG) + fMotherMass(motherMass), + fMotherPDG(motherPDG) { // // Constructor with arguments. // This constructor allows to define all the working parameters. // - SetDaughters(type1, sign1, type2, sign2); + SetDaughters(type1, sign1, type2, sign2); } //_____________________________________________________________________________ AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) : - TObject(copy), - fMotherMass(copy.fMotherMass), - fMotherPDG(copy.fMotherPDG) + TObject(copy), + fMotherMass(copy.fMotherMass), + fMotherPDG(copy.fMotherPDG) { // // Copy constructor with standard behavior // - SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]); + SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]); } //_____________________________________________________________________________ @@ -71,11 +71,11 @@ const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©) // Assignment operator with standard behavior. // - fMotherMass = copy.fMotherMass; - fMotherPDG = copy.fMotherPDG; - SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]); + fMotherMass = copy.fMotherMass; + fMotherPDG = copy.fMotherPDG; + SetDaughters(copy.fPID[0], copy.fCharge[0], copy.fPID[1], copy.fCharge[1]); - return (*this); + return (*this); } //_____________________________________________________________________________ @@ -86,36 +86,31 @@ Bool_t AliRsnPairDef::SetDaughter(Int_t i, AliPID::EParticleType type, Char_t ch // and returns warnings if the type is not valid. // - AliPID pid; - - if (i < 0 || i > 1) - { - AliError("Index out of range"); - return kFALSE; - } - if (charge != '+' && charge != '-' && charge != '0') - { - AliError(Form("Character '%c' not recognized as charge sign", charge)); - return kFALSE; - } - if (type < 0 && type > (Int_t)AliPID::kSPECIESN) - { - AliError("Type index out of enumeration range"); - return kFALSE; - } - - fCharge[i] = charge; - fPID[i] = type; - fMass[i] = pid.ParticleMass(type); - if ((Int_t)type < AliPID::kSPECIES) fDaughterType[i] = AliRsnDaughter::kTrack; - else if (type == AliPID::kKaon0) - { - fDaughterType[i] = AliRsnDaughter::kV0; - fCharge[i] = '0'; - } - else return kFALSE; - - return kTRUE; + AliPID pid; + + if (i < 0 || i > 1) { + AliError("Index out of range"); + return kFALSE; + } + if (charge != '+' && charge != '-' && charge != '0') { + AliError(Form("Character '%c' not recognized as charge sign", charge)); + return kFALSE; + } + if (type < 0 && type > (Int_t)AliPID::kSPECIESN) { + AliError("Type index out of enumeration range"); + return kFALSE; + } + + fCharge[i] = charge; + fPID[i] = type; + fMass[i] = pid.ParticleMass(type); + if ((Int_t)type < AliPID::kSPECIES) fDaughterType[i] = AliRsnDaughter::kTrack; + else if (type == AliPID::kKaon0) { + fDaughterType[i] = AliRsnDaughter::kV0; + fCharge[i] = '0'; + } else return kFALSE; + + return kTRUE; } //_____________________________________________________________________________ @@ -126,10 +121,10 @@ Bool_t AliRsnPairDef::SetDaughters // Set both elements of the pair, // returning logical AND of check for each one. // - Bool_t part1 = SetDaughter(0, type1, charge1); - Bool_t part2 = SetDaughter(1, type2, charge2); + Bool_t part1 = SetDaughter(0, type1, charge1); + Bool_t part2 = SetDaughter(1, type2, charge2); - return (part1 && part2); + return (part1 && part2); } //_____________________________________________________________________________ @@ -140,5 +135,5 @@ const char* AliRsnPairDef::GetPairName() const // to be used for naming objects related to it. // - return Form("%s%c%s%c", AliPID::ParticleShortName(fPID[0]), fCharge[0], AliPID::ParticleShortName(fPID[1]), fCharge[1]); + return Form("%s%c%s%c", AliPID::ParticleShortName(fPID[0]), fCharge[0], AliPID::ParticleShortName(fPID[1]), fCharge[1]); } diff --git a/PWG2/RESONANCES/AliRsnPairDef.h b/PWG2/RESONANCES/AliRsnPairDef.h index 667fc753baa..9f2e1091796 100644 --- a/PWG2/RESONANCES/AliRsnPairDef.h +++ b/PWG2/RESONANCES/AliRsnPairDef.h @@ -17,49 +17,48 @@ class AliRsnDaughter; -class AliRsnPairDef : public TObject -{ - public: +class AliRsnPairDef : public TObject { +public: - AliRsnPairDef(); - AliRsnPairDef(AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG = 0, Double_t motherMass = 0.0); - AliRsnPairDef(const AliRsnPairDef ©); - const AliRsnPairDef& operator= (const AliRsnPairDef ©); - virtual ~AliRsnPairDef() { } + AliRsnPairDef(); + AliRsnPairDef(AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2, Int_t motherPDG = 0, Double_t motherMass = 0.0); + AliRsnPairDef(const AliRsnPairDef ©); + const AliRsnPairDef& operator= (const AliRsnPairDef ©); + virtual ~AliRsnPairDef() { } - // getters - Int_t GetMotherPDG() const {return fMotherPDG;} - Double_t GetMotherMass() const {return fMotherMass;} - Double_t GetMass(Int_t i) const {if (i>=0&&i<2) return fMass[i]; else return 0.0;} - Char_t GetCharge(Int_t i) const {if (i>=0&&i<2) return fCharge[i]; else return 0;} - Short_t GetChargeShort(Int_t i) const {if (GetCharge(i) == '+') return 1; else if (GetCharge(i) == '-') return -1; else return 0;} - AliPID::EParticleType GetPID(Int_t i) const {if (i>=0&&i<2) return fPID[i]; else return AliPID::kUnknown;} - AliRsnDaughter::ERefType GetDaughterType(Int_t i) {if (i>=0&&i<2) return fDaughterType[i]; else return AliRsnDaughter::kNoType;} - const char* GetPairName() const; + // getters + Int_t GetMotherPDG() const {return fMotherPDG;} + Double_t GetMotherMass() const {return fMotherMass;} + Double_t GetMass(Int_t i) const {if (i >= 0 && i < 2) return fMass[i]; else return 0.0;} + Char_t GetCharge(Int_t i) const {if (i >= 0 && i < 2) return fCharge[i]; else return 0;} + Short_t GetChargeShort(Int_t i) const {if (GetCharge(i) == '+') return 1; else if (GetCharge(i) == '-') return -1; else return 0;} + AliPID::EParticleType GetPID(Int_t i) const {if (i >= 0 && i < 2) return fPID[i]; else return AliPID::kUnknown;} + AliRsnDaughter::ERefType GetDaughterType(Int_t i) {if (i >= 0 && i < 2) return fDaughterType[i]; else return AliRsnDaughter::kNoType;} + const char* GetPairName() const; - // setters - void SetMotherPDG(Int_t pdg) {fMotherPDG = pdg;} - void SetMotherMass(Double_t mass) {fMotherMass = mass;} - Bool_t SetDaughter(Int_t i, AliPID::EParticleType pid, Char_t charge = 0); - Bool_t SetDaughters(AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2); + // setters + void SetMotherPDG(Int_t pdg) {fMotherPDG = pdg;} + void SetMotherMass(Double_t mass) {fMotherMass = mass;} + Bool_t SetDaughter(Int_t i, AliPID::EParticleType pid, Char_t charge = 0); + Bool_t SetDaughters(AliPID::EParticleType type1, Char_t sign1, AliPID::EParticleType type2, Char_t sign2); - // pair information methods - Bool_t IsLikeSign() const {return (fCharge[0] == fCharge[1]);} - Bool_t HasEqualPID() const {return (fPID[0] == fPID[1]);} + // pair information methods + Bool_t IsLikeSign() const {return (fCharge[0] == fCharge[1]);} + Bool_t HasEqualPID() const {return (fPID[0] == fPID[1]);} - private: +private: - // pair parameters - Double_t fMotherMass; // nominal mass of true mother - Int_t fMotherPDG; // PDG code of true mother (if known) - - Double_t fMass[2]; // mass of particles - Char_t fCharge[2]; // charge of particles - AliPID::EParticleType fPID[2]; // PID of particles - AliRsnDaughter::ERefType fDaughterType[2]; // object type (track/V0) + // pair parameters + Double_t fMotherMass; // nominal mass of true mother + Int_t fMotherPDG; // PDG code of true mother (if known) - // ROOT dictionary - ClassDef(AliRsnPairDef, 1) + Double_t fMass[2]; // mass of particles + Char_t fCharge[2]; // charge of particles + AliPID::EParticleType fPID[2]; // PID of particles + AliRsnDaughter::ERefType fDaughterType[2]; // object type (track/V0) + + // ROOT dictionary + ClassDef(AliRsnPairDef, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnPairFunctions.cxx b/PWG2/RESONANCES/AliRsnPairFunctions.cxx index 2e2710d4035..80351b68ffc 100644 --- a/PWG2/RESONANCES/AliRsnPairFunctions.cxx +++ b/PWG2/RESONANCES/AliRsnPairFunctions.cxx @@ -28,43 +28,42 @@ ClassImp(AliRsnPairFunctions) //_____________________________________________________________________________ AliRsnPairFunctions::AliRsnPairFunctions(const char *name, AliRsnPairDef *def) : - AliRsnPair(name, def), - fFunctions("AliRsnFunction", 0) + AliRsnPair(name, def), + fFunctions("AliRsnFunction", 0) { // // Default constructor // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ AliRsnPairFunctions::AliRsnPairFunctions(const AliRsnPairFunctions& copy) : - AliRsnPair(copy), - fFunctions(copy.fFunctions) + AliRsnPair(copy), + fFunctions(copy.fFunctions) { // // Default constructor // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ AliRsnPairFunctions& AliRsnPairFunctions::operator=(const AliRsnPairFunctions& copy) { - AliRsnPair::operator=(copy); + AliRsnPair::operator=(copy); - Int_t i, n = copy.fFunctions.GetEntries(); - for (i = 0; i < n; i++) - { - AliRsnFunction *fcn = (AliRsnFunction*)copy.fFunctions[i]; - if (fcn) AddFunction(fcn); - } + Int_t i, n = copy.fFunctions.GetEntries(); + for (i = 0; i < n; i++) { + AliRsnFunction *fcn = (AliRsnFunction*)copy.fFunctions[i]; + if (fcn) AddFunction(fcn); + } - return (*this); + return (*this); } //_____________________________________________________________________________ @@ -74,8 +73,8 @@ AliRsnPairFunctions::~AliRsnPairFunctions() // Destructor // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -86,20 +85,19 @@ void AliRsnPairFunctions::Compute() // Checks all cuts and then computes the corresponding pair object // and then fill the list of required values using it. // - - AliDebug(AliLog::kDebug+2,"<-"); - - TObjArrayIter nextFcn(&fFunctions); - AliRsnFunction *fcn = 0x0; - - while ((fcn = (AliRsnFunction*)nextFcn())) - { - fcn->SetPairDef(fPairDef); - fcn->SetPair(&fMother); - fcn->Fill(); - } - - AliDebug(AliLog::kDebug+2,"->"); + + AliDebug(AliLog::kDebug + 2, "<-"); + + TObjArrayIter nextFcn(&fFunctions); + AliRsnFunction *fcn = 0x0; + + while ((fcn = (AliRsnFunction*)nextFcn())) { + fcn->SetPairDef(fPairDef); + fcn->SetPair(&fMother); + fcn->Fill(); + } + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -113,24 +111,23 @@ void AliRsnPairFunctions::Init(const char *prefix, TList *list) // All generated histograms are stored into the output TList. // - AliDebug(AliLog::kDebug+2,"<-"); - - Int_t i; - TString hName(""); - AliRsnFunction *fcn = 0; - for (i = 0; i < fFunctions.GetEntries(); i++) - { - fcn = (AliRsnFunction*)fFunctions.At(i); - hName += prefix; - hName += '_'; - hName += GetName(); - hName += '_'; - hName += fcn->GetName(); - if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName.Data(), "")); - else list->Add(fcn->CreateHistogramSparse(hName.Data(), "")); - } - - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + + Int_t i; + TString hName(""); + AliRsnFunction *fcn = 0; + for (i = 0; i < fFunctions.GetEntries(); i++) { + fcn = (AliRsnFunction*)fFunctions.At(i); + hName += prefix; + hName += '_'; + hName += GetName(); + hName += '_'; + hName += fcn->GetName(); + if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName.Data(), "")); + else list->Add(fcn->CreateHistogramSparse(hName.Data(), "")); + } + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -140,11 +137,11 @@ void AliRsnPairFunctions::AddFunction(AliRsnFunction *const fcn) // Adds a new computing function // - AliDebug(AliLog::kDebug+2,"<-"); - - fFunctions.Print(); - Int_t size = fFunctions.GetEntries(); - new(fFunctions[size]) AliRsnFunction(*fcn); - - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + + fFunctions.Print(); + Int_t size = fFunctions.GetEntries(); + new(fFunctions[size]) AliRsnFunction(*fcn); + + AliDebug(AliLog::kDebug + 2, "->"); } diff --git a/PWG2/RESONANCES/AliRsnPairFunctions.h b/PWG2/RESONANCES/AliRsnPairFunctions.h index 732fda2c059..cd94787ec1c 100644 --- a/PWG2/RESONANCES/AliRsnPairFunctions.h +++ b/PWG2/RESONANCES/AliRsnPairFunctions.h @@ -22,25 +22,24 @@ class AliRsnCutSet; class AliRsnFunction; class AliRsnValue; -class AliRsnPairFunctions : public AliRsnPair -{ - public: +class AliRsnPairFunctions : public AliRsnPair { +public: - AliRsnPairFunctions(const char *name = "default", AliRsnPairDef *def = 0); - AliRsnPairFunctions(const AliRsnPairFunctions ©); - AliRsnPairFunctions& operator=(const AliRsnPairFunctions&); - ~AliRsnPairFunctions(); + AliRsnPairFunctions(const char *name = "default", AliRsnPairDef *def = 0); + AliRsnPairFunctions(const AliRsnPairFunctions ©); + AliRsnPairFunctions& operator=(const AliRsnPairFunctions&); + ~AliRsnPairFunctions(); - void AddFunction(AliRsnFunction*const fcn); - TList* GenerateHistograms(const char *prefix = "", TList *list = 0); - virtual void Compute(); - virtual void Init(const char *prefix, TList *list); + void AddFunction(AliRsnFunction*const fcn); + TList* GenerateHistograms(const char *prefix = "", TList *list = 0); + virtual void Compute(); + virtual void Init(const char *prefix, TList *list); - protected: +protected: - TClonesArray fFunctions; // a list of functions which generate histograms + TClonesArray fFunctions; // a list of functions which generate histograms - ClassDef(AliRsnPairFunctions, 2) + ClassDef(AliRsnPairFunctions, 2) }; #endif diff --git a/PWG2/RESONANCES/AliRsnPairNtuple.cxx b/PWG2/RESONANCES/AliRsnPairNtuple.cxx index a887d0068de..cca554ec8c6 100644 --- a/PWG2/RESONANCES/AliRsnPairNtuple.cxx +++ b/PWG2/RESONANCES/AliRsnPairNtuple.cxx @@ -29,47 +29,46 @@ ClassImp(AliRsnPairNtuple) //_____________________________________________________________________________ AliRsnPairNtuple::AliRsnPairNtuple(const char *name, AliRsnPairDef *def) : - AliRsnPair(name, def), - fValues("AliRsnValue", 0), - fNtuple(0x0) + AliRsnPair(name, def), + fValues("AliRsnValue", 0), + fNtuple(0x0) { // // Default constructor // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ AliRsnPairNtuple::AliRsnPairNtuple(const AliRsnPairNtuple& copy) : - AliRsnPair(copy), - fValues(copy.fValues), - fNtuple(copy.fNtuple) + AliRsnPair(copy), + fValues(copy.fValues), + fNtuple(copy.fNtuple) { // // Default constructor // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ AliRsnPairNtuple& AliRsnPairNtuple::operator=(const AliRsnPairNtuple& copy) { - AliRsnPair::operator=(copy); - - Int_t i, n = copy.fValues.GetEntries(); - for (i = 0; i < n; i++) - { - AliRsnValue *fcn = (AliRsnValue*)copy.fValues[i]; - if (fcn) AddValue(fcn); - } - - fNtuple = copy.fNtuple; - - return (*this); + AliRsnPair::operator=(copy); + + Int_t i, n = copy.fValues.GetEntries(); + for (i = 0; i < n; i++) { + AliRsnValue *fcn = (AliRsnValue*)copy.fValues[i]; + if (fcn) AddValue(fcn); + } + + fNtuple = copy.fNtuple; + + return (*this); } //_____________________________________________________________________________ @@ -79,8 +78,8 @@ AliRsnPairNtuple::~AliRsnPairNtuple() // Destructor // - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -92,36 +91,34 @@ void AliRsnPairNtuple::Compute() // and then fill the list of required values using it. // - AliDebug(AliLog::kDebug+2,"<-"); - - // compute all values - Int_t i, n = fValues.GetEntries(); - TArrayF values(n); - AliRsnValue *value = 0x0; - Bool_t computeOK = kFALSE; - for (i = 0; i < n; i++) - { - values[i] = -1E10; - value = (AliRsnValue*)fValues[i]; - switch (value->GetTargetType()) - { - case AliRsnTarget::kMother: - value->SetSupportObject(fPairDef); - computeOK = value->Eval(&fMother); - break; - case AliRsnTarget::kEvent: - computeOK = value->Eval(AliRsnTarget::GetCurrentEvent()); - break; - default: - AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", value->GetName(), value->GetTargetTypeName())); - computeOK = kFALSE; - } - if (computeOK) values[i] = ((Float_t)value->GetComputedValue()); - } - - fNtuple->Fill(values.GetArray()); - - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + + // compute all values + Int_t i, n = fValues.GetEntries(); + TArrayF values(n); + AliRsnValue *value = 0x0; + Bool_t computeOK = kFALSE; + for (i = 0; i < n; i++) { + values[i] = -1E10; + value = (AliRsnValue*)fValues[i]; + switch (value->GetTargetType()) { + case AliRsnTarget::kMother: + value->SetSupportObject(fPairDef); + computeOK = value->Eval(&fMother); + break; + case AliRsnTarget::kEvent: + computeOK = value->Eval(AliRsnTarget::GetCurrentEvent()); + break; + default: + AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", value->GetName(), value->GetTargetTypeName())); + computeOK = kFALSE; + } + if (computeOK) values[i] = ((Float_t)value->GetComputedValue()); + } + + fNtuple->Fill(values.GetArray()); + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -135,24 +132,23 @@ void AliRsnPairNtuple::Init(const char *prefix, TList *list) // All generated histograms are stored into the output TList. // - AliDebug(AliLog::kDebug+2,"<-"); - - TString nameList(""); - - Int_t i, n = fValues.GetEntries(); - AliRsnValue *val = 0; - for (i = 0; i < n; i++) - { - val = (AliRsnValue*)fValues.At(i); - nameList += val->GetName(); - if (i < n - 1) nameList += ':'; - } - - if (fNtuple) delete fNtuple; - fNtuple = new TNtuple(Form("%sntp%s", prefix, GetName()), "", nameList.Data()); - if (list) list->Add(fNtuple); - - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + + TString nameList(""); + + Int_t i, n = fValues.GetEntries(); + AliRsnValue *val = 0; + for (i = 0; i < n; i++) { + val = (AliRsnValue*)fValues.At(i); + nameList += val->GetName(); + if (i < n - 1) nameList += ':'; + } + + if (fNtuple) delete fNtuple; + fNtuple = new TNtuple(Form("%sntp%s", prefix, GetName()), "", nameList.Data()); + if (list) list->Add(fNtuple); + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -162,15 +158,14 @@ Bool_t AliRsnPairNtuple::AddValue(AliRsnValue *const val) // Adds a new computing function. // - RSNTARGET target = val->GetTargetType(); - if (target != AliRsnTarget::kMother && target != AliRsnTarget::kEvent) - { - AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", val->GetName(), val->GetTargetTypeName())); - return kFALSE; - } - - Int_t size = fValues.GetEntries(); - new (fValues[size]) AliRsnValue(*val); - - return kTRUE; + RSNTARGET target = val->GetTargetType(); + if (target != AliRsnTarget::kMother && target != AliRsnTarget::kEvent) { + AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", val->GetName(), val->GetTargetTypeName())); + return kFALSE; + } + + Int_t size = fValues.GetEntries(); + new(fValues[size]) AliRsnValue(*val); + + return kTRUE; } diff --git a/PWG2/RESONANCES/AliRsnPairNtuple.h b/PWG2/RESONANCES/AliRsnPairNtuple.h index 2d3132f16a0..93c565ab8b8 100644 --- a/PWG2/RESONANCES/AliRsnPairNtuple.h +++ b/PWG2/RESONANCES/AliRsnPairNtuple.h @@ -15,26 +15,25 @@ class TList; class TNtuple; -class AliRsnPairNtuple : public AliRsnPair -{ - public: +class AliRsnPairNtuple : public AliRsnPair { +public: - AliRsnPairNtuple(const char *name = "default", AliRsnPairDef *def = 0); - AliRsnPairNtuple(const AliRsnPairNtuple ©); - AliRsnPairNtuple& operator=(const AliRsnPairNtuple&); - ~AliRsnPairNtuple(); + AliRsnPairNtuple(const char *name = "default", AliRsnPairDef *def = 0); + AliRsnPairNtuple(const AliRsnPairNtuple ©); + AliRsnPairNtuple& operator=(const AliRsnPairNtuple&); + ~AliRsnPairNtuple(); - Bool_t AddValue(AliRsnValue*const val); - void GenerateNtuple(const char *prefix = "", TList *list = 0); - virtual void Compute(); - virtual void Init(const char *prefix, TList *list); + Bool_t AddValue(AliRsnValue*const val); + void GenerateNtuple(const char *prefix = "", TList *list = 0); + virtual void Compute(); + virtual void Init(const char *prefix, TList *list); - private: +private: - TClonesArray fValues; // single values computed from analyzed objects - TNtuple *fNtuple; // ntuple computed with values + TClonesArray fValues; // single values computed from analyzed objects + TNtuple *fNtuple; // ntuple computed with values - ClassDef(AliRsnPairNtuple, 2) + ClassDef(AliRsnPairNtuple, 2) }; #endif diff --git a/PWG2/RESONANCES/AliRsnTarget.cxx b/PWG2/RESONANCES/AliRsnTarget.cxx index 2b7301d4919..8dcb25d1ae0 100644 --- a/PWG2/RESONANCES/AliRsnTarget.cxx +++ b/PWG2/RESONANCES/AliRsnTarget.cxx @@ -1,10 +1,10 @@ // // *** Class AliRsnTarget *** // -// Base class used wherever it is needed to check the class type of -// an object (daughter, mother, event) which could be used for +// Base class used wherever it is needed to check the class type of +// an object (daughter, mother, event) which could be used for // cut checking or value computing. -// Since most of these operation are implemented into classes that +// Since most of these operation are implemented into classes that // operate on any of such objects, then this class helps in making sure // that the object being processed corresponds to what is expected. // @@ -32,58 +32,53 @@ Bool_t AliRsnTarget::TargetOK(TObject *object) // kTRUE or kFALSE depending if they match or not. // - // fails by default if a NULL pointer is passed - if (!object) - { - AliError("Object is NULL"); - return kFALSE; - } - - // checks if the object is correct by dynamic casting - switch (fTargetType) - { - case kDaughter: - fDaughter = dynamic_cast(object); - fMother = 0x0; - fEvent = 0x0; - if (fDaughter) - return kTRUE; - else - { - AliError(Form("[%s] Target mismatch: expected 'AliRsnDaughter', passed '%s'", GetName(), object->ClassName())); - Print(); - return kFALSE; - } - case kMother: - fDaughter = 0x0; - fMother = dynamic_cast(object); - fEvent = 0x0; - if (fMother) - return kTRUE; - else - { - AliError(Form("[%s] Target mismatch: expected 'AliRsnMother', passed '%s'", GetName(), object->ClassName())); - Print(); - return kFALSE; - } - case kEvent: - fDaughter = 0x0; - fMother = 0x0; - fEvent = dynamic_cast(object); - if (fEvent) - return kTRUE; - else - { - AliError(Form("[%s] Target mismatch: expected 'AliRsnEvent', passed '%s'", GetName(), object->ClassName())); - Print(); - return kFALSE; - } - default: - fDaughter = 0x0; - fMother = 0x0; - fEvent = 0x0; + // fails by default if a NULL pointer is passed + if (!object) { + AliError("Object is NULL"); return kFALSE; - } + } + + // checks if the object is correct by dynamic casting + switch (fTargetType) { + case kDaughter: + fDaughter = dynamic_cast(object); + fMother = 0x0; + fEvent = 0x0; + if (fDaughter) + return kTRUE; + else { + AliError(Form("[%s] Target mismatch: expected 'AliRsnDaughter', passed '%s'", GetName(), object->ClassName())); + Print(); + return kFALSE; + } + case kMother: + fDaughter = 0x0; + fMother = dynamic_cast(object); + fEvent = 0x0; + if (fMother) + return kTRUE; + else { + AliError(Form("[%s] Target mismatch: expected 'AliRsnMother', passed '%s'", GetName(), object->ClassName())); + Print(); + return kFALSE; + } + case kEvent: + fDaughter = 0x0; + fMother = 0x0; + fEvent = dynamic_cast(object); + if (fEvent) + return kTRUE; + else { + AliError(Form("[%s] Target mismatch: expected 'AliRsnEvent', passed '%s'", GetName(), object->ClassName())); + Print(); + return kFALSE; + } + default: + fDaughter = 0x0; + fMother = 0x0; + fEvent = 0x0; + return kFALSE; + } } //______________________________________________________________________________ @@ -93,13 +88,12 @@ Char_t AliRsnTarget::GetTargetTypeChar() const // Returns a single character identifying the cut target type. // - switch (fTargetType) - { - case kDaughter: return 'D'; - case kMother: return 'M'; - case kEvent: return 'E'; - default: return 'X'; - } + switch (fTargetType) { + case kDaughter: return 'D'; + case kMother: return 'M'; + case kEvent: return 'E'; + default: return 'X'; + } } //______________________________________________________________________________ @@ -109,11 +103,10 @@ const char* AliRsnTarget::GetTargetTypeName() const // Returns a string with the name of the cut target type- // - switch (fTargetType) - { - case kDaughter: return "Daughter"; - case kMother: return "Mother"; - case kEvent: return "Event"; - default: return "Undefined"; - } + switch (fTargetType) { + case kDaughter: return "Daughter"; + case kMother: return "Mother"; + case kEvent: return "Event"; + default: return "Undefined"; + } } diff --git a/PWG2/RESONANCES/AliRsnTarget.h b/PWG2/RESONANCES/AliRsnTarget.h index 13d123e2c99..fcc7b0d7a38 100644 --- a/PWG2/RESONANCES/AliRsnTarget.h +++ b/PWG2/RESONANCES/AliRsnTarget.h @@ -1,10 +1,10 @@ // // *** Class AliRsnTarget *** // -// Base class used wherever it is needed to check the class type of -// an object (daughter, mother, event) which could be used for +// Base class used wherever it is needed to check the class type of +// an object (daughter, mother, event) which could be used for // cut checking or value computing. -// Since most of these operation are implemented into classes that +// Since most of these operation are implemented into classes that // operate on any of such objects, then this class helps in making sure // that the object being processed corresponds to what is expected. // @@ -19,53 +19,51 @@ class AliRsnDaughter; class AliRsnMother; -class AliRsnTarget : public TNamed -{ - public: - - enum ETargetType - { +class AliRsnTarget : public TNamed { +public: + + enum ETargetType { kDaughter, kMother, kEvent, kTargetTypes - }; - - AliRsnTarget() : fTargetType(kTargetTypes), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ } - AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ } - AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ } - AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; fDaughter = 0x0; fMother = 0x0; fEvent = 0x0; return (*this); } - virtual ~AliRsnTarget() { /*nothing*/ } - - Bool_t IsTarget(ETargetType targetType) {return (fTargetType == targetType);} - ETargetType GetTargetType() const {return fTargetType;} - Char_t GetTargetTypeChar() const; - const char* GetTargetTypeName() const; - void SetTargetType(ETargetType type) {fTargetType = type;} - Bool_t TargetOK(TObject *object); - AliRsnDaughter* GetTargetDaughter() {return fDaughter;} - AliRsnMother* GetTargetMother() {return fMother;} - AliRsnEvent* GetTargetEvent() {return fEvent;} - - static AliRsnEvent* GetCurrentEvent() {return fgCurrentEvent;} - static void SetCurrentEvent(AliRsnEvent *event) {fgCurrentEvent = event;} - static void SwitchToFirst() {fgCurrentEvent = AliRsnEvent::GetCurrentEvent1();} - static void SwitchToSecond() {fgCurrentEvent = AliRsnEvent::GetCurrentEvent2();} - - protected: - - ETargetType fTargetType; // target type selected for this object - static AliRsnEvent *fgCurrentEvent; //! pointer to current event (useful in many cases) - - AliRsnDaughter *fDaughter; // utility pointer to target object (daughter) - AliRsnMother *fMother; // utility pointer to target object (mother) - AliRsnEvent *fEvent; // utility pointer to target object (event) - - static const Double_t fgkVeryBig; // utility value for very large value - static const Double_t fgkVerySmall; // utility value for very small value - - // ROOT dictionary - ClassDef(AliRsnTarget, 1) + }; + + AliRsnTarget() : fTargetType(kTargetTypes), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ } + AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ } + AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ } + AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; fDaughter = 0x0; fMother = 0x0; fEvent = 0x0; return (*this); } + virtual ~AliRsnTarget() { /*nothing*/ } + + Bool_t IsTarget(ETargetType targetType) {return (fTargetType == targetType);} + ETargetType GetTargetType() const {return fTargetType;} + Char_t GetTargetTypeChar() const; + const char* GetTargetTypeName() const; + void SetTargetType(ETargetType type) {fTargetType = type;} + Bool_t TargetOK(TObject *object); + AliRsnDaughter* GetTargetDaughter() {return fDaughter;} + AliRsnMother* GetTargetMother() {return fMother;} + AliRsnEvent* GetTargetEvent() {return fEvent;} + + static AliRsnEvent* GetCurrentEvent() {return fgCurrentEvent;} + static void SetCurrentEvent(AliRsnEvent *event) {fgCurrentEvent = event;} + static void SwitchToFirst() {fgCurrentEvent = AliRsnEvent::GetCurrentEvent1();} + static void SwitchToSecond() {fgCurrentEvent = AliRsnEvent::GetCurrentEvent2();} + +protected: + + ETargetType fTargetType; // target type selected for this object + static AliRsnEvent *fgCurrentEvent; //! pointer to current event (useful in many cases) + + AliRsnDaughter *fDaughter; // utility pointer to target object (daughter) + AliRsnMother *fMother; // utility pointer to target object (mother) + AliRsnEvent *fEvent; // utility pointer to target object (event) + + static const Double_t fgkVeryBig; // utility value for very large value + static const Double_t fgkVerySmall; // utility value for very small value + + // ROOT dictionary + ClassDef(AliRsnTarget, 1) }; typedef AliRsnTarget::ETargetType RSNTARGET; diff --git a/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx b/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx index fe020f30c07..8d63553ec8d 100644 --- a/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx +++ b/PWG2/RESONANCES/AliRsnVATProcessInfo.cxx @@ -22,43 +22,43 @@ ClassImp(AliRsnVATProcessInfo) //______________________________________________________________________________ AliRsnVATProcessInfo::AliRsnVATProcessInfo(const char *name) : - TNamed(name,name), - fHistUsedEvents(0x0), - fEventUsed(kFALSE), - fEventFunctions("AliRsnFunction", 0), - fPrintInfoNumber(1000) + TNamed(name, name), + fHistUsedEvents(0x0), + fEventUsed(kFALSE), + fEventFunctions("AliRsnFunction", 0), + fPrintInfoNumber(1000) { // // Constructor. // Does nothing more than initialization of data members. // - AliDebug(AliLog::kDebug+2, "Entering"); - AliDebug(AliLog::kDebug+2, "Exiting"); + AliDebug(AliLog::kDebug + 2, "Entering"); + AliDebug(AliLog::kDebug + 2, "Exiting"); } //______________________________________________________________________________ AliRsnVATProcessInfo::AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy) : - TNamed(copy), - fHistUsedEvents(0x0), - fEventUsed(copy.fEventUsed), - fEventFunctions(copy.fEventFunctions), - fPrintInfoNumber(copy.fPrintInfoNumber) + TNamed(copy), + fHistUsedEvents(0x0), + fEventUsed(copy.fEventUsed), + fEventFunctions(copy.fEventFunctions), + fPrintInfoNumber(copy.fPrintInfoNumber) { // // Copy constructor. // Clones the histogram and copies the values of other data members // - AliDebug(AliLog::kDebug+2, "Entering"); - - fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone(); - - AliDebug(AliLog::kDebug+2, "Exiting"); + AliDebug(AliLog::kDebug + 2, "Entering"); + + fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone(); + + AliDebug(AliLog::kDebug + 2, "Exiting"); } //______________________________________________________________________________ -AliRsnVATProcessInfo& AliRsnVATProcessInfo::operator= +AliRsnVATProcessInfo& AliRsnVATProcessInfo::operator= (const AliRsnVATProcessInfo& copy) { // @@ -66,16 +66,16 @@ AliRsnVATProcessInfo& AliRsnVATProcessInfo::operator= // Clones the histogram and copies the values of other data members. // - AliDebug(AliLog::kDebug+2, "Entering"); + AliDebug(AliLog::kDebug + 2, "Entering"); + + fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone(); + fEventUsed = copy.fEventUsed; + fPrintInfoNumber = copy.fPrintInfoNumber; + fEventFunctions = copy.fEventFunctions; + + AliDebug(AliLog::kDebug + 2, "Exiting"); - fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone(); - fEventUsed = copy.fEventUsed; - fPrintInfoNumber = copy.fPrintInfoNumber; - fEventFunctions = copy.fEventFunctions; - - AliDebug(AliLog::kDebug+2, "Exiting"); - - return (*this); + return (*this); } //______________________________________________________________________________ @@ -88,13 +88,13 @@ AliRsnVATProcessInfo::~AliRsnVATProcessInfo() // the data member pointers to NULL. // - AliDebug(AliLog::kDebug+2, "Entering"); - - fHistUsedEvents = 0x0; - fEventUsed = 0; - fPrintInfoNumber = 0; - - AliDebug(AliLog::kDebug+2, "Exiting"); + AliDebug(AliLog::kDebug + 2, "Entering"); + + fHistUsedEvents = 0x0; + fEventUsed = 0; + fPrintInfoNumber = 0; + + AliDebug(AliLog::kDebug + 2, "Exiting"); } //______________________________________________________________________________ @@ -102,37 +102,36 @@ void AliRsnVATProcessInfo::GenerateInfoList(TList *list) { // // Allocate in memory the histograms created in this class and store them -// inside the TList object passed as argument, which usually belongs to +// inside the TList object passed as argument, which usually belongs to // an AnalysisTask object, and represents one of its outputs. // If the histogram was already initialized, it is deleted and recreated. // - AliDebug(AliLog::kDebug+2, "Entering"); - - // delete existing allocation of stored objects - if (fHistUsedEvents) delete fHistUsedEvents; - - // create stored objects - fHistUsedEvents = new TH1I(GetEventHistogramName(), "Skipped/used events", 3, 0, 3); - - // ad objects to list - list->Add(fHistUsedEvents); - - // add all other functions - Int_t i; - TString hName(""); - AliRsnFunction *fcn = 0; - for (i = 0; i < fEventFunctions.GetEntries(); i++) - { - fcn = (AliRsnFunction*)fEventFunctions.At(i); - hName += GetName(); - hName += '_'; - hName += fcn->GetName(); - if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName.Data(), "")); - else list->Add(fcn->CreateHistogramSparse(hName.Data(), "")); - } - - AliDebug(AliLog::kDebug+2, "Exiting"); + AliDebug(AliLog::kDebug + 2, "Entering"); + + // delete existing allocation of stored objects + if (fHistUsedEvents) delete fHistUsedEvents; + + // create stored objects + fHistUsedEvents = new TH1I(GetEventHistogramName(), "Skipped/used events", 3, 0, 3); + + // ad objects to list + list->Add(fHistUsedEvents); + + // add all other functions + Int_t i; + TString hName(""); + AliRsnFunction *fcn = 0; + for (i = 0; i < fEventFunctions.GetEntries(); i++) { + fcn = (AliRsnFunction*)fEventFunctions.At(i); + hName += GetName(); + hName += '_'; + hName += fcn->GetName(); + if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName.Data(), "")); + else list->Add(fcn->CreateHistogramSparse(hName.Data(), "")); + } + + AliDebug(AliLog::kDebug + 2, "Exiting"); } //______________________________________________________________________________ @@ -147,17 +146,16 @@ void AliRsnVATProcessInfo::FillInfo() // histogram (bin '0' = skipped, bin '1' = used). // - fHistUsedEvents->Fill(fEventUsed); - - if (!fEventUsed) return; - - Int_t i; - AliRsnFunction *fcn = 0; - for (i = 0; i < fEventFunctions.GetEntries(); i++) - { - fcn = (AliRsnFunction*)fEventFunctions.At(i); - fcn->Fill(); - } + fHistUsedEvents->Fill(fEventUsed); + + if (!fEventUsed) return; + + Int_t i; + AliRsnFunction *fcn = 0; + for (i = 0; i < fEventFunctions.GetEntries(); i++) { + fcn = (AliRsnFunction*)fEventFunctions.At(i); + fcn->Fill(); + } } //______________________________________________________________________________ @@ -168,7 +166,7 @@ void AliRsnVATProcessInfo::PrintInfo(const Long64_t &num) // to inform about number of events processed // - if ((num+1) % fPrintInfoNumber == 0) AliInfo(Form("Events processed %lld", num+1)); + if ((num + 1) % fPrintInfoNumber == 0) AliInfo(Form("Events processed %lld", num + 1)); } //______________________________________________________________________________ @@ -178,8 +176,8 @@ Long64_t AliRsnVATProcessInfo::GetNumerOfEventsProcessed() // returns number of events from histogram // - if (fHistUsedEvents) return fHistUsedEvents->Integral(); - return 0; + if (fHistUsedEvents) return fHistUsedEvents->Integral(); + return 0; } //_____________________________________________________________________________ @@ -189,11 +187,11 @@ void AliRsnVATProcessInfo::AddEventFunction(AliRsnFunction * fcn) // Adds a new computing function // - AliDebug(AliLog::kDebug+2,"<-"); - - fEventFunctions.Print(); - Int_t size = fEventFunctions.GetEntries(); - new(fEventFunctions[size]) AliRsnFunction(*fcn); - - AliDebug(AliLog::kDebug+2,"->"); + AliDebug(AliLog::kDebug + 2, "<-"); + + fEventFunctions.Print(); + Int_t size = fEventFunctions.GetEntries(); + new(fEventFunctions[size]) AliRsnFunction(*fcn); + + AliDebug(AliLog::kDebug + 2, "->"); } diff --git a/PWG2/RESONANCES/AliRsnVATProcessInfo.h b/PWG2/RESONANCES/AliRsnVATProcessInfo.h index 9d8930e2269..3006debd977 100644 --- a/PWG2/RESONANCES/AliRsnVATProcessInfo.h +++ b/PWG2/RESONANCES/AliRsnVATProcessInfo.h @@ -20,35 +20,34 @@ class TH1I; class AliRsnFunction; class AliRsnEvent; -class AliRsnVATProcessInfo : public TNamed -{ - public: - AliRsnVATProcessInfo(const char *name = "RSNInfo"); - AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy); - AliRsnVATProcessInfo& operator= (const AliRsnVATProcessInfo& copy); - ~AliRsnVATProcessInfo(); +class AliRsnVATProcessInfo : public TNamed { +public: + AliRsnVATProcessInfo(const char *name = "RSNInfo"); + AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy); + AliRsnVATProcessInfo& operator= (const AliRsnVATProcessInfo& copy); + ~AliRsnVATProcessInfo(); - void GenerateInfoList(TList* list); - virtual void FillInfo(); - virtual void PrintInfo(const Long64_t &num); + void GenerateInfoList(TList* list); + virtual void FillInfo(); + virtual void PrintInfo(const Long64_t &num); - const char* GetEventHistogramName() { return Form("hEventsUsed_%s",GetName()); }; - Long64_t GetNumerOfEventsProcessed(); - void SetEventUsed(Int_t flag) { fEventUsed = flag; } - Int_t IsEventUsed() const { return fEventUsed; }; - void AddEventFunction(AliRsnFunction *fcn); + const char* GetEventHistogramName() { return Form("hEventsUsed_%s", GetName()); }; + Long64_t GetNumerOfEventsProcessed(); + void SetEventUsed(Int_t flag) { fEventUsed = flag; } + Int_t IsEventUsed() const { return fEventUsed; }; + void AddEventFunction(AliRsnFunction *fcn); - void SetPrintInfoNumber(const Long64_t &num=1) { fPrintInfoNumber = num; } + void SetPrintInfoNumber(const Long64_t &num = 1) { fPrintInfoNumber = num; } - private: +private: - TH1I *fHistUsedEvents; // hist of used events - Int_t fEventUsed; // number of used events - TClonesArray fEventFunctions; // collection of functions computed on event + TH1I *fHistUsedEvents; // hist of used events + Int_t fEventUsed; // number of used events + TClonesArray fEventFunctions; // collection of functions computed on event - Long64_t fPrintInfoNumber; // print info number + Long64_t fPrintInfoNumber; // print info number - ClassDef(AliRsnVATProcessInfo, 1) + ClassDef(AliRsnVATProcessInfo, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTask.cxx b/PWG2/RESONANCES/AliRsnVAnalysisTask.cxx index 1f897f5b996..1755a3444bb 100644 --- a/PWG2/RESONANCES/AliRsnVAnalysisTask.cxx +++ b/PWG2/RESONANCES/AliRsnVAnalysisTask.cxx @@ -29,56 +29,56 @@ ClassImp(AliRsnVAnalysisTask) //_____________________________________________________________________________ AliRsnVAnalysisTask::AliRsnVAnalysisTask (const char *name, Bool_t mcOnly) : - AliAnalysisTaskSE(name), - fLogType(AliLog::kInfo), - fLogClassesString(""), - fIsMixing(kFALSE), - fMCOnly(mcOnly), - fInfoList(0x0), - fTaskInfo(name), - fMixedEH(0), - fUseMixingRange(kTRUE) + AliAnalysisTaskSE(name), + fLogType(AliLog::kInfo), + fLogClassesString(""), + fIsMixing(kFALSE), + fMCOnly(mcOnly), + fInfoList(0x0), + fTaskInfo(name), + fMixedEH(0), + fUseMixingRange(kTRUE) { // // Default constructor. // Define the output slot for histograms. // - DefineOutput(1, TList::Class()); - DefineOutput(2, TList::Class()); - for(Int_t i=0;i<2;i++) { - fESDEvent[i] = 0; - fMCEvent[i]=0; - fAODEventIn[i]=0; - fAODEventOut[i]=0; - } + DefineOutput(1, TList::Class()); + DefineOutput(2, TList::Class()); + for (Int_t i = 0; i < 2; i++) { + fESDEvent[i] = 0; + fMCEvent[i] = 0; + fAODEventIn[i] = 0; + fAODEventOut[i] = 0; + } } //_____________________________________________________________________________ AliRsnVAnalysisTask::AliRsnVAnalysisTask(const AliRsnVAnalysisTask& copy) : - AliAnalysisTaskSE(copy), - fLogType(copy.fLogType), - fLogClassesString(copy.fLogClassesString), - fIsMixing(copy.fIsMixing), - fMCOnly(copy.fMCOnly), - fInfoList(0x0), - fTaskInfo(copy.fTaskInfo), - fMixedEH(copy.fMixedEH), - fUseMixingRange(copy.fUseMixingRange) + AliAnalysisTaskSE(copy), + fLogType(copy.fLogType), + fLogClassesString(copy.fLogClassesString), + fIsMixing(copy.fIsMixing), + fMCOnly(copy.fMCOnly), + fInfoList(0x0), + fTaskInfo(copy.fTaskInfo), + fMixedEH(copy.fMixedEH), + fUseMixingRange(copy.fUseMixingRange) { // // Copy constructor. // Defined for coding conventions compliance but never used. // - AliDebug(AliLog::kDebug+2, "<-"); - for(Int_t i=0;i<2;i++) { - fESDEvent[i] = copy.fESDEvent[i]; - fMCEvent[i]=copy.fMCEvent[i]; - fAODEventIn[i]=copy.fAODEventIn[i]; - fAODEventOut[i]=copy.fAODEventOut[i]; - fRsnEvent[i]=copy.fRsnEvent[i]; - } - AliDebug(AliLog::kDebug+2, "->"); + AliDebug(AliLog::kDebug + 2, "<-"); + for (Int_t i = 0; i < 2; i++) { + fESDEvent[i] = copy.fESDEvent[i]; + fMCEvent[i] = copy.fMCEvent[i]; + fAODEventIn[i] = copy.fAODEventIn[i]; + fAODEventOut[i] = copy.fAODEventOut[i]; + fRsnEvent[i] = copy.fRsnEvent[i]; + } + AliDebug(AliLog::kDebug + 2, "->"); } @@ -90,8 +90,8 @@ void AliRsnVAnalysisTask::LocalInit() // Defines the debug message level and calls the mother class LocalInit(). // - AliAnalysisTaskSE::LocalInit(); - SetDebugForAllClasses(); + AliAnalysisTaskSE::LocalInit(); + SetDebugForAllClasses(); } //_____________________________________________________________________________ @@ -101,7 +101,7 @@ Bool_t AliRsnVAnalysisTask::UserNotify() // Calls the mother class Notify() // - return AliAnalysisTaskSE::UserNotify(); + return AliAnalysisTaskSE::UserNotify(); } //_____________________________________________________________________________ @@ -112,34 +112,31 @@ void AliRsnVAnalysisTask::ConnectInputData(Option_t *opt) // the pointer to the input event, which is dynamically casted // to all available types, and this allows to know its type. // Calls also the mother class omonyme method. -// - - AliAnalysisTaskSE::ConnectInputData(opt); - - // get AliESDEvent and, if successful - // retrieve the corresponding MC if exists - fESDEvent[0] = dynamic_cast(fInputEvent); - if (fESDEvent[0]) - { - fMCEvent[0] = (AliMCEvent*) MCEvent(); - AliInfo(Form("Input event is of type ESD (%p)", fESDEvent[0])); - if (fMCEvent[0]) AliInfo(Form("Input has an associated MC (%p)", fMCEvent[0])); - } - - // get AliAODEvent from input and, if successful - // it will contain both the reconstructed and MC informations - fAODEventIn[0] = dynamic_cast(fInputEvent); - if (fAODEventIn[0]) - { - AliInfo(Form("Input event if of type native AOD (%p)", fAODEventIn[0])); - } - - // get AliAODEvent from output of previous task - fAODEventOut[0] = dynamic_cast(AODEvent()); - if (fAODEventOut[0]) - { - AliInfo(Form("Input event if of type produced AOD from previous step (%p)",fAODEventOut[0])); - } +// + + AliAnalysisTaskSE::ConnectInputData(opt); + + // get AliESDEvent and, if successful + // retrieve the corresponding MC if exists + fESDEvent[0] = dynamic_cast(fInputEvent); + if (fESDEvent[0]) { + fMCEvent[0] = (AliMCEvent*) MCEvent(); + AliInfo(Form("Input event is of type ESD (%p)", fESDEvent[0])); + if (fMCEvent[0]) AliInfo(Form("Input has an associated MC (%p)", fMCEvent[0])); + } + + // get AliAODEvent from input and, if successful + // it will contain both the reconstructed and MC informations + fAODEventIn[0] = dynamic_cast(fInputEvent); + if (fAODEventIn[0]) { + AliInfo(Form("Input event if of type native AOD (%p)", fAODEventIn[0])); + } + + // get AliAODEvent from output of previous task + fAODEventOut[0] = dynamic_cast(AODEvent()); + if (fAODEventOut[0]) { + AliInfo(Form("Input event if of type produced AOD from previous step (%p)", fAODEventOut[0])); + } } //_____________________________________________________________________________ @@ -152,17 +149,17 @@ void AliRsnVAnalysisTask::UserCreateOutputObjects() // in the applications of this base class. // - SetDebugForAllClasses(); + SetDebugForAllClasses(); - // set event info outputs - fInfoList = new TList(); - fInfoList->SetOwner(); - fTaskInfo.GenerateInfoList(fInfoList); - - // create customized outputs - RsnUserCreateOutputObjects(); + // set event info outputs + fInfoList = new TList(); + fInfoList->SetOwner(); + fTaskInfo.GenerateInfoList(fInfoList); - PostData(1, fInfoList); + // create customized outputs + RsnUserCreateOutputObjects(); + + PostData(1, fInfoList); } //_____________________________________________________________________________ @@ -173,129 +170,110 @@ void AliRsnVAnalysisTask::UserExec(Option_t* opt) // RSN package event interface, which will point to the not NULL // objects obtained from dynamic-casts called in ConnectInputData(). // - if (!IsMixing()) { - - - if (fMCOnly && fMCEvent) - { - fRsnEvent[0].SetRef (fMCEvent[0]); - fRsnEvent[0].SetRefMC(fMCEvent[0]); - } - else if (fESDEvent[0]) - { - fRsnEvent[0].SetRef (fESDEvent[0]); - fRsnEvent[0].SetRefMC(fMCEvent[0]); - } - else if (fAODEventOut) - { - fRsnEvent[0].SetRef (fAODEventOut[0]); - fRsnEvent[0].SetRefMC(fAODEventOut[0]); - } - else if (fAODEventIn) - { - fRsnEvent[0].SetRef (fAODEventIn[0]); - fRsnEvent[0].SetRefMC(fAODEventIn[0]); - } - else - { - AliError("Unknown input event format. Skipping"); - return; - } - - // since this class is for single-event analysis - // both static pointers of AliRsnEvent class - // will point to the same unique datamember - AliRsnEvent::SetCurrentEvent1(&fRsnEvent[0], fEntry); - AliRsnEvent::SetCurrentEvent2(&fRsnEvent[0], fEntry); - AliRsnTarget::SwitchToFirst(); - - // call event preprocessing... - Bool_t preCheck = EventProcess(); - // ...then fill the information object and print informations... - fTaskInfo.FillInfo(); - fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); - // ...and return if event did not pass selections - if (!preCheck) - { - AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); - return; - } - - - // call customized implementation for execution - RsnUserExec(opt); - } - // post outputs for the info object - // (eventually others are done in the derived classes) - PostData(1, fInfoList); + if (!IsMixing()) { + + + if (fMCOnly && fMCEvent) { + fRsnEvent[0].SetRef(fMCEvent[0]); + fRsnEvent[0].SetRefMC(fMCEvent[0]); + } else if (fESDEvent[0]) { + fRsnEvent[0].SetRef(fESDEvent[0]); + fRsnEvent[0].SetRefMC(fMCEvent[0]); + } else if (fAODEventOut) { + fRsnEvent[0].SetRef(fAODEventOut[0]); + fRsnEvent[0].SetRefMC(fAODEventOut[0]); + } else if (fAODEventIn) { + fRsnEvent[0].SetRef(fAODEventIn[0]); + fRsnEvent[0].SetRefMC(fAODEventIn[0]); + } else { + AliError("Unknown input event format. Skipping"); + return; + } + + // since this class is for single-event analysis + // both static pointers of AliRsnEvent class + // will point to the same unique datamember + AliRsnEvent::SetCurrentEvent1(&fRsnEvent[0], fEntry); + AliRsnEvent::SetCurrentEvent2(&fRsnEvent[0], fEntry); + AliRsnTarget::SwitchToFirst(); + + // call event preprocessing... + Bool_t preCheck = EventProcess(); + // ...then fill the information object and print informations... + fTaskInfo.FillInfo(); + fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); + // ...and return if event did not pass selections + if (!preCheck) { + AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); + return; + } + + + // call customized implementation for execution + RsnUserExec(opt); + } + // post outputs for the info object + // (eventually others are done in the derived classes) + PostData(1, fInfoList); } void AliRsnVAnalysisTask::UserExecMix(Option_t* option) { - AliDebug(AliLog::kDebug+2,"<-"); - - - if (!IsMixing()) return; - - SetupMixingEvents(); - - if (!fMixedEH) return; - - if (fMCOnly && fMCEvent[0]) - { - fRsnEvent[0].SetRef (fMCEvent[0]); + AliDebug(AliLog::kDebug + 2, "<-"); + + + if (!IsMixing()) return; + + SetupMixingEvents(); + + if (!fMixedEH) return; + + if (fMCOnly && fMCEvent[0]) { + fRsnEvent[0].SetRef(fMCEvent[0]); fRsnEvent[0].SetRefMC(fMCEvent[0]); - fRsnEvent[1].SetRef (fMCEvent[1]); + fRsnEvent[1].SetRef(fMCEvent[1]); fRsnEvent[1].SetRefMC(fMCEvent[1]); - } - else if (fESDEvent[0]) - { - fRsnEvent[0].SetRef (fESDEvent[0]); + } else if (fESDEvent[0]) { + fRsnEvent[0].SetRef(fESDEvent[0]); fRsnEvent[0].SetRefMC(fMCEvent[0]); - fRsnEvent[1].SetRef (fESDEvent[1]); + fRsnEvent[1].SetRef(fESDEvent[1]); fRsnEvent[1].SetRefMC(fMCEvent[1]); - } - else if (fAODEventOut) - { - fRsnEvent[0].SetRef (fAODEventOut[0]); + } else if (fAODEventOut) { + fRsnEvent[0].SetRef(fAODEventOut[0]); fRsnEvent[0].SetRefMC(fAODEventOut[0]); - fRsnEvent[1].SetRef (fAODEventOut[1]); + fRsnEvent[1].SetRef(fAODEventOut[1]); fRsnEvent[1].SetRefMC(fAODEventOut[1]); - } - else if (fAODEventIn) - { - fRsnEvent[0].SetRef (fAODEventIn[0]); + } else if (fAODEventIn) { + fRsnEvent[0].SetRef(fAODEventIn[0]); fRsnEvent[0].SetRefMC(fAODEventIn[0]); - fRsnEvent[1].SetRef (fAODEventIn[1]); + fRsnEvent[1].SetRef(fAODEventIn[1]); fRsnEvent[1].SetRefMC(fAODEventIn[1]); - } - else { + } else { AliError("NO ESD or AOD object!!! Skipping ..."); return; - } - // since this class is for single-event analysis - // both static pointers of AliRsnEvent class - // will point to the same unique datamember - - - AliRsnEvent::SetCurrentEvent1(&fRsnEvent[0], fMixedEH->CurrentEntryMain()); - AliRsnEvent::SetCurrentEvent2(&fRsnEvent[1], fMixedEH->CurrentEntryMix()); - AliRsnTarget::SwitchToFirst(); - - // call event preprocessing... - Bool_t preCheck = EventProcess(); - // ...then fill the information object and print informations... - fTaskInfo.FillInfo(); - fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); - // ...and return if event did not pass selections - if (!preCheck) - { + } + // since this class is for single-event analysis + // both static pointers of AliRsnEvent class + // will point to the same unique datamember + + + AliRsnEvent::SetCurrentEvent1(&fRsnEvent[0], fMixedEH->CurrentEntryMain()); + AliRsnEvent::SetCurrentEvent2(&fRsnEvent[1], fMixedEH->CurrentEntryMix()); + AliRsnTarget::SwitchToFirst(); + + // call event preprocessing... + Bool_t preCheck = EventProcess(); + // ...then fill the information object and print informations... + fTaskInfo.FillInfo(); + fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); + // ...and return if event did not pass selections + if (!preCheck) { AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); return; - } - - RsnUserExecMix(option); - AliDebug(AliLog::kDebug+2,"->"); + } + + RsnUserExecMix(option); + AliDebug(AliLog::kDebug + 2, "->"); } @@ -308,30 +286,28 @@ void AliRsnVAnalysisTask::Terminate(Option_t* opt) // and includes to the TList all task informations. // - AliAnalysisTask::Terminate(); - - TList* list = dynamic_cast(GetOutputData(1)); - if (!list) - { - AliError(Form("At end of analysis, fOutList is %p", list)); - return; - } - - RsnTerminate(opt); - - TH1I *hEventInfo = (TH1I*) list->FindObject(fTaskInfo.GetEventHistogramName()); - if (!hEventInfo) - { - AliError(Form("hEventInfo is %p", hEventInfo)); - return; - } - AliInfo(Form("=== %s ==================",GetName())); - AliInfo(Form("Number Of Events Processed : %10lld",(Long64_t)hEventInfo->Integral())); - AliInfo(Form("Number Of Events Accepted : %10lld",(Long64_t)hEventInfo->GetBinContent(2))); - AliInfo(Form("Number Of Events Skipped : %10lld",(Long64_t)hEventInfo->GetBinContent(1))); - AliInfo(Form("=== end %s ==============",GetName())); - - AliDebug(AliLog::kDebug+2, "->"); + AliAnalysisTask::Terminate(); + + TList* list = dynamic_cast(GetOutputData(1)); + if (!list) { + AliError(Form("At end of analysis, fOutList is %p", list)); + return; + } + + RsnTerminate(opt); + + TH1I *hEventInfo = (TH1I*) list->FindObject(fTaskInfo.GetEventHistogramName()); + if (!hEventInfo) { + AliError(Form("hEventInfo is %p", hEventInfo)); + return; + } + AliInfo(Form("=== %s ==================", GetName())); + AliInfo(Form("Number Of Events Processed : %10lld", (Long64_t)hEventInfo->Integral())); + AliInfo(Form("Number Of Events Accepted : %10lld", (Long64_t)hEventInfo->GetBinContent(2))); + AliInfo(Form("Number Of Events Skipped : %10lld", (Long64_t)hEventInfo->GetBinContent(1))); + AliInfo(Form("=== end %s ==============", GetName())); + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -343,7 +319,7 @@ void AliRsnVAnalysisTask::RsnUserCreateOutputObjects() // in the used task. // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -353,16 +329,16 @@ void AliRsnVAnalysisTask::RsnUserExec(Option_t*) // // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } -void AliRsnVAnalysisTask::RsnUserExecMix(Option_t* ) +void AliRsnVAnalysisTask::RsnUserExecMix(Option_t*) { - // - // - // - - AliWarning("Implement this in derived classes"); + // + // + // + + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -372,7 +348,7 @@ void AliRsnVAnalysisTask::RsnTerminate(Option_t*) // Overload this to add additional termination operations // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -380,58 +356,58 @@ Bool_t AliRsnVAnalysisTask::EventProcess() { // // Performs some pre-processing of current event, -// which is useful for all the operations which +// which is useful for all the operations which // need to be done only once for each event. // - - // if not using mixing cuts return kTRUE - if (!IsUsingMixingRange()) return kTRUE; - - // cut if event was in range of mixing cuts - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - AliMultiInputEventHandler *inEvHMain = dynamic_cast(mgr->GetInputEventHandler()); - if(inEvHMain) { - fMixedEH = dynamic_cast(inEvHMain->GetFirstMultiInputHandler()); - if(fMixedEH) { - if (fMixedEH->CurrentBinIndex()<0) return kFALSE; - } - - } - - // in this case, return always a success - return kTRUE; + + // if not using mixing cuts return kTRUE + if (!IsUsingMixingRange()) return kTRUE; + + // cut if event was in range of mixing cuts + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + AliMultiInputEventHandler *inEvHMain = dynamic_cast(mgr->GetInputEventHandler()); + if (inEvHMain) { + fMixedEH = dynamic_cast(inEvHMain->GetFirstMultiInputHandler()); + if (fMixedEH) { + if (fMixedEH->CurrentBinIndex() < 0) return kFALSE; + } + + } + + // in this case, return always a success + return kTRUE; } void AliRsnVAnalysisTask::SetupMixingEvents() { - // mixing setup - - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - AliMultiInputEventHandler *inEvHMain = dynamic_cast(mgr->GetInputEventHandler()); - if(inEvHMain) { - fMixedEH = dynamic_cast(inEvHMain->GetFirstMultiInputHandler()); - if(fMixedEH) { - AliMultiInputEventHandler *inEvHMainTmpMix = dynamic_cast(fMixedEH->InputEventHandler(0)); - if(!inEvHMainTmpMix) return; - AliInputEventHandler *inEvHMixTmp = dynamic_cast(inEvHMainTmpMix->GetFirstInputEventHandler()); - AliMCEventHandler *inEvHMCMixTmp = dynamic_cast(inEvHMainTmpMix->GetFirstMCEventHandler()); - if(!inEvHMixTmp) return; - fESDEvent[1] = dynamic_cast(inEvHMixTmp->GetEvent()); - if (fESDEvent[1]) AliDebug(AliLog::kDebug,Form("Input is ESD (%p) MIXED", fESDEvent[1])); - // getting AliAODEvent from input - fAODEventIn[1] = dynamic_cast(inEvHMixTmp->GetEvent()); - if (fAODEventIn[1]) AliDebug(AliLog::kDebug,Form("Input is AOD (%p) MIXED", fAODEventIn[1])); - // getting AliAODEvent if it is output from previous task (not supported) - fAODEventOut[1] = 0; - - if(inEvHMCMixTmp) { - fMCEvent[1] = inEvHMCMixTmp->MCEvent(); - if (fMCEvent[1]) AliDebug(AliLog::kDebug,Form("Input is ESDMC (%p) MIXED", fMCEvent[1])); + // mixing setup + + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + AliMultiInputEventHandler *inEvHMain = dynamic_cast(mgr->GetInputEventHandler()); + if (inEvHMain) { + fMixedEH = dynamic_cast(inEvHMain->GetFirstMultiInputHandler()); + if (fMixedEH) { + AliMultiInputEventHandler *inEvHMainTmpMix = dynamic_cast(fMixedEH->InputEventHandler(0)); + if (!inEvHMainTmpMix) return; + AliInputEventHandler *inEvHMixTmp = dynamic_cast(inEvHMainTmpMix->GetFirstInputEventHandler()); + AliMCEventHandler *inEvHMCMixTmp = dynamic_cast(inEvHMainTmpMix->GetFirstMCEventHandler()); + if (!inEvHMixTmp) return; + fESDEvent[1] = dynamic_cast(inEvHMixTmp->GetEvent()); + if (fESDEvent[1]) AliDebug(AliLog::kDebug, Form("Input is ESD (%p) MIXED", fESDEvent[1])); + // getting AliAODEvent from input + fAODEventIn[1] = dynamic_cast(inEvHMixTmp->GetEvent()); + if (fAODEventIn[1]) AliDebug(AliLog::kDebug, Form("Input is AOD (%p) MIXED", fAODEventIn[1])); + // getting AliAODEvent if it is output from previous task (not supported) + fAODEventOut[1] = 0; + + if (inEvHMCMixTmp) { + fMCEvent[1] = inEvHMCMixTmp->MCEvent(); + if (fMCEvent[1]) AliDebug(AliLog::kDebug, Form("Input is ESDMC (%p) MIXED", fMCEvent[1])); + } + } - - } - - } + + } } //_____________________________________________________________________________ @@ -441,17 +417,16 @@ void AliRsnVAnalysisTask::SetDebugForAllClasses() // Set debug level for all classes for which it is required // - TObjArray *array = fLogClassesString.Tokenize(":"); - TObjString *objStr; - TString str; - Int_t i, n = array->GetEntriesFast(); - - for (i = 0; i < n; i++) - { - objStr = (TObjString*)array->At(i); - str = objStr->GetString(); - AliLog::SetClassDebugLevel(str.Data(), fLogType); - AliInfo(Form("Setting Debug to %s", str.Data())); - } + TObjArray *array = fLogClassesString.Tokenize(":"); + TObjString *objStr; + TString str; + Int_t i, n = array->GetEntriesFast(); + + for (i = 0; i < n; i++) { + objStr = (TObjString*)array->At(i); + str = objStr->GetString(); + AliLog::SetClassDebugLevel(str.Data(), fLogType); + AliInfo(Form("Setting Debug to %s", str.Data())); + } } diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTask.h b/PWG2/RESONANCES/AliRsnVAnalysisTask.h index 64cff7d71c5..ed798b7425a 100644 --- a/PWG2/RESONANCES/AliRsnVAnalysisTask.h +++ b/PWG2/RESONANCES/AliRsnVAnalysisTask.h @@ -23,72 +23,71 @@ class AliESDEvent; class AliAODEvent; class AliMCEvent; -class AliRsnVAnalysisTask : public AliAnalysisTaskSE -{ - public: - - AliRsnVAnalysisTask(const char *name = "AliRsnVAnalysisTask", Bool_t mcOnly = kFALSE); - AliRsnVAnalysisTask(const AliRsnVAnalysisTask& copy); - AliRsnVAnalysisTask& operator= (const AliRsnVAnalysisTask& /*copy*/) { return *this; } - virtual ~AliRsnVAnalysisTask() {/* Does nothing*/;} - - // basic interface methods - virtual void LocalInit(); - virtual Bool_t UserNotify(); - virtual void ConnectInputData(Option_t *opt); - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t* opt); - virtual void UserExecMix(Option_t* option = ""); - virtual void Terminate(Option_t* opt); - - // customized methods (to be implemented in derived classes) - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnUserExecMix(Option_t*); - virtual void RsnTerminate(Option_t*); - - // event pre-processing functions - virtual Bool_t EventProcess(); - - // getters - AliRsnEvent* GetRsnEvent(Int_t i=0) {return &fRsnEvent[i];} - AliRsnVATProcessInfo* GetInfo() {return &fTaskInfo;} - - // setters - void SetMCOnly(Bool_t mcOnly = kTRUE) {fMCOnly = mcOnly;} - void SetLogType(AliLog::EType_t type, const char *classes = "") {fLogType = type; fLogClassesString = classes;} - void SetPrintInfoNumber(const Long64_t &num = 100) {fTaskInfo.SetPrintInfoNumber(num);} - - void SetMixing(Bool_t doMix = kTRUE) {fIsMixing = doMix;} - Bool_t IsMixing() { return fIsMixing;} - - void UseMixingRange(Bool_t useMixRange = kTRUE) {fUseMixingRange = useMixRange;} - Bool_t IsUsingMixingRange() { return fUseMixingRange;} - - protected: - - AliLog::EType_t fLogType; // log type - TString fLogClassesString; // all classes string divided with ":" - - AliESDEvent *fESDEvent[2]; // ESD event - AliMCEvent *fMCEvent[2]; // MC event - AliAODEvent *fAODEventIn[2]; // AOD event from input - AliAODEvent *fAODEventOut[2]; // AOD event from output from previous taks - - Bool_t fIsMixing; // flag is using mixing - Bool_t fMCOnly; // use only MC information - AliRsnEvent fRsnEvent[2]; // interface to event for RSN package - - TList *fInfoList; //! output list for informations - AliRsnVATProcessInfo fTaskInfo; // task info - - AliMixInputEventHandler *fMixedEH; //! mixed event hadnler - Bool_t fUseMixingRange; // - - void SetupMixingEvents(); - void SetDebugForAllClasses(); - - ClassDef(AliRsnVAnalysisTask, 1) +class AliRsnVAnalysisTask : public AliAnalysisTaskSE { +public: + + AliRsnVAnalysisTask(const char *name = "AliRsnVAnalysisTask", Bool_t mcOnly = kFALSE); + AliRsnVAnalysisTask(const AliRsnVAnalysisTask& copy); + AliRsnVAnalysisTask& operator= (const AliRsnVAnalysisTask& /*copy*/) { return *this; } + virtual ~AliRsnVAnalysisTask() {/* Does nothing*/;} + + // basic interface methods + virtual void LocalInit(); + virtual Bool_t UserNotify(); + virtual void ConnectInputData(Option_t *opt); + virtual void UserCreateOutputObjects(); + virtual void UserExec(Option_t* opt); + virtual void UserExecMix(Option_t* option = ""); + virtual void Terminate(Option_t* opt); + + // customized methods (to be implemented in derived classes) + virtual void RsnUserCreateOutputObjects(); + virtual void RsnUserExec(Option_t*); + virtual void RsnUserExecMix(Option_t*); + virtual void RsnTerminate(Option_t*); + + // event pre-processing functions + virtual Bool_t EventProcess(); + + // getters + AliRsnEvent* GetRsnEvent(Int_t i = 0) {return &fRsnEvent[i];} + AliRsnVATProcessInfo* GetInfo() {return &fTaskInfo;} + + // setters + void SetMCOnly(Bool_t mcOnly = kTRUE) {fMCOnly = mcOnly;} + void SetLogType(AliLog::EType_t type, const char *classes = "") {fLogType = type; fLogClassesString = classes;} + void SetPrintInfoNumber(const Long64_t &num = 100) {fTaskInfo.SetPrintInfoNumber(num);} + + void SetMixing(Bool_t doMix = kTRUE) {fIsMixing = doMix;} + Bool_t IsMixing() { return fIsMixing;} + + void UseMixingRange(Bool_t useMixRange = kTRUE) {fUseMixingRange = useMixRange;} + Bool_t IsUsingMixingRange() { return fUseMixingRange;} + +protected: + + AliLog::EType_t fLogType; // log type + TString fLogClassesString; // all classes string divided with ":" + + AliESDEvent *fESDEvent[2]; // ESD event + AliMCEvent *fMCEvent[2]; // MC event + AliAODEvent *fAODEventIn[2]; // AOD event from input + AliAODEvent *fAODEventOut[2]; // AOD event from output from previous taks + + Bool_t fIsMixing; // flag is using mixing + Bool_t fMCOnly; // use only MC information + AliRsnEvent fRsnEvent[2]; // interface to event for RSN package + + TList *fInfoList; //! output list for informations + AliRsnVATProcessInfo fTaskInfo; // task info + + AliMixInputEventHandler *fMixedEH; //! mixed event hadnler + Bool_t fUseMixingRange; // + + void SetupMixingEvents(); + void SetDebugForAllClasses(); + + ClassDef(AliRsnVAnalysisTask, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTaskME.cxx b/PWG2/RESONANCES/AliRsnVAnalysisTaskME.cxx deleted file mode 100644 index edea20e5c37..00000000000 --- a/PWG2/RESONANCES/AliRsnVAnalysisTaskME.cxx +++ /dev/null @@ -1,296 +0,0 @@ -// -// Class AliRsnVAnalysisTaskME -// -// Virtual Class derivated from AliAnalysisTaskME which will be base class -// for all RSN ME tasks -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// - -#include -#include -#include "AliESDEvent.h" -#include "AliMCEvent.h" -#include "AliAODEvent.h" -#include "AliAODTrack.h" -#include "AliMultiEventInputHandler.h" -#include "AliRsnVAnalysisTaskME.h" - -ClassImp(AliRsnVAnalysisTaskME) - -//_____________________________________________________________________________ -AliRsnVAnalysisTaskME::AliRsnVAnalysisTaskME(const char *name) : - AliAnalysisTaskME(name), - fLogType(AliLog::kInfo), - fLogClassesString(""), - fESDEvent(0x0), - fMCEvent(0x0), - fAODEvent(0x0), - fInfoList(0x0), - fTaskInfo(name) -{ -// -// Default constructor -// - AliDebug(AliLog::kDebug+2,"<-"); - - DefineOutput(1, TList::Class()); - - AliDebug(AliLog::kDebug+2,"->"); -} - -AliRsnVAnalysisTaskME::AliRsnVAnalysisTaskME(const AliRsnVAnalysisTaskME& copy) : AliAnalysisTaskME(copy), - fLogType(copy.fLogType), - fLogClassesString(copy.fLogClassesString), - fESDEvent(copy.fESDEvent), - fMCEvent(copy.fMCEvent), - fAODEvent(copy.fAODEvent), - fInfoList(0x0), - fTaskInfo(copy.fTaskInfo) -{ - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::LocalInit() -{ -// -// LocalInit() -// - - SetDebugForAllClasses(); - AliDebug(AliLog::kDebug+2,"<-"); - AliAnalysisTaskME::LocalInit(); - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -Bool_t AliRsnVAnalysisTaskME::Notify() -{ -// -// Notify() -// - - AliDebug(AliLog::kDebug+2,"<-"); - if (!AliAnalysisTaskME::Notify()) return kFALSE; - AliDebug(AliLog::kDebug+2,"->"); - - return kTRUE; -} - - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::ConnectInputData(Option_t *opt) -{ -// -// ConnectInputData -// - - SetDebugForAllClasses(); - - AliDebug(AliLog::kDebug+2,"<-"); - - AliAnalysisTaskME::ConnectInputData(opt); - - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::RsnUserCreateOutputObjects() -{ -// -// Rsn User Create Output Objects -// - - AliDebug(AliLog::kDebug+2,"<-"); - - AliDebug(AliLog::kDebug+2,"->"); -} - - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::UserCreateOutputObjects() -{ -// -// User Create Output Objects -// - - SetDebugForAllClasses(); - - AliDebug(AliLog::kDebug+2,"<-"); - - fInfoList = new TList(); - fInfoList->SetOwner(); - fTaskInfo.GenerateInfoList(fInfoList); - RsnUserCreateOutputObjects(); - - PostData(1, fInfoList); - - AliDebug(AliLog::kDebug+2,"<-"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::UserExec(Option_t* opt) -{ -// -// User Exec -// - - AliDebug(AliLog::kDebug+2,"<-"); - - RsnUserExec(opt); - - FillInfo(); - - fTaskInfo.PrintInfo(fEntry); - - PostData(1, fInfoList); - - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::RsnUserExec(Option_t*) -{ -// -// Rsn User Exec -// - - AliDebug(AliLog::kDebug+2,"<-"); - - if (!CheckAndPrintEvents()) return; - - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -Bool_t AliRsnVAnalysisTaskME::CheckAndPrintEvents() -{ -// -// Check for supported events -// return false in the case of unkown format -// or number of events is less or equal 1 -// - - AliInfo(Form("Current Entry %lld", Entry())); - Int_t nEvents = fInputHandler->GetBufferSize(); - if (nEvents <= 1) return kFALSE; - fESDEvent = dynamic_cast(GetEvent(0)); - fAODEvent = dynamic_cast(GetEvent(0)); - - if (fESDEvent) { - AliESDEvent **allESDEvents = new AliESDEvent*[nEvents]; - for (Int_t i = 0; i < nEvents; i++) { - allESDEvents[i] = dynamic_cast(GetEvent(i)); - if (!allESDEvents[i]) { - AliWarning(Form("Null ESD event in index %d", i)); - continue; - } - AliDebug(AliLog::kDebug, Form("ESD event %d has %d tracks", i, allESDEvents[i]->GetNumberOfTracks())); - } - } else if (fAODEvent) { - AliAODEvent **allAODEvents = new AliAODEvent*[nEvents]; - for (Int_t i = 0; i < nEvents; i++) { - allAODEvents[i] = dynamic_cast(GetEvent(i)); - if (!allAODEvents[i]) { - AliWarning(Form("Null AOD event in index %d", i)); - continue; - } - AliDebug(AliLog::kDebug, Form("AOD event %d has %d tracks", i, allAODEvents[i]->GetNumberOfTracks())); - } - } else { - AliWarning("Unknown input format"); - return kFALSE; - } - - return kTRUE; -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::Terminate(Option_t* opt) -{ -// -// Terminate -// - - AliDebug(AliLog::kDebug+2,"<-"); - AliAnalysisTask::Terminate(); - - fInfoList = dynamic_cast(GetOutputData(1)); - if (!fInfoList) { - AliError(Form("At end of analysis, fOutList is %p", fInfoList)); - return; - } - - RsnTerminate(opt); - - TH1I *hEventInfo = (TH1I*) fInfoList->FindObject(fTaskInfo.GetEventHistogramName()); - if (!hEventInfo) { - AliError(Form("hEventInfo is %p", hEventInfo)); - return; - } - - AliInfo(Form("=== %s ==================", GetName())); - AliInfo(Form("Number Of Events Processed : %10lld", (Long64_t)hEventInfo->Integral())); - AliInfo(Form("Number Of Events Accepted : %10lld", (Long64_t)hEventInfo->GetBinContent(2))); - AliInfo(Form("Number Of Events Skipped : %10lld", (Long64_t)hEventInfo->GetBinContent(1))); - AliInfo(Form("=== end %s ==============", GetName())); - - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::RsnTerminate(Option_t*) -{ -// -// RsnTerminate -// - - AliDebug(AliLog::kDebug+2,"<-"); - AliDebug(AliLog::kDebug+2,"->"); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::FillInfo() -{ -// -// Fills Info -// - - fTaskInfo.FillInfo(); -} - -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::SetLogType(AliLog::EType_t type, TString allClasses) -{ -// -// Sets Log Type -// - - AliDebug(AliLog::kDebug+2,"<-"); - fLogType = type; - fLogClassesString = allClasses; - AliDebug(AliLog::kDebug+2,"->"); -} -//_____________________________________________________________________________ -void AliRsnVAnalysisTaskME::SetDebugForAllClasses() -{ -// -// Set Debug For All Classes -// - - AliDebug(AliLog::kDebug+2,"<-"); - TObjArray* array = fLogClassesString.Tokenize(":"); - TObjString *str; - TString strr; - for (Int_t i = 0;i < array->GetEntriesFast();i++) { - str = (TObjString *) array->At(i); - strr = str->GetString(); - AliLog::SetClassDebugLevel(strr.Data(), fLogType); - AliInfo(Form("Setting Debug to %s", strr.Data())); - } - AliDebug(AliLog::kDebug+2,"->"); -} - diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTaskME.h b/PWG2/RESONANCES/AliRsnVAnalysisTaskME.h deleted file mode 100644 index 89cfc321b37..00000000000 --- a/PWG2/RESONANCES/AliRsnVAnalysisTaskME.h +++ /dev/null @@ -1,67 +0,0 @@ -// -// Class AliRsnVAnalysisTaskME -// -// Virtual Class derivated from AliAnalysisTaskME which will be base class -// for all RSN ME tasks -// -// authors: Martin Vala (martin.vala@cern.ch) -// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) -// -#ifndef ALIRSNVANALYSISTASKME_H -#define ALIRSNVANALYSISTASKME_H - -#include "AliLog.h" -#include "AliRsnVATProcessInfo.h" - -#include "AliAnalysisTaskME.h" - -class TH1; -class AliESDEvent; -class AliMCEvent; -class AliAODEvent; -class AliRsnVAnalysisTaskME : public AliAnalysisTaskME -{ - public: - - AliRsnVAnalysisTaskME(const char *name = "AliRsnVAnalysisTaskME"); - AliRsnVAnalysisTaskME(const AliRsnVAnalysisTaskME& copy); - AliRsnVAnalysisTaskME& operator= (const AliRsnVAnalysisTaskME& /*copy*/) { return *this; } - virtual ~AliRsnVAnalysisTaskME() {/* Does nothing*/} - - virtual void LocalInit(); - virtual Bool_t Notify(); - virtual void ConnectInputData(Option_t *opt); - // Implementation of interface methods - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t *opt); - virtual void Terminate(Option_t *opt); - - // Implement this - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t *opt); - virtual void RsnTerminate(Option_t *opt); - - virtual void FillInfo(); - - void SetLogType(AliLog::EType_t type, TString allClasses = ""); - void SetPrintInfoNumber(const Long64_t &num = 100) { fTaskInfo.SetPrintInfoNumber(num); } - Bool_t CheckAndPrintEvents(); - - protected: - - AliLog::EType_t fLogType; // log type - TString fLogClassesString;// all classes string divided with ":" - - AliESDEvent *fESDEvent; // AliVEvent event - AliMCEvent *fMCEvent; // ESD event - AliAODEvent *fAODEvent; // AOD event - - TList *fInfoList; //! output list for info - AliRsnVATProcessInfo fTaskInfo; // task info - - void SetDebugForAllClasses(); - - ClassDef(AliRsnVAnalysisTaskME, 1) -}; - -#endif diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx index 7720935058d..e7d2f082df6 100644 --- a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx +++ b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.cxx @@ -23,40 +23,40 @@ ClassImp(AliRsnVAnalysisTaskSE) //_____________________________________________________________________________ AliRsnVAnalysisTaskSE::AliRsnVAnalysisTaskSE (const char *name, Bool_t mcOnly) : - AliAnalysisTaskSE(name), - fLogType(AliLog::kInfo), - fLogClassesString(""), - fESDEvent(0x0), - fMCEvent(0x0), - fAODEventIn(0x0), - fAODEventOut(0x0), - fMCOnly(mcOnly), - fRsnEvent(), - fInfoList(0x0), - fTaskInfo(name) + AliAnalysisTaskSE(name), + fLogType(AliLog::kInfo), + fLogClassesString(""), + fESDEvent(0x0), + fMCEvent(0x0), + fAODEventIn(0x0), + fAODEventOut(0x0), + fMCOnly(mcOnly), + fRsnEvent(), + fInfoList(0x0), + fTaskInfo(name) { // // Default constructor. // Define the output slot for histograms. // - DefineOutput(1, TList::Class()); - DefineOutput(2, TList::Class()); + DefineOutput(1, TList::Class()); + DefineOutput(2, TList::Class()); } //_____________________________________________________________________________ AliRsnVAnalysisTaskSE::AliRsnVAnalysisTaskSE(const AliRsnVAnalysisTaskSE& copy) : - AliAnalysisTaskSE(copy), - fLogType(copy.fLogType), - fLogClassesString(copy.fLogClassesString), - fESDEvent(copy.fESDEvent), - fMCEvent(copy.fMCEvent), - fAODEventIn(copy.fAODEventIn), - fAODEventOut(copy.fAODEventOut), - fMCOnly(copy.fMCOnly), - fRsnEvent(), - fInfoList(0x0), - fTaskInfo(copy.fTaskInfo) + AliAnalysisTaskSE(copy), + fLogType(copy.fLogType), + fLogClassesString(copy.fLogClassesString), + fESDEvent(copy.fESDEvent), + fMCEvent(copy.fMCEvent), + fAODEventIn(copy.fAODEventIn), + fAODEventOut(copy.fAODEventOut), + fMCOnly(copy.fMCOnly), + fRsnEvent(), + fInfoList(0x0), + fTaskInfo(copy.fTaskInfo) { // // Copy constructor. @@ -72,8 +72,8 @@ void AliRsnVAnalysisTaskSE::LocalInit() // Defines the debug message level and calls the mother class LocalInit(). // - AliAnalysisTaskSE::LocalInit(); - SetDebugForAllClasses(); + AliAnalysisTaskSE::LocalInit(); + SetDebugForAllClasses(); } //_____________________________________________________________________________ @@ -83,7 +83,7 @@ Bool_t AliRsnVAnalysisTaskSE::UserNotify() // Calls the mother class Notify() // - return AliAnalysisTaskSE::UserNotify(); + return AliAnalysisTaskSE::UserNotify(); } //_____________________________________________________________________________ @@ -94,34 +94,31 @@ void AliRsnVAnalysisTaskSE::ConnectInputData(Option_t *opt) // the pointer to the input event, which is dynamically casted // to all available types, and this allows to know its type. // Calls also the mother class omonyme method. -// - - AliAnalysisTaskSE::ConnectInputData(opt); - - // get AliESDEvent and, if successful - // retrieve the corresponding MC if exists - fESDEvent = dynamic_cast(fInputEvent); - if (fESDEvent) - { - fMCEvent = (AliMCEvent*) MCEvent(); - AliInfo(Form("Input event is of type ESD (%p)", fESDEvent)); - if (fMCEvent) AliInfo(Form("Input has an associated MC (%p)", fMCEvent)); - } - - // get AliAODEvent from input and, if successful - // it will contain both the reconstructed and MC informations - fAODEventIn = dynamic_cast(fInputEvent); - if (fAODEventIn) - { - AliInfo(Form("Input event if of type native AOD (%p)", fAODEventIn)); - } - - // get AliAODEvent from output of previous task - fAODEventOut = dynamic_cast(AODEvent()); - if (fAODEventOut) - { - AliInfo(Form("Input event if of type produced AOD from previous step (%p)",fAODEventOut)); - } +// + + AliAnalysisTaskSE::ConnectInputData(opt); + + // get AliESDEvent and, if successful + // retrieve the corresponding MC if exists + fESDEvent = dynamic_cast(fInputEvent); + if (fESDEvent) { + fMCEvent = (AliMCEvent*) MCEvent(); + AliInfo(Form("Input event is of type ESD (%p)", fESDEvent)); + if (fMCEvent) AliInfo(Form("Input has an associated MC (%p)", fMCEvent)); + } + + // get AliAODEvent from input and, if successful + // it will contain both the reconstructed and MC informations + fAODEventIn = dynamic_cast(fInputEvent); + if (fAODEventIn) { + AliInfo(Form("Input event if of type native AOD (%p)", fAODEventIn)); + } + + // get AliAODEvent from output of previous task + fAODEventOut = dynamic_cast(AODEvent()); + if (fAODEventOut) { + AliInfo(Form("Input event if of type produced AOD from previous step (%p)", fAODEventOut)); + } } //_____________________________________________________________________________ @@ -134,17 +131,17 @@ void AliRsnVAnalysisTaskSE::UserCreateOutputObjects() // in the applications of this base class. // - SetDebugForAllClasses(); + SetDebugForAllClasses(); - // set event info outputs - fInfoList = new TList(); - fInfoList->SetOwner(); - fTaskInfo.GenerateInfoList(fInfoList); - - // create customized outputs - RsnUserCreateOutputObjects(); + // set event info outputs + fInfoList = new TList(); + fInfoList->SetOwner(); + fTaskInfo.GenerateInfoList(fInfoList); - PostData(1, fInfoList); + // create customized outputs + RsnUserCreateOutputObjects(); + + PostData(1, fInfoList); } //_____________________________________________________________________________ @@ -156,58 +153,48 @@ void AliRsnVAnalysisTaskSE::UserExec(Option_t* opt) // objects obtained from dynamic-casts called in ConnectInputData(). // - if (fMCOnly && fMCEvent) - { - fRsnEvent.SetRef (fMCEvent); - fRsnEvent.SetRefMC(fMCEvent); - } - else if (fESDEvent) - { - fRsnEvent.SetRef (fESDEvent); - fRsnEvent.SetRefMC(fMCEvent); - } - else if (fAODEventOut) - { - fRsnEvent.SetRef (fAODEventOut); - fRsnEvent.SetRefMC(fAODEventOut); - } - else if (fAODEventIn) - { - fRsnEvent.SetRef (fAODEventIn); - fRsnEvent.SetRefMC(fAODEventIn); - } - else - { - AliError("Unknown input event format. Skipping"); - return; - } - - // since this class is for single-event analysis - // both static pointers of AliRsnEvent class - // will point to the same unique datamember - AliRsnEvent::SetCurrentEvent1(&fRsnEvent, fEntry); - AliRsnEvent::SetCurrentEvent2(&fRsnEvent, fEntry); - AliRsnTarget::SwitchToFirst(); - - // call event preprocessing... - Bool_t preCheck = EventProcess(); - // ...then fill the information object and print informations... - fTaskInfo.FillInfo(); - fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); - // ...and return if event did not pass selections - if (!preCheck) - { - AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); - return; - } - - - // call customized implementation for execution - RsnUserExec(opt); - - // post outputs for the info object - // (eventually others are done in the derived classes) - PostData(1, fInfoList); + if (fMCOnly && fMCEvent) { + fRsnEvent.SetRef(fMCEvent); + fRsnEvent.SetRefMC(fMCEvent); + } else if (fESDEvent) { + fRsnEvent.SetRef(fESDEvent); + fRsnEvent.SetRefMC(fMCEvent); + } else if (fAODEventOut) { + fRsnEvent.SetRef(fAODEventOut); + fRsnEvent.SetRefMC(fAODEventOut); + } else if (fAODEventIn) { + fRsnEvent.SetRef(fAODEventIn); + fRsnEvent.SetRefMC(fAODEventIn); + } else { + AliError("Unknown input event format. Skipping"); + return; + } + + // since this class is for single-event analysis + // both static pointers of AliRsnEvent class + // will point to the same unique datamember + AliRsnEvent::SetCurrentEvent1(&fRsnEvent, fEntry); + AliRsnEvent::SetCurrentEvent2(&fRsnEvent, fEntry); + AliRsnTarget::SwitchToFirst(); + + // call event preprocessing... + Bool_t preCheck = EventProcess(); + // ...then fill the information object and print informations... + fTaskInfo.FillInfo(); + fTaskInfo.PrintInfo(fTaskInfo.GetNumerOfEventsProcessed()); + // ...and return if event did not pass selections + if (!preCheck) { + AliDebug(AliLog::kDebug, "Event preprocessing has failed. Skipping event"); + return; + } + + + // call customized implementation for execution + RsnUserExec(opt); + + // post outputs for the info object + // (eventually others are done in the derived classes) + PostData(1, fInfoList); } //_____________________________________________________________________________ @@ -219,30 +206,28 @@ void AliRsnVAnalysisTaskSE::Terminate(Option_t* opt) // and includes to the TList all task informations. // - AliAnalysisTask::Terminate(); - - TList* list = dynamic_cast(GetOutputData(1)); - if (!list) - { - AliError(Form("At end of analysis, fOutList is %p", list)); - return; - } - - RsnTerminate(opt); - - TH1I *hEventInfo = (TH1I*) list->FindObject(fTaskInfo.GetEventHistogramName()); - if (!hEventInfo) - { - AliError(Form("hEventInfo is %p", hEventInfo)); - return; - } - AliInfo(Form("=== %s ==================",GetName())); - AliInfo(Form("Number Of Events Processed : %10lld",(Long64_t)hEventInfo->Integral())); - AliInfo(Form("Number Of Events Accepted : %10lld",(Long64_t)hEventInfo->GetBinContent(2))); - AliInfo(Form("Number Of Events Skipped : %10lld",(Long64_t)hEventInfo->GetBinContent(1))); - AliInfo(Form("=== end %s ==============",GetName())); - - AliDebug(AliLog::kDebug+2, "->"); + AliAnalysisTask::Terminate(); + + TList* list = dynamic_cast(GetOutputData(1)); + if (!list) { + AliError(Form("At end of analysis, fOutList is %p", list)); + return; + } + + RsnTerminate(opt); + + TH1I *hEventInfo = (TH1I*) list->FindObject(fTaskInfo.GetEventHistogramName()); + if (!hEventInfo) { + AliError(Form("hEventInfo is %p", hEventInfo)); + return; + } + AliInfo(Form("=== %s ==================", GetName())); + AliInfo(Form("Number Of Events Processed : %10lld", (Long64_t)hEventInfo->Integral())); + AliInfo(Form("Number Of Events Accepted : %10lld", (Long64_t)hEventInfo->GetBinContent(2))); + AliInfo(Form("Number Of Events Skipped : %10lld", (Long64_t)hEventInfo->GetBinContent(1))); + AliInfo(Form("=== end %s ==============", GetName())); + + AliDebug(AliLog::kDebug + 2, "->"); } //_____________________________________________________________________________ @@ -254,7 +239,7 @@ void AliRsnVAnalysisTaskSE::RsnUserCreateOutputObjects() // in the used task. // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -264,7 +249,7 @@ void AliRsnVAnalysisTaskSE::RsnUserExec(Option_t*) // // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -274,7 +259,7 @@ void AliRsnVAnalysisTaskSE::RsnTerminate(Option_t*) // Overload this to add additional termination operations // - AliWarning("Implement this in derived classes"); + AliWarning("Implement this in derived classes"); } //_____________________________________________________________________________ @@ -282,12 +267,12 @@ Bool_t AliRsnVAnalysisTaskSE::EventProcess() { // // Performs some pre-processing of current event, -// which is useful for all the operations which +// which is useful for all the operations which // need to be done only once for each event. // - - // in this case, return always a success - return kTRUE; + + // in this case, return always a success + return kTRUE; } //_____________________________________________________________________________ @@ -297,17 +282,16 @@ void AliRsnVAnalysisTaskSE::SetDebugForAllClasses() // Set debug level for all classes for which it is required // - TObjArray *array = fLogClassesString.Tokenize(":"); - TObjString *objStr; - TString str; - Int_t i, n = array->GetEntriesFast(); - - for (i = 0; i < n; i++) - { - objStr = (TObjString*)array->At(i); - str = objStr->GetString(); - AliLog::SetClassDebugLevel(str.Data(), fLogType); - AliInfo(Form("Setting Debug to %s", str.Data())); - } + TObjArray *array = fLogClassesString.Tokenize(":"); + TObjString *objStr; + TString str; + Int_t i, n = array->GetEntriesFast(); + + for (i = 0; i < n; i++) { + objStr = (TObjString*)array->At(i); + str = objStr->GetString(); + AliLog::SetClassDebugLevel(str.Data(), fLogType); + AliInfo(Form("Setting Debug to %s", str.Data())); + } } diff --git a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h index e1560d23c59..d34df73bec2 100644 --- a/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h +++ b/PWG2/RESONANCES/AliRsnVAnalysisTaskSE.h @@ -22,59 +22,58 @@ class AliESDEvent; class AliAODEvent; class AliMCEvent; -class AliRsnVAnalysisTaskSE : public AliAnalysisTaskSE -{ - public: - - AliRsnVAnalysisTaskSE(const char *name = "AliRsnVAnalysisTaskSE", Bool_t mcOnly = kFALSE); - AliRsnVAnalysisTaskSE(const AliRsnVAnalysisTaskSE& copy); - AliRsnVAnalysisTaskSE& operator= (const AliRsnVAnalysisTaskSE& /*copy*/) { return *this; } - virtual ~AliRsnVAnalysisTaskSE() {/* Does nothing*/;} - - // basic interface methods - virtual void LocalInit(); - virtual Bool_t UserNotify(); - virtual void ConnectInputData(Option_t *opt); - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t* opt); - virtual void Terminate(Option_t* opt); - - // customized methods (to be implemented in derived classes) - virtual void RsnUserCreateOutputObjects(); - virtual void RsnUserExec(Option_t*); - virtual void RsnTerminate(Option_t*); - - // event pre-processing functions - virtual Bool_t EventProcess(); - - // getters - AliRsnEvent* GetRsnEvent() {return &fRsnEvent;} - AliRsnVATProcessInfo* GetInfo() {return &fTaskInfo;} - - // setters - void SetMCOnly(Bool_t mcOnly = kTRUE) {fMCOnly = mcOnly;} - void SetLogType(AliLog::EType_t type, const char *classes = "") {fLogType = type; fLogClassesString = classes;} - void SetPrintInfoNumber(const Long64_t &num = 100) {fTaskInfo.SetPrintInfoNumber(num);} - - protected: - - AliLog::EType_t fLogType; // log type - TString fLogClassesString; // all classes string divided with ":" - - AliESDEvent *fESDEvent; // ESD event - AliMCEvent *fMCEvent; // MC event - AliAODEvent *fAODEventIn; // AOD event from input - AliAODEvent *fAODEventOut; // AOD event from output from previous taks - - Bool_t fMCOnly; // use only MC information - AliRsnEvent fRsnEvent; // interface to event for RSN package - - TList *fInfoList; //! output list for informations - AliRsnVATProcessInfo fTaskInfo; // task info - - void SetDebugForAllClasses(); - - ClassDef(AliRsnVAnalysisTaskSE, 1) +class AliRsnVAnalysisTaskSE : public AliAnalysisTaskSE { +public: + + AliRsnVAnalysisTaskSE(const char *name = "AliRsnVAnalysisTaskSE", Bool_t mcOnly = kFALSE); + AliRsnVAnalysisTaskSE(const AliRsnVAnalysisTaskSE& copy); + AliRsnVAnalysisTaskSE& operator= (const AliRsnVAnalysisTaskSE& /*copy*/) { return *this; } + virtual ~AliRsnVAnalysisTaskSE() {/* Does nothing*/;} + + // basic interface methods + virtual void LocalInit(); + virtual Bool_t UserNotify(); + virtual void ConnectInputData(Option_t *opt); + virtual void UserCreateOutputObjects(); + virtual void UserExec(Option_t* opt); + virtual void Terminate(Option_t* opt); + + // customized methods (to be implemented in derived classes) + virtual void RsnUserCreateOutputObjects(); + virtual void RsnUserExec(Option_t*); + virtual void RsnTerminate(Option_t*); + + // event pre-processing functions + virtual Bool_t EventProcess(); + + // getters + AliRsnEvent* GetRsnEvent() {return &fRsnEvent;} + AliRsnVATProcessInfo* GetInfo() {return &fTaskInfo;} + + // setters + void SetMCOnly(Bool_t mcOnly = kTRUE) {fMCOnly = mcOnly;} + void SetLogType(AliLog::EType_t type, const char *classes = "") {fLogType = type; fLogClassesString = classes;} + void SetPrintInfoNumber(const Long64_t &num = 100) {fTaskInfo.SetPrintInfoNumber(num);} + +protected: + + AliLog::EType_t fLogType; // log type + TString fLogClassesString; // all classes string divided with ":" + + AliESDEvent *fESDEvent; // ESD event + AliMCEvent *fMCEvent; // MC event + AliAODEvent *fAODEventIn; // AOD event from input + AliAODEvent *fAODEventOut; // AOD event from output from previous taks + + Bool_t fMCOnly; // use only MC information + AliRsnEvent fRsnEvent; // interface to event for RSN package + + TList *fInfoList; //! output list for informations + AliRsnVATProcessInfo fTaskInfo; // task info + + void SetDebugForAllClasses(); + + ClassDef(AliRsnVAnalysisTaskSE, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnValue.cxx b/PWG2/RESONANCES/AliRsnValue.cxx index 67bdba33afc..82bf6d984c4 100644 --- a/PWG2/RESONANCES/AliRsnValue.cxx +++ b/PWG2/RESONANCES/AliRsnValue.cxx @@ -20,30 +20,30 @@ ClassImp(AliRsnValue) //_____________________________________________________________________________ AliRsnValue::AliRsnValue() : - AliRsnTarget(), - fComputedValue(0), - fValueType(kValueTypes), - fBinArray(0), - fSupportObject(0x0) + AliRsnTarget(), + fComputedValue(0), + fValueType(kValueTypes), + fBinArray(0), + fSupportObject(0x0) { // // Default constructor without arguments. // Initialize data members to meaningless values. -// This method is provided for ROOT streaming, +// This method is provided for ROOT streaming, // but should never be used directly by a user. // - AssignTarget(); + AssignTarget(); } //_____________________________________________________________________________ AliRsnValue::AliRsnValue (const char *name, EValueType type, Int_t nbins, Double_t min, Double_t max) : - AliRsnTarget(name, AliRsnTarget::kTargetTypes), - fComputedValue(0.0), - fValueType(type), - fBinArray(0), - fSupportObject(0x0) + AliRsnTarget(name, AliRsnTarget::kTargetTypes), + fComputedValue(0.0), + fValueType(type), + fBinArray(0), + fSupportObject(0x0) { // // Main constructor (version 1). @@ -57,18 +57,18 @@ AliRsnValue::AliRsnValue // binning array, in order not to allocate memory when this is useless. // - AssignTarget(); - SetBins(nbins, min, max); + AssignTarget(); + SetBins(nbins, min, max); } //_____________________________________________________________________________ AliRsnValue::AliRsnValue (const char *name, EValueType type, Double_t min, Double_t max, Double_t step) : - AliRsnTarget(name, AliRsnTarget::kTargetTypes), - fComputedValue(0.0), - fValueType(type), - fBinArray(0), - fSupportObject(0x0) + AliRsnTarget(name, AliRsnTarget::kTargetTypes), + fComputedValue(0.0), + fValueType(type), + fBinArray(0), + fSupportObject(0x0) { // // Main constructor (version 2). @@ -77,18 +77,18 @@ AliRsnValue::AliRsnValue // the required interval. // - AssignTarget(); - SetBins(min, max, step); + AssignTarget(); + SetBins(min, max, step); } //_____________________________________________________________________________ AliRsnValue::AliRsnValue (const char *name, EValueType type, Int_t nbins, Double_t *array) : - AliRsnTarget(name, AliRsnTarget::kTargetTypes), - fComputedValue(0.0), - fValueType(type), - fBinArray(0), - fSupportObject(0x0) + AliRsnTarget(name, AliRsnTarget::kTargetTypes), + fComputedValue(0.0), + fValueType(type), + fBinArray(0), + fSupportObject(0x0) { // // Main constructor (version 3). @@ -96,26 +96,26 @@ AliRsnValue::AliRsnValue // and creates a set of variable bins delimited by the passed array. // - AssignTarget(); - SetBins(nbins, array); + AssignTarget(); + SetBins(nbins, array); } //_____________________________________________________________________________ -AliRsnValue::AliRsnValue(const AliRsnValue& copy) : - AliRsnTarget(copy), - fComputedValue(copy.fComputedValue), - fValueType(copy.fValueType), - fBinArray(copy.fBinArray), - fSupportObject(copy.fSupportObject) +AliRsnValue::AliRsnValue(const AliRsnValue& copy) : + AliRsnTarget(copy), + fComputedValue(copy.fComputedValue), + fValueType(copy.fValueType), + fBinArray(copy.fBinArray), + fSupportObject(copy.fSupportObject) { // // Copy constructor. // Duplicates the binning array and copies all settings. -// Calls also the function that assigns properly the +// Calls also the function that assigns properly the // expected target, depending on the computation type. // - AssignTarget(); + AssignTarget(); } //_____________________________________________________________________________ @@ -126,15 +126,15 @@ AliRsnValue& AliRsnValue::operator=(const AliRsnValue& copy) // Works like copy constructor. // - AliRsnTarget::operator=(copy); - - fComputedValue = copy.fComputedValue; - fBinArray = copy.fBinArray; - fSupportObject = copy.fSupportObject; - - AssignTarget(); - - return (*this); + AliRsnTarget::operator=(copy); + + fComputedValue = copy.fComputedValue; + fBinArray = copy.fBinArray; + fSupportObject = copy.fSupportObject; + + AssignTarget(); + + return (*this); } //_____________________________________________________________________________ @@ -145,22 +145,21 @@ void AliRsnValue::SetBins(Int_t nbins, Double_t min, Double_t max) // where the number of bins, minimum and maximum are given. // - if (!nbins) - { - fBinArray.Set(0); - return; - } - - fBinArray.Set(nbins + 1); - - Double_t mymax = TMath::Max(min, max); - Double_t mymin = TMath::Min(min, max); - - Int_t k = 0; - Double_t binSize = (mymax - mymin) / ((Double_t)nbins); - - fBinArray[0] = mymin; - for (k = 1; k <= nbins; k++) fBinArray[k] = fBinArray[k-1] + binSize; + if (!nbins) { + fBinArray.Set(0); + return; + } + + fBinArray.Set(nbins + 1); + + Double_t mymax = TMath::Max(min, max); + Double_t mymin = TMath::Min(min, max); + + Int_t k = 0; + Double_t binSize = (mymax - mymin) / ((Double_t)nbins); + + fBinArray[0] = mymin; + for (k = 1; k <= nbins; k++) fBinArray[k] = fBinArray[k - 1] + binSize; } //_____________________________________________________________________________ @@ -171,10 +170,10 @@ void AliRsnValue::SetBins(Double_t min, Double_t max, Double_t step) // where the bin size, minimum and maximum are given. // - Double_t dblNbins = TMath::Abs(max - min) / step; - Int_t intNbins = ((Int_t)dblNbins) + 1; - - SetBins(intNbins, min, max); + Double_t dblNbins = TMath::Abs(max - min) / step; + Int_t intNbins = ((Int_t)dblNbins) + 1; + + SetBins(intNbins, min, max); } //_____________________________________________________________________________ @@ -185,13 +184,12 @@ void AliRsnValue::SetBins(Int_t nbins, Double_t *array) // using the same way it is done in TAxis // - if (!nbins) - { - fBinArray.Set(0); - return; - } - - fBinArray.Adopt(nbins, array); + if (!nbins) { + fBinArray.Set(0); + return; + } + + fBinArray.Adopt(nbins, array); } //_____________________________________________________________________________ @@ -201,39 +199,38 @@ const char* AliRsnValue::GetValueTypeName() const // This method returns a string to give a name to each possible // computation value. // - - switch (fValueType) - { - case kTrackP: return "SingleTrackPtot"; - case kTrackPt: return "SingleTrackPt"; - case kTrackEta: return "SingleTrackEta"; - case kPairP1: return "PairPtotDaughter1"; - case kPairP2: return "PairPtotDaughter2"; - case kPairP1t: return "PairPtDaughter1"; - case kPairP2t: return "PairPtDaughter2"; - case kPairP1z: return "PairPzDaughter1"; - case kPairP2z: return "PairPzDaughter2"; - case kPairInvMass: return "PairInvMass"; - case kPairInvMassMC: return "PairInvMassMC"; - case kPairInvMassRes: return "PairInvMassResolution"; - case kPairPt: return "PairPt"; - case kPairPz: return "PairPz"; - case kPairEta: return "PairEta"; - case kPairMt: return "PairMt"; - case kPairY: return "PairY"; - case kPairPhi: return "PairPhi"; - case kPairPhiMC: return "PairPhiMC"; - case kPairPtRatio: return "PairPtRatio"; - case kPairDipAngle: return "PairDipAngle"; - case kPairCosThetaStar: return "PairCosThetaStar"; - case kPairQInv: return "PairQInv"; - case kPairAngleToLeading: return "PairAngleToLeading"; - case kEventLeadingPt: return "EventLeadingPt"; - case kEventMult: return "EventMult"; - case kEventMultESDCuts: return "EventMultESDCuts"; - case kEventVz: return "EventVz"; - default: return "Undefined"; - } + + switch (fValueType) { + case kTrackP: return "SingleTrackPtot"; + case kTrackPt: return "SingleTrackPt"; + case kTrackEta: return "SingleTrackEta"; + case kPairP1: return "PairPtotDaughter1"; + case kPairP2: return "PairPtotDaughter2"; + case kPairP1t: return "PairPtDaughter1"; + case kPairP2t: return "PairPtDaughter2"; + case kPairP1z: return "PairPzDaughter1"; + case kPairP2z: return "PairPzDaughter2"; + case kPairInvMass: return "PairInvMass"; + case kPairInvMassMC: return "PairInvMassMC"; + case kPairInvMassRes: return "PairInvMassResolution"; + case kPairPt: return "PairPt"; + case kPairPz: return "PairPz"; + case kPairEta: return "PairEta"; + case kPairMt: return "PairMt"; + case kPairY: return "PairY"; + case kPairPhi: return "PairPhi"; + case kPairPhiMC: return "PairPhiMC"; + case kPairPtRatio: return "PairPtRatio"; + case kPairDipAngle: return "PairDipAngle"; + case kPairCosThetaStar: return "PairCosThetaStar"; + case kPairQInv: return "PairQInv"; + case kPairAngleToLeading: return "PairAngleToLeading"; + case kEventLeadingPt: return "EventLeadingPt"; + case kEventMult: return "EventMult"; + case kEventMultESDCuts: return "EventMultESDCuts"; + case kEventVz: return "EventVz"; + default: return "Undefined"; + } } //_____________________________________________________________________________ @@ -243,50 +240,49 @@ void AliRsnValue::AssignTarget() // This method assigns the target to be expected by this object // in the computation, depending on its type chosen in the enum. // - - switch (fValueType) - { - // track related values - case kTrackP: - case kTrackPt: - case kTrackEta: - SetTargetType(AliRsnTarget::kDaughter); // end of track-related values - break; - // pair related values - case kPairP1: - case kPairP2: - case kPairP1t: - case kPairP2t: - case kPairP1z: - case kPairP2z: - case kPairInvMass: - case kPairInvMassMC: - case kPairInvMassRes: - case kPairPt: - case kPairPz: - case kPairEta: - case kPairMt: - case kPairY: - case kPairPhi: - case kPairPhiMC: - case kPairPtRatio: - case kPairDipAngle: - case kPairCosThetaStar: - case kPairQInv: - case kPairAngleToLeading: - SetTargetType(AliRsnTarget::kMother); // end of pair-related values - break; - // event related values - case kEventLeadingPt: - case kEventMult: - case kEventMultESDCuts: - case kEventVz: - SetTargetType(AliRsnTarget::kEvent); // end of event-related values - break; - // undefined value - default: - SetTargetType(AliRsnTarget::kTargetTypes); // undefined targets - } + + switch (fValueType) { + // track related values + case kTrackP: + case kTrackPt: + case kTrackEta: + SetTargetType(AliRsnTarget::kDaughter); // end of track-related values + break; + // pair related values + case kPairP1: + case kPairP2: + case kPairP1t: + case kPairP2t: + case kPairP1z: + case kPairP2z: + case kPairInvMass: + case kPairInvMassMC: + case kPairInvMassRes: + case kPairPt: + case kPairPz: + case kPairEta: + case kPairMt: + case kPairY: + case kPairPhi: + case kPairPhiMC: + case kPairPtRatio: + case kPairDipAngle: + case kPairCosThetaStar: + case kPairQInv: + case kPairAngleToLeading: + SetTargetType(AliRsnTarget::kMother); // end of pair-related values + break; + // event related values + case kEventLeadingPt: + case kEventMult: + case kEventMultESDCuts: + case kEventVz: + SetTargetType(AliRsnTarget::kEvent); // end of event-related values + break; + // undefined value + default: + SetTargetType(AliRsnTarget::kTargetTypes); // undefined targets + } } //_____________________________________________________________________________ @@ -300,217 +296,194 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC) // and the values must be taken with GetValue(). // - // cast the input to the allowed types - AliRsnDaughter *daughter = dynamic_cast(object); - AliRsnMother *mother = dynamic_cast(object); - - // common variables - TLorentzVector pRec; // 4-momentum for single track or pair sum (reco) - TLorentzVector pSim; // 4-momentum for single track or pair sum (MC) - TLorentzVector pRec0; // 4-momentum of first daughter (reco) - TLorentzVector pSim0; // 4-momentum of first daughter (MC) - TLorentzVector pRec1; // 4-momentum of second daughter (reco) - TLorentzVector pSim1; // 4-momentum of second daughter (MC) - - // check that the input object is the correct class type - switch (fTargetType) - { - case AliRsnTarget::kDaughter: - if (daughter) - { - pRec = daughter->Psim(); - pSim = daughter->Prec(); - } - else - { - AliError(Form("[%s] expected: AliRsnDaughter, passed: [%s]", GetName(), object->ClassName())); - return kFALSE; - } - break; - case AliRsnTarget::kMother: - if (mother) - { - pRec = mother->Sum(); - pSim = mother->SumMC(); - pRec0 = mother->GetDaughter(0)->Prec(); - pRec1 = mother->GetDaughter(1)->Prec(); - pSim0 = mother->GetDaughter(0)->Psim(); - pSim1 = mother->GetDaughter(1)->Psim(); - } - else - { - AliError(Form("[%s] expected: AliRsnMother, passed: [%s]", GetName(), object->ClassName())); - return kFALSE; - } - break; - case AliRsnTarget::kEvent: - if (!AliRsnTarget::GetCurrentEvent()) - { - AliError(Form("[%s] expected: AliRsnEvent, passed: [%s]", GetName(), object->ClassName())); - return kFALSE; - } - break; - default: - AliError(Form("[%s] Wrong type", GetName())); - return kFALSE; - } - - // cast the support object to the types which could be needed - AliESDtrackCuts *esdCuts = dynamic_cast(fSupportObject); - AliRsnPairDef *pairDef = dynamic_cast(fSupportObject); - - // compute value depending on type - switch (fValueType) - { - case kTrackP: - fComputedValue = useMC ? pSim.Mag() : pRec.Mag(); - break; - case kTrackPt: - fComputedValue = useMC ? pSim.Perp() : pRec.Perp(); - break; - case kTrackEta: - fComputedValue = useMC ? pSim.Eta() : pRec.Eta(); - break; - case kPairP1: - fComputedValue = useMC ? pSim0.Mag() : pRec0.Mag(); - break; - case kPairP2: - fComputedValue = useMC ? pSim1.Mag() : pRec1.Mag(); - break; - case kPairP1t: - fComputedValue = useMC ? pSim0.Perp() : pRec0.Perp(); - break; - case kPairP2t: - fComputedValue = useMC ? pSim1.Perp() : pRec1.Perp(); - break; - case kPairP1z: - fComputedValue = useMC ? pSim0.Z() : pRec0.Z(); - break; - case kPairP2z: - fComputedValue = useMC ? pSim1.Z() : pRec1.Z(); - break; - case kPairInvMass: - fComputedValue = useMC ? pSim.M() : pRec.M(); - break; - case kPairInvMassRes: - fComputedValue = (pSim.M() - pRec.M()) / pSim.M(); - break; - case kPairPt: - fComputedValue = useMC ? pSim.Perp() : pRec.Perp(); - break; - case kPairEta: - fComputedValue = useMC ? pSim.Eta() : pRec.Eta(); - break; - case kPairMt: - // for this computation, replace the computed mass with the default mass - // for doing this, an initialized pairDef is required to get the mass - if (!pairDef) - { - AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName())); - fComputedValue = 1E+10; - return kFALSE; - } - else - { - pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass()); - pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass()); - fComputedValue = useMC ? pSim.Mt() : pRec.Mt(); - } - break; - case kPairY: - // for this computation, replace the computed mass with the default mass - // for doing this, an initialized pairDef is required to get the mass - if (!pairDef) - { - AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName())); - fComputedValue = 1E+10; - return kFALSE; - } - else - { - pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass()); - pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass()); - fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity(); - } - break; - case kPairPhi: - fComputedValue = useMC ? pSim.Phi() : pRec.Phi(); - break; - case kPairPtRatio: - if (useMC) - { - fComputedValue = TMath::Abs(pSim0.Perp() - pSim1.Perp()); - fComputedValue /= TMath::Abs(pSim0.Perp() + pSim1.Perp()); - } - else - { - fComputedValue = TMath::Abs(pRec0.Perp() - pRec1.Perp()); - fComputedValue /= TMath::Abs(pRec0.Perp() + pRec1.Perp()); - } - break; - case kPairDipAngle: - fComputedValue = useMC ? pSim0.Angle(pSim1.Vect()) : pRec0.Angle(pRec1.Vect()); - fComputedValue = TMath::Abs(TMath::Cos(fComputedValue)); - break; - case kPairCosThetaStar: - fComputedValue = mother->CosThetaStar(useMC); - break; - case kPairQInv: - pSim0 -= pSim1; - pRec0 -= pRec1; - fComputedValue = useMC ? pSim0.M() : pRec0.M(); - break; - case kPairAngleToLeading: - { - AliRsnEvent *event = AliRsnTarget::GetCurrentEvent(); - int ID1 = (mother->GetDaughter(0))->GetID(); - int ID2 = (mother->GetDaughter(1))->GetID(); - //int leadingID = event->SelectLeadingParticle(0); - Int_t leadingID = event->GetLeadingParticleID(); - if (leadingID == ID1 || leadingID == ID2) return kFALSE; - AliRsnDaughter leadingPart = event->GetDaughter(leadingID); - AliVParticle *ref = leadingPart.GetRef(); - fComputedValue = ref->Phi() - mother->Sum().Phi(); - //return angle w.r.t. leading particle in the range -pi/2, 3/2pi - while(fComputedValue >= TMath::Pi()) fComputedValue -= 2*TMath::Pi(); - while(fComputedValue < -0.5*TMath::Pi()) fComputedValue += 2*TMath::Pi(); - //Printf("%g", fComputedValue); - } - break; - case kEventMult: - fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(0x0); - break; - case kEventMultESDCuts: - // this value requires an initialized ESDtrackCuts - if (!esdCuts) - { - AliError(Form("[%s] Required a correctly initialized ESDtrackCuts to compute this value", GetName())); - fComputedValue = 1E+10; - return kFALSE; + // cast the input to the allowed types + AliRsnDaughter *daughter = dynamic_cast(object); + AliRsnMother *mother = dynamic_cast(object); + + // common variables + TLorentzVector pRec; // 4-momentum for single track or pair sum (reco) + TLorentzVector pSim; // 4-momentum for single track or pair sum (MC) + TLorentzVector pRec0; // 4-momentum of first daughter (reco) + TLorentzVector pSim0; // 4-momentum of first daughter (MC) + TLorentzVector pRec1; // 4-momentum of second daughter (reco) + TLorentzVector pSim1; // 4-momentum of second daughter (MC) + + // check that the input object is the correct class type + switch (fTargetType) { + case AliRsnTarget::kDaughter: + if (daughter) { + pRec = daughter->Psim(); + pSim = daughter->Prec(); + } else { + AliError(Form("[%s] expected: AliRsnDaughter, passed: [%s]", GetName(), object->ClassName())); + return kFALSE; + } + break; + case AliRsnTarget::kMother: + if (mother) { + pRec = mother->Sum(); + pSim = mother->SumMC(); + pRec0 = mother->GetDaughter(0)->Prec(); + pRec1 = mother->GetDaughter(1)->Prec(); + pSim0 = mother->GetDaughter(0)->Psim(); + pSim1 = mother->GetDaughter(1)->Psim(); + } else { + AliError(Form("[%s] expected: AliRsnMother, passed: [%s]", GetName(), object->ClassName())); + return kFALSE; + } + break; + case AliRsnTarget::kEvent: + if (!AliRsnTarget::GetCurrentEvent()) { + AliError(Form("[%s] expected: AliRsnEvent, passed: [%s]", GetName(), object->ClassName())); + return kFALSE; + } + break; + default: + AliError(Form("[%s] Wrong type", GetName())); + return kFALSE; + } + + // cast the support object to the types which could be needed + AliESDtrackCuts *esdCuts = dynamic_cast(fSupportObject); + AliRsnPairDef *pairDef = dynamic_cast(fSupportObject); + + // compute value depending on type + switch (fValueType) { + case kTrackP: + fComputedValue = useMC ? pSim.Mag() : pRec.Mag(); + break; + case kTrackPt: + fComputedValue = useMC ? pSim.Perp() : pRec.Perp(); + break; + case kTrackEta: + fComputedValue = useMC ? pSim.Eta() : pRec.Eta(); + break; + case kPairP1: + fComputedValue = useMC ? pSim0.Mag() : pRec0.Mag(); + break; + case kPairP2: + fComputedValue = useMC ? pSim1.Mag() : pRec1.Mag(); + break; + case kPairP1t: + fComputedValue = useMC ? pSim0.Perp() : pRec0.Perp(); + break; + case kPairP2t: + fComputedValue = useMC ? pSim1.Perp() : pRec1.Perp(); + break; + case kPairP1z: + fComputedValue = useMC ? pSim0.Z() : pRec0.Z(); + break; + case kPairP2z: + fComputedValue = useMC ? pSim1.Z() : pRec1.Z(); + break; + case kPairInvMass: + fComputedValue = useMC ? pSim.M() : pRec.M(); + break; + case kPairInvMassRes: + fComputedValue = (pSim.M() - pRec.M()) / pSim.M(); + break; + case kPairPt: + fComputedValue = useMC ? pSim.Perp() : pRec.Perp(); + break; + case kPairEta: + fComputedValue = useMC ? pSim.Eta() : pRec.Eta(); + break; + case kPairMt: + // for this computation, replace the computed mass with the default mass + // for doing this, an initialized pairDef is required to get the mass + if (!pairDef) { + AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName())); + fComputedValue = 1E+10; + return kFALSE; + } else { + pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass()); + pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass()); + fComputedValue = useMC ? pSim.Mt() : pRec.Mt(); + } + break; + case kPairY: + // for this computation, replace the computed mass with the default mass + // for doing this, an initialized pairDef is required to get the mass + if (!pairDef) { + AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName())); + fComputedValue = 1E+10; + return kFALSE; + } else { + pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass()); + pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass()); + fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity(); + } + break; + case kPairPhi: + fComputedValue = useMC ? pSim.Phi() : pRec.Phi(); + break; + case kPairPtRatio: + if (useMC) { + fComputedValue = TMath::Abs(pSim0.Perp() - pSim1.Perp()); + fComputedValue /= TMath::Abs(pSim0.Perp() + pSim1.Perp()); + } else { + fComputedValue = TMath::Abs(pRec0.Perp() - pRec1.Perp()); + fComputedValue /= TMath::Abs(pRec0.Perp() + pRec1.Perp()); + } + break; + case kPairDipAngle: + fComputedValue = useMC ? pSim0.Angle(pSim1.Vect()) : pRec0.Angle(pRec1.Vect()); + fComputedValue = TMath::Abs(TMath::Cos(fComputedValue)); + break; + case kPairCosThetaStar: + fComputedValue = mother->CosThetaStar(useMC); + break; + case kPairQInv: + pSim0 -= pSim1; + pRec0 -= pRec1; + fComputedValue = useMC ? pSim0.M() : pRec0.M(); + break; + case kPairAngleToLeading: { + AliRsnEvent *event = AliRsnTarget::GetCurrentEvent(); + int ID1 = (mother->GetDaughter(0))->GetID(); + int ID2 = (mother->GetDaughter(1))->GetID(); + //int leadingID = event->SelectLeadingParticle(0); + Int_t leadingID = event->GetLeadingParticleID(); + if (leadingID == ID1 || leadingID == ID2) return kFALSE; + AliRsnDaughter leadingPart = event->GetDaughter(leadingID); + AliVParticle *ref = leadingPart.GetRef(); + fComputedValue = ref->Phi() - mother->Sum().Phi(); + //return angle w.r.t. leading particle in the range -pi/2, 3/2pi + while (fComputedValue >= TMath::Pi()) fComputedValue -= 2 * TMath::Pi(); + while (fComputedValue < -0.5 * TMath::Pi()) fComputedValue += 2 * TMath::Pi(); + //Printf("%g", fComputedValue); } - fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(esdCuts); break; - case kEventLeadingPt: - { - int leadingID = AliRsnTarget::GetCurrentEvent()->GetLeadingParticleID(); //fEvent->SelectLeadingParticle(0); - if(leadingID >= 0) - { - AliRsnDaughter leadingPart = AliRsnTarget::GetCurrentEvent()->GetDaughter(leadingID); - AliVParticle *ref = leadingPart.GetRef(); - fComputedValue = ref->Pt(); - } - else fComputedValue = 0; + case kEventMult: + fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(0x0); + break; + case kEventMultESDCuts: + // this value requires an initialized ESDtrackCuts + if (!esdCuts) { + AliError(Form("[%s] Required a correctly initialized ESDtrackCuts to compute this value", GetName())); + fComputedValue = 1E+10; + return kFALSE; + } + fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(esdCuts); + break; + case kEventLeadingPt: { + int leadingID = AliRsnTarget::GetCurrentEvent()->GetLeadingParticleID(); //fEvent->SelectLeadingParticle(0); + if (leadingID >= 0) { + AliRsnDaughter leadingPart = AliRsnTarget::GetCurrentEvent()->GetDaughter(leadingID); + AliVParticle *ref = leadingPart.GetRef(); + fComputedValue = ref->Pt(); + } else fComputedValue = 0; } break; - case kEventVz: - fComputedValue = AliRsnTarget::GetCurrentEvent()->GetRef()->GetPrimaryVertex()->GetZ(); - break; - default: - AliError(Form("[%s] Invalid value type for this computation", GetName())); - return kFALSE; - } - - return kTRUE; + case kEventVz: + fComputedValue = AliRsnTarget::GetCurrentEvent()->GetRef()->GetPrimaryVertex()->GetZ(); + break; + default: + AliError(Form("[%s] Invalid value type for this computation", GetName())); + return kFALSE; + } + + return kTRUE; } //_____________________________________________________________________________ @@ -520,15 +493,14 @@ void AliRsnValue::Print(Option_t * /*option */) const // Print informations about this object // - AliInfo("=== VALUE INFO ================================================="); - AliInfo(Form(" Name : %s", GetName())); - AliInfo(Form(" Type : %s", GetValueTypeName())); - AliInfo(Form(" Current computed value: %f", fComputedValue)); - Int_t i; - for (i = 0; i < fBinArray.GetSize(); i++) - { - AliInfo(Form(" Bin limit #%d = %f", i, fBinArray[i])); - } - AliInfo(Form(" Support object : %s", (fSupportObject ? fSupportObject->ClassName() : " NO SUPPORT"))); - AliInfo("=== END VALUE INFO ============================================="); + AliInfo("=== VALUE INFO ================================================="); + AliInfo(Form(" Name : %s", GetName())); + AliInfo(Form(" Type : %s", GetValueTypeName())); + AliInfo(Form(" Current computed value: %f", fComputedValue)); + Int_t i; + for (i = 0; i < fBinArray.GetSize(); i++) { + AliInfo(Form(" Bin limit #%d = %f", i, fBinArray[i])); + } + AliInfo(Form(" Support object : %s", (fSupportObject ? fSupportObject->ClassName() : " NO SUPPORT"))); + AliInfo("=== END VALUE INFO ============================================="); } diff --git a/PWG2/RESONANCES/AliRsnValue.h b/PWG2/RESONANCES/AliRsnValue.h index 7d9bb353c30..d88769dbeb7 100644 --- a/PWG2/RESONANCES/AliRsnValue.h +++ b/PWG2/RESONANCES/AliRsnValue.h @@ -3,7 +3,7 @@ // // This class implements all the computations which could be useful // during the analysis, both for cuts and for output histograms. -// +// // It inherits from the AliRsnTarget base class since it can operate // on tracks, pairs and events, and the kind of expected object to // be processed depends on the kind of requested computation. @@ -18,14 +18,12 @@ #include "TArrayD.h" #include "AliRsnTarget.h" -class AliRsnValue : public AliRsnTarget -{ - public: - - // this enumeration lists all available computations - // any user feedback proposing new ones is welcome - enum EValueType - { +class AliRsnValue : public AliRsnTarget { +public: + + // this enumeration lists all available computations + // any user feedback proposing new ones is welcome + enum EValueType { kTrackP, // single track total momentum kTrackPt, // single track transverse momentum kTrackEta, // single track pseudo-rapidity @@ -54,48 +52,48 @@ class AliRsnValue : public AliRsnTarget kEventMult, // multiplicity computed as the number of tracks kEventMultESDCuts, // multiplicity computed as the number of track passing an ESD quality cut (need this cut defined) kEventVz, // Z position of event primary vertex - + kValueTypes // last value is used to have a meaningless enum value for initializations - }; + }; + + AliRsnValue(); + AliRsnValue(const char *name, EValueType type, Int_t nbins = 0, Double_t min = 0.0, Double_t max = 0.0); + AliRsnValue(const char *name, EValueType type, Double_t min, Double_t max, Double_t step); + AliRsnValue(const char *name, EValueType type, Int_t nbins, Double_t *array); + AliRsnValue(const AliRsnValue& copy); + AliRsnValue& operator=(const AliRsnValue& copy); + virtual ~AliRsnValue() { /*does nothing, since pointers are not owned by this object*/ } + + TArrayD GetArray() const {return fBinArray;} + Double_t GetComputedValue() const {return fComputedValue;} + EValueType GetValueType() const {return fValueType;} + const char* GetValueTypeName() const; + TObject* GetSupportObject() {return fSupportObject;} + void SetSupportObject(TObject *obj) {fSupportObject = obj;} + void SetValueType(EValueType type) {fValueType = type;} + void AssignTarget(); + + void SetBins(Int_t n, Double_t min, Double_t max); + void SetBins(Int_t n, Double_t *array); + void SetBins(Double_t min, Double_t max, Double_t step); + + void Set(EValueType type, Int_t n, Double_t min, Double_t max) {fValueType = type; AssignTarget(); SetBins(n, min, max);} + void Set(EValueType type, Int_t n, Double_t *array) {fValueType = type; AssignTarget(); SetBins(n, array);} + void Set(EValueType type, Double_t min, Double_t max, Double_t step) {fValueType = type; AssignTarget(); SetBins(min, max, step);} + + + virtual Bool_t Eval(TObject *object, Bool_t useMC = kFALSE); + virtual void Print(Option_t *option = "") const; + +protected: - AliRsnValue(); - AliRsnValue(const char *name, EValueType type, Int_t nbins = 0, Double_t min = 0.0, Double_t max = 0.0); - AliRsnValue(const char *name, EValueType type, Double_t min, Double_t max, Double_t step); - AliRsnValue(const char *name, EValueType type, Int_t nbins, Double_t *array); - AliRsnValue(const AliRsnValue& copy); - AliRsnValue& operator=(const AliRsnValue& copy); - virtual ~AliRsnValue() { /*does nothing, since pointers are not owned by this object*/ } - - TArrayD GetArray() const {return fBinArray;} - Double_t GetComputedValue() const {return fComputedValue;} - EValueType GetValueType() const {return fValueType;} - const char* GetValueTypeName() const; - TObject* GetSupportObject() {return fSupportObject;} - void SetSupportObject(TObject *obj) {fSupportObject = obj;} - void SetValueType(EValueType type) {fValueType = type;} - void AssignTarget(); - - void SetBins(Int_t n, Double_t min, Double_t max); - void SetBins(Int_t n, Double_t *array); - void SetBins(Double_t min, Double_t max, Double_t step); - - void Set(EValueType type, Int_t n, Double_t min, Double_t max) {fValueType = type; AssignTarget(); SetBins(n, min, max);} - void Set(EValueType type, Int_t n, Double_t *array) {fValueType = type; AssignTarget(); SetBins(n, array);} - void Set(EValueType type, Double_t min, Double_t max, Double_t step) {fValueType = type; AssignTarget(); SetBins(min, max, step);} - - - virtual Bool_t Eval(TObject *object, Bool_t useMC = kFALSE); - virtual void Print(Option_t *option = "") const; + Double_t fComputedValue; // computed value + EValueType fValueType; // value type + TArrayD fBinArray; // array of bins (when used for a histogram axis) + TObject *fSupportObject; // support object needed for computing some of the values - protected: - - Double_t fComputedValue; // computed value - EValueType fValueType; // value type - TArrayD fBinArray; // array of bins (when used for a histogram axis) - TObject *fSupportObject; // support object needed for computing some of the values - - // ROOT dictionary - ClassDef(AliRsnValue, 2) + // ROOT dictionary + ClassDef(AliRsnValue, 2) }; #endif diff --git a/PWG2/RESONANCES/AliRsnVariableExpression.cxx b/PWG2/RESONANCES/AliRsnVariableExpression.cxx index 8d11e4a6ef6..283ed552a1e 100644 --- a/PWG2/RESONANCES/AliRsnVariableExpression.cxx +++ b/PWG2/RESONANCES/AliRsnVariableExpression.cxx @@ -19,9 +19,9 @@ Bool_t AliRsnVariableExpression::Value(TObjArray& /*pgm*/) { // Int_t indexx = fgCutSet->GetIndexByCutName ( fVname.Data() ); - AliDebug(AliLog::kDebug,Form("Vname %s",fVname.Data())); + AliDebug(AliLog::kDebug, Form("Vname %s", fVname.Data())); // return fgCutSet->GetBoolValue ( indexx ); - return fgCutSet->GetBoolValue(fVname.Atoi()); + return fgCutSet->GetBoolValue(fVname.Atoi()); } diff --git a/PWG2/RESONANCES/AliRsnVariableExpression.h b/PWG2/RESONANCES/AliRsnVariableExpression.h index fc11baa0017..8a15b0db796 100644 --- a/PWG2/RESONANCES/AliRsnVariableExpression.h +++ b/PWG2/RESONANCES/AliRsnVariableExpression.h @@ -12,15 +12,14 @@ #include "AliRsnExpression.h" -class AliRsnVariableExpression: public AliRsnExpression -{ - public: - AliRsnVariableExpression(TString a) : AliRsnExpression() { fVname = a; }; - ~AliRsnVariableExpression() {} - virtual Bool_t Value(TObjArray& pgm); - virtual TString Unparse() const { return fVname; } +class AliRsnVariableExpression: public AliRsnExpression { +public: + AliRsnVariableExpression(TString a) : AliRsnExpression() { fVname = a; }; + ~AliRsnVariableExpression() {} + virtual Bool_t Value(TObjArray& pgm); + virtual TString Unparse() const { return fVname; } - ClassDef(AliRsnVariableExpression, 1); // Class to define a variable expression + ClassDef(AliRsnVariableExpression, 1); // Class to define a variable expression }; #endif -- 2.43.0