From e0baff8c6a5d7d4eacb9b9bcd2380e0b0f4c5890 Mon Sep 17 00:00:00 2001 From: pulvir Date: Tue, 30 Sep 2008 15:52:18 +0000 Subject: [PATCH] Corrections, bug fixes and a class name change --- PWG2/RESONANCES/AliRsnAnalysisSE.cxx | 10 +- PWG2/RESONANCES/AliRsnAnalysisSE.h | 2 +- PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.cxx | 169 ++++--- PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.h | 4 +- ...nBaseAT.cxx => AliRsnAnalysisTaskBase.cxx} | 46 +- ...liRsnBaseAT.h => AliRsnAnalysisTaskBase.h} | 24 +- PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.cxx | 460 +++++++++--------- PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.h | 12 +- PWG2/RESONANCES/AliRsnComparisonAT.cxx | 4 +- PWG2/RESONANCES/AliRsnComparisonAT.h | 8 +- PWG2/RESONANCES/AliRsnComparisonObj.h | 16 +- PWG2/RESONANCES/AliRsnCut.cxx | 33 +- PWG2/RESONANCES/AliRsnCut.h | 6 +- PWG2/RESONANCES/AliRsnCutMgr.h | 2 +- PWG2/RESONANCES/AliRsnCutSet.cxx | 31 ++ PWG2/RESONANCES/AliRsnCutSet.h | 18 +- PWG2/RESONANCES/AliRsnDaughter.cxx | 120 ++++- PWG2/RESONANCES/AliRsnDaughter.h | 43 +- PWG2/RESONANCES/AliRsnEvent.cxx | 36 +- PWG2/RESONANCES/AliRsnEvent.h | 11 +- PWG2/RESONANCES/AliRsnEventBuffer.cxx | 59 ++- PWG2/RESONANCES/AliRsnEventBuffer.h | 4 + PWG2/RESONANCES/AliRsnFunction.cxx | 248 ++++++---- PWG2/RESONANCES/AliRsnFunction.h | 26 +- PWG2/RESONANCES/AliRsnHistoDef.cxx | 36 +- PWG2/RESONANCES/AliRsnHistoDef.h | 2 +- PWG2/RESONANCES/AliRsnMCInfo.cxx | 40 +- PWG2/RESONANCES/AliRsnMCInfo.h | 75 +-- PWG2/RESONANCES/AliRsnPID.cxx | 132 +++-- PWG2/RESONANCES/AliRsnPID.h | 21 +- PWG2/RESONANCES/AliRsnPIDIndex.cxx | 19 +- PWG2/RESONANCES/AliRsnPIDIndex.h | 9 +- PWG2/RESONANCES/AliRsnPair.cxx | 63 +-- PWG2/RESONANCES/AliRsnPair.h | 38 +- PWG2/RESONANCES/AliRsnPairDef.cxx | 92 ++-- PWG2/RESONANCES/AliRsnPairMgr.cxx | 66 +-- PWG2/RESONANCES/AliRsnPairMgr.h | 31 +- PWG2/RESONANCES/AliRsnPairParticle.cxx | 79 +-- PWG2/RESONANCES/AliRsnPairParticle.h | 17 +- PWG2/RESONANCES/AliRsnReader.cxx | 49 +- PWG2/RESONANCES/AliRsnReader.h | 9 + PWG2/RESONANCES/AliRsnReaderTask.cxx | 8 +- PWG2/RESONANCES/AliRsnReaderTask.h | 4 +- PWG2/RESONANCES/AliRsnReaderTaskSE.cxx | 50 +- PWG2/RESONANCES/AliRsnReaderTaskSE.h | 8 +- 45 files changed, 1292 insertions(+), 948 deletions(-) rename PWG2/RESONANCES/{AliRsnBaseAT.cxx => AliRsnAnalysisTaskBase.cxx} (88%) rename PWG2/RESONANCES/{AliRsnBaseAT.h => AliRsnAnalysisTaskBase.h} (82%) diff --git a/PWG2/RESONANCES/AliRsnAnalysisSE.cxx b/PWG2/RESONANCES/AliRsnAnalysisSE.cxx index 776fee03756..1299f66b4b8 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisSE.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisSE.cxx @@ -71,7 +71,7 @@ void AliRsnAnalysisSE::UserCreateOutputObjects() AliDebug(AliLog::kDebug, "<-"); // fPID.DumpPriors(); - OpenFile ( 0 ); + OpenFile(0); fOutList = new TList(); fOutList->SetOwner(); AliRsnPair *def=0; @@ -89,15 +89,15 @@ void AliRsnAnalysisSE::UserCreateOutputObjects() if (def) { def->Init(); - //listTmp->Add(def->GenerateHistograms(mgr->GetName())); - def->GenerateHistograms(mgr->GetName(), listTmp); + listTmp->Add(def->GenerateHistograms(mgr->GetName())); + //def->GenerateHistograms(mgr->GetName(), listTmp); //def->Print(); } } fOutList->Add(listTmp); } - fRsnEventBuffer = new AliRsnEventBuffer(100); + fRsnEventBuffer = new AliRsnEventBuffer(1000); // fRsnEventBuffer = new AliRsnEventBuffer ( 10000 ,kFALSE ); AliDebug(AliLog::kDebug, "->"); @@ -111,7 +111,7 @@ void AliRsnAnalysisSE::UserExec(Option_t *) //========================================================= if (fEntry++%1000==0) - AliInfo(Form("Event %d",-1)); + AliInfo(Form("Event %d",fEntry-1)); AliRsnEvent *curEvent = GetRsnEventFromInputType(); if (!curEvent) return; diff --git a/PWG2/RESONANCES/AliRsnAnalysisSE.h b/PWG2/RESONANCES/AliRsnAnalysisSE.h index d143c6ec754..48feb4e4d87 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisSE.h +++ b/PWG2/RESONANCES/AliRsnAnalysisSE.h @@ -22,7 +22,7 @@ class AliRsnAnalysisSE : public AliRsnAnalysisTaskSEBase public: AliRsnAnalysisSE(const char *name = "AliRsnAnalysisSE"); AliRsnAnalysisSE(const AliRsnAnalysisSE& copy): AliRsnAnalysisTaskSEBase(copy), - fPairMgrs(0),fOutList(0x0),fRsnEventBuffer(0x0),fNumOfEventsInBuffer(100) {} + fPairMgrs(0),fOutList(0x0),fRsnEventBuffer(0x0),fNumOfEventsInBuffer(100) {} AliRsnAnalysisSE& operator= (const AliRsnAnalysisSE&) {return *this;} ~AliRsnAnalysisSE(); diff --git a/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.cxx b/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.cxx index 6d23584fa42..dd0ac0748a7 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.cxx @@ -29,18 +29,18 @@ ClassImp(AliRsnAnalysisTask2ndStep) //_____________________________________________________________________________ AliRsnAnalysisTask2ndStep::AliRsnAnalysisTask2ndStep(const char *name) : - AliAnalysisTaskSE(name), - fOutList(0x0), - fPairMgrs(0x0), - fEventBuffer(0x0), - fRsnHandlerAOD(0x0), - fAnalysisMgr(0x0) + AliAnalysisTaskSE(name), + fOutList(0x0), + fPairMgrs(0x0), + fEventBuffer(0x0), + fRsnHandlerAOD(0x0), + fAnalysisMgr(0x0) { // // Default constructor // - DefineOutput(1, TList::Class()); + DefineOutput(1, TList::Class()); } //_____________________________________________________________________________ @@ -50,16 +50,17 @@ void AliRsnAnalysisTask2ndStep::CreateHandlers(AliAnalysisManager* am) // Sets the handlers. // - fAnalysisMgr = am; - if (!fAnalysisMgr) { - AliWarning("Passed a NULL AnalysisManager!"); - return; - } - - // this task is made only for building histograms from - // a set of RSN events saved as non-standard branches in AOD tree - fRsnHandlerAOD = new AliAODInputHandler(); - if (fRsnHandlerAOD) fAnalysisMgr->SetInputEventHandler(fRsnHandlerAOD); + fAnalysisMgr = am; + if (!fAnalysisMgr) + { + AliWarning("Passed a NULL AnalysisManager!"); + return; + } + + // this task is made only for building histograms from + // a set of RSN events saved as non-standard branches in AOD tree + fRsnHandlerAOD = new AliAODInputHandler(); + if (fRsnHandlerAOD) fAnalysisMgr->SetInputEventHandler(fRsnHandlerAOD); } //_____________________________________________________________________________ @@ -68,40 +69,44 @@ void AliRsnAnalysisTask2ndStep::UserCreateOutputObjects() // // Creates output objects, as a TList of all histograms // - AliInfo("--->"); - - //OpenFile (1); - if (fOutList) { - fOutList->Clear(); - delete fOutList; - } - fOutList = new TList(); - fOutList->SetOwner(); - AliRsnPairMgr *pairMgr = 0x0; - AliRsnPair *pair = 0x0; - - if (!fPairMgrs) { - AliError("No pair managers defined!"); - return; + AliInfo("--->"); + + //OpenFile (1); + if (fOutList) + { + fOutList->Clear(); + delete fOutList; + } + fOutList = new TList(); + fOutList->SetOwner(); + AliRsnPairMgr *pairMgr = 0x0; + AliRsnPair *pair = 0x0; + + if (!fPairMgrs) + { + AliError("No pair managers defined!"); + return; + } + + TObjArrayIter next(fPairMgrs); + while ((pairMgr = (AliRsnPairMgr*)next())) + { + TList *listTmp = new TList(); + listTmp->SetName(pairMgr->GetName()); + TObjArrayIter nextPair(pairMgr->GetPairs()); + while ((pair = (AliRsnPair*)nextPair())) + { + pair->Init(); + //pair->Print(); + pair->GenerateHistograms(pairMgr->GetName(), listTmp); + //listTmp->Add(pair->GenerateHistograms(pairMgr->GetName())); + //fOutList->Add(listTmp); } - - TObjArrayIter next(fPairMgrs); - while ( (pairMgr = (AliRsnPairMgr*)next()) ) { - TList *listTmp = new TList(); - listTmp->SetName(pairMgr->GetName()); - TObjArrayIter nextPair(pairMgr->GetPairs()); - while ( (pair = (AliRsnPair*)nextPair()) ) { - pair->Init(); - //pair->Print(); - pair->GenerateHistograms(pairMgr->GetName(), listTmp); - //listTmp->Add(pair->GenerateHistograms(pairMgr->GetName())); - //fOutList->Add(listTmp); - } - fOutList->Add(listTmp); - } - fEventBuffer = new AliRsnEventBuffer(1000); - - AliInfo("<---"); + fOutList->Add(listTmp); + } + fEventBuffer = new AliRsnEventBuffer(1000); + + AliInfo("<---"); } //_____________________________________________________________________________ @@ -110,20 +115,20 @@ void AliRsnAnalysisTask2ndStep::UserExec(Option_t *) // // Executes the task // - - if (fEntry++ % 1000 == 0) AliInfo(Form("Event %d",-1)); - - // retrieve AOD - AliAODEvent *aod = dynamic_cast(fInputEvent); - - // find RSN event - AliRsnEvent *rsn = (AliRsnEvent*)(aod->GetList()->FindObject("rsnEvents")); - - // execute analysis - ProcessEventAnalysis(rsn); - PostEventProcess(); - - PostData(1, fOutList); + + if (fEntry++ % 1000 == 0) AliInfo(Form("Event %d",-1)); + + // retrieve AOD + AliAODEvent *aod = dynamic_cast(fInputEvent); + + // find RSN event + AliRsnEvent *rsn = (AliRsnEvent*)(aod->GetList()->FindObject("rsnEvents")); + + // execute analysis + ProcessEventAnalysis(rsn); + PostEventProcess(); + + PostData(1, fOutList); } //_____________________________________________________________________________ @@ -133,9 +138,9 @@ void AliRsnAnalysisTask2ndStep::Terminate(Option_t *) // A simple check on the output list // - fOutList = dynamic_cast(GetOutputData(1)); - if (!fOutList) { AliError("--- Output list not available ---"); return; } - fOutList->Print(); + fOutList = dynamic_cast(GetOutputData(1)); + if (!fOutList) { AliError("--- Output list not available ---"); return; } + fOutList->Print(); } //_____________________________________________________________________________ @@ -145,19 +150,21 @@ void AliRsnAnalysisTask2ndStep::ProcessEventAnalysis(AliRsnEvent *curEvent) // Process of one event // - // Adds event to Event Buffer - fEventBuffer->AddEvent(curEvent); - - // loop over all Pair managers - AliRsnPair *pair = 0; - AliRsnPairMgr *mgr = 0; - TObjArrayIter nextMgr(fPairMgrs); - while ( (mgr = (AliRsnPairMgr*)nextMgr()) ) { - TObjArrayIter nextPair(mgr->GetPairs()); - while ( (pair = (AliRsnPair*)nextPair()) ) { - pair->ProcessPair(fEventBuffer); - } + // Adds event to Event Buffer + fEventBuffer->AddEvent(curEvent); + + // loop over all Pair managers + AliRsnPair *pair = 0; + AliRsnPairMgr *mgr = 0; + TObjArrayIter nextMgr(fPairMgrs); + while ((mgr = (AliRsnPairMgr*)nextMgr())) + { + TObjArrayIter nextPair(mgr->GetPairs()); + while ((pair = (AliRsnPair*)nextPair())) + { + pair->ProcessPair(fEventBuffer); } + } } //_____________________________________________________________________________ @@ -172,6 +179,6 @@ void AliRsnAnalysisTask2ndStep::PostEventProcess() //_____________________________________________________________________________ void AliRsnAnalysisTask2ndStep::AddPairMgr(AliRsnPairMgr *pairmgr) { - if (!fPairMgrs) fPairMgrs = new TObjArray; - fPairMgrs->Add(pairmgr); + if (!fPairMgrs) fPairMgrs = new TObjArray; + fPairMgrs->Add(pairmgr); } diff --git a/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.h b/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.h index f21720be65c..f1e134289ce 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.h +++ b/PWG2/RESONANCES/AliRsnAnalysisTask2ndStep.h @@ -41,12 +41,12 @@ class AliRsnAnalysisTask2ndStep : public AliAnalysisTaskSE void PostEventProcess(); private: - + AliRsnAnalysisTask2ndStep(const AliRsnAnalysisTask2ndStep& copy) : AliAnalysisTaskSE(copy),fOutList(0x0),fPairMgrs(0x0),fEventBuffer(0x0), fRsnHandlerAOD(0x0),fAnalysisMgr(0x0) {} AliRsnAnalysisTask2ndStep& operator= (const AliRsnAnalysisTask2ndStep&) {return *this;} - + TList *fOutList; // list of output histograms TObjArray *fPairMgrs; // array if pair managers used AliRsnEventBuffer *fEventBuffer; // event buffer diff --git a/PWG2/RESONANCES/AliRsnBaseAT.cxx b/PWG2/RESONANCES/AliRsnAnalysisTaskBase.cxx similarity index 88% rename from PWG2/RESONANCES/AliRsnBaseAT.cxx rename to PWG2/RESONANCES/AliRsnAnalysisTaskBase.cxx index 10f13e6ff9f..b4252ff4a06 100644 --- a/PWG2/RESONANCES/AliRsnBaseAT.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisTaskBase.cxx @@ -1,5 +1,5 @@ // -// Class AliRsnBaseAT +// Class AliRsnAnalysisTaskBase // // TODO // @@ -20,13 +20,13 @@ #include "AliRsnEvent.h" #include "AliMCEvent.h" -#include "AliRsnBaseAT.h" +#include "AliRsnAnalysisTaskBase.h" -ClassImp(AliRsnBaseAT) +ClassImp(AliRsnAnalysisTaskBase) //________________________________________________________________________ -AliRsnBaseAT::AliRsnBaseAT(const char *name) +AliRsnAnalysisTaskBase::AliRsnAnalysisTaskBase(const char *name) : AliAnalysisTask(name, ""), fNumOfEvents(100), fUseAutoHandler(100), @@ -45,7 +45,7 @@ AliRsnBaseAT::AliRsnBaseAT(const char *name) } //________________________________________________________________________ -void AliRsnBaseAT::InitIOVars() +void AliRsnAnalysisTaskBase::InitIOVars() { //========================================================= // Initial values for constructor @@ -73,7 +73,7 @@ void AliRsnBaseAT::InitIOVars() } //________________________________________________________________________ -void AliRsnBaseAT::LocalInit() +void AliRsnAnalysisTaskBase::LocalInit() { //========================================================= // LocalInit() @@ -81,7 +81,7 @@ void AliRsnBaseAT::LocalInit() } //________________________________________________________________________ -Bool_t AliRsnBaseAT::Notify() +Bool_t AliRsnAnalysisTaskBase::Notify() { //========================================================= // Notify() @@ -91,7 +91,7 @@ Bool_t AliRsnBaseAT::Notify() } //________________________________________________________________________ -void AliRsnBaseAT::SetInputType(EInputType type,AliAnalysisManager* am,Bool_t autohandler, Short_t inputIndex) +void AliRsnAnalysisTaskBase::SetInputType(EInputType type,AliAnalysisManager* am,Bool_t autohandler, Short_t inputIndex) { //========================================================= // Sets input type. @@ -167,19 +167,19 @@ void AliRsnBaseAT::SetInputType(EInputType type,AliAnalysisManager* am,Bool_t au } //________________________________________________________________________ -void AliRsnBaseAT::ConnectInputData(Option_t *) +void AliRsnAnalysisTaskBase::ConnectInputData(Option_t *) { //========================================================= // ConectInputData() for AliAnalysisTask -// just define myTask->SetInputType ( AliRsnBaseAT::kRSN ); for Rsn input -// just define myTask->SetInputType ( AliRsnBaseAT::kESDMC ); for ESD and MC input -// just define myTask->SetInputType ( AliRsnBaseAT::kAOD ); for Rsn input +// just define myTask->SetInputType ( AliRsnAnalysisTaskBase::kRSN ); for Rsn input +// just define myTask->SetInputType ( AliRsnAnalysisTaskBase::kESDMC ); for ESD and MC input +// just define myTask->SetInputType ( AliRsnAnalysisTaskBase::kAOD ); for Rsn input //========================================================= ConnectInputDataByInputType(fInputType[0],0); } -void AliRsnBaseAT::ConnectInputDataByInputType(EInputType type ,Short_t inputIndex) +void AliRsnAnalysisTaskBase::ConnectInputDataByInputType(EInputType type ,Short_t inputIndex) { //========================================================= // Connect input data by input type @@ -219,7 +219,7 @@ void AliRsnBaseAT::ConnectInputDataByInputType(EInputType type ,Short_t inputInd AliDebug(AliLog::kDebug, "->"); } //________________________________________________________________________ -void AliRsnBaseAT::ConnectRSN(Short_t inputIndex) +void AliRsnAnalysisTaskBase::ConnectRSN(Short_t inputIndex) { //========================================================= // Connect input data by RSN input type @@ -239,7 +239,7 @@ void AliRsnBaseAT::ConnectRSN(Short_t inputIndex) AliDebug(AliLog::kDebug, "->"); } -void AliRsnBaseAT::ConnectESD(Short_t inputIndex) +void AliRsnAnalysisTaskBase::ConnectESD(Short_t inputIndex) { //========================================================= // Connect input data by ESD input type @@ -265,7 +265,7 @@ void AliRsnBaseAT::ConnectESD(Short_t inputIndex) } //________________________________________________________________________ -void AliRsnBaseAT::ConnectESDMC(Short_t inputIndex) +void AliRsnAnalysisTaskBase::ConnectESDMC(Short_t inputIndex) { //========================================================= // Connect input data by ESDMC input type @@ -292,7 +292,7 @@ void AliRsnBaseAT::ConnectESDMC(Short_t inputIndex) } //________________________________________________________________________ -void AliRsnBaseAT::ConnectAOD(Short_t inputIndex) +void AliRsnAnalysisTaskBase::ConnectAOD(Short_t inputIndex) { //========================================================= // Connect input data by AOD input type @@ -316,7 +316,7 @@ void AliRsnBaseAT::ConnectAOD(Short_t inputIndex) } //________________________________________________________________________ -AliRsnEvent * AliRsnBaseAT::GetRsnEventFromInputType(const Short_t & index) +AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnEventFromInputType(const Short_t & index) { //========================================================= // Gets Evetn from input type @@ -360,7 +360,7 @@ AliRsnEvent * AliRsnBaseAT::GetRsnEventFromInputType(const Short_t & index) //________________________________________________________________________ -AliRsnEvent * AliRsnBaseAT::GetRsnFromAOD(const Short_t & index) +AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromAOD(const Short_t & index) { //========================================================= // Gets RSN event from AOD @@ -388,7 +388,7 @@ AliRsnEvent * AliRsnBaseAT::GetRsnFromAOD(const Short_t & index) } //________________________________________________________________________ -AliRsnEvent * AliRsnBaseAT::GetRsnFromESD(const Short_t & index) +AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESD(const Short_t & index) { //========================================================= // Gets RSN event from ESD @@ -415,7 +415,7 @@ AliRsnEvent * AliRsnBaseAT::GetRsnFromESD(const Short_t & index) return fRSN[index]; } //________________________________________________________________________ -AliRsnEvent * AliRsnBaseAT::GetRsnFromESDMC(const Short_t & index) +AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESDMC(const Short_t & index) { //========================================================= // Gets RSN event from ESD and MC @@ -452,7 +452,7 @@ AliRsnEvent * AliRsnBaseAT::GetRsnFromESDMC(const Short_t & index) return fRSN[index]; } //________________________________________________________________________ -AliRsnEvent * AliRsnBaseAT::GetRsnFromRSN(const Short_t & index) +AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromRSN(const Short_t & index) { //========================================================= // Gets RSN event from RSN @@ -469,7 +469,7 @@ AliRsnEvent * AliRsnBaseAT::GetRsnFromRSN(const Short_t & index) } //________________________________________________________________________ -void AliRsnBaseAT::UseAutoHandler(const Bool_t & theValue) +void AliRsnAnalysisTaskBase::UseAutoHandler(const Bool_t & theValue) { //========================================================= // Sets should create handlers diff --git a/PWG2/RESONANCES/AliRsnBaseAT.h b/PWG2/RESONANCES/AliRsnAnalysisTaskBase.h similarity index 82% rename from PWG2/RESONANCES/AliRsnBaseAT.h rename to PWG2/RESONANCES/AliRsnAnalysisTaskBase.h index afac444094c..35b3d91ad03 100644 --- a/PWG2/RESONANCES/AliRsnBaseAT.h +++ b/PWG2/RESONANCES/AliRsnAnalysisTaskBase.h @@ -1,13 +1,13 @@ // -// Class AliRsnBaseAT +// Class AliRsnAnalysisTaskBase // // TODO // // authors: Martin Vala (martin.vala@cern.ch) // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) // -#ifndef ALIRSNBASEAT_H -#define ALIRSNBASEAT_H +#ifndef ALIRSNANALYSISTASKBASE_H +#define ALIRSNANALYSISTASKBASE_H #include @@ -25,15 +25,15 @@ class AliMCEvent; #include "AliAODInputHandler.h" -class AliRsnBaseAT : public AliAnalysisTask +class AliRsnAnalysisTaskBase : public AliAnalysisTask { public: - AliRsnBaseAT(const char *name = "AliRsnBaseAT"); - AliRsnBaseAT(const AliRsnBaseAT& copy):AliAnalysisTask(copy), - fNumOfEvents(0),fUseAutoHandler(kTRUE), - fRsnInput(1),fReader(),fPID(),fAnalysisMgr(0x0) {} - AliRsnBaseAT& operator= (const AliRsnBaseAT&) {return *this;} - virtual ~AliRsnBaseAT() {/* Does nothing*/} + AliRsnAnalysisTaskBase(const char *name = "AliRsnAnalysisTaskBase"); + AliRsnAnalysisTaskBase(const AliRsnAnalysisTaskBase& copy):AliAnalysisTask(copy), + fNumOfEvents(0),fUseAutoHandler(kTRUE), + fRsnInput(1),fReader(),fPID(),fAnalysisMgr(0x0) {} + AliRsnAnalysisTaskBase& operator= (const AliRsnAnalysisTaskBase&) {return *this;} + virtual ~AliRsnAnalysisTaskBase() {/* Does nothing*/} enum EInputType { @@ -69,7 +69,7 @@ class AliRsnBaseAT : public AliAnalysisTask AliRsnReader *GetReader() { return &fReader; } AliRsnPID *GetPID() { return &fPID;} - + protected: Long64_t fNumOfEvents; // number of events @@ -109,7 +109,7 @@ class AliRsnBaseAT : public AliAnalysisTask virtual AliRsnEvent* GetRsnFromRSN(const Short_t &index=0); - ClassDef(AliRsnBaseAT, 1) + ClassDef(AliRsnAnalysisTaskBase, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.cxx b/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.cxx index 0cf9c748314..98ac77eec68 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.cxx @@ -27,17 +27,17 @@ ClassImp(AliRsnAnalysisTaskSEBase) //_____________________________________________________________________________ AliRsnAnalysisTaskSEBase::AliRsnAnalysisTaskSEBase(const char *name) : - AliAnalysisTaskSE(name), - fUseAutoHandler(kTRUE), - fReader(), - fPID(), - fAnalysisMgr(0x0) // pointer to current AnalysisMgr + AliAnalysisTaskSE(name), + fUseAutoHandler(kTRUE), + fReader(), + fPID(), + fAnalysisMgr(0x0) // pointer to current AnalysisMgr { // // Default constructor // - InitIOVars(); - DefineInput(0, TChain::Class()); + InitIOVars(); + DefineInput(0, TChain::Class()); } //_____________________________________________________________________________ @@ -46,23 +46,24 @@ void AliRsnAnalysisTaskSEBase::InitIOVars() // // Initial values for constructor // - - fUseAutoHandler = kFALSE; - - Int_t i; - for (i = 0; i < 2; i++) { - fChain[i] = 0; - fRSN[i] = 0; - fRsnESD[i] = 0; - fRsnMC[i] = 0; - fRsnAOD[i] = 0; - fRsnESDEH[i] = 0; - fRsnMCEH[i] = 0; - fRsnAODEH[i] = 0; - fInputType[i] = kRSN; - } - - fAnalysisMgr = 0; + + fUseAutoHandler = kFALSE; + + Int_t i; + for (i = 0; i < 2; i++) + { + fChain[i] = 0; + fRSN[i] = 0; + fRsnESD[i] = 0; + fRsnMC[i] = 0; + fRsnAOD[i] = 0; + fRsnESDEH[i] = 0; + fRsnMCEH[i] = 0; + fRsnAODEH[i] = 0; + fInputType[i] = kRSN; + } + + fAnalysisMgr = 0; } //_____________________________________________________________________________ @@ -71,7 +72,7 @@ void AliRsnAnalysisTaskSEBase::LocalInit() // // LocalInit() // - AliAnalysisTaskSE::LocalInit(); + AliAnalysisTaskSE::LocalInit(); } //_____________________________________________________________________________ @@ -81,7 +82,7 @@ Bool_t AliRsnAnalysisTaskSEBase::Notify() // Notify() // - return AliAnalysisTaskSE::Notify(); + return AliAnalysisTaskSE::Notify(); } //_____________________________________________________________________________ @@ -95,47 +96,45 @@ void AliRsnAnalysisTaskSEBase::SetInputType // The internal AliAnalysisManager object is redirected to the passed one. // - fInputType[inputIndex] = type; - fAnalysisMgr = am; - - UseAutoHandler(autohandler); - if (!fUseAutoHandler) return; - - if (!fAnalysisMgr) { - AliWarning(Form("fAnalysisMgr is %p and fUseAutoHandler is %d", fAnalysisMgr, fUseAutoHandler)); - return; - } - - switch (fInputType[inputIndex]) { - case kAOD: - fRsnAODEH[0] = new AliAODInputHandler(); - if (fRsnAODEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnAODEH[0]); - break; - case kESD: - fRsnESDEH[0] = new AliESDInputHandler(); - if (fRsnESDEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]); - break; - case kESDMC: - fRsnESDEH[0] = new AliESDInputHandler(); - fRsnMCEH[0] = new AliMCEventHandler(); - if ((fRsnESDEH[0]) && (fRsnMCEH[0])) { - fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]); - fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]); - } - break; - case kMC: - fRsnMCEH[0] = new AliMCEventHandler(); - if (fRsnMCEH[0]) { - fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]); - } - break; - case kRSN: - AliError("Not Implemented Yet ..."); - break; - default: - AliError("Type not supported ..."); - break; - } + fInputType[inputIndex] = type; + fAnalysisMgr = am; + + UseAutoHandler(autohandler); + if (!fUseAutoHandler) return; + + if (!fAnalysisMgr) + { + AliWarning(Form("fAnalysisMgr is %p and fUseAutoHandler is %d", fAnalysisMgr, fUseAutoHandler)); + return; + } + + switch (fInputType[inputIndex]) + { + case kAOD: + fRsnAODEH[0] = new AliAODInputHandler(); + if (fRsnAODEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnAODEH[0]); + break; + case kESD: + fRsnESDEH[0] = new AliESDInputHandler(); + if (fRsnESDEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]); + break; + case kESDMC: + case kMC: + fRsnESDEH[0] = new AliESDInputHandler(); + fRsnMCEH[0] = new AliMCEventHandler(); + if ((fRsnESDEH[0]) && (fRsnMCEH[0])) + { + fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]); + fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]); + } + break; + case kRSN: +// AliError("Not Implemented Yet ..."); + break; + default: + AliError("Type not supported ..."); + break; + } } //_____________________________________________________________________________ @@ -148,10 +147,10 @@ void AliRsnAnalysisTaskSEBase::ConnectInputData(Option_t *) // just define myTask->SetInputType ( AliRsnAnalysisTaskSEBase::kAOD ); for Rsn input // - if (fInputType[0] != kRSN) AliAnalysisTaskSE::ConnectInputData(); - - // connects input handlers according to the type of analysis being done - ConnectInputDataByInputType(fInputType[0], 0); + if (fInputType[0] != kRSN) AliAnalysisTaskSE::ConnectInputData(); + + // connects input handlers according to the type of analysis being done + ConnectInputDataByInputType(fInputType[0], 0); } //_____________________________________________________________________________ @@ -161,31 +160,29 @@ void AliRsnAnalysisTaskSEBase::ConnectInputDataByInputType // // Connect input data dependint on the input type used. // - AliDebug(AliLog::kDebug, "<-"); - - switch (type) - { - case kAOD: - ConnectAOD(inputIndex); - break; - case kESD: - ConnectESD(inputIndex); - break; - case kESDMC: - ConnectESDMC(inputIndex); - break; - case kMC: - ConnectESDMC(inputIndex); - break; - case kRSN: - ConnectRSN(inputIndex); - break; - default: - AliError("Type not supported ..."); - break; - } - - AliDebug(AliLog::kDebug, "->"); + AliDebug(AliLog::kDebug, "<-"); + + switch (type) + { + case kAOD: + ConnectAOD(inputIndex); + break; + case kESD: + ConnectESD(inputIndex); + break; + case kESDMC: + case kMC: + ConnectESDMC(inputIndex); + break; + case kRSN: + ConnectRSN(inputIndex); + break; + default: + AliError("Type not supported ..."); + break; + } + + AliDebug(AliLog::kDebug, "->"); } //_____________________________________________________________________________ void AliRsnAnalysisTaskSEBase::ConnectRSN(Short_t inputIndex) @@ -194,20 +191,20 @@ void AliRsnAnalysisTaskSEBase::ConnectRSN(Short_t inputIndex) // Connect input data by RSN input type // - AliDebug(AliLog::kDebug, "<-"); - - char ** address = (char **) GetBranchAddress(inputIndex, "rsnEvents"); - if (address) - { - fRSN[inputIndex] = (AliRsnEvent*)(*address); - } - else - { - fRSN[inputIndex] = 0; - SetBranchAddress(inputIndex, "rsnEvents", &fRSN[inputIndex]); - } - - AliDebug(AliLog::kDebug, "->"); + AliDebug(AliLog::kDebug, "<-"); + + char ** address = (char **) GetBranchAddress(inputIndex, "rsnEvents"); + if (address) + { + fRSN[inputIndex] = (AliRsnEvent*)(*address); + } + else + { + fRSN[inputIndex] = 0; + SetBranchAddress(inputIndex, "rsnEvents", &fRSN[inputIndex]); + } + + AliDebug(AliLog::kDebug, "->"); } //_____________________________________________________________________________ @@ -217,9 +214,9 @@ void AliRsnAnalysisTaskSEBase::ConnectESD(Short_t inputIndex) // Connect input data by ESD input type // - AliDebug(AliLog::kDebug, "<-"); - fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent; - AliDebug(AliLog::kDebug, "->"); + AliDebug(AliLog::kDebug, "<-"); + fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent; + AliDebug(AliLog::kDebug, "->"); } @@ -230,10 +227,10 @@ void AliRsnAnalysisTaskSEBase::ConnectESDMC(Short_t inputIndex) // Connect input data by ESDMC input type // - AliDebug(AliLog::kDebug, "<-"); - fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent; - //fRSNMC[inputIndex] = fMCEvent; - AliDebug(AliLog::kDebug, "->"); + AliDebug(AliLog::kDebug, "<-"); + fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent; + //fRSNMC[inputIndex] = fMCEvent; + AliDebug(AliLog::kDebug, "->"); } //_____________________________________________________________________________ @@ -243,18 +240,18 @@ void AliRsnAnalysisTaskSEBase::ConnectAOD(Short_t inputIndex) // Connect input data by AOD input type // - AliDebug(AliLog::kDebug, "<-"); + AliDebug(AliLog::kDebug, "<-"); + + TTree* tree = dynamic_cast(GetInputData(inputIndex)); + if (!tree) { AliError("Could not read chain from input slot 0");} + else + { + AliAODInputHandler *aodH = dynamic_cast(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); + if (!aodH) { AliError("Could not get AODInputHandler"); } + else fRsnAOD[inputIndex] = aodH->GetEvent(); + } - TTree* tree = dynamic_cast(GetInputData(inputIndex)); - if (!tree) { AliError("Could not read chain from input slot 0");} - else - { - AliAODInputHandler *aodH = dynamic_cast(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); - if (!aodH) { AliError("Could not get AODInputHandler"); } - else fRsnAOD[inputIndex] = aodH->GetEvent(); - } - - AliDebug(AliLog::kDebug, "->"); + AliDebug(AliLog::kDebug, "->"); } //_____________________________________________________________________________ @@ -264,19 +261,19 @@ AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnEventFromInputType(const Short_t & // Gets Event from input type // - switch (fInputType[index]) - { - case kAOD: return GetRsnFromAOD(index); - case kESD: return GetRsnFromESD(index); - case kESDMC: return GetRsnFromESDMC(index); - case kMC: return GetRsnFromMC(index); - case kRSN: return GetRsnFromRSN(index); - default: - AliError("Type not supported ..."); - return (AliRsnEvent*) 0x0; - } - - return (AliRsnEvent*) 0x0; + switch (fInputType[index]) + { + case kAOD: return GetRsnFromAOD(index); + case kESD: return GetRsnFromESD(index); + case kESDMC: return GetRsnFromESDMC(index); + case kMC: return GetRsnFromMC(index); + case kRSN: return GetRsnFromRSN(index); + default: + AliError("Type not supported ..."); + return (AliRsnEvent*) 0x0; + } + + return (AliRsnEvent*) 0x0; } //_____________________________________________________________________________ @@ -286,25 +283,25 @@ AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromAOD(const Short_t & index) // Gets RSN event from AOD // - if (!fRsnAOD[index]) - { - AliError("fRsnAOD not available."); - return (AliRsnEvent *) 0x0; - } - - if (!fRSN[0]) - { - fRSN[0] = new AliRsnEvent(); - fRSN[0]->SetName("rsnEvents"); - fRSN[0]->Init(); - } - - // clear pevious event - fRSN[0]->Clear(); - if (!fReader.FillFromAOD(fRSN[0], fRsnAOD[index])) return (AliRsnEvent*) 0x0; - if (!fPID.Process(fRSN[0])) AliWarning("Failed PID"); - - return (AliRsnEvent*) fRSN[0]; + if (!fRsnAOD[index]) + { + AliError("fRsnAOD not available."); + return (AliRsnEvent *) 0x0; + } + + if (!fRSN[0]) + { + fRSN[0] = new AliRsnEvent(); + fRSN[0]->SetName("rsnEvents"); + fRSN[0]->Init(); + } + + // clear pevious event + fRSN[0]->Clear(); + if (!fReader.FillFromAOD(fRSN[0], fRsnAOD[index])) return (AliRsnEvent*) 0x0; + if (!fPID.Process(fRSN[0])) AliWarning("Failed PID"); + + return (AliRsnEvent*) fRSN[0]; } //_____________________________________________________________________________ @@ -314,31 +311,31 @@ AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromESD(const Short_t & index) // Gets RSN event from ESD // - if (!fRsnESD[index]) - { - AliError("fRsnESD not available."); - return (AliRsnEvent *) 0x0; - } - - if (!fRSN[index]) - { - fRSN[index] = new AliRsnEvent(); - fRSN[index]->SetName("rsnEvents"); - fRSN[index]->Init(); - } - - // clear pevious event - fRSN[index]->Clear(); - - if (!fReader.FillFromESD(fRSN[index], fRsnESD[index])) return (AliRsnEvent*) 0x0; - - if (!fPID.Process(fRSN[index])) - { - AliWarning("Failed PID"); - return (AliRsnEvent*) 0x0; - } - - return fRSN[index]; + if (!fRsnESD[index]) + { + AliError("fRsnESD not available."); + return (AliRsnEvent *) 0x0; + } + + if (!fRSN[index]) + { + fRSN[index] = new AliRsnEvent(); + fRSN[index]->SetName("rsnEvents"); + fRSN[index]->Init(); + } + + // clear pevious event + fRSN[index]->Clear(); + + if (!fReader.FillFromESD(fRSN[index], fRsnESD[index])) return (AliRsnEvent*) 0x0; + + if (!fPID.Process(fRSN[index])) + { + AliWarning("Failed PID"); + return (AliRsnEvent*) 0x0; + } + + return fRSN[index]; } //_____________________________________________________________________________ @@ -348,20 +345,29 @@ AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromMC(const Short_t & index) // Gets RSN event from ESD // - if (!fRSN[index]) - { - fRSN[index] = new AliRsnEvent(); - fRSN[index]->SetName("rsnEvents"); - fRSN[index]->Init(); - } - - // clear pevious event - fRSN[index]->Clear(); - fRsnMC[index] = MCEvent(); - - if (!fReader.FillFromMC(fRSN[index], fRsnMC[index])) return (AliRsnEvent*) 0x0; - fRSN[index]->FillPIDArrays(); - return fRSN[index]; + if (!fRsnESD[index]) + { + AliError("fRsnESD not available."); + return (AliRsnEvent *) 0x0; + } + + if (!fRSN[index]) + { + fRSN[index] = new AliRsnEvent(); + fRSN[index]->SetName("rsnEvents"); + fRSN[index]->Init(); + } + + // clear pevious event + fRSN[index]->Clear(); + fRsnMC[index] = MCEvent(); + + if (!fRsnMC[index]) return (AliRsnEvent *) 0x0; + if (!fReader.FillFromMC(fRSN[index], fRsnMC[index])) return (AliRsnEvent*) 0x0; + //if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], fRsnMC[index])) return (AliRsnEvent*) 0x0; + fPID.Process(fRSN[index]); + fRSN[index]->FillPIDArrays(3000); + return fRSN[index]; } //_____________________________________________________________________________ @@ -371,32 +377,32 @@ AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromESDMC(const Short_t & index) // Gets RSN event from ESD and MC // - if (!fRsnESD[index]) - { - AliError("fRsnESD not available."); - return (AliRsnEvent *) 0x0; - } - - if (!fRSN[index]) - { - fRSN[index] = new AliRsnEvent(); - fRSN[index]->SetName("rsnEvents"); - fRSN[index]->Init(); - } - - // clear pevious event - fRSN[index]->Clear(); - fRsnMC[index] = MCEvent(); - - if (!fRsnMC[index]) return (AliRsnEvent *) 0x0; - if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], fRsnMC[index])) return (AliRsnEvent*) 0x0; - if (!fPID.Process(fRSN[index])) - { - AliWarning("Failed PID"); - return (AliRsnEvent*) 0x0; - } - - return fRSN[index]; + if (!fRsnESD[index]) + { + AliError("fRsnESD not available."); + return (AliRsnEvent *) 0x0; + } + + if (!fRSN[index]) + { + fRSN[index] = new AliRsnEvent(); + fRSN[index]->SetName("rsnEvents"); + fRSN[index]->Init(); + } + + // clear pevious event + fRSN[index]->Clear(); + fRsnMC[index] = MCEvent(); + + if (!fRsnMC[index]) return (AliRsnEvent *) 0x0; + if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], fRsnMC[index])) return (AliRsnEvent*) 0x0; + if (!fPID.Process(fRSN[index])) + { + AliWarning("Failed PID"); + return (AliRsnEvent*) 0x0; + } + + return fRSN[index]; } //_____________________________________________________________________________ @@ -406,6 +412,6 @@ AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromRSN(const Short_t & index) // Gets RSN event from RSN // not fully implemented yet // - AliRsnEvent *event = fRSN[index]; - return event; + AliRsnEvent *event = fRSN[index]; + return event; } diff --git a/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.h b/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.h index 63893567a0b..6de11401eef 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.h +++ b/PWG2/RESONANCES/AliRsnAnalysisTaskSEBase.h @@ -35,12 +35,12 @@ class AliRsnAnalysisTaskSEBase : public AliAnalysisTaskSE enum EInputType { - kAOD = 0, - kESD, - kESDMC, - kMC, - kRSN, - kLastIndex + kAOD = 0, + kESD, + kESDMC, + kMC, + kRSN, + kLastIndex }; virtual void InitIOVars(); diff --git a/PWG2/RESONANCES/AliRsnComparisonAT.cxx b/PWG2/RESONANCES/AliRsnComparisonAT.cxx index 99e5c702a7a..4770f1816df 100644 --- a/PWG2/RESONANCES/AliRsnComparisonAT.cxx +++ b/PWG2/RESONANCES/AliRsnComparisonAT.cxx @@ -26,7 +26,7 @@ ClassImp(AliRsnComparisonAT) //________________________________________________________________________ AliRsnComparisonAT::AliRsnComparisonAT(const char*name) - : AliRsnBaseAT(name),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0) + : AliRsnAnalysisTaskBase(name),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0) { //========================================================= // Default constructor @@ -44,7 +44,7 @@ void AliRsnComparisonAT::InitIOVars() // Sets default values for input and output //========================================================= AliDebug(AliLog::kDebug, "<-"); - AliRsnBaseAT::InitIOVars(); + AliRsnAnalysisTaskBase::InitIOVars(); fOutList = 0; AliDebug(AliLog::kDebug, "->"); } diff --git a/PWG2/RESONANCES/AliRsnComparisonAT.h b/PWG2/RESONANCES/AliRsnComparisonAT.h index 101c582b11b..d22b89e3511 100644 --- a/PWG2/RESONANCES/AliRsnComparisonAT.h +++ b/PWG2/RESONANCES/AliRsnComparisonAT.h @@ -13,11 +13,11 @@ #include "AliRsnDaughter.h" #include "AliRsnEvent.h" -#include "AliRsnBaseAT.h" +#include "AliRsnAnalysisTaskBase.h" #include "AliRsnCut.h" #include "AliRsnCutSet.h" -class AliRsnComparisonAT : public AliRsnBaseAT +class AliRsnComparisonAT : public AliRsnAnalysisTaskBase { public: @@ -50,9 +50,9 @@ class AliRsnComparisonAT : public AliRsnBaseAT private: - + AliRsnComparisonAT(const AliRsnComparisonAT&) - : AliRsnBaseAT(""),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0) {} + : AliRsnAnalysisTaskBase(""),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0) {} AliRsnComparisonAT& operator=(const AliRsnComparisonAT&) {return *this;} TList *fOutList; // output list diff --git a/PWG2/RESONANCES/AliRsnComparisonObj.h b/PWG2/RESONANCES/AliRsnComparisonObj.h index b10b9fcf1c8..dc86882b92c 100644 --- a/PWG2/RESONANCES/AliRsnComparisonObj.h +++ b/PWG2/RESONANCES/AliRsnComparisonObj.h @@ -47,7 +47,7 @@ class AliRsnComparisonObj : public TNamed kY, kLastParameterType }; - + enum EHistoType { kIndent=0, @@ -79,7 +79,7 @@ class AliRsnComparisonObj : public TNamed void FillPIDHistograms(AliRsnDaughter *daughter); void FillPIDHistograms(AliESDtrack *track,AliMCEvent *mc=0); void FillPIDHistograms(AliMCParticle *mctrack); - + void FillHistograms(AliMCParticle *mctrack); void SetCurrentESDPID(const EPIDType& type,const Double_t&divValue = 0.0); @@ -88,10 +88,10 @@ class AliRsnComparisonObj : public TNamed void SetESDstatus(const ULong_t status); void SetESDTrackQualityCuts(const Int_t& its=-1,const Int_t& tpc=-1,const Int_t& trd=-1); private: - - AliRsnComparisonObj(const AliRsnComparisonObj& copy) - : TNamed(copy),fCurrentComparisonType(kParticleInfo),fCurrentESDPID(kEsd), - fESDstatus(0),fITSClusters(0),fTPCClusters(0),fTRDClusters(0),fPIDDivValue(0.) {} + + AliRsnComparisonObj(const AliRsnComparisonObj& copy) + : TNamed(copy),fCurrentComparisonType(kParticleInfo),fCurrentESDPID(kEsd), + fESDstatus(0),fITSClusters(0),fTPCClusters(0),fTRDClusters(0),fPIDDivValue(0.) {} const AliRsnComparisonObj& operator=(const AliRsnComparisonObj&) {return *this;} EComparisonType fCurrentComparisonType; @@ -101,12 +101,12 @@ class AliRsnComparisonObj : public TNamed Int_t fITSClusters; Int_t fTPCClusters; Int_t fTRDClusters; - + Double_t fPIDDivValue; TH1D *fHistosPartInfo[kLastParameterType][2][AliRsnPID::kSpeciesAll]; TH1D *fHistosPID[kLastFormat][kLastHistoType][AliRsnPID::kSpecies+1]; - + TString GetFormatName(EFormat type); TString GetHistoTypeName(EHistoType type); diff --git a/PWG2/RESONANCES/AliRsnCut.cxx b/PWG2/RESONANCES/AliRsnCut.cxx index 277d45946cf..e7d18216dbb 100644 --- a/PWG2/RESONANCES/AliRsnCut.cxx +++ b/PWG2/RESONANCES/AliRsnCut.cxx @@ -317,11 +317,11 @@ Bool_t AliRsnCut::IsSelected(ETarget type, AliRsnDaughter *daughter) case kEtaMC: if (mcinfo) return IsBetween(mcinfo->Eta()); else return kTRUE; + case kNSigma: + return IsBetween(daughter->NSigmaToVertex()); /* - case kEsdNSigma: - return IsBetween (daughter->GetNSigma()); case kEsdNSigmaCalculate: - return IsBetween (daughter->GetESDInfo()->GetNSigmaCalculate()); + return IsBetween (daughter->GetESDInfo()->GetNSigmaCalculate()); */ default: AliWarning("Requested a cut which cannot be applied to a single track"); @@ -393,6 +393,33 @@ Bool_t AliRsnCut::IsSelected(ETarget type, AliRsnEvent * event) return kTRUE; } +//________________________________________________________________________________________________________________ +Bool_t AliRsnCut::IsSelected(ETarget type, AliRsnEvent * ev1, AliRsnEvent * ev2) +{ + AliDebug(AliLog::kDebug, "<-"); + + Double_t valueD; + Int_t valueI; + + switch (fType) + { + case kMultiplicityDifference: + valueI = TMath::Abs(ev1->GetMultiplicity() - ev2->GetMultiplicity()); + return IsBetween((Int_t)valueI); + case kVzDifference: + valueD = TMath::Abs(ev1->GetVz() - ev2->GetVz()); + return IsBetween((Double_t)valueD); + case kPhiMeanDifference: + valueD = TMath::Abs(ev1->GetPhiMean() - ev2->GetPhiMean()); + return IsBetween((Double_t)valueD); + default: + AliWarning("Requested a cut which cannot be applied to an event"); + return kTRUE; + } + + return kTRUE; +} + //________________________________________________________________________________________________________________ void AliRsnCut::PrintAllValues() { diff --git a/PWG2/RESONANCES/AliRsnCut.h b/PWG2/RESONANCES/AliRsnCut.h index a753dbee644..46a6e1be080 100644 --- a/PWG2/RESONANCES/AliRsnCut.h +++ b/PWG2/RESONANCES/AliRsnCut.h @@ -49,6 +49,9 @@ class AliRsnCut : public TNamed kPIDType, kPIDProb, kMultiplicity, + kMultiplicityDifference, + kPhiMeanDifference, + kVzDifference, kLastCutType }; @@ -64,7 +67,7 @@ class AliRsnCut : public TNamed kParticle = 0, kPair, kEvent, - kMixEventFinderCut, + kMixEvent, kLastCutTarget }; @@ -85,6 +88,7 @@ class AliRsnCut : public TNamed Bool_t IsSelected(ETarget tgt, AliRsnDaughter *daughter); Bool_t IsSelected(ETarget tgt, AliRsnPairParticle *pair); Bool_t IsSelected(ETarget tgt, AliRsnEvent *event); + Bool_t IsSelected(ETarget tgt, AliRsnEvent *ev1, AliRsnEvent *ev2); void PrintAllValues(); diff --git a/PWG2/RESONANCES/AliRsnCutMgr.h b/PWG2/RESONANCES/AliRsnCutMgr.h index 7c15ebbb086..f96c2be9a10 100644 --- a/PWG2/RESONANCES/AliRsnCutMgr.h +++ b/PWG2/RESONANCES/AliRsnCutMgr.h @@ -39,7 +39,7 @@ class AliRsnCutMgr : public TNamed AliRsnCutSet *fCutSets[AliRsnCut::kLastCutTarget]; // cut definitions for all targets - ClassDef(AliRsnCutMgr, 1); // dictionary + ClassDef(AliRsnCutMgr, 1) // dictionary }; #endif diff --git a/PWG2/RESONANCES/AliRsnCutSet.cxx b/PWG2/RESONANCES/AliRsnCutSet.cxx index 836a231acc8..4bf61b2aeae 100644 --- a/PWG2/RESONANCES/AliRsnCutSet.cxx +++ b/PWG2/RESONANCES/AliRsnCutSet.cxx @@ -1,3 +1,12 @@ +// +// Class AliRsnCutSet +// +// This is the front-end for cut management and checking. +// It must be prepared by adding all required single cuts, +// and then with a logical expression which combines all cuts +// with the "AND", "OR" and "NOT" operators. +// + #include "AliLog.h" #include "AliRsnCut.h" @@ -183,6 +192,28 @@ Bool_t AliRsnCutSet::IsSelected(AliRsnCut::ETarget type, AliRsnEvent * event) return boolReturn; } +//_____________________________________________________________________________ +Bool_t AliRsnCutSet::IsSelected(AliRsnCut::ETarget type, AliRsnEvent * ev1, AliRsnEvent *ev2) +{ +// +// Checks an object according to the cut expression defined here. +// + + 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(type,ev1,ev2); + } + + if (fIsScheme) boolReturn = Passed(); + return boolReturn; +} + //_____________________________________________________________________________ void AliRsnCutSet::SetCutScheme(const TString & theValue) { diff --git a/PWG2/RESONANCES/AliRsnCutSet.h b/PWG2/RESONANCES/AliRsnCutSet.h index 315ecc5e68e..d1528e833b4 100644 --- a/PWG2/RESONANCES/AliRsnCutSet.h +++ b/PWG2/RESONANCES/AliRsnCutSet.h @@ -1,11 +1,12 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice * - **************************************************************************/ - // -// class AliRsnCutSet -// Combination of simple cuts +// Class AliRsnCutSet +// +// This is the front-end for cut management and checking. +// It must be prepared by adding all required single cuts, +// and then with a logical expression which combines all cuts +// with the "AND", "OR" and "NOT" operators. +// +// author: M. Vala (martin.vala@cern.ch) // #ifndef ALIRSNCUTSET_H @@ -43,6 +44,7 @@ class AliRsnCutSet : public TNamed Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnDaughter *daughter); Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnPairParticle *pair); Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnEvent *event); + Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnEvent *ev1, AliRsnEvent *ev2); void SetBoolValue(Bool_t theValue,Int_t index) { fBoolValues[index] = theValue; } Bool_t GetBoolValue(Int_t index) const { return fBoolValues[index]; } @@ -69,7 +71,7 @@ class AliRsnCutSet : public TNamed AliRsnExpression *fExpression; // pointer to AliRsnExpression - ClassDef(AliRsnCutSet,1); // ROOT dictionary + ClassDef(AliRsnCutSet,1) // ROOT dictionary }; #endif diff --git a/PWG2/RESONANCES/AliRsnDaughter.cxx b/PWG2/RESONANCES/AliRsnDaughter.cxx index bbe48e5835e..11fde071b47 100644 --- a/PWG2/RESONANCES/AliRsnDaughter.cxx +++ b/PWG2/RESONANCES/AliRsnDaughter.cxx @@ -1,14 +1,12 @@ // // Class AliRsnDaughter // +// Light-weight AOD object which contains all required track details +// which are used for resonance analysis. +// Provides converters from all kinds of input track type: ESD, AOD and MC. // -// Light-weight 'track' object into an internal format used -// for further steps of resonance analysis. -// Provides converters from all kinds of input track type -// (ESD, AOD and MC). -// Contains also a facility to compute invariant mass of a pair. -// -// author: A. Pulvirenti --- email: alberto.pulvirenti@ct.infn.it +// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) +// M. Vala (martin.vala@cern.ch) // #include @@ -35,7 +33,12 @@ AliRsnDaughter::AliRsnDaughter() : fLabel(-1), fCharge(0), fFlags(0), + fKink(0), fMass(0.0), + fChi2(0.0), + fNSigmaToVertex(-1.0), + fITSnum(0), + fTPCnum(0), fRealisticPID(AliRsnPID::kUnknown), fMCInfo(0x0) { @@ -64,7 +67,12 @@ AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) : fLabel(copy.fLabel), fCharge(copy.fCharge), fFlags(copy.fFlags), + fKink(copy.fKink), fMass(copy.fMass), + fChi2(copy.fChi2), + fNSigmaToVertex(copy.fNSigmaToVertex), + fITSnum(copy.fITSnum), + fTPCnum(copy.fTPCnum), fRealisticPID(copy.fRealisticPID), fMCInfo(0x0) { @@ -96,7 +104,12 @@ AliRsnDaughter::AliRsnDaughter(AliESDtrack *track, Bool_t useTPC) : fLabel(-1), fCharge(0), fFlags(0), + fKink(0), fMass(0.0), + fChi2(0.0), + fNSigmaToVertex(-1.0), + fITSnum(0), + fTPCnum(0), fRealisticPID(AliRsnPID::kUnknown), fMCInfo(0x0) { @@ -116,7 +129,12 @@ AliRsnDaughter::AliRsnDaughter(AliAODTrack *track) : fLabel(-1), fCharge(0), fFlags(0), + fKink(0), fMass(0.0), + fChi2(0.0), + fNSigmaToVertex(-1.0), + fITSnum(0), + fTPCnum(0), fRealisticPID(AliRsnPID::kUnknown), fMCInfo(0x0) { @@ -136,7 +154,12 @@ AliRsnDaughter::AliRsnDaughter(AliMCParticle *track) : fLabel(-1), fCharge(0), fFlags(0), + fKink(0), fMass(0.0), + fChi2(0.0), + fNSigmaToVertex(-1.0), + fITSnum(0), + fTPCnum(0), fRealisticPID(AliRsnPID::kUnknown), fMCInfo(0x0) { @@ -162,6 +185,11 @@ AliRsnDaughter& AliRsnDaughter::operator=(const AliRsnDaughter ©) fLabel = copy.fLabel; fCharge = copy.fCharge; fFlags = copy.fFlags; + fKink = copy.fKink; + fChi2 = copy.fChi2; + fNSigmaToVertex = copy.fNSigmaToVertex; + fITSnum = copy.fITSnum; + fTPCnum = copy.fTPCnum; Int_t i; for (i = 0; i < AliRsnPID::kSpecies; i++) @@ -205,6 +233,20 @@ AliRsnDaughter::~AliRsnDaughter() } } +//_____________________________________________________________________________ +void AliRsnDaughter::RotateP(Double_t angle) +{ +// +// Rotate the momentum along Z axis by an angle +// + + Double_t s = TMath::Sin(angle); + Double_t c = TMath::Cos(angle); + Double_t xx = fP[0]; + fP[0] = c*xx - s*fP[1]; + fP[1] = s*xx + c*fP[1]; +} + //_____________________________________________________________________________ void AliRsnDaughter::SetPIDWeight(Int_t i, Double_t value) { @@ -307,22 +349,37 @@ Bool_t AliRsnDaughter::Adopt(AliESDtrack* esdTrack,EPIDType pidType ,Double_t di return kFALSE; } - // copy momentum and vertex + // copy momentum, vertex, chi2 and number of clusters if (!useTPCInnerParam) { esdTrack->GetPxPyPz(fP); esdTrack->GetXYZ(fV); + fChi2 = esdTrack->GetConstrainedChi2(); + fITSnum = esdTrack->GetITSclusters(0x0); + fTPCnum = esdTrack->GetTPCclusters(0x0); } else { if (!esdTrack->GetTPCInnerParam()) return kFALSE; esdTrack->GetTPCInnerParam()->GetPxPyPz(fP); esdTrack->GetTPCInnerParam()->GetXYZ(fV); + fChi2 = esdTrack->GetTPCchi2(); + fITSnum = 0; + fTPCnum = esdTrack->GetTPCclusters(0x0); } + // define the kink index: + // 0 = no kink + // 1 = kink daughter + // -1 = kink mother + Int_t i, ik[3]; + for (i = 0; i < 3; i++) ik[i] = esdTrack->GetKinkIndex(i); + if (ik[0] < 0 || ik[1] < 0 || ik[2] < 0) fKink = -1; + else if (ik[0] > 0 || ik[1] > 0 || ik[2] > 0) fKink = 1; + else fKink = 0; + Double_t p = esdTrack->P(); // copy PID weights - Int_t i; Double_t pid[5]; if (!useTPCInnerParam) { @@ -341,6 +398,10 @@ Bool_t AliRsnDaughter::Adopt(AliESDtrack* esdTrack,EPIDType pidType ,Double_t di // copy charge sign fCharge = (Short_t)esdTrack->Charge(); + // calculate N sigma to vertex + SetNSigmaToVertex(fESDTrackCuts.GetSigmaToVertex(esdTrack)); + + return kTRUE; } @@ -371,6 +432,9 @@ Bool_t AliRsnDaughter::Adopt(AliAODTrack* aodTrack) fV[1] = aodTrack->Yv(); fV[2] = aodTrack->Zv(); + // chi2 + fChi2 = aodTrack->Chi2perNDF(); + // copy PID weights Int_t i; for (i = 0; i < 5; i++) fPIDWeight[i] = aodTrack->PID()[i]; @@ -424,16 +488,18 @@ Bool_t AliRsnDaughter::Adopt(AliMCParticle *mcParticle) // recognize charge sign from PDG code sign Int_t pdg = particle->GetPdgCode(); Int_t absPDG = TMath::Abs(pdg); - if (absPDG <= 15) + if (absPDG == 11 || absPDG == 13) { if (pdg > 0) fCharge = -1; else fCharge = 1; } - else if (absPDG < 3000) + else if (absPDG == 211 || absPDG == 321 || absPDG == 2212) { if (pdg > 0) fCharge = 1; else fCharge = -1; } else { + // when trying to "adopt" a neutral track (photon, neutron, etc.) + // for the moment a "failed" message is returned fCharge = 0; return kFALSE; } @@ -593,13 +659,20 @@ Int_t AliRsnDaughter::Compare(const TObject* obj) const } //_____________________________________________________________________________ -void AliRsnDaughter::GetESDPID(AliESDtrack * track, Double_t * pid,EPIDType pidType, Double_t divValue, Double_t val) +void AliRsnDaughter::GetESDPID +(AliESDtrack * track, Double_t * pid, EPIDType pidType, Double_t divValue, Double_t val) { // -// return PID from EPIDType type +// A simple method to define PID weights by combining the ones +// from single detectors by multiplication. +// In the case when 'kITS_TPC_TOF_SP' option is chosen, a separation value +// defines if the TOF signal must be included or not. +// This value is usually the transverse momentum, but here it is left undefined. // + Int_t i; Double_t ctmp[AliRsnPID::kSpecies]; + switch (pidType) { case kEsd : @@ -617,31 +690,31 @@ void AliRsnDaughter::GetESDPID(AliESDtrack * track, Double_t * pid,EPIDType pidT case kITS_TPC : track->GetITSpid(pid); track->GetTPCpid(ctmp); - for (Int_t i=0;i<5;i++) pid[i]*=ctmp[i]; + for (i = 0; i < 5; i++) pid[i] *= ctmp[i]; break; case kITS_TOF : track->GetITSpid(pid); track->GetTOFpid(ctmp); - for (Int_t i=0;iGetTPCpid(pid); track->GetTOFpid(ctmp); - for (Int_t i=0;iGetITSpid(pid); track->GetTPCpid(ctmp); - for (Int_t i=0;iGetTOFpid(ctmp); - for (Int_t i=0;iGetITSpid(pid); track->GetTPCpid(ctmp); - for (Int_t i=0;i 0);} void SetCharge(Short_t value) {fCharge = value;} + void SetKink(Char_t kink) {fKink = kink;} // PID virtual const Double_t* PID() const {return fPIDWeight;} @@ -110,10 +118,11 @@ class AliRsnDaughter : public AliVParticle AliRsnPID::EType PIDType(Double_t &prob) const; // check that contains a given ESD flag + UInt_t GetFlags() {return fFlags;} Bool_t CheckFlag(ULong_t flag) {return ((fFlags & flag) == flag);} // information getters from objects - Bool_t Adopt(AliESDtrack *track, EPIDType pidType = kEsd,Double_t divValue = 0.0,Bool_t useTPCInnerParam = kFALSE); + Bool_t Adopt(AliESDtrack *track, EPIDType pidType = kEsd, Double_t divValue = 0.0, Bool_t useTPCInnerParam = kFALSE); Bool_t Adopt(AliAODTrack *track); Bool_t Adopt(AliMCParticle *track); @@ -123,6 +132,17 @@ class AliRsnDaughter : public AliVParticle Int_t GetLabel() const {return -1;} void SetIndex(Int_t value) {fIndex = value;} void SetLabel(Int_t value) {fLabel = value;} + + // N sigma to vertex + Float_t NSigmaToVertex() const { return fNSigmaToVertex; } + void SetNSigmaToVertex(const Float_t& theValue) { fNSigmaToVertex = theValue; } + + + // ITS/TPC clusters + Int_t NumberOfITSClusters() const {return fITSnum;} + Int_t NumberOfTPCClusters() const {return fTPCnum;} + void SetNumberOfITSClusters(Int_t n) {fITSnum = n;} + void SetNumberOfTPCClusters(Int_t n) {fTPCnum = n;} // Utilities void Print(Option_t *option = "ALL") const; @@ -137,29 +157,40 @@ class AliRsnDaughter : public AliVParticle virtual Bool_t IsSortable() const {return kTRUE;} virtual Int_t Compare(const TObject* obj) const; + private: + static void GetESDPID + (AliESDtrack *track, Double_t *pid, EPIDType pidType = kEsd, + Double_t divValue = -1.0, Double_t val = -1.0); + Int_t fIndex; // index of source object (ESD/AOD/MC) in its collection Int_t fLabel; // label assigned to the track (act. by GEANT3) Short_t fCharge; // charge sign ULong_t fFlags; // status flags + Char_t fKink; // kink index Double_t fP[3]; // vector momentum (x, y, z) Double_t fV[3]; // DCA vertex (x, y, z) Double_t fMass; // mass (assigned externally) + Double_t fChi2; // chi square of track + Float_t fNSigmaToVertex; // N sigma to vertex + + Int_t fITSnum; // number of ITS clusters + Int_t fTPCnum; // number of TPC clusters AliRsnPID::EType fRealisticPID; // PID from Bayesian probs (largest one) Double_t fPIDProb[AliRsnPID::kSpecies]; // PID probabilities (Bayesian comp.) Double_t fPIDWeight[AliRsnPID::kSpecies]; // PID weights AliRsnMCInfo *fMCInfo; // reference to particle object (if any) + + AliESDtrackCuts fESDTrackCuts; //! tmp object of AliESDtrackCuts for fNSigmaToVertex static EPIDMethod fgPIDMethod; // flag to define how the PID is computed for this object - static void GetESDPID(AliESDtrack *track,Double_t *pid,EPIDType pidType = kEsd,Double_t divValue=-1.0,Double_t val=-1.0); - - ClassDef(AliRsnDaughter, 4); + ClassDef(AliRsnDaughter, 4) }; #endif diff --git a/PWG2/RESONANCES/AliRsnEvent.cxx b/PWG2/RESONANCES/AliRsnEvent.cxx index ec1c8a91c9b..ee024eaf0f6 100644 --- a/PWG2/RESONANCES/AliRsnEvent.cxx +++ b/PWG2/RESONANCES/AliRsnEvent.cxx @@ -312,7 +312,7 @@ TArrayI * AliRsnEvent::GetTracksArray } //_____________________________________________________________________________ -void AliRsnEvent::FillPIDArrays() +void AliRsnEvent::FillPIDArrays(Int_t arraySizeInit) { // // Initializes and fills the AliRsnPIDIndex objects containing @@ -323,9 +323,9 @@ void AliRsnEvent::FillPIDArrays() if (fNoPID) delete fNoPID; if (fPerfectPID) delete fPerfectPID; if (fRealisticPID) delete fRealisticPID; - fNoPID = new AliRsnPIDIndex(2000); - fPerfectPID = new AliRsnPIDIndex(2000); - fRealisticPID = new AliRsnPIDIndex(2000); + fNoPID = new AliRsnPIDIndex(arraySizeInit); + fPerfectPID = new AliRsnPIDIndex(arraySizeInit); + fRealisticPID = new AliRsnPIDIndex(arraySizeInit); // set the default type to Realistic AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic); @@ -389,6 +389,32 @@ void AliRsnEvent::Print(Option_t *option) const } } +//_____________________________________________________________________________ +void AliRsnEvent::MakeComputations() +{ +// +// Computes all required overall variables: +// - multiplicity +// - mean phi of tracks +// + + if (!fTracks) { + fMult = 0; + fPhiMean = 0.0; + } + else { + fMult = fTracks->GetEntries(); + fPhiMean = 0.0; + + AliRsnDaughter *d = 0; + TObjArrayIter next(fTracks); + while ( (d = (AliRsnDaughter*)next()) ) { + fPhiMean += d->Phi(); + } + fPhiMean /= (Double_t)fMult; + } +} + //_____________________________________________________________________________ void AliRsnEvent::CorrectByPrimaryVertex() { @@ -404,6 +430,7 @@ void AliRsnEvent::CorrectByPrimaryVertex() } } +/* //_____________________________________________________________________________ Int_t AliRsnEvent::GetMultiplicity() const { @@ -414,6 +441,7 @@ Int_t AliRsnEvent::GetMultiplicity() const if (!fTracks) return 0; return fTracks->GetEntries(); } +*/ //_____________________________________________________________________________ Int_t AliRsnEvent::GetNCharged(Char_t sign) diff --git a/PWG2/RESONANCES/AliRsnEvent.h b/PWG2/RESONANCES/AliRsnEvent.h index 651681e41c6..3ee2278a326 100644 --- a/PWG2/RESONANCES/AliRsnEvent.h +++ b/PWG2/RESONANCES/AliRsnEvent.h @@ -48,15 +48,17 @@ class AliRsnEvent : public TNamed TClonesArray* GetTracks() {return fTracks;} TArrayI* GetCharged(Char_t sign); TArrayI* GetTracksArray(AliRsnDaughter::EPIDMethod method, Char_t sign, AliRsnPID::EType type); - void FillPIDArrays(); + void FillPIDArrays(Int_t arraySizeDefault = 1000); void SortTracks() {fTracks->Sort();} void Print(Option_t *option = "") const; + void MakeComputations(); // Primary vertex Double_t GetPrimaryVertexX() const {return fPVx;} Double_t GetPrimaryVertexY() const {return fPVy;} Double_t GetPrimaryVertexZ() const {return fPVz;} void GetPrimaryVertex(Double_t &x, Double_t &y, Double_t &z) const {x=fPVx;y=fPVy;z=fPVz;} + Double_t GetVz() const {return GetPrimaryVertexZ();} void SetPrimaryVertexX(Double_t value) {fPVx = value;} void SetPrimaryVertexY(Double_t value) {fPVy = value;} void SetPrimaryVertexZ(Double_t value) {fPVz = value;} @@ -64,8 +66,11 @@ class AliRsnEvent : public TNamed void CorrectByPrimaryVertex(); // Multiplicity - Int_t GetMultiplicity() const; + Int_t GetMultiplicity() const {return fMult;} Int_t GetNCharged(Char_t sign); + + // Mean phi + Double_t GetPhiMean() const {return fPhiMean;} private: @@ -75,6 +80,8 @@ class AliRsnEvent : public TNamed Double_t fPVx; // position of Double_t fPVy; // primary Double_t fPVz; // vertex + Double_t fPhiMean; // mean "phi" coord of all tracks + Int_t fMult; // track multiplicity TClonesArray *fTracks; // collection of particles diff --git a/PWG2/RESONANCES/AliRsnEventBuffer.cxx b/PWG2/RESONANCES/AliRsnEventBuffer.cxx index 9d18c0277c4..9ff3ad93e12 100644 --- a/PWG2/RESONANCES/AliRsnEventBuffer.cxx +++ b/PWG2/RESONANCES/AliRsnEventBuffer.cxx @@ -24,6 +24,9 @@ // #include "AliLog.h" + +#include "AliRsnCut.h" +#include "AliRsnCutSet.h" #include "AliRsnEventBuffer.h" ClassImp(AliRsnEventBuffer) @@ -91,10 +94,32 @@ void AliRsnEventBuffer::AddEvent(AliRsnEvent * event) if (fEventsBufferIndex >= fEventsBufferSize - 1) ResetIndex(); fEventsBufferIndex++; - if (fEventsBuffer[fEventsBufferIndex]) + if (fEventsBuffer[fEventsBufferIndex]) { + //AliInfo("Replacing event"); *fEventsBuffer[fEventsBufferIndex] = *event; - else + } + else { + //AliInfo("New event"); fEventsBuffer[fEventsBufferIndex] = new AliRsnEvent(*event); + } + + // correct for primary vertex + fEventsBuffer[fEventsBufferIndex]->CorrectByPrimaryVertex(); +} + +//_____________________________________________________________________________ +Int_t AliRsnEventBuffer::IndexOf(AliRsnEvent * event) +{ +// +// Return position of the event +// + + Int_t i; + for (i = 0; i < fEventsBufferSize; i++) { + if (event == fEventsBuffer[i]) return i; + } + + return -1; } //_____________________________________________________________________________ @@ -116,6 +141,36 @@ AliRsnEvent * AliRsnEventBuffer::GetNextEvent() else return GetEvent(fEventsBufferIndex + 1); } +//_____________________________________________________________________________ +AliRsnEvent * AliRsnEventBuffer::GetNextGoodEvent +(Int_t &start, AliRsnCutSet *cuts) +{ +// +// Scans the buffer starting from 'start' in order to +// find another event which satisfies the cuts defined in 'cuts'. +// If it finds such an event, returns it and upgrades the 'start' value +// to its position, otherwise returns NULL. +// + + Int_t i = start; + AliRsnEvent *ref = GetCurrentEvent(); + AliRsnEvent *ev = 0x0; + for(;;i++) { + ev = GetEvent(i); + if (!ev) break; + if (!cuts) { + start = i; + return ev; + } + else if (cuts->IsSelected(AliRsnCut::kMixEvent, ref, ev)) { + start = i; + return ev; + } + } + + return 0x0; +} + //_____________________________________________________________________________ AliRsnEvent * AliRsnEventBuffer::GetEvent(Int_t index) { diff --git a/PWG2/RESONANCES/AliRsnEventBuffer.h b/PWG2/RESONANCES/AliRsnEventBuffer.h index e7493bba5c8..52c15f621c9 100644 --- a/PWG2/RESONANCES/AliRsnEventBuffer.h +++ b/PWG2/RESONANCES/AliRsnEventBuffer.h @@ -18,6 +18,8 @@ #include "AliRsnEvent.h" +class AliRsnCutSet; + class AliRsnEventBuffer : public TObject { public: @@ -29,9 +31,11 @@ class AliRsnEventBuffer : public TObject void ResetIndex(); void AddEvent(AliRsnEvent *event); + Int_t IndexOf(AliRsnEvent *event); AliRsnEvent *GetEvent(Int_t index) ; AliRsnEvent *GetCurrentEvent(); AliRsnEvent *GetNextEvent(); + AliRsnEvent *GetNextGoodEvent(Int_t &start, AliRsnCutSet *cuts = 0); void SetEventsBufferSize(const Int_t& theValue) { fEventsBufferSize = theValue; } Int_t GetEventsBufferSize() const { return fEventsBufferSize; } diff --git a/PWG2/RESONANCES/AliRsnFunction.cxx b/PWG2/RESONANCES/AliRsnFunction.cxx index 36926b8e618..ac10aeddfc5 100644 --- a/PWG2/RESONANCES/AliRsnFunction.cxx +++ b/PWG2/RESONANCES/AliRsnFunction.cxx @@ -11,8 +11,8 @@ // because the AliRsnAnalyzer which executes the analysis will accept a collection // of such objects, in order to have a unique format of processing method // -// The user who implements a kind of computation type should inherit from -// this class and override the virtual functions defined in it, which +// The user who implements a kind of computation type should inherit from +// this class and override the virtual functions defined in it, which // initialize the final output histogram and define how to process data. // // @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -40,13 +39,14 @@ ClassImp(AliRsnFunction) //________________________________________________________________________________________ AliRsnFunction::AliRsnFunction() : - fFcnType(kFcnTypes), - fUseBins(kFALSE), - fSkipOutsideInterval(kFALSE), - fBins(0), - fBinningCut(), - fBinningCutType(AliRsnCut::kLastCutType), - fHistoDef(0x0) + fFcnType(kFcnTypes), + fRotAngle(0.0), + fUseBins(kFALSE), + fSkipOutsideInterval(kFALSE), + fBins(0), + fBinningCut(), + fBinningCutType(AliRsnCut::kLastCutType), + fHistoDef(0x0) { // // Constructor. @@ -54,9 +54,10 @@ AliRsnFunction::AliRsnFunction() : // its initialization MUST be defined inside the Init() method, // which must be overridden in any derivate implementation. // - + Int_t i; - for (i = 0; i < 100; i++) { + for (i = 0; i < 100; i++) + { fHisto[i] = 0x0; } } @@ -64,13 +65,14 @@ AliRsnFunction::AliRsnFunction() : //________________________________________________________________________________________ AliRsnFunction::AliRsnFunction (EFcnType type, AliRsnHistoDef *hd, Bool_t skipOut) : - fFcnType(type), - fUseBins(kFALSE), - fSkipOutsideInterval(skipOut), - fBins(0), - fBinningCut(), - fBinningCutType(AliRsnCut::kLastCutType), - fHistoDef(hd) + fFcnType(type), + fRotAngle(0.0), + fUseBins(kFALSE), + fSkipOutsideInterval(skipOut), + fBins(0), + fBinningCut(), + fBinningCutType(AliRsnCut::kLastCutType), + fHistoDef(hd) { // // Constructor. @@ -78,23 +80,25 @@ AliRsnFunction::AliRsnFunction // its initialization MUST be defined inside the Init() method, // which must be overridden in any derivate implementation. // - + Int_t i; - for (i = 0; i < 100; i++) { + for (i = 0; i < 100; i++) + { fHisto[i] = 0x0; } } //________________________________________________________________________________________ AliRsnFunction::AliRsnFunction(const AliRsnFunction ©) : - TObject(copy), - fFcnType(copy.fFcnType), - fUseBins(copy.fUseBins), - fSkipOutsideInterval(copy.fSkipOutsideInterval), - fBins(0), - fBinningCut(), - fBinningCutType(AliRsnCut::kLastCutType), - fHistoDef(copy.fHistoDef) + TObject(copy), + fFcnType(copy.fFcnType), + fRotAngle(copy.fRotAngle), + fUseBins(copy.fUseBins), + fSkipOutsideInterval(copy.fSkipOutsideInterval), + fBins(0), + fBinningCut(), + fBinningCutType(AliRsnCut::kLastCutType), + fHistoDef(copy.fHistoDef) { // // Copy constructor. @@ -102,11 +106,13 @@ AliRsnFunction::AliRsnFunction(const AliRsnFunction ©) : // Int_t i, n = 100; - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) + { fHisto[i] = 0x0; } - - if (fUseBins) { + + if (fUseBins) + { n = copy.fBins.GetSize(); Double_t *array = new Double_t[n]; for (i = 0; i < n; i++) array[i] = copy.fBins[i]; @@ -135,7 +141,8 @@ void AliRsnFunction::Clear(Option_t* /*option*/) // Int_t i; - for (i = 0; i < 100; i++) { + for (i = 0; i < 100; i++) + { delete fHisto[i]; fHisto[i] = 0x0; } @@ -153,33 +160,35 @@ TList* AliRsnFunction::Init(const char *histoName, const char *histoTitle) // Clear(); - + Int_t i, ibin, nbins = fHistoDef->GetNBins(); Double_t min = fHistoDef->GetMin(), max = fHistoDef->GetMax(); - + // list is created and named after the general // settings used for the contained histograms TList *histos = new TList; histos->SetName(Form("%s", GetFcnName().Data())); - - // a general histogram is always added, + + // a general histogram is always added, // which overrides the binning and collects everything fHisto[0] = new TH1D(histoName, histoTitle, nbins, min, max); histos->AddLast(fHisto[0]); - - // if requested a binning w.r. to some cut variable, histograms are added + + // if requested a binning w.r. to some cut variable, histograms are added // for that in this part of the method (one per each bin) Char_t hName[255]; Char_t hTitle[255]; - if (fUseBins) { - for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) { + if (fUseBins) + { + for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) + { sprintf(hName, "%s[%.2f-%.2f]", histoName, fBins[ibin], fBins[ibin+1]); sprintf(hTitle, "%s [%.2f-%.2f]", histoTitle, fBins[ibin], fBins[ibin+1]); fHisto[i] = new TH1D(hName, hTitle, nbins, min, max); histos->AddLast(fHisto[i]); } } - + // returns the full list at the end return histos; } @@ -196,28 +205,31 @@ void AliRsnFunction::Init(const char *histoName, const char *histoTitle, TList * // Clear(); - + Int_t i, ibin, nbins = fHistoDef->GetNBins(); Double_t min = fHistoDef->GetMin(), max = fHistoDef->GetMax(); - + // list is created and named after the general // settings used for the contained histograms - if (!histos) { + if (!histos) + { AliError("NULL target list!"); return; } - - // a general histogram is always added, + + // a general histogram is always added, // which overrides the binning and collects everything fHisto[0] = new TH1D(histoName, histoTitle, nbins, min, max); histos->AddLast(fHisto[0]); - - // if requested a binning w.r. to some cut variable, histograms are added + + // if requested a binning w.r. to some cut variable, histograms are added // for that in this part of the method (one per each bin) Char_t hName[255]; Char_t hTitle[255]; - if (fUseBins) { - for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) { + if (fUseBins) + { + for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) + { sprintf(hName, "%s[%.2f-%.2f]", histoName, fBins[ibin], fBins[ibin+1]); sprintf(hTitle, "%s [%.2f-%.2f]", histoTitle, fBins[ibin], fBins[ibin+1]); fHisto[i] = new TH1D(hName, hTitle, nbins, min, max); @@ -233,13 +245,14 @@ void AliRsnFunction::SetBinningCut // // Set fixed bins // - + fUseBins = kTRUE; Int_t i, nBins = (Int_t)((max - min) / step) + 1; fBinningCutType = type; fBins.Set(nBins); - for (i = 0; i < nBins; i++) { + for (i = 0; i < nBins; i++) + { fBins[i] = min + (Double_t)i * step; } } @@ -257,7 +270,8 @@ void AliRsnFunction::SetBinningCut Int_t i; fBinningCutType = type; fBins.Set(nbins); - for (i = 0; i < nbins; i++) { + for (i = 0; i < nbins; i++) + { fBins[i] = bins[i]; } } @@ -271,22 +285,26 @@ TString AliRsnFunction::GetFcnName() TString text("Undef"); - switch (fFcnType) { - case kInvMass: - text = "IM"; - break; - case kInvMassMC: - text = "IM_MC"; - break; - case kResolution: - text = "RES"; - break; - case kPtSpectrum: - text = "PT"; - default: - AliError("Type not defined"); + switch (fFcnType) + { + case kInvMass: + text = "IM"; + break; + case kInvMassMC: + text = "IM_MC"; + break; + case kInvMassRotated: + text = Form("IMR%.2f", fRotAngle); + break; + case kResolution: + text = "RES"; + break; + case kPtSpectrum: + text = "PT"; + default: + AliError("Type not defined"); } - + return text; } @@ -296,25 +314,26 @@ TString AliRsnFunction::GetFcnTitle() // // Return a string which names the function type // - + TString text("Undef"); - switch (fFcnType) { - case kInvMass: - text = "Invariant mass"; - break; - case kInvMassMC: - text = "Invariant mass (MC)"; - break; - case kResolution: - text = "Resolution"; - break; - case kPtSpectrum: - text = "p_{#perp} distribution"; - default: - AliError("Type not defined"); + switch (fFcnType) + { + case kInvMass: + text = "Invariant mass"; + break; + case kInvMassMC: + text = "Invariant mass (MC)"; + break; + case kResolution: + text = "Resolution"; + break; + case kPtSpectrum: + text = "p_{#perp} distribution"; + default: + AliError("Type not defined"); } - + return text; } @@ -328,29 +347,32 @@ Bool_t AliRsnFunction::Fill(AliRsnPairParticle *pair, AliRsnPairDef *ref, Double Double_t value = FcnValue(pair, ref); if (fSkipOutsideInterval) - { - if (value < fHistoDef->GetMin()) return kFALSE; - if (value > fHistoDef->GetMax()) return kFALSE; - } - + { + if (value < fHistoDef->GetMin()) return kFALSE; + if (value > fHistoDef->GetMax()) return kFALSE; + } + // fill global histogram if (weight == 0.0) fHisto[0]->Fill(value); else fHisto[0]->Fill(value, weight); - + // if bins are allocated, find right one and fill it - if (fUseBins) { + if (fUseBins) + { Int_t i, ibin; - for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) { + for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) + { if (!fHisto[i]) continue; fBinningCut.SetCutValues(fBinningCutType, fBins[ibin], fBins[ibin+1]); - if (fBinningCut.IsSelected(AliRsnCut::kPair, pair)) { + if (fBinningCut.IsSelected(AliRsnCut::kPair, pair)) + { if (weight == 0.0) fHisto[i]->Fill(value); else fHisto[i]->Fill(value, weight); break; } } } - + return kTRUE; } @@ -362,19 +384,29 @@ Double_t AliRsnFunction::FcnValue(AliRsnPairParticle *pair, AliRsnPairDef *ref) // It computes the value which must be used to fill the histogram. // - switch (fFcnType) { - case kInvMass: - return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1)); - case kInvMassMC: - return pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1)); - case kResolution: - return FcnResolution(pair, ref); - case kPtSpectrum: - return pair->GetPt(); - default: - AliError("Type not defined"); + switch (fFcnType) + { + case kInvMass: + return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1)); + case kInvMassMC: + return pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1)); + case kInvMassRotated: + //AliInfo(Form("*** ROTATION ANGLE = %f ***", fRotAngle)); + //AliInfo(Form("UNROTATED INV MASS = %f", pair->GetInvMass(ref->GetMass(0), ref->GetMass(1)))); + //pair->GetDaughter(1)->Print("P"); + pair->GetDaughter(1)->RotateP(fRotAngle * TMath::DegToRad()); + pair->ResetPair(); + //AliInfo(Form(" ROTATED INV MASS = %f", pair->GetInvMass(ref->GetMass(0), ref->GetMass(1)))); + //pair->GetDaughter(1)->Print("P"); + return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1)); + case kResolution: + return FcnResolution(pair, ref); + case kPtSpectrum: + return pair->GetPt(); + default: + AliError("Type not defined"); } - + return 0.0; } @@ -387,6 +419,6 @@ inline Double_t AliRsnFunction::FcnResolution(AliRsnPairParticle *pair, AliRsnPa Double_t recInvMass = pair->GetInvMass(ref->GetMass(0), ref->GetMass(1)); Double_t simInvMass = pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1)); - + return (simInvMass - recInvMass) / simInvMass; } diff --git a/PWG2/RESONANCES/AliRsnFunction.h b/PWG2/RESONANCES/AliRsnFunction.h index 0db1b145597..e73e8dd8c5c 100644 --- a/PWG2/RESONANCES/AliRsnFunction.h +++ b/PWG2/RESONANCES/AliRsnFunction.h @@ -11,8 +11,8 @@ // because the AliRsnAnalyzer which executes the analysis will accept a collection // of such objects, in order to have a unique format of processing method // -// The user who implements a kind of computation type should inherit from -// this class and override the virtual functions defined in it, which +// The user who implements a kind of computation type should inherit from +// this class and override the virtual functions defined in it, which // initialize the final output histogram and define how to process data. // // @@ -36,12 +36,13 @@ class AliRsnEvent; class AliRsnFunction : public TObject { -public: + public: enum EFcnType { kInvMass, kInvMassMC, + kInvMassRotated, kResolution, kPtSpectrum, kFcnTypes @@ -58,10 +59,11 @@ public: AliRsnHistoDef* GetHistoDef() {return fHistoDef;} TString GetFcnName(); TString GetFcnTitle(); - + void SetBinningCut(AliRsnCut::EType type, Double_t min, Double_t max, Double_t step); - void SetBinningCut(AliRsnCut::EType type, Int_t nbins, Double_t *bins); + void SetBinningCut(AliRsnCut::EType type, Int_t nbins, Double_t *bins); void SetHistoDef(AliRsnHistoDef *def) {fHistoDef = def;} + void SetRotationAngle(Double_t rotAngle) {fRotAngle = rotAngle;} // working routines TList* Init(const char *histoName, const char *histoTitle); @@ -69,24 +71,26 @@ public: Bool_t Fill(AliRsnPairParticle *pair, AliRsnPairDef *ref, Double_t weight = 0.0); Double_t FcnValue(AliRsnPairParticle *pair, AliRsnPairDef *ref); -private: - + private: + const AliRsnFunction& operator=(const AliRsnFunction ©); - + Double_t FcnResolution(AliRsnPairParticle *pair, AliRsnPairDef *pd); - + EFcnType fFcnType; // function type + + Double_t fRotAngle; // rotation angle (for "rotated" invMass) Bool_t fUseBins; // flag to choose if binning is used Bool_t fSkipOutsideInterval; // skip pairs which fall outside histogram interval - + TArrayD fBins; // low edge of each bin (upper is the low edge of next bin) AliRsnCut fBinningCut; // binning cut AliRsnCut::EType fBinningCutType;// binning cut type AliRsnHistoDef *fHistoDef; // definitions for histogram TH1D *fHisto[100]; // binned histograms - + // ROOT dictionary ClassDef(AliRsnFunction, 1) }; diff --git a/PWG2/RESONANCES/AliRsnHistoDef.cxx b/PWG2/RESONANCES/AliRsnHistoDef.cxx index ab6cf151705..dc3a1a2b58a 100644 --- a/PWG2/RESONANCES/AliRsnHistoDef.cxx +++ b/PWG2/RESONANCES/AliRsnHistoDef.cxx @@ -18,9 +18,9 @@ ClassImp(AliRsnHistoDef) //_____________________________________________________________________________ AliRsnHistoDef::AliRsnHistoDef() : - fNBins(0), - fMin(0.0), - fMax(0.0) + fNBins(0), + fMin(0.0), + fMax(0.0) { // // Default constructor @@ -30,14 +30,14 @@ AliRsnHistoDef::AliRsnHistoDef() : //_____________________________________________________________________________ AliRsnHistoDef::AliRsnHistoDef (Int_t nbins, Double_t min, Double_t max) : - fNBins(0), - fMin(0.0), - fMax(0.0) + fNBins(0), + fMin(0.0), + fMax(0.0) { // // 1D histo definition. // - SetBins(nbins, min, max); + SetBins(nbins, min, max); } //_____________________________________________________________________________ @@ -46,14 +46,16 @@ void AliRsnHistoDef::SetBins(Int_t n, Double_t min, Double_t max) // // Binning for histogram. // - fNBins = n; - - if (min < max) { - fMin = min; - fMax = max; - } - else { - fMin = max; - fMax = min; - } + fNBins = n; + + if (min < max) + { + fMin = min; + fMax = max; + } + else + { + fMin = max; + fMax = min; + } } diff --git a/PWG2/RESONANCES/AliRsnHistoDef.h b/PWG2/RESONANCES/AliRsnHistoDef.h index 4e841979eed..a47d53cf412 100644 --- a/PWG2/RESONANCES/AliRsnHistoDef.h +++ b/PWG2/RESONANCES/AliRsnHistoDef.h @@ -4,7 +4,7 @@ // Histogram definition. // Contains required informations to create a histogram // with fixed bin size: number of bins, minimum and maximum. -// Variable bin sizes are not considered because they are +// Variable bin sizes are not considered because they are // not used as typical output of analysis in this package. // diff --git a/PWG2/RESONANCES/AliRsnMCInfo.cxx b/PWG2/RESONANCES/AliRsnMCInfo.cxx index de84229bb01..d47556d3ddd 100644 --- a/PWG2/RESONANCES/AliRsnMCInfo.cxx +++ b/PWG2/RESONANCES/AliRsnMCInfo.cxx @@ -1,3 +1,11 @@ +// +// Class AliRsnMCInfo +// +// Contains informations from the MonteCarlo particle is associated to a track. +// It is used when looking at "perfect" PID and at "true" pairs, but the user +// does not need to access its methods. +// + #include "AliLog.h" #include "AliRsnMCInfo.h" @@ -5,21 +13,21 @@ ClassImp(AliRsnMCInfo) //_____________________________________________________________________________ -AliRsnMCInfo::AliRsnMCInfo() : TObject(), - fEnergy(0), - fPDG(0), - fMother(-1), - fMotherPDG(0) +AliRsnMCInfo::AliRsnMCInfo() : + TObject(), fEnergy(0), fPDG(0), fMother(-1), fMotherPDG(0) { // // Default constructor. -// Initializes all data-members with meaningless values. +// Initializes all data-members to meaningless values. // - for (Int_t i = 0; i < 3; i++) fP[i] = 0.0; + + Int_t i; + for (i = 0; i < 3; i++) fP[i] = 0.0; } //_____________________________________________________________________________ -AliRsnMCInfo::AliRsnMCInfo(const AliRsnMCInfo & copy) : TObject(copy), +AliRsnMCInfo::AliRsnMCInfo(const AliRsnMCInfo & copy) : + TObject(copy), fEnergy(copy.fEnergy), fPDG(copy.fPDG), fMother(copy.fMother), @@ -27,27 +35,27 @@ AliRsnMCInfo::AliRsnMCInfo(const AliRsnMCInfo & copy) : TObject(copy), { // // Copy constructor. -// Initializes all data-members with meaningless values. // - for (Int_t i = 0; i < 3; i++) fP[i] = copy.fP[i]; - + Int_t i; + for (i = 0; i < 3; i++) fP[i] = copy.fP[i]; } //_____________________________________________________________________________ AliRsnMCInfo::~AliRsnMCInfo() { +// +// Destructor. +// Does nothing because there are no pointers to clean. +// } //_____________________________________________________________________________ void AliRsnMCInfo::Adopt(TParticle * particle) { // -// Copies data from a TParticle into "this": -// - PDG code -// - GEANT label of mother (if any, otherwise -1) -// If the argument is NULL, nothing is done, and an alert -// is given by the method. +// Uses a TParticle to initialize its data members. +// If the argument is NULL, nothing is done and an error message is returned. // if (!particle) diff --git a/PWG2/RESONANCES/AliRsnMCInfo.h b/PWG2/RESONANCES/AliRsnMCInfo.h index b70eca5176a..f0f9cfb3c78 100644 --- a/PWG2/RESONANCES/AliRsnMCInfo.h +++ b/PWG2/RESONANCES/AliRsnMCInfo.h @@ -1,13 +1,24 @@ -#ifndef AliRsnMCInfo_h -#define AliRsnMCInfo_h +// +// Class AliRsnMCInfo +// +// Contains informations from the MonteCarlo particle is associated to a track. +// It is used when looking at "perfect" PID and at "true" pairs, but the user +// does not need to access its methods. +// +// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) +// M. Vala (martin.vala@cern.ch) +// + +#ifndef ALIRSNMCINFO_H +#define ALIRSNMCINFO_H -#include #include #include class AliRsnMCInfo : public TObject { public: + AliRsnMCInfo(); AliRsnMCInfo(const AliRsnMCInfo ©); @@ -15,35 +26,35 @@ class AliRsnMCInfo : public TObject void Adopt(TParticle *part); // 4-momentum - virtual Double_t E() const {return fEnergy;} - virtual Double_t E(Double_t mass) {return TMath::Sqrt(mass*mass + P2());} - virtual Double_t M() const {return TMath::Sqrt(fEnergy*fEnergy - P2());} - virtual Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();} - virtual Double_t P() const {return TMath::Sqrt(P2());} - virtual Double_t Px() const {return fP[0];} - virtual Double_t Py() const {return fP[1];} - virtual Double_t Pz() const {return fP[2];} - virtual Double_t Pt() const {return TMath::Sqrt(Px() *Px() + Py() *Py());} - virtual Double_t OneOverPt() const {return 1.0 / Pt();} - virtual Bool_t PxPyPz(Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;} - - virtual Double_t Phi() const {return TMath::ATan2(Py(), Px());} - virtual Double_t Theta() const {return TMath::ATan2(Pt(), Pz());} - virtual Double_t Eta() const {return -TMath::Log(TMath::Tan(0.5*Theta()));} - virtual Double_t Y() const {return TMath::Log((E() + Pz()) / (E() - Pz()));} - - void SetPx(Double_t value) {fP[0] = value;} - void SetPy(Double_t value) {fP[1] = value;} - void SetPz(Double_t value) {fP[2] = value;} - void SetP(Double_t px, Double_t py, Double_t pz) {SetPx(px); SetPy(py); SetPz(pz);} - void SetE(Double_t e) {fEnergy = e;} - - Int_t PDG() const {return fPDG;} - Int_t Mother() const {return fMother;} - Short_t MotherPDG() const {return fMotherPDG;} - void SetPDG(Int_t pdg) {fPDG = pdg;} - void SetMother(Int_t mlabel) {fMother = mlabel;} - void SetMotherPDG(Int_t pdg) {fMotherPDG = (Short_t) pdg;} + Double_t E() const {return fEnergy;} + Double_t E(Double_t mass) {return TMath::Sqrt(mass*mass + P2());} + Double_t M() const {return TMath::Sqrt(fEnergy*fEnergy - P2());} + Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();} + Double_t P() const {return TMath::Sqrt(P2());} + Double_t Px() const {return fP[0];} + Double_t Py() const {return fP[1];} + Double_t Pz() const {return fP[2];} + Double_t Pt() const {return TMath::Sqrt(Px() *Px() + Py() *Py());} + Double_t OneOverPt() const {return 1.0 / Pt();} + Bool_t PxPyPz(Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;} + + Double_t Phi() const {return TMath::ATan2(Py(), Px());} + Double_t Theta() const {return TMath::ATan2(Pt(), Pz());} + Double_t Eta() const {return -TMath::Log(TMath::Tan(0.5*Theta()));} + Double_t Y() const {return 0.5 * TMath::Log((E() + Pz()) / (E() - Pz()));} + + void SetPx(Double_t value) {fP[0] = value;} + void SetPy(Double_t value) {fP[1] = value;} + void SetPz(Double_t value) {fP[2] = value;} + void SetP(Double_t px, Double_t py, Double_t pz) {SetPx(px); SetPy(py); SetPz(pz);} + void SetE(Double_t e) {fEnergy = e;} + + Int_t PDG() const {return fPDG;} + Int_t Mother() const {return fMother;} + Short_t MotherPDG() const {return fMotherPDG;} + void SetPDG(Int_t pdg) {fPDG = pdg;} + void SetMother(Int_t mlabel) {fMother = mlabel;} + void SetMotherPDG(Int_t pdg) {fMotherPDG = (Short_t) pdg;} private: diff --git a/PWG2/RESONANCES/AliRsnPID.cxx b/PWG2/RESONANCES/AliRsnPID.cxx index 2e53130cb80..b0c68c02ba0 100644 --- a/PWG2/RESONANCES/AliRsnPID.cxx +++ b/PWG2/RESONANCES/AliRsnPID.cxx @@ -1,28 +1,14 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -//------------------------------------------------------------------------- -// Class AliRsnPID -// ------------------- -// Simple collection of reconstructed tracks -// selected from an ESD event -// to be used for analysis. -// ......................................... // -// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it) -//------------------------------------------------------------------------- +// Class AliRsnPID +// +// Processes the tracks to compute PID probabilities, +// by combining the prior probabilities with the PID weights +// stored in each AliRsnDaughter +// +// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) +// M. Vala (martin.vala@cern.ch) +// + #include #include @@ -34,9 +20,9 @@ #include "AliRsnPID.h" -ClassImp ( AliRsnPID ) +ClassImp(AliRsnPID) - const Double_t AliRsnPID::fgkParticleMass[AliRsnPID::kSpeciesAll + 1] = +const Double_t AliRsnPID::fgkParticleMass[AliRsnPID::kSpeciesAll + 1] = { 0.00051099892, // electron 0.105658369, // muon @@ -98,9 +84,9 @@ const Int_t AliRsnPID::fgkParticlePDG[AliRsnPID::kSpeciesAll + 1] = //_____________________________________________________________________________ AliRsnPID::AliRsnPID() : - TNamed ( "RsnPID", "" ), - fMaxPt ( 100.0 ), - fMinProb ( 0.0 ) + TNamed("RsnPID", ""), + fMaxPt(100.0), + fMinProb(0.0) { // // Constructor. @@ -108,13 +94,13 @@ AliRsnPID::AliRsnPID() : // Int_t i; - for ( i = 0; i < kSpecies; i++ ) fPrior[i] = 0.0; + for (i = 0; i < kSpecies; i++) fPrior[i] = 0.0; // gDirectory->Append(this, kTRUE); } //_____________________________________________________________________________ -AliRsnPID::EType AliRsnPID::InternalType ( Int_t pdg ) +AliRsnPID::EType AliRsnPID::InternalType(Int_t pdg) // // Return the internal enum value corresponding to the PDG // code passed as argument, if possible. @@ -122,9 +108,9 @@ AliRsnPID::EType AliRsnPID::InternalType ( Int_t pdg ) // { EType value; - Int_t absPDG = TMath::Abs ( pdg ); + Int_t absPDG = TMath::Abs(pdg); - switch ( absPDG ) + switch (absPDG) { case 11: value = kElectron; @@ -155,14 +141,14 @@ AliRsnPID::EType AliRsnPID::InternalType ( Int_t pdg ) //_____________________________________________________________________________ -Int_t AliRsnPID::PDGCode ( EType type ) +Int_t AliRsnPID::PDGCode(EType type) { // // Returns the PDG code of the particle type // specified as argument (w.r. to the internal enum) // - if ( type >= kElectron && type <= kUnknown ) + if (type >= kElectron && type <= kUnknown) { return fgkParticlePDG[type]; } @@ -173,14 +159,14 @@ Int_t AliRsnPID::PDGCode ( EType type ) } //_____________________________________________________________________________ -const char* AliRsnPID::ParticleName ( EType type, Bool_t shortName ) +const char* AliRsnPID::ParticleName(EType type, Bool_t shortName) { // // Returns the name of the particle type // specified as argument (w.r. to the internal enum) // - if ( type >= kElectron && type <= kSpeciesAll ) + if (type >= 0 && type <= kSpeciesAll) { return shortName ? fgkParticleNameShort[type] : fgkParticleNameLong[type]; } @@ -191,14 +177,14 @@ const char* AliRsnPID::ParticleName ( EType type, Bool_t shortName ) } //_____________________________________________________________________________ -const char* AliRsnPID::ParticleNameLatex ( EType type ) +const char* AliRsnPID::ParticleNameLatex(EType type) { // // Returns the name of the particle type // specified as argument (w.r. to the internal enum) // - if ( type >= kElectron && type <= kSpeciesAll ) + if (type >= kElectron && type <= kSpeciesAll) { return fgkParticleNameLatex[type]; } @@ -209,7 +195,7 @@ const char* AliRsnPID::ParticleNameLatex ( EType type ) } //_____________________________________________________________________________ -Double_t AliRsnPID::ParticleMass ( EType type ) +Double_t AliRsnPID::ParticleMass(EType type) { // // Returns the mass corresponding to the particle type @@ -220,12 +206,12 @@ Double_t AliRsnPID::ParticleMass ( EType type ) Int_t pdg = PDGCode(type); return db->GetParticle(pdg)->Mass(); */ - if ( type >= kElectron && type < kSpeciesAll ) return fgkParticleMass[type]; + if (type >= kElectron && type < kSpeciesAll) return fgkParticleMass[type]; return 0.0; } //_____________________________________________________________________________ -Bool_t AliRsnPID::ComputeProbs ( AliRsnDaughter *daughter ) +Bool_t AliRsnPID::ComputeProbs(AliRsnDaughter *daughter) { // // Uses the Bayesian combination of prior probabilities @@ -245,28 +231,28 @@ Bool_t AliRsnPID::ComputeProbs ( AliRsnDaughter *daughter ) // reset all PID probabilities to 0.0 Int_t i; - for ( i = 0; i < kSpecies; i++ ) daughter->SetPIDProb ( i, 1.0 / ( Double_t ) kSpecies ); + for (i = 0; i < kSpecies; i++) daughter->SetPIDProb(i, 1.0 / (Double_t) kSpecies); // multiply weights and priors Double_t sum = 0.0, prob[kSpecies]; - for ( i = 0; i < kSpecies; i++ ) + for (i = 0; i < kSpecies; i++) { - prob[i] = fPrior[i] * daughter->PID() [i]; + prob[i] = fPrior[i] * daughter->PID()[i]; sum += prob[i]; } - if ( sum <= ( Double_t ) 0. ) + if (sum <= (Double_t) 0.) { - AliError ( Form ( "Sum of weights = %f <= 0", sum ) ); + AliError(Form("Sum of weights = %f <= 0", sum)); return kFALSE; } // normalize - for ( i = 0; i < kSpecies; i++ ) + for (i = 0; i < kSpecies; i++) { prob[i] /= sum; - daughter->SetPIDProb ( i, prob[i] ); + daughter->SetPIDProb(i, prob[i]); } - + daughter->AssignRealisticPID(); Double_t assprob; AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic); @@ -277,7 +263,7 @@ Bool_t AliRsnPID::ComputeProbs ( AliRsnDaughter *daughter ) } //_____________________________________________________________________________ -Bool_t AliRsnPID::IdentifiedAs ( AliRsnDaughter *d, EType type, Short_t charge ) +Bool_t AliRsnPID::IdentifiedAs(AliRsnDaughter *d, EType type, Short_t charge) { // // Tells if a particle has can be identified to be of a given tipe and charge. @@ -288,24 +274,24 @@ Bool_t AliRsnPID::IdentifiedAs ( AliRsnDaughter *d, EType type, Short_t charge ) // is kFALSE even when the type and charge are matched. // - EType dType = TrackType ( d ); - if ( dType != type ) return kFALSE; - if ( charge == 0 ) + EType dType = TrackType(d); + if (dType != type) return kFALSE; + if (charge == 0) { return kTRUE; } - else if ( charge > 0 ) + else if (charge > 0) { - return ( d->Charge() > 0 ); + return (d->Charge() > 0); } else { - return ( d->Charge() < 0 ); + return (d->Charge() < 0); } } //_____________________________________________________________________________ -AliRsnPID::EType AliRsnPID::TrackType ( AliRsnDaughter *d ) +AliRsnPID::EType AliRsnPID::TrackType(AliRsnDaughter *d) { // // Returns the track type according to the object settings @@ -313,16 +299,16 @@ AliRsnPID::EType AliRsnPID::TrackType ( AliRsnDaughter *d ) // Double_t prob; - EType type = d->PIDType ( prob ); + EType type = d->PIDType(prob); - if ( d->Pt() > fMaxPt ) return kUnknown; - if ( prob < fMinProb ) return kUnknown; + if (d->Pt() > fMaxPt) return kUnknown; + if (prob < fMinProb) return kUnknown; return type; } //_____________________________________________________________________________ -Bool_t AliRsnPID::Process ( AliRsnEvent *event ) +Bool_t AliRsnPID::Process(AliRsnEvent *event) { // // Performs identification for all tracks in a given event. @@ -330,15 +316,15 @@ Bool_t AliRsnPID::Process ( AliRsnEvent *event ) // Bool_t check = kTRUE; - if ( !event ) return check; - if ( !event->GetTracks() ) return check; - if ( event->GetTracks()->IsEmpty() ) return check; + if (!event) return check; + if (!event->GetTracks()) return check; + if (event->GetTracks()->IsEmpty()) return check; AliRsnDaughter *daughter = 0; - TObjArrayIter iter ( event->GetTracks() ); - while ( ( daughter = ( AliRsnDaughter* ) iter.Next() ) ) + TObjArrayIter iter(event->GetTracks()); + while ((daughter = (AliRsnDaughter*) iter.Next())) { - check = check && ComputeProbs ( daughter ); + check = check && ComputeProbs(daughter); } event->FillPIDArrays(); @@ -347,14 +333,14 @@ Bool_t AliRsnPID::Process ( AliRsnEvent *event ) //_____________________________________________________________________________ -void AliRsnPID::SetPriorProbability ( EType type, Double_t p ) +void AliRsnPID::SetPriorProbability(EType type, Double_t p) { // // Sets the prior probability for Realistic PID, for a // given particle species. // - if ( type >= kElectron && type < kSpecies ) + if (type >= kElectron && type < kSpecies) { fPrior[type] = p; } @@ -370,9 +356,9 @@ void AliRsnPID::DumpPriors() Int_t i; Char_t msg[200]; - for ( i = 0; i < kSpecies; i++ ) + for (i = 0; i < kSpecies; i++) { - sprintf ( msg, "Prior probability for '%s' = %3.5f", fgkParticleNameLong[i], fPrior[i] ); - AliInfo ( msg ); + sprintf(msg, "Prior probability for '%s' = %3.5f", fgkParticleNameLong[i], fPrior[i]); + AliInfo(msg); } } diff --git a/PWG2/RESONANCES/AliRsnPID.h b/PWG2/RESONANCES/AliRsnPID.h index 41e64fd25af..f5035b2fb35 100644 --- a/PWG2/RESONANCES/AliRsnPID.h +++ b/PWG2/RESONANCES/AliRsnPID.h @@ -1,16 +1,13 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice * - **************************************************************************/ - -/* $Id: AliRsnPID.h,v 1.5 2007/02/21 14:33:25 pulvir Exp $ */ - -//------------------------------------------------------------------------- -// Class AliRsnPID -// Simple collection of reconstructed tracks, selected from an ESD event // -// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it) -//------------------------------------------------------------------------- +// Class AliRsnPID +// +// Processes the tracks to compute PID probabilities, +// by combining the prior probabilities with the PID weights +// stored in each AliRsnDaughter +// +// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) +// M. Vala (martin.vala@cern.ch) +// #ifndef ALIRSNPID_H #define ALIRSNPID_H diff --git a/PWG2/RESONANCES/AliRsnPIDIndex.cxx b/PWG2/RESONANCES/AliRsnPIDIndex.cxx index 741443a5511..49c9228f209 100644 --- a/PWG2/RESONANCES/AliRsnPIDIndex.cxx +++ b/PWG2/RESONANCES/AliRsnPIDIndex.cxx @@ -1,20 +1,5 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -// -// *** Class AliRsnPIDIndex *** +// +// Class AliRsnPIDIndex // // It sorts the indexes of all tracks in an AliRsnEvent // for a fast retrieval of them according to charge and PID. diff --git a/PWG2/RESONANCES/AliRsnPIDIndex.h b/PWG2/RESONANCES/AliRsnPIDIndex.h index 1c4dfba51b4..a91821cf087 100644 --- a/PWG2/RESONANCES/AliRsnPIDIndex.h +++ b/PWG2/RESONANCES/AliRsnPIDIndex.h @@ -1,10 +1,5 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice * - **************************************************************************/ - // -// *** Class AliRsnPIDIndex *** +// Class AliRsnPIDIndex // // It sorts the indexes of all tracks in an AliRsnEvent // for a fast retrieval of them according to charge and PID. @@ -22,7 +17,7 @@ class AliRsnPIDIndex : public TObject { public: - AliRsnPIDIndex(Int_t num = 2000); + AliRsnPIDIndex(Int_t num = 1000); AliRsnPIDIndex(const AliRsnPIDIndex ©); AliRsnPIDIndex& operator= (const AliRsnPIDIndex& copy); diff --git a/PWG2/RESONANCES/AliRsnPair.cxx b/PWG2/RESONANCES/AliRsnPair.cxx index 0f40b8e18ad..1627fd1bb69 100644 --- a/PWG2/RESONANCES/AliRsnPair.cxx +++ b/PWG2/RESONANCES/AliRsnPair.cxx @@ -25,17 +25,18 @@ ClassImp(AliRsnPair) //_____________________________________________________________________________ AliRsnPair::AliRsnPair -(EPairType type, AliRsnPairDef *def, Int_t mixNum) : - TObject(), - fIsMixed(kFALSE), - fUseMC(kFALSE), - fIsLikeSign(kFALSE), - fMixNum(mixNum), - fPairDef(def), - fPairType(type), - fTypePID(AliRsnDaughter::kRealistic), - fCutMgr(0), - fFunctions("AliRsnFunction", 0) +(EPairType type, AliRsnPairDef *def, Int_t mixNum, Double_t mixVzCut, Int_t mixMultCut) : + TObject(), + fIsMixed(kFALSE), + fUseMC(kFALSE), + fIsLikeSign(kFALSE), + fMixNum(mixNum), + fMixingCut(0x0), + fPairDef(def), + fPairType(type), + fTypePID(AliRsnDaughter::kRealistic), + fCutMgr(0), + fFunctions("AliRsnFunction", 0) { // // Default constructor @@ -123,16 +124,16 @@ void AliRsnPair::Print() AliInfo(Form("Number of functions %d", fFunctions.GetEntries())); switch(fTypePID) { case AliRsnDaughter::kNoPID: - AliInfo("PID method: none"); - break; + AliInfo("PID method: none"); + break; case AliRsnDaughter::kRealistic: - AliInfo("PID method: realistic"); - break; + AliInfo("PID method: realistic"); + break; case AliRsnDaughter::kPerfect: - AliInfo("PID method: perfect"); - break; + AliInfo("PID method: perfect"); + break; default: - AliInfo("PID method: undefined"); + AliInfo("PID method: undefined"); } } @@ -145,22 +146,24 @@ void AliRsnPair::ProcessPair(AliRsnEventBuffer *buf) AliRsnEvent *e1 = buf->GetCurrentEvent(); if (!e1) return; - if (e1->GetMultiplicity() < 1) return; +// if (e1->GetMultiplicity() < 1) return; TArrayI* array1 = e1->GetTracksArray(fTypePID, fPairDef->GetCharge(0), fPairDef->GetType(0)); - + Int_t i = 0; Int_t numMixed = 0; - Int_t lastOkEvent = 1; + Int_t lastOkEvent = 0; TArrayI* array2 = 0; for (i = 0; i < fMixNum; i++) { // find other event by event cut - AliRsnEvent *e2 = FindEventByEventCut(buf, lastOkEvent); + AliRsnEvent *e2 = 0; + e2 = FindEventByEventCut(buf, lastOkEvent); if (!e2) return; - if (e2->GetMultiplicity() < 1) return; +// if (e2->GetMultiplicity() < 1) continue; array2 = e2->GetTracksArray(fTypePID, fPairDef->GetCharge(1), fPairDef->GetType(1)); LoopPair(e1, array1, e2, array2); numMixed++; + lastOkEvent++; } // if (fIsMixed) AliInfo (Form ("NumMixed = %d",numMixed)); } @@ -178,7 +181,8 @@ AliRsnEvent * AliRsnPair::FindEventByEventCut(AliRsnEventBuffer *buf, Int_t& num if (fIsMixed) { - returnEvent = buf->GetEvent(buf->GetEventsBufferIndex() - num); + //returnEvent = buf->GetEvent(buf->GetEventsBufferIndex() - num); + returnEvent = buf->GetNextGoodEvent(num); } else { @@ -197,8 +201,8 @@ void AliRsnPair::LoopPair // using the arrays of indexes and the events containing them. // - if (!a1) {AliError("No TArrayI 1 from currentEvent->GetTracksArray(...)"); return;} - if (!a2) {AliError("No TArrayI 2 from currentEvent->GetTracksArray(...)"); return;} + if (!a1) {AliDebug(4, "No TArrayI 1 from currentEvent->GetTracksArray(...)"); return;} + if (!a2) {AliDebug(4, "No TArrayI 2 from currentEvent->GetTracksArray(...)"); return;} AliRsnDaughter::SetPIDMethod(fTypePID); AliRsnDaughter *daughter1 = 0; @@ -288,7 +292,7 @@ void AliRsnPair::GenerateHistograms(TString prefix, TList *tgt) } //_____________________________________________________________________________ -TString AliRsnPair::GetPairTypeName(EPairType type) +TString AliRsnPair::GetPairTypeName(EPairType type) { // // Returns type name, made with particle names ant chosen PID @@ -311,7 +315,7 @@ TString AliRsnPair::GetPairTypeName(EPairType type) } //_____________________________________________________________________________ -TString AliRsnPair::GetPairName() +TString AliRsnPair::GetPairName() { // // Retruns pair name @@ -371,11 +375,8 @@ void AliRsnPair::AddFunction(AliRsnFunction *fcn) // // Adds a new computing function // -// if (!fFunctions) fFunctions = new TList; - //fFunctions.Add((AliRsnFunction *)fcn->Clone()); Int_t size = fFunctions.GetEntries(); new(fFunctions[size]) AliRsnFunction(*fcn); - //fFunctions.AddLast(fcopy); } //________________________________________________________________________________________ diff --git a/PWG2/RESONANCES/AliRsnPair.h b/PWG2/RESONANCES/AliRsnPair.h index 8323a2cccd8..d1ac9bbf681 100644 --- a/PWG2/RESONANCES/AliRsnPair.h +++ b/PWG2/RESONANCES/AliRsnPair.h @@ -29,28 +29,22 @@ class AliRsnPair : public TObject enum EPairType { - kNoPID = 0, kNoPIDMix, - kRealisticPID, kRealisticPIDMix, - kPerfectPID, kPerfectPIDMix, - kTruePairs, - kPairTypes + kNoPID = 0, kNoPIDMix, + kRealisticPID, kRealisticPIDMix, + kPerfectPID, kPerfectPIDMix, + kTruePairs, + kPairTypes }; - enum EOutputType - { - kInvMass = 0, - kInvMassResolution, - kOutputTypes - }; - - - AliRsnPair (EPairType type = kRealisticPID, AliRsnPairDef *def = 0, Int_t mixNum = 1); + AliRsnPair(EPairType type = kRealisticPID, AliRsnPairDef *def = 0, + Int_t mixNum = 1, Double_t mixVzCut = 1.0, Int_t mixMultCut = 10); ~AliRsnPair(); void Init(); void Print(); void ProcessPair(AliRsnEventBuffer *buf); void SetCutMgr(AliRsnCutMgr* theValue) { fCutMgr = theValue; } + void SetMixingCut(AliRsnCutSet* theValue) { fMixingCut = theValue; } void AddFunction(AliRsnFunction *fcn); TList* GenerateHistograms(TString prefix = ""); void GenerateHistograms(TString prefix, TList *tgt); @@ -61,11 +55,11 @@ class AliRsnPair : public TObject TString GetPairHistTitle(AliRsnFunction *fcn, TString text=""); private: - + AliRsnPair (const AliRsnPair ©) : TObject(copy), - fIsMixed(kFALSE),fUseMC(kFALSE),fIsLikeSign(kFALSE),fMixNum(1), - fPairDef(0x0),fPairType(kPairTypes),fTypePID(AliRsnDaughter::kRealistic), - fCutMgr(0x0),fFunctions("AliRsnFunction",0) {} + fIsMixed(kFALSE),fUseMC(kFALSE),fIsLikeSign(kFALSE),fMixNum(1),fMixingCut(0x0), + fPairDef(0x0),fPairType(kPairTypes),fTypePID(AliRsnDaughter::kRealistic), + fCutMgr(0x0),fFunctions("AliRsnFunction",0) {} AliRsnPair& operator=(const AliRsnPair&) {return *this;} void SetUp(EPairType type); // sets up all flags @@ -73,13 +67,6 @@ class AliRsnPair : public TObject AliRsnEvent* FindEventByEventCut(AliRsnEventBuffer *buf,Int_t & num); void LoopPair(AliRsnEvent *ev1,TArrayI *a1,AliRsnEvent *ev2,TArrayI *a2); - void FillHistogram(EOutputType type,AliRsnPairParticle*pairPart); - void FillEffMass(EOutputType type,AliRsnPairParticle*pairPart); - void FillResolution(EOutputType type,AliRsnPairParticle*pairPart); - - TString GetOutputTypeName(EOutputType type); - TString GetOutputTypeTitle(EOutputType type); - Bool_t CutPass(AliRsnDaughter *d); Bool_t CutPass(AliRsnPairParticle *p); Bool_t CutPass(AliRsnEvent *e); @@ -89,6 +76,7 @@ class AliRsnPair : public TObject Bool_t fUseMC; // using MC inv. mass ? Bool_t fIsLikeSign; // is a like-sign pair ? Int_t fMixNum; // number of mixed events + AliRsnCutSet *fMixingCut; // cut for event mixing // work management AliRsnPairDef *fPairDef; // pair definition (particles, charges) diff --git a/PWG2/RESONANCES/AliRsnPairDef.cxx b/PWG2/RESONANCES/AliRsnPairDef.cxx index 59e38989e2e..a330c288350 100644 --- a/PWG2/RESONANCES/AliRsnPairDef.cxx +++ b/PWG2/RESONANCES/AliRsnPairDef.cxx @@ -27,12 +27,13 @@ AliRsnPairDef::AliRsnPairDef() : 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; - fType[i] = AliRsnPID::kUnknown; - } + Int_t i; + for (i = 0; i < 2; i++) + { + fCharge[i] = '0'; + fMass[i] = 0.0; + fType[i] = AliRsnPID::kUnknown; + } } //_____________________________________________________________________________ @@ -45,7 +46,7 @@ AliRsnPairDef::AliRsnPairDef // This constructor allows to define all the working parameters. // - SetPair(sign1, type1, sign2, type2); + SetPair(sign1, type1, sign2, type2); } //_____________________________________________________________________________ @@ -58,7 +59,7 @@ AliRsnPairDef::AliRsnPairDef // This constructor allows to define all the working parameters. // - SetPair(sign1, type1, sign2, type2); + SetPair(sign1, type1, sign2, type2); } @@ -71,7 +72,7 @@ AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) : // Copy constructor with standard behavior // - SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]); + SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]); } //_____________________________________________________________________________ @@ -81,10 +82,10 @@ const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©) // Assignment operator with standard behavior. // - fMotherPDG = copy.fMotherPDG; - SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]); + fMotherPDG = copy.fMotherPDG; + SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]); - return (*this); + return (*this); } //_____________________________________________________________________________ @@ -94,23 +95,26 @@ Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliRsnPID::EType ty // Set one element of the pair // and returns warnings if the type is not valid. // - if (i < 0 || i > 1) { - AliError("Index out of range"); - return kFALSE; - } - if (charge != '+' && charge != '-') { - AliError(Form("Character '%c' not recognized as charge sign")); - return kFALSE; - } - if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown) { - AliError("Type index out of enumeration range"); - return kFALSE; - } - fCharge[i] = charge; - fType[i] = type; - fMass[i] = AliRsnPID::ParticleMass(type); - - return kTRUE; + if (i < 0 || i > 1) + { + AliError("Index out of range"); + return kFALSE; + } + if (charge != '+' && charge != '-') + { + AliError(Form("Character '%c' not recognized as charge sign")); + return kFALSE; + } + if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown) + { + AliError("Type index out of enumeration range"); + return kFALSE; + } + fCharge[i] = charge; + fType[i] = type; + fMass[i] = AliRsnPID::ParticleMass(type); + + return kTRUE; } //_____________________________________________________________________________ @@ -121,10 +125,10 @@ Bool_t AliRsnPairDef::SetPair // Set both elements of the pair, // returning logical AND of check for each one. // - Bool_t part1 = SetPairElement(0, charge1, type1); - Bool_t part2 = SetPairElement(1, charge2, type2); - - return (part1 && part2); + Bool_t part1 = SetPairElement(0, charge1, type1); + Bool_t part2 = SetPairElement(1, charge2, type2); + + return (part1 && part2); } //_____________________________________________________________________________ @@ -137,10 +141,10 @@ Double_t AliRsnPairDef::ComputeWeight(AliRsnDaughter *d0, AliRsnDaughter *d1) // according to the order of appearance in argument list. // - Double_t prob0 = d0->PIDProb()[fType[0]]; - Double_t prob1 = d1->PIDProb()[fType[1]]; + Double_t prob0 = d0->PIDProb()[fType[0]]; + Double_t prob1 = d1->PIDProb()[fType[1]]; - return prob0*prob1; + return prob0*prob1; } //_____________________________________________________________________________ @@ -150,12 +154,12 @@ TString AliRsnPairDef::GetPairName() // Returns a compact string with the name of the pair, // to be used for naming objects related to it. // - - TString sName; - sName += AliRsnPID::ParticleName(fType[0]); - sName += fCharge[0]; - sName += AliRsnPID::ParticleName(fType[1]); - sName += fCharge[1]; - - return sName; + + TString sName; + sName += AliRsnPID::ParticleName(fType[0]); + sName += fCharge[0]; + sName += AliRsnPID::ParticleName(fType[1]); + sName += fCharge[1]; + + return sName; } diff --git a/PWG2/RESONANCES/AliRsnPairMgr.cxx b/PWG2/RESONANCES/AliRsnPairMgr.cxx index db78cfc4692..8e984d41f2e 100644 --- a/PWG2/RESONANCES/AliRsnPairMgr.cxx +++ b/PWG2/RESONANCES/AliRsnPairMgr.cxx @@ -1,71 +1,59 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ // -// *** Class AliRsnPairMgr *** +// Class AliRsnPairMgr // -// TODO +// A collection of pairs for an analysis. +// The function of this collection is just for purposes of well-sorting +// the analyzed pairs into upper-level groups, in the case of a wide +// analysis containing many resonances at once, or different settings for the same one. // -// authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it) -// M. Vala (email: martin.vala@cern.ch) +// Each PairMgr will result in a separate list of histograms, which +// can be seen as a folder in the output file, whose name is given by this object. +// +// author: M. Vala (email: martin.vala@cern.ch) // #include "AliLog.h" #include "AliRsnPairMgr.h" -ClassImp ( AliRsnPairMgr ) +ClassImp(AliRsnPairMgr) //_____________________________________________________________________________ -AliRsnPairMgr::AliRsnPairMgr ( const char*name ) - : TNamed ( name,name),fPairs(0) +AliRsnPairMgr::AliRsnPairMgr(const char*name) : + TNamed(name,name), + fPairs(0) { -//========================================================= +// // Default constructor -//========================================================= - +// } //_____________________________________________________________________________ AliRsnPairMgr::~AliRsnPairMgr() { -//========================================================= +// // Destructor -//========================================================= - +// } //_____________________________________________________________________________ -void AliRsnPairMgr::AddPair ( AliRsnPair * pair ) +void AliRsnPairMgr::AddPair(AliRsnPair *pair) { -//========================================================= +// // Adds pair -//========================================================= +// - fPairs.Add ( ( AliRsnPair * ) pair ); + fPairs.Add((AliRsnPair*)pair); } //_____________________________________________________________________________ void AliRsnPairMgr::PrintPairs() { -//========================================================= +// // Prints all pairs -//========================================================= - AliRsnPair * pair=0; - for ( Int_t i=0;iPrint(); - } +// + + AliRsnPair *pair = 0; + TObjArrayIter next(&fPairs); + while ((pair = (AliRsnPair*)next())) pair->Print(); } diff --git a/PWG2/RESONANCES/AliRsnPairMgr.h b/PWG2/RESONANCES/AliRsnPairMgr.h index 2b02a49fbd4..ae07e4d72a8 100644 --- a/PWG2/RESONANCES/AliRsnPairMgr.h +++ b/PWG2/RESONANCES/AliRsnPairMgr.h @@ -1,33 +1,38 @@ // -// *** Class AliRsnPairMgr *** +// Class AliRsnPairMgr // -// TODO +// A collection of pairs for an analysis. +// The function of this collection is just for purposes of well-sorting +// the analyzed pairs into upper-level groups, in the case of a wide +// analysis containing many resonances at once, or different settings for the same one. // -// authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it) -// M. Vala (email: martin.vala@cern.ch) +// Each PairMgr will result in a separate list of histograms, which +// can be seen as a folder in the output file, whose name is given by this object. +// +// author: M. Vala (email: martin.vala@cern.ch) // -#ifndef ALIRSNMVPAIRMGR_H -#define ALIRSNMVPAIRMGR_H +#ifndef ALIRSNPAIRMGR_H +#define ALIRSNPAIRMGR_H #include "AliRsnPair.h" class AliRsnPairMgr : public TNamed { public: - AliRsnPairMgr(const char*name="default"); + AliRsnPairMgr(const char*name = "default"); ~AliRsnPairMgr(); - void AddPair ( AliRsnPair *pair ); - TObjArray *GetPairs() { return &fPairs; } - void PrintPairs(); + void AddPair(AliRsnPair *pair); + TObjArray *GetPairs() { return &fPairs; } + void PrintPairs(); private: - TObjArray fPairs; // array of pairs - - ClassDef ( AliRsnPairMgr, 1 ) + TObjArray fPairs; // array of pairs + + ClassDef(AliRsnPairMgr, 1) }; #endif diff --git a/PWG2/RESONANCES/AliRsnPairParticle.cxx b/PWG2/RESONANCES/AliRsnPairParticle.cxx index 8dc04936d9a..8b593451df3 100644 --- a/PWG2/RESONANCES/AliRsnPairParticle.cxx +++ b/PWG2/RESONANCES/AliRsnPairParticle.cxx @@ -1,27 +1,13 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - // // Class AliRsnPairParticle // // Implementation of a pair of tracks, for several purposes // - computing the total 4-momentum & inv. mass for output histos filling // - evaluating cut checks on the pair of particles +// - evaluating any kind of kinematic value over their sum // -// author: Martin Vala (martin.vala@cern.ch) -// revised by: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) +// authors: Martin Vala (martin.vala@cern.ch) +// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) // #include "AliLog.h" @@ -134,7 +120,7 @@ Double_t AliRsnPairParticle::GetInvMass(Double_t mass0, Double_t mass1) // Mass in argument #1 is assigned to first track in the pair (fDaughter[0]), // mass in argument #2 is assigned to second track in the pair (fDaughter[1]) // Then, the invariant mass of the pair is computed by using their total momentum -// and the sum of their energies as they result from assigned masses. +// and the sum of their energies computed after assigned masses. // if (!fDaughter[0] || !fDaughter[1]) @@ -160,7 +146,7 @@ Double_t AliRsnPairParticle::GetInvMassMC(Double_t mass0, Double_t mass1) // Mass in argument #1 is assigned to first track in the pair (fDaughter[0]), // mass in argument #2 is assigned to second track in the pair (fDaughter[1]) // Then, the invariant mass of the pair is computed by using their total momentum -// and the sum of their energies as they result from assigned masses. +// and the sum of their energies. // if (!fDaughter[0] || !fDaughter[1]) @@ -180,7 +166,7 @@ Double_t AliRsnPairParticle::GetInvMassMC(Double_t mass0, Double_t mass1) etot += fDaughter[1]->GetMCInfo()->E(mass1); // compute & return invariant mass - return TMath::Sqrt(etot * etot - GetP2()); + return TMath::Sqrt(etot * etot - GetP2MC()); } //_____________________________________________________________________________ @@ -190,11 +176,12 @@ Double_t AliRsnPairParticle::GetEtot(Double_t mass0, Double_t mass1) const // Compute total pair energy from the sum of single track energies // with a necessary mass hypothesis (rec. values). // - Double_t etot = 0.0; - etot += fDaughter[0]->E(mass0); - etot += fDaughter[1]->E(mass1); - - return etot; + + Double_t etot = 0.0; + etot += fDaughter[0]->E(mass0); + etot += fDaughter[1]->E(mass1); + + return etot; } //_____________________________________________________________________________ @@ -204,11 +191,11 @@ Double_t AliRsnPairParticle::GetEtotMC(Double_t mass0, Double_t mass1) const // Compute total pair energy from the sum of single track energies // with a necessary mass hypothesis (MC values). // - Double_t etot = 0.0; - etot += fDaughter[0]->GetMCInfo()->E(mass0); - etot += fDaughter[1]->GetMCInfo()->E(mass1); - - return etot; + Double_t etot = 0.0; + etot += fDaughter[0]->GetMCInfo()->E(mass0); + etot += fDaughter[1]->GetMCInfo()->E(mass1); + + return etot; } //_____________________________________________________________________________ @@ -298,6 +285,38 @@ void AliRsnPairParticle::SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daug for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i]; } +//_____________________________________________________________________________ +void AliRsnPairParticle::ResetPair() +{ +// +// Computes the total momentum for REC data and MC if available +// + + Int_t i; + + // copy MC info (if available) + if (fDaughter[0]->GetMCInfo() && fDaughter[1]->GetMCInfo()) + { + for (i = 0; i < 2; i++) + { + fPTrackMC[i][0] = fDaughter[i]->GetMCInfo()->Px(); + fPTrackMC[i][1] = fDaughter[i]->GetMCInfo()->Py(); + fPTrackMC[i][2] = fDaughter[i]->GetMCInfo()->Pz(); + fMotherPDG[i] = fDaughter[i]->GetMCInfo()->MotherPDG(); + } + for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i]; + } + + // copy reconstructed info (always available) + for (i = 0; i < 2; i++) + { + fPTrack[i][0] = fDaughter[i]->Px(); + fPTrack[i][1] = fDaughter[i]->Py(); + fPTrack[i][2] = fDaughter[i]->Pz(); + } + for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i]; +} + //_____________________________________________________________________________ void AliRsnPairParticle::PrintInfo(const Option_t *option) { diff --git a/PWG2/RESONANCES/AliRsnPairParticle.h b/PWG2/RESONANCES/AliRsnPairParticle.h index 07753220e9a..f82dae8a3b9 100644 --- a/PWG2/RESONANCES/AliRsnPairParticle.h +++ b/PWG2/RESONANCES/AliRsnPairParticle.h @@ -1,17 +1,13 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice * - **************************************************************************/ - // // Class AliRsnPairParticle // // Implementation of a pair of tracks, for several purposes // - computing the total 4-momentum & inv. mass for output histos filling // - evaluating cut checks on the pair of particles +// - evaluating any kind of kinematic value over their sum // -// author: Martin Vala (martin.vala@cern.ch) -// revised by: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) +// authors: Martin Vala (martin.vala@cern.ch) +// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) // #ifndef ALIRSNPAIRPARTICLE_H @@ -43,7 +39,8 @@ class AliRsnPairParticle : public TObject Double_t GetPz() const {return fPTot[2];} Double_t GetPt() const {return TMath::Sqrt(GetPt2());} Double_t GetPhi() const {return TMath::Pi() + TMath::ATan2(-fPTot[1], -fPTot[0]);} - Double_t GetTheta() const {if(fPTot[2]==0.0){return TMath::PiOver2();}else{return TMath::ACos(fPTot[2]/GetP());}} + Double_t GetTheta() const {if (fPTot[2]==0.0){return TMath::PiOver2();} + else{return TMath::ACos(fPTot[2]/GetP());}} Double_t GetEta() const {return -TMath::Log(TMath::ATan(0.5*GetTheta()));} Double_t GetY(Double_t m1, Double_t m2) const {return 0.5*TMath::Log((GetEtot(m1,m2)+fPTot[2])/(GetEtot(m1,m2)-fPTot[2]));} @@ -56,7 +53,8 @@ class AliRsnPairParticle : public TObject Double_t GetPzMC() const {return fPTotMC[2];} Double_t GetPtMC() const {return TMath::Sqrt(GetPt2MC());} Double_t GetPhiMC() const {return TMath::Pi() + TMath::ATan2(-fPTotMC[1], -fPTotMC[0]);} - Double_t GetThetaMC() const {if(fPTotMC[2]==0.0){return TMath::PiOver2();}else{return TMath::ACos(fPTotMC[2]/GetPMC());}} + Double_t GetThetaMC() const {if (fPTotMC[2]==0.0){return TMath::PiOver2();} + else{return TMath::ACos(fPTotMC[2]/GetPMC());}} Double_t GetEtaMC() const {return -TMath::Log(TMath::ATan(0.5*GetThetaMC()));} Double_t GetYMC(Double_t m1, Double_t m2) const {return 0.5*TMath::Log((GetEtotMC(m1,m2)+fPTotMC[2])/(GetEtotMC(m1,m2)-fPTotMC[2]));} @@ -69,6 +67,7 @@ class AliRsnPairParticle : public TObject Bool_t IsTruePair(Int_t refPDG = 0); void SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2); + void ResetPair(); void PrintInfo(const Option_t *option = ""); private: diff --git a/PWG2/RESONANCES/AliRsnReader.cxx b/PWG2/RESONANCES/AliRsnReader.cxx index c4c128f4eb9..e3893858151 100644 --- a/PWG2/RESONANCES/AliRsnReader.cxx +++ b/PWG2/RESONANCES/AliRsnReader.cxx @@ -55,7 +55,10 @@ AliRsnReader::AliRsnReader(AliRsnPIDWeightsMgr *mgr) : fPIDDivValue(0.0), fITSClusters(0), fTPCClusters(0), - fTRDClusters(0) + fTRDClusters(0), + fTrackRefs(0), + fTrackRefsITS(0), + fTrackRefsTPC(0) { // // Constructor. @@ -164,9 +167,18 @@ Bool_t AliRsnReader::FillFromESD } else { - vertex[0] = esd->GetPrimaryVertexTPC()->GetXv(); - vertex[1] = esd->GetPrimaryVertexTPC()->GetYv(); - vertex[2] = esd->GetPrimaryVertexTPC()->GetZv(); + // when taking vertex from ESD event there are two options: + // if a vertex with tracks was successfully reconstructed, + // it is used for computing DCA; + // otherwise, the one computed with SPD is used. + // This is known from the "Status" parameter of the vertex itself. + const AliESDVertex *v = esd->GetPrimaryVertex(); + if (!v->GetStatus()) v = esd->GetPrimaryVertexSPD(); + + // get primary vertex + vertex[0] = (Double_t)v->GetXv(); + vertex[1] = (Double_t)v->GetYv(); + vertex[2] = (Double_t)v->GetZv(); } rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]); @@ -242,12 +254,14 @@ Bool_t AliRsnReader::FillFromESD // set index and label and add this object to the output container temp.SetIndex(index); temp.SetLabel(label); + temp.ShiftZero(vertex[0], vertex[1], vertex[2]); AliRsnDaughter *ptr = rsn->AddTrack(temp); // if problems occurred while storing, that pointer is NULL if (!ptr) AliWarning(Form("Failed storing track#%d", index)); } // compute total multiplicity + rsn->MakeComputations(); if (rsn->GetMultiplicity() <= 0) { AliDebug(1, "Zero Multiplicity in this event"); @@ -330,6 +344,7 @@ Bool_t AliRsnReader::FillFromAOD(AliRsnEvent *rsn, AliAODEvent *aod, AliMCEvent } // compute total multiplicity + rsn->MakeComputations(); if (rsn->GetMultiplicity() <= 0) { AliDebug(1, "Zero multiplicity in this event"); @@ -372,15 +387,34 @@ Bool_t AliRsnReader::FillFromMC(AliRsnEvent *rsn, AliMCEvent *mc) rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]); // store tracks from MC - Int_t index, labmum; + Int_t i, index, labmum, nHitsITS, nHitsTPC, nRef; Bool_t check; AliRsnDaughter temp; for (index = 0; index < ntracks; index++) { // get and check MC track AliMCParticle *mcTrack = mc->GetTrack(index); - // if particle has no track references, it is rejected - if (mcTrack->GetNumberOfTrackReferences() <= 0) continue; + // check particle track references + nRef = mcTrack->GetNumberOfTrackReferences(); + if (fTrackRefs > 0 && nRef < fTrackRefs) continue; + else if (fTrackRefsITS > 0 || fTrackRefsTPC > 0) + { + nHitsITS = nHitsTPC = 0; + for (i = 0; i < nRef; i++) { + AliTrackReference *trackRef = mcTrack->GetTrackReference(i); + if(trackRef) + { + Int_t detectorId = trackRef->DetectorId(); + switch(detectorId) { + case AliTrackReference::kITS : nHitsITS++ ; break ; + case AliTrackReference::kTPC : nHitsTPC++ ; break ; + default : break ; + } + } + } + if (fTrackRefsITS > 0 && nHitsITS < fTrackRefsITS) continue; + if (fTrackRefsTPC > 0 && nHitsTPC < fTrackRefsTPC) continue; + } // try to insert in the RsnDaughter its data check = temp.Adopt(mcTrack); if (!check) continue; @@ -399,6 +433,7 @@ Bool_t AliRsnReader::FillFromMC(AliRsnEvent *rsn, AliMCEvent *mc) } // compute total multiplicity + rsn->MakeComputations(); if (rsn->GetMultiplicity() <= 0) { AliDebug(1, "Zero multiplicity in this event"); diff --git a/PWG2/RESONANCES/AliRsnReader.h b/PWG2/RESONANCES/AliRsnReader.h index 070eecd5686..62133738cd8 100644 --- a/PWG2/RESONANCES/AliRsnReader.h +++ b/PWG2/RESONANCES/AliRsnReader.h @@ -52,6 +52,11 @@ class AliRsnReader : public TNamed // sets PID TYPE void SetPIDtype(const AliRsnDaughter::EPIDType& theValue = AliRsnDaughter::kEsd, Double_t divValue = 0.0); AliRsnDaughter::EPIDType GetPIDtype() const { return fCurrentPIDtype; } + + // set limits in track references + void SetTrackRefs(Int_t value) {fTrackRefs = value;} + void SetTrackRefsITS(Int_t value) {fTrackRefsITS = value;} + void SetTrackRefsTPC(Int_t value) {fTrackRefsTPC = value;} // sets Sectors cut void SetITSTPCTRDSectors(const Int_t& its = -1, const Int_t& tpc = -1, const Int_t& trd = -1); @@ -73,6 +78,10 @@ class AliRsnReader : public TNamed Int_t fITSClusters; // Int_t fTPCClusters; // Int_t fTRDClusters; // + Int_t fTrackRefs; // minimum required track references for MC reading + Int_t fTrackRefsITS; // minimum required track references for MC reading (ITS) + Int_t fTrackRefsTPC; // minimum required track references for MC reading (TPC) + private: diff --git a/PWG2/RESONANCES/AliRsnReaderTask.cxx b/PWG2/RESONANCES/AliRsnReaderTask.cxx index 208baf4a446..eba1c7736ee 100644 --- a/PWG2/RESONANCES/AliRsnReaderTask.cxx +++ b/PWG2/RESONANCES/AliRsnReaderTask.cxx @@ -28,7 +28,7 @@ ClassImp(AliRsnReaderTask) //_____________________________________________________________________________ AliRsnReaderTask::AliRsnReaderTask() : - AliRsnBaseAT(), + AliRsnAnalysisTaskBase(), fRsnTree(0x0) { //========================================================= @@ -38,7 +38,7 @@ AliRsnReaderTask::AliRsnReaderTask() : //_____________________________________________________________________________ AliRsnReaderTask::AliRsnReaderTask(const char *name) : - AliRsnBaseAT(name), + AliRsnAnalysisTaskBase(name), fRsnTree(0x0) { //========================================================= @@ -50,7 +50,7 @@ AliRsnReaderTask::AliRsnReaderTask(const char *name) : //_____________________________________________________________________________ AliRsnReaderTask::AliRsnReaderTask(const AliRsnReaderTask& obj) : - AliRsnBaseAT(obj), + AliRsnAnalysisTaskBase(obj), fRsnTree(0x0) { //========================================================= @@ -76,7 +76,7 @@ void AliRsnReaderTask::InitIOVars() // Init values for input and output data //========================================================= AliDebug(AliLog::kDebug, "<-"); - AliRsnBaseAT::InitIOVars(); + AliRsnAnalysisTaskBase::InitIOVars(); AliDebug(AliLog::kDebug, "->"); } diff --git a/PWG2/RESONANCES/AliRsnReaderTask.h b/PWG2/RESONANCES/AliRsnReaderTask.h index 68f787e9c31..5a837b750cb 100644 --- a/PWG2/RESONANCES/AliRsnReaderTask.h +++ b/PWG2/RESONANCES/AliRsnReaderTask.h @@ -9,12 +9,12 @@ #ifndef ALIRSNREADERTASK_H #define ALIRSNREADERTASK_H -#include "AliRsnBaseAT.h" +#include "AliRsnAnalysisTaskBase.h" class AliRsnPID; class AliRsnReader; -class AliRsnReaderTask : public AliRsnBaseAT +class AliRsnReaderTask : public AliRsnAnalysisTaskBase { public: diff --git a/PWG2/RESONANCES/AliRsnReaderTaskSE.cxx b/PWG2/RESONANCES/AliRsnReaderTaskSE.cxx index 7e2b1ba8f96..7f976ca9d10 100644 --- a/PWG2/RESONANCES/AliRsnReaderTaskSE.cxx +++ b/PWG2/RESONANCES/AliRsnReaderTaskSE.cxx @@ -93,31 +93,31 @@ void AliRsnReaderTaskSE::UserExec(Option_t */*option*/) // step 1: conversion Bool_t ok = kFALSE; switch (fInputType[0]) - { - case kAOD: - AliDebug(5, "Reading AOD event..."); - ok = fReader.FillFromAOD(fRsnEvent, (AliAODEvent*)fInputEvent, fMCEvent); - AliDebug(5, "...done"); - break; - case kESD: - AliDebug(5, "Reading ESD event..."); - ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent); - AliDebug(5, "...done"); - break; - case kESDMC: - AliDebug(5, "Reading ESD event with MC..."); - ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent); - AliDebug(5, "...done"); - break; - case kMC: - AliDebug(5, "Reading MC only event..."); - ok = fReader.FillFromMC(fRsnEvent, fMCEvent); - AliDebug(5, "...done"); - break; - default: - AliError("Type not supported ..."); - return; - } + { + case kAOD: + AliDebug(5, "Reading AOD event..."); + ok = fReader.FillFromAOD(fRsnEvent, (AliAODEvent*)fInputEvent, fMCEvent); + AliDebug(5, "...done"); + break; + case kESD: + AliDebug(5, "Reading ESD event..."); + ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent); + AliDebug(5, "...done"); + break; + case kESDMC: + AliDebug(5, "Reading ESD event with MC..."); + ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent); + AliDebug(5, "...done"); + break; + case kMC: + AliDebug(5, "Reading MC only event..."); + ok = fReader.FillFromMC(fRsnEvent, fMCEvent); + AliDebug(5, "...done"); + break; + default: + AliError("Type not supported ..."); + return; + } if (!ok) AliWarning("Failed reading"); // step 2: PID probability computation diff --git a/PWG2/RESONANCES/AliRsnReaderTaskSE.h b/PWG2/RESONANCES/AliRsnReaderTaskSE.h index 9cb0e0dc469..0fa9613bc54 100644 --- a/PWG2/RESONANCES/AliRsnReaderTaskSE.h +++ b/PWG2/RESONANCES/AliRsnReaderTaskSE.h @@ -21,7 +21,7 @@ class AliRsnReader; class AliRsnReaderTaskSE : public AliRsnAnalysisTaskSEBase { -public: + public: AliRsnReaderTaskSE(); AliRsnReaderTaskSE(const char *name); @@ -40,12 +40,12 @@ public: // AliRsnPID* GetPID() {return fPID;} AliRsnEvent* GetCurrentEvent() {return fRsnEvent;} -private: + private: AliRsnReaderTaskSE(const AliRsnReaderTaskSE ©) : - AliRsnAnalysisTaskSEBase(copy),fRsnEvent(0x0) { /*nothing*/ } + AliRsnAnalysisTaskSEBase(copy),fRsnEvent(0x0) { /*nothing*/ } AliRsnReaderTaskSE& operator=(const AliRsnReaderTaskSE&) - { /*nothing*/ return (*this); } + { /*nothing*/ return (*this); } AliRsnEvent *fRsnEvent; // output events in the AliRsnEvent format -- 2.43.5