From ddfbc51acf6b3902f09df36ed175a957919adb56 Mon Sep 17 00:00:00 2001 From: hristov Date: Fri, 13 Jan 2012 10:34:05 +0000 Subject: [PATCH] Reverting the full pools implementation --- ITS/AliITStrackerMI.cxx | 24 +- ITS/AliITStrackerMI.h | 2 +- ITS/AliITStrackerSA.cxx | 13 +- STEER/CMakelibSTEERBase.pkg | 3 - STEER/ESD/AliESD.cxx | 11 +- STEER/ESD/AliESDEvent.cxx | 34 +- STEER/ESD/AliESDEvent.h | 2 +- STEER/ESD/AliESDfriend.cxx | 15 +- STEER/ESD/AliESDfriend.h | 13 +- STEER/ESD/AliESDfriendTrack.cxx | 325 ++---- STEER/ESD/AliESDfriendTrack.h | 15 +- STEER/ESD/AliESDtrack.cxx | 955 +++++++---------- STEER/ESD/AliESDtrack.h | 25 +- STEER/ESD/AliTrackPointArray.cxx | 206 ++-- STEER/ESD/AliTrackPointArray.h | 14 +- STEER/STEER/AliReconstruction.cxx | 118 +- STEER/STEER/AliReconstruction.h | 6 +- STEER/STEER/AliTracker.cxx | 7 +- STEER/STEER/AliTracker.h | 9 +- STEER/STEERBase/AliClonesPool.cxx | 90 -- STEER/STEERBase/AliClonesPool.h | 44 - STEER/STEERBase/AliExternalTrackParam.h | 2 +- STEER/STEERBase/AliPoolN.cxx | 215 ---- STEER/STEERBase/AliPoolN.h | 58 - STEER/STEERBase/AliPoolsSet.cxx | 77 -- STEER/STEERBase/AliPoolsSet.h | 57 - STEER/STEERBase/AliVParticle.cxx | 4 +- STEER/STEERBase/AliVParticle.h | 11 +- STEER/STEERBaseLinkDef.h | 4 - TPC/AliTPCclustererMI.cxx | 3 +- TPC/AliTPCseed.cxx | 14 +- TPC/AliTPCseed.h | 3 + TPC/AliTPCtrackerMI.cxx | 1303 ++++++++++++++++++----- TPC/AliTPCtrackerMI.h | 13 +- TRD/AliTRDseedV1.cxx | 14 - TRD/AliTRDseedV1.h | 2 +- TRD/AliTRDtrackerV1.cxx | 3 +- 37 files changed, 1694 insertions(+), 2020 deletions(-) delete mode 100644 STEER/STEERBase/AliClonesPool.cxx delete mode 100644 STEER/STEERBase/AliClonesPool.h delete mode 100644 STEER/STEERBase/AliPoolN.cxx delete mode 100644 STEER/STEERBase/AliPoolN.h delete mode 100644 STEER/STEERBase/AliPoolsSet.cxx delete mode 100644 STEER/STEERBase/AliPoolsSet.h diff --git a/ITS/AliITStrackerMI.cxx b/ITS/AliITStrackerMI.cxx index 6c6e8e67adf..9aac3508a23 100644 --- a/ITS/AliITStrackerMI.cxx +++ b/ITS/AliITStrackerMI.cxx @@ -58,8 +58,6 @@ #include "AliITSV0Finder.h" #include "AliITStrackerMI.h" #include "AliMathBase.h" -#include "AliClonesPool.h" -#include "AliPoolsSet.h" ClassImp(AliITStrackerMI) @@ -544,8 +542,7 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) { fTrackingPhase="Clusters2Tracks"; // - if (fPools && !fPools->GetPoolTrITS()) fPools->SetPool(new AliClonesPool("AliITStrackMI",5000), AliPoolsSet::kPoolTrITS); - // + // RS fSelectBestMIP03 = kFALSE;//AliITSReconstructor::GetRecoParam()->GetSelectBestMIP03(); fFlagFakes = AliITSReconstructor::GetRecoParam()->GetFlagFakes(); fUseImproveKalman = AliITSReconstructor::GetRecoParam()->GetUseImproveKalman(); @@ -4210,21 +4207,12 @@ void AliITStrackerMI::UpdateESDtrack(AliITStrackMI* track, ULong_t flags) const // track->UpdateESDtrack(flags); AliITStrackMI * oldtrack = (AliITStrackMI*)(track->GetESDtrack()->GetITStrack()); - AliClonesPool* poolITS = fPools ? fPools->GetPoolTrITS() : 0; - if (oldtrack) { - if (!poolITS) delete oldtrack; - else poolITS->MarkSlotFree(oldtrack); - } - AliITStrackMI* trc = 0; - if (!poolITS) trc = new AliITStrackMI(*track); - else { - trc = new ( poolITS->NextFreeSlot() ) AliITStrackMI(*track); - poolITS->RegisterClone( trc ); - } - track->GetESDtrack()->SetITStrack(trc); - // + if (oldtrack) delete oldtrack; + track->GetESDtrack()->SetITStrack(new AliITStrackMI(*track)); + // if (TMath::Abs(track->GetDnorm(1))<0.000000001){ + // printf("Problem\n"); + // } } - //------------------------------------------------------------------------ Int_t AliITStrackerMI::GetNearestLayer(const Double_t *xr) const{ // diff --git a/ITS/AliITStrackerMI.h b/ITS/AliITStrackerMI.h index 77f4b6e7f50..c5744bf3c06 100644 --- a/ITS/AliITStrackerMI.h +++ b/ITS/AliITStrackerMI.h @@ -21,7 +21,7 @@ class AliITSPlaneEff; class AliITSChannelStatus; class AliITSDetTypeRec; class AliPlaneEff; -class AliClonesPool; + #include #include "AliITStrackMI.h" diff --git a/ITS/AliITStrackerSA.cxx b/ITS/AliITStrackerSA.cxx index 8d8555b7134..f575e94c39d 100644 --- a/ITS/AliITStrackerSA.cxx +++ b/ITS/AliITStrackerSA.cxx @@ -27,7 +27,7 @@ #include #include #include -#include "AliSysInfo.h" // memory snapshots + #include "AliESDEvent.h" #include "AliESDVertex.h" #include "AliESDtrack.h" @@ -40,8 +40,6 @@ #include "AliITSReconstructor.h" #include "AliLog.h" #include "AliRun.h" -#include "AliClonesPool.h" -#include "AliPoolsSet.h" ClassImp(AliITStrackerSA) @@ -130,12 +128,9 @@ Int_t AliITStrackerSA::Clusters2Tracks(AliESDEvent *event){ // is done in the ITS only. In the standard reconstruction chain this option // can be set via AliReconstruction::SetOption("ITS","onlyITS") Int_t rc=0; - if (fPools && !fPools->GetPoolTrITS()) fPools->SetPool(new AliClonesPool("AliITStrackMI",5000), AliPoolsSet::kPoolTrITS); - // - static int eventNr = 0; + if(!fITSStandAlone){ rc=AliITStrackerMI::Clusters2Tracks(event); - AliSysInfo::AddStamp(Form("TracMI_%d",eventNr), -1,1,-1); } else { AliDebug(1,"Stand Alone flag set: doing tracking in ITS alone\n"); @@ -150,7 +145,6 @@ Int_t AliITStrackerSA::Clusters2Tracks(AliESDEvent *event){ rc=FindTracks(event,kTRUE); } } - eventNr++; return rc; } @@ -207,7 +201,6 @@ void AliITStrackerSA::ResetForFinding(){ Int_t AliITStrackerSA::FindTracks(AliESDEvent* event, Bool_t useAllClusters){ // Track finder using the ESD object - static int eventNr = 0; AliDebug(2,Form(" field is %f",event->GetMagneticField())); AliDebug(2,Form("SKIPPING %d %d %d %d %d %d",ForceSkippingOfLayer(0),ForceSkippingOfLayer(1),ForceSkippingOfLayer(2),ForceSkippingOfLayer(3),ForceSkippingOfLayer(4),ForceSkippingOfLayer(5))); @@ -457,8 +450,6 @@ Int_t AliITStrackerSA::FindTracks(AliESDEvent* event, Bool_t useAllClusters){ if(!useAllClusters) AliInfo(Form("Number of found tracks: %d",event->GetNumberOfTracks())); ResetForFinding(); - AliSysInfo::AddStamp(Form("TracSA_%d",eventNr), useAllClusters ? 1:0,1,-1); - eventNr++; return 0; } diff --git a/STEER/CMakelibSTEERBase.pkg b/STEER/CMakelibSTEERBase.pkg index eef729f2cff..e9450ba8c49 100644 --- a/STEER/CMakelibSTEERBase.pkg +++ b/STEER/CMakelibSTEERBase.pkg @@ -76,9 +76,6 @@ set ( SRCS STEERBase/TTreeStream.cxx STEERBase/AliVMFT.cxx STEERBase/AliTPCdEdxInfo.cxx - STEERBase/AliPoolN.cxx - STEERBase/AliClonesPool.cxx - STEERBase/AliPoolsSet.cxx ) string(REPLACE ".cxx" ".h" HDRS "${SRCS}") diff --git a/STEER/ESD/AliESD.cxx b/STEER/ESD/AliESD.cxx index e25f6992112..c88e5598ea7 100644 --- a/STEER/ESD/AliESD.cxx +++ b/STEER/ESD/AliESD.cxx @@ -415,10 +415,9 @@ Bool_t AliESD::RemoveTrack(Int_t rm) { if (rm==last) return kTRUE; - // RS: Attention: semi-shalow copy is used: the new track will steal the dynamic content of old one AliESDtrack *t=GetTrack(last); t->SetID(rm); - new (a[rm]) AliESDtrack(t, kTRUE); // detach dynamic content of the source + new (a[rm]) AliESDtrack(*t); delete a.RemoveAt(last); @@ -622,9 +621,11 @@ void AliESD::GetESDfriend(AliESDfriend *ev) const { for (Int_t i=0; iGetFriendTrack(); - ev->AddTrackShallow(f); - t->ReleaseESDfriendTrackGently();// Not to have two copies of "friendTrack" + const AliESDfriendTrack *f=t->GetFriendTrack(); + ev->AddTrack(f); + + t->ReleaseESDfriendTrack();// Not to have two copies of "friendTrack" + } } diff --git a/STEER/ESD/AliESDEvent.cxx b/STEER/ESD/AliESDEvent.cxx index 8ffa41ccb60..3b1144aa0e3 100644 --- a/STEER/ESD/AliESDEvent.cxx +++ b/STEER/ESD/AliESDEvent.cxx @@ -495,14 +495,14 @@ void AliESDEvent::ResetStdContent() if(fEMCALTrigger)fEMCALTrigger->DeAllocate(); if(fSPDPileupVertices)fSPDPileupVertices->Delete(); if(fTrkPileupVertices)fTrkPileupVertices->Delete(); - if(fTracks) fTracks->Clear("C"); // Delete(); + if(fTracks)fTracks->Delete(); if(fMuonTracks)fMuonTracks->Delete(); if(fPmdTracks)fPmdTracks->Delete(); if(fTrdTracks)fTrdTracks->Delete(); if(fTrdTracklets)fTrdTracklets->Delete(); - if(fV0s)fV0s->Clear(); // not dynamic // Delete(); - if(fCascades)fCascades->Clear(); // not dynamic // Delete(); - if(fKinks)fKinks->Clear(); // not dynamyc //Delete(); + if(fV0s)fV0s->Delete(); + if(fCascades)fCascades->Delete(); + if(fKinks)fKinks->Delete(); if(fCaloClusters)fCaloClusters->Delete(); if(fPHOSCells)fPHOSCells->DeleteContainer(); if(fEMCALCells)fEMCALCells->DeleteContainer(); @@ -762,16 +762,17 @@ Bool_t AliESDEvent::RemoveTrack(Int_t rm) const { } } - // Replace the removed track with the last track + + + //Replace the removed track with the last track TClonesArray &a=*fTracks; delete a.RemoveAt(rm); if (rm==last) return kTRUE; - // RS: Attention: semi-shalow copy is used: the new track will steal the dynamic content of old one AliESDtrack *t=GetTrack(last); t->SetID(rm); - new (a[rm]) AliESDtrack(t, kTRUE); // detach dynamic content of the source + new (a[rm]) AliESDtrack(*t); delete a.RemoveAt(last); @@ -1157,15 +1158,6 @@ void AliESDEvent::SetACORDEData(AliESDACORDE * obj) *fESDACORDE = *obj; } -void AliESDEvent::DetachFriends() const -{ - // clean friend track pointers of ESDtracks - Int_t ntrk=GetNumberOfTracks(); - for (Int_t i=0; iReleaseESDfriendTrackGently(); - } -} void AliESDEvent::GetESDfriend(AliESDfriend *ev) const { @@ -1178,9 +1170,11 @@ void AliESDEvent::GetESDfriend(AliESDfriend *ev) const for (Int_t i=0; iGetFriendTrack(); - ev->AddTrackShallow(f); - t->ReleaseESDfriendTrackGently();// Not to have two copies of "friendTrack" + const AliESDfriendTrack *f=t->GetFriendTrack(); + ev->AddTrack(f); + + t->ReleaseESDfriendTrack();// Not to have two copies of "friendTrack" + } AliESDfriend *fr = (AliESDfriend*)(const_cast(this)->FindListObject("AliESDfriend")); @@ -1364,7 +1358,7 @@ void AliESDEvent::WriteToTree(TTree* tree) const { TString branchname; TIter next(fESDObjects); const Int_t kSplitlevel = 99; // default value in TTree::Branch() - const Int_t kBufsize = 32000/4; // default value in TTree::Branch() + const Int_t kBufsize = 32000; // default value in TTree::Branch() TObject *obj = 0; while ((obj = next())) { diff --git a/STEER/ESD/AliESDEvent.h b/STEER/ESD/AliESDEvent.h index c8a694d353d..acae513d146 100644 --- a/STEER/ESD/AliESDEvent.h +++ b/STEER/ESD/AliESDEvent.h @@ -262,7 +262,7 @@ public: void SetESDfriend(const AliESDfriend *f) const; void GetESDfriend(AliESDfriend *f) const; - void DetachFriends() const; + void SetPrimaryVertexTPC(const AliESDVertex *vertex); diff --git a/STEER/ESD/AliESDfriend.cxx b/STEER/ESD/AliESDfriend.cxx index 1b0b4d407a8..41280b36032 100644 --- a/STEER/ESD/AliESDfriend.cxx +++ b/STEER/ESD/AliESDfriend.cxx @@ -66,24 +66,15 @@ AliESDfriend& AliESDfriend::operator=(const AliESDfriend& esd) return *this; } -void AliESDfriend::Clear(Option_t*) { - // - // Destructor - // - fTracks.Clear("C"); - delete fESDVZEROfriend; - delete fESDTZEROfriend; - fESDVZEROfriend = 0; - fESDTZEROfriend = 0; - TObject::Clear(); -} AliESDfriend::~AliESDfriend() { // // Destructor // - Clear(); + fTracks.Delete(); + delete fESDVZEROfriend; + delete fESDTZEROfriend; } diff --git a/STEER/ESD/AliESDfriend.h b/STEER/ESD/AliESDfriend.h index 2ac361675aa..498ce5f25b8 100644 --- a/STEER/ESD/AliESDfriend.h +++ b/STEER/ESD/AliESDfriend.h @@ -32,20 +32,10 @@ public: new(fTracks[fTracks.GetEntriesFast()]) AliESDfriendTrack(*t); } - void AddTrackShallow(AliESDfriendTrack *t) { - // steal dynamic content - new(fTracks[fTracks.GetEntriesFast()]) AliESDfriendTrack(t,kTRUE); - } - void AddTrackAt(const AliESDfriendTrack *t, Int_t i) { new(fTracks[i]) AliESDfriendTrack(*t); } - void AddTrackShallowAt(AliESDfriendTrack *t, Int_t i) { - // steal dynamic content - new(fTracks[i]) AliESDfriendTrack(t,kTRUE); - } - void SetVZEROfriend(AliESDVZEROfriend * obj); AliESDVZEROfriend *GetVZEROfriend(){ return fESDVZEROfriend; } void SetTZEROfriend(AliESDTZEROfriend * obj); @@ -58,8 +48,7 @@ public: // bit manipulation for filtering void SetSkipBit(Bool_t skip){SetBit(23,skip);} Bool_t TestSkipBit() {return TestBit(23);} - virtual void Clear(Option_t* opt=0); - // + protected: TClonesArray fTracks; // ESD friend tracks AliESDVZEROfriend *fESDVZEROfriend; // VZERO object containing complete raw data diff --git a/STEER/ESD/AliESDfriendTrack.cxx b/STEER/ESD/AliESDfriendTrack.cxx index 3352f290805..5c7c934f21b 100644 --- a/STEER/ESD/AliESDfriendTrack.cxx +++ b/STEER/ESD/AliESDfriendTrack.cxx @@ -23,13 +23,9 @@ #include "TObjArray.h" #include "TClonesArray.h" #include "AliKalmanTrack.h" -#include "AliPoolsSet.h" ClassImp(AliESDfriendTrack) - -AliPoolsSet* AliESDfriendTrack::fgPools = 0; - AliESDfriendTrack::AliESDfriendTrack(): TObject(), f1P(0), @@ -83,287 +79,146 @@ fTRDIn(0) // Copy constructor // AliDebug(2,"Calling copy constructor"); - AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; + Int_t i; if (fnMaxITScluster != 0){ - fITSindex = poolN ? poolN->BookI(fnMaxITScluster,&fITSindex) : new Int_t[fnMaxITScluster]; - for (i=fnMaxITScluster; i--;) fITSindex[i]=t.fITSindex[i]; + fITSindex = new Int_t[fnMaxITScluster]; + for (i=0; iBookI(fnMaxTPCcluster,&fTPCindex) : new Int_t[fnMaxTPCcluster]; - for (i=fnMaxTPCcluster; i--;) fTPCindex[i]=t.fTPCindex[i]; + fTPCindex = new Int_t[fnMaxTPCcluster]; + for (i=0; iBookI(fnMaxTRDcluster,&fTRDindex) : new Int_t[fnMaxTRDcluster]; - for (i=fnMaxTRDcluster; i--;) fTRDindex[i]=t.fTRDindex[i]; + fTRDindex = new Int_t[fnMaxTRDcluster]; + for (i=0; iSetOwner(kFALSE); //RS !!! objects are owned by pools Int_t no=t.fCalibContainer->GetEntriesFast(); for (i=0; iAt(i); - if (o) { - TObject* ocl = o->Clone(); - fCalibContainer->AddLast(ocl); - // RS: Special treatment for CalibContainer objects: we don't know at which pool (if any) the - // object was created, so we have to create the clone outside of any pool - if (ocl->InheritsFrom("AliExternalTrackParam")) ((AliExternalTrackParam*)ocl)->SetPoolID(-1); - else ocl->SetUniqueID(0); - } + if (o) fCalibContainer->AddLast(o->Clone()); } } - // - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - AliClonesPool* poolTPA = fgPools ? fgPools->GetPoolTrPoints() : 0; - if (t.fPoints) { - if (poolTPA) {fPoints = new(poolTPA->NextFreeSlot()) AliTrackPointArray(*t.fPoints); poolTPA->RegisterClone(fPoints);} - else fPoints = new AliTrackPointArray(*t.fPoints); - } - if (poolETP) { - if (t.fTPCOut) {fTPCOut = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*(t.fTPCOut)); poolETP->RegisterClone(fTPCOut);} - if (t.fITSOut) {fITSOut = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*(t.fITSOut)); poolETP->RegisterClone(fITSOut);} - if (t.fTRDIn) {fTRDIn = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*(t.fTRDIn)); poolETP->RegisterClone(fTRDIn);} - } - else { - if (t.fTPCOut) fTPCOut = new AliExternalTrackParam(*(t.fTPCOut)); - if (t.fITSOut) fITSOut = new AliExternalTrackParam(*(t.fITSOut)); - if (t.fTRDIn) fTRDIn = new AliExternalTrackParam(*(t.fTRDIn)); - } -} -//__________________________________________________________________ -AliESDfriendTrack::AliESDfriendTrack(AliESDfriendTrack *t, Bool_t detach): -TObject(*t), -f1P(t->f1P), -fnMaxITScluster(t->fnMaxITScluster), -fnMaxTPCcluster(t->fnMaxTPCcluster), -fnMaxTRDcluster(t->fnMaxTRDcluster), -fITSindex(0x0), -fTPCindex(0x0), -fTRDindex(0x0), -fPoints(0), -fCalibContainer(0), -fITStrack(0), -fTRDtrack(0), -fTPCOut(0), -fITSOut(0), -fTRDIn(0) -{ - // - // Semi-shallow copy constructor: pointers of dynamic content is simply transfered, if detach is true the pointers of source are set to 0 - // - AliDebug(2,"Calling semi-shallow copy constructor"); - if (fnMaxITScluster != 0) fITSindex = t->fITSindex; - if (fnMaxTPCcluster != 0) fTPCindex = t->fTPCindex; - if (fnMaxTRDcluster != 0) fTRDindex = t->fTRDindex; - // - AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster)); - AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster)); - AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster)); - // - if (t->fCalibContainer) fCalibContainer = t->fCalibContainer; - // - if (t->fPoints) fPoints = t->fPoints; - // - if (t->fTPCOut) fTPCOut = t->fTPCOut; - if (t->fITSOut) fITSOut = t->fITSOut; - if (t->fTRDIn) fTRDIn = t->fTRDIn; - // - if (detach) { - t->fITSindex = t->fTPCindex = t->fTRDindex = 0; - t->fnMaxITScluster = t->fnMaxTPCcluster = t->fnMaxTRDcluster = 0; - t->fCalibContainer = 0; - t->fPoints = 0; - t->fTPCOut = t->fITSOut = t->fTRDIn = 0; - } - // + if (t.fTPCOut) fTPCOut = new AliExternalTrackParam(*(t.fTPCOut)); + if (t.fITSOut) fITSOut = new AliExternalTrackParam(*(t.fITSOut)); + if (t.fTRDIn) fTRDIn = new AliExternalTrackParam(*(t.fTRDIn)); + } - -AliESDfriendTrack::~AliESDfriendTrack() -{ +AliESDfriendTrack::~AliESDfriendTrack() { // // Simple destructor // - Clear(); + delete fPoints; + if (fCalibContainer) fCalibContainer->Delete(); + delete fCalibContainer; + delete fITStrack; + delete fTRDtrack; + delete fTPCOut; + delete fITSOut; + delete fTRDIn; + delete[] fITSindex; + delete[] fTPCindex; + delete[] fTRDindex; } -void AliESDfriendTrack::Clear(Option_t*) -{ - // clear dynamical part - if (fCalibContainer) { - int n = fCalibContainer->GetEntriesFast(); - for (int i=0;i<=n;i++) { - TObject* obj = fCalibContainer->RemoveAt(i); - if (!obj) continue; - // was it created in the pool? - if (fgPools) { - int poolID = (obj->InheritsFrom("AliExternalTrackParam")) ? ((AliExternalTrackParam*)obj)->GetPoolID() : obj->GetUniqueID()-1; - if (poolID<0) delete obj; // not in the pool. those which are in the pool will be deleted on pool reset - } - else delete obj; - } - delete fCalibContainer; - fCalibContainer = 0; - } - // - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - AliClonesPool* poolTPA = fgPools ? fgPools->GetPoolTrPoints() : 0; - AliClonesPool* poolITS = fgPools ? fgPools->GetPoolTrITS() : 0; - AliClonesPool* poolTRD = fgPools ? fgPools->GetPoolTrTRD() : 0; - AliPoolN * poolN = fgPools ? fgPools->GetPoolN() : 0; - // - if (!poolTPA) delete fPoints; - else if (!poolTPA->IsReset()) poolTPA->MarkSlotFree(fPoints); - fPoints = 0; - // - if (!poolETP) { // during reco these objects are stored in AliReconstruction pools - delete fTPCOut; - delete fITSOut; - delete fTRDIn; - } - else if (!poolETP->IsReset()) { - poolETP->MarkSlotFree(fTPCOut); - poolETP->MarkSlotFree(fITSOut); - poolETP->MarkSlotFree(fTRDIn); - } - fTPCOut = fITSOut = fTRDIn = 0; - // - if (!poolITS) delete fITStrack; - else if (!poolITS->IsReset()) poolITS->MarkSlotFree(fITStrack); - fITStrack = 0; - // - if (!poolTRD) delete fTRDtrack; - else if (!poolTRD->IsReset()) poolTRD->MarkSlotFree(fTRDtrack); // no TRD tracks? - fTRDtrack = 0; - // - // - if (!poolETP) { - delete[] fITSindex; - delete[] fTPCindex; - delete[] fTRDindex; - } - else if (!poolN->IsReset()) { - if (fITSindex) poolN->FreeSlot(&fITSindex); - if (fTPCindex) poolN->FreeSlot(&fTPCindex); - if (fTRDindex) poolN->FreeSlot(&fTRDindex); - } - fITSindex = fTPCindex = fTRDindex = 0; - // - TObject::Clear(); -} -void AliESDfriendTrack::AddCalibObject(TObject * calibObject) -{ +void AliESDfriendTrack::AddCalibObject(TObject * calibObject){ + // // add calibration object to array - // track is owner of the objects in the container // - if (!fCalibContainer) fCalibContainer = new TObjArray(5); //RS!!! container does not own its objects + if (!fCalibContainer) fCalibContainer = new TObjArray(5); fCalibContainer->AddLast(calibObject); } -TObject * AliESDfriendTrack::GetCalibObject(Int_t index) -{ - // get object +TObject * AliESDfriendTrack::GetCalibObject(Int_t index){ + // + // + // if (!fCalibContainer) return 0; if (index>=fCalibContainer->GetEntriesFast()) return 0; return fCalibContainer->At(index); } -void AliESDfriendTrack::SetTPCOut(const AliExternalTrackParam ¶m) -{ +void AliESDfriendTrack::SetTPCOut(const AliExternalTrackParam ¶m) { + // // backup TPC out track // - if (fTPCOut) {*fTPCOut = param; return;} - // - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - if (poolETP) {fTPCOut = new(poolETP->NextFreeSlot()) AliExternalTrackParam(param); poolETP->RegisterClone(fTPCOut);} - else fTPCOut = new AliExternalTrackParam(param); - // + delete fTPCOut; + fTPCOut=new AliExternalTrackParam(param); } - -void AliESDfriendTrack::SetITSOut(const AliExternalTrackParam ¶m) -{ - // backup ITS out track - // - if (fITSOut) {*fITSOut = param; return;} +void AliESDfriendTrack::SetITSOut(const AliExternalTrackParam ¶m) { // - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - if (poolETP) {fITSOut = new(poolETP->NextFreeSlot()) AliExternalTrackParam(param); poolETP->RegisterClone(fITSOut);} - else fITSOut = new AliExternalTrackParam(param); + // backup ITS out track // + delete fITSOut; + fITSOut=new AliExternalTrackParam(param); } - -void AliESDfriendTrack::SetTRDIn(const AliExternalTrackParam ¶m) -{ - // backup TRD in track +void AliESDfriendTrack::SetTRDIn(const AliExternalTrackParam ¶m) { // - if (fTRDIn) {*fTRDIn = param; return;} + // backup TRD in track // - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - if (poolETP) {fTRDIn = new(poolETP->NextFreeSlot()) AliExternalTrackParam(param); poolETP->RegisterClone(fTRDIn);} - else fTRDIn = new AliExternalTrackParam(param); - // + delete fTRDIn; + fTRDIn=new AliExternalTrackParam(param); } -void AliESDfriendTrack::SetITSIndices(Int_t* indices, Int_t n) -{ - // - // setting fITSindex - // instantiating the pointer if still NULL - // - if ( !(fITSindex && (fnMaxITScluster==n)) ) { - fnMaxITScluster = n; - AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; - // - if (fITSindex) poolN ? poolN->FreeSlot(&fITSindex) : delete[] fITSindex; fITSindex = 0; - if (poolN) fITSindex = poolN->BookI(fnMaxITScluster,&fITSindex); - else fITSindex = new Int_t[fnMaxITScluster]; - } - AliDebug(2,Form("fnMaxITScluster = %d",n)); - for (Int_t i=fnMaxITScluster; i--;) fITSindex[i] = indices[i]; +void AliESDfriendTrack::SetITSIndices(Int_t* indices, Int_t n){ + + // + // setting fITSindex + // instantiating the pointer if still NULL + // + + fnMaxITScluster = n; + AliDebug(2,Form("fnMaxITScluster = %d",fnMaxITScluster)); + if (fITSindex == 0x0){ + fITSindex = new Int_t[fnMaxITScluster]; + } + for (Int_t i = 0; i < fnMaxITScluster; i++){ + fITSindex[i] = indices[i]; + } } -void AliESDfriendTrack::SetTPCIndices(Int_t* indices, Int_t n) -{ - // - // setting fTPCindex - // instantiating the pointer if still NULL - // - if ( !(fTPCindex && (fnMaxTPCcluster==n)) ) { - fnMaxTPCcluster = n; - AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; - // - if (fTPCindex) poolN ? poolN->FreeSlot(&fTPCindex) : delete[] fTPCindex; fTPCindex = 0; - if (poolN) fTPCindex = poolN->BookI(fnMaxTPCcluster,&fTPCindex); - else fTPCindex = new Int_t[fnMaxTPCcluster]; - } - AliDebug(2,Form("fnMaxTPCcluster = %d",n)); - for (Int_t i=fnMaxTPCcluster; i--;) fTPCindex[i] = indices[i]; - // +void AliESDfriendTrack::SetTPCIndices(Int_t* indices, Int_t n){ + + // + // setting fTPCindex + // instantiating the pointer if still NULL + // + + fnMaxTPCcluster = n; + AliDebug(2,Form("fnMaxTPCcluster = %d",fnMaxTPCcluster)); + if (fTPCindex == 0x0){ + fTPCindex = new Int_t[fnMaxTPCcluster]; + } + for (Int_t i = 0; i < fnMaxTPCcluster; i++){ + fTPCindex[i] = indices[i]; + } } -void AliESDfriendTrack::SetTRDIndices(Int_t* indices, Int_t n) -{ - // setting fTRDindex - // instantiating the pointer if still NULL - // - if ( !(fTRDindex && (fnMaxTRDcluster==n)) ) { - fnMaxTRDcluster = n; - AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; - // - if (fTRDindex) poolN ? poolN->FreeSlot(&fTRDindex) : delete[] fTRDindex; fTRDindex = 0; - if (poolN) fTRDindex = poolN->BookI(fnMaxTRDcluster,&fTRDindex); - else fTRDindex = new Int_t[fnMaxTRDcluster]; - } - AliDebug(2,Form("fnMaxTRDcluster = %d",n)); - for (Int_t i=fnMaxTRDcluster; i--;) fTRDindex[i] = indices[i]; - // +void AliESDfriendTrack::SetTRDIndices(Int_t* indices, Int_t n){ + + // + // setting fTRDindex + // instantiating the pointer if still NULL + // + + fnMaxTRDcluster = n; + AliDebug(2,Form("fnMaxTRDcluster = %d",fnMaxTRDcluster)); + if (fTRDindex == 0x0){ + fTRDindex = new Int_t[fnMaxTRDcluster]; + } + for (Int_t i = 0; i < fnMaxTRDcluster; i++){ + fTRDindex[i] = indices[i]; + } } diff --git a/STEER/ESD/AliESDfriendTrack.h b/STEER/ESD/AliESDfriendTrack.h index 88906026a6c..b0f3033ec05 100644 --- a/STEER/ESD/AliESDfriendTrack.h +++ b/STEER/ESD/AliESDfriendTrack.h @@ -11,7 +11,6 @@ #include #include -class AliPoolsSet; class AliTrackPointArray; class AliKalmanTrack; class TObjArrray; @@ -25,7 +24,6 @@ public: }; AliESDfriendTrack(); AliESDfriendTrack(const AliESDfriendTrack &t); - AliESDfriendTrack(AliESDfriendTrack *t, Bool_t detach); virtual ~AliESDfriendTrack(); void Set1P(Float_t p) {f1P=p;} @@ -66,12 +64,7 @@ public: // bit manipulation for filtering void SetSkipBit(Bool_t skip){SetBit(23,skip);} Bool_t TestSkipBit() {return TestBit(23);} - // - virtual void Clear(Option_t* opt=""); - // - static void SetPools(AliPoolsSet* p) {fgPools = p;} - static AliPoolsSet* GetPools() {return fgPools;} - // + protected: Float_t f1P; // 1/P (1/(GeV/c)) Int_t fnMaxITScluster; // Max number of ITS clusters @@ -90,13 +83,11 @@ protected: AliExternalTrackParam * fTPCOut; // tpc outer parameters AliExternalTrackParam * fITSOut; // its outer parameters AliExternalTrackParam * fTRDIn; // trd inner parameters - // - static AliPoolsSet* fgPools; // set of pools - // + private: AliESDfriendTrack &operator=(const AliESDfriendTrack & /* t */) {return *this;} - ClassDef(AliESDfriendTrack,7) //ESD friend track + ClassDef(AliESDfriendTrack,6) //ESD friend track }; #endif diff --git a/STEER/ESD/AliESDtrack.cxx b/STEER/ESD/AliESDtrack.cxx index 9ddfbcef3cc..f6c75e51d25 100644 --- a/STEER/ESD/AliESDtrack.cxx +++ b/STEER/ESD/AliESDtrack.cxx @@ -128,12 +128,9 @@ #include "TPolyMarker3D.h" #include "AliTrackerBase.h" #include "AliTPCdEdxInfo.h" -#include "AliPoolsSet.h" ClassImp(AliESDtrack) -AliPoolsSet* AliESDtrack::fgPools = 0; - void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) { // This function copies "n" PID weights from "scr" to "dest" // and normalizes their sum to 1 thus producing conditional probabilities. @@ -243,14 +240,11 @@ AliESDtrack::AliESDtrack() : // // The default ESD constructor // - if (!OnlineMode()) { - AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; - if (poolFr) { fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(); poolFr->RegisterClone(fFriendTrack);} - else fFriendTrack = new AliESDfriendTrack(); - } - // - for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0; - for (int i=AliPID::kSPECIES;i--;) { + if (!OnlineMode()) fFriendTrack=new AliESDfriendTrack(); + + Int_t i; + for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0; + for (i=0; iGetPoolN() : 0; - if (fTRDnSlices) { - if (poolN) fTRDslices = poolN->BookD32(fTRDnSlices,&fTRDslices); - else fTRDslices = new Double32_t[fTRDnSlices]; - for (Int_t i=fTRDnSlices;i--;) fTRDslices[i] = track.fTRDslices[i]; - } + for (Int_t i=0;iGetPoolExtTrPar() : 0; - if (poolETP) { - if (track.fCp) {fCp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fCp); poolETP->RegisterClone(fCp);} - if (track.fIp) {fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fIp); poolETP->RegisterClone(fIp);} - if (track.fOp) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fOp); poolETP->RegisterClone(fOp);} - if (track.fHMPIDp) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fHMPIDp); poolETP->RegisterClone(fHMPIDp);} - if (track.fTPCInner) {fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fTPCInner); poolETP->RegisterClone(fTPCInner);} - } - else { - if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp); - if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp); - if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp); - if (track.fHMPIDp) fHMPIDp=new AliExternalTrackParam(*track.fHMPIDp); - if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner); - } + for (Int_t i=0;iGetPoolTPCdEdx() : 0; - if (pooldEdx) {fTPCdEdxInfo = new(pooldEdx->NextFreeSlot()) AliTPCdEdxInfo(*track.fTPCdEdxInfo); pooldEdx->RegisterClone(fTPCdEdxInfo);} - else fTPCdEdxInfo = new AliTPCdEdxInfo(*track.fTPCdEdxInfo); - } + for (Int_t i=0;iGetPoolTrFriend() : 0; - if (poolFr) {fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(*(track.fFriendTrack)); poolFr->RegisterClone(fFriendTrack);} - else fFriendTrack = new AliESDfriendTrack(*(track.fFriendTrack)); + for (Int_t i=0;ifTPCFitMap), - fTPCClusterMap(track->fTPCClusterMap), - fTPCSharedMap(track->fTPCSharedMap), - fFlags(track->fFlags), - fID(track->fID), - fLabel(track->fLabel), - fITSLabel(track->fITSLabel), - fTPCLabel(track->fTPCLabel), - fTRDLabel(track->fTRDLabel), - fTOFCalChannel(track->fTOFCalChannel), - fTOFindex(track->fTOFindex), - fHMPIDqn(track->fHMPIDqn), - fHMPIDcluIdx(track->fHMPIDcluIdx), - fCaloIndex(track->fCaloIndex), - fHMPIDtrkTheta(track->fHMPIDtrkTheta), - fHMPIDtrkPhi(track->fHMPIDtrkPhi), - fHMPIDsignal(track->fHMPIDsignal), - fTrackLength(track->fTrackLength), - fdTPC(track->fdTPC),fzTPC(track->fzTPC), - fCddTPC(track->fCddTPC),fCdzTPC(track->fCdzTPC),fCzzTPC(track->fCzzTPC), - fCchi2TPC(track->fCchi2TPC), - fD(track->fD),fZ(track->fZ), - fCdd(track->fCdd),fCdz(track->fCdz),fCzz(track->fCzz), - fCchi2(track->fCchi2), - fITSchi2(track->fITSchi2), - fTPCchi2(track->fTPCchi2), - fTPCchi2Iter1(track->fTPCchi2Iter1), - fTRDchi2(track->fTRDchi2), - fTOFchi2(track->fTOFchi2), - fHMPIDchi2(track->fHMPIDchi2), - fGlobalChi2(track->fGlobalChi2), - fITSsignal(track->fITSsignal), - fTPCsignal(track->fTPCsignal), - fTPCsignalS(track->fTPCsignalS), - fTPCdEdxInfo(0), - fTRDsignal(track->fTRDsignal), - fTRDQuality(track->fTRDQuality), - fTRDBudget(track->fTRDBudget), - fTOFsignal(track->fTOFsignal), - fTOFsignalToT(track->fTOFsignalToT), - fTOFsignalRaw(track->fTOFsignalRaw), - fTOFsignalDz(track->fTOFsignalDz), - fTOFsignalDx(track->fTOFsignalDx), - fTOFdeltaBC(track->fTOFdeltaBC), - fTOFl0l1(track->fTOFl0l1), - fCaloDx(track->fCaloDx), - fCaloDz(track->fCaloDz), - fHMPIDtrkX(track->fHMPIDtrkX), - fHMPIDtrkY(track->fHMPIDtrkY), - fHMPIDmipX(track->fHMPIDmipX), - fHMPIDmipY(track->fHMPIDmipY), - fTPCncls(track->fTPCncls), - fTPCnclsF(track->fTPCnclsF), - fTPCsignalN(track->fTPCsignalN), - fTPCnclsIter1(track->fTPCnclsIter1), - fTPCnclsFIter1(track->fTPCnclsIter1), - fITSncls(track->fITSncls), - fITSClusterMap(track->fITSClusterMap), - fITSSharedMap(track->fITSSharedMap), - fTRDncls(track->fTRDncls), - fTRDncls0(track->fTRDncls0), - fTRDntracklets(track->fTRDntracklets), - fTRDnSlices(track->fTRDnSlices), - fTRDslices(0x0), - fVertexID(track->fVertexID), - fESDEvent(track->fESDEvent), - fCacheNCrossedRows(track->fCacheNCrossedRows), - fCacheChi2TPCConstrainedVsGlobal(track->fCacheChi2TPCConstrainedVsGlobal), - fCacheChi2TPCConstrainedVsGlobalVertex(track->fCacheChi2TPCConstrainedVsGlobalVertex) -{ - // - //semi-shallow copy constructor with transfer of most of pointers of the source. When detach is true, the dynamic content of - //of source is set to 0 w/o deletion - // - for (Int_t i=kNITSchi2Std;i--;) fITSchi2Std[i] = track->fTrackTime[i]; - for (Int_t i=AliPID::kSPECIES;i--;) { - fTrackTime[i]=track->fTrackTime[i]; - fR[i]=track->fR[i]; - fITSr[i]=track->fITSr[i]; - fTPCr[i]=track->fTPCr[i]; - } - for (Int_t i=4;i--;) fITSdEdxSamples[i]=track->fITSdEdxSamples[i]; - for (Int_t i=4;i--;) fTPCPoints[i]=track->fTPCPoints[i]; - for (Int_t i=3;i--;) fKinkIndexes[i]=track->fKinkIndexes[i]; - for (Int_t i=3;i--;) fV0Indexes[i]=track->fV0Indexes[i]; - // - for (Int_t i=kTRDnPlanes;i--;) fTRDTimBin[i]=track->fTRDTimBin[i]; - if (fTRDnSlices) fTRDslices = track->fTRDslices; - // - for (Int_t i=AliPID::kSPECIES;i--;) { - fTRDr[i]=track->fTRDr[i]; - fTOFr[i]=track->fTOFr[i]; - fHMPIDr[i]=track->fHMPIDr[i]; - } - for (Int_t i=3;i--;) fTOFLabel[i]=track->fTOFLabel[i]; - for (Int_t i=10;i--;) fTOFInfo[i]=track->fTOFInfo[i]; - for (Int_t i=12;i--;) fITSModule[i]=track->fITSModule[i]; - - if (track->fCp) fCp = track->fCp; - if (track->fIp) fIp = track->fIp; - if (track->fOp) fOp = track->fOp; - if (track->fTPCInner) fTPCInner = track->fTPCInner; - if (track->fHMPIDp) fHMPIDp = track->fHMPIDp; - // - if (track->fTPCdEdxInfo) fTPCdEdxInfo = track->fTPCdEdxInfo; - // - if (track->fFriendTrack) fFriendTrack = track->fFriendTrack; - // - if (detach) { - track->fTRDslices = 0; - track->fTRDnSlices = 0; - track->fCp = track->fIp = track->fTPCInner = track->fOp = track->fHMPIDp = 0; - track->fTPCdEdxInfo = 0; - track->fFriendTrack = 0; + if (fTRDnSlices) { + fTRDslices=new Double32_t[fTRDnSlices]; + for (Int_t i=0; iGetID()); @@ -661,14 +513,19 @@ AliESDtrack::AliESDtrack(const AliVTrack *track) : fITSSharedMap=0; fITSncls=0; - for(int i=6;i--;) if(HasPointOnITSLayer(i)) fITSncls++; - // + for(i=0; i<6; i++) { + if(HasPointOnITSLayer(i)) fITSncls++; + } + // Set TPC ncls fTPCncls=track->GetTPCNcls(); - // + + // Set the combined PID const Double_t *pid = track->PID(); - if(pid) for (int i=AliPID::kSPECIES;i--;) fR[i]=pid[i]; + if(pid){ + for (i=0; iGetLabel()); // Set the status @@ -759,8 +616,9 @@ AliESDtrack::AliESDtrack(TParticle * part) : // // Reset all the arrays - for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0; - for (int i=AliPID::kSPECIES;i--;) { + Int_t i; + for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0; + for (i=0; iVx(),part->Vy(),part->Vz()); @@ -868,158 +728,105 @@ AliESDtrack::AliESDtrack(TParticle * part) : } -//_______________________________________________________________________ -void AliESDtrack::Clear(Option_t* ) -{ - // - // clean dynamical part - // - //printf("Delete track\n"); - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - fTPCFitMap.Clear(); - fTPCClusterMap.Clear(); - fTPCSharedMap.Clear(); - if (poolETP) { - if (fIp) poolETP->MarkSlotFree(fIp); - if (fOp) poolETP->MarkSlotFree(fOp); - if (fCp) poolETP->MarkSlotFree(fCp); - if (fTPCInner) poolETP->MarkSlotFree(fTPCInner); - if (fHMPIDp) poolETP->MarkSlotFree(fHMPIDp); - } - else { - delete fIp; - delete fTPCInner; - delete fOp; - delete fHMPIDp; - delete fCp; - } - fIp = fOp = fCp = fTPCInner = fHMPIDp = 0; - // - if (fFriendTrack) { - AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; - if (poolFr) poolFr->MarkSlotFree(fFriendTrack); - else delete fFriendTrack; - fFriendTrack = 0; - } - if (fTPCdEdxInfo) { - AliClonesPool* pooldEdx = fgPools ? fgPools->GetPoolTPCdEdx() : 0; - if (pooldEdx) pooldEdx->MarkSlotFree(fTPCdEdxInfo); - else delete fTPCdEdxInfo; - fTPCdEdxInfo = 0; - } - if(fTRDnSlices) { - AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; - if (poolN) poolN->FreeSlot(&fTRDslices); - else delete[] fTRDslices; - fTRDslices = 0; - } - - //Reset cached values - fCacheNCrossedRows = -10.; - fCacheChi2TPCConstrainedVsGlobal = -10.; - if(fCacheChi2TPCConstrainedVsGlobalVertex) fCacheChi2TPCConstrainedVsGlobalVertex = 0; - - - AliExternalTrackParam::Clear(); -} - //_______________________________________________________________________ AliESDtrack::~AliESDtrack(){ // // This is destructor according Coding Conventrions // //printf("Delete track\n"); - Clear(); -} - -//_______________________________________________________________________ -AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source) -{ + delete fIp; + delete fTPCInner; + delete fOp; + delete fHMPIDp; + delete fCp; + if (fFriendTrack) delete fFriendTrack; + if (fTPCdEdxInfo) delete fTPCdEdxInfo; + fFriendTrack=NULL; + if(fTRDnSlices) + delete[] fTRDslices; +} + +AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){ + if(&source == this) return *this; AliExternalTrackParam::operator=(source); - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - if (source.fCp) { // we have the trackparam: assign or copy construct - if (fCp) *fCp = *source.fCp; - else { - if (poolETP) {fCp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fCp); poolETP->RegisterClone(fCp);} - else fCp = new AliExternalTrackParam(*source.fCp); - } + + 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) poolETP ? poolETP->MarkSlotFree(fCp) : delete fCp; fCp = 0; + 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 { - if (poolETP) {fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fIp); poolETP->RegisterClone(fIp);} - else fIp = new AliExternalTrackParam(*source.fIp); - } + + 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) poolETP ? poolETP->MarkSlotFree(fIp) : delete fIp; fIp = 0; + 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 { - if (poolETP) {fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fTPCInner);poolETP->RegisterClone(fTPCInner);} - else fTPCInner = new AliExternalTrackParam(*source.fTPCInner); - } - } - else { // no track param delete the old one - if (fTPCInner) poolETP ? poolETP->MarkSlotFree(fTPCInner) : delete fTPCInner; fTPCInner = 0; + + + if(source.fTPCInner){ + // we have the trackparam: assign or copy construct + if(fTPCInner) *fTPCInner = *source.fTPCInner; + else fTPCInner = new AliExternalTrackParam(*source.fTPCInner); } - // - if (source.fOp) { // we have the trackparam: assign or copy construct - if (fOp) *fOp = *source.fOp; - else { - if (poolETP) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fOp); poolETP->RegisterClone(fOp);} - else fOp = new AliExternalTrackParam(*source.fOp); - } + else{ + // no track param delete the old one + if(fTPCInner)delete fTPCInner; + fTPCInner = 0; } - else { // no track param delete the old one - if (fOp) poolETP ? poolETP->MarkSlotFree(fOp) : delete fOp; fOp = 0; + + if(source.fTPCdEdxInfo) { + if(fTPCdEdxInfo) *fTPCdEdxInfo = *source.fTPCdEdxInfo; + fTPCdEdxInfo = new AliTPCdEdxInfo(*source.fTPCdEdxInfo); } - // - if (source.fHMPIDp) { // we have the trackparam: assign or copy construct - if (fHMPIDp) *fHMPIDp = *source.fHMPIDp; - else { - if (poolETP) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fHMPIDp); poolETP->RegisterClone(fHMPIDp);} - else fHMPIDp = new AliExternalTrackParam(*source.fHMPIDp); - } + + 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 (fHMPIDp) poolETP ? poolETP->MarkSlotFree(fHMPIDp) : delete fHMPIDp; fHMPIDp = 0; + else{ + // no track param delete the old one + if(fOp)delete fOp; + fOp = 0; } - // - AliClonesPool* pooldEdx = fgPools ? fgPools->GetPoolTPCdEdx() : 0; - if (source.fTPCdEdxInfo) { - if (fTPCdEdxInfo) *fTPCdEdxInfo = *source.fTPCdEdxInfo; - else { - if (pooldEdx) {fTPCdEdxInfo = new(pooldEdx->NextFreeSlot()) AliTPCdEdxInfo(*source.fTPCdEdxInfo); pooldEdx->RegisterClone(fTPCdEdxInfo);} - else fTPCdEdxInfo = new AliTPCdEdxInfo(*source.fTPCdEdxInfo); - } + + + if(source.fHMPIDp){ + // we have the trackparam: assign or copy construct + if(fHMPIDp) *fHMPIDp = *source.fHMPIDp; + else fHMPIDp = new AliExternalTrackParam(*source.fHMPIDp); } - else { // no dedx info, delete the old one - if (fTPCdEdxInfo) pooldEdx ? pooldEdx->MarkSlotFree(fTPCdEdxInfo) : delete fTPCdEdxInfo; fTPCdEdxInfo = 0; + else{ + // no track param delete the old one + if(fHMPIDp)delete fHMPIDp; + fHMPIDp = 0; } - // + // copy also the friend track // use copy constructor - AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; - if (fFriendTrack) poolFr ? poolFr->MarkSlotFree(fFriendTrack) : delete fFriendTrack; fFriendTrack= 0; - if (source.fFriendTrack) { // we have the trackparam: assign or copy construct - if (poolFr) { - fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(*source.fFriendTrack); - poolFr->RegisterClone(fFriendTrack); - } - else fFriendTrack = new AliESDfriendTrack(*source.fFriendTrack); + if(source.fFriendTrack){ + // we have the trackparam: assign or copy construct + delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack); } - // - fTPCFitMap = source.fTPCFitMap; + else{ + // no track param delete the old one + delete fFriendTrack; fFriendTrack= 0; + } + + fTPCFitMap = source.fTPCFitMap; fTPCClusterMap = source.fTPCClusterMap; fTPCSharedMap = source.fTPCSharedMap; // the simple stuff @@ -1027,22 +834,26 @@ AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source) fID = source.fID; fLabel = source.fLabel; fITSLabel = source.fITSLabel; - for(int i=12;i--;) fITSModule[i] = source.fITSModule[i]; + for(int i = 0; i< 12;++i){ + fITSModule[i] = source.fITSModule[i]; + } fTPCLabel = source.fTPCLabel; fTRDLabel = source.fTRDLabel; - for(int i=3;i--;) fTOFLabel[i] = source.fTOFLabel[i]; + for(int i = 0; i< 3;++i){ + fTOFLabel[i] = source.fTOFLabel[i]; + } fTOFCalChannel = source.fTOFCalChannel; fTOFindex = source.fTOFindex; fHMPIDqn = source.fHMPIDqn; fHMPIDcluIdx = source.fHMPIDcluIdx; fCaloIndex = source.fCaloIndex; for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = source.fITSchi2Std[i]; - for(int i=3;i--;) { + for(int i = 0; i< 3;++i){ fKinkIndexes[i] = source.fKinkIndexes[i]; fV0Indexes[i] = source.fV0Indexes[i]; } - // - for(int i=AliPID::kSPECIES;i--;) { + + for(int i = 0; i< AliPID::kSPECIES;++i){ fR[i] = source.fR[i]; fITSr[i] = source.fITSr[i]; fTPCr[i] = source.fTPCr[i]; @@ -1051,11 +862,12 @@ AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source) fHMPIDr[i] = source.fHMPIDr[i]; fTrackTime[i] = source.fTrackTime[i]; } - // + fHMPIDtrkTheta = source.fHMPIDtrkTheta; fHMPIDtrkPhi = source.fHMPIDtrkPhi; fHMPIDsignal = source.fHMPIDsignal; - // + + fTrackLength = source. fTrackLength; fdTPC = source.fdTPC; fzTPC = source.fzTPC; @@ -1063,45 +875,45 @@ AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source) fCdzTPC = source.fCdzTPC; fCzzTPC = source.fCzzTPC; fCchi2TPC = source.fCchi2TPC; - // + fD = source.fD; fZ = source.fZ; fCdd = source.fCdd; fCdz = source.fCdz; fCzz = source.fCzz; fCchi2 = source.fCchi2; - // + fITSchi2 = source.fITSchi2; fTPCchi2 = source.fTPCchi2; fTPCchi2Iter1 = source.fTPCchi2Iter1; fTRDchi2 = source.fTRDchi2; fTOFchi2 = source.fTOFchi2; fHMPIDchi2 = source.fHMPIDchi2; - // + fGlobalChi2 = source.fGlobalChi2; - // + fITSsignal = source.fITSsignal; - for (Int_t i=4;i--;) fITSdEdxSamples[i]=source.fITSdEdxSamples[i]; + for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=source.fITSdEdxSamples[i];} fTPCsignal = source.fTPCsignal; fTPCsignalS = source.fTPCsignalS; - for(int i=4;i--;) fTPCPoints[i] = source.fTPCPoints[i]; + for(int i = 0; i< 4;++i){ + fTPCPoints[i] = source.fTPCPoints[i]; + } fTRDsignal = source.fTRDsignal; - for(int i=kTRDnPlanes;i--;) fTRDTimBin[i] = source.fTRDTimBin[i]; - // - AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; - if (fTRDnSlices) { - if (poolN) poolN->FreeSlot(&fTRDslices); - else delete[] fTRDslices; - fTRDslices = 0; + + for(int i = 0;i < kTRDnPlanes;++i){ + fTRDTimBin[i] = source.fTRDTimBin[i]; } - fTRDnSlices = source.fTRDnSlices; + + if(fTRDnSlices) + delete[] fTRDslices; + fTRDslices=0; + fTRDnSlices=source.fTRDnSlices; if (fTRDnSlices) { - if (poolN) fTRDslices = poolN->BookD32(fTRDnSlices,&fTRDslices); - else fTRDslices = new Double32_t[fTRDnSlices]; - fTRDslices = new Double32_t[fTRDnSlices]; - for(int j=fTRDnSlices;j--;) fTRDslices[j] = source.fTRDslices[j]; + fTRDslices=new Double32_t[fTRDnSlices]; + for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j]; } - // + fTRDQuality = source.fTRDQuality; fTRDBudget = source.fTRDBudget; fTOFsignal = source.fTOFsignal; @@ -1111,9 +923,11 @@ AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source) fTOFsignalDx = source.fTOFsignalDx; fTOFdeltaBC = source.fTOFdeltaBC; fTOFl0l1 = source.fTOFl0l1; - // - for(int i=10;i--;) fTOFInfo[i] = source.fTOFInfo[i]; - // + + for(int i = 0;i<10;++i){ + fTOFInfo[i] = source.fTOFInfo[i]; + } + fHMPIDtrkX = source.fHMPIDtrkX; fHMPIDtrkY = source.fHMPIDtrkY; fHMPIDmipX = source.fHMPIDmipX; @@ -1132,15 +946,11 @@ AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source) fTRDncls0 = source.fTRDncls0; fTRDntracklets = source.fTRDntracklets; fVertexID = source.fVertexID; - - fCacheNCrossedRows = source.fCacheNCrossedRows; - fCacheChi2TPCConstrainedVsGlobal = source.fCacheChi2TPCConstrainedVsGlobal; - fCacheChi2TPCConstrainedVsGlobalVertex = source.fCacheChi2TPCConstrainedVsGlobalVertex; - - return *this; } + + void AliESDtrack::Copy(TObject &obj) const { // this overwrites the virtual TOBject::Copy() @@ -1154,15 +964,13 @@ void AliESDtrack::Copy(TObject &obj) const { } + + void AliESDtrack::AddCalibObject(TObject * object){ // // add calib object to the list // - if (!fFriendTrack) { - AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; - if (poolFr) { fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(); poolFr->RegisterClone(fFriendTrack);} - else fFriendTrack = new AliESDfriendTrack(); - } + if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack; if (!fFriendTrack) return; fFriendTrack->AddCalibObject(object); } @@ -1182,6 +990,8 @@ Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){ // into the passed ESDtrack object. For consistency fTPCInner is also filled // again + + // For data produced before r26675 // RelateToVertexTPC was not properly called during reco // so you'll have to call it again, before FillTPCOnlyTrack @@ -1191,7 +1001,7 @@ Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){ // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig); - if (!fTPCInner) return kFALSE; + if(!fTPCInner)return kFALSE; // fill the TPC track params to the global track parameters track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance()); @@ -1200,21 +1010,14 @@ Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){ track.fCdd = fCddTPC; track.fCdz = fCdzTPC; track.fCzz = fCzzTPC; - // - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; + // copy the inner params - if (track.fIp) *track.fIp = *fIp; - else { - if (poolETP) {track.fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*fIp); poolETP->RegisterClone(track.fIp);} - else track.fIp = new AliExternalTrackParam(*fIp); - } - // + if(track.fIp) *track.fIp = *fIp; + else track.fIp = new AliExternalTrackParam(*fIp); + // copy the TPCinner parameters - if (track.fTPCInner) *track.fTPCInner = *fTPCInner; - else { - if (poolETP) {track.fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*fTPCInner); poolETP->RegisterClone(track.fTPCInner);} - else track.fTPCInner = new AliExternalTrackParam(*fTPCInner); - } + if(track.fTPCInner) *track.fTPCInner = *fTPCInner; + else track.fTPCInner = new AliExternalTrackParam(*fTPCInner); track.fdTPC = fdTPC; track.fzTPC = fzTPC; track.fCddTPC = fCddTPC; @@ -1232,7 +1035,7 @@ Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){ track.fTPCchi2Iter1 = fTPCchi2Iter1; track.fTPCsignal = fTPCsignal; track.fTPCsignalS = fTPCsignalS; - for(int i=4;i--;) track.fTPCPoints[i] = fTPCPoints[i]; + for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i]; track.fTPCncls = fTPCncls; track.fTPCnclsF = fTPCnclsF; @@ -1241,7 +1044,7 @@ Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){ track.fTPCnclsFIter1 = fTPCnclsFIter1; // PID - for(int i=AliPID::kSPECIES;i--;){ + for(int i=0;iGetPoolExtTrPar() : 0; + for (Int_t i=0;iMarkSlotFree(fCp) : delete fCp; fCp = 0; + delete fCp;fCp = 0; + // Reset track parameters at the inner wall of TPC - if (fIp) poolETP ? poolETP->MarkSlotFree(fIp) : delete fIp; fIp = 0; - // Reset track TPC inner params - if (fTPCInner) poolETP ? poolETP->MarkSlotFree(fTPCInner) : delete fTPCInner; fTPCInner = 0; + delete fIp;fIp = 0; + delete fTPCInner;fTPCInner=0; // Reset track parameters at the inner wall of the TRD - if (fOp) poolETP ? poolETP->MarkSlotFree(fOp) : delete fOp; fOp = 0; + delete fOp;fOp = 0; // Reset track parameters at the HMPID - if (fHMPIDp) poolETP ? poolETP->MarkSlotFree(fHMPIDp) : delete fHMPIDp; fHMPIDp = 0; - // + delete fHMPIDp;fHMPIDp = 0; + + // Reset ITS track related information fITSchi2 = 0; fITSncls = 0; fITSClusterMap=0; fITSSharedMap=0; fITSsignal = 0; - for (Int_t i=4;i--;) fITSdEdxSamples[i] = 0.; - for (Int_t i=AliPID::kSPECIES;i--;) fITSr[i]=0; + for (Int_t i=0;i<4;i++) fITSdEdxSamples[i] = 0.; + for (Int_t i=0;iGetPoolN() : 0; - if (poolN) poolN->FreeSlot(&fTRDslices); - else delete[] fTRDslices; - fTRDslices = 0; - } + if(fTRDnSlices) + delete[] fTRDslices; + fTRDslices=0x0; fTRDnSlices=0; fTRDBudget = 0; @@ -1347,16 +1150,16 @@ void AliESDtrack::MakeMiniESDtrack(){ fTOFsignalDx = 999; fTOFdeltaBC = 999; fTOFl0l1 = 999; - for (Int_t i=AliPID::kSPECIES;i--;) fTOFr[i] = 0; - for (Int_t i=3;i--;) fTOFLabel[i] = -1; - for (Int_t i=10;i--;) fTOFInfo[i] = 0; + for (Int_t i=0;iGetPoolTrFriend() : 0; - poolFr ? poolFr->MarkSlotFree(fFriendTrack) : delete fFriendTrack; fFriendTrack = 0; - // + + delete fFriendTrack; fFriendTrack = 0; } //_______________________________________________________________________ Int_t AliESDtrack::GetPID() const { // Returns the particle most probable id - int i; - for (i=0;imax) {k=i; max=fR[i];} + for (i=0; imax) {k=i; max=fR[i];} // if (k==0) { // dE/dx "crossing points" in the TPC Double_t p=GetP(); @@ -1485,113 +1286,113 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ if (t->IsStartedTimeIntegral()) { SetStatus(kTIME); - Double_t times[10]; t->GetIntegratedTimes(times); SetIntegratedTimes(times); + Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times); SetIntegratedLength(t->GetIntegratedLength()); } Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); if (fFriendTrack) { - if (flags==kITSout) fFriendTrack->SetITSOut(*t); - if (flags==kTPCout) fFriendTrack->SetTPCOut(*t); - if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t); + if (flags==kITSout) fFriendTrack->SetITSOut(*t); + if (flags==kTPCout) fFriendTrack->SetTPCOut(*t); + if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t); } - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - // + switch (flags) { - // + case kITSin: fITSchi2Std[0] = t->GetChi2(); // case kITSout: fITSchi2Std[1] = t->GetChi2(); - case kITSrefit: + case kITSrefit: + { fITSchi2Std[2] = t->GetChi2(); fITSClusterMap=0; fITSncls=t->GetNumberOfClusters(); if (fFriendTrack) { - Int_t indexITS[AliESDfriendTrack::kMaxITScluster]; - for (Int_t i=AliESDfriendTrack::kMaxITScluster;i--;) { + Int_t* indexITS = new Int_t[AliESDfriendTrack::kMaxITScluster]; + for (Int_t i=0;iGetClusterIndex(i); + if (i> 28; - SETBIT(fITSClusterMap,l); + SETBIT(fITSClusterMap,l); } - } - fFriendTrack->SetITSIndices(indexITS,AliESDfriendTrack::kMaxITScluster); } - // + fFriendTrack->SetITSIndices(indexITS,AliESDfriendTrack::kMaxITScluster); + delete [] indexITS; + } + fITSchi2=t->GetChi2(); fITSsignal=t->GetPIDsignal(); fITSLabel = t->GetLabel(); // keep in fOp the parameters outside ITS for ITS stand-alone tracks if (flags==kITSout) { - if (!fOp) { - if (poolETP) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fOp);} - else fOp = new AliExternalTrackParam(*t); - } - else fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + if (!fOp) fOp=new AliExternalTrackParam(*t); + else + fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + } } break; - // + case kTPCin: case kTPCrefit: + { fTPCLabel = t->GetLabel(); if (flags==kTPCin) { - if (poolETP) { fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fTPCInner);} - else fTPCInner = new AliExternalTrackParam(*t); - fTPCnclsIter1 = t->GetNumberOfClusters(); - fTPCchi2Iter1 = t->GetChi2(); + fTPCInner=new AliExternalTrackParam(*t); + fTPCnclsIter1=t->GetNumberOfClusters(); + fTPCchi2Iter1=t->GetChi2(); } - if (!fIp) { - if (poolETP) { fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fIp);} - else fIp = new AliExternalTrackParam(*t); + if (!fIp) fIp=new AliExternalTrackParam(*t); + else + fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); } - else fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); - // // Intentionally no break statement; need to set general TPC variables as well case kTPCout: + { if (flags & kTPCout){ - if (!fOp) { - if (poolETP) { fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fOp);} - else fOp = new AliExternalTrackParam(*t); - } - else fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + if (!fOp) fOp=new AliExternalTrackParam(*t); + else + fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); } fTPCncls=t->GetNumberOfClusters(); fTPCchi2=t->GetChi2(); if (fFriendTrack) { // Copy cluster indices - Int_t indexTPC[AliESDfriendTrack::kMaxTPCcluster]; - for (Int_t i=AliESDfriendTrack::kMaxTPCcluster;i--;) indexTPC[i]=t->GetClusterIndex(i); + Int_t* indexTPC = new Int_t[AliESDfriendTrack::kMaxTPCcluster]; + for (Int_t i=0;iGetClusterIndex(i); fFriendTrack->SetTPCIndices(indexTPC,AliESDfriendTrack::kMaxTPCcluster); + delete [] indexTPC; } fTPCsignal=t->GetPIDsignal(); + } break; - // + case kTRDin: case kTRDrefit: break; case kTRDout: + { fTRDLabel = t->GetLabel(); fTRDchi2 = t->GetChi2(); fTRDncls = t->GetNumberOfClusters(); if (fFriendTrack) { - Int_t indexTRD[AliESDfriendTrack::kMaxTRDcluster]; - for (Int_t i=AliESDfriendTrack::kMaxTRDcluster;i--;) indexTRD[i] = -2; - for (Int_t i=6;i--;) indexTRD[i] = t->GetTrackletIndex(i); + Int_t* indexTRD = new Int_t[AliESDfriendTrack::kMaxTRDcluster]; + for (Int_t i=0;iGetTrackletIndex(i); fFriendTrack->SetTRDIndices(indexTRD,AliESDfriendTrack::kMaxTRDcluster); + delete [] indexTRD; } - // + fTRDsignal=t->GetPIDsignal(); + } break; - // case kTRDbackup: - if (!fOp) { - if (poolETP) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fOp);} - else fOp = new AliExternalTrackParam(*t); - } - else fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + if (!fOp) fOp=new AliExternalTrackParam(*t); + else + fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); fTRDncls0 = t->GetNumberOfClusters(); break; - // case kTOFin: break; case kTOFout: @@ -1599,19 +1400,15 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ case kTRDStop: break; case kHMPIDout: - if (!fHMPIDp) { - if (poolETP) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fHMPIDp);} - else fHMPIDp = new AliExternalTrackParam(*t); - fHMPIDp=new AliExternalTrackParam(*t); - } - else fHMPIDp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + if (!fHMPIDp) fHMPIDp=new AliExternalTrackParam(*t); + else + fHMPIDp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); break; - // default: AliError("Wrong flag !"); return kFALSE; } - // + return rc; } @@ -1621,7 +1418,7 @@ void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const { // This function returns external representation of the track parameters //--------------------------------------------------------------------- x=GetX(); - for (Int_t i=5;i--;) p[i]=GetParameter()[i]; + for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i]; } //_______________________________________________________________________ @@ -1629,7 +1426,7 @@ void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const { //--------------------------------------------------------------------- // This function returns external representation of the cov. matrix //--------------------------------------------------------------------- - for (Int_t i=15;i--;) cov[i]=AliExternalTrackParam::GetCovariance()[i]; + for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i]; } //_______________________________________________________________________ @@ -1641,7 +1438,7 @@ Bool_t AliESDtrack::GetConstrainedExternalParameters if (!fCp) return kFALSE; alpha=fCp->GetAlpha(); x=fCp->GetX(); - for (Int_t i=5;i--;) p[i]=fCp->GetParameter()[i]; + for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i]; return kTRUE; } @@ -1652,7 +1449,7 @@ AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const { // This function returns the constrained external cov. matrix //--------------------------------------------------------------------- if (!fCp) return kFALSE; - for (Int_t i=15;i--;) c[i]=fCp->GetCovariance()[i]; + for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i]; return kTRUE; } @@ -1666,7 +1463,7 @@ AliESDtrack::GetInnerExternalParameters if (!fIp) return kFALSE; alpha=fIp->GetAlpha(); x=fIp->GetX(); - for (Int_t i=5;i--;) p[i]=fIp->GetParameter()[i]; + for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i]; return kTRUE; } @@ -1677,7 +1474,7 @@ AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const { // at the inner layer of TPC //--------------------------------------------------------------------- if (!fIp) return kFALSE; - for (Int_t i=15;i--;) cov[i]=fIp->GetCovariance()[i]; + for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i]; return kTRUE; } @@ -1687,7 +1484,6 @@ AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) { // This is a direct setter for the outer track parameters // SetStatus(flags); - if (fOp) delete fOp; fOp=new AliExternalTrackParam(*p); } @@ -1698,12 +1494,8 @@ AliESDtrack::SetOuterHmpParam(const AliExternalTrackParam *p, ULong_t flags) { // This is a direct setter for the outer track parameters // SetStatus(flags); - if (fHMPIDp) *fHMPIDp = *p; - else { - AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; - if (poolETP) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*p); poolETP->RegisterClone(fHMPIDp);} - else fHMPIDp = new AliExternalTrackParam(*p); - } + if (fHMPIDp) delete fHMPIDp; + fHMPIDp=new AliExternalTrackParam(*p); } Bool_t @@ -1716,7 +1508,7 @@ AliESDtrack::GetOuterExternalParameters if (!fOp) return kFALSE; alpha=fOp->GetAlpha(); x=fOp->GetX(); - for (Int_t i=5;i--;) p[i]=fOp->GetParameter()[i]; + for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i]; return kTRUE; } @@ -1730,7 +1522,7 @@ AliESDtrack::GetOuterHmpExternalParameters if (!fHMPIDp) return kFALSE; alpha=fHMPIDp->GetAlpha(); x=fHMPIDp->GetX(); - for (Int_t i=5;i--;) p[i]=fHMPIDp->GetParameter()[i]; + for (Int_t i=0; i<5; i++) p[i]=fHMPIDp->GetParameter()[i]; return kTRUE; } @@ -1741,7 +1533,7 @@ AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const { // at the inner layer of TRD //--------------------------------------------------------------------- if (!fOp) return kFALSE; - for (Int_t i=15;i--;) cov[i]=fOp->GetCovariance()[i]; + for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i]; return kTRUE; } @@ -1752,7 +1544,7 @@ AliESDtrack::GetOuterHmpExternalCovariance(Double_t cov[15]) const { // at the inner layer of TRD //--------------------------------------------------------------------- if (!fHMPIDp) return kFALSE; - for (Int_t i=15;i--;) cov[i]=fHMPIDp->GetCovariance()[i]; + for (Int_t i=0; i<15; i++) cov[i]=fHMPIDp->GetCovariance()[i]; return kTRUE; } @@ -1832,13 +1624,13 @@ Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const //_______________________________________________________________________ void AliESDtrack::GetIntegratedTimes(Double_t *times) const { // Returns the array with integrated times for each particle hypothesis - for (Int_t i=AliPID::kSPECIES;i--;) times[i]=fTrackTime[i]; + for (Int_t i=0; iGetITSindices(); - for (Int_t i=AliESDfriendTrack::kMaxITScluster;i--;) { + for (Int_t i=0; i=fITSncls) && (i<6) ) idx[i]=-1; else { if (index) { @@ -1940,10 +1732,10 @@ UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const { Int_t *index=fFriendTrack->GetTPCindices(); if (index){ - for (Int_t i=AliESDfriendTrack::kMaxTPCcluster;i--;) idx[i]=index[i]; + for (Int_t i=0; irow1) upperBound=row1; - for (Int_t i=row0;iGetTRDindices(); - if (index) for (Int_t i=AliESDfriendTrack::kMaxTRDcluster;i--;) idx[i]=index[i]; - else for (Int_t i=AliESDfriendTrack::kMaxTRDcluster;i--;) idx[i]=-2; + + if (index) { + for (Int_t i=0; iGetTRDindices(); Int_t n = 0; - for (Int_t i=0;i=0) n++; idx[i]=index[i]; @@ -2102,7 +1899,7 @@ void AliESDtrack::SetTRDpid(const Double_t *p) { //_______________________________________________________________________ void AliESDtrack::GetTRDpid(Double_t *p) const { // Gets the probability of each particle type (in TRD) - for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fTRDr[i]; + for (Int_t i=0; i0.) q+=(*s); + for (Int_t i=0; i0.) q+=(*s); return q/ns; } @@ -2179,14 +1976,13 @@ Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const { void AliESDtrack::SetNumberOfTRDslices(Int_t n) { //Sets the number of slices used for PID if (fTRDnSlices) return; + fTRDnSlices=n; - AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; - if (poolN) fTRDslices = poolN->BookD32(fTRDnSlices,&fTRDslices); - else fTRDslices = new Double32_t[fTRDnSlices]; - // + fTRDslices=new Double32_t[fTRDnSlices]; + // set-up correctly the allocated memory memset(fTRDslices, 0, n*sizeof(Double32_t)); - for (Int_t i=GetNumberOfTRDslices();i--;) fTRDslices[i]=-1.; + for (Int_t i=GetNumberOfTRDslices(); i--;) fTRDslices[i]=-1.; } //____________________________________________________ @@ -2241,31 +2037,31 @@ void AliESDtrack::SetTOFpid(const Double_t *p) { //_______________________________________________________________________ void AliESDtrack::SetTOFLabel(const Int_t *p) { // Sets (in TOF) - for (Int_t i=3;i--;) fTOFLabel[i]=p[i]; + for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i]; } //_______________________________________________________________________ void AliESDtrack::GetTOFpid(Double_t *p) const { // Gets probabilities of each particle type (in TOF) - for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fTOFr[i]; + for (Int_t i=0; iGetPoolTPCdEdx() : 0; - pooldEdx ? pooldEdx->MarkSlotFree(fTPCdEdxInfo) : delete fTPCdEdxInfo; - } +void AliESDtrack::SetTPCdEdxInfo(AliTPCdEdxInfo * dEdxInfo){ + if(fTPCdEdxInfo) delete fTPCdEdxInfo; fTPCdEdxInfo = dEdxInfo; } //_______________________________________________________________________ void AliESDtrack::GetHMPIDpid(Double_t *p) const { // Gets probabilities of each particle type (in HMPID) - for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fHMPIDr[i]; + for (Int_t i=0; iGetXYZ(pos); mpos[0]+=pos[0]/entries; @@ -2619,7 +2412,7 @@ void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) { // Store the dE/dx samples measured by the two SSD and two SDD layers. // These samples are corrected for the track segment length. // - for (Int_t i=4;i--;) fITSdEdxSamples[i]=s[i]; + for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i]; } //_______________________________________________________________________ @@ -2628,7 +2421,7 @@ void AliESDtrack::GetITSdEdxSamples(Double_t *s) const { // Get the dE/dx samples measured by the two SSD and two SDD layers. // These samples are corrected for the track segment length. // - for (Int_t i=4;i--;) s[i]=fITSdEdxSamples[i]; + for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i]; } @@ -2675,25 +2468,33 @@ Double_t AliESDtrack::GetChi2TPCConstrainedVsGlobal(const AliESDVertex* vtx) con } // clone for constraining - AliExternalTrackParam tpcInnerC(*fTPCInner); + AliExternalTrackParam* tpcInnerC = new AliExternalTrackParam(*fTPCInner); + if (!tpcInnerC) { + AliWarning("Clone of TPCInnerParam failed."); + return fCacheChi2TPCConstrainedVsGlobal; + } // transform to the track reference frame - Bool_t isOK = tpcInnerC.Rotate(GetAlpha()); - isOK &= tpcInnerC.PropagateTo(GetX(), b[2]); + Bool_t isOK = tpcInnerC->Rotate(GetAlpha()); + isOK &= tpcInnerC->PropagateTo(GetX(), b[2]); if (!isOK) { + delete tpcInnerC; + tpcInnerC = 0; AliWarning("Rotation/Propagation of track failed.") ; return fCacheChi2TPCConstrainedVsGlobal; } // constrain TPCinner - isOK = tpcInnerC.ConstrainToVertex(vtx, b); + isOK = tpcInnerC->ConstrainToVertex(vtx, b); // transform to the track reference frame - isOK &= tpcInnerC.Rotate(GetAlpha()); - isOK &= tpcInnerC.PropagateTo(GetX(), b[2]); + isOK &= tpcInnerC->Rotate(GetAlpha()); + isOK &= tpcInnerC->PropagateTo(GetX(), b[2]); if (!isOK) { AliWarning("ConstrainTPCInner failed.") ; + delete tpcInnerC; + tpcInnerC = 0; return fCacheChi2TPCConstrainedVsGlobal; } @@ -2704,45 +2505,23 @@ Double_t AliESDtrack::GetChi2TPCConstrainedVsGlobal(const AliESDVertex* vtx) con TMatrixD delta(1,5); TMatrixD covarM(5,5); - for (Int_t ipar=0;ipar<5;ipar++) { - deltaT(ipar,0) = tpcInnerC.GetParameter()[ipar] - GetParameter()[ipar]; - delta(0,ipar) = tpcInnerC.GetParameter()[ipar] - GetParameter()[ipar]; + for (Int_t ipar=0; ipar<5; ipar++) { + deltaT(ipar,0) = tpcInnerC->GetParameter()[ipar] - GetParameter()[ipar]; + delta(0,ipar) = tpcInnerC->GetParameter()[ipar] - GetParameter()[ipar]; for (Int_t jpar=0; jpar<5; jpar++) { Int_t index = GetIndex(ipar,jpar); - covarM(ipar,jpar) = GetCovariance()[index]+tpcInnerC.GetCovariance()[index]; + covarM(ipar,jpar) = GetCovariance()[index]+tpcInnerC->GetCovariance()[index]; } } // chi2 distance TPC constrained and TPC+ITS TMatrixD covarMInv = covarM.Invert(); TMatrixD mat2 = covarMInv*deltaT; TMatrixD chi2 = delta*mat2; - // + + delete tpcInnerC; + tpcInnerC = 0; + fCacheChi2TPCConstrainedVsGlobal = chi2(0,0); return fCacheChi2TPCConstrainedVsGlobal; } - -void AliESDtrack::ReleaseESDfriendTrackGently() -{ - // remove friend track - if (!fFriendTrack) return; - AliClonesPool* poolFr = fgPools->GetPoolTrFriend(); - poolFr ? poolFr->MarkSlotFree(fFriendTrack) : delete fFriendTrack; - fFriendTrack=0; -} - -void AliESDtrack::PrintTmp() -{ -} - -void AliESDtrack::SetFriendTrack(const AliESDfriendTrack *t) -{ - //attach fr. track - if (fFriendTrack) { - AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; - if (poolFr) poolFr->MarkSlotFree(fFriendTrack); - else delete fFriendTrack; - fFriendTrack = 0; - } - if (t) fFriendTrack=new AliESDfriendTrack(*t); -} diff --git a/STEER/ESD/AliESDtrack.h b/STEER/ESD/AliESDtrack.h index a82fc0d3bba..86e3161537b 100644 --- a/STEER/ESD/AliESDtrack.h +++ b/STEER/ESD/AliESDtrack.h @@ -40,7 +40,7 @@ class AliESDEvent; class AliKalmanTrack; class AliTrackPointArray; class TPolyMarker3D; -class AliPoolsSet; + class AliESDtrack : public AliExternalTrackParam { public: @@ -49,15 +49,15 @@ public: // AliESDtrack(); AliESDtrack(const AliESDtrack& track); - AliESDtrack(AliESDtrack* track, Bool_t detach); AliESDtrack(const AliVTrack* track); AliESDtrack(TParticle * part); virtual ~AliESDtrack(); virtual void Copy(TObject &obj) const; const AliESDfriendTrack *GetFriendTrack() const {return fFriendTrack;} - void SetFriendTrack(const AliESDfriendTrack *t); - void ReleaseESDfriendTrackGently(); - // void ReleaseESDfriendTrack() {delete fFriendTrack; fFriendTrack=0;} + void SetFriendTrack(const AliESDfriendTrack *t) { + delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*t); + } + void ReleaseESDfriendTrack() { delete fFriendTrack; fFriendTrack=0; } void AddCalibObject(TObject * object); // add calib object to the list TObject * GetCalibObject(Int_t index); // return calib objct at given position void MakeMiniESDtrack(); @@ -380,8 +380,7 @@ public: void GetImpactParameters(Float_t p[2], Float_t cov[3]) const { p[0]=fD; p[1]=fZ; cov[0]=fCdd; cov[1]=fCdz; cov[2]=fCzz; } - virtual void Print(Option_t *opt) const; - virtual void Clear(Option_t *opt=""); + virtual void Print(Option_t * opt) const ; const AliESDEvent* GetESDEvent() const {return fESDEvent;} void SetESDEvent(const AliESDEvent* evt) {fESDEvent = evt;} // @@ -396,12 +395,8 @@ public: // - creation of AliESDfriendTrack // - set lengt of bit fields fTPCClusterMap and fTPCSharedMap to 0 static void OnlineMode(bool mode) {fgkOnlineMode=mode;} - static bool OnlineMode() {return fgkOnlineMode;} - static void SetPools(AliPoolsSet* p) {fgPools = p;} - static AliPoolsSet* GetPools() {return fgPools;} - - void PrintTmp(); - protected: + static bool OnlineMode() {return fgkOnlineMode;} +protected: AliExternalTrackParam *fCp; // Track parameters constrained to the primary vertex AliExternalTrackParam *fIp; // Track parameters estimated at the inner wall of TPC @@ -522,9 +517,7 @@ public: mutable Float_t fCacheNCrossedRows; //! Cache for the number of crossed rows mutable Float_t fCacheChi2TPCConstrainedVsGlobal; //! Cache for the chi2 of constrained TPC vs global track mutable const AliESDVertex* fCacheChi2TPCConstrainedVsGlobalVertex; //! Vertex for which the cache is valid - - static AliPoolsSet* fgPools; // set of pools - + private: static bool fgkOnlineMode; //! indicate the online mode to skip some of the functionality diff --git a/STEER/ESD/AliTrackPointArray.cxx b/STEER/ESD/AliTrackPointArray.cxx index 796e23807f1..edb0ed5c876 100644 --- a/STEER/ESD/AliTrackPointArray.cxx +++ b/STEER/ESD/AliTrackPointArray.cxx @@ -27,14 +27,11 @@ #include #include #include -#include + #include "AliTrackPointArray.h" -#include "AliPoolN.h" ClassImp(AliTrackPointArray) -AliPoolN* AliTrackPointArray::fgPool = 0; - //______________________________________________________________________________ AliTrackPointArray::AliTrackPointArray() : TObject(), @@ -59,20 +56,21 @@ AliTrackPointArray::AliTrackPointArray(Int_t npoints): TObject(), fSorted(kFALSE), fNPoints(npoints), - fX( fgPool ? fgPool->BookF(npoints,&fX) : new Float_t[npoints]), - fY( fgPool ? fgPool->BookF(npoints,&fY) : new Float_t[npoints]), - fZ( fgPool ? fgPool->BookF(npoints,&fZ) : new Float_t[npoints]), - fCharge( fgPool ? fgPool->BookF(npoints,&fCharge) : new Float_t[npoints]), - fDriftTime( fgPool ? fgPool->BookF(npoints,&fDriftTime) : new Float_t[npoints]), - fChargeRatio( fgPool ? fgPool->BookF(npoints,&fChargeRatio) : new Float_t[npoints]), - fClusterType( fgPool ? fgPool->BookI(npoints,&fClusterType) : new Int_t[npoints]), - fIsExtra( fgPool ? fgPool->BookB(npoints,&fIsExtra) : new Bool_t[npoints]), + fX(new Float_t[npoints]), + fY(new Float_t[npoints]), + fZ(new Float_t[npoints]), + fCharge(new Float_t[npoints]), + fDriftTime(new Float_t[npoints]), + fChargeRatio(new Float_t[npoints]), + fClusterType(new Int_t[npoints]), + fIsExtra(new Bool_t[npoints]), fSize(6*npoints), - fCov( fgPool ? fgPool->BookF(fSize,&fCov) : new Float_t[fSize]), - fVolumeID( fgPool ? fgPool->BookUS(npoints,&fVolumeID) : new UShort_t[npoints]) + fCov(new Float_t[fSize]), + fVolumeID(new UShort_t[npoints]) { // Constructor - for (Int_t ip=npoints;ip--;){ + // + for (Int_t ip=0; ipBookF(fNPoints,&fX) : new Float_t[fNPoints]), - fY( fgPool ? fgPool->BookF(fNPoints,&fY) : new Float_t[fNPoints]), - fZ( fgPool ? fgPool->BookF(fNPoints,&fZ) : new Float_t[fNPoints]), - fCharge( fgPool ? fgPool->BookF(fNPoints,&fCharge) : new Float_t[fNPoints]), - fDriftTime( fgPool ? fgPool->BookF(fNPoints,&fDriftTime) : new Float_t[fNPoints]), - fChargeRatio( fgPool ? fgPool->BookF(fNPoints,&fChargeRatio) : new Float_t[fNPoints]), - fClusterType( fgPool ? fgPool->BookI(fNPoints,&fClusterType) : new Int_t[fNPoints]), - fIsExtra( fgPool ? fgPool->BookB(fNPoints,&fIsExtra) : new Bool_t[fNPoints]), - fSize(6*fNPoints), - fCov( fgPool ? fgPool->BookF(fSize,&fCov) : new Float_t[fSize]), - fVolumeID( fgPool ? fgPool->BookUS(fNPoints,&fVolumeID) : new UShort_t[fNPoints]) + fX(new Float_t[fNPoints]), + fY(new Float_t[fNPoints]), + fZ(new Float_t[fNPoints]), + fCharge(new Float_t[fNPoints]), + fDriftTime(new Float_t[fNPoints]), + fChargeRatio(new Float_t[fNPoints]), + fClusterType(new Int_t[fNPoints]), + fIsExtra(new Bool_t[fNPoints]), + fSize(array.fSize), + fCov(new Float_t[fSize]), + fVolumeID(new UShort_t[fNPoints]) { // Copy constructor // memcpy(fX,array.fX,fNPoints*sizeof(Float_t)); memcpy(fY,array.fY,fNPoints*sizeof(Float_t)); memcpy(fZ,array.fZ,fNPoints*sizeof(Float_t)); - if (array.fCharge) memcpy(fCharge,array.fCharge,fNPoints*sizeof(Float_t)); - else memset(fCharge, 0, fNPoints*sizeof(Float_t)); - // - if (array.fDriftTime) memcpy(fDriftTime,array.fDriftTime,fNPoints*sizeof(Float_t)); - else memset(fDriftTime, 0, fNPoints*sizeof(Float_t)); - // - if (array.fChargeRatio) memcpy(fChargeRatio,array.fChargeRatio,fNPoints*sizeof(Float_t)); - else memset(fChargeRatio, 0, fNPoints*sizeof(Float_t)); - // - if (array.fClusterType) memcpy(fClusterType,array.fClusterType,fNPoints*sizeof(Int_t)); - else memset(fClusterType, 0, fNPoints*sizeof(Int_t)); - // - if (array.fIsExtra) memcpy(fIsExtra,array.fIsExtra,fNPoints*sizeof(Bool_t)); - else memset(fIsExtra, 0, fNPoints*sizeof(Bool_t)); - // + if (array.fCharge) { + memcpy(fCharge,array.fCharge,fNPoints*sizeof(Float_t)); + } else { + memset(fCharge, 0, fNPoints*sizeof(Float_t)); + } + if (array.fDriftTime) { + memcpy(fDriftTime,array.fDriftTime,fNPoints*sizeof(Float_t)); + } else { + memset(fDriftTime, 0, fNPoints*sizeof(Float_t)); + } + if (array.fChargeRatio) { + memcpy(fChargeRatio,array.fChargeRatio,fNPoints*sizeof(Float_t)); + } else { + memset(fChargeRatio, 0, fNPoints*sizeof(Float_t)); + } + if (array.fClusterType) { + memcpy(fClusterType,array.fClusterType,fNPoints*sizeof(Int_t)); + } else { + memset(fClusterType, 0, fNPoints*sizeof(Int_t)); + } + if (array.fIsExtra) { + memcpy(fIsExtra,array.fIsExtra,fNPoints*sizeof(Bool_t)); + } else { + memset(fIsExtra, 0, fNPoints*sizeof(Bool_t)); + } memcpy(fVolumeID,array.fVolumeID,fNPoints*sizeof(UShort_t)); memcpy(fCov,array.fCov,fSize*sizeof(Float_t)); } @@ -134,37 +143,30 @@ AliTrackPointArray &AliTrackPointArray::operator =(const AliTrackPointArray& arr // if(this==&array) return *this; ((TObject *)this)->operator=(array); + fSorted = array.fSorted; fNPoints = array.fNPoints; fSize = array.fSize; - // - if (fgPool) Clear(); - if (!fgPool) { - fX = new Float_t[fNPoints]; - fY = new Float_t[fNPoints]; - fZ = new Float_t[fNPoints]; - fCharge = new Float_t[fNPoints]; - fDriftTime = new Float_t[fNPoints]; - fChargeRatio = new Float_t[fNPoints]; - fClusterType = new Int_t[fNPoints]; - fIsExtra = new Bool_t[fNPoints]; - fVolumeID = new UShort_t[fNPoints]; - fCov = new Float_t[fSize]; - } - else { // store in pools - fX = fgPool->BookF(fNPoints,&fX); - fY = fgPool->BookF(fNPoints,&fY); - fZ = fgPool->BookF(fNPoints,&fZ); - fCharge = fgPool->BookF(fNPoints,&fCharge); - fDriftTime = fgPool->BookF(fNPoints,&fDriftTime); - fChargeRatio = fgPool->BookF(fNPoints,&fChargeRatio); - fClusterType = fgPool->BookI(fNPoints,&fClusterType); - fIsExtra = fgPool->BookB(fNPoints,&fIsExtra); - fCov = fgPool->BookF(fSize,&fCov); - fVolumeID = fgPool->BookUS(fNPoints,&fVolumeID); - // - } - // + delete [] fX; + fX = new Float_t[fNPoints]; + delete [] fY; + fY = new Float_t[fNPoints]; + delete [] fZ; + fZ = new Float_t[fNPoints]; + delete [] fCharge; + fCharge = new Float_t[fNPoints]; + delete [] fDriftTime; + fDriftTime = new Float_t[fNPoints]; + delete [] fChargeRatio; + fChargeRatio = new Float_t[fNPoints]; + delete [] fClusterType; + fClusterType = new Int_t[fNPoints]; + delete [] fIsExtra; + fIsExtra = new Bool_t[fNPoints]; + delete [] fVolumeID; + fVolumeID = new UShort_t[fNPoints]; + delete [] fCov; + fCov = new Float_t[fSize]; memcpy(fX,array.fX,fNPoints*sizeof(Float_t)); memcpy(fY,array.fY,fNPoints*sizeof(Float_t)); memcpy(fZ,array.fZ,fNPoints*sizeof(Float_t)); @@ -184,42 +186,18 @@ AliTrackPointArray::~AliTrackPointArray() { // Destructor // - Clear(); + delete [] fX; + delete [] fY; + delete [] fZ; + delete [] fCharge; + delete [] fDriftTime; + delete [] fChargeRatio; + delete [] fClusterType; + delete [] fIsExtra; + delete [] fVolumeID; + delete [] fCov; } -//______________________________________________________________________________ -void AliTrackPointArray::Clear(Option_t *) -{ - // clean dynamical part - TObject::Clear(); - if (!fX) return; - if (!fgPool) { - delete [] fX; - delete [] fY; - delete [] fZ; - delete [] fCharge; - delete [] fDriftTime; - delete [] fChargeRatio; - delete [] fClusterType; - delete [] fIsExtra; - delete [] fVolumeID; - delete [] fCov; - } - else { - if (!fgPool->IsReset()) { // UniqueID==0 means that the array was freed globally - fgPool->FreeSlot(&fX); - fgPool->FreeSlot(&fY); - fgPool->FreeSlot(&fZ); - fgPool->FreeSlot(&fCharge); - fgPool->FreeSlot(&fDriftTime); - fgPool->FreeSlot(&fChargeRatio); - fgPool->FreeSlot(&fClusterType); - fgPool->FreeSlot(&fIsExtra); - fgPool->FreeSlot(&fCov); - fgPool->FreeSlot(&fVolumeID); - } - } -} //______________________________________________________________________________ Bool_t AliTrackPointArray::AddPoint(Int_t i, const AliTrackPoint *p) @@ -276,22 +254,20 @@ void AliTrackPointArray::Sort(Bool_t down) // Sort the array by the values of Y-coordinate of the track points. // The order is given by "down". // Optimized more for maintenance rather than for speed. + if (fSorted) return; - // - static TArrayI indexAr; - if (indexAr.GetSize() #include -class AliPoolN; class TGeoRotation; class AliTrackPoint : public TObject { @@ -63,7 +62,7 @@ class AliTrackPoint : public TObject { AliTrackPoint& MasterToLocal() const; void Print(Option_t *) const; - // + private: Float_t fX; // X coordinate @@ -118,11 +117,8 @@ class AliTrackPointArray : public TObject { const UShort_t* GetVolumeID() const { return &fVolumeID[0]; } Bool_t HasVolumeID(UShort_t volid) const; - void Clear(Option_t* opt=""); - // + void Sort(Bool_t down=kTRUE); - static void SetPool(AliPoolN* rc) {fgPool = rc;} - static AliPoolN* GetPool() {return fgPool;} private: Bool_t fSorted; // Sorted flag @@ -139,10 +135,8 @@ class AliTrackPointArray : public TObject { Int_t fSize; // Size of array with cov matrices = 6*N of points Float_t *fCov; //[fSize] Array with space point coordinates cov matrix UShort_t *fVolumeID; //[fNPoints] Array of space point volume IDs - // - static AliPoolN* fgPool; // pointer to the pool (of AliReconstruction) - // - ClassDef(AliTrackPointArray,8) + + ClassDef(AliTrackPointArray,7) }; #endif diff --git a/STEER/STEER/AliReconstruction.cxx b/STEER/STEER/AliReconstruction.cxx index c5405afe984..be0719957b9 100644 --- a/STEER/STEER/AliReconstruction.cxx +++ b/STEER/STEER/AliReconstruction.cxx @@ -200,9 +200,6 @@ #include "AliESDHLTDecision.h" #include "AliTriggerInput.h" #include "AliLHCData.h" -#include "AliPoolN.h" -#include "AliClonesPool.h" -#include "AliPoolsSet.h" #include "ARVersion.h" #include #include @@ -323,7 +320,6 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fAnalysis(0), fRecoHandler(0), fDeclTriggerClasses(""), - fPools(0), fStopped(kFALSE), fMaxRSS(0), fMaxVMEM(0) @@ -450,7 +446,6 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fAnalysis(0), fRecoHandler(0), fDeclTriggerClasses(rec.fDeclTriggerClasses), - fPools(0), fStopped(kFALSE), fMaxRSS(0), fMaxVMEM(0) @@ -649,6 +644,7 @@ AliReconstruction::~AliReconstruction() delete fAlignObjArray; } fSpecCDBUri.Delete(); + AliCodeTimer::Instance()->Print(); } @@ -1744,28 +1740,24 @@ void AliReconstruction::SlaveBegin(TTree*) } ftree = new TTree("esdTree", "Tree with ESD objects"); - ftree->SetAutoFlush(1); fesd = new AliESDEvent(); fesd->CreateStdContent(); // add a so far non-std object to the ESD, this will // become part of the std content fesd->AddObject(new AliESDHLTDecision); - - const Int_t kBufsize = 32000/4; // default value in TTree::Branch() + fesd->WriteToTree(ftree); if (fWriteESDfriend) { ffileF = TFile::Open("AliESDfriends.root", "RECREATE"); ftreeF = new TTree("esdFriendTree", "Tree with ESD Friend objects"); - ftreeF->SetAutoFlush(1); fesdf = new AliESDfriend(); - ftreeF->Branch("ESDfriend.","AliESDfriend", &fesdf, kBufsize); + ftreeF->Branch("ESDfriend.","AliESDfriend", &fesdf); fesd->AddObject(fesdf); ffile->cd(); } ftree->GetUserInfo()->Add(fesd); fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects"); - fhlttree->SetAutoFlush(1); fhltesd = new AliESDEvent(); fhltesd->CreateStdContent(); // read the ESD template from CDB @@ -1888,7 +1880,7 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) AliCodeTimerAuto("",0); AliESDpid pid; - + AliSysInfo::AddStamp(Form("StartEv_%d",iEvent), 0,0,iEvent); if (iEvent >= fRunLoader->GetNumberOfEvents()) { @@ -1905,9 +1897,8 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) if ((iEvent < fFirstEvent) || ((fLastEvent >= 0) && (iEvent > fLastEvent))) { return kTRUE; } - // - InitPools(); // make sure the pools are ready - // + + fRunLoader->GetEvent(iEvent); // Fill Event-info object @@ -2319,7 +2310,6 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) pHLTSrc->Copy(*pHLTTgt); } // - fPools->Print(); // RS:tmp // Perform analysis of this event if requested // RS: Should be done before WriteESDfriend, since the latter may clean the esdfriend if (fAnalysis) { @@ -2329,36 +2319,37 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) AliSysInfo::AddStamp(Form("Analysis_%d",iEvent), 0,0,iEvent); } // - // RS there is no point in filling the esdFriend object if it is not going to be written if (fWriteESDfriend) { - WriteESDfriend(); - AliSysInfo::AddStamp(Form("WriteFriend_%d",iEvent), 0,0,iEvent); + fesd->GetESDfriend(fesdf); + AliSysInfo::AddStamp(Form("CreateFriend_%d",iEvent), 0,0,iEvent); + } // ftree->Fill(); - // AliSysInfo::AddStamp(Form("ESDFill_%d",iEvent), 0,0,iEvent); + // if (fWriteESDfriend) { - // Auto-save the ESD tree in case of prompt reco @P2 - if (fRawReader && fRawReader->UseAutoSaveESD()) { - ftree->AutoSave("SaveSelf"); - if (fWriteESDfriend) ftreeF->AutoSave("SaveSelf"); - } + WriteESDfriend(); + AliSysInfo::AddStamp(Form("WriteFriend_%d",iEvent), 0,0,iEvent); + } + // + // + // Auto-save the ESD tree in case of prompt reco @P2 + if (fRawReader && fRawReader->UseAutoSaveESD()) { + ftree->AutoSave("SaveSelf"); + if (fWriteESDfriend) ftreeF->AutoSave("SaveSelf"); } // write HLT ESD fhlttree->Fill(); - AliSysInfo::AddStamp(Form("WriteESDs_%d",iEvent), 0,0,iEvent); - // call AliEVE if (fRunAliEVE) RunAliEVE(); // fesd->Reset(); fhltesd->Reset(); if (fWriteESDfriend) { - fesdf->Clear(); - // fesdf->~AliESDfriend(); - // new (fesdf) AliESDfriend(); // Reset... + fesdf->~AliESDfriend(); + new (fesdf) AliESDfriend(); // Reset... } gSystem->GetProcInfo(&procInfo); @@ -2385,11 +2376,10 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) if (fRunQA || fRunGlobalQA) AliQAManager::QAManager()->Increment() ; - // - fPools->Print(); - fPools->ResetPools(); + DeleteRecPoints(fDeleteRecPoints); DeleteDigits(fDeleteDigits); + // return kTRUE; } @@ -2536,8 +2526,7 @@ void AliReconstruction::Terminate() // In case of empty events the tags will contain dummy values AliCodeTimerAuto("",0); - // - // or for the files stopped due to the limited resources + // Do not call the ESD tag creator in case of PROOF-based reconstruction if (!fInput) { AliESDTagCreator *esdtagCreator = new AliESDTagCreator(); esdtagCreator->CreateESDTags(fFirstEvent,fLastEvent,fGRPData, AliQAv1::Instance()->GetQA(), AliQAv1::Instance()->GetEventSpecies(), AliQAv1::kNDET, AliRecoParam::kNSpecies); @@ -2604,7 +2593,6 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors) reconstructor->ConvertDigits(fRawReader, digitsTree); loader->WriteDigits("OVERWRITE"); loader->UnloadDigits(); - AliSysInfo::AddStamp(Form("LRecRW2Root%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr); } // local reconstruction AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet])); @@ -2618,7 +2606,6 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors) TTree* clustersTree = loader->TreeR(); if (fRawReader && !reconstructor->HasDigitConversion()) { reconstructor->Reconstruct(fRawReader, clustersTree); - AliSysInfo::AddStamp(Form("LRecRec%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr); } else { AliDebug(1, "Loading Digits"); @@ -2637,7 +2624,6 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors) AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; AliQAManager::QAManager()->RunOneEventInOneDetector(iDet, digitsTree) ; } - AliSysInfo::AddStamp(Form("LRecD2C%s_%d",fgkDetectorName[iDet],eventNr), iDet,1,eventNr); } loader->UnloadDigits(); } @@ -2889,7 +2875,6 @@ Bool_t AliReconstruction::RunMuonTracking(AliESDEvent*& esd) AliWarning(Form("couldn't create a tracker for %s", detName.Data())); return kFALSE; } - tracker->SetPools(fPools); // read RecPoints fLoader[iDet]->LoadRecPoints("read"); @@ -2929,7 +2914,6 @@ Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd,AliESDpid &PID) for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { if (!fTracker[iDet]) continue; fTracker[iDet]->SetEventInfo(&fEventInfo); - fTracker[iDet]->SetPools(fPools); } //Fill the ESD with the T0 info (will be used by the TOF) @@ -3539,17 +3523,6 @@ void AliReconstruction::CleanUp() fTracker[iDet] = NULL; } */ - if (fPools) { - if (fesd) fesd->Reset(); - if (fhltesd) fhltesd->Reset(); - if (fesdf) fesdf->Clear(); - fPools->ResetPools(); - AliTrackPointArray::SetPool(0); - AliESDtrack::SetPools(0); - AliESDfriendTrack::SetPools(0); - delete fPools; fPools = 0; - } - // delete fRunInfo; fRunInfo = NULL; @@ -3578,14 +3551,12 @@ void AliReconstruction::CleanUp() // AliQAManager::Destroy() ; delete fAnalysis; fAnalysis = NULL; - // } void AliReconstruction::WriteAlignmentData(AliESDEvent* esd) { // Write space-points which are then used in the alignment procedures // For the moment only ITS, TPC, TRD and TOF - AliClonesPool* poolTPA = fPools ? fPools->GetPoolTrPoints() : 0; Int_t ntracks = esd->GetNumberOfTracks(); for (Int_t itrack = 0; itrack < ntracks; itrack++) @@ -3604,9 +3575,7 @@ void AliReconstruction::WriteAlignmentData(AliESDEvent* esd) } if (nsp) { - AliTrackPointArray *sp = 0; - if (poolTPA) {sp = new(poolTPA->NextFreeSlot()) AliTrackPointArray(nsp); poolTPA->RegisterClone(sp);} - else sp = new AliTrackPointArray(nsp); + AliTrackPointArray *sp = new AliTrackPointArray(nsp); track->SetTrackPointArray(sp); Int_t isptrack = 0; for (Int_t iDet = 5; iDet >= 0; iDet--) { @@ -4327,9 +4296,7 @@ void AliReconstruction::WriteESDfriend() { // 1. Store all Cosmic or Calibration events within the required fraction // 2. Sample "high Pt" events within the remaining fraction after step 1. // 3. Sample randomly events if we still have remaining slot - // - static int iEvent = 0; - // + fNall++; Bool_t isSelected = kFALSE; // @@ -4368,41 +4335,14 @@ void AliReconstruction::WriteESDfriend() { isSelected = kTRUE; } } - // + if (!isSelected) { - fesdf->Clear(); + fesdf->~AliESDfriend(); + new (fesdf) AliESDfriend(); // Reset... fesdf->SetSkipBit(kTRUE); - fesd->DetachFriends(); // remove friend tracks } - else fesd->GetESDfriend(fesdf); // move friend tracks to AliESDfriens object - // - AliSysInfo::AddStamp(Form("WriteFriend%d_%d",isSelected,iEvent), 0,0,iEvent); // ftreeF->Fill(); - AliSysInfo::AddStamp(Form("WriteFrFill%d_%d",isSelected,iEvent), 0,0,iEvent); - // - iEvent++; -} - -//___________________________________________________________________ -void AliReconstruction::InitPools() -{ - // create general purpose pools - if (!fPools) { - fPools = new AliPoolsSet(); - fPools->InitPools(); // this will initialize only obligatory pools - // - if (fWriteAlignmentData) { - AliClonesPool* pta = new AliClonesPool("AliTrackPointArray",5000); - fPools->SetPool(pta,AliPoolsSet::kPoolTrPoints); - } - AliTrackPointArray::SetPool(fPools->GetPoolN()); - AliESDtrack::SetPools(fPools); - AliESDfriendTrack::SetPools(fPools); - } - // - fPools->ResetPools(); - // } //_________________________________________________________________ diff --git a/STEER/STEER/AliReconstruction.h b/STEER/STEER/AliReconstruction.h index 38e709f6983..d372b0eadc1 100644 --- a/STEER/STEER/AliReconstruction.h +++ b/STEER/STEER/AliReconstruction.h @@ -48,7 +48,6 @@ class AliTriggerRunScalers; class AliCTPTimeParams; class AliAnalysisManager; class AliRecoInputHandler; -class AliPoolsSet; #include "AliQAv1.h" #include "AliEventInfo.h" @@ -129,6 +128,7 @@ public: void SetAlignObjArray(TObjArray *array) {fAlignObjArray = array; fLoadAlignFromCDB = kFALSE;} + virtual Int_t Version() const {return 2;} virtual void Begin(TTree*); virtual void SlaveBegin(TTree*); @@ -192,8 +192,6 @@ public: void DeclareTriggerClasses(const char *trClasses) {fDeclTriggerClasses = trClasses;} // // - AliPoolsSet* GetPools() const {return fPools;} - void InitPools(); Bool_t HasEnoughResources(int ev); void SetStopOnResourcesExcess(int vRSS=3000,int vVMEM=4000); // @@ -385,8 +383,6 @@ private: AliRecoInputHandler *fRecoHandler; //! Input handler adapted for reconstruction TString fDeclTriggerClasses; // Declared defined trigger classes // - AliPoolsSet* fPools; //! reconstruction pools - // Bool_t fStopped; // flag that reco is stopped due to the limited resources Int_t fMaxRSS; // max RSS memory, MB Int_t fMaxVMEM; // max VMEM memory, MB diff --git a/STEER/STEER/AliTracker.cxx b/STEER/STEER/AliTracker.cxx index 1bb700a6130..5cac8da6493 100644 --- a/STEER/STEER/AliTracker.cxx +++ b/STEER/STEER/AliTracker.cxx @@ -30,7 +30,6 @@ #include "AliCluster.h" #include "AliKalmanTrack.h" #include "AliGlobalQADataMaker.h" -#include "AliPoolsSet.h" Bool_t AliTracker::fFillResiduals=kFALSE; TObjArray **AliTracker::fResiduals=NULL; @@ -40,8 +39,7 @@ ClassImp(AliTracker) AliTracker::AliTracker(): AliTrackerBase(), - fEventInfo(NULL), - fPools(NULL) + fEventInfo(NULL) { //-------------------------------------------------------------------- // The default constructor. @@ -51,8 +49,7 @@ AliTracker::AliTracker(): //__________________________________________________________________________ AliTracker::AliTracker(const AliTracker &atr): AliTrackerBase(atr), - fEventInfo(atr.fEventInfo), - fPools(atr.fPools) + fEventInfo(atr.fEventInfo) { //-------------------------------------------------------------------- // The default constructor. diff --git a/STEER/STEER/AliTracker.h b/STEER/STEER/AliTracker.h index 78c317da0eb..62ce04e0e86 100644 --- a/STEER/STEER/AliTracker.h +++ b/STEER/STEER/AliTracker.h @@ -24,7 +24,6 @@ class AliExternalTrackParam; class AliTrackPoint; class AliKalmanTrack; class AliEventInfo; -class AliPoolsSet; class AliTracker : public AliTrackerBase { public: @@ -58,10 +57,7 @@ public: void SetEventInfo(AliEventInfo *evInfo) {fEventInfo = evInfo;} const AliEventInfo* GetEventInfo() const {return fEventInfo;} - // - AliPoolsSet* GetPools() const {return fPools;} - void SetPools(AliPoolsSet* p) {fPools = p;} - // + protected: AliTracker(const AliTracker &atr); private: @@ -71,9 +67,6 @@ private: static AliRecoParam::EventSpecie_t fEventSpecie ; //! event specie, see AliRecoParam AliEventInfo* fEventInfo; //! pointer to the event info object - - protected: - AliPoolsSet* fPools; //! source of pools ClassDef(AliTracker,6) //abstract tracker }; diff --git a/STEER/STEERBase/AliClonesPool.cxx b/STEER/STEERBase/AliClonesPool.cxx deleted file mode 100644 index 6d2f7da73a6..00000000000 --- a/STEER/STEERBase/AliClonesPool.cxx +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include -#include "AliLog.h" -#include "AliClonesPool.h" - -ClassImp(AliClonesPool) - - -//_______________________________________________________________________________ -AliClonesPool::AliClonesPool(const char* classname, Int_t size) -: TClonesArray(classname,size), fFreeID(size>1000 ? size/100:10), fNFree(0), fLastID(-1), fCastToTrack(kFALSE) -{ - // ctor, delegate to TClonesArray - TClass* cl = TClass::GetClass(classname); - if (cl->InheritsFrom(AliVParticle::Class())) fCastToTrack = kTRUE; - else AliInfo(Form("Pool will use TObject::GetUniqueID to accout %s clones",classname)); - // -} - -//_______________________________________________________________________________ -AliClonesPool::AliClonesPool(const TClass* cl, Int_t size) - : TClonesArray(cl,size), fFreeID(size>1000 ? size/100:10), fNFree(0), fLastID(-1), fCastToTrack(kFALSE) -{ - // ctor, delegate to TClonesArray - if (cl->InheritsFrom(AliVParticle::Class())) fCastToTrack = kTRUE; - else AliInfo(Form("Pool will use TObject::GetUniqueID to accout %s clones",cl->ClassName())); - // -} - -//_______________________________________________________________________________ -AliClonesPool::AliClonesPool(const AliClonesPool& src) - : TClonesArray(src), fFreeID(src.fFreeID), fNFree(src.fNFree), fLastID(src.fLastID), fCastToTrack(src.fCastToTrack) -{ - // ctor, delegate to TClonesArray -} - -//_______________________________________________________________________________ -AliClonesPool& AliClonesPool::operator=(const AliClonesPool& src) -{ - if (this!=&src) { - TClonesArray::operator=(src); - fFreeID = src.fFreeID; - fNFree = src.fNFree; - fLastID = src.fLastID; - fCastToTrack = src.fCastToTrack; - } - return *this; -} - -//_______________________________________________________________________________ -AliClonesPool::~AliClonesPool() -{ - // d-tor - Delete(); -} - -//_______________________________________________________________________________ -void AliClonesPool::Clear(Option_t* opt) -{ - // reset all - TClonesArray::Clear(opt); - fNFree = 0; - fLastID = -1; -} - -//_______________________________________________________________________________ -void AliClonesPool::MarkSlotFree(TObject *sd) -{ - // account that this seed is "deleted" - int id; - if (!sd || (id=GetCloneID(sd))<0 ) return; - if (!IsReset()) { - // if (id<0) {AliError(Form("Freeing of seed %p NOT from the pool is requested",sd)); return;} - sd->Clear(""); - RemoveAt(id); - if (fFreeID.GetSize()<=fNFree) fFreeID.Set( 2*fNFree + 100 ); - fFreeID.GetArray()[fNFree++] = id; - } - // if (fCastToTrack) ((AliVParticle*)sd)->SetPoolID(-1); - // else sd->SetUniqueID(0); -} - -//_______________________________________________________________________________ -void AliClonesPool::PrintSummary(Option_t *opt) const -{ - // print summary - printf("Pool:%s, Booked %d, Size: %d, Freed: %d\n",GetName(), GetEntriesFast(),GetSize(),fNFree); - TString optS = opt; optS.ToLower(); - if (optS.Contains("l")) TClonesArray::Print(); -} diff --git a/STEER/STEERBase/AliClonesPool.h b/STEER/STEERBase/AliClonesPool.h deleted file mode 100644 index e161a933a20..00000000000 --- a/STEER/STEERBase/AliClonesPool.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef ALICLONESPOOL_H -#define ALICLONESPOOL_H - -#include -#include -#include "AliVParticle.h" - -class AliClonesPool: public TClonesArray -{ - public: - AliClonesPool() : fFreeID(),fNFree(0),fLastID(-1),fCastToTrack(kFALSE) {} - AliClonesPool(const char* classname, Int_t size = 1000); - AliClonesPool(const TClass* cl, Int_t size = 1000); - AliClonesPool(const AliClonesPool& src); - AliClonesPool& operator=(const AliClonesPool& src); - virtual ~AliClonesPool(); - virtual void Clear(Option_t* option=""); - // - Int_t GetLastID() const {return fLastID;} - Bool_t IsReset() const {return fLastID<0;} - TObject *&NextFreeSlot(); - void MarkSlotFree(TObject *sd); - void RegisterClone(TObject *sd) const {fCastToTrack ? ((AliVParticle*)sd)->SetPoolID(fLastID) : sd->SetUniqueID(UInt_t(fLastID+1));} - void PrintSummary(const Option_t* opt="") const; - // - protected: - Int_t GetCloneID(TObject* obj) const {return fCastToTrack ? ((AliVParticle*)obj)->GetPoolID() : (int(obj->GetUniqueID())-1);} - - protected: - TArrayI fFreeID; // array of ID's of free slots - Int_t fNFree; // number of slots freed in the pool - Int_t fLastID; // id of the slot which is returned by the NextFreeSlot method - Bool_t fCastToTrack; // AliVParticle-derived classes has GetPoolID method, use it - // - ClassDef(AliClonesPool,0) // pool of clones -}; - -inline TObject *& AliClonesPool::NextFreeSlot() { - // return slot where next object will be created (using new with placement) - return (*this)[ fLastID = fNFree ? fFreeID.GetArray()[--fNFree] : GetEntriesFast() ]; -} - - -#endif diff --git a/STEER/STEERBase/AliExternalTrackParam.h b/STEER/STEERBase/AliExternalTrackParam.h index 88c9d9ee86d..60cc1849308 100644 --- a/STEER/STEERBase/AliExternalTrackParam.h +++ b/STEER/STEERBase/AliExternalTrackParam.h @@ -250,7 +250,7 @@ class AliExternalTrackParam: public AliVTrack { Double32_t fAlpha; // Local <-->global coor.system rotation angle Double32_t fP[5]; // The track parameters Double32_t fC[15]; // The track parameter covariance matrix - // + static Double32_t fgMostProbablePt; // "Most probable" pt // (to be used if Bz=0) static Bool_t fgUseLogTermMS; // use log term in Mult.Stattering evaluation diff --git a/STEER/STEERBase/AliPoolN.cxx b/STEER/STEERBase/AliPoolN.cxx deleted file mode 100644 index 10e03932fa2..00000000000 --- a/STEER/STEERBase/AliPoolN.cxx +++ /dev/null @@ -1,215 +0,0 @@ -#include "AliPoolN.h" -#include "AliLog.h" -#include - - -ClassImp(AliPoolN) - -//_______________________________________________ -AliPoolN& AliPoolN::operator=(const AliPoolN& src) -{ - // assign - if (this!=&src) { - if (fPool) delete[] fPool; - fSize = src.fSize; - fPool = new Int_t[fSize]; - memcpy(fPool,src.fPool,sizeof(Int_t)*fSize); - fPtrSlot = src.fPtrSlot; - fFreeSlot = src.fFreeSlot; - fNBooked = src.fNBooked; - fNFreed = src.fNFreed; - } - return *this; -} - - -//_______________________________________________ -void AliPoolN::Clear(Option_t*) -{ - // reset - fNBooked = fFreeSlot = fNFreed = 0; - SetUniqueID(0); -} - -//_______________________________________________ -int* AliPoolN::BookSlots(void** addr, int n, int wsize) -{ - // book n slots of size wsize (aligning to sizeof(int)) - const int kIntW = sizeof(Int_t); - const int kDivW = TMath::Log2(sizeof(Int_t)); - const int kPtrW = sizeof(void*); - const int kPtrIW = kPtrW/kIntW; // pointer length in int words - static int eCounter = 0; - // - if (n<1) return 0; - int nbtot = n*wsize; // total bytes to book (apart from addr) - if (nbtot%kIntW) nbtot = (((nbtot>>kDivW)+1)<>kDivW); // number of int words to book (including space for pointer) - UInt_t newFreeSlot = fFreeSlot+nw; - // - if (UInt_t(fPtrSlot.GetSize())<=fNBooked) fPtrSlot.Set( 2*(fNBooked+10) ); - int* ptrS = fPtrSlot.GetArray(); - if (fSize<=newFreeSlot) { // do we need to expand the array ? - // - int sizeN = int((newFreeSlot+10000)*1.5); - Int_t* oldArr = fPool; - fPool = new Int_t[sizeN]; - if (fSize) memcpy(fPool,oldArr, fSize*sizeof(Int_t)); - memset(&fPool[fSize],0,(sizeN-fSize)*sizeof(Int_t)); - // - for (UInt_t i=0;i>%d %p %p old:%p\n",i,ppp, ppp ? *ppp : 0,oldP); - if (!ppp || *ppp!=oldP) continue; // array was discarded - *ppp = &fPool[ ptrS[i]+kPtrIW ]; - } - fSize = sizeN; - delete[] oldArr; - AliInfo(Form("Expansion %d: Size:%d, Object Booked:%d, Freed:%d, Next Free Slot:%d\n", - ++eCounter,fSize,fNBooked,fNFreed,fFreeSlot)); - } - ptrS[fNBooked++] = fFreeSlot; - void** slotP = (void**)&fPool[ fFreeSlot ]; - slotP[0] = addr; - SetUniqueID(fFreeSlot+kPtrIW); - fFreeSlot = newFreeSlot; - // - return &fPool[GetUniqueID()]; -} - -//_______________________________________________ -void AliPoolN::PrintSummary(Option_t*) const -{ - // print summary - printf("Pool: Num.Arrays: Size:%d, Object Booked:%d, Freed:%d, Next Free Slot:%d\n", - fSize,fNBooked,fNFreed,fFreeSlot); -} - - -//_______________________________________________ -AliPoolN::AliPoolN(Int_t nini) : - fSize(nini>100 ? nini:10000),fPool(new Int_t[fSize]),fPtrSlot(fSize/10),fNBooked(0), - fNFreed(0),fFreeSlot(0) -{ - // c-tor -} - -//_______________________________________________ -AliPoolN::AliPoolN(const AliPoolN& src) : - TObject(src), fSize(src.fSize),fPool(new Int_t[fSize]),fPtrSlot(src.fPtrSlot), - fNBooked(src.fNBooked), fNFreed(src.fNFreed),fFreeSlot(src.fFreeSlot) -{ - // c-tor -} - -//_______________________________________________ -void AliPoolN::FreeSlot(void* adr) -{ - char** adrc = (char**)adr; - if (!(*adrc)) return; //{ printf("ATTENTION: 0 pointer is freed\n"); return; } - *adrc = NULL; fNFreed++; -} - -//_______________________________________________ -Int_t AliPoolN::GetUsedSize() -{ - // estimate which fraction of array is actually used - const int kIntW = sizeof(Int_t); - const int kPtrW = sizeof(void*); - const int kPtrIW = kPtrW/kIntW; // pointer length in int words - // - if (fFreeSlot<1) return 0.; // empty - int nFreeW=0, freeStart=-1,freeEnd=-1; - int* ptrS = fPtrSlot.GetArray(); - // - for (UInt_t i=0;i -#include - -class AliPoolN : public TObject -{ - public: - // - AliPoolN() : fSize(0),fPool(0),fPtrSlot(),fNBooked(0),fNFreed(0),fFreeSlot(0) {} - AliPoolN(Int_t nini); - AliPoolN(const AliPoolN& src); - AliPoolN& operator=(const AliPoolN& src); - // - virtual ~AliPoolN() {delete[] fPool;} - virtual void Clear(Option_t* option=""); - void PrintSummary(Option_t* option="") const; - void Reset() {Clear();} - // - Int_t* BookI( int n, Int_t **addr) { return (Int_t*)BookSlots((void**)addr,n,sizeof(Int_t));} - UInt_t* BookUI(int n, UInt_t **addr) { return (UInt_t*)BookSlots((void**)addr,n,sizeof(UInt_t));} - Short_t* BookS( int n, Short_t **addr) { return (Short_t*)BookSlots((void**)addr,n,sizeof(Short_t));} - UShort_t* BookUS(int n, UShort_t **addr) { return (UShort_t*)BookSlots((void**)addr,n,sizeof(UShort_t));} - Char_t* BookC( int n, Char_t **addr) { return (Char_t*)BookSlots((void**)addr,n,sizeof(Char_t));} - Bool_t* BookB( int n, Bool_t **addr) { return (Bool_t*)BookSlots((void**)addr,n,sizeof(Bool_t));} - Float_t* BookF( int n, Float_t **addr) { return (Float_t*)BookSlots((void**)addr,n,sizeof(Float_t));} - Double_t* BookD( int n, Double_t **addr) { return (Double_t*)BookSlots((void**)addr,n,sizeof(Double_t));} - Long64_t* BookL64(int n, Long64_t **addr) { return (Long64_t*)BookSlots((void**)addr,n,sizeof(Long64_t));} - Double32_t* BookD32(int n, Double32_t **addr) { return (Double32_t*)BookSlots((void**)addr,n,sizeof(Double32_t));} - // - void FreeSlot(void* adr);/* {char** adrc = (char**)adr; - if (*adrc) { - printf("ATTENTION: 0 pointed is freed\n"); - } - *adrc = NULL; fNFreed++;}*/ - // - Bool_t IsReset() const {return GetUniqueID()==0;} - Int_t* GetArr() {return (Int_t*)fPool;} - UInt_t GetSize() {return fSize;} - Int_t GetUsedSize(); - void Defragment(); - // - protected: - int* BookSlots(void** addr, int n, int wsize); - // - protected: - UInt_t fSize; // pool length - Int_t* fPool; // container for values - TArrayI fPtrSlot; // container for object's addresses slots - UInt_t fNBooked; // number of booked arrays - UInt_t fNFreed; // number of freed arrays - UInt_t fFreeSlot; // first free slot - // - ClassDef(AliPoolN,1) // pool for numerical values -}; - -#endif diff --git a/STEER/STEERBase/AliPoolsSet.cxx b/STEER/STEERBase/AliPoolsSet.cxx deleted file mode 100644 index 1eedc4aea01..00000000000 --- a/STEER/STEERBase/AliPoolsSet.cxx +++ /dev/null @@ -1,77 +0,0 @@ -#include "AliPoolsSet.h" -#include "AliLog.h" - -ClassImp(AliPoolsSet) - -//__________________________________________ -AliPoolsSet::AliPoolsSet() : fPools(kMaxPools) -{ - // def ctor - fPools.SetOwner(); -} - -//___________________________________________________________ -void AliPoolsSet::InitPools() -{ - // Create obligatory pools (which always needed). - // The pools for specific detector objects are initialized by respective trackers of AliReconstruction - AliInfo("Initializing pools>>"); - if (!GetPoolN()) SetPool(new AliPoolN(100000), kPoolN); - if (!GetPool(kPoolExtTrPar)) { - SetPool(new AliClonesPool("AliExternalTrackParam",5000), kPoolExtTrPar); - GetPoolC(kPoolExtTrPar)->SetName("ExternalTrackParam"); - } - if (!GetPool(kPoolTrFriend)) { - SetPool(new AliClonesPool("AliESDfriendTrack",5000),kPoolTrFriend); - GetPoolC(kPoolTrFriend)->SetName("ESDfriendTrack"); - } - if (!GetPool(kPoolTPCdEdx)) { - SetPool(new AliClonesPool("AliTPCdEdxInfo",5000), kPoolTPCdEdx); - GetPoolC(kPoolTPCdEdx)->SetName("TPCdEdxInfo"); - } - // - AliInfo("Initializing pools<<"); -} - -//___________________________________________________________ -void AliPoolsSet::DeletePools() -{ - // delete all global pools - fPools.Delete(); -} - -//___________________________________________________________ -void AliPoolsSet::ResetPools() -{ - // reset all pools - for (int i=kMaxPools;i--;) { - TObject* pool = GetPool(i); - if (!pool) continue; - pool->Clear("C"); - } -} - -//___________________________________________________________ -Bool_t AliPoolsSet::SetPool(TObject* pool, Int_t id) -{ - // attach the pool - if (!pool) return kFALSE; - if (id<0 || id>=kMaxPools) AliFatal(Form("Defined pool id's are 0:%d, %d requested",kMaxPools,id)); - if (!pool->InheritsFrom("AliPoolN") && !pool->InheritsFrom("AliClonesPool")) - AliFatal(Form("Supported pool types: %s,%s | supplied %s","AliPoolN","AliClonesPool",pool->ClassName())); - // - fPools[id] = pool; - return kTRUE; -} - -//___________________________________________________________ -void AliPoolsSet::Print(Option_t* opt) const -{ - // print summary - for (int i=0;iIsA() == AliClonesPool::Class() ) ((AliClonesPool*)pl)->PrintSummary(opt); - else if ( pl->IsA() == AliPoolN::Class() ) ((AliPoolN*)pl)->PrintSummary(opt); - } -} diff --git a/STEER/STEERBase/AliPoolsSet.h b/STEER/STEERBase/AliPoolsSet.h deleted file mode 100644 index 01d71a8d76b..00000000000 --- a/STEER/STEERBase/AliPoolsSet.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef ALIPOOLSSET_H -#define ALIPOOLSSET_H - -#include -#include "AliPoolN.h" -#include "AliClonesPool.h" - - -class AliPoolsSet : public TObject -{ - public: - // - enum {kPoolN, // special pool for numeric arrays (AliPoolN class) - kPoolExtTrPar, // pool for AliExternalTrackParam objects (AliClonesPool) - kPoolTrPoints, // pool for AliTrackPointArray objects (AliClonesPool) - kPoolTrITS, // pool for ITS tracks (AliClonesPool) - kPoolTrTRD, // pool for TRD tracks (AliClonesPool) - kPoolTrFriend, // pool for AliESDfriendTrack (AliClonesPool) - kPoolTPCdEdx, // pool for AliTPCdEdx (AliClonesPool) - kPoolTPCSeed, // pool for TPC seeds - kPoolTPCKink, // pool for TPC kinks - kMaxPools}; // total number of pools - // - AliPoolsSet(); - AliPoolsSet(const AliPoolsSet& src) : TObject(src),fPools(src.fPools) {} - virtual ~AliPoolsSet() {DeletePools();} - AliPoolsSet& operator=(const AliPoolsSet& src) { if (this!=&src) {this->TObject::operator=(src);fPools=src.fPools;} return *this;} - // - AliPoolN* GetPoolN() const {return dynamic_cast(GetPool(kPoolN));} - AliClonesPool* GetPoolC(Int_t id) const {return dynamic_cast(GetPool(id));} - TObject* GetPool(Int_t id) const {return fPools[id];} - // detector-specific pools require setters - Bool_t SetPool(TObject* pool, Int_t id); - // - void ResetPools(); - void InitPools(); - void DeletePools(); - void Print(Option_t* opt="") const; - // - // shortcuts - AliClonesPool* GetPoolExtTrPar() const {return GetPoolC(kPoolExtTrPar);} - AliClonesPool* GetPoolTrPoints() const {return GetPoolC(kPoolTrPoints);} - AliClonesPool* GetPoolTrFriend() const {return GetPoolC(kPoolTrFriend);} - AliClonesPool* GetPoolTPCdEdx() const {return GetPoolC(kPoolTPCdEdx);} - AliClonesPool* GetPoolTrITS() const {return GetPoolC(kPoolTrITS);} - AliClonesPool* GetPoolTrTRD() const {return GetPoolC(kPoolTrTRD);} - AliClonesPool* GetPoolTPCSeed() const {return GetPoolC(kPoolTPCSeed);} - // - protected: - // - TObjArray fPools; //! array of pools - // - ClassDef(AliPoolsSet,0) // set of pools -}; - - -#endif diff --git a/STEER/STEERBase/AliVParticle.cxx b/STEER/STEERBase/AliVParticle.cxx index ddf1c758b00..972894015ef 100644 --- a/STEER/STEERBase/AliVParticle.cxx +++ b/STEER/STEERBase/AliVParticle.cxx @@ -26,13 +26,13 @@ ClassImp(AliVParticle) AliVParticle::AliVParticle(const AliVParticle& vPart) : -TObject(vPart), fPoolID(-1) { } // Copy constructor + TObject(vPart) { } // Copy constructor AliVParticle& AliVParticle::operator=(const AliVParticle& vPart) { if (this!=&vPart) { TObject::operator=(vPart); } - fPoolID = -1; + return *this; } diff --git a/STEER/STEERBase/AliVParticle.h b/STEER/STEERBase/AliVParticle.h index 95588e4073a..d2db0295594 100644 --- a/STEER/STEERBase/AliVParticle.h +++ b/STEER/STEERBase/AliVParticle.h @@ -24,14 +24,11 @@ const Double_t kAlmost0Field=1.e-13; class AliVParticle: public TObject { public: - AliVParticle() : fPoolID(-1) { } + AliVParticle() { } virtual ~AliVParticle() { } AliVParticle(const AliVParticle& vPart); AliVParticle& operator=(const AliVParticle& vPart); - virtual void SetPoolID(const Int_t id) {fPoolID = id;} - virtual Int_t GetPoolID() const {return fPoolID;} - // kinematics virtual Double_t Px() const = 0; virtual Double_t Py() const = 0; @@ -86,10 +83,8 @@ public: Bool_t Global2LocalPosition(Double_t r[3], Double_t alpha) const; - protected: - Int_t fPoolID; //! id of position in the pool - - ClassDef(AliVParticle, 4) // base class for particles + + ClassDef(AliVParticle, 3) // base class for particles }; #endif diff --git a/STEER/STEERBaseLinkDef.h b/STEER/STEERBaseLinkDef.h index 8c62d78d874..2a7cc7d6eec 100644 --- a/STEER/STEERBaseLinkDef.h +++ b/STEER/STEERBaseLinkDef.h @@ -109,8 +109,4 @@ #pragma link C++ class AliVMFT+; -#pragma link C++ class AliPoolN+; -#pragma link C++ class AliClonesPool+; -#pragma link C++ class AliPoolsSet+; - #endif diff --git a/TPC/AliTPCclustererMI.cxx b/TPC/AliTPCclustererMI.cxx index cf1cecec3c2..1a07f11aae8 100644 --- a/TPC/AliTPCclustererMI.cxx +++ b/TPC/AliTPCclustererMI.cxx @@ -220,8 +220,7 @@ void AliTPCclustererMI::SetOutput(TTree * tree) fOutput= tree; AliTPCClustersRow clrow("AliTPCclusterMI"); AliTPCClustersRow *pclrow=&clrow; - fOutput->Branch("Segment","AliTPCClustersRow",&pclrow,32000/4); - tree->SetAutoFlush(20); + fOutput->Branch("Segment","AliTPCClustersRow",&pclrow,32000,200); } diff --git a/TPC/AliTPCseed.cxx b/TPC/AliTPCseed.cxx index 422b3ac003a..725ed2832c0 100644 --- a/TPC/AliTPCseed.cxx +++ b/TPC/AliTPCseed.cxx @@ -69,7 +69,8 @@ AliTPCseed::AliTPCseed(): fSeed1(-1), fSeed2(-1), fMAngular(0), - fCircular(0) + fCircular(0), + fPoolID(-1) { // for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3); @@ -112,7 +113,8 @@ AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner): fSeed1(-1), fSeed2(-1), fMAngular(0), - fCircular(0) + fCircular(0), + fPoolID(-1) { //--------------------- // dummy copy constructor @@ -167,7 +169,8 @@ AliTPCseed::AliTPCseed(const AliTPCtrack &t): fSeed1(-1), fSeed2(-1), fMAngular(0), - fCircular(0) + fCircular(0), + fPoolID(-1) { // // Constructor from AliTPCtrack @@ -221,7 +224,8 @@ AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5], fSeed1(-1), fSeed2(-1), fMAngular(0), - fCircular(0) + fCircular(0), + fPoolID(-1) { // // Constructor @@ -256,6 +260,7 @@ AliTPCseed & AliTPCseed::operator=(const AliTPCseed ¶m) { // // assignment operator + // don't touch pool ID // if(this!=¶m){ AliTPCtrack::operator=(param); @@ -1700,5 +1705,4 @@ void AliTPCseed::Clear(Option_t*) // formally seed may allocate memory for clusters (althought this should not happen for // the seeds in the pool). Hence we need this method for fwd. compatibility if (fClusterOwner) for (int i=160;i--;) {delete fClusterPointer[i]; fClusterPointer[i] = 0;} - AliTPCtrack::Clear(); } diff --git a/TPC/AliTPCseed.h b/TPC/AliTPCseed.h index 7ba73102617..2a757cfb32b 100644 --- a/TPC/AliTPCseed.h +++ b/TPC/AliTPCseed.h @@ -146,6 +146,8 @@ class AliTPCseed : public AliTPCtrack { static Double_t GetQCorrShape(Int_t ipad, Int_t type,Float_t z, Float_t ty, Float_t tz, Float_t q, Float_t thr); // Float_t GetTPCClustInfo(Int_t nNeighbours, Int_t type, Int_t row0, Int_t row1); + void SetPoolID(Int_t id) {fPoolID = id;} + Int_t GetPoolID() const {return fPoolID;} private: // AliTPCseed & operator = (const AliTPCseed &) // {::Fatal("= operator","Not Implemented\n");return *this;} @@ -186,6 +188,7 @@ class AliTPCseed : public AliTPCtrack { Float_t fMAngular; // mean angular factor Char_t fCircular; // indicates curlin track AliTPCTrackerPoint fTrackPoints[160]; //track points - array track points + Int_t fPoolID; //! id in the pool ClassDef(AliTPCseed,6) }; diff --git a/TPC/AliTPCtrackerMI.cxx b/TPC/AliTPCtrackerMI.cxx index f194cf48bde..91ecd234ab0 100644 --- a/TPC/AliTPCtrackerMI.cxx +++ b/TPC/AliTPCtrackerMI.cxx @@ -142,11 +142,10 @@ #include "AliTPCTransform.h" #include "AliTPCClusterParam.h" #include "AliTPCdEdxInfo.h" -#include "AliClonesPool.h" -#include "AliPoolsSet.h" #include "AliDCSSensorArray.h" #include "AliDCSSensor.h" #include "AliDAQ.h" + // ClassImp(AliTPCtrackerMI) @@ -207,7 +206,9 @@ AliTPCtrackerMI::AliTPCtrackerMI() fDebugStreamer(0), fUseHLTClusters(4), fSeedsPool(0), - fKinksPool(0) + fFreeSeedsID(500), + fNFreeSeeds(0), + fLastSeedID(-1) { // // default constructor @@ -420,7 +421,9 @@ AliTracker(), fDebugStreamer(0), fUseHLTClusters(4), fSeedsPool(0), - fKinksPool(0) + fFreeSeedsID(500), + fNFreeSeeds(0), + fLastSeedID(-1) { //--------------------------------------------------------------------- // The main TPC tracker constructor @@ -454,11 +457,7 @@ AliTracker(), fDebugStreamer = new TTreeSRedirector("TPCdebug.root"); } // - fSeedsPool = new AliClonesPool("AliTPCseed",1000); - fSeedsPool->SetName("TPCSeed"); - fKinksPool = new AliClonesPool("AliKink",1000); - fKinksPool->SetName("TPCKink"); - + fSeedsPool = new TClonesArray("AliTPCseed",1000); } //________________________________________________________________________ AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t): @@ -483,7 +482,9 @@ AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t): fDebugStreamer(0), fUseHLTClusters(4), fSeedsPool(0), - fKinksPool(0) + fFreeSeedsID(500), + fNFreeSeeds(0), + fLastSeedID(-1) { //------------------------------------ // dummy copy constructor @@ -515,8 +516,7 @@ AliTPCtrackerMI::~AliTPCtrackerMI() { delete fSeeds; } if (fDebugStreamer) delete fDebugStreamer; - if (fSeedsPool && !fPools) delete fSeedsPool; // RS: owned by reconstruction pools (if exist) - if (fKinksPool && !fPools) delete fKinksPool; // RS: owned by reconstruction pools (if exist) + if (fSeedsPool) delete fSeedsPool; } @@ -2302,7 +2302,7 @@ void AliTPCtrackerMI::RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t fac if (!pt) continue; // if (quality[trackindex]<0){ - fSeedsPool->MarkSlotFree( arr->RemoveAt(trackindex) ); + MarkSeedFree( arr->RemoveAt(trackindex) ); continue; } // @@ -2330,7 +2330,7 @@ void AliTPCtrackerMI::RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t fac "pt.="<MarkSlotFree( arr->RemoveAt(trackindex) ); + MarkSeedFree( arr->RemoveAt(trackindex) ); continue; } if (pt->GetNumberOfClusters()<50&&(found-0.5*shared)MarkSlotFree( arr->RemoveAt(trackindex) ); + MarkSeedFree( arr->RemoveAt(trackindex) ); continue; } } @@ -2583,7 +2583,7 @@ void AliTPCtrackerMI::SignClusters(const TObjArray * arr, Float_t fnumber, Float pt->GetClusterStatistic(0,160,found, foundable,shared); if (shared/float(found)>0.3) { if (shared/float(found)>0.9 ){ - //fSeedsPool->MarkSlotFree( arr->RemoveAt(i) ); + //MarkSeedFree( arr->RemoveAt(i) ); } continue; } @@ -2774,22 +2774,17 @@ Int_t AliTPCtrackerMI::RefitInward(AliESDEvent *event) } signal[3] = seed->GetDEDXregion(4); // - AliClonesPool* pooldEdx = fPools ? fPools->GetPoolTPCdEdx() : 0; - AliTPCdEdxInfo * infoTpcPid = 0; - if (pooldEdx) { - infoTpcPid = new(pooldEdx->NextFreeSlot()) AliTPCdEdxInfo(); - pooldEdx->RegisterClone(pooldEdx); - } - else infoTpcPid = new AliTPCdEdxInfo(); + AliTPCdEdxInfo * infoTpcPid = new AliTPCdEdxInfo(); infoTpcPid->SetTPCSignalRegionInfo(signal, ncl, nrows); esd->SetTPCdEdxInfo(infoTpcPid); // // add seed to the esd track in Calib level // Bool_t storeFriend = gRandom->Rndm()<(kMaxFriendTracks)/Float_t(nseed); - if (AliTPCReconstructor::StreamLevel()>0 &&storeFriend){ - AliTPCseed * seedCopy = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(*seed, kTRUE); - fSeedsPool->RegisterClone(seedCopy); + if (AliTPCReconstructor::StreamLevel()>0 &&storeFriend){ + // RS: this is the only place where the seed is created not in the pool, + // since it should belong to ESDevent + AliTPCseed * seedCopy = new AliTPCseed(*seed, kTRUE); esd->AddCalibObject(seedCopy); } ntracks++; @@ -2903,11 +2898,11 @@ Int_t AliTPCtrackerMI::PostProcess(AliESDEvent *event) } -void AliTPCtrackerMI::DeleteSeeds() + void AliTPCtrackerMI::DeleteSeeds() { // fSeeds->Clear(); - fSeedsPool->Clear("C"); // nominally allocate memory + ResetSeedsPool(); delete fSeeds; fSeeds =0; } @@ -2935,8 +2930,8 @@ void AliTPCtrackerMI::ReadSeeds(const AliESDEvent *const event, Int_t direction) AliTPCtrack t(*esd); t.SetNumberOfClusters(0); // AliTPCseed *seed = new AliTPCseed(t,t.GetAlpha()); - AliTPCseed *seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(t/*,t.GetAlpha()*/); - fSeedsPool->RegisterClone(seed); + AliTPCseed *seed = new( NextFreeSeed() ) AliTPCseed(t/*,t.GetAlpha()*/); + seed->SetPoolID(fLastSeedID); seed->SetUniqueID(esd->GetID()); AddCovariance(seed); //add systematic ucertainty for (Int_t ikink=0;ikink<3;ikink++) { @@ -2959,7 +2954,7 @@ void AliTPCtrackerMI::ReadSeeds(const AliESDEvent *const event, Int_t direction) if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) == 0 ) seed->ResetCovariance(10.); //if ( direction ==2 && ((status & AliESDtrack::kTPCout) == 0) ) { // fSeeds->AddAt(0,i); - // fSeedsPool->MarkSlotFree( seed ); + // MarkSeedFree( seed ); // continue; //} if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) > 0 ) { @@ -2991,7 +2986,7 @@ void AliTPCtrackerMI::ReadSeeds(const AliESDEvent *const event, Int_t direction) if (TMath::Abs(alpha) > 0.001) { // This should not happen normally AliWarning(Form("Rotating track over %f",alpha)); if (!seed->Rotate(alpha)) { - fSeedsPool->MarkSlotFree( seed ); + MarkSeedFree( seed ); continue; } } @@ -3043,8 +3038,8 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Double_t x[5], c[15]; // Int_t di = i1-i2; // - AliTPCseed * seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(); - fSeedsPool->RegisterClone(seed); + AliTPCseed * seed = new( NextFreeSeed() ) AliTPCseed(); + seed->SetPoolID(fLastSeedID); Double_t alpha=fSectors->GetAlpha(), shift=fSectors->GetAlphaShift(); Double_t cs=cos(alpha), sn=sin(alpha); // @@ -3254,9 +3249,9 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, // if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue; UInt_t index=kr1.GetIndex(is); - if (seed) {fSeedsPool->MarkSlotFree(seed); seed = 0;} - AliTPCseed *track = seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x1, ns*alpha+shift, x, c, index); - fSeedsPool->RegisterClone(seed); + if (seed) {MarkSeedFree(seed); seed = 0;} + AliTPCseed *track = seed = new( NextFreeSeed() ) AliTPCseed(x1, ns*alpha+shift, x, c, index); + seed->SetPoolID(fLastSeedID); track->SetIsSeeding(kTRUE); track->SetSeed1(i1); track->SetSeed2(i2); @@ -3268,7 +3263,7 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Int_t foundable,found,shared; track->GetClusterStatistic((i1+i2)/2,i1, found, foundable, shared, kTRUE); if ((found<0.55*foundable) || shared>0.5*found || (track->GetSigmaY2()+track->GetSigmaZ2())>0.5){ - fSeedsPool->MarkSlotFree(seed); seed = 0; + MarkSeedFree(seed); seed = 0; continue; } //} @@ -3286,7 +3281,7 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, if (track->GetNumberOfClusters()<(i1-i2)*0.5 || track->GetNumberOfClusters() < track->GetNFoundable()*0.6 || track->GetNShared()>0.4*track->GetNumberOfClusters() ) { - fSeedsPool->MarkSlotFree(seed); seed = 0; + MarkSeedFree(seed); seed = 0; continue; } nout1++; @@ -3306,11 +3301,11 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, track2->SetBConstrain(kFALSE); track2->SetSeedType(1); arr->AddLast(track2); - fSeedsPool->MarkSlotFree( seed ); seed = 0; + MarkSeedFree( seed ); seed = 0; continue; } else{ - fSeedsPool->MarkSlotFree( seed ); seed = 0; + MarkSeedFree( seed ); seed = 0; continue; } @@ -3319,8 +3314,8 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, track->SetSeedType(0); arr->AddLast(track); // note, track is seed, don't free the seed - seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed; - fSeedsPool->RegisterClone(seed); + seed = new( NextFreeSeed() ) AliTPCseed; + seed->SetPoolID(fLastSeedID); nout2++; // don't consider other combinations if (track->GetNumberOfClusters() > track->GetNFoundable()*0.8) @@ -3331,7 +3326,7 @@ void AliTPCtrackerMI::MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, if (fDebug>3){ Info("MakeSeeds3","\nSeeding statistic:\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2); } - if (seed) fSeedsPool->MarkSlotFree( seed ); + if (seed) MarkSeedFree( seed ); } @@ -3359,8 +3354,8 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Double_t x[5], c[15]; // // make temporary seed - AliTPCseed * seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed; - fSeedsPool->RegisterClone(seed); + AliTPCseed * seed = new( NextFreeSeed() ) AliTPCseed; + seed->SetPoolID(fLastSeedID); Double_t alpha=fOuterSec->GetAlpha(), shift=fOuterSec->GetAlphaShift(); // Double_t cs=cos(alpha), sn=sin(alpha); // @@ -3541,9 +3536,9 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, // if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue; index=kr1.GetIndex(is); - if (seed) {fSeedsPool->MarkSlotFree( seed ); seed = 0;} - AliTPCseed *track = seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x1, sec*alpha+shift, x, c, index); - fSeedsPool->RegisterClone(seed); + if (seed) {MarkSeedFree( seed ); seed = 0;} + AliTPCseed *track = seed = new( NextFreeSeed() ) AliTPCseed(x1, sec*alpha+shift, x, c, index); + seed->SetPoolID(fLastSeedID); track->SetIsSeeding(kTRUE); @@ -3551,7 +3546,7 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, FollowProlongation(*track, i1-7,1); if (track->GetNumberOfClusters() < track->GetNFoundable()*0.75 || track->GetNShared()>0.6*track->GetNumberOfClusters() || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.6){ - fSeedsPool->MarkSlotFree( seed ); seed = 0; + MarkSeedFree( seed ); seed = 0; continue; } nout1++; @@ -3565,7 +3560,7 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, if (track->GetNumberOfClusters()<(i1-i2)*0.5 || track->GetNumberOfClusters()GetNFoundable()*0.7 || track->GetNShared()>2. || track->GetChi2()/track->GetNumberOfClusters()>6 || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.5 ) { - fSeedsPool->MarkSlotFree( seed ); seed = 0; + MarkSeedFree( seed ); seed = 0; continue; } @@ -3576,7 +3571,7 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, track2->SetBConstrain(kFALSE); track2->SetSeedType(4); arr->AddLast(track2); - fSeedsPool->MarkSlotFree( seed ); seed = 0; + MarkSeedFree( seed ); seed = 0; } @@ -3589,7 +3584,7 @@ void AliTPCtrackerMI::MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, if (fDebug>3){ Info("MakeSeeds5","\nSeeding statiistic:\t%d\t%d\t%d\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin,nout1,nout2,nout3); } - if (seed) fSeedsPool->MarkSlotFree(seed); + if (seed) MarkSeedFree(seed); } @@ -3621,8 +3616,8 @@ void AliTPCtrackerMI::MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, AliTPCpolyTrack polytrack; Int_t nclusters=fSectors[sec][row0]; - AliTPCseed * seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed; - fSeedsPool->RegisterClone(seed); + AliTPCseed * seed = new( NextFreeSeed() ) AliTPCseed; + seed->SetPoolID(fLastSeedID); Int_t sumused=0; Int_t cused=0; @@ -3820,9 +3815,9 @@ void AliTPCtrackerMI::MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, UInt_t index=0; //kr0.GetIndex(is); - if (seed) {fSeedsPool->MarkSlotFree( seed ); seed = 0;} - AliTPCseed *track = seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x1,sec*alpha+shift,x,c,index); - fSeedsPool->RegisterClone(seed); + if (seed) {MarkSeedFree( seed ); seed = 0;} + AliTPCseed *track = seed = new( NextFreeSeed() ) AliTPCseed(x1,sec*alpha+shift,x,c,index); + seed->SetPoolID(fLastSeedID); track->SetIsSeeding(kTRUE); Int_t rc=FollowProlongation(*track, i2); if (constrain) track->SetBConstrain(1); @@ -3834,12 +3829,12 @@ void AliTPCtrackerMI::MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, if (rc==0 || track->GetNumberOfClusters()<(i1-i2)*0.5 || track->GetNumberOfClusters() < track->GetNFoundable()*0.6 || track->GetNShared()>0.4*track->GetNumberOfClusters()) { - fSeedsPool->MarkSlotFree( seed ); seed = 0; + MarkSeedFree( seed ); seed = 0; } else { arr->AddLast(track); // track IS seed, don't free seed - seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed; - fSeedsPool->RegisterClone(seed); + seed = new( NextFreeSeed() ) AliTPCseed; + seed->SetPoolID(fLastSeedID); } nin3++; } @@ -3848,7 +3843,7 @@ void AliTPCtrackerMI::MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, if (fDebug>3){ Info("MakeSeeds2","\nSeeding statiistic:\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin3); } - if (seed) fSeedsPool->MarkSlotFree( seed ); + if (seed) MarkSeedFree( seed ); } @@ -3970,8 +3965,8 @@ AliTPCseed *AliTPCtrackerMI::MakeSeed(AliTPCseed *const track, Float_t r0, Float c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; // Int_t row1 = fSectors->GetRowNumber(x2[0]); - AliTPCseed *seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x2[0], sec2*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0); - fSeedsPool->RegisterClone(seed); + AliTPCseed *seed = new( NextFreeSeed() ) AliTPCseed(x2[0], sec2*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0); + seed->SetPoolID(fLastSeedID); // Double_t y0,z0,y1,z1, y2,z2; //seed->GetProlongation(x0[0],y0,z0); // seed->GetProlongation(x1[0],y1,z1); @@ -4091,8 +4086,8 @@ AliTPCseed *AliTPCtrackerMI::ReSeed(const AliTPCseed *track, Float_t r0, Float_t c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; // Int_t row1 = fSectors->GetRowNumber(xyz[2][0]); - AliTPCseed *seed=new( fSeedsPool->NextFreeSlot() ) AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0); - fSeedsPool->RegisterClone(seed); + AliTPCseed *seed=new( NextFreeSeed() ) AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0); + seed->SetPoolID(fLastSeedID); seed->SetLastPoint(row[2]); seed->SetFirstPoint(row[2]); return seed; @@ -4241,8 +4236,8 @@ AliTPCseed *AliTPCtrackerMI::ReSeed(AliTPCseed *track,Int_t r0, Bool_t forward) c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43; // Int_t row1 = fSectors->GetRowNumber(xyz[2][0]); - AliTPCseed *seed=new( fSeedsPool->NextFreeSlot() ) AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0); - fSeedsPool->RegisterClone(seed); + AliTPCseed *seed=new( NextFreeSeed() ) AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0); + seed->SetPoolID(fLastSeedID); seed->SetLastPoint(row[2]); seed->SetFirstPoint(row[2]); for (Int_t i=row[0];iMarkSlotFree( array->RemoveAt(index1) ); + MarkSeedFree( array->RemoveAt(index1) ); } } } @@ -4800,24 +4795,27 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) // // RS something is wrong in this routine: not all seeds are assigned to daughters and mothers array, but they all are queried // to check later - if (fPools && !fPools->GetPool(AliPoolsSet::kPoolTPCKink)) fPools->SetPool(fKinksPool,AliPoolsSet::kPoolTPCKink); - fKinksPool->Clear(); + + TObjArray *kinks= new TObjArray(10000); // TObjArray *v0s= new TObjArray(10000); Int_t nentries = array->GetEntriesFast(); - AliHelix *helixes = new AliHelix[nentries]; - Int_t sign[nentries]; - Int_t nclusters[nentries]; - Float_t alpha[nentries]; - Int_t usage[nentries]; - Float_t zm[nentries]; - Float_t z0[nentries]; - Float_t fim[nentries]; - Float_t shared[nentries]; - Bool_t circular[nentries]; - Float_t dca[nentries]; + AliHelix *helixes = new AliHelix[nentries]; + Int_t *sign = new Int_t[nentries]; + Int_t *nclusters = new Int_t[nentries]; + Float_t *alpha = new Float_t[nentries]; + AliKink *kink = new AliKink(); + Int_t * usage = new Int_t[nentries]; + Float_t *zm = new Float_t[nentries]; + Float_t *z0 = new Float_t[nentries]; + Float_t *fim = new Float_t[nentries]; + Float_t *shared = new Float_t[nentries]; + Bool_t *circular = new Bool_t[nentries]; + Float_t *dca = new Float_t[nentries]; //const AliESDVertex * primvertex = esd->GetVertex(); // // nentries = array->GetEntriesFast(); + // + // // for (Int_t i=0;iNextFreeSlot() ) AliKink(); fKinksPool->RegisterClone(kink); // for (Int_t i =0;iNextFreeSlot() ) AliKink(); fKinksPool->RegisterClone(kink); + kinks->AddLast(kink); + kink = new AliKink; ncandidates++; } } - // eliminate last dummy kink - fKinksPool->MarkSlotFree(kink); - kink = 0; - if (ncandidates!=fKinksPool->GetEntriesFast() ) { - AliError(Form("Mismatch in number of kinks: %d %d",ncandidates,fKinksPool->GetEntriesFast())); - } + // // sort the kinks according quality - and refit them towards vertex // - Int_t nkinks = fKinksPool->GetEntriesFast(); - Float_t quality[nkinks]; - Int_t indexes[nkinks]; - AliTPCseed* mothers[nkinks];; - AliTPCseed* daughters[nkinks]; + Int_t nkinks = kinks->GetEntriesFast(); + Float_t *quality = new Float_t[nkinks]; + Int_t *indexes = new Int_t[nkinks]; + AliTPCseed *mothers = new AliTPCseed[nkinks]; + AliTPCseed *daughters = new AliTPCseed[nkinks]; // // for (Int_t i=0;iAt(i); + AliKink *kinkl = (AliKink*)kinks->At(i); // // refit kinks towards vertex // @@ -5256,27 +5248,29 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) if (first>ktrack1->GetLastPoint()-25) first = TMath::Max(ktrack1->GetLastPoint()-25,30); AliTPCseed* seed1 = ReSeed(ktrack1,first,kTRUE); // - if (seed0 && seed1) { + if (seed0 && seed1){ kinkl->SetStatus(1,8); if (RefitKink(*seed0,*seed1,*kinkl)) kinkl->SetStatus(1,9); row0 = GetRowNumber(kinkl->GetR()); sumn = seed0->GetNumberOfClusters()+seed1->GetNumberOfClusters(); - mothers[i] = seed0; - daughters[i] = seed1; + mothers[i] = *seed0; + daughters[i] = *seed1; } - else { - fKinksPool->MarkSlotFree(kinkl); - if (seed0) fSeedsPool->MarkSlotFree( seed0 ); - if (seed1) fSeedsPool->MarkSlotFree( seed1 ); + else{ + delete kinks->RemoveAt(i); + if (seed0) MarkSeedFree( seed0 ); + if (seed1) MarkSeedFree( seed1 ); continue; } if (kinkl->GetDistance()>0.5 || kinkl->GetR()<110 || kinkl->GetR()>240) { - fKinksPool->MarkSlotFree(kinkl); - if (seed0) fSeedsPool->MarkSlotFree( seed0 ); - if (seed1) fSeedsPool->MarkSlotFree( seed1 ); - mothers[i] = daughters[i] = 0; + delete kinks->RemoveAt(i); + if (seed0) MarkSeedFree( seed0 ); + if (seed1) MarkSeedFree( seed1 ); continue; } + // + MarkSeedFree( seed0 ); + MarkSeedFree( seed1 ); } // if (kinkl) quality[i] = 160*((0.1+kinkl->GetDistance())*(2.-kinkl->GetTPCDensityFactor()))/(sumn+40.); //the longest -clossest will win @@ -5286,23 +5280,23 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) //remove double find kinks // for (Int_t ikink0=1;ikink0At(indexes[ikink0]); + AliKink * kink0 = (AliKink*) kinks->At(indexes[ikink0]); if (!kink0) continue; - AliTPCseed *mother0 = mothers[indexes[ikink0]]; - AliTPCseed *daughter0 = daughters[indexes[ikink0]]; - if (!mother0 || !daughter0) continue; // for (Int_t ikink1=0;ikink1At(indexes[ikink1]); + kink0 = (AliKink*) kinks->At(indexes[ikink0]); + if (!kink0) continue; + AliKink * kink1 = (AliKink*) kinks->At(indexes[ikink1]); if (!kink1) continue; - AliTPCseed *mother1 = mothers[indexes[ikink1]]; - AliTPCseed *daughter1 = daughters[indexes[ikink1]]; - if (!mother1 || !daughter1) continue; // if not close kink continue if (TMath::Abs(kink1->GetPosition()[2]-kink0->GetPosition()[2])>10) continue; if (TMath::Abs(kink1->GetPosition()[1]-kink0->GetPosition()[1])>10) continue; if (TMath::Abs(kink1->GetPosition()[0]-kink0->GetPosition()[0])>10) continue; // + AliTPCseed &mother0 = mothers[indexes[ikink0]]; + AliTPCseed &daughter0 = daughters[indexes[ikink0]]; + AliTPCseed &mother1 = mothers[indexes[ikink1]]; + AliTPCseed &daughter1 = daughters[indexes[ikink1]]; Int_t row0 = (kink0->GetTPCRow0()+kink1->GetTPCRow0())/2; // Int_t same = 0; @@ -5313,10 +5307,10 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) Int_t bothd = 0; // for (Int_t i=0;iGetClusterIndex(i)>0 && mother1->GetClusterIndex(i)>0){ + if (mother0.GetClusterIndex(i)>0 && mother1.GetClusterIndex(i)>0){ both++; bothm++; - if (mother0->GetClusterIndex(i)==mother1->GetClusterIndex(i)){ + if (mother0.GetClusterIndex(i)==mother1.GetClusterIndex(i)){ same++; samem++; } @@ -5325,10 +5319,10 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) for (Int_t i=row0;i<158;i++){ //if (daughter0.GetClusterIndex(i)>0 && daughter0.GetClusterIndex(i)>0){ // RS: Bug? - if (daughter0->GetClusterIndex(i)>0 && daughter1->GetClusterIndex(i)>0){ + if (daughter0.GetClusterIndex(i)>0 && daughter1.GetClusterIndex(i)>0){ both++; bothd++; - if (daughter0->GetClusterIndex(i)==daughter1->GetClusterIndex(i)){ + if (mother0.GetClusterIndex(i)==mother1.GetClusterIndex(i)){ same++; samed++; } @@ -5338,21 +5332,18 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) Float_t ratiom = Float_t(samem+1)/Float_t(bothm+1); Float_t ratiod = Float_t(samed+1)/Float_t(bothd+1); if (ratio>0.3 && ratiom>0.5 &&ratiod>0.5) { - Int_t sum0 = mother0->GetNumberOfClusters()+daughter0->GetNumberOfClusters(); - Int_t sum1 = mother1->GetNumberOfClusters()+daughter1->GetNumberOfClusters(); + Int_t sum0 = mother0.GetNumberOfClusters()+daughter0.GetNumberOfClusters(); + Int_t sum1 = mother1.GetNumberOfClusters()+daughter1.GetNumberOfClusters(); if (sum1>sum0){ shared[kink0->GetIndex(0)]= kTRUE; shared[kink0->GetIndex(1)]= kTRUE; - fKinksPool->MarkSlotFree(kink0); - kink0 = 0; + delete kinks->RemoveAt(indexes[ikink0]); break; } else{ shared[kink1->GetIndex(0)]= kTRUE; shared[kink1->GetIndex(1)]= kTRUE; - fKinksPool->MarkSlotFree(kink1); - fKinksPool->MarkSlotFree(kink1); - kink1 = 0; + delete kinks->RemoveAt(indexes[ikink1]); } } } @@ -5360,7 +5351,7 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) for (Int_t i=0;iAt(indexes[i]); + AliKink * kinkl = (AliKink*) kinks->At(indexes[i]); if (!kinkl) continue; kinkl->SetTPCRow0(GetRowNumber(kinkl->GetR())); Int_t index0 = kinkl->GetIndex(0); @@ -5380,12 +5371,9 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) // // if ( ktrack0->GetKinkIndex(0)==0 && ktrack1->GetKinkIndex(0)==0) { //best kink - if (mothers[indexes[i]] && daughters[indexes[i]]) { - if (mothers[indexes[i]]->GetNumberOfClusters()>20 && daughters[indexes[i]]->GetNumberOfClusters()>20 && - (mothers[indexes[i]]->GetNumberOfClusters()+daughters[indexes[i]]->GetNumberOfClusters())>100) { - *ktrack0 = *mothers[indexes[i]]; - *ktrack1 = *daughters[indexes[i]]; - } + if (mothers[indexes[i]].GetNumberOfClusters()>20 && daughters[indexes[i]].GetNumberOfClusters()>20 && (mothers[indexes[i]].GetNumberOfClusters()+daughters[indexes[i]].GetNumberOfClusters())>100){ + *ktrack0 = mothers[indexes[i]]; + *ktrack1 = daughters[indexes[i]]; } } // @@ -5401,8 +5389,9 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) AliTPCseed * track0 = (AliTPCseed*)array->At(i); if (!track0) continue; if (track0->GetKinkIndex(0)!=0) continue; - if (shared[i]) fSeedsPool->MarkSlotFree( array->RemoveAt(i) ); + if (shared[i]) MarkSeedFree( array->RemoveAt(i) ); } + // // RemoveUsed2(array,0.5,0.4,30); @@ -5428,38 +5417,38 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) } } if (Float_t(ishared+1)/Float_t(all+1)>0.5) { - fSeedsPool->MarkSlotFree( array->RemoveAt(i) ); + MarkSeedFree( array->RemoveAt(i) ); continue; } // if (track0->GetKinkIndex(0)!=0) continue; if (track0->GetNumberOfClusters()<80) continue; - AliTPCseed *pmother = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(); fSeedsPool->RegisterClone(pmother); - AliTPCseed *pdaughter = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(); fSeedsPool->RegisterClone(pdaughter); - AliKink *pkink = new( fKinksPool->NextFreeSlot() ) AliKink(); fKinksPool->RegisterClone(pkink); - // + AliTPCseed *pmother = new AliTPCseed(); + AliTPCseed *pdaughter = new AliTPCseed(); + AliKink *pkink = new AliKink; + AliTPCseed & mother = *pmother; AliTPCseed & daughter = *pdaughter; AliKink & kinkl = *pkink; if (CheckKinkPoint(track0,mother,daughter, kinkl)){ if (mother.GetNumberOfClusters()<30||daughter.GetNumberOfClusters()<20) { - fSeedsPool->MarkSlotFree(pmother); - fSeedsPool->MarkSlotFree(pdaughter); - fKinksPool->MarkSlotFree(pkink); + delete pmother; + delete pdaughter; + delete pkink; continue; //too short tracks } if (mother.Pt()<1.4) { - fSeedsPool->MarkSlotFree(pmother); - fSeedsPool->MarkSlotFree(pdaughter); - fKinksPool->MarkSlotFree(pkink); + delete pmother; + delete pdaughter; + delete pkink; continue; } Int_t row0= kinkl.GetTPCRow0(); if (kinkl.GetDistance()>0.5 || kinkl.GetR()<110. || kinkl.GetR()>240.) { - fSeedsPool->MarkSlotFree(pmother); - fSeedsPool->MarkSlotFree(pdaughter); - fKinksPool->MarkSlotFree(pkink); + delete pmother; + delete pdaughter; + delete pkink; continue; } // @@ -5467,18 +5456,18 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) mother.SetKinkIndex(0,-(index+1)); daughter.SetKinkIndex(0,index+1); if (mother.GetNumberOfClusters()>50) { - fSeedsPool->MarkSlotFree( array->RemoveAt(i) ); - AliTPCseed* mtc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(mother); - fSeedsPool->RegisterClone(mtc); + MarkSeedFree( array->RemoveAt(i) ); + AliTPCseed* mtc = new( NextFreeSeed() ) AliTPCseed(mother); + mtc->SetPoolID(fLastSeedID); array->AddAt(mtc,i); } else{ - AliTPCseed* mtc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(mother); - fSeedsPool->RegisterClone(mtc); + AliTPCseed* mtc = new( NextFreeSeed() ) AliTPCseed(mother); + mtc->SetPoolID(fLastSeedID); array->AddLast(mtc); } - AliTPCseed* dtc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(daughter); - fSeedsPool->RegisterClone(dtc); + AliTPCseed* dtc = new( NextFreeSeed() ) AliTPCseed(daughter); + dtc->SetPoolID(fLastSeedID); array->AddLast(dtc); for (Int_t icl=0;iclUse(20); @@ -5489,116 +5478,858 @@ void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) } // } - fSeedsPool->MarkSlotFree(pmother); - fSeedsPool->MarkSlotFree(pdaughter); - fKinksPool->MarkSlotFree(pkink); + delete pmother; + delete pdaughter; + delete pkink; } + + delete [] daughters; + delete [] mothers; // - for (int i=nkinks;i--;) { - if (daughters[i]) fSeedsPool->MarkSlotFree(daughters[i]); - if (mothers[i]) fSeedsPool->MarkSlotFree(mothers[i]); - } - fKinksPool->Clear(); // + delete [] dca; + delete []circular; + delete []shared; + delete []quality; + delete []indexes; + // + delete kink; + delete[]fim; + delete[] zm; + delete[] z0; + delete [] usage; + delete[] alpha; + delete[] nclusters; + delete[] sign; delete[] helixes; + kinks->Delete(); + delete kinks; + AliInfo(Form("Ncandidates=\t%d\t%d\t%d\t%d\n",esd->GetNumberOfKinks(),ncandidates,ntracks,nall)); timer.Print(); } -Int_t AliTPCtrackerMI::RefitKink(AliTPCseed &mother, AliTPCseed &daughter, const AliESDkink &knk) +/* +void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd) { // - // refit kink towards to the vertex + // find kinks // // - AliKink &kink=(AliKink &)knk; - Int_t row0 = GetRowNumber(kink.GetR()); - FollowProlongation(mother,0); - mother.Reset(kFALSE); - // - FollowProlongation(daughter,row0); - daughter.Reset(kFALSE); - FollowBackProlongation(daughter,158); - daughter.Reset(kFALSE); - Int_t first = TMath::Max(row0-20,30); - Int_t last = TMath::Min(row0+20,140); - // - const Int_t kNdiv =5; - AliTPCseed param0[kNdiv]; // parameters along the track - AliTPCseed param1[kNdiv]; // parameters along the track - AliKink kinks[kNdiv]; // corresponding kink parameters + TObjArray *kinks= new TObjArray(10000); + // TObjArray *v0s= new TObjArray(10000); + Int_t nentries = array->GetEntriesFast(); + AliHelix *helixes = new AliHelix[nentries]; + Int_t *sign = new Int_t[nentries]; + Int_t *nclusters = new Int_t[nentries]; + Float_t *alpha = new Float_t[nentries]; + AliKink *kink = new AliKink(); + Int_t * usage = new Int_t[nentries]; + Float_t *zm = new Float_t[nentries]; + Float_t *z0 = new Float_t[nentries]; + Float_t *fim = new Float_t[nentries]; + Float_t *shared = new Float_t[nentries]; + Bool_t *circular = new Bool_t[nentries]; + Float_t *dca = new Float_t[nentries]; + //const AliESDVertex * primvertex = esd->GetVertex(); // - Int_t rows[kNdiv]; - for (Int_t irow=0; irowGetEntriesFast(); // - for (Int_t irow=0;irow240.) continue; - if (TMath::Abs(kinks[irow].GetR())<100.) continue; - // - Float_t normdist = TMath::Abs(param0[irow].GetX()-kinks[irow].GetR())*(0.1+kink.GetDistance()); - normdist/= (param0[irow].GetNumberOfClusters()+param1[irow].GetNumberOfClusters()+40.); - if (normdist < mindist){ - mindist = normdist; - index = irow; + for (Int_t i=0;iAt(i); + if (!track) continue; + track->SetCircular(0); + shared[i] = kFALSE; + track->UpdatePoints(); + if (( track->GetPoints()[2]- track->GetPoints()[0])>5 && track->GetPoints()[3]>0.8){ + } + nclusters[i]=track->GetNumberOfClusters(); + alpha[i] = track->GetAlpha(); + new (&helixes[i]) AliHelix(*track); + Double_t xyz[3]; + helixes[i].Evaluate(0,xyz); + sign[i] = (track->GetC()>0) ? -1:1; + Double_t x,y,z; + x=160; + if (track->GetProlongation(x,y,z)){ + zm[i] = z; + fim[i] = alpha[i]+TMath::ATan2(y,x); } + else{ + zm[i] = track->GetZ(); + fim[i] = alpha[i]; + } + z0[i]=1000; + circular[i]= kFALSE; + if (track->GetProlongation(0,y,z)) z0[i] = z; + dca[i] = track->GetD(0,0); } // - if (index==-1) return 0; - // // - param0[index].Reset(kTRUE); - FollowProlongation(param0[index],0); + TStopwatch timer; + timer.Start(); + Int_t ncandidates =0; + Int_t nall =0; + Int_t ntracks=0; + Double_t phase[2][2]={{0,0},{0,0}},radius[2]={0,0}; + // - mother = param0[index]; - daughter = param1[index]; // daughter in vertex + // Find circling track // - kink.SetMother(mother); - kink.SetDaughter(daughter); - kink.Update(); - kink.SetTPCRow0(GetRowNumber(kink.GetR())); - kink.SetTPCncls(param0[index].GetNumberOfClusters(),0); - kink.SetTPCncls(param1[index].GetNumberOfClusters(),1); - kink.SetLabel(CookLabel(&mother,0.4, 0,kink.GetTPCRow0()),0); - kink.SetLabel(CookLabel(&daughter,0.4, kink.GetTPCRow0(),160),1); - mother.SetLabel(kink.GetLabel(0)); - daughter.SetLabel(kink.GetLabel(1)); - - return 1; -} - + for (Int_t i0=0;i0At(i0); + if (!track0) continue; + if (track0->GetNumberOfClusters()<40) continue; + if (TMath::Abs(1./track0->GetC())>200) continue; + for (Int_t i1=i0+1;i1At(i1); + if (!track1) continue; + if (track1->GetNumberOfClusters()<40) continue; + if ( TMath::Abs(track1->GetTgl()+track0->GetTgl())>0.1) continue; + if (track0->GetBConstrain()&&track1->GetBConstrain()) continue; + if (TMath::Abs(1./track1->GetC())>200) continue; + if (track1->GetSigned1Pt()*track0->GetSigned1Pt()>0) continue; + if (track1->GetTgl()*track0->GetTgl()>0) continue; + if (TMath::Max(TMath::Abs(1./track0->GetC()),TMath::Abs(1./track1->GetC()))>190) continue; + if (track0->GetBConstrain()&&track1->OneOverPt()OneOverPt()) continue; //returning - lower momenta + if (track1->GetBConstrain()&&track0->OneOverPt()OneOverPt()) continue; //returning - lower momenta + // + Float_t mindcar = TMath::Min(TMath::Abs(dca[i0]),TMath::Abs(dca[i1])); + if (mindcar<5) continue; + Float_t mindcaz = TMath::Min(TMath::Abs(z0[i0]-GetZ()),TMath::Abs(z0[i1]-GetZ())); + if (mindcaz<5) continue; + if (mindcar+mindcaz<20) continue; + // + // + Float_t xc0 = helixes[i0].GetHelix(6); + Float_t yc0 = helixes[i0].GetHelix(7); + Float_t r0 = helixes[i0].GetHelix(8); + Float_t xc1 = helixes[i1].GetHelix(6); + Float_t yc1 = helixes[i1].GetHelix(7); + Float_t r1 = helixes[i1].GetHelix(8); + + Float_t rmean = (r0+r1)*0.5; + Float_t delta =TMath::Sqrt((xc1-xc0)*(xc1-xc0)+(yc1-yc0)*(yc1-yc0)); + //if (delta>30) continue; + if (delta>rmean*0.25) continue; + if (TMath::Abs(r0-r1)/rmean>0.3) continue; + // + Int_t npoints = helixes[i0].GetRPHIintersections(helixes[i1], phase, radius,10); + if (npoints==0) continue; + helixes[i0].GetClosestPhases(helixes[i1], phase); + // + Double_t xyz0[3]; + Double_t xyz1[3]; + Double_t hangles[3]; + helixes[i0].Evaluate(phase[0][0],xyz0); + helixes[i1].Evaluate(phase[0][1],xyz1); -void AliTPCtrackerMI::UpdateKinkQualityM(AliTPCseed * seed){ + helixes[i0].GetAngle(phase[0][0],helixes[i1],phase[0][1],hangles); + Double_t deltah[2],deltabest; + if (hangles[2]<2.8) continue; + if (npoints>0){ + Int_t ibest=0; + helixes[i0].ParabolicDCA(helixes[i1],phase[0][0],phase[0][1],radius[0],deltah[0],2); + if (npoints==2){ + helixes[i0].ParabolicDCA(helixes[i1],phase[1][0],phase[1][1],radius[1],deltah[1],2); + if (deltah[1]6) continue; + if (mindcar+mindcaz<40 && (hangles[2]<3.12||deltabest>3)) continue; + Bool_t lsign =kFALSE; + if (hangles[2]>3.06) lsign =kTRUE; + // + if (lsign){ + circular[i0] = kTRUE; + circular[i1] = kTRUE; + if (track0->OneOverPt()OneOverPt()){ + track0->SetCircular(track0->GetCircular()+1); + track1->SetCircular(track1->GetCircular()+2); + } + else{ + track1->SetCircular(track1->GetCircular()+1); + track0->SetCircular(track0->GetCircular()+2); + } + } + if (lsign&&AliTPCReconstructor::StreamLevel()>1){ + //debug stream + Int_t lab0=track0->GetLabel(); + Int_t lab1=track1->GetLabel(); + TTreeSRedirector &cstream = *fDebugStreamer; + cstream<<"Curling"<< + "lab0="<GetKinkIndex(0)>=0) return; - for (Int_t ikink=0;ikink<3;ikink++){ - Int_t index = seed->GetKinkIndex(ikink); - if (index>=0) break; + for (Int_t i =0;iAt(i); + if (track0==0) { + AliInfo("seed==0"); + continue; + } + ntracks++; + // + Double_t cradius0 = 40*40; + Double_t cradius1 = 270*270; + Double_t cdist1=8.; + Double_t cdist2=8.; + Double_t cdist3=0.55; + for (Int_t j =i+1;j200) continue; + if ( (nclusters[i]+nclusters[j])<80) continue; + if ( TMath::Abs(zm[i]-zm[j])>60.) continue; + if ( TMath::Abs(fim[i]-fim[j])>0.6 && TMath::Abs(fim[i]-fim[j])<5.7 ) continue; + //AliTPCseed * track1 = (AliTPCseed*)array->At(j); Double_t phase[2][2],radius[2]; + Int_t npoints = helixes[i].GetRPHIintersections(helixes[j], phase, radius,20); + if (npoints<1) continue; + // cuts on radius + if (npoints==1){ + if (radius[0]cradius1) continue; + } + else{ + if ( (radius[0]cradius1) && (radius[1]cradius1) ) continue; + } + // + Double_t delta1=10000,delta2=10000; + // cuts on the intersection radius + helixes[i].LinearDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta1); + if (radius[0]<20&&delta1<1) continue; //intersection at vertex + if (radius[0]<10&&delta1<3) continue; //intersection at vertex + if (npoints==2){ + helixes[i].LinearDCA(helixes[j],phase[1][0],phase[1][1],radius[1],delta2); + if (radius[1]<20&&delta2<1) continue; //intersection at vertex + if (radius[1]<10&&delta2<3) continue; //intersection at vertex + } + // + Double_t distance1 = TMath::Min(delta1,delta2); + if (distance1>cdist1) continue; // cut on DCA linear approximation + // + npoints = helixes[i].GetRPHIintersections(helixes[j], phase, radius,20); + helixes[i].ParabolicDCA(helixes[j],phase[0][0],phase[0][1],radius[0],delta1); + if (radius[0]<20&&delta1<1) continue; //intersection at vertex + if (radius[0]<10&&delta1<3) continue; //intersection at vertex + // + if (npoints==2){ + helixes[i].ParabolicDCA(helixes[j],phase[1][0],phase[1][1],radius[1],delta2); + if (radius[1]<20&&delta2<1) continue; //intersection at vertex + if (radius[1]<10&&delta2<3) continue; //intersection at vertex + } + distance1 = TMath::Min(delta1,delta2); + Float_t rkink =0; + if (delta1cdist2) continue; + // + // + AliTPCseed * track1 = (AliTPCseed*)array->At(j); + // + // + Int_t row0 = GetRowNumber(rkink); + if (row0<10) continue; + if (row0>150) continue; + // + // + Float_t dens00=-1,dens01=-1; + Float_t dens10=-1,dens11=-1; + // + Int_t found,foundable,ishared; + track0->GetClusterStatistic(0,row0-5, found, foundable,ishared,kFALSE); + if (foundable>5) dens00 = Float_t(found)/Float_t(foundable); + track0->GetClusterStatistic(row0+5,155, found, foundable,ishared,kFALSE); + if (foundable>5) dens01 = Float_t(found)/Float_t(foundable); + // + track1->GetClusterStatistic(0,row0-5, found, foundable,ishared,kFALSE); + if (foundable>10) dens10 = Float_t(found)/Float_t(foundable); + track1->GetClusterStatistic(row0+5,155, found, foundable,ishared,kFALSE); + if (foundable>10) dens11 = Float_t(found)/Float_t(foundable); + // + if (dens00dens10 && dens01>dens11) continue; + if (TMath::Max(dens00,dens10)<0.1) continue; + if (TMath::Max(dens01,dens11)<0.3) continue; + // + if (TMath::Min(dens00,dens10)>0.6) continue; + if (TMath::Min(dens01,dens11)>0.6) continue; + + // + AliTPCseed * ktrack0, *ktrack1; + if (dens00>dens10){ + ktrack0 = track0; + ktrack1 = track1; + } + else{ + ktrack0 = track1; + ktrack1 = track0; + } + if (TMath::Abs(ktrack0->GetC())>5) continue; // cut on the curvature for mother particle + AliExternalTrackParam paramm(*ktrack0); + AliExternalTrackParam paramd(*ktrack1); + if (row0>60&&ktrack1->GetReference().GetX()>90.)new (¶md) AliExternalTrackParam(ktrack1->GetReference()); + // + // + kink->SetMother(paramm); + kink->SetDaughter(paramd); + kink->Update(); + + Float_t x[3] = { kink->GetPosition()[0],kink->GetPosition()[1],kink->GetPosition()[2]}; + Int_t index[4]; + fkParam->Transform0to1(x,index); + fkParam->Transform1to2(x,index); + row0 = GetRowNumber(x[0]); + + if (kink->GetR()<100) continue; + if (kink->GetR()>240) continue; + if (kink->GetPosition()[2]/kink->GetR()>AliTPCReconstructor::GetCtgRange()) continue; //out of fiducial volume + if (kink->GetDistance()>cdist3) continue; + Float_t dird = kink->GetDaughterP()[0]*kink->GetPosition()[0]+kink->GetDaughterP()[1]*kink->GetPosition()[1]; // rough direction estimate + if (dird<0) continue; + + Float_t dirm = kink->GetMotherP()[0]*kink->GetPosition()[0]+kink->GetMotherP()[1]*kink->GetPosition()[1]; // rough direction estimate + if (dirm<0) continue; + Float_t mpt = TMath::Sqrt(kink->GetMotherP()[0]*kink->GetMotherP()[0]+kink->GetMotherP()[1]*kink->GetMotherP()[1]); + if (mpt<0.2) continue; + + if (mpt<1){ + //for high momenta momentum not defined well in first iteration + Double_t qt = TMath::Sin(kink->GetAngle(2))*ktrack1->GetP(); + if (qt>0.35) continue; + } + + kink->SetLabel(CookLabel(ktrack0,0.4,0,row0),0); + kink->SetLabel(CookLabel(ktrack1,0.4,row0,160),1); + if (dens00>dens10){ + kink->SetTPCDensity(dens00,0,0); + kink->SetTPCDensity(dens01,0,1); + kink->SetTPCDensity(dens10,1,0); + kink->SetTPCDensity(dens11,1,1); + kink->SetIndex(i,0); + kink->SetIndex(j,1); + } + else{ + kink->SetTPCDensity(dens10,0,0); + kink->SetTPCDensity(dens11,0,1); + kink->SetTPCDensity(dens00,1,0); + kink->SetTPCDensity(dens01,1,1); + kink->SetIndex(j,0); + kink->SetIndex(i,1); + } + + if (mpt<1||kink->GetAngle(2)>0.1){ + // angle and densities not defined yet + if (kink->GetTPCDensityFactor()<0.8) continue; + if ((2-kink->GetTPCDensityFactor())*kink->GetDistance() >0.25) continue; + if (kink->GetAngle(2)*ktrack0->GetP()<0.003) continue; //too small angle + if (kink->GetAngle(2)>0.2&&kink->GetTPCDensityFactor()<1.15) continue; + if (kink->GetAngle(2)>0.2&&kink->GetTPCDensity(0,1)>0.05) continue; + + Float_t criticalangle = track0->GetSigmaSnp2()+track0->GetSigmaTgl2(); + criticalangle+= track1->GetSigmaSnp2()+track1->GetSigmaTgl2(); + criticalangle= 3*TMath::Sqrt(criticalangle); + if (criticalangle>0.02) criticalangle=0.02; + if (kink->GetAngle(2)GetAngle(2))); // overlap region defined + Float_t shapesum =0; + Float_t sum = 0; + for ( Int_t row = row0-drow; row155) continue; + if (ktrack0->GetClusterPointer(row)){ + AliTPCTrackerPoint *point =ktrack0->GetTrackPoint(row); + shapesum+=point->GetSigmaY()+point->GetSigmaZ(); + sum++; + } + if (ktrack1->GetClusterPointer(row)){ + AliTPCTrackerPoint *point =ktrack1->GetTrackPoint(row); + shapesum+=point->GetSigmaY()+point->GetSigmaZ(); + sum++; + } + } + if (sum<4){ + kink->SetShapeFactor(-1.); + } + else{ + kink->SetShapeFactor(shapesum/sum); + } + // esd->AddKink(kink); + // + // kink->SetMother(paramm); + //kink->SetDaughter(paramd); + + Double_t chi2P2 = paramm.GetParameter()[2]-paramd.GetParameter()[2]; + chi2P2*=chi2P2; + chi2P2/=paramm.GetCovariance()[5]+paramd.GetCovariance()[5]; + Double_t chi2P3 = paramm.GetParameter()[3]-paramd.GetParameter()[3]; + chi2P3*=chi2P3; + chi2P3/=paramm.GetCovariance()[9]+paramd.GetCovariance()[9]; + // + if (AliTPCReconstructor::StreamLevel()>1) { + (*fDebugStreamer)<<"kinkLpt"<< + "chi2P2="<GetKinkAngleCutChi2(0)){ + continue; + } + // + kinks->AddLast(kink); + kink = new AliKink; + ncandidates++; + } + } + // + // sort the kinks according quality - and refit them towards vertex + // + Int_t nkinks = kinks->GetEntriesFast(); + Float_t *quality = new Float_t[nkinks]; + Int_t *indexes = new Int_t[nkinks]; + AliTPCseed **mothers = new AliTPCseed*[nkinks]; memset(mothers, 0, nkinks*sizeof(AliTPCseed*)); + AliTPCseed **daughters = new AliTPCseed*[nkinks]; memset(daughters, 0, nkinks*sizeof(AliTPCseed*)); + // + // + for (Int_t i=0;iAt(i); + // + // refit kinks towards vertex + // + Int_t index0 = kinkl->GetIndex(0); + Int_t index1 = kinkl->GetIndex(1); + AliTPCseed * ktrack0 = (AliTPCseed*)array->At(index0); + AliTPCseed * ktrack1 = (AliTPCseed*)array->At(index1); + // + Int_t sumn=ktrack0->GetNumberOfClusters()+ktrack1->GetNumberOfClusters(); + // + // Refit Kink under if too small angle + // + if (kinkl->GetAngle(2)<0.05){ + kinkl->SetTPCRow0(GetRowNumber(kinkl->GetR())); + Int_t row0 = kinkl->GetTPCRow0(); + Int_t drow = Int_t(2.+0.5/(0.05+kinkl->GetAngle(2))); + // + // + Int_t last = row0-drow; + if (last<40) last=40; + if (lastGetFirstPoint()+25) last = ktrack0->GetFirstPoint()+25; + AliTPCseed* seed0 = ReSeed(ktrack0,last,kFALSE); + // + // + Int_t first = row0+drow; + if (first>130) first=130; + if (first>ktrack1->GetLastPoint()-25) first = TMath::Max(ktrack1->GetLastPoint()-25,30); + AliTPCseed* seed1 = ReSeed(ktrack1,first,kTRUE); + // + if (seed0 && seed1){ + kinkl->SetStatus(1,8); + if (RefitKink(*seed0,*seed1,*kinkl)) kinkl->SetStatus(1,9); + row0 = GetRowNumber(kinkl->GetR()); + sumn = seed0->GetNumberOfClusters()+seed1->GetNumberOfClusters(); + mothers[i] = new ( NextFreeSeed() ) AliTPCseed(*seed0); + mothers[i]->SetPoolID(fLastSeedID); + daughters[i] = new (NextFreeSeed() ) AliTPCseed(*seed1); + daughters[i]->SetPoolID(fLastSeedID); + } + else{ + delete kinks->RemoveAt(i); + if (seed0) MarkSeedFree( seed0 ); + if (seed1) MarkSeedFree( seed1 ); + continue; + } + if (kinkl->GetDistance()>0.5 || kinkl->GetR()<110 || kinkl->GetR()>240) { + delete kinks->RemoveAt(i); + if (seed0) MarkSeedFree( seed0 ); + if (seed1) MarkSeedFree( seed1 ); + continue; + } + // + MarkSeedFree( seed0 ); + MarkSeedFree( seed1 ); + } + // + if (kinkl) quality[i] = 160*((0.1+kinkl->GetDistance())*(2.-kinkl->GetTPCDensityFactor()))/(sumn+40.); //the longest -clossest will win + } + TMath::Sort(nkinks,quality,indexes,kFALSE); + // + //remove double find kinks + // + for (Int_t ikink0=1;ikink0At(indexes[ikink0]); + if (!kink0) continue; + // + for (Int_t ikink1=0;ikink1At(indexes[ikink0]); + if (!kink0) continue; + AliKink * kink1 = (AliKink*) kinks->At(indexes[ikink1]); + if (!kink1) continue; + // if not close kink continue + if (TMath::Abs(kink1->GetPosition()[2]-kink0->GetPosition()[2])>10) continue; + if (TMath::Abs(kink1->GetPosition()[1]-kink0->GetPosition()[1])>10) continue; + if (TMath::Abs(kink1->GetPosition()[0]-kink0->GetPosition()[0])>10) continue; + // + AliTPCseed &mother0 = *mothers[indexes[ikink0]]; + AliTPCseed &daughter0 = *daughters[indexes[ikink0]]; + AliTPCseed &mother1 = *mothers[indexes[ikink1]]; + AliTPCseed &daughter1 = *daughters[indexes[ikink1]]; + Int_t row0 = (kink0->GetTPCRow0()+kink1->GetTPCRow0())/2; + // + Int_t same = 0; + Int_t both = 0; + Int_t samem = 0; + Int_t bothm = 0; + Int_t samed = 0; + Int_t bothd = 0; + // + for (Int_t i=0;i0 && mother1.GetClusterIndex(i)>0){ + both++; + bothm++; + if (mother0.GetClusterIndex(i)==mother1.GetClusterIndex(i)){ + same++; + samem++; + } + } + } + + for (Int_t i=row0;i<158;i++){ + //if (daughter0.GetClusterIndex(i)>0 && daughter0.GetClusterIndex(i)>0){ // RS: Bug? + if (daughter0.GetClusterIndex(i)>0 && daughter1.GetClusterIndex(i)>0){ + both++; + bothd++; + if (mother0.GetClusterIndex(i)==mother1.GetClusterIndex(i)){ + same++; + samed++; + } + } + } + Float_t ratio = Float_t(same+1)/Float_t(both+1); + Float_t ratiom = Float_t(samem+1)/Float_t(bothm+1); + Float_t ratiod = Float_t(samed+1)/Float_t(bothd+1); + if (ratio>0.3 && ratiom>0.5 &&ratiod>0.5) { + Int_t sum0 = mother0.GetNumberOfClusters()+daughter0.GetNumberOfClusters(); + Int_t sum1 = mother1.GetNumberOfClusters()+daughter1.GetNumberOfClusters(); + if (sum1>sum0){ + shared[kink0->GetIndex(0)]= kTRUE; + shared[kink0->GetIndex(1)]= kTRUE; + delete kinks->RemoveAt(indexes[ikink0]); + break; + } + else{ + shared[kink1->GetIndex(0)]= kTRUE; + shared[kink1->GetIndex(1)]= kTRUE; + delete kinks->RemoveAt(indexes[ikink1]); + } + } + } + } + + + for (Int_t i=0;iAt(indexes[i]); + if (!kinkl) continue; + kinkl->SetTPCRow0(GetRowNumber(kinkl->GetR())); + Int_t index0 = kinkl->GetIndex(0); + Int_t index1 = kinkl->GetIndex(1); + if (circular[index0]||(circular[index1]&&kinkl->GetDistance()>0.2)) continue; + kinkl->SetMultiple(usage[index0],0); + kinkl->SetMultiple(usage[index1],1); + if (kinkl->GetMultiple()[0]+kinkl->GetMultiple()[1]>2) continue; + if (kinkl->GetMultiple()[0]+kinkl->GetMultiple()[1]>0 && quality[indexes[i]]>0.2) continue; + if (kinkl->GetMultiple()[0]+kinkl->GetMultiple()[1]>0 && kinkl->GetDistance()>0.2) continue; + if (circular[index0]||(circular[index1]&&kinkl->GetDistance()>0.1)) continue; + + AliTPCseed * ktrack0 = (AliTPCseed*)array->At(index0); + AliTPCseed * ktrack1 = (AliTPCseed*)array->At(index1); + if (!ktrack0 || !ktrack1) continue; + Int_t index = esd->AddKink(kinkl); + // + // + if ( ktrack0->GetKinkIndex(0)==0 && ktrack1->GetKinkIndex(0)==0) { //best kink + if (mothers[indexes[i]]->GetNumberOfClusters()>20 && daughters[indexes[i]]->GetNumberOfClusters()>20 && + (mothers[indexes[i]]->GetNumberOfClusters()+daughters[indexes[i]]->GetNumberOfClusters())>100){ + *ktrack0 = *mothers[indexes[i]]; + *ktrack1 = *daughters[indexes[i]]; + } + } + // + ktrack0->SetKinkIndex(usage[index0],-(index+1)); + ktrack1->SetKinkIndex(usage[index1], (index+1)); + usage[index0]++; + usage[index1]++; + } + // + // Remove tracks corresponding to shared kink's + // + for (Int_t i=0;iAt(i); + if (!track0) continue; + if (track0->GetKinkIndex(0)!=0) continue; + if (shared[i]) MarkSeedFree( array->RemoveAt(i) ); + } + + // + // + RemoveUsed2(array,0.5,0.4,30); + UnsignClusters(); + for (Int_t i=0;iAt(i); + if (!track0) continue; + track0->CookdEdx(0.02,0.6); + track0->CookPID(); + } + // + for (Int_t i=0;iAt(i); + if (!track0) continue; + if (track0->Pt()<1.4) continue; + //remove double high momenta tracks - overlapped with kink candidates + Int_t ishared=0; + Int_t all =0; + for (Int_t icl=track0->GetFirstPoint();iclGetLastPoint(); icl++){ + if (track0->GetClusterPointer(icl)!=0){ + all++; + if (track0->GetClusterPointer(icl)->IsUsed(10)) ishared++; + } + } + if (Float_t(ishared+1)/Float_t(all+1)>0.5) { + MarkSeedFree( array->RemoveAt(i) ); + continue; + } + // + if (track0->GetKinkIndex(0)!=0) continue; + if (track0->GetNumberOfClusters()<80) continue; + + AliTPCseed *pmother = new( NextFreeSeed() ) AliTPCseed(); + pmother->SetPoolID(fLastSeedID); + AliTPCseed *pdaughter = new( NextFreeSeed() ) AliTPCseed(); + pdaughter->SetPoolID(fLastSeedID); + AliKink *pkink = new AliKink; + + AliTPCseed & mother = *pmother; + AliTPCseed & daughter = *pdaughter; + AliKink & kinkl = *pkink; + if (CheckKinkPoint(track0,mother,daughter, kinkl)){ + if (mother.GetNumberOfClusters()<30||daughter.GetNumberOfClusters()<20) { + MarkSeedFree( pmother ); + MarkSeedFree( pdaughter ); + delete pkink; + continue; //too short tracks + } + if (mother.Pt()<1.4) { + MarkSeedFree( pmother ); + MarkSeedFree( pdaughter ); + delete pkink; + continue; + } + Int_t row0= kinkl.GetTPCRow0(); + if (kinkl.GetDistance()>0.5 || kinkl.GetR()<110. || kinkl.GetR()>240.) { + MarkSeedFree( pmother ); + MarkSeedFree( pdaughter ); + delete pkink; + continue; + } + // + Int_t index = esd->AddKink(&kinkl); + mother.SetKinkIndex(0,-(index+1)); + daughter.SetKinkIndex(0,index+1); + if (mother.GetNumberOfClusters()>50) { + MarkSeedFree( array->RemoveAt(i) ); + AliTPCseed* mtc = new( NextFreeSeed() ) AliTPCseed(mother); + mtc->SetPoolID(fLastSeedID); + array->AddAt(mtc,i); + } + else{ + AliTPCseed* mtc = new( NextFreeSeed() ) AliTPCseed(mother); + mtc->SetPoolID(fLastSeedID); + array->AddLast(mtc); + } + AliTPCseed* dtc = new( NextFreeSeed() ) AliTPCseed(daughter); + dtc->SetPoolID(fLastSeedID); + array->AddLast(dtc); + for (Int_t icl=0;iclUse(20); + } + // + for (Int_t icl=row0;icl<158;icl++) { + if (daughter.GetClusterPointer(icl)) daughter.GetClusterPointer(icl)->Use(20); + } + // + } + MarkSeedFree( pmother ); + MarkSeedFree( pdaughter ); + delete pkink; + } + + delete [] daughters; + delete [] mothers; + // + // + delete [] dca; + delete []circular; + delete []shared; + delete []quality; + delete []indexes; + // + delete kink; + delete[]fim; + delete[] zm; + delete[] z0; + delete [] usage; + delete[] alpha; + delete[] nclusters; + delete[] sign; + delete[] helixes; + kinks->Delete(); + delete kinks; + + AliInfo(Form("Ncandidates=\t%d\t%d\t%d\t%d\n",esd->GetNumberOfKinks(),ncandidates,ntracks,nall)); + timer.Print(); +} +*/ + +Int_t AliTPCtrackerMI::RefitKink(AliTPCseed &mother, AliTPCseed &daughter, const AliESDkink &knk) +{ + // + // refit kink towards to the vertex + // + // + AliKink &kink=(AliKink &)knk; + + Int_t row0 = GetRowNumber(kink.GetR()); + FollowProlongation(mother,0); + mother.Reset(kFALSE); + // + FollowProlongation(daughter,row0); + daughter.Reset(kFALSE); + FollowBackProlongation(daughter,158); + daughter.Reset(kFALSE); + Int_t first = TMath::Max(row0-20,30); + Int_t last = TMath::Min(row0+20,140); + // + const Int_t kNdiv =5; + AliTPCseed param0[kNdiv]; // parameters along the track + AliTPCseed param1[kNdiv]; // parameters along the track + AliKink kinks[kNdiv]; // corresponding kink parameters + // + Int_t rows[kNdiv]; + for (Int_t irow=0; irow240.) continue; + if (TMath::Abs(kinks[irow].GetR())<100.) continue; + // + Float_t normdist = TMath::Abs(param0[irow].GetX()-kinks[irow].GetR())*(0.1+kink.GetDistance()); + normdist/= (param0[irow].GetNumberOfClusters()+param1[irow].GetNumberOfClusters()+40.); + if (normdist < mindist){ + mindist = normdist; + index = irow; + } + } + // + if (index==-1) return 0; + // + // + param0[index].Reset(kTRUE); + FollowProlongation(param0[index],0); + // + mother = param0[index]; + daughter = param1[index]; // daughter in vertex + // + kink.SetMother(mother); + kink.SetDaughter(daughter); + kink.Update(); + kink.SetTPCRow0(GetRowNumber(kink.GetR())); + kink.SetTPCncls(param0[index].GetNumberOfClusters(),0); + kink.SetTPCncls(param1[index].GetNumberOfClusters(),1); + kink.SetLabel(CookLabel(&mother,0.4, 0,kink.GetTPCRow0()),0); + kink.SetLabel(CookLabel(&daughter,0.4, kink.GetTPCRow0(),160),1); + mother.SetLabel(kink.GetLabel(0)); + daughter.SetLabel(kink.GetLabel(1)); + + return 1; +} + + +void AliTPCtrackerMI::UpdateKinkQualityM(AliTPCseed * seed){ + // + // update Kink quality information for mother after back propagation + // + if (seed->GetKinkIndex(0)>=0) return; + for (Int_t ikink=0;ikink<3;ikink++){ + Int_t index = seed->GetKinkIndex(ikink); + if (index>=0) break; index = TMath::Abs(index)-1; AliESDkink * kink = fEvent->GetKink(index); kink->SetTPCDensity(-1,0,0); @@ -5672,8 +6403,8 @@ Int_t AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTP seed1->Reset(kTRUE); last = seed1->GetLastPoint(); // - AliTPCseed *seed0 = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(*seed); - fSeedsPool->RegisterClone(seed0); + AliTPCseed *seed0 = new( NextFreeSeed() ) AliTPCseed(*seed); + seed0->SetPoolID(fLastSeedID); seed0->Reset(kFALSE); seed0->Reset(); // @@ -5713,15 +6444,15 @@ Int_t AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTP // } } - fSeedsPool->MarkSlotFree( seed0 ); - fSeedsPool->MarkSlotFree( seed1 ); + MarkSeedFree( seed0 ); + MarkSeedFree( seed1 ); if (index<0) return 0; // Int_t row0 = GetRowNumber(kinks[index].GetR()); //row 0 estimate - seed0 = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(param0[index]); - fSeedsPool->RegisterClone(seed0); - seed1 = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(param1[index]); - fSeedsPool->RegisterClone(seed1); + seed0 = new( NextFreeSeed() ) AliTPCseed(param0[index]); + seed0->SetPoolID(fLastSeedID); + seed1 = new( NextFreeSeed() ) AliTPCseed(param1[index]); + seed1->SetPoolID(fLastSeedID); seed0->Reset(kFALSE); seed1->Reset(kFALSE); seed0->ResetCovariance(10.); @@ -5774,8 +6505,8 @@ Int_t AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTP // // if (index==-1 || param0[index].GetNumberOfClusters()+param1[index].GetNumberOfClusters()<100){ - fSeedsPool->MarkSlotFree( seed0 ); - fSeedsPool->MarkSlotFree( seed1 ); + MarkSeedFree( seed0 ); + MarkSeedFree( seed1 ); return 0; } @@ -5802,8 +6533,8 @@ Int_t AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTP "\n"; } if ( chi2P2+chi2P3GetKinkAngleCutChi2(0)){ - fSeedsPool->MarkSlotFree( seed0 ); - fSeedsPool->MarkSlotFree( seed1 ); + MarkSeedFree( seed0 ); + MarkSeedFree( seed1 ); return 0; } @@ -5828,8 +6559,8 @@ Int_t AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTP if ( chi2P2+chi2P3GetKinkAngleCutChi2(1)){ mother=*seed; } - fSeedsPool->MarkSlotFree( seed0 ); - fSeedsPool->MarkSlotFree( seed1 ); + MarkSeedFree( seed0 ); + MarkSeedFree( seed1 ); // return 1; } @@ -5893,8 +6624,8 @@ Int_t AliTPCtrackerMI::ReadSeeds(const TFile *inp) { Int_t n=(Int_t)seedTree->GetEntries(); for (Int_t i=0; iGetEvent(i); - AliTPCseed* sdc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(*seed/*,seed->GetAlpha()*/); - fSeedsPool->RegisterClone(sdc); + AliTPCseed* sdc = new( NextFreeSeed() ) AliTPCseed(*seed/*,seed->GetAlpha()*/); + sdc->SetPoolID(fLastSeedID); fSeeds->AddLast(sdc); } @@ -5908,9 +6639,8 @@ Int_t AliTPCtrackerMI::Clusters2Tracks (AliESDEvent *const esd) { // // clusters to tracks - if (fPools && !fPools->GetPoolTPCSeed()) fPools->SetPool(fSeedsPool,AliPoolsSet::kPoolTPCSeed); if (fSeeds) DeleteSeeds(); - else fSeedsPool->Clear("C"); + else ResetSeedsPool(); fEvent = esd; AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ; @@ -5946,7 +6676,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { if (!pt) continue; Int_t nc=t.GetNumberOfClusters(); if (nc<20) { - fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); continue; } CookLabel(pt,0.1); @@ -5955,7 +6685,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { pt->Desactivate(10); // make track again active // MvL: should be 0 ? else{ pt->Desactivate(20); - fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); } } } @@ -5979,7 +6709,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { if (!pt) continue; Int_t nc=t.GetNumberOfClusters(); if (nc<15) { - fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); continue; } CookLabel(pt,0.1); //For comparison only @@ -5990,7 +6720,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { pt->SetLab2(i); } else - fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); } @@ -6005,7 +6735,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { if (!pt) continue; Int_t nc=t.GetNumberOfClusters(); if (nc<15) { - fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); continue; } t.SetUniqueID(i); @@ -6020,7 +6750,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { pt->SetLab2(i); } else - fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); //AliTPCseed * seed1 = ReSeed(pt,0.05,0.5,1); //if (seed1){ // FollowProlongation(*seed1,0); @@ -6057,7 +6787,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { if (!pt) continue; Int_t nc=t.GetNumberOfClusters(); if (nc<15) { - fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); continue; } t.CookdEdx(0.02,0.6); @@ -6067,7 +6797,7 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() { cerr<MarkSlotFree( fSeeds->RemoveAt(i) ); + MarkSeedFree( fSeeds->RemoveAt(i) ); pt->fLab2 = i; } */ @@ -6355,12 +7085,12 @@ void AliTPCtrackerMI::SumTracks(TObjArray *arr1,TObjArray *&arr2) // remove tracks with too big curvature // if (TMath::Abs(pt->GetC())>AliTPCReconstructor::GetRecoParam()->GetMaxC()){ - fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) ); + MarkSeedFree( arr2->RemoveAt(i) ); continue; } // REMOVE VERY SHORT TRACKS if (pt->GetNumberOfClusters()<20){ - fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) ); + MarkSeedFree( arr2->RemoveAt(i) ); continue; }// patch 28 fev06 // NORMAL ACTIVE TRACK @@ -6370,7 +7100,7 @@ void AliTPCtrackerMI::SumTracks(TObjArray *arr1,TObjArray *&arr2) } //remove not usable tracks if (pt->GetRemoval()!=10){ - fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) ); + MarkSeedFree( arr2->RemoveAt(i) ); continue; } @@ -6378,7 +7108,7 @@ void AliTPCtrackerMI::SumTracks(TObjArray *arr1,TObjArray *&arr2) if (pt->GetDensityFirst(20)>0.8 || pt->GetDensityFirst(30)>0.8 || pt->GetDensityFirst(40)>0.7) arr1->AddLast(arr2->RemoveAt(i)); else{ - fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) ); + MarkSeedFree( arr2->RemoveAt(i) ); } } } @@ -7001,3 +7731,36 @@ Double_t kTPCHVdip = 2.0; // allow for 2V dip as compared to median from given s return kFALSE; } + +//________________________________________ +void AliTPCtrackerMI::MarkSeedFree(TObject *sd) +{ + // account that this seed is "deleted" + AliTPCseed* seed = dynamic_cast(sd); + if (!sd) {AliError(Form("Freeing of non-AliTPCseed %p from the pool is requested",sd)); return;} + int id = seed->GetPoolID(); + if (id<0) {AliError(Form("Freeing of seed %p NOT from the pool is requested",sd)); return;} + // AliInfo(Form("%d %p",id, seed)); + fSeedsPool->RemoveAt(id); + if (fFreeSeedsID.GetSize()<=fNFreeSeeds) fFreeSeedsID.Set( 2*fNFreeSeeds + 100 ); + fFreeSeedsID.GetArray()[fNFreeSeeds++] = id; +} + +//________________________________________ +TObject *&AliTPCtrackerMI::NextFreeSeed() +{ + // return next free slot where the seed can be created + fLastSeedID = fNFreeSeeds ? fFreeSeedsID.GetArray()[--fNFreeSeeds] : fSeedsPool->GetEntriesFast(); + // AliInfo(Form("%d",fLastSeedID)); + return (*fSeedsPool)[ fLastSeedID ]; + // +} + +//________________________________________ +void AliTPCtrackerMI::ResetSeedsPool() +{ + // mark all seeds in the pool as unused + AliInfo(Form("CurrentSize: %d, BookedUpTo: %d, free: %d",fSeedsPool->GetSize(),fSeedsPool->GetEntriesFast(),fNFreeSeeds)); + fNFreeSeeds = 0; + fSeedsPool->Clear("C"); // RS: nominally the seeds may allocate memory... +} diff --git a/TPC/AliTPCtrackerMI.h b/TPC/AliTPCtrackerMI.h index 51fb0eb79a4..2350e0f1505 100644 --- a/TPC/AliTPCtrackerMI.h +++ b/TPC/AliTPCtrackerMI.h @@ -30,11 +30,11 @@ class TTree; class AliESDkink; class TTreeSRedirector; class AliTrackPoint; -class AliClonesPool; class AliDCSSensorArray; class AliDCSSensor; + class AliTPCtrackerMI : public AliTracker { public: AliTPCtrackerMI(); @@ -108,6 +108,10 @@ public: Double_t c) const; Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z) const; // + void ResetSeedsPool(); + void MarkSeedFree( TObject* seed ); + TObject *&NextFreeSeed(); + // public: void SetUseHLTClusters(Int_t useHLTClusters) {fUseHLTClusters = useHLTClusters;} // set usage from HLT clusters from rec.C options @@ -199,9 +203,10 @@ private: TTreeSRedirector *fDebugStreamer; //!debug streamer Int_t fUseHLTClusters; // use HLT clusters instead of offline clusters // - AliClonesPool* fSeedsPool; //! pool of seeds. Note: Owned by reconstruction pools (if exist) - AliClonesPool* fKinksPool; //! pool of kinks. Note: Owned by reconstruction pools (if exist) - + TClonesArray* fSeedsPool; //! pool of seeds + TArrayI fFreeSeedsID; //! array of ID's of freed seeds + Int_t fNFreeSeeds; //! number of seeds freed in the pool + Int_t fLastSeedID; //! id of the pool seed on which is returned by the NextFreeSeed method // ClassDef(AliTPCtrackerMI,3) }; diff --git a/TRD/AliTRDseedV1.cxx b/TRD/AliTRDseedV1.cxx index 262eaa57b8e..b2045ad22f3 100644 --- a/TRD/AliTRDseedV1.cxx +++ b/TRD/AliTRDseedV1.cxx @@ -185,20 +185,6 @@ AliTRDseedV1::~AliTRDseedV1() } } -//____________________________________________________________________ -void AliTRDseedV1::Clear(Option_t *) -{ - // clean - if (IsOwner()) { - for(int itb=0; itbSetOwner(); //RS commented, not needed with TClones + fTracksESD->SetOwner(); } //____________________________________________________________________ @@ -2242,7 +2242,6 @@ Int_t AliTRDtrackerV1::Clusters2TracksSM(Int_t sector, AliESDEvent *esd) // delete ESD tracks in the array fTracksESD->Delete(); - //fTracksESD->Clear(); // RS: don't delete TClones return nTracks; } -- 2.43.0