+++ /dev/null
-/**************************************************************************
- * 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 AliRsnManager
-//-------------------------------------------------------------------------
-// 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 "AliRsnEvent.h"
-#include "AliRsnPair.h"
-#include "AliRsnManager.h"
-
-ClassImp(AliRsnManager)
-
-//_____________________________________________________________________________
-AliRsnManager::AliRsnManager() :
- TObject(),
- fUsePID(kTRUE),
- fStep(100),
- fMixEvents(10),
- fMixMultCut(10),
- fMixVzCut(0.5),
- fQueuePos(-1),
- fPairs(0x0),
- fMixPairs(0x0),
- fBuffer(0x0),
- fOutputList(0x0)
-
-{
-//
-// Constructor
-//
-}
-
-//_____________________________________________________________________________
-void AliRsnManager::Clear(Option_t* /*option*/)
-{
-//
-// Clear heap
-//
-
- if (fPairs) {
- fPairs->Delete();
- delete fPairs;
- }
- if (fMixPairs) {
- fMixPairs->Delete();
- delete fMixPairs;
- }
- if (fBuffer) delete fBuffer;
- if (fOutputList) {
- fOutputList->Delete();
- delete fOutputList;
- }
-}
-
-//_____________________________________________________________________________
-void AliRsnManager::SetQueueSize(Int_t size)
-{
- if (fBuffer) {
- fBuffer->Delete();
- delete fBuffer;
- }
- fBuffer = new TObjArray(size);
- fBuffer->SetOwner();
- fQueuePos = -1;
-}
-
-//_____________________________________________________________________________
-void AliRsnManager::AddPair(AliRsnPair *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);
-
- if (!fOutputList) fOutputList = new TList;
-
- fOutputList->Add(pair->GetHistogram());
-}
-
-//_____________________________________________________________________________
-Stat_t AliRsnManager::Process(AliRsnEvent *event)
-{
-//
-// For each AliRsnPair definition, fills its histogram
-// taking particles from the passed event.
-//
- Stat_t nPairs = 0;
- if (!event) return nPairs;
-
- // check pair list
- if (!fPairs) {
- AliError("Uninitialized array");
- return 0.0;
- }
- if (fPairs->IsEmpty()) {
- AliError("No pairs defined");
- return 0.0;
- }
- if (!fBuffer) {
- AliError("Buffer uninitialized");
- return 0.0;
- }
-
- // create an iterator which run over all pairs
- TObjArrayIter pairIterator(fPairs);
- AliRsnPair *pair = 0;
- while ( (pair = (AliRsnPair*)pairIterator.Next()) ) {
- nPairs += pair->Process(event, event);
- }
-
- // if there are mix pairs, do event mixing
- if (fMixPairs) Mix(event);
-
- // add this event to the queue
- fQueuePos++;
- if (fQueuePos >= fBuffer->GetSize()) fQueuePos = 0;
- AliRsnEvent *prev = (AliRsnEvent*) fBuffer->At(fQueuePos);
- if (prev) fBuffer->RemoveAt(fQueuePos);
- fBuffer->AddAt(event, fQueuePos);
-
- return nPairs;
-}
-
-
-//_____________________________________________________________________________
-Stat_t AliRsnManager::Mix(AliRsnEvent *event)
-{
-//
-// Performs event mixing.
-// It takes the array of fMixPairDefs and stores results in fMixHistograms.
-// First parameter defines how many events must be mixed with each one.
-// Events to be mixed are chosen using the other parameters:
-//
-// - multDiffMax defines the maximum allowed difference in particle multiplicity,
-// a) when last argument is kFALSE (default) the multiplicity comparison is made with respect
-// to the particles of 'type 2' in the pair
-// b) when last argument is kTRUE, the multiplicity comparison is made with respect of total
-// particle multiplicity in the events
-//
-// - vzDiffMax defines maximum allowed difference in Z coordinate of prim. vertex.
-//
-// If one wants to exchange the particle types, one has to add both combinations of particles
-// as different pair defs.
-//
- Stat_t nPairs = 0;
-
- if (!fBuffer) {
- AliError("Uninitialized queue");
- return 0.0;
- }
-
- // iterator for pairs
- TObjArrayIter pairIterator(fMixPairs);
- AliRsnPair *pair = 0;
-
- // iterator for events
- TObjArrayIter eventIterator(fBuffer);
- AliRsnEvent *mixed = 0;
-
- // loop on array and mix with passed event
- while ( (mixed = (AliRsnEvent*)eventIterator.Next()) ) {
- if (!CanBeMixed(event, mixed)) continue;
- pairIterator.Reset();
- while ( (pair = (AliRsnPair*)pairIterator.Next()) ) {
- nPairs += pair->Process(event, mixed);
- }
- }
-
- return nPairs;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnManager::CanBeMixed(AliRsnEvent *ev1, AliRsnEvent *ev2)
-{
-//
-// Checks if two events are within the mixing cuts
-//
-
- Int_t diffMult = TMath::Abs(ev1->GetMultiplicity() - ev2->GetMultiplicity());
- Bool_t diffVz = TMath::Abs(ev1->GetPrimaryVertexZ() - ev2->GetPrimaryVertexZ());
- if (diffMult <= fMixMultCut && diffVz <= fMixVzCut) {
- return kTRUE;
- }
- else {
- return kFALSE;
- }
-}
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice *
- **************************************************************************/
-
-//-------------------------------------------------------------------------
-// Class AliRsnManager
-// Reconstruction and analysis of K* Rsn
-// ........................................
-// ........................................
-// ........................................
-// ........................................
-//
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-//-------------------------------------------------------------------------
-
-#ifndef AliRsnManager_H
-#define AliRsnManager_H
-
-#include "AliRsnPID.h"
-
-class TList;
-class TObjArray;
-class AliRsnPair;
-
-class AliRsnManager : public TObject
-{
-public:
-
- AliRsnManager();
- virtual ~AliRsnManager() {Clear();}
- virtual void Clear(Option_t *option = "");
-
- /* setters */
- void SetEventsTree(TTree *tree){;}
- void SetStep(Int_t step) {fStep = step;}
- void SetMixEvents(Int_t num) {fMixEvents = num;}
- void SetMixMultiplicityCut(Int_t cut) {fMixMultCut = cut;}
- void SetMixVzCut(Double_t cut) {fMixVzCut = cut;}
- void SetQueueSize(Int_t size);
- void SetUsePID(Bool_t doit) {fUsePID = doit;}
-
- /* working routines */
- void AddPair(AliRsnPair *pair);
- Stat_t Process(AliRsnEvent *event);
- Stat_t Mix(AliRsnEvent *event);
- Bool_t CanBeMixed(AliRsnEvent *ev1, AliRsnEvent *ev2);
- TList* GetOutputList() {return fOutputList;}
-
-private:
-
- AliRsnManager(const AliRsnManager ©) :
- TObject(copy),fUsePID(kTRUE),fStep(100),
- fMixEvents(10),fMixMultCut(10),fMixVzCut(0.5),fQueuePos(-1),
- fPairs(0x0),fMixPairs(0x0),fBuffer(0x0),fOutputList(0x0) { }
- AliRsnManager& operator=(const AliRsnManager & /*copy*/) { return (*this); }
-
- Bool_t fUsePID; // flag to switch between PID/noPID analysis
- Int_t fStep; // step for progress message
- Int_t fMixEvents; // number of events to be mixed (maximum)
- Int_t fMixMultCut; // multiplicity cut for event mixing
- Double_t fMixVzCut; // difference in VZ cut for event mixing
- Int_t fQueuePos; // position in queue for event adding
-
- 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
- TObjArray *fBuffer; //! buffer for events to mix
- TList *fOutputList; //! list of output histograms
-
- // Rsn analysis implementation
- ClassDef(AliRsnManager,1)
-};
-
-#endif
+++ /dev/null
-/**************************************************************************
- * 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 AliRsnSelectorRL
-// ------------------------
-// Reader for conversion of ESD output into the internal format
-// used for resonance study.
-// ---
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-// ---
-// adapted for TSelector compliance
-// by : R. Vernet (email: renaud.vernet@cern.ch)
-//-------------------------------------------------------------------------
-
-#include <Riostream.h>
-
-#include <TFile.h>
-#include <TChain.h>
-#include <TParticle.h>
-#include <TRandom.h>
-#include <TObjString.h>
-#include <TObjectTable.h>
-#include <TOrdCollection.h>
-#include "AliRun.h"
-#include "AliESD.h"
-#include "AliESDEvent.h"
-#include "AliStack.h"
-#include "AliHeader.h"
-#include "AliESDtrack.h"
-#include "AliRunLoader.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-#include "AliRsnSelectorRL.h"
-
-ClassImp(AliRsnSelectorRL)
-
-//--------------------------------------------------------------------------------------------------------
-AliRsnSelectorRL::AliRsnSelectorRL(TTree*) :
- AliSelectorRL(),
- AliRsnReader(),
- fOutputPath(0),
- fIsRunLoaderOpen(0),
- fRsnEventTree(0),
- fRsnEvent(0),
- fRsnEventBranch(0)
-{
-//
-// Constructor.
-// Initializes all working parameters to default values:
-// - ESD particle identification
-// - rejection of non-ITS-refitted tracks
-// - maximum distance allowed from primary vertex = 3.0 cm (beam pipe)
-//
-}
-
-AliRsnSelectorRL::~AliRsnSelectorRL() {
- Clear();
-}
-
-//--------------------------------------------------------------------------------------------------------
-AliRsnSelectorRL::AliRsnSelectorRL(const AliRsnSelectorRL& obj) :
- AliSelectorRL(), // not implemented a copy constructor for AliRsnSelectorRL
- AliRsnReader(obj),
- fOutputPath(obj.fOutputPath),
- fIsRunLoaderOpen(obj.fIsRunLoaderOpen),
- fRsnEventTree(obj.fRsnEventTree),
- fRsnEvent(obj.fRsnEvent),
- fRsnEventBranch(obj.fRsnEventBranch)
-{
-//
-// Copy constructor
-//
-}
-//--------------------------------------------------------------------------------------------------------
-AliRsnSelectorRL& AliRsnSelectorRL::operator=(const AliRsnSelectorRL& obj)
-{
-//
-// Assignment operator
-// works in the same way as the copy constructor
-//
- if (this!=&obj) {
- fOutputPath = obj.fOutputPath;
- fIsRunLoaderOpen = obj.fIsRunLoaderOpen;
- fRsnEventTree = obj.fRsnEventTree;
- fRsnEvent = obj.fRsnEvent;
- fRsnEventBranch = obj.fRsnEventBranch;
- }
-
- return *this;
-}
-//--------------------------------------------------------------------------------------------------------
-void AliRsnSelectorRL::Clear(Option_t * /*option*/)
-{
- //
- // Does nothing.
- //
-}
-//--------------------------------------------------------------------------------------------------------
-
-//--------------------------------------------------------
-// The following is Selector stuff
-//--------------------------------------------------------
-
-//--------------------------------------------------------------------------------------------------------
-void AliRsnSelectorRL::Begin(TTree *) const
-{
-//
-// Implementation of BEGIN method
-//
- Info("Begin", "");
- TString option = GetOption();
-}
-//--------------------------------------------------------------------------------------------------------
-void AliRsnSelectorRL::SlaveBegin(TTree * tree)
-{
-//
-// Implementation of secondary BEGIN which
-// is called by separate process managers
-//
- Info("SlaveBegin", "");
- Init(tree);
- TString option = GetOption();
-}
-//--------------------------------------------------------------------------------------------------------
-void AliRsnSelectorRL::Init(TTree *tree)
-{
-//
-// Initializer
-// Connects the selector to a TTree and links the branch
-// which is used to make translation ESD --> Rsn
-//
- Info("Init","");
-
- if (!tree) return;
- fTree = tree;
- if (fDebugFlag) {
- Info("Init", "fTree=%p fTree->GetCurrentFile()=%p", fTree, fTree->GetCurrentFile());
- }
- fTree->SetBranchAddress("ESD", &fESD);
- fRsnEventTree = new TTree("selection", "AliRsnEvents");
- TTree::SetBranchStyle(1);
- fRsnEvent = new AliRsnEvent;
- fRsnEventBranch = fRsnEventTree->Branch("RsnEvents", "AliRsnEvent", &fRsnEvent, 32000, 1);
- fRsnEventBranch->SetAutoDelete(kFALSE);
-}
-//--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnSelectorRL::Process(Long64_t entry)
-{
-//
-// Main core of the Selector processing
-// Reads the ESD input and creates a TTree or AliRsnEvent objects
-//
- if (fDebugFlag) Info("Process", "Processing event %d", entry);
- if (!AliSelectorRL::Process(entry)) return kFALSE;
-
- AliStack* stack = GetStack();
- if (!stack) {
- Warning("Process", "NULL stack: cannot get kinematics info");
- }
-
- /*
- AliESDEvent *esdEvent = new AliESDEvent(fESD);
- AliRsnEvent *event = ReadESDEvent(esdEvent);
- AddMCInfo(event, stack);
- AddEvent(fRsnTree, event);
- */
- return kTRUE;
-}
-//--------------------------------------------------------------------------------------------------------
-void AliRsnSelectorRL::SlaveTerminate()
-{
-//
-// SlaveTerminate
-// Partial termination method
-//
-// test have been performed only on AliEn, please contact the author in case of merging problem under CAF/PROOF.
-//
-//
- Info("SlaveTerminate", "");
-
- // Add the histograms to the output on each slave server
- fOutput->Add(fRsnEventTree);
-}
-//--------------------------------------------------------------------------------------------------------
-void AliRsnSelectorRL::Terminate()
-{
-//
-// Global termination method
-//
- Info("Terminate","");
- // fRsnEventTree = dynamic_cast<TTree*>(fOutput->FindObject("fRsnEventTree"));
-
- //AliSelector::Terminate();
- cout << fOutputPath << endl;
- Info("Terminate", Form("Saving in: %s", fOutputPath->Data()));
- TFile* file = TFile::Open(fOutputPath->Data(), "RECREATE");
- fRsnEventTree->Write();
- file->Close();
-
- delete fRsnEventTree;
- delete file;
- delete fOutputPath;
-}
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice *
- **************************************************************************/
-
-//-------------------------------------------------------------------------
-// Class AliRsnSelectorRL
-// ------------------------
-// Reader for conversion of ESD output into the internal format
-// used for resonance study.
-// ---
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-// ---
-// adapted for TSelector compliance
-// by : R. Vernet (email: renaud.vernet@cern.ch)
-//-------------------------------------------------------------------------
-
-#ifndef ALIRSNSELECTORRL_H
-#define ALIRSNSELECTORRL_H
-
-#include "AliPID.h"
-#include "AliSelectorRL.h"
-#include "AliRsnReader.h"
-
-class TH3D;
-class TH1D;
-class TOrdCollection;
-class TTree;
-class TBranch;
-class AliRunLoader;
-
-class AliRsnSelectorRL : public AliSelectorRL, public AliRsnReader
-{
-public:
-
- AliRsnSelectorRL(TTree *tree = 0);
- AliRsnSelectorRL(const AliRsnSelectorRL& obj);
- virtual ~AliRsnSelectorRL();
- AliRsnSelectorRL& operator=(const AliRsnSelectorRL& obj);
-
- // TSelector-inherited member functions
- virtual Int_t Version() const {return 1;}
- virtual void Begin(TTree *tree) const;
- virtual void SlaveBegin(TTree *tree);
- virtual void Init(TTree *tree);
- virtual Bool_t Process(Long64_t entry);
- virtual void SetOption(const char *option) {fOption = option;}
- virtual void SetObject(TObject *obj) {fObject = obj;}
- virtual void SetInputList(TList *input) {fInput = input;}
- virtual TList *GetOutputList() const {return fOutput;}
- virtual void SlaveTerminate() ;
- virtual void Terminate();
-
- // Other
- void Clear(const Option_t *option = "");
-
-protected:
-
- // Parameters/flags
- TString* fOutputPath; //! path where output tree will be stored
-
- // Workaround for AliSelectorRL:
- Bool_t fIsRunLoaderOpen; // flag to check if run loader is open
-
- // IO tree
- TTree* fRsnEventTree; // output tree which should contain AliRsnEvents
- AliRsnEvent* fRsnEvent; // pointer on AliRsnEvent to store
- TBranch* fRsnEventBranch; // tree branch to store AliRsnEvents in
-
- // Rsn event reader implementation
- ClassDef(AliRsnSelectorRL,1)
-};
-
-#endif
-