From 732a24fe12969c50908153cee19b25134fee1baa Mon Sep 17 00:00:00 2001 From: kleinb Date: Fri, 9 May 2008 09:54:45 +0000 Subject: [PATCH] Implemented Copy() function for all esd objects to allow for assignment of AliESDEvents (based on the list of objects), fixed some assignment operators --- STEER/AliESDACORDE.cxx | 13 +++ STEER/AliESDACORDE.h | 37 ++++---- STEER/AliESDCaloCells.cxx | 23 ++++- STEER/AliESDCaloCells.h | 1 + STEER/AliESDCaloCluster.cxx | 96 +++++++++++++++---- STEER/AliESDCaloCluster.h | 1 + STEER/AliESDCaloTrigger.cxx | 39 ++++++-- STEER/AliESDCaloTrigger.h | 10 +- STEER/AliESDEvent.cxx | 150 +++++++++++++++++------------ STEER/AliESDEvent.h | 8 +- STEER/AliESDFMD.cxx | 11 +++ STEER/AliESDFMD.h | 2 + STEER/AliESDHeader.cxx | 13 +++ STEER/AliESDHeader.h | 1 + STEER/AliESDMuonTrack.cxx | 14 +++ STEER/AliESDMuonTrack.h | 1 + STEER/AliESDPmdTrack.cxx | 12 +++ STEER/AliESDPmdTrack.h | 1 + STEER/AliESDRun.cxx | 34 +++++-- STEER/AliESDRun.h | 2 +- STEER/AliESDTZERO.cxx | 14 +++ STEER/AliESDTZERO.h | 1 + STEER/AliESDTrdTrack.cxx | 11 +++ STEER/AliESDTrdTrack.h | 1 + STEER/AliESDVZERO.cxx | 15 +++ STEER/AliESDVZERO.h | 5 +- STEER/AliESDVertex.cxx | 15 +++ STEER/AliESDVertex.h | 1 + STEER/AliESDZDC.cxx | 13 +++ STEER/AliESDZDC.h | 1 + STEER/AliESDcascade.cxx | 38 ++++++++ STEER/AliESDcascade.h | 4 +- STEER/AliESDkink.cxx | 14 +++ STEER/AliESDkink.h | 1 + STEER/AliESDtrack.cxx | 179 +++++++++++++++++++++++++++++++++++ STEER/AliESDtrack.h | 4 +- STEER/AliESDv0.cxx | 66 +++++++++++++ STEER/AliESDv0.h | 3 +- STEER/AliMultiplicity.cxx | 14 +++ STEER/AliMultiplicity.h | 1 + STEER/AliRawDataErrorLog.cxx | 13 +++ STEER/AliRawDataErrorLog.h | 3 +- 42 files changed, 756 insertions(+), 130 deletions(-) diff --git a/STEER/AliESDACORDE.cxx b/STEER/AliESDACORDE.cxx index a0c3b8cf7fb..f642521fa5a 100644 --- a/STEER/AliESDACORDE.cxx +++ b/STEER/AliESDACORDE.cxx @@ -52,4 +52,17 @@ AliESDACORDE& AliESDACORDE::operator=(const AliESDACORDE& o) return *this; } +void AliESDACORDE::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDACORDE *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDACRDE + *robj = *this; + +} + diff --git a/STEER/AliESDACORDE.h b/STEER/AliESDACORDE.h index 4da5136feb8..841734f5990 100644 --- a/STEER/AliESDACORDE.h +++ b/STEER/AliESDACORDE.h @@ -6,26 +6,25 @@ class AliESDACORDE : public TObject { - public: - AliESDACORDE(); - AliESDACORDE(const AliESDACORDE&); - AliESDACORDE(Int_t *ACORDESingleMuon,Int_t *ACORDEMultiMuon); - virtual ~AliESDACORDE() {}; + public: + AliESDACORDE(); + AliESDACORDE(const AliESDACORDE&); + AliESDACORDE(Int_t *ACORDESingleMuon,Int_t *ACORDEMultiMuon); + virtual ~AliESDACORDE() {}; + virtual void Copy(TObject &) const; + void SetACORDEMultiMuon(Bool_t ACORDEMultiMuon[60]){for(Int_t i=0;i<60;i++){fACORDEMultiMuon[i]=ACORDEMultiMuon[i];}} + + void SetACORDESingleMuon(Bool_t ACORDESingleMuon[60]){for(Int_t i=0;i<60;i++){fACORDESingleMuon[i]=ACORDESingleMuon[i];}} + - void SetACORDEMultiMuon(Bool_t ACORDEMultiMuon[60]){for(Int_t i=0;i<60;i++){fACORDEMultiMuon[i]=ACORDEMultiMuon[i];}} - - void SetACORDESingleMuon(Bool_t ACORDESingleMuon[60]){for(Int_t i=0;i<60;i++){fACORDESingleMuon[i]=ACORDESingleMuon[i];}} - - - AliESDACORDE &operator=(const AliESDACORDE& source); - - protected: - - Bool_t fACORDESingleMuon[60]; // array with the Single Muon hits in the 60 Acorde's Modules - Bool_t fACORDEMultiMuon[60]; // array with the Multi Muon hits in the 60 Acorde's Modules - - - ClassDef(AliESDACORDE,2) + AliESDACORDE &operator=(const AliESDACORDE& source); + + protected: + + Bool_t fACORDESingleMuon[60]; // array with the Single Muon hits in the 60 Acorde's Modules + Bool_t fACORDEMultiMuon[60]; // array with the Multi Muon hits in the 60 Acorde's Modules + + ClassDef(AliESDACORDE,2) }; diff --git a/STEER/AliESDCaloCells.cxx b/STEER/AliESDCaloCells.cxx index 1a0c3f18785..da5c2d98140 100644 --- a/STEER/AliESDCaloCells.cxx +++ b/STEER/AliESDCaloCells.cxx @@ -59,10 +59,17 @@ AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source) if(&source == this) return *this; TNamed::operator=(source); + if(fNCells != source.fNCells){ + DeleteContainer(); + CreateContainer(source.fNCells); + } + fNCells = source.fNCells; fIsSorted = source.fIsSorted; fType = source.fType; - + + + for(Int_t i = 0; i < fNCells; i++){ fCellNumber[i] = source.fCellNumber[i]; fAmplitude[i] = source.fAmplitude[i]; @@ -73,6 +80,20 @@ AliESDCaloCells & AliESDCaloCells::operator =(const AliESDCaloCells& source) } + +void AliESDCaloCells::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDCaloCells *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDCaloCells + *robj = *this; + +} + //_______________________________________________________________________ AliESDCaloCells::~AliESDCaloCells() { diff --git a/STEER/AliESDCaloCells.h b/STEER/AliESDCaloCells.h index a6534a3bb70..69057c3f271 100644 --- a/STEER/AliESDCaloCells.h +++ b/STEER/AliESDCaloCells.h @@ -29,6 +29,7 @@ class AliESDCaloCells : public TNamed AliESDCaloCells(const AliESDCaloCells & cells); AliESDCaloCells & operator=(const AliESDCaloCells& source); virtual ~AliESDCaloCells(); + virtual void Copy(TObject &obj) const; Bool_t IsEMCAL() const {return (fType == kEMCALCell);} Bool_t IsPHOS() const {return (fType == kPHOSCell);} diff --git a/STEER/AliESDCaloCluster.cxx b/STEER/AliESDCaloCluster.cxx index 78f6efa5ea3..3c3bc9f9c8d 100644 --- a/STEER/AliESDCaloCluster.cxx +++ b/STEER/AliESDCaloCluster.cxx @@ -133,45 +133,103 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source) for(Int_t i=0; i 0) { - if(source.fCellsAbsId){ - fCellsAbsId = new UShort_t[source.fNCells]; + if(fNCells != source.fNCells){ + delete [] fCellsAbsId; + fCellsAbsId = new UShort_t[source.fNCells]; + } for (Int_t i=0; i(&obj); + if(!robj)return; // not an AliESDCluster + *robj = *this; + +} //_______________________________________________________________________ AliESDCaloCluster::~AliESDCaloCluster(){ diff --git a/STEER/AliESDCaloCluster.h b/STEER/AliESDCaloCluster.h index c8d50bd3187..6fc951eb114 100644 --- a/STEER/AliESDCaloCluster.h +++ b/STEER/AliESDCaloCluster.h @@ -31,6 +31,7 @@ public: AliESDCaloCluster(const AliESDCaloCluster& clus); AliESDCaloCluster & operator=(const AliESDCaloCluster& source); virtual ~AliESDCaloCluster(); + virtual void Copy(TObject &) const; void SetID(Int_t id) {fID = id;} Int_t GetID() const {return fID;} diff --git a/STEER/AliESDCaloTrigger.cxx b/STEER/AliESDCaloTrigger.cxx index b83fc1bd5c7..d3a8269c8b2 100644 --- a/STEER/AliESDCaloTrigger.cxx +++ b/STEER/AliESDCaloTrigger.cxx @@ -50,16 +50,43 @@ AliESDCaloTrigger& AliESDCaloTrigger::operator=(const AliESDCaloTrigger& ctrig) // assigment operator if(this!=&ctrig) { TNamed::operator=(ctrig); - // CKB dont't want to create leak if fTriggerAmp points to - // something already - delete fTriggerAmplitudes; - fTriggerAmplitudes = new TArrayF(*ctrig.fTriggerAmplitudes); - delete fTriggerPosition; - fTriggerPosition = new TArrayF(*ctrig.fTriggerPosition); + if(ctrig.fTriggerAmplitudes){ + // asign or copy construct + if(fTriggerAmplitudes)*fTriggerAmplitudes = *ctrig.fTriggerAmplitudes; + else fTriggerAmplitudes = new TArrayF(*ctrig.fTriggerAmplitudes); + } + else{ + delete fTriggerAmplitudes; + fTriggerAmplitudes = 0; + } + + if(ctrig.fTriggerPosition){ + // asign or copy construct + if(fTriggerPosition)*fTriggerPosition = *ctrig.fTriggerPosition; + else fTriggerPosition = new TArrayF(*ctrig.fTriggerPosition); + } + else{ + delete fTriggerPosition; + fTriggerPosition = 0; + } } return *this; } +void AliESDCaloTrigger::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDCaloTrigger *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDCaloTrigger + *robj = *this; + +} + + void AliESDCaloTrigger::Reset() { // simple reset diff --git a/STEER/AliESDCaloTrigger.h b/STEER/AliESDCaloTrigger.h index 104ffe046a8..d5fc630c34d 100644 --- a/STEER/AliESDCaloTrigger.h +++ b/STEER/AliESDCaloTrigger.h @@ -28,16 +28,16 @@ public: AliESDCaloTrigger(const AliESDCaloTrigger& ctrig); AliESDCaloTrigger& operator=(const AliESDCaloTrigger& ctrig); virtual ~AliESDCaloTrigger(); + virtual void Copy(TObject &obj) const; - // does this create mem leak? CKB use new with placement? void AddTriggerPosition(const TArrayF & array) { - if(fTriggerPosition) delete fTriggerPosition; - fTriggerPosition = new TArrayF(array); + if(fTriggerPosition) *fTriggerPosition = array; + else fTriggerPosition = new TArrayF(array); } void AddTriggerAmplitudes(const TArrayF & array) { - if(fTriggerAmplitudes)delete fTriggerAmplitudes; - fTriggerAmplitudes = new TArrayF(array); + if(fTriggerAmplitudes) *fTriggerAmplitudes = array; + else fTriggerAmplitudes = new TArrayF(array); } void Reset(); diff --git a/STEER/AliESDEvent.cxx b/STEER/AliESDEvent.cxx index 0de296ea9b3..9389fc8e7a5 100644 --- a/STEER/AliESDEvent.cxx +++ b/STEER/AliESDEvent.cxx @@ -204,60 +204,60 @@ AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) { if(&source == this) return *this; AliVEvent::operator=(source); - fESDRun = new AliESDRun(*source.fESDRun); - fHeader = new AliESDHeader(*source.fHeader); - fESDZDC = new AliESDZDC(*source.fESDZDC); - fESDFMD = new AliESDFMD(*source.fESDFMD); - fESDVZERO = new AliESDVZERO(*source.fESDVZERO); - fESDTZERO = new AliESDTZERO(*source.fESDTZERO); - fTPCVertex = new AliESDVertex(*source.fTPCVertex); - fSPDVertex = new AliESDVertex(*source.fSPDVertex); - fPrimaryVertex = new AliESDVertex(*source.fPrimaryVertex); - fSPDMult = new AliMultiplicity(*source.fSPDMult); - fPHOSTrigger = new AliESDCaloTrigger(*source.fPHOSTrigger); - fEMCALTrigger = new AliESDCaloTrigger(*source.fEMCALTrigger); - fTracks = new TClonesArray(*source.fTracks); - fMuonTracks = new TClonesArray(*source.fMuonTracks); - fPmdTracks = new TClonesArray(*source.fPmdTracks); - fTrdTracks = new TClonesArray(*source.fTrdTracks); - fV0s = new TClonesArray(*source.fV0s); - fCascades = new TClonesArray(*source.fCascades); - fKinks = new TClonesArray(*source.fKinks); - fCaloClusters = new TClonesArray(*source.fCaloClusters); - fEMCALCells = new AliESDCaloCells(*source.fEMCALCells); - fPHOSCells = new AliESDCaloCells(*source.fPHOSCells); - fErrorLogs = new TClonesArray(*source.fErrorLogs); - fESDACORDE = new AliESDACORDE(*source.fESDACORDE); - fESDOld = new AliESD(*source.fESDOld); - fESDFriendOld = new AliESDfriend(*source.fESDFriendOld); - // CKB this way?? or - // or AddObject( fESDZDC = new AliESDZDC(*source.fESDZDC)); - - fESDObjects = new TList(); - AddObject(fESDRun); - AddObject(fHeader); - AddObject(fESDZDC); - AddObject(fESDFMD); - AddObject(fESDVZERO); - AddObject(fESDTZERO); - AddObject(fTPCVertex); - AddObject(fSPDVertex); - AddObject(fPrimaryVertex); - AddObject(fSPDMult); - AddObject(fPHOSTrigger); - AddObject(fEMCALTrigger); - AddObject(fTracks); - AddObject(fMuonTracks); - AddObject(fPmdTracks); - AddObject(fTrdTracks); - AddObject(fV0s); - AddObject(fCascades); - AddObject(fKinks); - AddObject(fCaloClusters); - AddObject(fEMCALCells); - AddObject(fPHOSCells); - AddObject(fErrorLogs); - AddObject(fESDACORDE); + // This assumes that the list is already created + // and that the virtual void Copy(Tobject&) function + // is correctly implemented in the derived class + // otherwise only TObject::Copy() will be used + + + if((fESDObjects->GetSize()==0)&&(source.fESDObjects->GetSize()>=kESDListN)){ + // We cover the case that we do not yet have the + // standard content but the source has it + CreateStdContent(); + } + + TIter next(source.GetList()); + TObject *its = 0; + TString name; + while ((its = next())) { + name.Form("%s", its->GetName()); + TObject *mine = fESDObjects->FindObject(name.Data()); + if(!mine){ + // not in this: can be added to list (to be implemented) + AliWarning(Form("%s:%d Could not find %s for copying \n", + (char*)__FILE__,__LINE__,name.Data())); + continue; + } + + if(!its->InheritsFrom("TCollection")){ + // simple objects + its->Copy(*mine); + } + else if(its->InheritsFrom("TClonesArray")){ + // Create or expand the tclonesarray pointers + // so we can directly copy to the object + TClonesArray *its_tca = (TClonesArray*)its; + TClonesArray *mine_tca = (TClonesArray*)mine; + + // this leaves the capacity of the TClonesArray the same + // except for a factor of 2 increase when size > capacity + // does not release any memory occupied by the tca + mine_tca->ExpandCreate(its_tca->GetEntriesFast()); + for(int i = 0;i < its_tca->GetEntriesFast();++i){ + // copy + TObject *mine_tca_obj = mine_tca->At(i); + TObject *its_tca_obj = its_tca->At(i); + // no need to delete first + // pointers within the class should be handled by Copy()... + // Can there be Empty slots? + its_tca_obj->Copy(*mine_tca_obj); + } + } + else{ + AliWarning(Form("%s:%d cannot copy TCollection \n", + (char*)__FILE__,__LINE__)); + } + } fConnected = source.fConnected; fEMCALClusters = source.fEMCALClusters; @@ -266,7 +266,6 @@ AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) { fFirstPHOSCluster = source.fFirstPHOSCluster; - return *this; } @@ -291,6 +290,19 @@ AliESDEvent::~AliESDEvent() } +void AliESDEvent::Copy(TObject &obj) const { + + // interface to TOBject::Copy + // Copies the content of this into obj! + // bascially obj = *this + + if(this==&obj)return; + AliESDEvent *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESEvent + *robj = *this; + return; +} + //______________________________________________________________________________ void AliESDEvent::Reset() { @@ -1045,7 +1057,7 @@ const void AliESDEvent::WriteToTree(TTree* tree) const { while ((obj = next())) { branchname.Form("%s", obj->GetName()); if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) { - branchname += "."; + if(!branchname.EndsWith("."))branchname += "."; } tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj), kBufsize, kSplitlevel - 1); @@ -1133,8 +1145,9 @@ void AliESDEvent::ReadFromTree(TTree *tree){ return; } - delete fESDOld; - fESDOld = 0; + + delete fESDOld; + fESDOld = 0; // Try to find AliESDEvent AliESDEvent *esdEvent = 0; esdEvent = (AliESDEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliESDEvent"); @@ -1149,14 +1162,24 @@ void AliESDEvent::ReadFromTree(TTree *tree){ fConnected = true; return; } + // Connect to tree // prevent a memory leak when reading back the TList delete fESDObjects; fESDObjects = 0; + + + // create a new TList from the UserInfo TList... // copy constructor does not work... + fESDObjects = (TList*)(esdEvent->GetList()->Clone()); fESDObjects->SetOwner(kFALSE); + + // in principle + // we only need new things in the list if we do no already have it.. + // TODO just add new entries + if(fESDObjects->GetEntries()GetEntries(),kESDListN); @@ -1208,7 +1231,16 @@ void AliESDEvent::ReadFromTree(TTree *tree){ TNamed *el; while((el=(TNamed*)next())){ TString bname(el->GetName()); - tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); + TBranch *br = tree->GetBranch(bname.Data()); + if(br){ + tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); + } + else{ + br = tree->GetBranch(Form("%s.",bname.Data())); + if(br){ + tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el)); + } + } } GetStdContent(); // when reading back we are not owner of the list diff --git a/STEER/AliESDEvent.h b/STEER/AliESDEvent.h index 56d0558e7a2..8bd1dea20fb 100644 --- a/STEER/AliESDEvent.h +++ b/STEER/AliESDEvent.h @@ -87,8 +87,9 @@ public: }; AliESDEvent(); - virtual ~AliESDEvent(); - + virtual ~AliESDEvent(); + AliESDEvent &operator=(const AliESDEvent& source); // or make private and use only copy? + virtual void Copy(TObject& obj) const; // RUN // move this to the UserData!!! @@ -119,7 +120,7 @@ public: void SetTimeStamp(UInt_t timeStamp){fHeader->SetTimeStamp(timeStamp);} void SetEventType(UInt_t eventType){fHeader->SetEventType(eventType);} void SetEventNumberInFile(Int_t n) {fHeader->SetEventNumberInFile(n);} - // void SetRunNumber(Int_t n) {fHeader->SetRunNumber(n);} + // void SetRunNumber(Int_t n) {fHeader->SetRunNumber(n);} void SetBunchCrossNumber(UShort_t n) {fHeader->SetBunchCrossNumber(n);} void SetTriggerCluster(UChar_t n) {fHeader->SetTriggerCluster(n);} @@ -343,7 +344,6 @@ public: protected: AliESDEvent(const AliESDEvent&); - AliESDEvent &operator=(const AliESDEvent& source); TList *fESDObjects; // List of esd Objects diff --git a/STEER/AliESDFMD.cxx b/STEER/AliESDFMD.cxx index c7e367d6df8..9709396907d 100755 --- a/STEER/AliESDFMD.cxx +++ b/STEER/AliESDFMD.cxx @@ -74,6 +74,17 @@ AliESDFMD::operator=(const AliESDFMD& other) return *this; } +void AliESDFMD::Copy(TObject &obj) const{ + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDFMD *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDFMD + *robj = *this; +} + //____________________________________________________________________ void AliESDFMD::CheckNeedUShort(TFile* file) diff --git a/STEER/AliESDFMD.h b/STEER/AliESDFMD.h index 3224fa6e94d..564b206e065 100755 --- a/STEER/AliESDFMD.h +++ b/STEER/AliESDFMD.h @@ -41,6 +41,8 @@ public: AliESDFMD& operator=(const AliESDFMD& other); /** Destructor - does nothing */ virtual ~AliESDFMD() {} + virtual void Copy(TObject &obj) const; + void Clear(Option_t *option=""); /** Get the pseudo-multiplicity of diff --git a/STEER/AliESDHeader.cxx b/STEER/AliESDHeader.cxx index 74287769f33..51412841257 100644 --- a/STEER/AliESDHeader.cxx +++ b/STEER/AliESDHeader.cxx @@ -86,6 +86,19 @@ AliESDHeader& AliESDHeader::operator=(const AliESDHeader &header) return *this; } +void AliESDHeader::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDHeader *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDHeader + *robj = *this; + +} + //______________________________________________________________________________ diff --git a/STEER/AliESDHeader.h b/STEER/AliESDHeader.h index 8f1bbde06cb..8fe8a63e89f 100644 --- a/STEER/AliESDHeader.h +++ b/STEER/AliESDHeader.h @@ -20,6 +20,7 @@ public: virtual ~AliESDHeader(); AliESDHeader(const AliESDHeader& header); AliESDHeader& operator=(const AliESDHeader& header); + virtual void Copy(TObject &obj) const; void SetTriggerMask(ULong64_t n) {fTriggerMask=n;} void SetOrbitNumber(UInt_t n) {fOrbitNumber=n;} diff --git a/STEER/AliESDMuonTrack.cxx b/STEER/AliESDMuonTrack.cxx index 90030f0dfca..bef6fd5130a 100644 --- a/STEER/AliESDMuonTrack.cxx +++ b/STEER/AliESDMuonTrack.cxx @@ -195,6 +195,20 @@ AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& muonTrack) return *this; } +void AliESDMuonTrack::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDMuonTrack *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDMuonTrack + *robj = *this; + +} + + //__________________________________________________________________________ AliESDMuonTrack::~AliESDMuonTrack() { diff --git a/STEER/AliESDMuonTrack.h b/STEER/AliESDMuonTrack.h index 00212ffa6c7..5daf8641621 100644 --- a/STEER/AliESDMuonTrack.h +++ b/STEER/AliESDMuonTrack.h @@ -27,6 +27,7 @@ public: virtual ~AliESDMuonTrack(); // Destructor AliESDMuonTrack(const AliESDMuonTrack& esdm); AliESDMuonTrack& operator=(const AliESDMuonTrack& esdm); + virtual void Copy(TObject &obj) const; virtual void Clear(Option_t* opt = ""); diff --git a/STEER/AliESDPmdTrack.cxx b/STEER/AliESDPmdTrack.cxx index 9f50623e945..5a7303557f7 100644 --- a/STEER/AliESDPmdTrack.cxx +++ b/STEER/AliESDPmdTrack.cxx @@ -68,3 +68,15 @@ AliESDPmdTrack &AliESDPmdTrack::operator=(const AliESDPmdTrack& PMDTrack) fNcell = PMDTrack.fNcell; return *this; } + +void AliESDPmdTrack::Copy(TObject& obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDPmdTrack *robj = dynamic_cast(&obj); + if(!robj)return; // not an aliesesdpmdtrack + *robj = *this; +} diff --git a/STEER/AliESDPmdTrack.h b/STEER/AliESDPmdTrack.h index 2f41ca80ab9..94d38abf0ca 100644 --- a/STEER/AliESDPmdTrack.h +++ b/STEER/AliESDPmdTrack.h @@ -18,6 +18,7 @@ class AliESDPmdTrack : public TObject { virtual ~AliESDPmdTrack(){;} AliESDPmdTrack (const AliESDPmdTrack &PMDTrack); // copy constructor AliESDPmdTrack &operator=(const AliESDPmdTrack &PMDTrack); // assignment op + virtual void Copy(TObject &obj) const; void SetDetector(Int_t idet) {fDet = idet;} diff --git a/STEER/AliESDRun.cxx b/STEER/AliESDRun.cxx index 707abb5ee9e..17027dde7a2 100644 --- a/STEER/AliESDRun.cxx +++ b/STEER/AliESDRun.cxx @@ -67,20 +67,34 @@ AliESDRun& AliESDRun::operator=(const AliESDRun &esd) if(this!=&esd) { TObject::operator=(esd); fRunNumber=esd.fRunNumber; - fPeriodNumber=esd.fPeriodNumber; - fRecoVersion=esd.fRecoVersion; - fMagneticField=esd.fMagneticField; - for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i]; - for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i]; - fTriggerClasses.Clear(); - for(Int_t i = 0; i < kNTriggerClasses; i++) { - TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i)); - if (str) fTriggerClasses.AddAt(new TNamed(*str),i); - } + fPeriodNumber=esd.fPeriodNumber; + fRecoVersion=esd.fRecoVersion; + fMagneticField=esd.fMagneticField; + for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i]; + for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i]; + fTriggerClasses.Clear(); + for(Int_t i = 0; i < kNTriggerClasses; i++) { + TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i)); + if (str) fTriggerClasses.AddAt(new TNamed(*str),i); + } + } return *this; } +void AliESDRun::Copy(TObject &obj) const{ + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDRun *robj = dynamic_cast(&obj); + if(!robj)return; // not an aliesdrun + *robj = *this; + +} + void AliESDRun::SetDiamond(const AliESDVertex *vertex) { // set the interaction diamond fDiamondXY[0]=vertex->GetXv(); diff --git a/STEER/AliESDRun.h b/STEER/AliESDRun.h index a73f09f3c03..0692b8fb51e 100644 --- a/STEER/AliESDRun.h +++ b/STEER/AliESDRun.h @@ -23,7 +23,7 @@ public: AliESDRun(); AliESDRun(const AliESDRun& esd); AliESDRun& operator=(const AliESDRun& esd); - + virtual void Copy(TObject &obj) const; // Interface for using TOBject::Copy() Int_t GetRunNumber() const {return fRunNumber;} void SetRunNumber(Int_t n) {fRunNumber=n;} diff --git a/STEER/AliESDTZERO.cxx b/STEER/AliESDTZERO.cxx index baf6e38cd91..45f7d33ba9d 100644 --- a/STEER/AliESDTZERO.cxx +++ b/STEER/AliESDTZERO.cxx @@ -61,6 +61,20 @@ AliESDTZERO& AliESDTZERO::operator=(const AliESDTZERO& tzero){ return *this; } +void AliESDTZERO::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDTZERO *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDTZERO + *robj = *this; + +} + + //______________________________________________________________________________ void AliESDTZERO::Reset() { diff --git a/STEER/AliESDTZERO.h b/STEER/AliESDTZERO.h index 55bad439af7..f50c699a85b 100644 --- a/STEER/AliESDTZERO.h +++ b/STEER/AliESDTZERO.h @@ -21,6 +21,7 @@ public: AliESDTZERO(); AliESDTZERO(const AliESDTZERO& tzero); AliESDTZERO& operator=(const AliESDTZERO& tzero); + virtual void Copy(TObject &obj) const; Double_t GetT0zVertex() const {return fT0zVertex;} void SetT0zVertex(Double_t z) {fT0zVertex=z;} diff --git a/STEER/AliESDTrdTrack.cxx b/STEER/AliESDTrdTrack.cxx index 2c5a60dbd4c..365368c0c0d 100644 --- a/STEER/AliESDTrdTrack.cxx +++ b/STEER/AliESDTrdTrack.cxx @@ -100,3 +100,14 @@ AliESDTrdTrack& AliESDTrdTrack::operator=(const AliESDTrdTrack& track) } +void AliESDTrdTrack::Copy(TObject& obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDTrdTrack *robj = dynamic_cast(&obj); + if(!robj)return; // not an aliesesdtrdtrack + *robj = *this; +} diff --git a/STEER/AliESDTrdTrack.h b/STEER/AliESDTrdTrack.h index 1d7be7b5506..23c7e0844ae 100644 --- a/STEER/AliESDTrdTrack.h +++ b/STEER/AliESDTrdTrack.h @@ -15,6 +15,7 @@ class AliESDTrdTrack : public TObject { virtual ~AliESDTrdTrack(){}; AliESDTrdTrack(const AliESDTrdTrack& track); AliESDTrdTrack& operator=(const AliESDTrdTrack& track); + virtual void Copy(TObject &obj) const; Double_t GetYproj() const { return fYproj; }; Double_t GetZproj() const { return fZproj; }; diff --git a/STEER/AliESDVZERO.cxx b/STEER/AliESDVZERO.cxx index 769da3de7b9..be9422e7b26 100644 --- a/STEER/AliESDVZERO.cxx +++ b/STEER/AliESDVZERO.cxx @@ -62,3 +62,18 @@ AliESDVZERO& AliESDVZERO::operator=(const AliESDVZERO& o) return *this; } + +void AliESDVZERO::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDVZERO *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDVZERO + *robj = *this; + +} + + diff --git a/STEER/AliESDVZERO.h b/STEER/AliESDVZERO.h index 42a41695d9f..932ccf36415 100644 --- a/STEER/AliESDVZERO.h +++ b/STEER/AliESDVZERO.h @@ -11,6 +11,9 @@ public: AliESDVZERO(Int_t NbPMV0A, Int_t NbPMV0C, Int_t MTotV0A, Int_t MTotV0C, Int_t *MRingV0A, Int_t *MRingV0C); virtual ~AliESDVZERO() {}; + AliESDVZERO &operator=(const AliESDVZERO& source); + virtual void Copy(TObject &obj) const; + // Setters virtual void SetNbPMV0A(Int_t NbPMV0A) {fNbPMV0A = NbPMV0A;} @@ -30,7 +33,7 @@ public: Int_t* GetMRingV0A() const {return (int*) fMRingV0A;} Int_t* GetMRingV0C() const {return (int*) fMRingV0C;} - AliESDVZERO &operator=(const AliESDVZERO& source); + protected: Int_t fMTotV0A; // Total multiplicity in V0A diff --git a/STEER/AliESDVertex.cxx b/STEER/AliESDVertex.cxx index a2a320b598c..bc65501a516 100644 --- a/STEER/AliESDVertex.cxx +++ b/STEER/AliESDVertex.cxx @@ -174,6 +174,21 @@ AliESDVertex &AliESDVertex::operator=(const AliESDVertex &source){ } return *this; } + +void AliESDVertex::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDVertex *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDVertex + *robj = *this; + +} + + //-------------------------------------------------------------------------- void AliESDVertex::SetToZero() { // diff --git a/STEER/AliESDVertex.h b/STEER/AliESDVertex.h index 4f764b7df64..f29b8fc41bd 100644 --- a/STEER/AliESDVertex.h +++ b/STEER/AliESDVertex.h @@ -46,6 +46,7 @@ class AliESDVertex : public AliVertex { const Char_t *vtxName="Vertex"); AliESDVertex(const AliESDVertex &source); AliESDVertex &operator=(const AliESDVertex &source); + virtual void Copy(TObject &obj) const; virtual ~AliESDVertex() {} diff --git a/STEER/AliESDZDC.cxx b/STEER/AliESDZDC.cxx index 9ad1ac0d8c3..3d7cd625988 100644 --- a/STEER/AliESDZDC.cxx +++ b/STEER/AliESDZDC.cxx @@ -97,6 +97,19 @@ AliESDZDC& AliESDZDC::operator=(const AliESDZDC&zdc) return *this; } +void AliESDZDC::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDZDC *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDZDC + *robj = *this; + +} + //______________________________________________________________________________ void AliESDZDC::Reset() diff --git a/STEER/AliESDZDC.h b/STEER/AliESDZDC.h index bedd2ada933..b52d21d806e 100644 --- a/STEER/AliESDZDC.h +++ b/STEER/AliESDZDC.h @@ -20,6 +20,7 @@ public: AliESDZDC(); AliESDZDC(const AliESDZDC& zdc); AliESDZDC& operator=(const AliESDZDC& zdc); + virtual void Copy(TObject &obj) const; Double_t GetZDCN1Energy() const {return fZDCN1Energy;} Double_t GetZDCP1Energy() const {return fZDCP1Energy;} diff --git a/STEER/AliESDcascade.cxx b/STEER/AliESDcascade.cxx index a0f325bfcf1..5e96cb1e066 100644 --- a/STEER/AliESDcascade.cxx +++ b/STEER/AliESDcascade.cxx @@ -152,6 +152,44 @@ AliESDcascade::AliESDcascade(const AliESDcascade& cas) : } } +AliESDcascade& AliESDcascade::operator=(const AliESDcascade& cas){ + + // ------- + // Assigmnet oeprator + // ----- + + if(this==&cas) return *this; + AliESDv0::operator=(cas); + + fEffMassXi = cas.fEffMassXi; + fChi2Xi = cas.fChi2Xi; + fDcaXiDaughters = cas.fDcaXiDaughters; + fPdgCodeXi = cas.fPdgCodeXi; + fBachIdx = cas.fBachIdx; + for (int i=0; i<3; i++) { + fPosXi[i] = cas.fPosXi[i]; + fBachMom[i] = cas.fBachMom[i]; + } + for (int i=0; i<6; i++) { + fPosCovXi[i] = cas.fPosCovXi[i]; + fBachMomCov[i] = cas.fBachMomCov[i]; + } + return *this; +} + +void AliESDcascade::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDcascade *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDcascade + *robj = *this; + +} + Double_t AliESDcascade::ChangeMassHypothesis(Double_t &v0q, Int_t code) { //-------------------------------------------------------------------- // This function changes the mass hypothesis for this cascade diff --git a/STEER/AliESDcascade.h b/STEER/AliESDcascade.h index b16b83f58ec..b3755d98f40 100644 --- a/STEER/AliESDcascade.h +++ b/STEER/AliESDcascade.h @@ -32,6 +32,8 @@ public: AliESDcascade(const AliESDv0 &v0, const AliExternalTrackParam &t, Int_t i); ~AliESDcascade(); + AliESDcascade& operator=(const AliESDcascade&); + virtual void Copy(TObject &obj) const; Double_t ChangeMassHypothesis(Double_t &v0q, Int_t code=kXiMinus); @@ -69,7 +71,7 @@ protected: private: - AliESDcascade& operator=(const AliESDcascade&); + ClassDef(AliESDcascade,5) // reconstructed cascade vertex }; diff --git a/STEER/AliESDkink.cxx b/STEER/AliESDkink.cxx index 8c7d0e6b2c2..a1fe5e8717f 100644 --- a/STEER/AliESDkink.cxx +++ b/STEER/AliESDkink.cxx @@ -130,6 +130,20 @@ AliESDkink& AliESDkink::operator=(const AliESDkink &source) return *this; } +void AliESDkink::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDkink *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDkink + *robj = *this; + +} + + void AliESDkink::SetMother(const AliExternalTrackParam & pmother) { // // set mother diff --git a/STEER/AliESDkink.h b/STEER/AliESDkink.h index 217369f2508..300210ac31b 100644 --- a/STEER/AliESDkink.h +++ b/STEER/AliESDkink.h @@ -23,6 +23,7 @@ public: AliESDkink(); //constructor AliESDkink(const AliESDkink &source); //constructor AliESDkink& operator=(const AliESDkink &source); + virtual void Copy(TObject &obj) const; // void SetID(Short_t id){fID=id;} Short_t GetID(){return fID;} diff --git a/STEER/AliESDtrack.cxx b/STEER/AliESDtrack.cxx index 6b7cfc65b33..2c0644a71a9 100644 --- a/STEER/AliESDtrack.cxx +++ b/STEER/AliESDtrack.cxx @@ -420,6 +420,185 @@ AliESDtrack::~AliESDtrack(){ delete fFriendTrack; } +AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){ + + + if(&source == this) return *this; + AliExternalTrackParam::operator=(source); + + + if(source.fCp){ + // we have the trackparam: assign or copy construct + if(fCp)*fCp = *source.fCp; + else fCp = new AliExternalTrackParam(*source.fCp); + } + else{ + // no track param delete the old one + if(fCp)delete fCp; + fCp = 0; + } + + if(source.fIp){ + // we have the trackparam: assign or copy construct + if(fIp)*fIp = *source.fIp; + else fIp = new AliExternalTrackParam(*source.fIp); + } + else{ + // no track param delete the old one + if(fIp)delete fIp; + fIp = 0; + } + + + if(source.fTPCInner){ + // we have the trackparam: assign or copy construct + if(fTPCInner) *fTPCInner = *source.fTPCInner; + else fTPCInner = new AliExternalTrackParam(*source.fTPCInner); + } + else{ + // no track param delete the old one + if(fTPCInner)delete fTPCInner; + fTPCInner = 0; + } + + + if(source.fOp){ + // we have the trackparam: assign or copy construct + if(fOp) *fOp = *source.fOp; + else fOp = new AliExternalTrackParam(*source.fOp); + } + else{ + // no track param delete the old one + if(fOp)delete fOp; + fOp = 0; + } + + // copy also the friend track + // use copy constructor + if(source.fFriendTrack){ + // we have the trackparam: assign or copy construct + delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack); + } + else{ + // no track param delete the old one + delete fFriendTrack; fFriendTrack= 0; + } + + fTPCClusterMap = source.fTPCClusterMap; + fTPCSharedMap = source.fTPCSharedMap; + // the simple stuff + fFlags = source.fFlags; + fID = source.fID; + fLabel = source.fLabel; + fITSLabel = source.fITSLabel; + for(int i = 0; i< 12;++i){ + fITSModule[i] = source.fITSModule[i]; + } + fTPCLabel = source.fTPCLabel; + fTRDLabel = source.fTRDLabel; + for(int i = 0; i< 3;++i){ + fTOFLabel[i] = source.fTOFLabel[i]; + } + fTOFCalChannel = source.fTOFCalChannel; + fTOFindex = source.fTOFindex; + fHMPIDqn = source.fHMPIDqn; + fHMPIDcluIdx = source.fHMPIDcluIdx; + fEMCALindex = source.fEMCALindex; + + for(int i = 0; i< 3;++i){ + fKinkIndexes[i] = source.fKinkIndexes[i]; + fV0Indexes[i] = source.fV0Indexes[i]; + } + + for(int i = 0; i< AliPID::kSPECIES;++i){ + fR[i] = source.fR[i]; + fITSr[i] = source.fITSr[i]; + fTPCr[i] = source.fTPCr[i]; + fTRDr[i] = source.fTRDr[i]; + fTOFr[i] = source.fTOFr[i]; + fHMPIDr[i] = source.fHMPIDr[i]; + fTrackTime[i] = source.fTrackTime[i]; + } + + fHMPIDtrkTheta = source.fHMPIDtrkTheta; + fHMPIDtrkPhi = source.fHMPIDtrkPhi; + fHMPIDsignal = source.fHMPIDsignal; + + + fTrackLength = source. fTrackLength; + fD = source.fD; + fZ = source.fZ; + fCdd = source.fCdd; + fCdz = source.fCdz; + fCzz = source.fCzz; + + fCchi2 = source.fCchi2; + fITSchi2 = source.fITSchi2; + fTPCchi2 = source.fTPCchi2; + fTRDchi2 = source.fTRDchi2; + fTOFchi2 = source.fTOFchi2; + fHMPIDchi2 = source.fHMPIDchi2; + + + fITSsignal = source.fITSsignal; + fTPCsignal = source.fTPCsignal; + fTPCsignalS = source.fTPCsignalS; + for(int i = 0; i< 4;++i){ + fTPCPoints[i] = source.fTPCPoints[i]; + } + fTRDsignal = source.fTRDsignal; + + for(int i = 0;i < kNPlane;++i){ + fTRDTimBin[i] = source.fTRDTimBin[i]; + for(int j = 0;j < kNSlice;++j){ + fTRDsignals[i][j] = source.fTRDsignals[i][j]; + } + } + fTRDQuality = source.fTRDQuality; + fTRDBudget = source.fTRDBudget; + fTOFsignal = source.fTOFsignal; + fTOFsignalToT = source.fTOFsignalToT; + fTOFsignalRaw = source.fTOFsignalRaw; + fTOFsignalDz = source.fTOFsignalDz; + + for(int i = 0;i<10;++i){ + fTOFInfo[i] = source.fTOFInfo[i]; + } + + fHMPIDtrkX = source.fHMPIDtrkX; + fHMPIDtrkY = source.fHMPIDtrkY; + fHMPIDmipX = source.fHMPIDmipX; + fHMPIDmipY = source.fHMPIDmipY; + + fTPCncls = source.fTPCncls; + fTPCnclsF = source.fTPCnclsF; + fTPCsignalN = source.fTPCsignalN; + + fITSncls = source.fITSncls; + fITSClusterMap = source.fITSClusterMap; + fTRDncls = source.fTRDncls; + fTRDncls0 = source.fTRDncls0; + fTRDpidQuality = source.fTRDpidQuality; + return *this; +} + + + +void AliESDtrack::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDtrack *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDtrack + *robj = *this; + +} + + + void AliESDtrack::AddCalibObject(TObject * object){ // // add calib object to the list diff --git a/STEER/AliESDtrack.h b/STEER/AliESDtrack.h index f3c96185122..4f68c215d94 100644 --- a/STEER/AliESDtrack.h +++ b/STEER/AliESDtrack.h @@ -40,10 +40,10 @@ public: AliESDtrack(const AliESDtrack& track); AliESDtrack(TParticle * part); virtual ~AliESDtrack(); + virtual void Copy(TObject &obj) const; const AliESDfriendTrack *GetFriendTrack() const {return fFriendTrack;} void SetFriendTrack(const AliESDfriendTrack *t) { delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*t); - // CKB } void ReleaseESDfriendTrack() { delete fFriendTrack; fFriendTrack=0; } void AddCalibObject(TObject * object); // add calib object to the list @@ -383,7 +383,7 @@ protected: private: - AliESDtrack & operator=(const AliESDtrack & ) {return *this;} + AliESDtrack & operator=(const AliESDtrack & ); ClassDef(AliESDtrack,42) //ESDtrack }; diff --git a/STEER/AliESDv0.cxx b/STEER/AliESDv0.cxx index eba32ce0480..62b6c677f16 100644 --- a/STEER/AliESDv0.cxx +++ b/STEER/AliESDv0.cxx @@ -129,6 +129,7 @@ AliESDv0::AliESDv0(const AliESDv0& v0) : for (Int_t i=0;i<4;i++){fCausality[i]=v0.fCausality[i];} } + AliESDv0::AliESDv0(const AliExternalTrackParam &t1, Int_t i1, const AliExternalTrackParam &t2, Int_t i2) : TObject(), @@ -194,6 +195,71 @@ AliESDv0::AliESDv0(const AliExternalTrackParam &t1, Int_t i1, for (Int_t i=0;i<4;i++){fCausality[i]=0;} } +AliESDv0& AliESDv0::operator=(const AliESDv0 &v0){ + + + //-------------------------------------------------------------------- + // The assingment operator + //-------------------------------------------------------------------- + + if(this==&v0)return *this; + TObject::operator=(v0); + fParamN = v0.fParamN; + fParamP = v0.fParamP; + fEffMass = v0.fEffMass; + fDcaV0Daughters = v0.fDcaV0Daughters; + fChi2V0 = v0.fChi2V0; + fRr = v0.fRr; + fDistSigma = v0.fDistSigma; + fChi2Before = v0.fChi2Before; + fChi2After = v0.fChi2After; + fPointAngleFi = v0.fPointAngleFi; + fPointAngleTh = v0.fPointAngleTh; + fPointAngle = v0.fPointAngle; + fPdgCode = v0.fPdgCode; + fNidx = v0.fNidx; + fPidx = v0.fPidx; + fStatus = v0.fStatus; + fNBefore = v0.fNBefore; + fNAfter = v0.fNAfter; + fOnFlyStatus = v0.fOnFlyStatus; + + for (int i=0; i<3; i++) { + fPos[i] = v0.fPos[i]; + fNmom[i] = v0.fNmom[i]; + fPmom[i] = v0.fPmom[i]; + } + for (int i=0; i<6; i++) { + fPosCov[i] = v0.fPosCov[i]; + } + for (Int_t i=0; i<2; i++) { + fNormDCAPrim[i]=v0.fNormDCAPrim[i]; + } + for (Int_t i=0;i<6;i++){ + fClusters[0][i]=v0.fClusters[0][i]; + fClusters[1][i]=v0.fClusters[1][i]; + } + for (Int_t i=0;i<3;i++){ + fAngle[i]=v0.fAngle[i]; + } + for (Int_t i=0;i<4;i++){fCausality[i]=v0.fCausality[i];} + + return *this; +} + +void AliESDv0::Copy(TObject& obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDv0 *robj = dynamic_cast(&obj); + if(!robj)return; // not an aliesesv0 + *robj = *this; +} + + AliESDv0::~AliESDv0(){ //-------------------------------------------------------------------- // Empty destructor diff --git a/STEER/AliESDv0.h b/STEER/AliESDv0.h index 8da2738ff36..0ae196dffb8 100644 --- a/STEER/AliESDv0.h +++ b/STEER/AliESDv0.h @@ -27,6 +27,8 @@ public: AliESDv0(const AliESDv0&); virtual ~AliESDv0(); + AliESDv0& operator=(const AliESDv0&); + virtual void Copy(TObject &obj) const; Double_t ChangeMassHypothesis(Int_t code=kK0Short); @@ -141,7 +143,6 @@ protected: static const AliESDV0Params fgkParams; //! resolution and likelihood parameterization private: - AliESDv0& operator=(const AliESDv0&); ClassDef(AliESDv0,4) // ESD V0 vertex }; diff --git a/STEER/AliMultiplicity.cxx b/STEER/AliMultiplicity.cxx index 960968a4e90..d3332f8fba8 100644 --- a/STEER/AliMultiplicity.cxx +++ b/STEER/AliMultiplicity.cxx @@ -96,6 +96,20 @@ AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){ return *this; } +void AliMultiplicity::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliMultiplicity *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliMultiplicity + *robj = *this; + +} + + //______________________________________________________________________ void AliMultiplicity::Duplicate(const AliMultiplicity& m){ // used by copy constructor and assignment operator diff --git a/STEER/AliMultiplicity.h b/STEER/AliMultiplicity.h index 4cef32d2183..9c5a3cc2eec 100644 --- a/STEER/AliMultiplicity.h +++ b/STEER/AliMultiplicity.h @@ -19,6 +19,7 @@ class AliMultiplicity : public TObject { Int_t* labelsL2, Int_t ns, Float_t *ts, Float_t *ps); AliMultiplicity(const AliMultiplicity& m); AliMultiplicity& operator=(const AliMultiplicity& m); + virtual void Copy(TObject &obj) const; virtual ~AliMultiplicity(); // methods to access tracklet information Int_t GetNumberOfTracklets() const {return fNtracks;} diff --git a/STEER/AliRawDataErrorLog.cxx b/STEER/AliRawDataErrorLog.cxx index a3a65db9a70..83b72cffe26 100644 --- a/STEER/AliRawDataErrorLog.cxx +++ b/STEER/AliRawDataErrorLog.cxx @@ -91,6 +91,19 @@ AliRawDataErrorLog & AliRawDataErrorLog::operator=(const AliRawDataErrorLog &sou return *this; } +void AliRawDataErrorLog::Copy(TObject &obj) const { + + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliRawDataErrorLog *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliRawDataErrorLog + *robj = *this; + +} + //_____________________________________________________________________________ Int_t AliRawDataErrorLog::Compare(const TObject *obj) const { diff --git a/STEER/AliRawDataErrorLog.h b/STEER/AliRawDataErrorLog.h index 7c6b9be49e1..32f7c978d5e 100644 --- a/STEER/AliRawDataErrorLog.h +++ b/STEER/AliRawDataErrorLog.h @@ -38,7 +38,8 @@ class AliRawDataErrorLog: public TNamed { AliRawDataErrorLog(const AliRawDataErrorLog & source); AliRawDataErrorLog & operator=(const AliRawDataErrorLog & source); virtual ~AliRawDataErrorLog() {}; - + virtual void Copy(TObject &obj) const; + Int_t GetEventNumber() const { return fEventNumber; } Int_t GetDdlID() const { return fDdlID; } ERawDataErrorLevel GetErrorLevel() const { return fErrorLevel; } -- 2.39.3