]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Renamed classes: these with old name are removed and newly named will be added in...
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jul 2008 17:50:44 +0000 (17:50 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jul 2008 17:50:44 +0000 (17:50 +0000)
32 files changed:
PWG2/RESONANCES/AliRsnAnalysisSimple.cxx [deleted file]
PWG2/RESONANCES/AliRsnAnalysisSimple.h [deleted file]
PWG2/RESONANCES/AliRsnAnalysisSimpleTask.cxx [deleted file]
PWG2/RESONANCES/AliRsnAnalysisSimpleTask.h [deleted file]
PWG2/RESONANCES/AliRsnAnalyzerSimple.cxx [deleted file]
PWG2/RESONANCES/AliRsnAnalyzerSimple.h [deleted file]
PWG2/RESONANCES/AliRsnCut.cxx
PWG2/RESONANCES/AliRsnCut.h
PWG2/RESONANCES/AliRsnCutMgr.cxx
PWG2/RESONANCES/AliRsnCutMgr.h
PWG2/RESONANCES/AliRsnCutSet.cxx
PWG2/RESONANCES/AliRsnCutSet.h
PWG2/RESONANCES/AliRsnDaughter.cxx
PWG2/RESONANCES/AliRsnDaughter.h
PWG2/RESONANCES/AliRsnEvent.cxx
PWG2/RESONANCES/AliRsnEvent.h
PWG2/RESONANCES/AliRsnExpression.h
PWG2/RESONANCES/AliRsnMCInfo.h
PWG2/RESONANCES/AliRsnPID.cxx
PWG2/RESONANCES/AliRsnPID.h
PWG2/RESONANCES/AliRsnPIDIndex.cxx
PWG2/RESONANCES/AliRsnPIDWeightsMgr.h
PWG2/RESONANCES/AliRsnPairDef.cxx
PWG2/RESONANCES/AliRsnPairDef.h
PWG2/RESONANCES/AliRsnPairParticle.cxx
PWG2/RESONANCES/AliRsnPairParticle.h
PWG2/RESONANCES/AliRsnPairSimple.cxx [deleted file]
PWG2/RESONANCES/AliRsnPairSimple.h [deleted file]
PWG2/RESONANCES/AliRsnReader.cxx
PWG2/RESONANCES/AliRsnReader.h
PWG2/RESONANCES/AliRsnReaderTaskSE.cxx
PWG2/RESONANCES/AliRsnReaderTaskSE.h

diff --git a/PWG2/RESONANCES/AliRsnAnalysisSimple.cxx b/PWG2/RESONANCES/AliRsnAnalysisSimple.cxx
deleted file mode 100644 (file)
index df9f6fa..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/**************************************************************************
- * 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 AliRsnAnalysisSimple
-//-------------------------------------------------------------------------
-// This class is a manager to process one or more pair analysis with a
-// given event sample, specified as a TTree passed to this object.
-// Each single pair analysis must be defined with its specifications, like
-// histogram binning, cuts and everything else.
-// This class utiliy consists in defining a unique event sample which is
-// used for all pairs analysis, and all kinds of event mixing (if required).
-// All histograms computed in a single execution, are then saved into a file.
-// This object contains a two TObjArray's:
-//  - one to contain single event pair analysis objects (signal, like-sign)
-//  - one to contain all event-mixing pair analysis objects
-// When a new pair is added, it must be then specified in what container it
-// must be placed, in order to avoid meaningless results.
-//
-// author: A. Pulvirenti
-// email : alberto.pulvirenti@ct.infn.it
-//-------------------------------------------------------------------------
-
-#include <TH1.h>
-#include <TTree.h>
-#include <TFile.h>
-#include <TArray.h>
-#include <TClonesArray.h>
-
-#include "AliLog.h"
-#include "AliRsnPID.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-#include "AliRsnEventBuffer.h"
-#include "AliRsnPairSimple.h"
-#include "AliRsnAnalyzerSimple.h"
-#include "AliRsnAnalysisSimple.h"
-
-ClassImp(AliRsnAnalysisSimple)
-
-//_____________________________________________________________________________
-AliRsnAnalysisSimple::AliRsnAnalysisSimple(AliRsnAnalyzerSimple *ana, AliRsnPID *pid) :
-  TObject(),
-  fInitialized(kFALSE),
-  fStep(1000),
-  fTree(0x0),
-  fPID(pid),
-  fAnalyzer(ana)
-{
-//
-// Constructor
-// Initializes all pointers and collections to NULL.
-//
-
-    strcpy(fFileName, "default.root");
-}
-
-
-//_____________________________________________________________________________
-void AliRsnAnalysisSimple::Clear(Option_t* /*option*/)
-{
-//
-// Clear heap
-//
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisSimple::SetEventsTree(TTree *tree)
-{
-//
-// Set the tree containing the events to be processed.
-// Counts also the number of events and stores it in a private datamember.
-// This can avoid the time-wasting entries count in a long TChain.
-//
-    fTree = tree;
-    AliInfo(Form("Total number of events to be processed: %d", fTree->GetEntries()));
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnAnalysisSimple::Initialize()
-{
-//
-// Various initialization processes
-//
-    // check process objects
-    if (!fPID) {
-        AliError("PID not initialized");
-        return kFALSE;
-    }
-    if (!fAnalyzer) {
-        AliError("Analyzer not initialized");
-        return kFALSE;
-    }
-
-    // set reference to PID method to all pairs
-    AliRsnPairSimple *pair = 0;
-    TObjArrayIter pairIterator(fAnalyzer->GetPairs());
-    while ( (pair = (AliRsnPairSimple*)pairIterator.Next()) ) {
-        pair->SetPIDMethod(fPID->GetMethod());
-    }
-    if (fAnalyzer->GetMixPairs() && !fAnalyzer->GetMixPairs()->IsEmpty()) {
-        TObjArrayIter mixIterator(fAnalyzer->GetMixPairs());
-        while ( (pair = (AliRsnPairSimple*)mixIterator.Next()) ) {
-            pair->SetPIDMethod(fPID->GetMethod());
-        }
-    }
-
-    // initialize analyzer
-    fAnalyzer->Init();
-
-    // at the end, update flag for initialization
-    fInitialized = kTRUE;
-
-    return kTRUE;
-}
-
-//_____________________________________________________________________________
-Stat_t AliRsnAnalysisSimple::Process()
-{
-//
-// Computes all invariant mass distributions defined in the AliRsnPair objects collected.
-// Depending on the kind of background evaluation method, computes also this one.
-//
-
-    // check initialization
-    if (!fInitialized) {
-        AliError("Analysis not initialized. Use method 'Initialize()'");
-        return 0.0;
-    }
-
-    // set cursor object
-    AliRsnEvent *event = 0x0;
-    fTree->SetBranchAddress("rsnEvents", &event);
-
-    // output counter
-    Stat_t nPairs = 0.0;
-
-       // loop on events
-       Int_t i, nEvents = (Int_t)fTree->GetEntries();
-    for (i = 0; i < nEvents; i++) {
-        // message
-        if ((i % fStep) == 0) AliInfo(Form("Processing event %d", i));
-        // get entry
-        fTree->GetEntry(i);
-        if (!event) continue;
-        fPID->Identify(event);
-        nPairs += fAnalyzer->Process(event);
-    }
-
-    return nPairs;
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisSimple::SaveOutput() const
-{
-//
-// Writes histograms in current directory
-//
-    TFile *file = TFile::Open(fFileName, "RECREATE");
-    AliRsnPairSimple *pair = 0;
-    TH1D *hist = 0;
-    TObjArrayIter pairIterator(fAnalyzer->GetPairs());
-    while ( (pair = (AliRsnPairSimple*)pairIterator.Next()) ) {
-        hist = pair->GetHistogram();
-        if (hist) hist->Write();
-        hist = pair->GetHistogramMC();
-        if (hist) hist->Write();
-    }
-    if (fAnalyzer->GetMixPairs() && !fAnalyzer->GetMixPairs()->IsEmpty()) {
-       TObjArrayIter mixIterator(fAnalyzer->GetMixPairs());
-        while ( (pair = (AliRsnPairSimple*)mixIterator.Next()) ) {
-            hist = pair->GetHistogram();
-            if (hist) hist->Write();
-            hist = pair->GetHistogramMC();
-            if (hist) hist->Write();
-        }
-       }
-       file->Close();
-}
diff --git a/PWG2/RESONANCES/AliRsnAnalysisSimple.h b/PWG2/RESONANCES/AliRsnAnalysisSimple.h
deleted file mode 100644 (file)
index 090b52e..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//-------------------------------------------------------------------------
-//                      Class AliRsnAnalysisSimple
-//             Reconstruction and analysis of K* Rsn
-// ........................................
-// ........................................
-// ........................................
-// ........................................
-//
-// author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-//-------------------------------------------------------------------------
-
-#ifndef AliRsnAnalysisSimple_H
-#define AliRsnAnalysisSimple_H
-
-#include "AliRsnPID.h"
-
-class TTree;
-class TArrayI;
-class TObjArray;
-class AliRsnPairSimple;
-class AliRsnPID;
-class AliRsnEventBuffer;
-class AliRsnAnalyzerSimple;
-
-class AliRsnAnalysisSimple : public TObject
-{
-public:
-
-    AliRsnAnalysisSimple(AliRsnAnalyzerSimple *ana = 0x0, AliRsnPID *pid = 0x0);
-    virtual ~AliRsnAnalysisSimple() {Clear();}
-    virtual void Clear(Option_t *option = "C");
-
-    /* setters */
-    void    SetAnalyzer(AliRsnAnalyzerSimple *analyzer) {fAnalyzer = analyzer;}
-    void    SetEventsTree(TTree *tree);
-    void    SetFileName(char *fname) {strcpy(fFileName, fname);}
-    void    SetStep(Int_t step) {fStep = step;}
-    void    SetPID(AliRsnPID *pid) {fPID = pid;}
-
-    /* working routines */
-    Bool_t  Initialize();
-    Stat_t  Process();
-    void    SaveOutput() const;
-
-private:
-
-    AliRsnAnalysisSimple(const AliRsnAnalysisSimple &copy) :
-      TObject(copy),fInitialized(kFALSE),fStep(1000),fTree(0x0),fPID(0x0),fAnalyzer(0x0) { }
-    AliRsnAnalysisSimple& operator=(const AliRsnAnalysisSimple & /*copy*/) { return (*this); }
-
-    Bool_t                fInitialized;     // flag to check initialization
-    Int_t                 fStep;            // progress step
-    Char_t                fFileName[250];   // output file name
-       TTree                *fTree;            //! TTree of events
-    AliRsnPID            *fPID;             //! PID object
-       AliRsnAnalyzerSimple *fAnalyzer;        //! analyzer
-
-       // Rsn analysis implementation
-       ClassDef(AliRsnAnalysisSimple,1)
-};
-
-#endif
diff --git a/PWG2/RESONANCES/AliRsnAnalysisSimpleTask.cxx b/PWG2/RESONANCES/AliRsnAnalysisSimpleTask.cxx
deleted file mode 100644 (file)
index 567efd5..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/**************************************************************************
- * 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 AliRsnAnalysisSimpleTask
-// ------------------------
-// Reader for conversion of ESD output into the internal format
-// used for resonance study.
-// ---
-// original author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-// ---
-// adapted for Analysis Framework
-// by    : R. Vernet                          (email: renaud.vernet@cern.ch)
-//----------------------------------------------------------------------------------
-
-#include <TChain.h>
-
-#include "AliLog.h"
-#include "AliVEvent.h"
-#include "AliMCEventHandler.h"
-#include "AliInputEventHandler.h"
-#include "AliAnalysisManager.h"
-
-#include "AliMCEvent.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnReader.h"
-#include "AliRsnPID.h"
-#include "AliRsnPairSimple.h"
-#include "AliRsnAnalyzerSimple.h"
-#include "AliRsnAnalysisSimpleTask.h"
-
-ClassImp(AliRsnAnalysisSimpleTask)
-
-//_____________________________________________________________________________
-AliRsnAnalysisSimpleTask::AliRsnAnalysisSimpleTask() :
-  AliAnalysisTask(),
-  fEvent(0x0),
-  fMC(0x0),
-  fReader(0x0),
-  fPID(0x0),
-  fAnalyzer(0x0),
-  fCurrEvent(0x0),
-  fHistograms(0x0)
-{
-//
-// Default constructor (not recommended)
-//
-}
-
-//_____________________________________________________________________________
-AliRsnAnalysisSimpleTask::AliRsnAnalysisSimpleTask(const char *name) :
-  AliAnalysisTask(name, ""),
-  fEvent(0x0),
-  fMC(0x0),
-  fReader(0x0),
-  fPID(0x0),
-  fAnalyzer(0x0),
-  fCurrEvent(0x0),
-  fHistograms(0x0)
-{
-//
-// Working constructor (recommended)
-//
-
-    DefineInput (0, TChain::Class());
-    DefineOutput (0, TList::Class());
-}
-
-//_____________________________________________________________________________
-AliRsnAnalysisSimpleTask::AliRsnAnalysisSimpleTask(const AliRsnAnalysisSimpleTask& obj) :
-  AliAnalysisTask(obj),
-  fEvent(0x0),
-  fMC(0x0),
-  fReader(obj.fReader),
-  fPID(obj.fPID),
-  fAnalyzer(obj.fAnalyzer),
-  fCurrEvent(0x0),
-  fHistograms(0x0)
-{
-//
-// Copy constructor (not recommended)
-//
-}
-
-//_____________________________________________________________________________
-AliRsnAnalysisSimpleTask& AliRsnAnalysisSimpleTask::operator=(const AliRsnAnalysisSimpleTask& /*obj*/)
-{
-//
-// Assignment operator (not recommended)
-//
-
-    AliInfo("Not implemented. Avoid using the assignment operator");
-    return *this;
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisSimpleTask::CreateOutputObjects()
-{
-//
-// Create the output container
-//
-
-    // check for presence of NECESSARY data-members
-    if (!fReader) {
-        AliFatal("Event reader not initialized. Impossible to continue. Aborting with fatal error.");
-        return;
-    }
-    if (!fPID) {
-        AliFatal("PID manager not initialized. Impossible to continue. Aborting with fatal error.");
-        return;
-    }
-    if (!fAnalyzer) {
-        AliFatal("Analysis manager not initialized. Impossible to continue. Aborting with fatal error.");
-        return;
-    }
-
-    // OpenFile (0);
-
-    // output histogram list
-    fHistograms = new TList(0);
-
-    // initialize analyzer
-    fAnalyzer->Init();
-
-    // store all histograms in the pairs into the list
-    TObjArray *array = fAnalyzer->GetPairs();
-    AliRsnPairSimple *pair;
-    if (array) {
-        TObjArrayIter iter(array);
-        while ( (pair = (AliRsnPairSimple*)iter.Next()) ) {
-            fHistograms->AddLast((TObject*)pair->GetHistogram());
-            fHistograms->AddLast((TObject*)pair->GetHistogramMC());
-        }
-    }
-    array = fAnalyzer->GetMixPairs();
-    if (array) {
-        TObjArrayIter iter(array);
-        while ( (pair = (AliRsnPairSimple*)iter.Next()) ) {
-            fHistograms->AddLast((TObject*)pair->GetHistogram());
-            fHistograms->AddLast((TObject*)pair->GetHistogramMC());
-        }
-    }
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisSimpleTask::ConnectInputData(Option_t *)
-{
-//
-// Connect the input data
-//
-
-    // connect ESD
-    AliInputEventHandler *inH = dynamic_cast<AliInputEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-    if (!inH) {
-               AliError("Could not get InputHandler");
-       }
-       else {
-               fEvent = inH->GetEvent();
-       }
-
-       // connect MC
-    AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*>((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
-    if (!mcH) {
-               AliError("Could not get MCInputHandler");
-       }
-    else {
-               fMC = mcH->MCEvent();
-       }
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisSimpleTask::Exec(Option_t */*option*/)
-{
-//
-// Loops on input container to store data of all tracks.
-// Uses the AliRsnReader methods to save them in the output.
-//
-
-    // check ESD and MC events
-    if (!fEvent) {
-        AliWarning("Event not available here");
-        return;
-    }
-    if (!fMC) {
-        AliWarning("MC event not available here");
-        return;
-    }
-
-    // clear previous event
-    if (!fCurrEvent) {
-        fCurrEvent = new AliRsnEvent;
-        fCurrEvent->Init();
-    }
-    else fCurrEvent->Clear();
-
-    // read event, identify
-    if (!fReader->Fill(fCurrEvent, fEvent, fMC)) AliWarning("Failed reading");
-    if (!fPID->Identify(fCurrEvent)) AliWarning("Failed PID");
-    AliInfo(Form("Collected %d tracks", fCurrEvent->GetMultiplicity()));
-
-    // process event with analyzer
-    fPID->Identify(fCurrEvent);
-    fAnalyzer->Process(fCurrEvent);
-
-    // post collected data
-    PostData (0, fHistograms);
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisSimpleTask::Terminate(Option_t */*option*/)
-{
-//
-// Terminate analysis
-//
-
-    AliDebug(1, "Terminating");
-    AliAnalysisTask::Terminate();
-}
diff --git a/PWG2/RESONANCES/AliRsnAnalysisSimpleTask.h b/PWG2/RESONANCES/AliRsnAnalysisSimpleTask.h
deleted file mode 100644 (file)
index a90989b..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//----------------------------------------------------------------------------------
-//  Class AliRsnAnalysisSimpleTask
-// ------------------------
-// Reader for conversion of ESD output into the internal format
-// used for resonance study.
-// ---
-// original author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-// ---
-// adapted for Analysis Framework
-// by    : R. Vernet                          (email: renaud.vernet@cern.ch)
-//----------------------------------------------------------------------------------
-
-#ifndef AliRsnAnalysisSimpleTask_H
-#define AliRsnAnalysisSimpleTask_H
-
-#include "AliAnalysisTask.h"
-
-class TList;
-class AliVEvent;
-class AliMCEvent;
-class AliRsnPID;
-class AliRsnReader;
-class AliRsnEvent;
-class AliRsnAnalyzerSimple;
-
-class AliRsnAnalysisSimpleTask : public AliAnalysisTask
-{
-public:
-
-    AliRsnAnalysisSimpleTask();
-    AliRsnAnalysisSimpleTask(const char *name);
-    virtual ~AliRsnAnalysisSimpleTask() { }
-    
-    // Implementation of interface methods
-    virtual void ConnectInputData (Option_t *);
-    virtual void CreateOutputObjects();
-    virtual void Exec (Option_t *option);
-    virtual void Terminate(Option_t *option);
-    
-    // setters
-    void SetReader(AliRsnReader *reader) {fReader = reader;}
-    void SetPID(AliRsnPID *pid) {fPID = pid;}
-    void SetAnalyzer(AliRsnAnalyzerSimple *analyzer) {fAnalyzer = analyzer;}
-    
-private:
-
-    AliRsnAnalysisSimpleTask(const AliRsnAnalysisSimpleTask&);
-    AliRsnAnalysisSimpleTask& operator=(const AliRsnAnalysisSimpleTask&);
-
-    AliVEvent*            fEvent;      // input event
-       AliMCEvent*           fMC;         // corresponding MC event
-    AliRsnReader*         fReader;     // read manager
-    AliRsnPID*            fPID;        // particle identification manager
-    AliRsnAnalyzerSimple* fAnalyzer;   // analyzer
-    AliRsnEvent*          fCurrEvent;  // current event pointer -> for moving among methods
-    TList*                fHistograms; // list of output histograms
-
-    ClassDef(AliRsnAnalysisSimpleTask, 1); // implementation of RsnReader as ReaderTaskSE
-};
-
-#endif
diff --git a/PWG2/RESONANCES/AliRsnAnalyzerSimple.cxx b/PWG2/RESONANCES/AliRsnAnalyzerSimple.cxx
deleted file mode 100644 (file)
index be054ee..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/**************************************************************************
- * 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 AliRsnAnalyzerSimple
-//
-// Implementation of the event processing which returns histograms of
-// invariant mass for resonances and backgrounds evaluation.
-//
-// author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-//=========================================================================
-
-#include <TTree.h>
-#include <TFile.h>
-#include <TArray.h>
-#include <TClonesArray.h>
-
-#include "AliLog.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-#include "AliRsnEventBuffer.h"
-#include "AliRsnPairSimple.h"
-#include "AliRsnAnalyzerSimple.h"
-
-ClassImp(AliRsnAnalyzerSimple)
-
-//_____________________________________________________________________________
-AliRsnAnalyzerSimple::AliRsnAnalyzerSimple(Int_t bufferSize) :
-  TObject(),
-  fBufferSize(bufferSize),
-  fMixMultCut(10),
-  fMixVzCut(0.5),
-  fNMix(10),
-  fPairs(0x0),
-  fMixPairs(0x0),
-  fBuffer(0x0)
-{
-//
-// Constructor
-// Initializes all pointers and collections to NULL.
-//
-}
-
-
-//_____________________________________________________________________________
-void AliRsnAnalyzerSimple::Clear(Option_t *option)
-{
-//
-// Clear heap
-//
-    fPairs->Clear(option);
-    fMixPairs->Clear(option);
-    delete fBuffer;
-    fBuffer = 0;
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalyzerSimple::AddPair(AliRsnPairSimple *pair)
-{
-//
-// Add a pair of particle types to be analyzed.
-// Second argument tells if the added object is for event mixing.
-//
-    Bool_t mixing = pair->IsForMixing();
-    TObjArray* &target = mixing ? fMixPairs : fPairs;
-    if (!target) target = new TObjArray(0);
-    target->AddLast(pair);
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalyzerSimple::Init()
-{
-//
-// Initialize what needs to.
-//
-
-    // buffer
-    fBuffer = new AliRsnEventBuffer(fBufferSize, kFALSE);
-
-    // histograms
-    AliRsnPairSimple *pair = 0;
-    if (fPairs) {
-        TObjArrayIter pairIterator(fPairs);
-        while ( (pair = (AliRsnPairSimple*)pairIterator.Next()) ) pair->InitHistograms();
-    }
-    if (fMixPairs) {
-        TObjArrayIter mixIterator(fMixPairs);
-        while ( (pair = (AliRsnPairSimple*)mixIterator.Next()) ) pair->InitHistograms();
-    }
-}
-
-//_____________________________________________________________________________
-Stat_t AliRsnAnalyzerSimple::Process(AliRsnEvent *event)
-{
-//
-// Computes all invariant mass distributions defined in the AliRsnPair objects collected.
-// Depending on the kind of background evaluation method, computes also this one.
-//
-
-    // skip empty events
-    if (event->GetMultiplicity() < 1) return 0.0;
-
-    // create buffer if not already present
-    if (!fBuffer) Init();
-
-    // initialize output values and utility variables
-    Stat_t nPairs = 0;
-    AliRsnPairSimple *pair = 0x0;
-
-    // break here if NULL argument is passed
-    if (!event) {
-        AliError("NULL event passed");
-        return 0.0;
-    }
-
-    // loop over the collection of pair defs
-    if (fPairs) {
-        TObjArrayIter pairIterator(fPairs);
-        while ( (pair = (AliRsnPairSimple*)pairIterator.Next()) ) {
-            nPairs += pair->Process(event, event);
-        }
-    }
-    if (fMixPairs) {
-        // variables for mixing
-        Int_t    mult1, mult2, i, j, count = 0;
-        Double_t vz1, vz2;
-        // add this event to buffer
-        fBuffer->AddEvent(event);
-        // event mixing
-        vz1 = event->GetPrimaryVertexZ();
-        mult1 = event->GetMultiplicity();
-        if (!fBuffer->NEmptySlots()) {
-            i = fBuffer->GetEventsBufferIndex();
-            j = i+1;
-            for (;;j++) {
-                if (count >= fNMix) break;
-                if (j == fBufferSize) j = 0;
-                if (j == i) break;
-                AliRsnEvent *evmix = fBuffer->GetEvent(j);
-                if (!evmix) continue;
-                vz2 = evmix->GetPrimaryVertexZ();
-                mult2 = evmix->GetMultiplicity();
-                if (TMath::Abs(vz1 - vz2) <= fMixVzCut && TMath::Abs(mult1- mult2) <= fMixMultCut) {
-                    // loop over the collection of pair defs
-                    TObjArrayIter mixIterator(fMixPairs);
-                    while ( (pair = (AliRsnPairSimple*)mixIterator.Next()) ) {
-                        nPairs += pair->Process(event, evmix);
-                        nPairs += pair->Process(evmix, event);
-                    }
-                    count++;
-                }
-            }
-        }
-    }
-
-    return nPairs;
-}
diff --git a/PWG2/RESONANCES/AliRsnAnalyzerSimple.h b/PWG2/RESONANCES/AliRsnAnalyzerSimple.h
deleted file mode 100644 (file)
index 7bbf4aa..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//=========================================================================
-// Class AliRsnAnalyzerSimple
-//
-// Implementation of the event processing which returns histograms of
-// invariant mass for resonances and backgrounds evaluation.
-//
-// author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-//=========================================================================
-
-#ifndef AliRsnAnalyzerSimple_H
-#define AliRsnAnalyzerSimple_H
-
-#include "AliRsnPID.h"
-
-class TObjArray;
-class AliRsnPairSimple;
-class AliRsnEventBuffer;
-
-class AliRsnAnalyzerSimple : public TObject
-{
-public:
-
-    AliRsnAnalyzerSimple(Int_t bufferSize = 1000);
-    virtual ~AliRsnAnalyzerSimple() {Clear();}
-
-    // setters
-    void    SetBufferSize(Int_t value) {fBufferSize = value;}
-    void    SetMixMultiplicityCut(Int_t cut) {fMixMultCut = cut;}
-    void    SetMixVzCut(Double_t cut) {fMixVzCut = cut;}
-    void    SetNMix(Int_t value) {fNMix = value;}
-
-    // getters
-    TObjArray* GetPairs() {return fPairs;}
-    TObjArray* GetMixPairs() {return fMixPairs;}
-
-    // working routines
-    void         Init();
-    virtual void Clear(Option_t *option = "C");
-    void         AddPair(AliRsnPairSimple *pair);
-    Stat_t       Process(AliRsnEvent *event);
-
-private:
-
-    AliRsnAnalyzerSimple(const AliRsnAnalyzerSimple &copy) :
-      TObject(copy),fBufferSize(1000),
-      fMixMultCut(10),fMixVzCut(0.5),fNMix(10),
-      fPairs(0x0),fMixPairs(0x0),fBuffer(0x0) { }
-    AliRsnAnalyzerSimple& operator=(const AliRsnAnalyzerSimple & /*copy*/) { return (*this); }
-
-    Int_t         fBufferSize;       // size of buffer
-    Int_t         fMixMultCut;       // multiplicity cut for event mixing
-    Double_t      fMixVzCut;         // difference in VZ cut for event mixing
-    Int_t         fNMix;             // number of events for mixing
-
-    TObjArray         *fPairs;       //! collection of particle pairs to be read for 1-event analysis
-    TObjArray         *fMixPairs;    //! collection of particle pairs to be read for event-mixing
-    AliRsnEventBuffer *fBuffer;      //! buffer for event mixing
-
-    // Rsn analyzer implementation
-    ClassDef(AliRsnAnalyzerSimple,1)
-};
-
-#endif
index 415e317c50f0dffb9a92d59a7c0b3fb403b1bd04..c038002d05f732103362caaff9dbeac613520180 100644 (file)
@@ -1,24 +1,10 @@
-/**************************************************************************
- * 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 AliRsnCut
 //
 // General implementation of a single cut strategy, which can be:
-// - a value contained in a given interval  [--> IsBetween()]
-// - a value equal to a given reference     [--> MatchesValue()  ]
+// - a value contained in a given interval  [--> IsBetween()   ]
+// - a value equal to a given reference     [--> MatchesValue()]
+//
 // In all cases, the reference value(s) is (are) given as data members
 // and each kind of cut requires a given value type (Int, UInt, Double),
 // but the cut check procedure is then automatized and chosen thanks to
@@ -28,7 +14,7 @@
 //
 // authors: Martin Vala (martin.vala@cern.ch)
 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//=========================================================================
+//
 
 #include "AliLog.h"
 
@@ -36,6 +22,7 @@
 #include "AliRsnMCInfo.h"
 #include "AliRsnPairParticle.h"
 #include "AliRsnPairDef.h"
+#include "AliRsnEvent.h"
 #include "AliRsnCut.h"
 
 const Double_t AliRsnCut::fgkDSmallNumber = 1e-100;
@@ -53,8 +40,8 @@ AliRsnCut::AliRsnCut() :
   fIMax( fgkIBigNumber),
   fUIMin(0),
   fUIMax(2 * (UInt_t)fgkIBigNumber),
-  fRsnCutType (kLastCutType),
-  fRsnCutVarType (kDouble_t)
+  fType (kLastCutType),
+  fVarType (kDouble_t)
 {
 //
 // Constructor
@@ -62,7 +49,7 @@ AliRsnCut::AliRsnCut() :
 }
 
 //________________________________________________________________________________________________________________
-AliRsnCut::AliRsnCut (const char *name, const char *title, ERsnCutType type) :
+AliRsnCut::AliRsnCut (const char *name, const char *title, EType type) :
   TNamed (name,title),
   fDMin(-fgkDBigNumber),
   fDMax( fgkDBigNumber),
@@ -70,8 +57,8 @@ AliRsnCut::AliRsnCut (const char *name, const char *title, ERsnCutType type) :
   fIMax( fgkIBigNumber),
   fUIMin(0),
   fUIMax(2 * (UInt_t)fgkIBigNumber),
-  fRsnCutType (type),
-  fRsnCutVarType (kDouble_t)
+  fType (type),
+  fVarType (kDouble_t)
 {
 //
 // Constructor with arguments but not limits
@@ -79,7 +66,7 @@ AliRsnCut::AliRsnCut (const char *name, const char *title, ERsnCutType type) :
 }
 
 //________________________________________________________________________________________________________________
-AliRsnCut::AliRsnCut (const char *name, const char *title, ERsnCutType type, Double_t min, Double_t max) :
+AliRsnCut::AliRsnCut (const char *name, const char *title, EType type, Double_t min, Double_t max) :
   TNamed (name,title),
   fDMin(min),
   fDMax(max),
@@ -87,8 +74,8 @@ AliRsnCut::AliRsnCut (const char *name, const char *title, ERsnCutType type, Dou
   fIMax( fgkIBigNumber),
   fUIMin(0),
   fUIMax(2 * (UInt_t)fgkIBigNumber),
-  fRsnCutType (type),
-  fRsnCutVarType (kDouble_t)
+  fType (type),
+  fVarType (kDouble_t)
 {
 //
 // Constructor with arguments and limits
@@ -96,7 +83,7 @@ AliRsnCut::AliRsnCut (const char *name, const char *title, ERsnCutType type, Dou
 }
 
 //________________________________________________________________________________________________________________
-AliRsnCut::AliRsnCut (const char * name, const char * title, ERsnCutType type, Int_t min, Int_t max) :
+AliRsnCut::AliRsnCut (const char * name, const char * title, EType type, Int_t min, Int_t max) :
   TNamed (name,title),
   fDMin(-fgkDBigNumber),
   fDMax( fgkDBigNumber),
@@ -104,8 +91,8 @@ AliRsnCut::AliRsnCut (const char * name, const char * title, ERsnCutType type, I
   fIMax(max),
   fUIMin(0),
   fUIMax(2 * (UInt_t)fgkIBigNumber),
-  fRsnCutType (type),
-  fRsnCutVarType (kInt_t)
+  fType (type),
+  fVarType (kInt_t)
 {
 //
 // Constructor with arguments and limits
@@ -113,7 +100,7 @@ AliRsnCut::AliRsnCut (const char * name, const char * title, ERsnCutType type, I
 }
 
 //________________________________________________________________________________________________________________
-AliRsnCut::AliRsnCut (const char * name, const char * title, ERsnCutType type, UInt_t min, UInt_t max) :
+AliRsnCut::AliRsnCut (const char * name, const char * title, EType type, UInt_t min, UInt_t max) :
   TNamed (name,title),
   fDMin(-fgkDBigNumber),
   fDMax( fgkDBigNumber),
@@ -121,8 +108,8 @@ AliRsnCut::AliRsnCut (const char * name, const char * title, ERsnCutType type, U
   fIMax( fgkIBigNumber),
   fUIMin(min),
   fUIMax(max),
-  fRsnCutType (type),
-  fRsnCutVarType (kUInt_t)
+  fType (type),
+  fVarType (kUInt_t)
 {
 //
 // Constructor with arguments and limits
@@ -130,7 +117,7 @@ AliRsnCut::AliRsnCut (const char * name, const char * title, ERsnCutType type, U
 }
 
 //________________________________________________________________________________________________________________
-AliRsnCut::~ AliRsnCut()
+AliRsnCut::~AliRsnCut()
 {
 //
 // Destructor.
@@ -139,7 +126,7 @@ AliRsnCut::~ AliRsnCut()
 }
 
 //________________________________________________________________________________________________________________
-Bool_t AliRsnCut::IsBetween (const Double_t & theValue)
+Bool_t AliRsnCut::IsBetween (const Double_t &theValue)
 {
 //
 // Interval check.
@@ -149,6 +136,17 @@ Bool_t AliRsnCut::IsBetween (const Double_t & theValue)
     return ((theValue >= fDMin) && (theValue <= fDMax));
 }
 
+//________________________________________________________________________________________________________________
+Bool_t AliRsnCut::IsBetween (const Int_t &theValue)
+{
+//
+// Interval check.
+// Question: "Is the argument included between fDMin and fDMax?"
+// (not implemented for integer values because usually it is not used with them)
+//
+    return ((theValue >= fIMin) && (theValue <= fIMax));
+}
+
 //________________________________________________________________________________________________________________
 Bool_t AliRsnCut::MatchesValue (const Int_t &theValue)
 {
@@ -182,40 +180,40 @@ Bool_t AliRsnCut::MatchesValue (const Double_t &theValue)
 }
 
 //________________________________________________________________________________________________________________
-void AliRsnCut::SetCutValues (ERsnCutType type, const Double_t & theValue, const Double_t & theValue2)
+void AliRsnCut::SetCutValues (EType type, const Double_t &theValue, const Double_t &theValue2)
 {
 //
 // (Re)assignment of cut values
 //
-    fRsnCutType = type;
+    fType = type;
     fDMin = theValue;
     fDMax = theValue2;
 }
 
 //________________________________________________________________________________________________________________
-void AliRsnCut::SetCutValues (ERsnCutType type, const Int_t& theValue, const Int_t& theValue2)
+void AliRsnCut::SetCutValues (EType type, const Int_t &theValue, const Int_t &theValue2)
 {
 //
 // (Re)assignment of cut values
 //
-    fRsnCutType = type;
+    fType = type;
     fIMin = theValue;
     fIMax = theValue2;
 }
 
 //________________________________________________________________________________________________________________
-void AliRsnCut::SetCutValues (ERsnCutType type, const UInt_t& theValue, const UInt_t& theValue2)
+void AliRsnCut::SetCutValues (EType type, const UInt_t &theValue, const UInt_t &theValue2)
 {
 //
 // (Re)assignment of cut values
 //
-    fRsnCutType = type;
+    fType = type;
     fUIMin = theValue;
     fUIMax = theValue2;
 }
 
 //________________________________________________________________________________________________________________
-Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnDaughter *daughter)
+Bool_t AliRsnCut::IsSelected(ETarget type, AliRsnDaughter *daughter)
 {
 //
 // Core of the whole class.
@@ -233,8 +231,12 @@ Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnDaughter *daughter)
         AliWarning(Form("Mismatch: type = %d (expected %d), class type = %s (expected AliRsnDaughter)", type, kParticle, daughter->ClassName()));
         return kTRUE;
     }
+    
+    // utility variables
+    AliRsnPID::EType pidType;
+    Double_t prob;
 
-    switch (fRsnCutType) {
+    switch (fType) {
         case kMomentum:
             return IsBetween (daughter->P());
         case kTransMomentum:
@@ -242,7 +244,7 @@ Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnDaughter *daughter)
         case kEta:
             return IsBetween (daughter->Eta());
         case kRadialImpactParam:
-            return IsBetween (daughter->Vt());
+            return IsBetween (daughter->Dr());
         case kMomentumMC:
             if (mcinfo) return IsBetween (mcinfo->P());
             else return kTRUE;
@@ -256,7 +258,10 @@ Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnDaughter *daughter)
         case kChargeNeg:
             return (daughter->Charge() < 0);
         case kPIDType:
-            return MatchesValue((Int_t)daughter->PIDType());
+        case kPIDProb:
+            pidType = daughter->PIDType(prob);
+            if (fType == kPIDType) return MatchesValue((Int_t)pidType);
+            if (fType == kPIDProb) return IsBetween(prob);
         /*
         case kEtaMC:
             if (mcinfo) return IsBetween (mcinfo->Eta());
@@ -278,7 +283,7 @@ Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnDaughter *daughter)
 }
 
 //________________________________________________________________________________________________________________
-Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnPairParticle * pair)
+Bool_t AliRsnCut::IsSelected(ETarget type, AliRsnPairParticle * pair)
 {
     AliDebug (AliLog::kDebug, "<-");
 
@@ -288,7 +293,7 @@ Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnPairParticle * pair)
         return kTRUE;
     }
 
-    switch (fRsnCutType) {
+    switch (fType) {
         case kMomentum:
             return IsBetween (pair->GetP());
         case kTransMomentum:
@@ -301,10 +306,6 @@ Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnPairParticle * pair)
             return IsBetween (pair->GetPMC());
         case kTransMomentumMC:
             return IsBetween (pair->GetPtMC());
-        case kRestMomentum:
-            return CheckRestMomentum(pair);
-        case kIsPdgEqual:
-            return pair->IsPDGEqual();
         case kIsLabelEqual:
             return pair->IsLabelEqual();
         case kIsTruePair:
@@ -318,38 +319,32 @@ Bool_t AliRsnCut::IsSelected(ECutSetType type, AliRsnPairParticle * pair)
 }
 
 //________________________________________________________________________________________________________________
-void AliRsnCut::PrintAllValues()
+Bool_t AliRsnCut::IsSelected(ETarget type, AliRsnEvent * event)
 {
-  AliInfo (Form ("fRsnCutType=%d fRsnCutVarType=%d",fRsnCutType,fRsnCutVarType));
-  AliInfo (Form ("fDMin=%.2e fDMax=%.2e",fDMin,fDMax));
-  AliInfo (Form ("fIMin=%d fIMax=%d",fIMin,fIMax));
-  AliInfo (Form ("fUIMin=%d fUIMax=%d",fUIMin,fUIMax));
-}
-
-//________________________________________________________________________________________________________________
-Bool_t AliRsnCut::CheckRestMomentum(AliRsnPairParticle *pair)
-{
-//
-// Check the cut on daughter momenta in rest reference frame of mother
-//
-
-    Double_t beta = pair->GetP() / pair->GetMass();
-    Double_t gamma = 1. / TMath::Sqrt(1. - beta*beta);
-
-    Double_t p1labP = 0.0, p1labT, p1restP, p1restTot;
-    p1labP += pair->GetDaughter(0)->Px() * pair->GetP(0);
-    p1labP += pair->GetDaughter(0)->Py() * pair->GetP(1);
-    p1labP += pair->GetDaughter(0)->Pz() * pair->GetP(2);
-    p1labP /= pair->GetP();
-
-    p1labT = TMath::Sqrt(pair->GetDaughter(0)->P2() - p1labP*p1labP);
+    AliDebug (AliLog::kDebug, "<-");
 
-    p1restP = gamma*p1labP - beta*gamma*pair->GetDaughter(0)->E();
+    // check type
+    if (type != kEvent) {
+        AliWarning(Form("Mismatch: type = %d (expected %d), class type = %s (expected AliRsnEvent)", type, kEvent, event->ClassName()));
+        return kTRUE;
+    }
 
-    p1restTot = TMath::Sqrt(p1restP*p1restP + p1labT*p1labT);
+    switch (fType) {
+        case kMultiplicity:
+            return IsBetween ((Int_t)event->GetMultiplicity());
+        default:
+            AliWarning("Requested a cut which cannot be applied to an event");
+            return kTRUE;
+    }
 
-    return IsBetween(p1restTot);
+    return kTRUE;
 }
 
-
-
+//________________________________________________________________________________________________________________
+void AliRsnCut::PrintAllValues()
+{
+  AliInfo (Form ("fType=%d fVarType=%d",fType,fVarType));
+  AliInfo (Form ("fDMin=%.2e fDMax=%.2e",fDMin,fDMax));
+  AliInfo (Form ("fIMin=%d fIMax=%d",fIMin,fIMax));
+  AliInfo (Form ("fUIMin=%d fUIMax=%d",fUIMin,fUIMax));
+}
index 02581a9a5fd3c88d4c5d14bc4818851e3f7b43ec..95c144771890811dabf73003aed957f064ca5b56 100644 (file)
@@ -1,9 +1,4 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//=========================================================================
+//
 // Class AliRsnCut
 //
 // General implementation of a single cut strategy, which can be:
@@ -18,7 +13,7 @@
 //
 // authors: Martin Vala (martin.vala@cern.ch)
 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//=========================================================================
+//
 
 #ifndef ALIRSNCUT_H
 #define ALIRSNCUT_H
 class AliRsnDaughter;
 class AliRsnPairParticle;
 class AliRsnPairDef;
+class AliRsnEvent;
 
 class AliRsnCut : public TNamed
 {
 public:
-    enum ERsnCutType
+
+    // available cut types
+    // some ones work both for pairs and single tracks
+    enum EType
     {
         kMomentum = 0,
         kTransMomentum,
@@ -41,60 +40,63 @@ public:
         kMomentumMC,
         kTransMomentumMC,
         kEtaMC,
-        kRestMomentum,
         kNSigma,
         kNSigmaCalculate,
         kStatus,
-        kIsPdgEqual,
         kIsLabelEqual,
         kIsTruePair,
         kChargePos,
         kChargeNeg,
         kPIDType,
+        kPIDProb,
+        kMultiplicity,
         kLastCutType
     };
 
-    enum ERsnCutVarType
+    // types of cut variables
+    enum EVarType
     {
         kDouble_t = 0,
         kInt_t,
         kUInt_t
     };
 
-    enum ECutSetType
+    // possible targets for a cut
+    enum ETarget
     {
         kParticle = 0,
         kPair,
+        kEvent,
         kMixEventFinderCut,
-        kLastCutSetIndex
+        kLastCutTarget
     };
 
     AliRsnCut();
-    AliRsnCut (const char *name, const char *title, ERsnCutType type);
-    AliRsnCut (const char *name, const char *title, ERsnCutType type, Double_t min, Double_t max = 1e-100);
-    AliRsnCut (const char *name, const char *title, ERsnCutType type, Int_t min, Int_t max = 32767);
-    AliRsnCut (const char *name, const char *title, ERsnCutType type, UInt_t min, UInt_t max = 65534);
+    AliRsnCut (const char *name, const char *title, EType type);
+    AliRsnCut (const char *name, const char *title, EType type, Double_t min, Double_t max = 1e-100);
+    AliRsnCut (const char *name, const char *title, EType type, Int_t min, Int_t max = 32767);
+    AliRsnCut (const char *name, const char *title, EType type, UInt_t min, UInt_t max = 65534);
 
     ~AliRsnCut();
 
-    void      SetCutValues (ERsnCutType type, const Double_t& theValue, const Double_t& theValue2);
-    void      SetCutValues (ERsnCutType type, const Int_t& theValue, const Int_t& theValue2);
-    void      SetCutValues (ERsnCutType type, const UInt_t& theValue, const UInt_t& theValue2);
+    void      SetCutValues (EType type, const Double_t& theValue, const Double_t& theValue2);
+    void      SetCutValues (EType type, const Int_t& theValue, const Int_t& theValue2);
+    void      SetCutValues (EType type, const UInt_t& theValue, const UInt_t& theValue2);
 
-    Bool_t    IsSelected (ECutSetType type,  AliRsnDaughter *daughter);
-    Bool_t    IsSelected (ECutSetType type,  AliRsnPairParticle *pair);
+    Bool_t    IsSelected (ETarget tgt,  AliRsnDaughter *daughter);
+    Bool_t    IsSelected (ETarget tgt,  AliRsnPairParticle *pair);
+    Bool_t    IsSelected (ETarget tgt,  AliRsnEvent *event);
 
     void      PrintAllValues();
 
     Bool_t    IsBetween (const Double_t &theValue);
+    Bool_t    IsBetween (const Int_t &theValue);
     Bool_t    MatchesValue (const Int_t &theValue);
     Bool_t    MatchesValue (const UInt_t &theValue);
     Bool_t    MatchesValue (const Double_t &theValue);
 
 private:
 
-    Bool_t CheckRestMomentum(AliRsnPairParticle *pair);
-
     Double_t        fDMin;          // min. double value
     Double_t        fDMax;          // max. double value
     Int_t           fIMin;          // min. int value
@@ -102,8 +104,8 @@ private:
     UInt_t          fUIMin;         // min. uint value
     UInt_t          fUIMax;         // max. uint value
 
-    ERsnCutType     fRsnCutType;    // cut type
-    ERsnCutVarType  fRsnCutVarType; // variable type
+    EType           fType;          // cut type
+    EVarType        fVarType;       // variable type
 
     static const Double_t fgkDSmallNumber;  // small double value
     static const Double_t fgkDBigNumber;    // big double value
index c1f9090c187c297d7a8702670035e73f1a3c5149..82f55a2041920835dc6116a5ca88df223eb084a2 100644 (file)
+//
+// Class AliRsnCutMgr
+//
+// The cut manager: contains a complete set of cut definitions
+// to be applied to all possible targets (one for each target),
+// in order to ease the set-up procedure of cuts and allow to
+// pass them at once to each object which must use them
+//
+// author: Martin Vala (martin.vala@cern.ch)
+//
+
 #include "AliLog.h"
 
 #include "AliRsnDaughter.h"
+#include "AliRsnEvent.h"
 #include "AliRsnCutSet.h"
 #include "AliRsnCutMgr.h"
 
-ClassImp ( AliRsnCutMgr )
+ClassImp (AliRsnCutMgr)
 
-AliRsnCutMgr::AliRsnCutMgr()
-    : TNamed("defaultName","default Tilte")
+//_____________________________________________________________________________
+AliRsnCutMgr::AliRsnCutMgr() :
+  TNamed("defaultName", "defaultTitle")
 {
-  for ( Int_t i=0 ;i<AliRsnCut::kLastCutSetIndex ;i++ )
-  {
-    fCutSets[i] = 0;
-  }
+//
+// Constructor without arguments.
+//
 
+    Int_t i;
+    for (i = 0; i < AliRsnCut::kLastCutTarget; i++) {
+        fCutSets[i] = 0;
+    }
 }
 
-AliRsnCutMgr::AliRsnCutMgr ( const char * name, const char * title )
-    : TNamed ( name,title )
+//_____________________________________________________________________________
+AliRsnCutMgr::AliRsnCutMgr (const char *name, const char *title) :
+  TNamed (name, title)
 {
+//
+// Constructor with name and title.
+//
 
-  for ( Int_t i=0 ;i<AliRsnCut::kLastCutSetIndex ;i++ )
-  {
-    fCutSets[i] = 0 ;
-  }
-
+    Int_t i;
+    for (i = 0; i < AliRsnCut::kLastCutTarget; i++) {
+        fCutSets[i] = 0;
+    }
 }
 
+//_____________________________________________________________________________
 AliRsnCutMgr::~AliRsnCutMgr()
 {
-  for ( Int_t i=0 ;i<AliRsnCut::kLastCutSetIndex ;i++ )
-  {
-    delete fCutSets[i];
-  }
+//
+// Destructor.
+// Deletes all cut definitions.
+//
 
+    Int_t i;
+    for (i = 0; i < AliRsnCut::kLastCutTarget; i++) {
+        delete fCutSets[i];
+    }
 }
 
-void AliRsnCutMgr::SetCutSet ( AliRsnCut::ECutSetType type, AliRsnCutSet* cutset )
+//_____________________________________________________________________________
+void AliRsnCutMgr::SetCutSet (AliRsnCut::ETarget type, AliRsnCutSet* cutset)
 {
-  if ( !fCutSets[type] )
-    fCutSets[type] = ( AliRsnCutSet* ) cutset->Clone() ;
-  AliDebug (AliLog::kDebug ,Form ( "DatasetName %s",fCutSets[type]->GetName() ) );
-}
+//
+// Assign a cut set to a given target
+//
 
+    if (!fCutSets[type]) fCutSets[type] = (AliRsnCutSet*) cutset->Clone();
+    AliDebug (AliLog::kDebug, Form ("DatasetName %s", fCutSets[type]->GetName()));
+}
 
-Bool_t AliRsnCutMgr::IsSelected ( AliRsnCut::ECutSetType type,TObject *obj )
+//_____________________________________________________________________________
+Bool_t AliRsnCutMgr::IsSelected ( AliRsnCut::ETarget type,TObject *obj )
 {
-  AliDebug ( AliLog::kDebug,"<-" );
-
-  if (!fCutSets[type]) return kTRUE;
-
-  switch ( type )
-  {
-    case AliRsnCut::kParticle:
-//       AliDebug ( AliLog::kDebug,"kParticle" );
-      return fCutSets[type]->IsSelected (type, ( AliRsnDaughter * ) obj );
-      break;
-    case AliRsnCut::kPair:
-//       AliInfo ( Form("%p" ,fCutSets[type]));
-      return fCutSets[type]->IsSelected (type, ( AliRsnPairParticle * ) obj );
-      break;
-    default:
-      AliWarning ( "Wrong ECutSetType selected." );
-      return kTRUE;
-      break;
+//
+// Check if a given object passes the cuts defined for it.
+// The target of the check is here a TObject, in order to allo generality
+// but then the kind of cut to be used is defined as first argument, and 
+// in the single cut it will be checked if it is appropriate for passed target
+//
 
-  }
-  return kTRUE;
+    AliDebug (AliLog::kDebug, "<-");
+    if (!fCutSets[type]) return kTRUE;
+    
+    switch (type) {
+        case AliRsnCut::kParticle:
+            return fCutSets[type]->IsSelected (type, (AliRsnDaughter*)obj);
+            break;
+        case AliRsnCut::kPair:
+            return fCutSets[type]->IsSelected (type, (AliRsnPairParticle*)obj);
+            break;
+        case AliRsnCut::kEvent:
+            return fCutSets[type]->IsSelected (type, (AliRsnEvent*)obj);
+            break;
+        default:
+            AliWarning ("Wrong target selected.");
+            return kTRUE;
+            break;
+    }
+    
+    return kTRUE;
 }
index 13cd8516f82812b70cdeca3df0a2740ffe82feed..f4dcd526f718d0aa94d170e4c63afcadb5a6aa61 100644 (file)
@@ -1,47 +1,45 @@
-#ifndef ALIRSNMVCUTMGR_H
-#define ALIRSNMVCUTMGR_H
+//
+// Class AliRsnCutMgr
+//
+// The cut manager: contains a complete set of cut definitions
+// to be applied to all possible targets (one for each target),
+// in order to ease the set-up procedure of cuts and allow to
+// pass them at once to each object which must use them
+//
+// author: Martin Vala (martin.vala@cern.ch)
+//
+
+#ifndef ALIRSNCUTMGR_H
+#define ALIRSNCUTMGR_H
 
 #include "TNamed.h"
 #include "TObjArray.h"
 
 #include "AliRsnCut.h"
-// #include "AliRsnCutSet.h"
-// class AliRsnCut;
+
 class AliRsnCutSet;
 
-/**
-  @author Martin Vala <Martin.Vala@cern.ch>
-*/
 class AliRsnCutMgr : public TNamed
 {
   public:
 
-//     enum ECutSetType {
-//       kParticle= 0,
-//       kPair,
-//       kMixEventFinderCut,
-//       kLastCutSetIndex
-//     };
-
-
     AliRsnCutMgr();
     AliRsnCutMgr(const char *name, const char* title);
-
     ~AliRsnCutMgr();
 
-    void SetCutSet(AliRsnCut::ECutSetType type,AliRsnCutSet* cutset);
-    AliRsnCutSet* GetCutSet(AliRsnCut::ECutSetType type) { return fCutSets[type];}
-
-    Bool_t IsSelected(AliRsnCut::ECutSetType type,TObject *obj);
+    void          SetCutSet(AliRsnCut::ETarget type, AliRsnCutSet* cutset);
+    AliRsnCutSet* GetCutSet(AliRsnCut::ETarget type) {return fCutSets[type];}
+    Bool_t        IsSelected(AliRsnCut::ETarget type, TObject *obj);
 
   private:
 
-    AliRsnCutMgr(const AliRsnCutMgr &cut):TNamed(cut) {}
+    // dummy constructors
+    AliRsnCutMgr(const AliRsnCutMgr &cut) : TNamed(cut) {}
     AliRsnCutMgr& operator=(const AliRsnCutMgr& /*cut*/) {return *this;}
 
-    AliRsnCutSet *fCutSets[AliRsnCut::kLastCutSetIndex];
+    AliRsnCutSet *fCutSets[AliRsnCut::kLastCutTarget];  // cut definitions for all targets
 
-    ClassDef ( AliRsnCutMgr,1 );
+    ClassDef (AliRsnCutMgr, 1); // dictionary
 };
 
 #endif
index b3aaf90c3c39a1dac54f075654da5bb492688487..b230f9c0c725c2a151228840ea71a1c898a7a059 100644 (file)
 
 #include "AliRsnCutSet.h"
 
-ClassImp ( AliRsnCutSet )
-
-AliRsnCutSet::AliRsnCutSet()
-    : TNamed(),fCuts(0),fNumOfCuts ( 0 ),
-    fCutScheme ( "" ),
-    fCutSchemeIndexed ( "" ),
-    fBoolValues ( 0 ),fIsScheme ( kFALSE ),fExpression(0)
+ClassImp (AliRsnCutSet)
+
+//_____________________________________________________________________________
+AliRsnCutSet::AliRsnCutSet() :
+  TNamed(),
+  fCuts(0),
+  fNumOfCuts(0),
+  fCutScheme (""),
+  fCutSchemeIndexed (""),
+  fBoolValues (0),
+  fIsScheme (kFALSE),
+  fExpression(0)
 {
-  fBoolValues = new Bool_t[1];
-//   fExpression = new AliRsnExpression ( fCutSchemeIndexed );
-  AliRsnExpression::sCutSet = this;
+//
+// Constructor without name (not recommended)
+//
+
+    fBoolValues = new Bool_t[1];
+    AliRsnExpression::sCutSet = this;
 }
 
-AliRsnCutSet::AliRsnCutSet ( TString name )
-    : TNamed ( name,name ),fCuts(0),fNumOfCuts ( 0 ),
-    fCutScheme ( "" ),
-    fCutSchemeIndexed ( "" ),
-    fBoolValues ( 0 ),fIsScheme ( kFALSE ),fExpression(0)
+//_____________________________________________________________________________
+AliRsnCutSet::AliRsnCutSet (TString name) :
+  TNamed (name, name),
+  fCuts(0),
+  fNumOfCuts(0),
+  fCutScheme (""),
+  fCutSchemeIndexed (""),
+  fBoolValues (0),
+  fIsScheme (kFALSE),
+  fExpression(0)
 {
-  fBoolValues = new Bool_t[1];
-  fExpression = 0;
-  AliRsnExpression::sCutSet = this;
+//
+// Constructor with argument name (recommended)
+//
+
+    fBoolValues = new Bool_t[1];
+    fExpression = 0;
+    AliRsnExpression::sCutSet = this;
 }
 
-AliRsnCutSet::AliRsnCutSet ( const AliRsnCutSet & copy )
-    :    TNamed ( ( TNamed ) copy ),fCuts ( copy.fCuts ),fNumOfCuts ( copy.fNumOfCuts ),
-    fCutScheme ( copy.fCutScheme ),
-    fCutSchemeIndexed ( copy.fCutSchemeIndexed ),
-    fBoolValues(0),
-    fIsScheme ( copy.fIsScheme ),
-    fExpression ( copy.fExpression )
+//_____________________________________________________________________________
+AliRsnCutSet::AliRsnCutSet (const AliRsnCutSet & copy) :
+  TNamed ((TNamed) copy),
+  fCuts(copy.fCuts),
+  fNumOfCuts(copy.fNumOfCuts),
+  fCutScheme(copy.fCutScheme),
+  fCutSchemeIndexed (copy.fCutSchemeIndexed),
+  fBoolValues(0),
+  fIsScheme(copy.fIsScheme),
+  fExpression(copy.fExpression)
 {
-  AliRsnExpression::sCutSet = this;
+//
+// Copy constructor
+//
+
+    AliRsnExpression::sCutSet = this;
 }
 
+//_____________________________________________________________________________
 AliRsnCutSet::~AliRsnCutSet()
 {
-  delete fExpression;
-  delete [] fBoolValues;
+//
+// Destructor
+//
+
+    delete fExpression;
+    delete [] fBoolValues;
 }
 
-void AliRsnCutSet::AddCut ( AliRsnCut * cut )
+//_____________________________________________________________________________
+void AliRsnCutSet::AddCut (AliRsnCut *cut)
 {
-  AliDebug ( AliLog::kDebug,"<-" );
-  fCuts.Add ( cut );
-  fNumOfCuts++;
-  if ( fBoolValues )
-    delete fBoolValues;
-  fBoolValues = new Bool_t[fNumOfCuts];
-  for ( Int_t i=0;i<fNumOfCuts ; i++ )
-  {
-    fBoolValues[i] = kTRUE;
-  }
+//
+// Add a new cut.
+// This must be done for all components of the final expression
+//
 
-  AliDebug ( AliLog::kDebug,Form ( "%d",fCuts.GetEntriesFast() ) );
-  AliDebug ( AliLog::kDebug,"->" );
+    Int_t i;
+
+    AliDebug (AliLog::kDebug,"<-");
+    fCuts.Add (cut);
+    fNumOfCuts++;
+    
+    if (fBoolValues) delete fBoolValues;
+    
+    fBoolValues = new Bool_t[fNumOfCuts];
+    for (i = 0; i < fNumOfCuts; i++) {
+        fBoolValues[i] = kTRUE;
+    }
+    
+    AliDebug (AliLog::kDebug,Form ("%d",fCuts.GetEntriesFast()));
+    AliDebug (AliLog::kDebug,"->");
 }
 
-void AliRsnCutSet::ShowCuts ( )
+//_____________________________________________________________________________
+void AliRsnCutSet::ShowCuts ()
 {
+//
+// Prints all cuts
+//
 //   AliRsnCut *cut;
-//   for ( Int_t i=0; i<fCuts.GetEntriesFast() ;i++ )
+//   for (Int_t i=0; i<fCuts.GetEntriesFast() ;i++)
 //   {
-//     cut = ( AliRsnCut* ) fCuts.At ( i );
-//     AliInfo ( Form ( "%s (\"%s\") [%.2f - %.2f]",cut->GetName(),cut->GetTitle(),cut->GetMin(),cut->GetMax() ) );
+//     cut = (AliRsnCut*) fCuts.At (i);
+//     AliInfo (Form ("%s (\"%s\") [%.2f - %.2f]",cut->GetName(),cut->GetTitle(),cut->GetMin(),cut->GetMax()));
 //   }
 }
 
-Bool_t AliRsnCutSet::IsSelected ( AliRsnCut::ECutSetType type, AliRsnDaughter *daughter )
+//_____________________________________________________________________________
+Bool_t AliRsnCutSet::IsSelected (AliRsnCut::ETarget type, AliRsnDaughter *daughter)
 {
-  if ( !fNumOfCuts )
-    return kTRUE;
-
-  Bool_t boolReturn = kTRUE;
-  AliRsnCut *cut;
-  for ( Int_t i=0; i<fNumOfCuts ;i++ )
-  {
-    cut = ( AliRsnCut* ) fCuts.At ( i );
-    fBoolValues[i] = cut->IsSelected ( type,daughter );
-//     AliInfo(Form("%s %d",cut->GetName(),fBoolValues[i]));
-  }
-
-  if ( fIsScheme )
-    boolReturn = Passed();
+//
+// Checks an object according to the cut expression defined here.
+//
 
-  return boolReturn;
+    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,daughter);
+    }
+    
+    if (fIsScheme) boolReturn = Passed();
+    return boolReturn;
 }
 
-Bool_t AliRsnCutSet::IsSelected ( AliRsnCut::ECutSetType type, AliRsnPairParticle * pair )
+//_____________________________________________________________________________
+Bool_t AliRsnCutSet::IsSelected (AliRsnCut::ETarget type, AliRsnPairParticle * pair)
 {
-  if ( !fNumOfCuts )
-    return kTRUE;
+//
+// Checks an object according to the cut expression defined here.
+//
 
-  Bool_t boolReturn = kTRUE;
-  AliRsnCut *cut;
-  for ( Int_t i=0; i<fNumOfCuts ;i++ )
-  {
-    cut = ( AliRsnCut* ) fCuts.At ( i );
-    fBoolValues[i] = cut->IsSelected (type,pair );
-//     AliInfo(Form("%s %d",cut->GetName(),fBoolValues[i]));
-  }
+    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,pair);
+    }
+    
+    if (fIsScheme) boolReturn = Passed();
+    return boolReturn;
+}
 
-  if ( fIsScheme )
-    boolReturn = Passed();
+//_____________________________________________________________________________
+Bool_t AliRsnCutSet::IsSelected (AliRsnCut::ETarget type, AliRsnEvent * event)
+{
+//
+// Checks an object according to the cut expression defined here.
+//
 
-  return boolReturn;
+    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,event);
+    }
+    
+    if (fIsScheme) boolReturn = Passed();
+    return boolReturn;
 }
 
-
-void AliRsnCutSet::SetCutScheme ( const TString & theValue )
+//_____________________________________________________________________________
+void AliRsnCutSet::SetCutScheme (const TString & theValue)
 {
-  AliDebug ( AliLog::kDebug,"<-" );
-  fCutScheme = theValue;
-  SetCutSchemeIndexed ( theValue );
-  fIsScheme = kTRUE;
-  AliDebug ( AliLog::kDebug,"->" );
-}
+//
+// Define the combination of cuts with logical operators
+// and using the names given to all defined cuts.
+//
 
+    AliDebug (AliLog::kDebug,"<-");
+    fCutScheme = theValue;
+    SetCutSchemeIndexed (theValue);
+    fIsScheme = kTRUE;
+    AliDebug (AliLog::kDebug,"->");
+}
 
-void AliRsnCutSet::SetCutSchemeIndexed ( TString theValue )
+//_____________________________________________________________________________
+void AliRsnCutSet::SetCutSchemeIndexed (TString theValue)
 {
-  AliDebug ( AliLog::kDebug,"<-" );
-  theValue.Append(" ");
-//   fCutSchemeIndexed = theValue;
-  fCutSchemeIndexed = GetCutSchemeIndexed();
-  AliDebug ( AliLog::kDebug,"->" );
+//
+// Internal method which indexes all cuts to organize their combo
+//
+
+    AliDebug (AliLog::kDebug,"<-");
+    theValue.Append(" ");
+    // fCutSchemeIndexed = theValue;
+    fCutSchemeIndexed = GetCutSchemeIndexed();
+    AliDebug (AliLog::kDebug,"->");
 }
 
-Int_t AliRsnCutSet::GetIndexByCutName ( TString s )
+//_____________________________________________________________________________
+Int_t AliRsnCutSet::GetIndexByCutName (TString s)
 {
-  AliRsnCut *cut;
-  for ( Int_t i=0 ;i< fCuts.GetEntriesFast() ;i++ )
-  {
-    cut = ( AliRsnCut* ) fCuts.At ( i );
-//     if ( !cut->GetName().CompareTo ( s ) )
-    if ( !s.CompareTo ( cut->GetName() ) )
-    {
-      return i;
-    }
-  }
+//
+// Retrieve the cut index from its name
+//
 
-  return -1;
+    Int_t i;
+    AliRsnCut *cut;
+    
+    for (i = 0; i < fCuts.GetEntriesFast(); i++) {
+        cut = (AliRsnCut*) fCuts.At (i);
+        if (!s.CompareTo (cut->GetName())) return i;
+    }
+    
+    return -1;
 }
 
+//_____________________________________________________________________________
 Bool_t AliRsnCutSet::Passed()
 {
-  AliRsnExpression::sCutSet = this;
-  if ( !fExpression )
-  {
-    fExpression = new AliRsnExpression ( fCutSchemeIndexed );
-    AliDebug ( AliLog::kDebug,"fExpression was created." );
-  }
-  return fExpression->Value ( *GetCuts() );
+//
+// Combines the cuts according to expression
+// and gives a global response to the cut check
+//
+
+    AliRsnExpression::sCutSet = this;
+    if (!fExpression) {
+        fExpression = new AliRsnExpression (fCutSchemeIndexed);
+        AliDebug (AliLog::kDebug,"fExpression was created.");
+    }
+    
+    return fExpression->Value (*GetCuts());
 }
 
+//_____________________________________________________________________________
 Bool_t AliRsnCutSet::IsValidScheme()
 {
-  return ( ! ( ShowCutScheme().Contains ( "Error" ) ) );
+//
+// Validity check on cut expression specified by user
+//
+
+    return (! (ShowCutScheme().Contains ("Error")));
 }
 
+//_____________________________________________________________________________
 TString AliRsnCutSet::ShowCutScheme()
 {
-  return fExpression->Unparse();
+//
+// Utility method to check validity of expression
+//
+    return fExpression->Unparse();
 }
 
-Int_t AliRsnCutSet::TestExpression ( TString opt )
+//_____________________________________________________________________________
+Int_t AliRsnCutSet::TestExpression (TString opt)
 {
-//   AliRsnCut *cut1 = new AliRsnCut ( "aaa","aaa" );
-//   cut1->SetCutValues ( AliRsnCut::kEsdPt,0.0,1.0 );
-//   AliRsnCut *cut2 = new AliRsnCut ( "bbb","bbb" );
-//   cut2->SetCutValues ( AliRsnCut::kEsdPt,1.,2.0 );
-//   AliRsnCut *cut3 = new AliRsnCut ( "ccc","ccc" );
-//   cut3->SetCutValues ( AliRsnCut::kEsdPt,2.0,3.0 );
+
+//   AliRsnCut *cut1 = new AliRsnCut ("aaa","aaa");
+//   cut1->SetCutValues (AliRsnCut::kEsdPt,0.0,1.0);
+//   AliRsnCut *cut2 = new AliRsnCut ("bbb","bbb");
+//   cut2->SetCutValues (AliRsnCut::kEsdPt,1.,2.0);
+//   AliRsnCut *cut3 = new AliRsnCut ("ccc","ccc");
+//   cut3->SetCutValues (AliRsnCut::kEsdPt,2.0,3.0);
 //
-//   AliRsnCutSet* set  = new AliRsnCutSet ( "setOne" );
-//   set->AddCut ( cut1 );
-//   set->AddCut ( cut2 );
-//   set->AddCut ( cut3 );
+//   AliRsnCutSet* set  = new AliRsnCutSet ("setOne");
+//   set->AddCut (cut1);
+//   set->AddCut (cut2);
+//   set->AddCut (cut3);
 //
-//   set->SetCutScheme ( "(aaa&!(ccc))&(bbb&!(ccc))" );
+//   set->SetCutScheme ("(aaa&!(ccc))&(bbb&!(ccc))");
 //
 //   set->ShowCuts ();
-    AliDebug(1, opt.Data());
 
-  return 0;
+    AliDebug(1, opt.Data());
+    return 0;
 }
 
+//_____________________________________________________________________________
 void AliRsnCutSet::PrintSetInfo()
 {
+//
+// Show data about the cut set
+//
 
-
-  AliInfo ( "========== Rsn Cut Set info ==============" );
-  AliInfo ( Form ( "Sheme : %s",fCutScheme.Data() ) );
-  AliInfo ( Form ( "Sheme : %s",fCutSchemeIndexed.Data() ) );
-  AliInfo ( Form ( "Num of Cuts: %d", fCuts.GetEntriesFast() ) );
-  AliInfo ( "====== Cuts ======" );
-  AliRsnCut *cut;
-  for ( Int_t i=0 ;i< fCuts.GetEntriesFast() ;i++ )
-  {
-    cut = ( AliRsnCut* ) fCuts.At ( i );
-    if ( cut )
-      AliInfo ( Form ( "%d %d",i,fBoolValues[i] ) );
-
-  }
-  AliInfo ( "========== END Rsn Cut Mgr info ==============" );
-
+    Int_t i;
+    
+    AliInfo ("========== Rsn Cut Set info ==============");
+    AliInfo (Form ("Sheme : %s",fCutScheme.Data()));
+    AliInfo (Form ("Sheme : %s",fCutSchemeIndexed.Data()));
+    AliInfo (Form ("Num of Cuts: %d", fCuts.GetEntriesFast()));
+    AliInfo ("====== Cuts ======");
+    AliRsnCut *cut;
+    for (i = 0; i < fCuts.GetEntriesFast(); i++) {
+        cut = (AliRsnCut*) fCuts.At (i);
+        if (cut) AliInfo (Form ("%d %d",i,fBoolValues[i]));
+    }
+    AliInfo ("========== END Rsn Cut Mgr info ==============");
 }
 
+//_____________________________________________________________________________
 TString AliRsnCutSet::GetCutSchemeIndexed()
 {
-  AliDebug ( AliLog::kDebug,"<-" );
-  TString str ( fCutScheme );
-  AliDebug ( AliLog::kDebug,Form ( "Num of cuts %d",fCuts.GetEntriesFast() ) );
-  AliRsnCut *cut;
-  for ( Int_t i=0; i<fCuts.GetEntriesFast();i++ )
-  {
-    cut = ( AliRsnCut* ) fCuts.At ( i );
-    str.ReplaceAll ( cut->GetName(),Form ( "%d",i ) );
-  }
-  AliDebug ( AliLog::kDebug,"->" );
-  return str;
-}
+//
+// Internal method to retrieve the list of cuts with their indexes
+// for evaluation of cut expression
+//
 
+    AliDebug (AliLog::kDebug,"<-");
+    Int_t i;
+    TString str (fCutScheme);
+    AliDebug (AliLog::kDebug,Form ("Num of cuts %d",fCuts.GetEntriesFast()));
+    AliRsnCut *cut;
+    for (i = 0; i < fCuts.GetEntriesFast(); i++) {
+        cut = (AliRsnCut*) fCuts.At (i);
+        str.ReplaceAll (cut->GetName(),Form ("%d",i));
+    }
+    AliDebug (AliLog::kDebug,"->");
+    return str;
+}
index e2255f9906aab0ee275059432dabe38e93da5205..64bbbd537809f0f6522c2831d46e9104f5af2311 100644 (file)
@@ -1,3 +1,13 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               *
+ **************************************************************************/
+//
+// class AliRsnCutSet
+// Combination of simple cuts
+//
+
 #ifndef ALIRSNCUTSET_H
 #define ALIRSNCUTSET_H
 
 #include <TObjArray.h>
 
 #include "AliRsnCut.h"
-// class AliRsnCut;
-class AliRsnCutMgr;
 
 class AliRsnDaughter;
 class AliRsnExpression;
 class AliRsnPairParticle;
+class AliRsnEvent;
 
 class AliRsnCutSet : public TNamed
 {
+public:
 
-  public:
     AliRsnCutSet();
-    AliRsnCutSet ( TString name );
-    AliRsnCutSet ( const AliRsnCutSet &copy );
-
+    AliRsnCutSet (TString name);
+    AliRsnCutSet (const AliRsnCutSet &copy);
     ~AliRsnCutSet();
 
-    void      AddCut ( AliRsnCut* cut );
-//     void      SetCutScheme ( TString sheme ) {fCutScheme = sheme;}
+    void      AddCut (AliRsnCut* cut);
 
     void      ShowCuts();
-    Int_t     GetIndexByCutName ( TString s );
+    Int_t     GetIndexByCutName (TString s);
     Bool_t    Passed();
     Bool_t    IsValidScheme();
     TString   ShowCutScheme();
-    Int_t     TestExpression ( TString opt="short" );
+    Int_t     TestExpression (TString opt="short");
     void      PrintSetInfo();
 
-    Bool_t    IsSelected (AliRsnCut::ECutSetType type, AliRsnDaughter *daughter );
-    Bool_t    IsSelected (AliRsnCut::ECutSetType type, AliRsnPairParticle *pair );
-//     Bool_t    IsSelected ( AliRsnEffectiveParticle *pair );
-//     Bool_t    IsSelected(TObject*obj);
+    Bool_t    IsSelected (AliRsnCut::ETarget type, AliRsnDaughter *daughter);
+    Bool_t    IsSelected (AliRsnCut::ETarget type, AliRsnPairParticle *pair);
+    Bool_t    IsSelected (AliRsnCut::ETarget type, AliRsnEvent *event);
 
-    void SetBoolValue ( Bool_t theValue,Int_t index ) { fBoolValues[index] = theValue; }
-    Bool_t GetBoolValue ( Int_t index ) const { return fBoolValues[index]; }
+    void SetBoolValue (Bool_t theValue,Int_t index) { fBoolValues[index] = theValue; }
+    Bool_t GetBoolValue (Int_t index) const { return fBoolValues[index]; }
 
-    void SetCutScheme ( const TString& theValue );
+    void SetCutScheme (const TString& theValue);
     TString GetCutScheme() const { return fCutScheme; }
 
-    void SetCutSchemeIndexed ( TString theValue );
+    void SetCutSchemeIndexed (TString theValue);
     TString   GetCutSchemeIndexed();
 
     TObjArray *GetCuts() { return &fCuts; }
 
-
-  private:
+private:
 
     AliRsnCutSet& operator=(const AliRsnCutSet& /*copy*/) {return (*this);}
 
@@ -59,11 +64,12 @@ class AliRsnCutSet : public TNamed
     TString       fCutScheme;             // cut scheme
     TString       fCutSchemeIndexed;      // cut scheme indexed
 
-    Bool_t        *fBoolValues;           //[fNumOfCuts]
+    Bool_t       *fBoolValues;            //[fNumOfCuts]
     Bool_t        fIsScheme;              // is scheme
-    AliRsnExpression  *fExpression;     // pointer to AliRsnExpression
+    
+    AliRsnExpression  *fExpression;       // pointer to AliRsnExpression
 
-    ClassDef ( AliRsnCutSet,1 );
+    ClassDef (AliRsnCutSet,1);   // ROOT dictionary
 };
 
 #endif
index 2a5a932252c8bc26935fd4bd7fb42324b64cf9ec..12d86c7d6a102d2c2c9b66e6c8b7db6fde485e71 100644 (file)
@@ -1,19 +1,4 @@
-/**************************************************************************
- * 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 AliRsnDaughter
 //
 //
@@ -24,7 +9,7 @@
 // Contains also a facility to compute invariant mass of a pair.
 //
 // author: A. Pulvirenti --- email: alberto.pulvirenti@ct.infn.it
-//=========================================================================
+//
 
 #include <Riostream.h>
 
 #include "AliAODTrack.h"
 #include "AliMCParticle.h"
 
-#include "AliRsnPID.h"
 #include "AliRsnMCInfo.h"
 #include "AliRsnDaughter.h"
 
 ClassImp(AliRsnDaughter)
 
+AliRsnDaughter::EPIDMethod AliRsnDaughter::fgPIDMethod = AliRsnDaughter::kNoPID;
+
 //_____________________________________________________________________________
 AliRsnDaughter::AliRsnDaughter() :
   AliVParticle(),
@@ -49,8 +35,8 @@ AliRsnDaughter::AliRsnDaughter() :
   fLabel(-1),
   fCharge(0),
   fFlags(0),
-  fPIDType(AliRsnPID::kUnknown),
   fMass(0.0),
+  fRealisticPID(AliRsnPID::kUnknown),
   fMCInfo(0x0)
 {
 //
@@ -76,8 +62,8 @@ AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter &copy) :
   fLabel(copy.fLabel),
   fCharge(copy.fCharge),
   fFlags(copy.fFlags),
-  fPIDType(copy.fPIDType),
   fMass(copy.fMass),
+  fRealisticPID(copy.fRealisticPID),
   fMCInfo(0x0)
 {
 //
@@ -106,8 +92,8 @@ AliRsnDaughter::AliRsnDaughter(AliESDtrack *track, Bool_t useTPC) :
   fLabel(-1),
   fCharge(0),
   fFlags(0),
-  fPIDType(AliRsnPID::kUnknown),
   fMass(0.0),
+  fRealisticPID(AliRsnPID::kUnknown),
   fMCInfo(0x0)
 {
 //
@@ -126,8 +112,8 @@ AliRsnDaughter::AliRsnDaughter(AliAODTrack *track) :
   fLabel(-1),
   fCharge(0),
   fFlags(0),
-  fPIDType(AliRsnPID::kUnknown),
   fMass(0.0),
+  fRealisticPID(AliRsnPID::kUnknown),
   fMCInfo(0x0)
 {
 //
@@ -146,8 +132,8 @@ AliRsnDaughter::AliRsnDaughter(AliMCParticle *track) :
   fLabel(-1),
   fCharge(0),
   fFlags(0),
-  fPIDType(AliRsnPID::kUnknown),
   fMass(0.0),
+  fRealisticPID(AliRsnPID::kUnknown),
   fMCInfo(0x0)
 {
 //
@@ -183,8 +169,8 @@ AliRsnDaughter& AliRsnDaughter::operator=(const AliRsnDaughter &copy)
         fPIDProb[i] = copy.fPIDProb[i];
     }
 
-    fPIDType = copy.fPIDType;
-    fMass    = copy.fMass;
+    fMass = copy.fMass;
+    fRealisticPID = copy.fRealisticPID;
 
     // initialize particle object
     // only if it is present in the template object;
@@ -226,33 +212,68 @@ void AliRsnDaughter::SetPIDWeight(Int_t i, Double_t value)
 }
 
 //_____________________________________________________________________________
-void AliRsnDaughter::SetPIDProb(Int_t i, Double_t value)
+void  AliRsnDaughter::AssignRealisticPID()
 {
 //
-// I the argument 'i' is in the correct range,
-// sets the i-th PID probability to 'value'
+// Assign realistic PID from largest probability
 //
 
-    if (i >= 0 && i < AliRsnPID::kSpecies) fPIDProb[i] = value;
-    else {
-        AliError(Form("Cannot set a weight related to slot %d", i));
+    Int_t i, imax = 0;
+    Double_t pmax = fPIDProb[0];
+    
+    // search for maximum
+    for (i = 1; i < AliRsnPID::kSpecies; i++) {
+        if (fPIDProb[i] > pmax) {
+            imax = i;
+            pmax = fPIDProb[i];
+        }
     }
+    
+    fRealisticPID = (AliRsnPID::EType)imax;
 }
 
 //_____________________________________________________________________________
-void AliRsnDaughter::SetPIDWeights(const Double_t *pid)
+AliRsnPID::EType AliRsnDaughter::PIDType(Double_t &prob)
 {
 //
-// Sets ALL PID weights at once.
-// The passed array is supposed to have at least as many
-// slots as the number of allowed particle species.
+// Return the PID type according to the selected method
+// in the argument passed by reference, the probability is stored.
+// It will be realistic for realistic PID and 1 for perfect PID.
+//
+
+    switch (fgPIDMethod) {
+        case kNoPID:
+            AliWarning("Requested a PIDtype call in NoPID mode");
+            return AliRsnPID::kUnknown;
+        case kPerfect:
+            if (fMCInfo) return AliRsnPID::InternalType(fMCInfo->PDG());
+            else return AliRsnPID::kUnknown;
+        default:
+            if (fRealisticPID > 0 && fRealisticPID < AliRsnPID::kSpecies) {
+                prob = fPIDProb[fRealisticPID];
+                return fRealisticPID;
+            }
+            else {
+                prob = 1.0;
+                return AliRsnPID::kUnknown;
+            }
+    }
+}
+
+//_____________________________________________________________________________
+void AliRsnDaughter::SetPIDProb(Int_t i, Double_t value)
+{
+//
+// I the argument 'i' is in the correct range,
+// sets the i-th PID probability to 'value'
 //
 
-   Int_t i;
-   for (i = 0; i < AliRsnPID::kSpecies; i++) fPIDWeight[i] = pid[i];
+    if (i >= 0 && i < AliRsnPID::kSpecies) fPIDProb[i] = value;
+    else {
+        AliError(Form("Cannot set a weight related to slot %d", i));
+    }
 }
 
-
 //_____________________________________________________________________________
 Bool_t AliRsnDaughter::Adopt(AliESDtrack* esdTrack, Bool_t useTPCInnerParam)
 {
@@ -330,6 +351,9 @@ Bool_t AliRsnDaughter::Adopt(AliAODTrack* aodTrack)
     // copy PID weights
     Int_t i;
     for (i = 0; i < 5; i++) fPIDWeight[i] = aodTrack->PID()[i];
+    
+    // copy flags
+    fFlags = aodTrack->GetStatus();
 
     // copy sign
     fCharge = aodTrack->Charge();
@@ -386,14 +410,10 @@ Bool_t AliRsnDaughter::Adopt(AliMCParticle *mcParticle)
         return kFALSE;
     }
 
-    // identify track perfectly using PDG code
-    fPIDType = AliRsnPID::InternalType(pdg);
-    fMass = AliRsnPID::ParticleMass(fPIDType);
-
     // flags and PID weights make no sense with MC tracks
     fFlags = 0;
     for (pdg = 0; pdg < AliRsnPID::kSpecies; pdg++) fPIDWeight[pdg] = 0.0;
-    fPIDWeight[fPIDType] = 1.0;
+    fPIDWeight[AliRsnPID::InternalType(absPDG)] = 1.0;
 
     // copy other MC info (mother PDG code cannot be retrieved here)
     InitMCInfo(particle);
@@ -413,6 +433,7 @@ void AliRsnDaughter::Print(Option_t *option) const
 // - I --> identification (PID, probability and mass)
 // - W --> PID weights
 // - M --> Montecarlo (from AliRsnMCInfo)
+// - L --> index & label
 // - ALL --> All oprions switched on
 //
 // Index and label are printed by default.
@@ -421,9 +442,10 @@ void AliRsnDaughter::Print(Option_t *option) const
     TString opt(option);
     opt.ToUpper();
 
-    cout << ".......Index            : " << fIndex << endl;
-    cout << ".......Label            : " << fLabel << endl;
-
+    if (opt.Contains("L") || opt.Contains("ALL")) {
+        cout << ".......Index            : " << fIndex << endl;
+        cout << ".......Label            : " << fLabel << endl;
+    }
     if (opt.Contains("P") || opt.Contains("ALL")) {
         cout << ".......Px, Py, Pz, Pt   : " << Px() << ' ' << Py() << ' ' << Pz() << ' ' << Pt() << endl;
     }
@@ -436,13 +458,6 @@ void AliRsnDaughter::Print(Option_t *option) const
     if (opt.Contains("F") || opt.Contains("ALL")) {
         cout << ".......Flags            : " << fFlags << endl;
     }
-    if (opt.Contains("I") || opt.Contains("ALL")) {
-        cout << ".......PID              : " << AliRsnPID::ParticleName(fPIDType) << endl;
-        if (fPIDType > 0 && fPIDType < AliRsnPID::kSpecies) {
-            cout << ".......PID probability  : " << fPIDProb[fPIDType] << endl;
-        }
-        cout << ".......Mass             : " << fMass << endl;
-    }
     if (opt.Contains("W") || opt.Contains("ALL")) {
         cout << ".......Weights          : ";
         Int_t i;
@@ -515,3 +530,19 @@ Bool_t AliRsnDaughter::InitMCInfo(AliMCParticle *mcParticle)
     TParticle *particle = mcParticle->Particle();
     return InitMCInfo(particle);
 }
+
+//_____________________________________________________________________________
+Int_t AliRsnDaughter::Compare(const TObject* obj) const
+{
+//
+// Compare two tracks with respect to their transverse momentum.
+// Citation from ROOT reference: 
+// "Must return -1 if this is smaller than obj, 0 if objects are equal 
+//  and 1 if this is larger than obj".
+//
+
+    AliRsnDaughter *that = (AliRsnDaughter*)obj;
+    if (Pt() < that->Pt()) return 1;
+    else if (Pt() > that->Pt()) return -1;
+    else return 0;
+}
index bf3ffb0de0f489a30173bc22f7236086e854464b..593dcc5b6b0e869dbfbdd066d53b2e12849ee5a5 100644 (file)
@@ -1,17 +1,12 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//=============================================================================
+//
 // Class AliRsnDaughter
 //
-// Light-weight 'track' AOD object which contains all required track details
+// 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.
 //
 // author: A. Pulvirenti --- email: alberto.pulvirenti@ct.infn.it
-//=============================================================================
+//
 
 #ifndef ALIRSNDAUGHTER_H
 #define ALIRSNDAUGHTER_H
@@ -32,6 +27,14 @@ class AliRsnMCInfo;
 class AliRsnDaughter : public AliVParticle
 {
   public:
+  
+    enum EPIDMethod {
+        kNoPID = 0,
+        kRealistic,
+        kWeighted,
+        kPerfect,
+        kMethods
+    };
 
     AliRsnDaughter();
     AliRsnDaughter (const AliRsnDaughter &copy);
@@ -43,13 +46,14 @@ class AliRsnDaughter : public AliVParticle
 
     // 4-momentum
     virtual Double_t E()  const {return TMath::Sqrt (fMass*fMass + P2());}
+    virtual Double_t E(Double_t mass) {SetM(mass); return E();}
     virtual Double_t M()  const {return fMass;}
-    virtual Double_t P2() const {return Px() *Px() + Py() *Py() + Pz() *Pz();}
+    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 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;}
     void             SetPx (Double_t value) {fP[0] = value;}
@@ -62,7 +66,7 @@ class AliRsnDaughter : public AliVParticle
     virtual Double_t Xv() const {return fV[0];}
     virtual Double_t Yv() const {return fV[1];}
     virtual Double_t Zv() const {return fV[2];}
-    virtual Double_t Vt() const {return TMath::Sqrt (Xv() *Xv() + Yv() *Yv());}
+    virtual Double_t Dr() const {return TMath::Sqrt (Xv()*Xv() + Yv()*Yv());}
     virtual Bool_t   XvYvZv (Double_t x[3]) const {x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE;}
     void             SetVx (Double_t value) {fV[0] = value;}
     void             SetVy (Double_t value) {fV[1] = value;}
@@ -81,12 +85,12 @@ class AliRsnDaughter : public AliVParticle
 
     // PID
     virtual const Double_t* PID() const {return fPIDWeight;}
-    AliRsnPID::EType        PIDType() const {return fPIDType;}
     const Double_t*         PIDProb() const {return fPIDProb;}
-    void                    SetPIDType (AliRsnPID::EType type) {fPIDType = type;}
     void                    SetPIDProb (Int_t i, Double_t value);
     void                    SetPIDWeight (Int_t i, Double_t value);
-    void                    SetPIDWeights (const Double_t *pid);
+    static void             SetPIDMethod(EPIDMethod method) {fgPIDMethod = method;}
+    void                    AssignRealisticPID();
+    AliRsnPID::EType        PIDType(Double_t &prob);
 
     // check that contains a given ESD flag
     Bool_t  CheckFlag (ULong_t flag) {return (fFlags & flag);}
@@ -99,6 +103,7 @@ class AliRsnDaughter : public AliVParticle
     // position in stack/array
     Int_t   Index() const {return fIndex;}
     Int_t   Label() const {return fLabel;}
+    Int_t   GetLabel() const {return -1;}
     void    SetIndex (Int_t value) {fIndex = value;}
     void    SetLabel (Int_t value) {fLabel = value;}
 
@@ -108,9 +113,12 @@ class AliRsnDaughter : public AliVParticle
     Bool_t  InitMCInfo (TParticle *particle);
     Bool_t  InitMCInfo (AliMCParticle *mcParticle);
 
-    // Dummy
-    Int_t GetLabel() const {return -1;}
+    // MC info
     AliRsnMCInfo* GetMCInfo() const { return fMCInfo; }
+    
+    // sorting (with respect to Pt)
+    virtual Bool_t IsSortable() const {return kTRUE;}
+    virtual Int_t  Compare(const TObject* obj) const;
 
   private:
 
@@ -122,15 +130,16 @@ class AliRsnDaughter : public AliVParticle
 
     Double_t           fP[3];     // vector momentum (x, y, z)
     Double_t           fV[3];     // DCA vertex (x, y, z)
+    Double_t           fMass;     // mass (assigned externally)
 
-    AliRsnPID::EType   fPIDType;  // assigned PID
-    Double_t           fPIDProb[AliRsnPID::kSpecies];   // probability related to assigned PID
+    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
-    Double_t           fMass;     // mass (defined by PID)
 
-    AliRsnMCInfo      *fMCInfo;   // reference to particle object (if any)
+    AliRsnMCInfo      *fMCInfo;     // reference to particle object (if any)
+    static EPIDMethod  fgPIDMethod; // flag to define how the PID is computed for this object
 
-    ClassDef (AliRsnDaughter, 3);
+    ClassDef (AliRsnDaughter, 4);
 };
 
 #endif
index 8a7e7acb0a955cb2b6db29a9acb9fedb8ce02f2d..fab29c6a843d9807bc3497590a009be96628e041 100644 (file)
@@ -189,6 +189,68 @@ AliRsnDaughter* AliRsnEvent::GetTrack(Int_t index)
     return (AliRsnDaughter*) fTracks->UncheckedAt (index);
 }
 
+//_____________________________________________________________________________
+AliRsnDaughter* AliRsnEvent::GetLeadingParticle
+(Double_t ptMin, AliRsnPID::EType type, Bool_t realistic)
+{
+//
+// Returns the particle in this event with largest transverse momentum,
+// provided that this momentum is larger than the first argument
+// and that the PID type correspond to the second argument.
+// If one specifies "AliRsnPID::kUnknown" as second arguments, the PID check is not done.
+//
+
+    Double_t prob;
+    AliRsnPID::EType trackType;
+    AliRsnDaughter *track, *leading = 0x0;
+    TObjArrayIter iter(fTracks);
+    while ( (track = (AliRsnDaughter*)iter.Next()) ) {
+        if (track->Pt() < ptMin) continue;
+        if (realistic) {
+            AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
+        }
+        else {
+            AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kPerfect);
+        }
+        trackType = track->PIDType(prob);
+        if (type != AliRsnPID::kUnknown && trackType != type) continue;
+        ptMin = track->Pt();
+        leading = track;
+    }
+    
+    return leading;
+}
+
+//_____________________________________________________________________________
+Int_t AliRsnEvent::GetLastFastTrack
+(Double_t ptMin, AliRsnPID::EType type, Bool_t realistic)
+{
+//
+// Loops on the list of tracks (eventually skipping the ones which do not match
+// the given PID type with the specified PID method) and returns the index of the last
+// one whose transverse momentum is still larger than a specified value.
+// When no tracks are found this way, the value "-1" is returned.
+//
+
+    if (realistic) {
+        AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
+    }
+    else {
+        AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kPerfect);
+    }
+
+    Double_t prob;
+    Int_t i, nTracks = fTracks->GetEntries(), lastIndex = -1;
+    for (i = 0; i < nTracks; i++) {
+        AliRsnDaughter *d = (AliRsnDaughter*)fTracks->At(i);
+        AliRsnPID::EType trackType = d->PIDType(prob);
+        if (type != AliRsnPID::kUnknown && trackType != type) continue;
+        if (d->Pt() >= ptMin) lastIndex = i;
+    }
+    
+    return lastIndex;
+}
+
 //_____________________________________________________________________________
 TArrayI* AliRsnEvent::GetCharged (Char_t sign)
 {
@@ -203,7 +265,7 @@ TArrayI* AliRsnEvent::GetCharged (Char_t sign)
 
 //_____________________________________________________________________________
 TArrayI * AliRsnEvent::GetTracksArray
-(AliRsnPID::EMethod pidtype, Char_t sign, AliRsnPID::EType type)
+(AliRsnDaughter::EPIDMethod pidtype, Char_t sign, AliRsnPID::EType type)
 {
 //
 // Returns an array of indexes of all tracks in this event
@@ -214,12 +276,12 @@ TArrayI * AliRsnEvent::GetTracksArray
 //
 
     switch (pidtype) {
-        case AliRsnPID::kRealistic:
+        case AliRsnDaughter::kRealistic:
             if (fRealisticPID) {
                 return fRealisticPID->GetTracksArray (sign, type);
             }
             break;
-        case AliRsnPID::kPerfect:
+        case AliRsnDaughter::kPerfect:
             if (fPerfectPID) {
                 return fPerfectPID->GetTracksArray (sign, type);
             }
@@ -247,8 +309,12 @@ void AliRsnEvent::FillPIDArrays()
     fNoPID = new AliRsnPIDIndex;
     fPerfectPID = new AliRsnPIDIndex;
     fRealisticPID = new AliRsnPIDIndex;
+    
+    // set the default type to Realistic
+    AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
 
     // loop on tracks and create references
+    Double_t prob;
     Int_t i, icharge, type;
     Short_t charge;
     AliRsnMCInfo *mcinfo = 0;
@@ -256,7 +322,7 @@ void AliRsnEvent::FillPIDArrays()
     TObjArrayIter iter(fTracks);
     while ( (track = (AliRsnDaughter*) iter.Next()) ) {
         charge = track->Charge();
-        type = (Int_t)track->PIDType();
+        type = (Int_t)track->PIDType(prob);
         i = fTracks->IndexOf(track);
         mcinfo = track->GetMCInfo();
         if (charge > 0) icharge = 0;
index ec82f4094f3a4436fd0f8bc4875c3e5bebb36932..26e7c8f4077a008c1eb25dbe12befb16bf84f848 100644 (file)
 #ifndef ALIRSNEVENT_H
 #define ALIRSNEVENT_H
 
-class AliRsnDaughter;
-
 #include <TNamed.h>
 #include <TArrayI.h>
 #include <TClonesArray.h>
+
 #include "AliRsnPID.h"
 #include "AliRsnPIDIndex.h"
+#include "AliRsnDaughter.h"
 
 class AliRsnEvent : public TNamed
 {
@@ -43,10 +43,13 @@ class AliRsnEvent : public TNamed
     void            Clear (Option_t *option = "");
     AliRsnDaughter* AddTrack (AliRsnDaughter track);
     AliRsnDaughter* GetTrack (Int_t index);
+    AliRsnDaughter* GetLeadingParticle(Double_t ptMin = 0.0, AliRsnPID::EType type = AliRsnPID::kUnknown, Bool_t realistic = kTRUE);
+    Int_t           GetLastFastTrack(Double_t ptMin, AliRsnPID::EType type = AliRsnPID::kUnknown, Bool_t realistic = kTRUE);
     TClonesArray*   GetTracks() {return fTracks;}
     TArrayI*        GetCharged (Char_t sign);
-    TArrayI*        GetTracksArray (AliRsnPID::EMethod pidtype, Char_t sign, AliRsnPID::EType type);
+    TArrayI*        GetTracksArray (AliRsnDaughter::EPIDMethod method, Char_t sign, AliRsnPID::EType type);
     void            FillPIDArrays();
+    void            SortTracks() {fTracks->Sort();}
     void            Print (Option_t *option = "") const;
 
     // Primary vertex
index 32a84f6adf9ca92fc5168bd5fccacb91357e637d..fb926727e80e777aa21585547d46fa928cf2e02e 100644 (file)
@@ -14,15 +14,19 @@ class AliRsnCutSet;
 
 // These are the valid operators types.
 
-enum { kOpAND=1,   // AND '&'
-       kOpOR,      // OR '|'
-       kOpNOT
-     };   // Unary negation '!'
-
 class AliRsnExpression : public TObject
 {
 
   public:
+  
+  // operators for complex cut expressions
+    enum ECutOp
+    {
+        kOpAND=1,   // AND '&'
+        kOpOR,      // OR '|'
+        kOpNOT      // Unary negation '!'
+    };
+  
     AliRsnExpression() : fVname ( 0 ), fArg1 ( 0 ), fArg2 ( 0 ), fOperator ( 0 )  {}
     AliRsnExpression ( TString exp );
     virtual    ~AliRsnExpression();
index 3783ef39ad21ca33a8805e329c79bf6aafae1a26..556613cf06dd96797d00421728f248aae8ef1209 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <AliVParticle.h>
 #include <TParticle.h>
+#include <TMath.h>
 
 class AliRsnMCInfo : public TObject
 {
@@ -15,6 +16,7 @@ public:
 
     // 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() );}
index 079550f42bf0dfb489f092ec2f511530881a859f..0d6f901ecdd89f1780f433ec45f1c619cdd47e3c 100644 (file)
@@ -25,9 +25,7 @@
 //-------------------------------------------------------------------------
 
 #include <TMath.h>
-#include <TString.h>
-#include <TClonesArray.h>
-#include <TDatabasePDG.h>
+#include <TDirectory.h>
 
 #include "AliLog.h"
 #include "AliRsnMCInfo.h"
 
 ClassImp(AliRsnPID)
 
+const Double_t AliRsnPID::fgkParticleMass[AliRsnPID::kSpecies + 1] =
+{
+  0.00051099892,   // electron
+  0.105658369,     // muon
+  0.13957018,      // pion
+  0.493677,        // kaon
+  0.93827203,      // proton
+  0.0              // nothing
+};
+
 const char* AliRsnPID::fgkParticleNameLong[AliRsnPID::kSpecies + 1] =
 {
   "electron",
@@ -80,59 +88,19 @@ const Int_t AliRsnPID::fgkParticlePDG[AliRsnPID::kSpecies + 1] =
 
 //_____________________________________________________________________________
 AliRsnPID::AliRsnPID() :
-  fMethod(kRealistic),
-  fMaxPt(10.0),
+  TNamed("RsnPID", ""),
+  fMaxPt(100.0),
   fMinProb(0.0)
 {
 //
-// Default constructor
-// Sets a default setup:
-//  - realistic PID
-//  - no lower limit for probability
-//  - upper limit of 10 GeV for Pt
-//  - suitable values for prior probabilities
-//
-
-    fPrior[kElectron] = 0.20;
-       fPrior[kMuon    ] = 0.20;
-       fPrior[kPion    ] = 0.83;
-       fPrior[kKaon    ] = 0.07;
-       fPrior[kProton  ] = 0.06;
-}
-
-//_____________________________________________________________________________
-AliRsnPID::AliRsnPID(const AliRsnPID &event) :
-  TObject((TObject)event),
-  fMethod(event.fMethod),
-  fMaxPt(event.fMaxPt),
-  fMinProb(event.fMinProb)
-{
-//
-// Copy constructor.
-// Implemented to manage the array safely.
+// Constructor.
+// Adds also the object in the default directory of the session.
 //
 
-    Int_t i;
-    for (i = 0; i < kSpecies; i++) fPrior[i] = event.fPrior[i];
-}
-
-//_____________________________________________________________________________
-AliRsnPID& AliRsnPID::operator=(const AliRsnPID &event)
-{
-//
-// Assignment operator.
-// Implemented to manage the array safely.
-//
-
-    fMethod = event.fMethod;
-    fMaxPt = event.fMaxPt;
-    fMinProb = event.fMinProb;
-
-    Int_t i;
-    for (i = 0; i < kSpecies; i++) fPrior[i] = event.fPrior[i];
-
-    // return the newly created object
-    return (*this);
+    Int_t i; 
+    for (i = 0; i < kSpecies; i++) fPrior[i] = 0.0;
+    
+    gDirectory->Append(this, kTRUE);
 }
 
 //_____________________________________________________________________________
@@ -224,13 +192,17 @@ Double_t AliRsnPID::ParticleMass(EType type)
 // Returns the mass corresponding to the particle type
 // specified as argument (w.r. to the internal enum)
 //
+    /*
     TDatabasePDG *db = TDatabasePDG::Instance();
     Int_t pdg = PDGCode(type);
     return db->GetParticle(pdg)->Mass();
+    */
+    if (type >= kElectron && type < kSpecies) return fgkParticleMass[type];
+    return 0.0;
 }
 
 //_____________________________________________________________________________
-Bool_t AliRsnPID::IdentifyRealistic(AliRsnDaughter *daughter)
+Bool_t AliRsnPID::ComputeProbs(AliRsnDaughter *daughter)
 {
 //
 // Uses the Bayesian combination of prior probabilities
@@ -249,159 +221,73 @@ Bool_t AliRsnPID::IdentifyRealistic(AliRsnDaughter *daughter)
 //
 
     // reset all PID probabilities to 0.0
-    Unidentify(daughter, 0.0);
-
-    // check the transverse momentum:
-    // if it is larger than the cut, the particle is unidentified
-    // setting all its probabilities to 1.0
-    if (daughter->Pt() > fMaxPt) {
-        Unidentify(daughter, 1.0);
-        return kTRUE;
-    }
-
-    // 0 - retrieve PID weights from argument
-    Int_t     i;
-    Double_t  sum    = 0.0;
-    Double_t *prob   = new Double_t[kSpecies];
-    Double_t *weight = new Double_t[kSpecies];
-    for (i = 0; i < kSpecies; i++) weight[i] = (daughter->PID())[i];
+    Int_t i;
+    for (i = 0; i < kSpecies; i++) daughter->SetPIDProb(i, 1.0 / (Double_t)kSpecies);
 
-    // step 1 - compute the normalization factor
+    // multiply weights and priors
+    Double_t sum = 0.0, prob[kSpecies];
     for (i = 0; i < kSpecies; i++) {
-        prob[i] = fPrior[i] * weight[i];
+        prob[i] = fPrior[i] * daughter->PID()[i];
         sum += prob[i];
     }
     if (sum <= (Double_t)0.) {
-        AliError(Form("Sum of weights = %f < 0", sum));
+        AliError(Form("Sum of weights = %f <= 0", sum));
         return kFALSE;
     }
 
-       // step 2 - normalize PID weights and update daughter data-member
+    // normalize
     for (i = 0; i < kSpecies; i++) {
         prob[i] /= sum;
         daughter->SetPIDProb(i, prob[i]);
     }
-
-       // step 3 - find the maximum probability and update daughter data members
-    Int_t    imax = 0;
-    Double_t pmax = prob[0];
-    for (i = 1; i < kSpecies; i++) {
-        if (prob[i] > pmax) {
-            imax = i;
-            pmax = prob[i];
-        }
-    }
-    EType type = (EType)imax;
-    if (pmax >= fMinProb) {
-        daughter->SetPIDType(type);
-        daughter->SetM(ParticleMass(type));
-    }
-    else {
-        daughter->SetPIDType(kUnknown);
-    }
-
+    
     return kTRUE;
 }
 
 //_____________________________________________________________________________
-Bool_t AliRsnPID::IdentifyPerfect(AliRsnDaughter *daughter)
+Bool_t AliRsnPID::IdentifiedAs(AliRsnDaughter *d, EType type, Short_t charge)
 {
 //
-// Uses the true PDG code to make a perfect identification.
-// If the true PDG code does not correspond to any
-// of the expected PID types, gives a warning, sets the
-// PID to 'unknown' and returns kFALSE.
-// Otherwise, returns kTRUE.
+// Tells if a particle has can be identified to be of a given tipe and charge.
+// If the charge is zero, the check is done only on the PID type, otherwise
+// both charge and PID type are required to match.
+// If the track momentum is larger than the pt threshold passed to this object,
+// or the maximum probability is smaller than the prob thrashold, the return value
+// is kFALSE even when the type and charge are matched.
 //
 
-    // reset all PID probabilities to 0.0
-    Unidentify(daughter, 0.0);
-
-    // if the MCInfo is not present, the particle cannot be identified perfectly
-    // in this case, to notice the error, the probs are maintained all to 0.0
-    AliRsnMCInfo *particle = daughter->GetMCInfo();
-    if (!particle) {
-        AliWarning("Particle object not initialized: impossible to do perfect PID");
-        return kFALSE;
-    }
-
-    // convert the PDG into the internal enum
-    Int_t pdgCode = particle->PDG();
-    EType type = InternalType(pdgCode);
-
-    // if the type is one of the available ones in the PID enum
-    // (e, mu, pi, K, p)
-    // the corresponding probability is set to 1, and the other remain 0
-    if (type >= 0 && type < kSpecies) {
-        daughter->SetPIDType(type);
-        daughter->SetPIDProb(type, 1.0);
-        daughter->SetM(ParticleMass(type));
+    EType dType = TrackType(d);
+    if (dType != type) return kFALSE;
+    if (charge == 0) {
         return kTRUE;
     }
-
-    return kFALSE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnPID::Unidentify(AliRsnDaughter *daughter, Double_t value)
-{
-//
-// Sets the PID to 'unknown' to every track.
-//
-
-    Int_t i;
-    for (i = 0; i < kSpecies; i++) daughter->SetPIDProb(i, value);
-    daughter->SetPIDType(kUnknown);
-    return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnPID::Identify(AliRsnDaughter *daughter)
-{
-//
-// Recalls one of the above methods, according to the one
-// defined in the related data member.
-// If the method is not recognized, returns kFALSE and
-// gives an alert. Otherwise, returns kTRUE.
-//
-
-    switch (fMethod) {
-        case kNone:
-            Unidentify(daughter);
-            return kTRUE;
-        case kRealistic:
-            IdentifyRealistic(daughter);
-            return kTRUE;
-        case kPerfect:
-            IdentifyPerfect(daughter);
-            return kTRUE;
-        default:
-            AliError(Form("PID method '%d' unrecognized. Nothing done.", fMethod));
-            return kFALSE;
+    else if (charge > 0) {
+        return (d->Charge() > 0);
+    }
+    else {
+        return (d->Charge() < 0);
     }
 }
 
 //_____________________________________________________________________________
-Bool_t AliRsnPID::IdentifiedAs(AliRsnDaughter *d, EType type, Short_t charge)
+AliRsnPID::EType AliRsnPID::TrackType(AliRsnDaughter *d)
 {
 //
-// Tells if a particle has been identified to be of a given tipe and charge.
-// If the charge is zero, the check is done only on the PID type, otherwise
-// both charge and PID type are required to match
+// Returns the track type according to the object settings
+// and to the static settings in the AliRsnDaughter object.
 //
-    if (charge == 0) {
-        return (d->PIDType() == type);
-    }
-    else if (charge > 0) {
-        return (d->PIDType() == type && d->Charge() > 0);
-    }
-    else {
-        return (d->PIDType() == type && d->Charge() < 0);
-    }
+
+    Double_t prob;
+    EType type = d->PIDType(prob);
+    
+    if (d->Pt() > fMaxPt) return kUnknown;
+    if (prob < fMinProb) return kUnknown;
+    
+    return type;
 }
 
 //_____________________________________________________________________________
-Bool_t AliRsnPID::Identify(AliRsnEvent *event)
+Bool_t AliRsnPID::Process(AliRsnEvent *event)
 {
 //
 // Performs identification for all tracks in a given event.
@@ -416,7 +302,7 @@ Bool_t AliRsnPID::Identify(AliRsnEvent *event)
     AliRsnDaughter *daughter = 0;
     TObjArrayIter iter(event->GetTracks());
     while ( (daughter = (AliRsnDaughter*)iter.Next()) ) {
-        check = check && Identify(daughter);
+        check = check && ComputeProbs(daughter);
     }
     event->FillPIDArrays();
 
@@ -436,3 +322,19 @@ void AliRsnPID::SetPriorProbability(EType type, Double_t p)
         fPrior[type] = p;
     }
 }
+
+//_____________________________________________________________________________
+void AliRsnPID::DumpPriors()
+{
+//
+// Print all prior probabilities
+//
+
+    Int_t i;
+    Char_t msg[200];
+    
+    for (i = 0; i < kSpecies; i++) {
+        sprintf(msg, "Prior probability for '%s' = %3.5f", fgkParticleNameLong[i], fPrior[i]);
+        AliInfo(msg);
+    }
+}
index 8d24d51a02bdfb5c93d244242a664d0274f76f37..1e160176249d72f6cc060a5c12769623ad2f1a65 100644 (file)
 #ifndef ALIRSNPID_H
 #define ALIRSNPID_H
 
-class AliRsnPIDProb;
+#include <TNamed.h>
+
 class AliRsnDaughter;
 class AliRsnEvent;
 
-class AliRsnPID : public TObject
+class AliRsnPID : public TNamed
 {
 public:
 
-    AliRsnPID();
-    AliRsnPID(const AliRsnPID& copy);
-    AliRsnPID& operator=(const AliRsnPID& copy);
-    virtual ~AliRsnPID() {}
-
     // types enum
     enum EType {
         kElectron = 0,
@@ -39,54 +35,46 @@ public:
         kSpecies = 5
     };
 
-    // identification method enum
-    enum EMethod {
-        kNone = 0,
-        kRealistic,
-        kPerfect,
-        kMethods
-    };
+    AliRsnPID();
+    virtual ~AliRsnPID() {}
 
     // conversions from PDG code to local type
-    static EType         InternalType(Int_t pdgCode);
-
+    static EType        InternalType(Int_t pdgCode);
+    
     // retrieve particle informations from internal type
-    static Int_t         PDGCode(EType pid);
-    static const char *  ParticleName(EType pid, Bool_t shortName = kTRUE);
-    static const char *  ParticleNameLatex(EType pid);
-    static Double_t      ParticleMass(EType pid);
+    static Int_t        PDGCode(EType pid);
+    static const char*  ParticleName(EType pid, Bool_t shortName = kTRUE);
+    static const char*  ParticleNameLatex(EType pid);
+    static Double_t     ParticleMass(EType pid);
 
     // identification routines
-    Bool_t        Identify(AliRsnDaughter *d);
-    Bool_t        Identify(AliRsnEvent *e);
-    Bool_t        IdentifiedAs(AliRsnDaughter *d, EType type, Short_t charge = 0);
-
-    // setters
-    void SetMethod(EMethod method) {fMethod = method;}
-       void SetPriorProbability(EType type, Double_t p);
-       void SetMinProb(Double_t p) {fMinProb = p;}
-       void SetMaxPt(Double_t p) {fMaxPt = p;}
-
-       // getters
-       EMethod  GetMethod() {return fMethod;}
+    Bool_t Process(AliRsnEvent *e);
+    Bool_t ComputeProbs(AliRsnDaughter *d);
+    Bool_t IdentifiedAs(AliRsnDaughter *d, EType type, Short_t charge = 0);
+    EType  TrackType(AliRsnDaughter *d);
+
+    // data members
+    void     SetPriorProbability(EType type, Double_t p);
+    void     SetMinProb(Double_t p) {fMinProb = p;}
+    void     SetMaxPt(Double_t p) {fMaxPt = p;}
+    Double_t GetPriorProbability(EType type) {return fPrior[(Int_t)type];}
+    Double_t GetMinProb() {return fMinProb;}
+    Double_t GetMaxPt() {return fMaxPt;}
+
+    // other
+    void DumpPriors();
 
 private:
 
-    // identification routines
-    Bool_t  IdentifyPerfect(AliRsnDaughter *d);
-    Bool_t  IdentifyRealistic(AliRsnDaughter *d);
-    Bool_t  Unidentify(AliRsnDaughter *d, Double_t value = 1.0);
-
-    EMethod    fMethod;          // PID method
-
-    Double_t   fPrior[kSpecies]; // prior probabilities
-    Double_t   fMaxPt;           // realistic PID is done for Pt < this parameter
-    Double_t   fMinProb;         // threshold on acceptable largest probability
+    Double_t  fPrior[kSpecies]; // prior probabilities
+    Double_t  fMaxPt;           // pt threshold for realistic PID
+    Double_t  fMinProb;         // threshold on acceptable largest probability
 
-    static const char* fgkParticleNameShort[kSpecies+1];
-    static const char* fgkParticleNameLong[kSpecies+1];
-    static const char* fgkParticleNameLatex[kSpecies+1];
-    static const Int_t fgkParticlePDG[kSpecies+1];
+    static const Double_t  fgkParticleMass[kSpecies + 1];      // PDG particle mass
+    static const char*     fgkParticleNameShort[kSpecies + 1]; // short particle name
+    static const char*     fgkParticleNameLong[kSpecies + 1];  // long particle name
+    static const char*     fgkParticleNameLatex[kSpecies + 1]; // latex particle name
+    static const Int_t     fgkParticlePDG[kSpecies + 1];       // PDG code of particle
 
     ClassDef(AliRsnPID,1);
 };
index 22ec09b2db8a307d38e965e1e147a850f709f98b..ef3a7787c5b0605b325e7a2810784d2fad70604a 100644 (file)
@@ -103,13 +103,12 @@ AliRsnPIDIndex::~AliRsnPIDIndex()
 }
 
 //_____________________________________________________________________________
-void AliRsnPIDIndex::Print (Option_t * option) const
+void AliRsnPIDIndex::Print (Option_t* /*option*/) const
 {
 //
 // Prints AliRsnPIDIndex info
 //
     Int_t i, j;
-    if (!option) return;
     for (i = 0; i < 2; i++) {
         for (j = 0; j < AliRsnPID::kSpecies + 1; j++) {
             AliInfo (Form (" [%d][%d] %d %d", i, j, fIndex[i][j].GetSize(), fNumOfIndex[i][j]));
index a497e1914e4d613f6c4a020b86dc383a37b08ef2..f1db9d3b1b3b7b62d580994d9e88a394644dedd0 100644 (file)
@@ -20,7 +20,8 @@
 class AliRsnPIDWeightsMgr : public TObject
 {
 public:
-    
+
+    // detectors for customizing PID weights
     enum EDetector {
         kITS,
         kTPC,
index 7048852c12e7de12aa3642fdab040833c8922934..42308e8f2bd9827e136e81b2f278c109633d7065 100644 (file)
@@ -1,34 +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.                  *
- **************************************************************************/
-
 //
-// ALIRSNPAIRDEF
+// Class AliRsnPairDef
 //
-// Definition of working parameters for a specific resonance analysis.
-// This object allows to define the particles to be used for computation
-// with respect to charge and PID type (included 'kUnknown'), and
-// the binning of the output histogram.
-// These definitions can then be used by many AliRsnPair objects
-// which can operate on the same track samples under different conditions.
+// Defines a decay channel for a resonance,
+// resulting in a specified PDG code for the mother,
+// and the particle type for the daughters, defined
+// according to the internal PID format of the package
 //
-// author: A. Pulvirenti
-// email : alberto.pulvirenti@ct.infn.it
+// author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 
-#include <Riostream.h>
-
 #include "AliLog.h"
 #include "AliRsnDaughter.h"
 #include "AliRsnPairDef.h"
@@ -37,11 +17,7 @@ ClassImp(AliRsnPairDef)
 
 //_____________________________________________________________________________
 AliRsnPairDef::AliRsnPairDef() :
-  TObject(),
-  fMotherPDG(0),
-  fNBins(0),
-  fMin(0.0),
-  fMax(0.0)
+  fMotherPDG(0)
 {
 //
 // Empty constructor.
@@ -62,13 +38,8 @@ AliRsnPairDef::AliRsnPairDef() :
 
 //_____________________________________________________________________________
 AliRsnPairDef::AliRsnPairDef
-(Char_t sign1, AliRsnPID::EType type1, Char_t sign2, AliRsnPID::EType type2,
- Int_t nbins, Double_t min, Double_t max) :
-  TObject(),
-  fMotherPDG(0),
-  fNBins(0),
-  fMin(0.0),
-  fMax(0.0)
+(Char_t sign1, AliRsnPID::EType type1, Char_t sign2, AliRsnPID::EType type2, Int_t motherPDG) :
+  fMotherPDG(motherPDG)
 {
 //
 // Constructor with arguments.
@@ -76,23 +47,18 @@ AliRsnPairDef::AliRsnPairDef
 //
 
     SetPair(sign1, type1, sign2, type2);
-    SetBins(nbins, min, max);
 }
 
 //_____________________________________________________________________________
 AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef &copy) :
   TObject(copy),
-  fMotherPDG(copy.fMotherPDG),
-  fNBins(0),
-  fMin(0.0),
-  fMax(0.0)
+  fMotherPDG(copy.fMotherPDG)
 {
 //
 // Copy constructor with standard behavior
 //
 
     SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
-    SetBins(copy.fNBins, copy.fMin, copy.fMax);
 }
 
 //_____________________________________________________________________________
@@ -104,7 +70,6 @@ const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef &copy)
 
     fMotherPDG = copy.fMotherPDG;
     SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
-    SetBins(copy.fNBins, copy.fMin, copy.fMax);
 
     return (*this);
 }
@@ -148,21 +113,6 @@ Bool_t AliRsnPairDef::SetPair
     return (part1 && part2);
 }
 
-//_____________________________________________________________________________
-void AliRsnPairDef::CheckEdges()
-{
-//
-// Checks that histogram edges are appropriate,
-// otherwise swaps them.
-//
-    if (fMin > fMax) {
-        AliWarning(Form("min = %f -- max = %f --> swapping", fMin, fMax));
-        Double_t temp = fMin;
-        fMin = fMax;
-        fMax = temp;
-    }
-}
-
 //_____________________________________________________________________________
 Double_t AliRsnPairDef::ComputeWeight(AliRsnDaughter *d0, AliRsnDaughter *d1)
 {
index c3c49d700da8e691c800ddac99a0c7abf5c4f47a..db9a54c39cc8ce662a8d08e2f1ef0f5cd3c626c9 100644 (file)
@@ -1,32 +1,28 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//-------------------------------------------------------------------------
-//                      Class AliRsnAnalysis
-//             Reconstruction and analysis of K* Rsn
-// ........................................
-// ........................................
-// ........................................
-// ........................................
 //
-// author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-//-------------------------------------------------------------------------
+// Class AliRsnPairDef
+//
+// Defines a decay channel for a resonance,
+// resulting in a specified PDG code for the mother,
+// and the particle type for the daughters, defined
+// according to the internal PID format of the package
+//
+// author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+//
 
 #ifndef ALIRSNPAIRDEF_H
 #define ALIRSNPAIRDEF_H
 
-class AliRsnDaughter;
 #include "AliRsnPID.h"
 
+class AliRsnDaughter;
+
 class AliRsnPairDef : public TObject
 {
 public:
 
     AliRsnPairDef();
-    AliRsnPairDef(Char_t sign1, AliRsnPID::EType type1, Char_t sign2, AliRsnPID::EType type2,
-                  Int_t nbins, Double_t min, Double_t max);
+    AliRsnPairDef(Char_t ch1, AliRsnPID::EType pid1, 
+                  Char_t ch2, AliRsnPID::EType pid2, Int_t motherPDG = 0);
     AliRsnPairDef(const AliRsnPairDef &copy);
     const AliRsnPairDef& operator=(const AliRsnPairDef &copy);
     virtual ~AliRsnPairDef() { }
@@ -35,26 +31,18 @@ public:
     Char_t           GetCharge(Int_t i) const {if (i>=0&&i<2) return fCharge[i]; else return 0;}
     AliRsnPID::EType GetType(Int_t i) const {if (i>=0&&i<2) return fType[i]; else return AliRsnPID::kUnknown;}
     Double_t         GetMass(Int_t i) const {if (i>=0&&i<2) return fMass[i]; else return 0.0;}
-    Int_t            GetNBins() const {return fNBins;}
-    Double_t         GetMin() const {return fMin;}
-    Double_t         GetMax() const {return fMax;}
     Int_t            GetMotherPDG() const {return fMotherPDG;}
 
     // setters
     Bool_t SetPairElement(Int_t i, Char_t charge, AliRsnPID::EType pid);
-    Bool_t SetPair(Char_t charge1, AliRsnPID::EType pid1, Char_t charge2, AliRsnPID::EType pid2);
+    Bool_t SetPair(Char_t ch1, AliRsnPID::EType pid1, Char_t ch2, AliRsnPID::EType pid2);
     void   SetMotherPDG(Int_t pdg) {fMotherPDG = pdg;}
-    void   SetNBins(Int_t value) {fNBins = value;}
-    void   SetMin(Double_t value) {fMin = value; CheckEdges();}
-    void   SetMax(Double_t value) {fMax = value; CheckEdges();}
-    void   SetBins(Int_t nbins, Double_t min, Double_t max) {fNBins=nbins; fMin=min; fMax=max; CheckEdges();}
 
     // pair information methods
     Bool_t IsLikeSign() {return (fCharge[0] == fCharge[1]);}
     Bool_t HasEqualTypes() {return (fType[0] == fType[1]);}
 
     // working routines
-    void     CheckEdges();
     Double_t ComputeWeight(AliRsnDaughter *d0, AliRsnDaughter *d1);
 
 private:
@@ -65,11 +53,6 @@ private:
     Char_t            fCharge[2];  // charge of particles
     AliRsnPID::EType  fType[2];    // PID of particles
 
-    // histogram parameters
-    Int_t             fNBins;      // number of histogram bins
-    Double_t          fMin;        // lower edge
-    Double_t          fMax;        // upper edge
-
     // ROOT dictionary
     ClassDef(AliRsnPairDef, 1)
 };
index 3260889935bb6aea4a5694cb7be2bf9acc033c5f..ab9999e0a7a6162e3a533015186efdcbdaf1b78b 100644 (file)
 ClassImp (AliRsnPairParticle)
 
 //_____________________________________________________________________________
-AliRsnPairParticle::AliRsnPairParticle() :
-  fMass(0.0)
+AliRsnPairParticle::AliRsnPairParticle()
 {
 //
 // Constructor.
 // Initializes all variables to meaningless values.
 //
+
     Int_t i, j;
+
     for (i = 0; i < 3; i++) {
         fPTot[i] = 0.0;
         fPTotMC[i] = 0.0;
@@ -56,14 +57,14 @@ AliRsnPairParticle::AliRsnPairParticle() :
 
 //_____________________________________________________________________________
 AliRsnPairParticle::AliRsnPairParticle(const AliRsnPairParticle &obj) :
-  TObject(obj),
-  fMass(obj.fMass)
+  TObject(obj)
 {
 //
 // Copy constructor.
 // Initializes all variables to copy values.
 // Does not duplicate pointers.
 //
+
     Int_t i, j;
     for (i = 0; i < 3; i++) {
         fPTot[i] = obj.fPTot[i];
@@ -89,8 +90,6 @@ AliRsnPairParticle& AliRsnPairParticle::operator=(const AliRsnPairParticle &obj)
 // Does not duplicate pointers.
 //
 
-    fMass = obj.fMass;
-
     Int_t i, j;
     for (i = 0; i < 3; i++) {
         fPTot[i] = obj.fPTot[i];
@@ -119,122 +118,88 @@ AliRsnPairParticle::~AliRsnPairParticle()
 }
 
 //_____________________________________________________________________________
-Double_t AliRsnPairParticle::GetInvMass(Double_t m1, Double_t m2)
+Double_t AliRsnPairParticle::GetInvMass(Double_t mass0, Double_t mass1)
 {
 //
-// Compute invariant mass using REC values.
-// The masses in argument have default value = -1.0;
-// when this is used, the mass for computation is taken from daughter object.
-// Otherwise, the passed values are used.
+// Compute invariant mass using reconstructed values.
+// 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.
 //
-    Double_t etot = 0.0;
 
-    // energy of particle 1
-    if (m1 > 0.0) etot = GetDaughterEnergy(0, m1);
-    else etot = fDaughter[0]->E();
-
-    // energy of particle 2
-    if (m2 > 0.0) etot += GetDaughterEnergy(1, m2);
-    else etot += fDaughter[1]->E();
-
-    // total momentum square module
-    Double_t p2Tot = fPTot[0]*fPTot[0] + fPTot[1]*fPTot[1] + fPTot[2]*fPTot[2];
-
-    // invariant mass returned
-    return  TMath::Sqrt (etot * etot - p2Tot);
-}
+    if (!fDaughter[0] || !fDaughter[1]) {
+        AliError("One of the two tracks is NULL in this pair!");
+        return -1000.0;
+    }
 
-//_____________________________________________________________________________
-Double_t AliRsnPairParticle::GetInvMassMC(Double_t m1, Double_t m2)
-{
-//
-// Compute invariant mass using MC values.
-// The masses in argument have default value = -1.0;
-// when a negative mass value is passed as one of the arguments,
-// the energy of tracks for computation is taken from daughter object.
-// Otherwise, the passed mass values are used to re-compute the track energy.
-//
+    // compute track energies using the shortcut method defined in AliRsnDaughter
     Double_t etot = 0.0;
+    etot += fDaughter[0]->E(mass0);
+    etot += fDaughter[1]->E(mass1);
 
-    // energy of particle 1
-    if (m1 > 0.0) etot = GetDaughterEnergyMC(0, m1);
-    else etot = fDaughter[0]->GetMCInfo()->E();
-
-    // energy of particle 2
-    if (m2 > 0.0) etot += GetDaughterEnergyMC(1, m2);
-    else etot += fDaughter[1]->GetMCInfo()->E();
-
-    // total momentum square module
-    Double_t p2Tot = fPTotMC[0]*fPTotMC[0] + fPTotMC[1]*fPTotMC[1] +fPTotMC[2]*fPTotMC[2];
-
-    // invariant mass returned
-    return  TMath::Sqrt (etot * etot - p2Tot);
+    // compute & return invariant mass
+    return  TMath::Sqrt (etot * etot - GetP2());
 }
 
 //_____________________________________________________________________________
-Double_t AliRsnPairParticle::GetDaughterEnergy(const Int_t &index, const Double_t &mass)
+Double_t AliRsnPairParticle::GetInvMassMC(Double_t mass0, Double_t mass1)
 {
 //
-// Compute track energy from REC momentum using a passed mass value.
-// The index argument refers to the used track among the two of the pair.
+// Compute invariant mass using MC values.
+// 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.
 //
 
-    if (mass > 0 && index >= 0 && index < 2) {
-        AliRsnDaughter temp(*fDaughter[index]);
-        temp.SetM(mass);
-        return temp.E();
+    if (!fDaughter[0] || !fDaughter[1]) {
+        AliError("One of the two tracks is NULL in this pair!");
+        return -1000.0;
     }
-
-    AliWarning("Negative mass or wrong index passed. Returning 0");
-    return 0.0;
-}
-
-//_____________________________________________________________________________
-Double_t AliRsnPairParticle::GetDaughterEnergyMC(const Int_t &index, const Double_t &mass)
-{
-//
-// Compute track energy from MC momentum using a passed mass value.
-// The index argument refers to the used track among the two of the pair.
-//
-    Int_t i;
-    Double_t p2Tot = 0.0;
-    if (mass > 0 && index >= 0 && index < 2) {
-        for (i = 0; i < 3; i++) p2Tot += fPTrackMC[index][i] * fPTrackMC[index][i];
-        return TMath::Sqrt(mass*mass + p2Tot);
+    if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo()) {
+        AliError("One of the two tracks has a NULL MCInfo in this pair!");
+        return -1000.0;
     }
 
-    AliWarning("Negative mass or wrong index passed. Returning 0");
-    return 0.0;
+    // compute track energies using the shortcut method defined in AliRsnDaughter
+    Double_t etot = 0.0;
+    etot += fDaughter[0]->GetMCInfo()->E(mass0);
+    etot += fDaughter[1]->GetMCInfo()->E(mass1);
+
+    // compute & return invariant mass
+    return  TMath::Sqrt (etot * etot - GetP2());
 }
 
 //_____________________________________________________________________________
-Int_t AliRsnPairParticle::GetPDG(const Int_t &index)
+Double_t AliRsnPairParticle::GetAngle() const
 {
 //
-// Return PDG code of one track in the pair
+// Returns the relative angle between the vector momenta of the tracks
+// Return value is in DEGREES.
 //
 
-    if (index < 0 || index > 1) {
-        AliError("Index out of range");
-        return 0;
-    }
-    if (!fDaughter[index]->GetMCInfo()) {
-        AliError(Form("MCInfo not initialized for track %d", index));
-        return 0;
-    }
-    return fDaughter[index]->GetMCInfo()->PDG();
+    Double_t dotProd = 0.0;
+    dotProd += fDaughter[0]->Px() * fDaughter[1]->Px();
+    dotProd += fDaughter[0]->Py() * fDaughter[1]->Pz();
+    dotProd += fDaughter[0]->Pz() * fDaughter[1]->Pz();
+    
+    Double_t cosAngle = dotProd / (fDaughter[0]->P() * fDaughter[1]->P());
+    
+    return TMath::ACos(cosAngle) * TMath::RadToDeg();
 }
 
 //_____________________________________________________________________________
 Bool_t AliRsnPairParticle::IsTruePair(Int_t refPDG)
 {
 //
-// Checks if the tweo tracks in the pair come from the same resonance.
+// Checks if the two tracks in the pair come from the same resonance.
 // This can be known if MC info is present, looking at the GEANT label of mother
 // (which should be the same).
 // If the argument is 0, the answer is kTRUE whenever the labels of mothers of the
 // two tracks is the same. When the argument is not zero, the answer is kTRUE only
 // if the mother is the same and its PDG code is equal to the argument.
+//
 
     // if MC info is not available, the pairs is not true by default
     if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo()) {
@@ -257,7 +222,6 @@ Bool_t AliRsnPairParticle::IsTruePair(Int_t refPDG)
 void AliRsnPairParticle::SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2)
 {
 //
-// Main object filling method.
 // Accepts two AliRsnDaughter's which are the two tracks in the pair,
 // fills all data-members which contain their momenta & info,
 // and computes the total momentum for REC data and MC if available
@@ -292,20 +256,14 @@ void AliRsnPairParticle::SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daug
 void AliRsnPairParticle::PrintInfo (const Option_t *option)
 {
 //
-// Print some info of the pair
+// Print some info of the pair. 
+// The options are passed to the AliRsnDaughter::Print() method
 //
 
-    TString s(option);
-
-    AliInfo ( "======== BEGIN PAIR INFO ===========" );
-    if (s.Contains("p")) {
-        AliInfo (Form("Px1 = %.6f --- Py1 = %.6f --- Pz1 = %.6f", fPTrack[0][0], fPTrack[0][1], fPTrack[0][2]));
-        AliInfo (Form("Px2 = %.6f --- Py2 = %.6f --- Pz2 = %.6f", fPTrack[1][0], fPTrack[1][1], fPTrack[1][2]));
-    }
-    if (s.Contains("t")) {
-        AliInfo (Form("PDG1 = %d --- PDG2 = %d", GetPDG(0), GetPDG(1)));
-        AliInfo (Form("type1 = %d --- type2 = %d", GetType(0), GetType(1)));
-        AliInfo (Form("label1 = %d --- label2 = %d", GetLabel(0), GetLabel(1)));
-    }
-    AliInfo ( "====== END PAIR INFO =========" );
+    AliInfo("======== BEGIN PAIR INFO ===========");
+    AliInfo("Track #1");
+    fDaughter[0]->Print(option);
+    AliInfo("Track #2");
+    fDaughter[1]->Print(option);
+    AliInfo ("========= END PAIR INFO ===========");
 }
index 102fac57247c3a7eab2c31d5b0e8c04f5d96cf72..26cf00170309348d7f6bf8269a78e13979f42e53 100644 (file)
@@ -31,39 +31,35 @@ public:
     AliRsnPairParticle& operator=(const AliRsnPairParticle &obj);
     virtual ~AliRsnPairParticle();
 
-    Double_t   GetInvMass (Double_t m1 = -1.0, Double_t m2 = -1.0);
-    Double_t   GetInvMassMC (Double_t m1 = -1.0, Double_t m2 = -1.0);
-    Double_t   GetDaughterEnergy(const Int_t &index, const Double_t &mass);
-    Double_t   GetDaughterEnergyMC(const Int_t &index, const Double_t &mass);
-
-    Double_t   GetP2() const {return (fPTot[0]*fPTot[0] + fPTot[1]*fPTot[1] + fPTot[2]*fPTot[2]);}
-    Double_t   GetPt2() const {return (fPTot[0]*fPTot[0] + fPTot[1]*fPTot[1]);}
-    Double_t   GetP() const {return TMath::Sqrt(GetP2());}
-    Double_t   GetP(Int_t index) const {return fPTot[index];}
-    Double_t   GetPt() const {return TMath::Sqrt(GetPt2());}
-
-    Double_t   GetP2MC() const {return (fPTotMC[0]*fPTotMC[0] + fPTotMC[1]*fPTotMC[1] + fPTotMC[2]*fPTotMC[2]);}
-    Double_t   GetPt2MC() const {return (fPTotMC[0]*fPTotMC[0] + fPTotMC[1]*fPTotMC[1]);}
-    Double_t   GetPMC() const {return TMath::Sqrt(GetP2MC());}
-    Double_t   GetPMC(Int_t index) const {return fPTotMC[index];}
-    Double_t   GetPtMC() const {return TMath::Sqrt(GetPt2MC());}
-
-    Int_t      GetPDG(const Int_t &index);
-    Int_t      GetType(const Int_t &index) const {return (Int_t) fDaughter[index]->PIDType();}
-    Int_t      GetLabel(const Int_t &index) const {return (Int_t) fDaughter[index]->Label();}
-    Int_t      GetIndex(const Int_t &index) const {return (Int_t) fDaughter[index]->Index();}
-    Double_t   GetMass() const {return fMass;}
-    AliRsnDaughter* GetDaughter(const Int_t &index) const {return fDaughter[index];}
-
-    Bool_t     IsPDGEqual() {return abs(GetPDG(0)) == abs(GetPDG(1));}
-    Bool_t     IsTypeEqual() {return GetType(0) == GetType(1);}
-    Bool_t     IsLabelEqual() {return abs(GetLabel(0)) == abs(GetLabel(1));}
-    Bool_t     IsIndexEqual() {return GetIndex(0) == GetIndex(1);}
-    Bool_t     IsTruePair(Int_t refPDG = 0);
-
-    void       SetMass(Double_t mass) {fMass = mass;}
-    void       SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2);
-    void       PrintInfo (const Option_t *option = "");
+    Double_t          GetInvMass (Double_t m1, Double_t m2);
+    Double_t          GetInvMassMC (Double_t m1 = -1.0, Double_t m2 = -1.0);
+    
+    Double_t          GetP2() const {return (fPTot[0]*fPTot[0] + fPTot[1]*fPTot[1] + fPTot[2]*fPTot[2]);}
+    Double_t          GetPt2() const {return (fPTot[0]*fPTot[0] + fPTot[1]*fPTot[1]);}
+    Double_t          GetP() const {return TMath::Sqrt(GetP2());}
+    Double_t          GetPx() const {return fPTot[0];}
+    Double_t          GetPy() const {return fPTot[1];}
+    Double_t          GetPz() const {return fPTot[2];}
+    Double_t          GetPt() const {return TMath::Sqrt(GetPt2());}
+
+    Double_t          GetP2MC() const {return (fPTotMC[0]*fPTotMC[0] + fPTotMC[1]*fPTotMC[1] + fPTotMC[2]*fPTotMC[2]);}
+    Double_t          GetPt2MC() const {return (fPTotMC[0]*fPTotMC[0] + fPTotMC[1]*fPTotMC[1]);}
+    Double_t          GetPMC() const {return TMath::Sqrt(GetP2MC());}
+    Double_t          GetPxMC() const {return fPTotMC[0];}
+    Double_t          GetPyMC() const {return fPTotMC[1];}
+    Double_t          GetPzMC() const {return fPTotMC[2];}
+    Double_t          GetPtMC() const {return TMath::Sqrt(GetPt2MC());}
+    
+    Double_t          GetAngle() const;
+
+    AliRsnDaughter*   GetDaughter(const Int_t &index) const {return fDaughter[index];}
+
+    Bool_t            IsLabelEqual() {return abs(fDaughter[0]->Label()) == abs(fDaughter[1]->Label());}
+    Bool_t            IsIndexEqual() {return (fDaughter[0]->Index() == fDaughter[1]->Index());}
+    Bool_t            IsTruePair(Int_t refPDG = 0);
+
+    void              SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2);
+    void              PrintInfo (const Option_t *option = "");
 
 private:
 
@@ -72,8 +68,6 @@ private:
     Double_t         fPTrack[2][3];     // rec. momentum of single tracks
     Double_t         fPTrackMC[2][3];   // MC momentum of single tracks
 
-    Double_t         fMass;             // mass hypothesis for resonance
-
     Int_t            fMotherLabel[2];   // GEANT label of tracks
     Int_t            fMotherPDG[2];     // PDG code of mother of tracks
 
diff --git a/PWG2/RESONANCES/AliRsnPairSimple.cxx b/PWG2/RESONANCES/AliRsnPairSimple.cxx
deleted file mode 100644 (file)
index 3cc5fae..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/**************************************************************************
- * 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 AliRsnPairSimple
-//-------------------------------------------------------------------------
-// This class computes the invariant mass spectrum of a specified pair of
-// particles, throughout a list of AliRsnEvents, and returns it as a TH1D.
-// This object is not supposed to be used directly: an AliRsnAnalysis
-// should be initialized in a macro and filled with one or more AliRsnPairSimple's
-// which are then processed with a given sample of events.
-//
-// author: A. Pulvirenti
-// email : alberto.pulvirenti@ct.infn.it
-//-------------------------------------------------------------------------
-
-#include <Riostream.h>
-
-#include <TH1.h>
-#include <TString.h>
-#include <TArrayI.h>
-#include <TClonesArray.h>
-
-#include "AliLog.h"
-#include "AliRsnMCInfo.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-#include "AliRsnCut.h"
-#include "AliRsnCutMgr.h"
-#include "AliRsnPairDef.h"
-#include "AliRsnPID.h"
-
-#include "AliRsnPairSimple.h"
-
-ClassImp(AliRsnPairSimple)
-
-//--------------------------------------------------------------------------------------------------------
-AliRsnPairSimple::AliRsnPairSimple(AliRsnPairDef *pd, const char *name, const char *title) :
-  TNamed(name, title),
-  fPIDMethod(AliRsnPID::kNone),
-  fForMixing(kFALSE),
-  fStoreOnlyTrue(kFALSE),
-  fCuts(0x0),
-  fPair(),
-  fPairDef(pd),
-  fHistogram(0x0),
-  fHistogramMC(0x0)
-{
-//
-// Constructor.
-// This constructor allows to define some of the initialization values:
-//  - name and title of the object
-//  - histogram binning and edges
-// The other parameters are initialized as in the default constructor.
-//
-}
-//--------------------------------------------------------------------------------------------------------
-AliRsnPairSimple::AliRsnPairSimple(const AliRsnPairSimple &copy) :
-  TNamed(copy),
-  fPIDMethod(copy.fPIDMethod),
-  fForMixing(copy.fForMixing),
-  fStoreOnlyTrue(copy.fStoreOnlyTrue),
-  fCuts(0x0),
-  fPair(),
-  fPairDef(copy.fPairDef),
-  fHistogram(0x0),
-  fHistogramMC(0x0)
-{
-//
-// Copy constructor.
-// Default behavior as a copy constructor for what concerns non-array data-members.
-// The arrays are cloned if they are not NULL.
-//
-}
-//--------------------------------------------------------------------------------------------------------
-const AliRsnPairSimple& AliRsnPairSimple::operator=(const AliRsnPairSimple &copy)
-{
-//
-// Assignment operator.
-// Default behavior like copy constructor.
-//
-    SetName(copy.GetName());
-    SetTitle(copy.GetTitle());
-
-    fHistogram = 0x0;
-    fHistogramMC = 0x0;
-    fPairDef = copy.fPairDef;
-
-    fPIDMethod = copy.fPIDMethod;
-    fForMixing = copy.fForMixing;
-    fStoreOnlyTrue = copy.fStoreOnlyTrue;
-    if (copy.fHistogram) fHistogram = (TH1D*)(copy.fHistogram->Clone());
-
-    fCuts = 0x0;
-
-    return (*this);
-}
-//--------------------------------------------------------------------------------------------------------
-void AliRsnPairSimple::Clear(Option_t* /*option*/)
-{
-//
-// Clear arrays and histogram.
-// For the sake of security, all pointers are also set explicitly to NULL.
-//
-    delete fHistogram;
-    fHistogram = 0x0;
-    delete fHistogramMC;
-    fHistogramMC = 0x0;
-}
-
-//--------------------------------------------------------------------------------------------------------
-void AliRsnPairSimple::InitHistograms()
-{
-//
-// Initialize histograms
-//
-
-    Int_t nbins = fPairDef->GetNBins();
-    Double_t min = fPairDef->GetMin(), max = fPairDef->GetMax();
-
-    if (strlen(GetName()) > 0) {
-        fHistogram = new TH1D(GetName(), GetTitle(), nbins, min, max);
-        fHistogramMC = new TH1D(Form("MC_%s", GetName()), Form("%s (MC)", GetTitle()), nbins, min, max);
-    }
-    else {
-        Char_t name[200], title[200];
-        strcpy(name, GetHistName());
-        strcpy(title, GetHistTitle());
-        fHistogram = new TH1D(name, title, nbins, min, max);
-        fHistogramMC = new TH1D(Form("MC_%s", name), Form("%s (MC)", title), nbins, min, max);
-    }
-    fHistogram->Sumw2();
-    fHistogramMC->Sumw2();
-}
-
-const char* AliRsnPairSimple::GetHistName ()
-{
-//
-// Creates the histogram name, given a cut manager
-//
-
-    TString strName("");
-    strName.Append(AliRsnPID::ParticleName(fPairDef->GetType(0)));
-    strName += '(';
-    strName += fPairDef->GetCharge(0);
-    strName += ')';
-    strName += '_';
-    strName.Append(AliRsnPID::ParticleName(fPairDef->GetType(1)));
-    strName += '(';
-    strName += fPairDef->GetCharge(1);
-    strName += ')';
-    strName += '_';
-    if (fCuts) {
-        strName.Append("cuts:");
-        strName.Append(fCuts->GetName());
-    }
-    else {
-        strName.Append("NoCuts");
-    }
-    if (fStoreOnlyTrue) strName.Append("_true");
-    if (fForMixing) strName.Append("_mix");
-
-    return strName.Data();
-}
-
-const char* AliRsnPairSimple::GetHistTitle()
-{
-//
-// Creates the histogram title, given a cut manager
-//
-
-    TString strName("Inv. mass of ");
-    strName.Append(AliRsnPID::ParticleName(fPairDef->GetType(0), kFALSE));
-    strName += 's';
-    strName += ' ';
-    strName += '(';
-    strName += fPairDef->GetCharge(0);
-    strName += ')';
-    strName.Append(" and ");
-    strName.Append(AliRsnPID::ParticleName(fPairDef->GetType(1), kFALSE));
-    strName += 's';
-    strName += ' ';
-    strName += '(';
-    strName += fPairDef->GetCharge(1);
-    strName += ')';
-    if (fCuts) {
-        strName.Append(" [cuts: ");
-        strName.Append(fCuts->GetTitle());
-        strName.Append("] ");
-    }
-    else {
-        strName.Append(" [No cuts] ");
-    }
-    if (fStoreOnlyTrue) strName.Append(" [true pairs]");
-    if (fForMixing) strName.Append(" [event mixing]");
-
-    return strName.Data();
-}
-
-//--------------------------------------------------------------------------------------------------------
-Stat_t AliRsnPairSimple::Process(AliRsnEvent *event1, AliRsnEvent *event2)
-{
-//
-// Scans the two events specified in argument to fill the histogram.
-// This method essentially calls the AliRsnPairSimple::Fill() method one or many times.
-// When the "noPID" argument is kFALSE, the analysis is done with identified particles
-// and this causes the Fill() method to be called only once, for the two lists of
-// identified particles of the two kinds specified in AliRsnPairSimple datamembers.
-// When the "noPID" argument is kTRUE, the analysis is done with all collections
-// of particles of the same sign as specified in the two arguments of the pair.
-// ---
-// Particles of type #1 are taken in 'event1', and particles of type #2 are taken in 'event2'.
-// When doing single-event analysis (for resonance signal or like-sign background),
-// the second argument can be simply skipped.
-// When doing event mixing, the two arguments must be not null and different.
-// If argument #1 is NULL, an error is raised, while if argument #2 is NULL, no error is raised,
-// and 'event2' argument is set equal to 'event1' (= single event processing).
-// ---
-// Return value is the total number of pairs processed.
-//
-
-    if (!event1) {
-        // argument #1 cannot be NULL
-        AliError("Argument #1 cannot be NULL.");
-        return 0.0;
-    }
-    if (!event2) {
-        // if argument #2 is NULL, it is put equal to argument #1
-        event2 = event1;
-    }
-    if (!fPairDef) {
-        AliError("No pairdef defined");
-        return 0.0;
-    }
-    if (!fHistogram) {
-        AliError("Histograms not initialized");
-        return 0.0;
-    }
-
-    // assign pointers to the list of indexes to be used
-    TArrayI *listCharged1 = 0x0, *listCharged2 = 0x0;
-    //if (pidMethod == AliRsnPID::kNone) {
-        listCharged1 = event1->GetCharged(fPairDef->GetCharge(0));
-        listCharged2 = event2->GetCharged(fPairDef->GetCharge(1));
-    //}
-    //else {
-        //listCharged1 = event1->GetTracksArray(pidMethod, fPairDef->GetCharge(0), fPairDef->GetType(0));
-        //listCharged2 = event2->GetTracksArray(pidMethod, fPairDef->GetCharge(1), fPairDef->GetType(1));
-    //}
-    if (!listCharged1 || !listCharged2) return 0.0;
-    TArrayI &list1 = *listCharged1;
-    TArrayI &list2 = *listCharged2;
-
-    Int_t   i1, i2, start2;
-    Stat_t  nPairs = 0;
-    AliRsnDaughter *track1 = 0x0, *track2 = 0x0;
-
-    // loop on particle of type 1 (in first event)
-    for (i1 = 0; i1 < list1.GetSize(); i1++) {
-        track1 = event1->GetTrack(list1[i1]);
-        //if (!track1) continue;
-        if (!fCuts->IsSelected(AliRsnCut::kParticle, track1)) continue;
-        // loop on particle of type 2 (in second event)
-        // in case we are building a like-sign histogram with particles
-        // of the same type in the same event, we must avoid that
-        // each pair is computed twice
-        start2 = 0;
-        if (listCharged1 == listCharged2) start2 = i1 + 1;
-        for (i2 = start2; i2 < list2.GetSize(); i2++) {
-            track2 = event2->GetTrack(list2[i2]);
-            //if (!track2) continue;
-            if (!fCuts->IsSelected(AliRsnCut::kParticle, track2)) continue;
-            nPairs += Process(track1, track2);
-        }
-    }
-
-    return nPairs;
-}
-
-//_____________________________________________________________________________
-Stat_t AliRsnPairSimple::Process
-(AliRsnDaughter *track1, AliRsnDaughter *track2)
-{
-//
-// Checks the single tracks and the pair against track cuts and,
-// if the cuts are passed, fill the histograms with a weight
-// given by the product of the appropriate PID probabilities of both.
-// The method returns a boolean success value for eventually counting.
-//
-
-    // setup pair and check pair cuts
-    fPair.SetPair(track1, track2);
-    if (!fCuts->IsSelected(AliRsnCut::kPair, &fPair)) return 0.0;
-
-    // if there is a request to process only the pairs born from a true resonance
-    // this is checked here
-    if (fStoreOnlyTrue && !fPair.IsTruePair(fPairDef->GetMotherPDG())) return 0.0;
-
-    // computation variables
-    Double_t mass1 = fPairDef->GetMass(0);
-    Double_t mass2 = fPairDef->GetMass(1);
-    Double_t invmass, invmassMC, weight;
-
-    // assign nominal masses to daughters
-    track1->SetM(mass1);
-    track2->SetM(mass2);
-
-    // if we are here, all cuts are passed - fill histograms
-    invmass = fPair.GetInvMass(mass1, mass2);
-    invmassMC = fPair.GetInvMassMC(mass1, mass2);
-    if (fPIDMethod == AliRsnPID::kNone) {
-        fHistogram->Fill(invmass);
-        fHistogramMC->Fill(invmassMC);
-        if (fPairDef->IsLikeSign() && !fPairDef->HasEqualTypes()) {
-            track1->SetM(mass1);
-            track2->SetM(mass2);
-            if (fCuts->IsSelected(AliRsnCut::kPair, &fPair)) {
-                invmass = fPair.GetInvMass(mass2, mass1);
-                invmassMC = fPair.GetInvMassMC(mass2, mass1);
-                fHistogram->Fill(invmass);
-                fHistogramMC->Fill(invmassMC);
-            }
-        }
-    }
-    else {
-        weight = fPairDef->ComputeWeight(track1, track2);
-        if (weight > 0.0) {
-            fHistogram->Fill(invmass, weight);
-            fHistogramMC->Fill(invmassMC, weight);
-        }
-        // if we are treating a like-sign pair with different types for track #1 and #2,
-        // we must also exchange the tracks and fill again the histogram
-        if (fPairDef->IsLikeSign() && !fPairDef->HasEqualTypes()) {
-            track1->SetM(mass1);
-            track2->SetM(mass2);
-            if (fCuts->IsSelected(AliRsnCut::kPair, &fPair)) {
-                weight = fPairDef->ComputeWeight(track2, track1);
-                invmass = fPair.GetInvMass(mass2, mass1);
-                invmassMC = fPair.GetInvMassMC(mass2, mass1);
-                if (weight > 0.0) {
-                    fHistogram->Fill(invmass, weight);
-                    fHistogramMC->Fill(invmassMC, weight);
-                }
-            }
-        }
-    }
-
-    return 1.0;
-}
diff --git a/PWG2/RESONANCES/AliRsnPairSimple.h b/PWG2/RESONANCES/AliRsnPairSimple.h
deleted file mode 100644 (file)
index 0dbf0e6..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//-------------------------------------------------------------------------
-//                      Class AliRsnAnalysis
-//             Reconstruction and analysis of K* Rsn
-// ........................................
-// ........................................
-// ........................................
-// ........................................
-//
-// author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-//-------------------------------------------------------------------------
-
-#ifndef AliRsnPairSimple_H
-#define AliRsnPairSimple_H
-
-#include <TNamed.h>
-#include "AliRsnPID.h"
-#include "AliRsnPairParticle.h"
-
-class TH1D;
-class AliRsnEvent;
-class AliRsnPairDef;
-class AliRsnCutMgr;
-class AliRsnPID;
-
-class AliRsnPairSimple : public TNamed
-{
-
-public:
-
-    AliRsnPairSimple(AliRsnPairDef *pd = 0x0, const char *name  = "", const char *title = "");
-    virtual ~AliRsnPairSimple() {Clear();}
-    virtual void Clear(Option_t *option = "");
-
-    // getters
-    TH1D*               GetHistogram() {return fHistogram;}
-    TH1D*               GetHistogramMC() {return fHistogramMC;}
-    AliRsnPairDef*      GetPairDef() {return fPairDef;}
-    AliRsnPairParticle* GetPair() {return &fPair;}
-    Bool_t              StoreOnlyTruePairs() const {return fStoreOnlyTrue;}
-    Bool_t              IsForMixing() const {return fForMixing;}
-
-    // setters
-    void   SetPIDMethod(AliRsnPID::EMethod method) {fPIDMethod = method;}
-    void   SetPairDef(AliRsnPairDef *def) {fPairDef = def;}
-    void   SetStoreOnlyTrue(Bool_t doit = kTRUE) {fStoreOnlyTrue = doit;}
-    void   SetForMixing(Bool_t doit = kTRUE) {fForMixing = doit;}
-    void   SetCutManager(AliRsnCutMgr *cutMgr) {fCuts = cutMgr;}
-
-    // working parameters
-    void   InitHistograms();
-    Stat_t Process(AliRsnEvent *event1, AliRsnEvent *event2 = 0);
-    Stat_t Process(AliRsnDaughter *t1, AliRsnDaughter *t2);
-
-private:
-
-    // private functions
-    AliRsnPairSimple(const AliRsnPairSimple &copy);
-    const AliRsnPairSimple& operator=(const AliRsnPairSimple &copy);
-    const char* GetHistName();
-    const char* GetHistTitle();
-
-    // flags
-    AliRsnPID::EMethod   fPIDMethod;       // flag to know PID method used
-    Bool_t               fForMixing;       // flag is true for objects created for event mixing
-    Bool_t               fStoreOnlyTrue;   // output = only spectra of true pairs
-
-    // cut manager
-    AliRsnCutMgr        *fCuts;            // cut manager for single particle
-
-    // objects
-    AliRsnPairParticle   fPair;            // utility class for pair
-    AliRsnPairDef       *fPairDef;         // definitions for pair
-    TH1D                *fHistogram;       // invariant mass distribution
-    TH1D                *fHistogramMC;     // invariant mass distribution (MC)
-
-    // ROOT dictionary
-    ClassDef(AliRsnPairSimple, 1)
-};
-
-#endif
index 8f9dcc80e612c5262a13d889bb84dabc0ed0dbd4..c3dddf6cd3e5ca32eab33c2dfeb01e7af96d76b7 100644 (file)
@@ -1,39 +1,24 @@
-/**************************************************************************
- * 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 AliRsnReader ========
+// Class AliRsnReader
 //
-// This object reads a 'standard' event and converts it into the internal
-// format used for resonance analysis (AliRsnEvent).
-// 'Standard' event means ESD, standard AOD and MC event.
+// This is the universal converter from any kind of source event
+// (i.e. ESD, standard AOD, MC) into the internal non-standard 
+// AOD format used by RSN package.
+// ---
+// This class reads all tracks in an input event and converts them
+// into AliRsnDaughters, and computes preliminarily the PID probabilities
+// by doing the Bayesian combination of a set of assigned prior probabilities
+// with the PID weights defined in each track.
+// ---
+// When filling the output event (AliRsnEvent), some arrays of indexes
+// are created in order to organize tracks according to their PID and charge,
+// which will then be used in further analysis steps.
 //
-// The input-2-AliRsnEvent conversion is done through a class which reads
-// from AliAnalysisTaskSE, which is the standard analysis object. 
-// This class creates the AliRsnEvent's before the input event is read, 
-// so this class has not to 'create' a new outpu event, but instead it has 
-// to 'fill' one which has already been created elsewhere.
-// Then, the methods provided here accept an AliRsnEvent as argument passed
-// by reference, and they 'fill' this object using the data from the inputs
-// passed to them.
-// 
-// author: A. Pulvirenti
-// email : alberto.pulvirenti@ct.infn.it
+// author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 
 #include <TString.h>
+#include <TDirectory.h>
 
 #include "AliLog.h"
 
@@ -62,7 +47,7 @@ ClassImp(AliRsnReader)
 
 //_____________________________________________________________________________
 AliRsnReader::AliRsnReader(ESource source, AliRsnPIDWeightsMgr *mgr) :
-  TObject(),
+  TNamed("RsnReader", ""),
   fSource(source),
   fCheckSplit(kFALSE),
   fRejectFakes(kFALSE),
@@ -70,36 +55,9 @@ AliRsnReader::AliRsnReader(ESource source, AliRsnPIDWeightsMgr *mgr) :
 {
 //
 // Constructor.
-// Initializes the base-type data members:
-//   - management of fake tracks
-//
-}
-
-//_____________________________________________________________________________
-AliRsnReader::AliRsnReader(const AliRsnReader &copy) : 
-  TObject(copy),
-  fSource(copy.fSource),
-  fCheckSplit(copy.fCheckSplit),
-  fRejectFakes(copy.fRejectFakes),
-  fWeightsMgr(copy.fWeightsMgr)
-{
-//
-// Copy constructor.
-//
-}
-
-//_____________________________________________________________________________
-AliRsnReader& AliRsnReader::operator=(const AliRsnReader &copy)
-{
+// Adds also this object to global directory.
 //
-// Assignment operator.
-//
-
-    fSource = copy.fSource;
-    fCheckSplit = copy.fCheckSplit;
-    fRejectFakes = copy.fRejectFakes;
-    fWeightsMgr = copy.fWeightsMgr;
-    return (*this);
+    gDirectory->Append(this, kTRUE);
 }
 
 //_____________________________________________________________________________
@@ -111,36 +69,46 @@ Bool_t AliRsnReader::Fill(AliRsnEvent *rsn, AliVEvent *event, AliMCEvent *mc)
 // passed by reference as first argument.
 //
 
+    Bool_t success = kFALSE;
     TString str(event->ClassName());
-
+    
     switch (fSource) {
         case kESD:
             if (!str.Contains("AliESDEvent")) {
-                AliError("A reader set to 'kESD' or 'kESDTPC' can read only ESD events");
+                AliError(Form("Source class mismatch [expected: 'AliESDEvent' -- passed: '%s'", str.Data()));
                 return kFALSE;
             }
-            return FillFromESD(rsn, (AliESDEvent*)event, mc);
+            success = FillFromESD(rsn, (AliESDEvent*)event, mc);
+            break;
         case kESDTPC:
             if (!str.Contains("AliESDEvent")) {
-                AliError("A reader set to 'kESD' or 'kESDTPC' can read only ESD events");
+                AliError(Form("Source class mismatch [expected: 'AliESDEvent' -- passed: '%s'", str.Data()));
                 return kFALSE;
             }
-            return FillFromESD(rsn, (AliESDEvent*)event, mc, kTRUE);
+            success = FillFromESD(rsn, (AliESDEvent*)event, mc, kTRUE);
+            break;
         case kAOD:
             if (!str.Contains("AliAODEvent")) {
-                AliError("A reader set to 'kAOD' can read only AOD events");
+                AliError(Form("Source class mismatch [expected: 'AliAODEvent' -- passed: '%s'", str.Data()));
                 return kFALSE;
             }
-            return FillFromAOD(rsn, (AliAODEvent*)event, mc);
+            success = FillFromAOD(rsn, (AliAODEvent*)event, mc);
+            break;
         case kMC:
             if (!str.Contains("AliMCEvent")) {
-                AliError("A reader set to 'kMC' can read only MC events");
+                AliError(Form("Source class mismatch [expected: 'AliMCEvent' -- passed: '%s'", str.Data()));
                 return kFALSE;
             }
-            return FillFromMC(rsn, (AliMCEvent*)event);
+            success = FillFromMC(rsn, (AliMCEvent*)event);
+            break;
         default:
             return kFALSE;
     }
+    
+    // sort tracks w.r. to Pt (from largest to smallest)
+    rsn->SortTracks();
+    
+    return success;
 }
 
 //_____________________________________________________________________________
@@ -157,20 +125,14 @@ Bool_t AliRsnReader::FillFromESD
 // When this is used, the 'source' flag of the output
 // AliRsnEvent object will be set to 'kESD'.
 //
-    
+
     // retrieve stack (if possible)
     AliStack *stack = 0x0;
     if (mc) stack = mc->Stack();
-    
+
     // get number of tracks
     Int_t ntracks = esd->GetNumberOfTracks();
-    /*
-    if (!ntracks) {
-       AliWarning("No tracks in this event");
-       return kFALSE;
-    }
-    */
-    
+
     // if required with the flag, scans the event
     // and searches all split tracks (= 2 tracks with the same label);
     // for each pair of split tracks, only the better (best chi2) is kept
@@ -199,7 +161,7 @@ Bool_t AliRsnReader::FillFromESD
             }
         }
     }
-    
+
     // get primary vertex
     Double_t vertex[3];
     if (!useTPCOnly) {
@@ -213,7 +175,7 @@ Bool_t AliRsnReader::FillFromESD
         vertex[2] = esd->GetPrimaryVertexTPC()->GetZv();
     }
     rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]);
-    
+
     // store tracks from ESD
     Int_t  i, index, label, labmum;
     Bool_t check;
@@ -251,7 +213,7 @@ Bool_t AliRsnReader::FillFromESD
         else {
             //AliInfo("Using standard ESD weights");
         }
-        
+
         // if stack is present, copy MC info
         if (stack) {
             TParticle *part = stack->Particle(TMath::Abs(label));
@@ -271,13 +233,13 @@ Bool_t AliRsnReader::FillFromESD
         // if problems occurred while storing, that pointer is NULL
         if (!ptr) AliWarning(Form("Failed storing track#%d", index));
     }
-    
+
     // compute total multiplicity
     if (rsn->GetMultiplicity() <= 0) {
         AliWarning("Zero Multiplicity in this event");
         return kFALSE;
     }
-    
+
     return kTRUE;
 }
 
@@ -294,25 +256,25 @@ Bool_t AliRsnReader::FillFromAOD(AliRsnEvent *rsn, AliAODEvent *aod, AliMCEvent
 // When this is used, the 'source' flag of the output
 // AliRsnEvent object will be set to 'kAOD'.
 //
-    
+
     // retrieve stack (if possible)
     AliStack *stack = 0x0;
     if (mc) stack = mc->Stack();
-    
+
     // get number of tracks
     Int_t ntracks = aod->GetNTracks();
     if (!ntracks) {
        AliWarning("No tracks in this event");
        return kFALSE;
     }
-    
+
     // get primary vertex
     Double_t vertex[3];
     vertex[0] = aod->GetPrimaryVertex()->GetX();
     vertex[1] = aod->GetPrimaryVertex()->GetY();
     vertex[2] = aod->GetPrimaryVertex()->GetZ();
     rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]);
-    
+
     // store tracks from ESD
     Int_t  index, label, labmum;
     Bool_t check;
@@ -347,13 +309,13 @@ Bool_t AliRsnReader::FillFromAOD(AliRsnEvent *rsn, AliAODEvent *aod, AliMCEvent
         // if problems occurred while storin, that pointer is NULL
         if (!ptr) AliWarning(Form("Failed storing track#%d"));
     }
-    
+
     // compute total multiplicity
     if (rsn->GetMultiplicity() <= 0) {
         AliWarning("Zero multiplicity in this event");
         return kFALSE;
     }
-    
+
     return kTRUE;
 }
 
@@ -369,16 +331,16 @@ Bool_t AliRsnReader::FillFromMC(AliRsnEvent *rsn, AliMCEvent *mc)
 // When this is used, the 'source' flag of the output
 // AliRsnEvent object will be set to 'kMC'.
 //
-    
+
     // get number of tracks
     Int_t ntracks = mc->GetNumberOfTracks();
     if (!ntracks) {
        AliWarning("No tracks in this event");
        return kFALSE;
     }
-    
+
     AliStack *stack = mc->Stack();
-    
+
     // get primary vertex
     TArrayF fvertex(3);
     Double_t vertex[3];
@@ -387,7 +349,7 @@ Bool_t AliRsnReader::FillFromMC(AliRsnEvent *rsn, AliMCEvent *mc)
     vertex[1] = (Double_t)fvertex[1];
     vertex[2] = (Double_t)fvertex[2];
     rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]);
-    
+
     // store tracks from MC
     Int_t  index, labmum;
     Bool_t check;
@@ -412,12 +374,12 @@ Bool_t AliRsnReader::FillFromMC(AliRsnEvent *rsn, AliMCEvent *mc)
         // if problems occurred while storin, that pointer is NULL
         if (!ptr) AliWarning(Form("Failed storing track#%d", index));
     }
-    
+
     // compute total multiplicity
     if (rsn->GetMultiplicity() <= 0) {
         AliWarning("Zero multiplicity in this event");
         return kFALSE;
     }
-    
+
     return kTRUE;
 }
index ab7d233615b7e70240722c6a5f9e21caea7ec734..96ce1b2517b3b25a33e817f134e8b24079564688 100644 (file)
@@ -1,31 +1,27 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
 //
-// ==== Class AliRsnReader ========
+// Class AliRsnReader
 //
-// This object reads a 'standard' event and converts it into the internal
-// format used for resonance analysis (AliRsnEvent).
-// 'Standard' event means ESD, standard AOD and MC event.
+// This is the universal converter from any kind of source event
+// (i.e. ESD, standard AOD, MC) into the internal non-standard 
+// AOD format used by RSN package.
+// ---
+// This class reads all tracks in an input event and converts them
+// into AliRsnDaughters, and computes preliminarily the PID probabilities
+// by doing the Bayesian combination of a set of assigned prior probabilities
+// with the PID weights defined in each track.
+// ---
+// When filling the output event (AliRsnEvent), some arrays of indexes
+// are created in order to organize tracks according to their PID and charge,
+// which will then be used in further analysis steps.
 //
-// The input-2-AliRsnEvent conversion is done through a class which reads
-// from AliAnalysisTaskSE, which is the standard analysis object. 
-// This class creates the AliRsnEvent's before the input event is read, 
-// so this class has not to 'create' a new outpu event, but instead it has 
-// to 'fill' one which has already been created elsewhere.
-// Then, the methods provided here accept an AliRsnEvent as argument passed
-// by reference, and they 'fill' this object using the data from the inputs
-// passed to them.
-// 
-// author: A. Pulvirenti
-// email : alberto.pulvirenti@ct.infn.it
+// author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 
 #ifndef ALIRSNREADER_H
 #define ALIRSNREADER_H
 
+#include <TNamed.h>
+
 class AliVEvent;
 class AliESDEvent;
 class AliAODEvent;
@@ -33,7 +29,7 @@ class AliMCEvent;
 class AliRsnEvent;
 class AliRsnPIDWeightsMgr;
 
-class AliRsnReader : public TObject
+class AliRsnReader : public TNamed
 {
 public:
 
@@ -46,18 +42,25 @@ public:
     };
 
     AliRsnReader(ESource source = kESD, AliRsnPIDWeightsMgr *mgr = 0x0);
-    AliRsnReader(const AliRsnReader& copy);
-    AliRsnReader& operator=(const AliRsnReader& copy);
     virtual ~AliRsnReader() {}
     
+    void    SetSource(ESource source) {fSource = source;}
     void    SetWeightsMgr(AliRsnPIDWeightsMgr *mgr) {fWeightsMgr = mgr;}
     void    SetCheckSplit(Bool_t doit = kTRUE) {fCheckSplit = doit;}
     void    SetRejectFakes(Bool_t doit = kTRUE) {fRejectFakes = doit;}
     
+    ESource GetSource() {return fSource;}
+    Bool_t  CheckSplit() {return fCheckSplit;}
+    Bool_t  RejectFakes() {return fRejectFakes;}
     Bool_t  Fill(AliRsnEvent *rsn, AliVEvent *event, AliMCEvent *refMC = 0);
     
 protected:
 
+    // dummy copy methods
+    AliRsnReader(const AliRsnReader &copy) : TNamed(copy),
+      fSource(kESD),fCheckSplit(0),fRejectFakes(0),fWeightsMgr(0x0) { /*nothing*/ }
+    AliRsnReader& operator=(const AliRsnReader&) {return (*this);}
+
     Bool_t  FillFromESD(AliRsnEvent *rsn, AliESDEvent *event, AliMCEvent *refMC = 0, Bool_t useTPCOnly = kFALSE);
     Bool_t  FillFromAOD(AliRsnEvent *rsn, AliAODEvent *event, AliMCEvent *refMC = 0);
     Bool_t  FillFromMC(AliRsnEvent *rsn, AliMCEvent *mc);
index a1b186ec132c0b7d3c9ecbec8542ebc23e66a4dc..64894270ae003a3be229d07783a736158f6bcfd5 100644 (file)
@@ -1,44 +1,29 @@
-/**************************************************************************
- * 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 AliRsnReaderTaskSE
-// ------------------------
-// Reader for conversion of ESD output into the internal format
-// used for resonance study.
+//
+// Class AliRsnReaderTaskSE
+//
+// An AnalysisTask object to convert any kind of source event type (ESD/AOD/MC)
+// into the RSN internal format (AliRsnEvent).
+// The output of this task is a TTree with converted events, which is saved in a file
+// and can then be processed as many times as desired, to build invariant mass spectra.
 // ---
-// original author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
-// ---
-// adapted for Analysis Framework
-// by    : R. Vernet                          (email: renaud.vernet@cern.ch)
-//----------------------------------------------------------------------------------
-
-#include <Riostream.h>
+// original author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// adapted for Analysis Framework by: R. Vernet (renaud.vernet@cern.ch)
+//
 
 #include "AliLog.h"
 
 #include "AliAnalysisManager.h"
-#include "AliMCEventHandler.h"
+
 #include "AliMCEvent.h"
+#include "AliMCEventHandler.h"
+
 #include "AliESDInputHandler.h"
 #include "AliAODInputHandler.h"
 #include "AliAODHandler.h"
 
+#include "AliRsnPID.h"
 #include "AliRsnEvent.h"
 #include "AliRsnReader.h"
-#include "AliRsnPID.h"
 #include "AliRsnReaderTaskSE.h"
 
 ClassImp(AliRsnReaderTaskSE)
@@ -50,9 +35,9 @@ AliRsnReaderTaskSE::AliRsnReaderTaskSE() :
   fPID(0x0),
   fRsnEvent(0x0)
 {
-//=========================================================
+//
 // Default constructor (not recommended)
-//=========================================================
+//
 }
 
 //_____________________________________________________________________________
@@ -62,61 +47,30 @@ AliRsnReaderTaskSE::AliRsnReaderTaskSE(const char *name) :
   fPID(0x0),
   fRsnEvent(0x0)
 {
-//=========================================================
+//
 // Working constructor (recommended)
-// Initializes the reader and PID objects.
-//=========================================================
-
-    fReader = new AliRsnReader;
-    fPID = new AliRsnPID;
-}
-
-//_____________________________________________________________________________
-AliRsnReaderTaskSE::AliRsnReaderTaskSE(const AliRsnReaderTaskSE& obj) :
-  AliAnalysisTaskSE(obj),
-  fReader(obj.fReader),
-  fPID(obj.fPID),
-  fRsnEvent(0x0)
-{
-//=========================================================
-// Copy constructor (not recommended)
-//=========================================================
-}
-
-//_____________________________________________________________________________
-AliRsnReaderTaskSE& AliRsnReaderTaskSE::operator=(const AliRsnReaderTaskSE& /*obj*/)
-{
-//=========================================================
-// Assignment operator (not recommended)
-//=========================================================
-
-    AliInfo("Not implemented. Avoid using the assignment operator");
-       return *this;
+//
 }
 
 //_____________________________________________________________________________
 void AliRsnReaderTaskSE::UserCreateOutputObjects()
 {
-//=========================================================
-// Create the output container
-//=========================================================
+//
+// Instantiates the output object (AliRsnEvent) and adds a branch
+// to the non-standard AOD output TTree to include it.
+// Checks that the necessary data member objects for
+// conversion and PID are allocated. If this is not the case,
+// raises a fatal error which breaks the AliRoot session.
+//
 
-    AliDebug(1, "Creating USER output objects");
-
-    // check for existence of reader, otherwise abort
     if (!fReader) {
         AliFatal("Event reader not initialized. Impossible to continue");
         return;
     }
     if (!fPID) {
-        AliFatal("PID manager not initialized. Impossible to continue");
+        AliFatal("PID not initialized. Impossible to continue");
         return;
     }
-    else {
-        // the PID object is always used in realistic mode here
-        // to fill the "realistic" index array in AliRsnEvent
-        fPID->SetMethod(AliRsnPID::kRealistic);
-    }
 
     fRsnEvent = new AliRsnEvent();
     fRsnEvent->SetName("rsnEvents");
@@ -127,39 +81,41 @@ void AliRsnReaderTaskSE::UserCreateOutputObjects()
 //_____________________________________________________________________________
 void AliRsnReaderTaskSE::Init()
 {
-//=========================================================
-// Initialization
-//=========================================================
-
-    AliDebug(1, "Initializing");
+//
+// Inherited function.
+// Here it does not need to do anything, so it is left dummy.
+//
 }
 
 //_____________________________________________________________________________
 void AliRsnReaderTaskSE::UserExec(Option_t */*option*/)
 {
-//=========================================================
-// Loops on input container to store data of all tracks.
-// Uses the AliRsnReader methods to save them in the output.
-//=========================================================
+//
+// Execution core of the class.
+// Uses the AliRsnReader and AliRsnPID methods to convert input data
+// and store them in the output AOD event, with all required computations.
+//
 
-    // static counter
     AliInfo(Form("Reading event %d", ++fEntry));
 
-    // clear previous sample
+    // before adding new data, the ones from previous event
+    // must be cleared explicitly
     fRsnEvent->Clear();
 
-    // read event, identify
+    // step 1: conversion
     if (!fReader->Fill(fRsnEvent, fInputEvent, fMCEvent)) AliWarning("Failed reading");
-    if (!fPID->Identify(fRsnEvent)) AliWarning("Failed PID");
+
+    // step 2: PID probability computation
+    if (!fPID->Process(fRsnEvent)) AliWarning("Failed PID");
+
     AliInfo(Form("Collected %d tracks", fRsnEvent->GetMultiplicity()));
 }
 
 //_____________________________________________________________________________
 void AliRsnReaderTaskSE::Terminate(Option_t */*option*/)
 {
-//=========================================================
-// Terminate analysis
-//=========================================================
-
-    AliDebug(1, "Terminating");
+//
+// Inherited function.
+// Here it does not need to do anything, so it is left dummy.
+//
 }
index 3821fe160cae324d8ca4690c546a8e46f2d169ba..9f55418ce9718ac082e654b9fe7cbf8120e92f29 100644 (file)
@@ -1,29 +1,22 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               *
- **************************************************************************/
-
-//----------------------------------------------------------------------------------
-//  Class AliRsnReaderTaskSE
-// ------------------------
-// Reader for conversion of ESD output into the internal format
-// used for resonance study.
-// ---
-// original author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
+//
+// Class AliRsnReaderTaskSE
+//
+// An AnalysisTask object to convert any kind of source event type (ESD/AOD/MC)
+// into the RSN internal format (AliRsnEvent).
+// The output of this task is a TTree with converted events, which is saved in a file
+// and can then be processed as many times as desired, to build invariant mass spectra.
 // ---
-// adapted for Analysis Framework
-// by    : R. Vernet                          (email: renaud.vernet@cern.ch)
-//----------------------------------------------------------------------------------
+// original author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// adapted for Analysis Framework by: R. Vernet (renaud.vernet@cern.ch)
+//
 
 #ifndef AliRsnReaderTaskSE_H
 #define AliRsnReaderTaskSE_H
 
 #include "AliAnalysisTaskSE.h"
-//#include "AliRsnReader.h"
-//#include "AliRsnPID.h"
 
-class AliESDEvent;
 class AliRsnPID;
+class AliESDEvent;
 class AliRsnReader;
 
 class AliRsnReaderTaskSE : public AliAnalysisTaskSE
@@ -31,8 +24,8 @@ class AliRsnReaderTaskSE : public AliAnalysisTaskSE
 public:
 
     AliRsnReaderTaskSE();
-       AliRsnReaderTaskSE(const char *name);
-       virtual ~AliRsnReaderTaskSE() {Clear();}
+    AliRsnReaderTaskSE(const char *name);
+    virtual ~AliRsnReaderTaskSE() {Clear();}
 
     // Implementation of interface methods
     virtual void UserCreateOutputObjects();
@@ -41,24 +34,24 @@ public:
     virtual void UserExec(Option_t *option);
     virtual void Terminate(Option_t *option);
 
-       // setters
-       void SetReader(AliRsnReader *reader) {fReader = reader;}
-       void SetPID(AliRsnPID *pid) {fPID = pid;}
-
-       // getters
-       AliRsnReader* GetReader() {return fReader;}
-       AliRsnPID*    GetPID() {return fPID;}
+    void          SetReader(AliRsnReader *reader) {fReader = reader;}
+    void          SetPID(AliRsnPID *pid) {fPID = pid;}
+    AliRsnReader* GetReader() {return fReader;}
+    AliRsnPID*    GetPID() {return fPID;}
+    AliRsnEvent*  GetCurrentEvent() {return fRsnEvent;}
 
 private:
 
-    AliRsnReaderTaskSE(const AliRsnReaderTaskSE&);
-       AliRsnReaderTaskSE& operator=(const AliRsnReaderTaskSE&);
+    AliRsnReaderTaskSE(const AliRsnReaderTaskSE &copy) :
+      AliAnalysisTaskSE(copy),fReader(0x0),fPID(0x0),fRsnEvent(0x0) { /*nothing*/ }
+    AliRsnReaderTaskSE& operator=(const AliRsnReaderTaskSE&)
+      { /*nothing*/ return (*this); }
 
-       AliRsnReader *fReader;     // read manager
-       AliRsnPID    *fPID;        // particle identification manager
-       AliRsnEvent  *fRsnEvent;   // output events in the AliRsnEvent format
+    AliRsnReader *fReader;     // read manager
+    AliRsnPID    *fPID;        // PID manager
+    AliRsnEvent  *fRsnEvent;   // output events in the AliRsnEvent format
 
-       ClassDef(AliRsnReaderTaskSE, 0); // implementation of RsnReader as AnalysisTaskSE
+    ClassDef(AliRsnReaderTaskSE, 1); // implementation of RsnReader as AnalysisTaskSE
 };
 
 #endif