From 6bc03c45442d728d27b89c0411f2b34f74b2659d Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 7 Aug 2007 20:28:06 +0000 Subject: [PATCH] Virual base classes for AOD and ESD, organized in libSTEERBase (Markus) --- STEER/AliVEvent.cxx | 38 ++++++++ STEER/AliVEvent.h | 145 +++++++++++++++++++++++++++++ STEER/AliVEventHandler.cxx | 44 +++++++++ STEER/AliVEventHandler.h | 34 +++++++ STEER/AliVHeader.cxx | 43 +++++++++ STEER/AliVHeader.h | 44 +++++++++ STEER/AliVParticle.cxx | 36 +++++++ STEER/AliVParticle.h | 51 ++++++++++ STEER/PROOF-INF.STEERBase/BUILD.sh | 3 + STEER/PROOF-INF.STEERBase/SETUP.C | 12 +++ STEER/STEERBaseLinkDef.h | 16 ++++ STEER/libSTEERBase.pkg | 10 ++ 12 files changed, 476 insertions(+) create mode 100644 STEER/AliVEvent.cxx create mode 100644 STEER/AliVEvent.h create mode 100644 STEER/AliVEventHandler.cxx create mode 100644 STEER/AliVEventHandler.h create mode 100644 STEER/AliVHeader.cxx create mode 100644 STEER/AliVHeader.h create mode 100644 STEER/AliVParticle.cxx create mode 100644 STEER/AliVParticle.h create mode 100755 STEER/PROOF-INF.STEERBase/BUILD.sh create mode 100644 STEER/PROOF-INF.STEERBase/SETUP.C create mode 100644 STEER/STEERBaseLinkDef.h create mode 100644 STEER/libSTEERBase.pkg diff --git a/STEER/AliVEvent.cxx b/STEER/AliVEvent.cxx new file mode 100644 index 00000000000..d9b85238139 --- /dev/null +++ b/STEER/AliVEvent.cxx @@ -0,0 +1,38 @@ +/************************************************************************** + * Copyright(c) 1998-2007, 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. * + **************************************************************************/ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// base class for ESD and AOD events +// Author: Markus Oldenburg, CERN +//------------------------------------------------------------------------- + +#include "AliVEvent.h" + + +AliVEvent::AliVEvent(const AliVEvent& vEvnt) : + TObject(vEvnt) { } // Copy constructor + +AliVEvent& AliVEvent::operator=(const AliVEvent& vEvnt) +{ if (this!=&vEvnt) { + TObject::operator=(vEvnt); + } + + return *this; +} + + +ClassImp(AliVEvent) diff --git a/STEER/AliVEvent.h b/STEER/AliVEvent.h new file mode 100644 index 00000000000..860b06c5c3f --- /dev/null +++ b/STEER/AliVEvent.h @@ -0,0 +1,145 @@ +// -*- mode: C++ -*- +#ifndef ALIVEVENT_H +#define ALIVEVENT_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +/* $Id$ */ + +//------------------------------------------------------------------------- +// Class AliVEvent +// +// Origin: Markus Oldenburg, CERN, Markus.Oldenburg@cern.ch +//------------------------------------------------------------------------- + +#include +#include +#include "AliVHeader.h" +#include "AliVParticle.h" + +class AliVEvent : public TObject { + +public: + + AliVEvent() { } + virtual ~AliVEvent() { } + AliVEvent(const AliVEvent& vEvnt); + AliVEvent& operator=(const AliVEvent& vEvnt); + + // Services + virtual void AddObject(TObject* obj) = 0; + virtual TObject* FindListObject(const char *name) = 0; + virtual TList* GetList() const = 0; + + virtual void CreateStdContent() = 0; + virtual void GetStdContent() = 0; + + virtual void ReadFromTree(TTree *tree) = 0; + virtual const void WriteToTree(TTree* tree) const = 0; + + //virtual void Reset() = 0; + //virtual void ResetStdContent() = 0; + virtual void SetStdNames() = 0; + + virtual void Print(Option_t *option="") const = 0; + + // Header + virtual AliVHeader* GetHeader() const = 0; + + // Delegated methods for fESDRun or AODHeader + + virtual void SetRunNumber(Int_t n) = 0; + virtual void SetPeriodNumber(UInt_t n) = 0; + virtual void SetMagneticField(Double_t mf) = 0; + + virtual Int_t GetRunNumber() const = 0; + virtual UInt_t GetPeriodNumber() const = 0; + virtual Double_t GetMagneticField() const = 0; + + // Delegated methods for fHeader + virtual void SetOrbitNumber(UInt_t n) = 0; + virtual void SetBunchCrossNumber(UShort_t n) = 0; + virtual void SetEventType(UInt_t eventType)= 0; + virtual void SetTriggerMask(ULong64_t n) = 0; + virtual void SetTriggerCluster(UChar_t n) = 0; + + virtual UInt_t GetOrbitNumber() const = 0; + virtual UShort_t GetBunchCrossNumber() const = 0; + virtual UInt_t GetEventType() const = 0; + virtual ULong64_t GetTriggerMask() const = 0; + virtual UChar_t GetTriggerCluster() const = 0; + + virtual Double_t GetZDCN1Energy() const = 0; + virtual Double_t GetZDCP1Energy() const = 0; + virtual Double_t GetZDCN2Energy() const = 0; + virtual Double_t GetZDCP2Energy() const = 0; + virtual Double_t GetZDCEMEnergy() const = 0; + + // Tracks + virtual AliVParticle *GetTrack(Int_t i) const = 0; + //virtual Int_t AddTrack(const AliVParticle *t) = 0; + virtual Int_t GetNumberOfTracks() const = 0; + + //---------- end of new stuff + + + /* to be considered to go in here be implemented + + void SetPrimaryVertex(const AliESDVertex *vertex) { + *fPrimaryVertex = *vertex; + fPrimaryVertex->SetName("PrimaryVertex");// error prone use class wide names? + } + const AliESDVertex *GetPrimaryVertex() const {return fPrimaryVertex;} + + void SetMultiplicity(const AliMultiplicity *mul) { + *fSPDMult = *mul; + // CKB + // new (&fSPDMult) AliMultiplicity(*mul); + } + const AliMultiplicity *GetMultiplicity() const {return fSPDMult;} + + + AliESDMuonTrack *GetMuonTrack(Int_t i) const { + return (AliESDMuonTrack *)fMuonTracks->UncheckedAt(i); + } + void AddMuonTrack(const AliESDMuonTrack *t) { + TClonesArray &fmu = *fMuonTracks; + new(fmu[fMuonTracks->GetEntriesFast()]) AliESDMuonTrack(*t); + } + + AliESDv0 *GetV0(Int_t i) const { + return (AliESDv0*)fV0s->UncheckedAt(i); + } + Int_t AddV0(const AliESDv0 *v); + + AliESDcascade *GetCascade(Int_t i) const { + return (AliESDcascade *)fCascades->UncheckedAt(i); + } + void AddCascade(const AliESDcascade *c) { + TClonesArray &fc = *fCascades; + new(fc[fCascades->GetEntriesFast()]) AliESDcascade(*c); + } + + AliESDkink *GetKink(Int_t i) const { + return (AliESDkink *)fKinks->UncheckedAt(i); + } + Int_t AddKink(const AliESDkink *c); + + AliESDCaloCluster *GetCaloCluster(Int_t i) const { + return (AliESDCaloCluster *)fCaloClusters->UncheckedAt(i); + } + Int_t AddCaloCluster(const AliESDCaloCluster *c); + + Int_t GetNumberOfMuonTracks() const {return fMuonTracks->GetEntriesFast();} + Int_t GetNumberOfV0s() const {return fV0s->GetEntriesFast();} + Int_t GetNumberOfCascades() const {return fCascades->GetEntriesFast();} + Int_t GetNumberOfKinks() const {return fKinks->GetEntriesFast();} + Int_t GetNumberOfCaloClusters() const {return fCaloClusters->GetEntriesFast();} + + */ + + ClassDef(AliVEvent,0) // base class for AliEvent data +}; +#endif + diff --git a/STEER/AliVEventHandler.cxx b/STEER/AliVEventHandler.cxx new file mode 100644 index 00000000000..03e2a3a46bb --- /dev/null +++ b/STEER/AliVEventHandler.cxx @@ -0,0 +1,44 @@ +/************************************************************************** + * Copyright(c) 1998-2007, 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. * + **************************************************************************/ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// Event IO handler base class +// Author: Andreas Morsch, CERN +//------------------------------------------------------------------------- + +#include "AliVEventHandler.h" + +ClassImp(AliVEventHandler) + +//______________________________________________________________________________ +AliVEventHandler::AliVEventHandler() : + TNamed() +{ + // default constructor +} + +//______________________________________________________________________________ +AliVEventHandler::~AliVEventHandler() +{ +// destructor +} + +//______________________________________________________________________________ +AliVEventHandler::AliVEventHandler(const char* name, const char* title): + TNamed(name, title) +{ +} diff --git a/STEER/AliVEventHandler.h b/STEER/AliVEventHandler.h new file mode 100644 index 00000000000..963ed67097d --- /dev/null +++ b/STEER/AliVEventHandler.h @@ -0,0 +1,34 @@ +#ifndef ALIVEVENTHANDLER_H +#define ALIVEVENTHANDLER_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// Event Handler base class +// Author: Andreas Morsch, CERN +//------------------------------------------------------------------------- + +#include + + +class AliVEventHandler : public TNamed { + + public: + AliVEventHandler(); + AliVEventHandler(const char* name, const char* title); + virtual ~AliVEventHandler(); + virtual void SetOutputFileName(char* fname) = 0; + virtual char* GetOutputFileName() = 0; + virtual Bool_t InitIO(Option_t* opt) = 0; + virtual Bool_t BeginEvent() = 0; + virtual Bool_t Notify(const char *path) = 0; + virtual Bool_t FinishEvent() = 0; + virtual Bool_t Terminate() = 0; + virtual Bool_t TerminateIO() = 0; + private : + ClassDef(AliVEventHandler, 0); +}; + +#endif diff --git a/STEER/AliVHeader.cxx b/STEER/AliVHeader.cxx new file mode 100644 index 00000000000..42e16c6ccd2 --- /dev/null +++ b/STEER/AliVHeader.cxx @@ -0,0 +1,43 @@ +/************************************************************************** + * Copyright(c) 1998-2007, 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. * + **************************************************************************/ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// Event header base class +// Author: Markus Oldenburg, CERN +//------------------------------------------------------------------------- + +#include "AliVHeader.h" + +ClassImp(AliVHeader) + +//______________________________________________________________________________ +AliVHeader::AliVHeader() : + TNamed("header","") { } // default constructor + +//______________________________________________________________________________ +AliVHeader::AliVHeader(const AliVHeader& hdr) : + TNamed(hdr) { } // Copy constructor + +//______________________________________________________________________________ +AliVHeader& AliVHeader::operator=(const AliVHeader& hdr) +{ + // Assignment operator + if(this!=&hdr) { + TNamed::operator=(hdr); + } + return *this; +} diff --git a/STEER/AliVHeader.h b/STEER/AliVHeader.h new file mode 100644 index 00000000000..5613b24b701 --- /dev/null +++ b/STEER/AliVHeader.h @@ -0,0 +1,44 @@ +#ifndef AliVHeader_H +#define AliVHeader_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// Event header base class +// Author: Markus Oldenburg, CERN +//------------------------------------------------------------------------- + +#include + +class AliVHeader : public TNamed { + + public : + AliVHeader(); + virtual ~AliVHeader() { }; + AliVHeader(const AliVHeader& evt); + AliVHeader& operator=(const AliVHeader& evt); + + virtual UShort_t GetBunchCrossNumber() const = 0; + virtual UInt_t GetOrbitNumber() const = 0; + virtual UInt_t GetPeriodNumber() const = 0; + virtual ULong64_t GetTriggerMask() const = 0; + virtual UChar_t GetTriggerCluster() const = 0; + virtual UInt_t GetEventType() const = 0; + + /* + virtual void SetBunchCrossNumber(UShort_t nBx) = 0; + virtual void SetOrbitNumber(UInt_t nOr) = 0; + virtual void SetPeriodNumber(UInt_t nPer) = 0; + virtual void SetTriggerMask(ULong64_t trigMsk) = 0; + virtual void SetTriggerCluster(UChar_t trigClus) = 0; + virtual void SetEventType(UInt_t evttype) = 0; + */ + + virtual void Print(Option_t* option = "") const = 0; + + ClassDef(AliVHeader,0); +}; + +#endif diff --git a/STEER/AliVParticle.cxx b/STEER/AliVParticle.cxx new file mode 100644 index 00000000000..56effb0537f --- /dev/null +++ b/STEER/AliVParticle.cxx @@ -0,0 +1,36 @@ +/************************************************************************** + * Copyright(c) 1998-2007, 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. * + **************************************************************************/ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// base class for ESD and AOD particles +// Author: Markus Oldenburg, CERN +//------------------------------------------------------------------------- + +#include "AliVParticle.h" + +ClassImp(AliVParticle) + +AliVParticle::AliVParticle(const AliVParticle& vPart) : + TObject(vPart) { } // Copy constructor + +AliVParticle& AliVParticle::operator=(const AliVParticle& vPart) +{ if (this!=&vPart) { + TObject::operator=(vPart); + } + + return *this; +} diff --git a/STEER/AliVParticle.h b/STEER/AliVParticle.h new file mode 100644 index 00000000000..23826537b59 --- /dev/null +++ b/STEER/AliVParticle.h @@ -0,0 +1,51 @@ +#ifndef AliVParticle_H +#define AliVParticle_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//------------------------------------------------------------------------- +// base class for ESD and AOD particles +// Author: Markus Oldenburg, CERN +//------------------------------------------------------------------------- + +#include +#include + +class AliVParticle: public TObject { + +public: + AliVParticle() { } + virtual ~AliVParticle() { } + AliVParticle(const AliVParticle& vPart); + AliVParticle& operator=(const AliVParticle& vPart); + + // kinematics + virtual Double_t Px() const = 0; + virtual Double_t Py() const = 0; + virtual Double_t Pz() const = 0; + virtual Double_t Pt() const = 0; + virtual Double_t P() const = 0; + + virtual Double_t OneOverPt() const = 0; + virtual Double_t Phi() const = 0; + virtual Double_t Theta() const = 0; + + + virtual Double_t E() const = 0; + virtual Double_t M() const = 0; + + virtual Double_t Eta() const = 0; + virtual Double_t Y() const = 0; + + virtual Short_t Charge() const = 0; + + // PID + virtual const Double_t *PID() const = 0; // return PID object (to be defined, still) + + + ClassDef(AliVParticle,0) // base class for particles +}; + +#endif diff --git a/STEER/PROOF-INF.STEERBase/BUILD.sh b/STEER/PROOF-INF.STEERBase/BUILD.sh new file mode 100755 index 00000000000..fc9490a6c2d --- /dev/null +++ b/STEER/PROOF-INF.STEERBase/BUILD.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +make diff --git a/STEER/PROOF-INF.STEERBase/SETUP.C b/STEER/PROOF-INF.STEERBase/SETUP.C new file mode 100644 index 00000000000..467dd4f499d --- /dev/null +++ b/STEER/PROOF-INF.STEERBase/SETUP.C @@ -0,0 +1,12 @@ +void SETUP() +{ + // Load the ESD library + gSystem->Load("libSTEERBase"); + + // Set the Inlucde paths + gSystem->SetIncludePath("-I$ROOTSYS/include -ISTEERBase"); + gROOT->ProcessLine(".include STEERBase"); + + // Set our location, so that other packages can find us + gSystem->Setenv("STEERBase_INCLUDE", "STEERBase"); +} diff --git a/STEER/STEERBaseLinkDef.h b/STEER/STEERBaseLinkDef.h new file mode 100644 index 00000000000..4b9d24640c6 --- /dev/null +++ b/STEER/STEERBaseLinkDef.h @@ -0,0 +1,16 @@ +#ifdef __CINT__ +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliVParticle+; +#pragma link C++ class AliVEvent+; +#pragma link C++ class AliVHeader+; +#pragma link C++ class AliVEventHandler+; + +#endif diff --git a/STEER/libSTEERBase.pkg b/STEER/libSTEERBase.pkg new file mode 100644 index 00000000000..084db3cfb25 --- /dev/null +++ b/STEER/libSTEERBase.pkg @@ -0,0 +1,10 @@ +SRCS = AliVParticle.cxx \ + AliVEvent.cxx \ + AliVHeader.cxx \ + AliVEventHandler.cxx \ + +HDRS:= $(SRCS:.cxx=.h) + +DHDR= STEERBaseLinkDef.h + +EXPORT:=$(SRCS:.cxx=.h) -- 2.31.1