#include "AliTPCcalibDButil.h"
#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)
fSeeds(0),
fIteration(0),
fkParam(0),
- fDebugStreamer(0)
+ fDebugStreamer(0),
+ fUseHLTClusters(4),
+ fSeedsPool(0),
+ fKinksPool(0)
{
//
// default constructor
return 2;
}
- if (AliTPCReconstructor::GetRecoParam()->GetUseHLTClusters() == 3 ||
- AliTPCReconstructor::GetRecoParam()->GetUseHLTClusters() == 4 ) {
- if(!AliTPCReconstructor::GetRecoParam()->GetUseOnePadCluster())
- if (TMath::Abs(cluster->GetSigmaY2()) < kAlmost0)
- return 2;
+ if (fUseHLTClusters == 3 || fUseHLTClusters == 4) {
+ if (fIteration==2){
+ if(!AliTPCReconstructor::GetRecoParam()->GetUseHLTOnePadCluster()) {
+ if (TMath::Abs(cluster->GetSigmaY2()) < kAlmost0)
+ return 2;
+ }
+ }
}
+
return 0;
}
fSeeds(0),
fIteration(0),
fkParam(0),
- fDebugStreamer(0)
+ fDebugStreamer(0),
+ fUseHLTClusters(4),
+ fSeedsPool(0),
+ fKinksPool(0)
{
//---------------------------------------------------------------------
// The main TPC tracker constructor
if (AliTPCReconstructor::StreamLevel()>0) {
fDebugStreamer = new TTreeSRedirector("TPCdebug.root");
}
+ //
+ fSeedsPool = new AliClonesPool("AliTPCseed",1000);
+ fSeedsPool->SetName("TPCSeed");
+ fKinksPool = new AliClonesPool("AliKink",1000);
+ fKinksPool->SetName("TPCKink");
+
}
//________________________________________________________________________
AliTPCtrackerMI::AliTPCtrackerMI(const AliTPCtrackerMI &t):
fSeeds(0),
fIteration(0),
fkParam(0),
- fDebugStreamer(0)
+ fDebugStreamer(0),
+ fUseHLTClusters(4),
+ fSeedsPool(0),
+ fKinksPool(0)
{
//------------------------------------
// dummy copy constructor
delete[] fInnerSec;
delete[] fOuterSec;
if (fSeeds) {
- fSeeds->Delete();
+ fSeeds->Clear();
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 (left ==0){
tpcrow->SetN1(clrow->GetArray()->GetEntriesFast());
- tpcrow->SetClusters1(new AliTPCclusterMI[tpcrow->GetN1()]);
for (Int_t j=0;j<tpcrow->GetN1();++j)
tpcrow->SetCluster1(j, *(AliTPCclusterMI*)(clrow->GetArray()->At(j)));
}
if (left ==1){
tpcrow->SetN2(clrow->GetArray()->GetEntriesFast());
- tpcrow->SetClusters2(new AliTPCclusterMI[tpcrow->GetN2()]);
for (Int_t j=0;j<tpcrow->GetN2();++j)
- tpcrow->SetCluster2(j,*(AliTPCclusterMI*)(clrow->GetArray()->At(j)));
+ tpcrow->SetCluster2(j, *(AliTPCclusterMI*)(clrow->GetArray()->At(j)));
}
clrow->GetArray()->Clear("C");
}
{
//
// load clusters to the memory
- AliTPCClustersRow *clrow= new AliTPCClustersRow("AliTPCclusterMI");
+ static AliTPCClustersRow *clrow= new AliTPCClustersRow("AliTPCclusterMI");
//
// TTree * tree = fClustersArray.GetTree();
TTree * tree = fInput;
TBranch * br = tree->GetBranch("Segment");
br->SetAddress(&clrow);
- //
+
+ // Conversion of pad, row coordinates in local tracking coords.
+ // Could be skipped here; is already done in clusterfinder
+
Int_t j=Int_t(tree->GetEntries());
for (Int_t i=0; i<j; i++) {
br->GetEntry(i);
}
if (left ==0){
tpcrow->SetN1(clrow->GetArray()->GetEntriesFast());
- tpcrow->SetClusters1(new AliTPCclusterMI[tpcrow->GetN1()]);
for (Int_t k=0;k<tpcrow->GetN1();++k)
tpcrow->SetCluster1(k, *(AliTPCclusterMI*)(clrow->GetArray()->At(k)));
}
if (left ==1){
tpcrow->SetN2(clrow->GetArray()->GetEntriesFast());
- tpcrow->SetClusters2(new AliTPCclusterMI[tpcrow->GetN2()]);
for (Int_t k=0;k<tpcrow->GetN2();++k)
- tpcrow->SetCluster2(k,*(AliTPCclusterMI*)(clrow->GetArray()->At(k)));
+ tpcrow->SetCluster2(k, *(AliTPCclusterMI*)(clrow->GetArray()->At(k)));
}
}
//
- delete clrow;
+ clrow->Clear("C");
LoadOuterSectors();
LoadInnerSectors();
return 0;
Int_t ncl=(index&0x00007fff)>>00;
const AliTPCtrackerRow * tpcrow=0;
- AliTPCclusterMI * clrow =0;
+ TClonesArray * clrow =0;
if (sec<0 || sec>=fkNIS*4) {
AliWarning(Form("Wrong sector %d",sec));
}
}
- return &(clrow[ncl]);
+ return (AliTPCclusterMI*)clrow->At(ncl);
}
if (tpcindex==-1) return 0; //track in dead zone
if (tpcindex >= 0){ //
cl = t.GetClusterPointer(nr);
- if ( (cl==0) ) cl = GetClusterMI(tpcindex);
+ //if (cl==0) cl = GetClusterMI(tpcindex);
+ if (!cl) cl = GetClusterMI(tpcindex);
t.SetCurrentClusterIndex1(tpcindex);
}
if (cl){
if (!cl){
index = t.GetClusterIndex2(nr);
- if ( (index>0) && (index&0x8000)==0){
+ if ( (index >= 0) && (index&0x8000)==0){
cl = t.GetClusterPointer(nr);
- if ( (cl==0) && (index>0)) cl = GetClusterMI(index);
+ if ( (cl==0) && (index >= 0)) cl = GetClusterMI(index);
t.SetCurrentClusterIndex1(index);
if (cl) {
t.SetCurrentCluster(cl);
if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
if (alpha < 0. ) alpha += 2.*TMath::Pi();
//
- t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha())%fN);
+ t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN);
Int_t first = GetRowNumber(xt);
if (!fromSeeds)
first -= step;
+ if (first < 0)
+ first = 0;
for (Int_t nr= first; nr>=rf; nr-=step) {
// update kink info
if (t.GetKinkIndexes()[0]>0){
Double_t alpha=t.GetAlpha();
if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
if (alpha < 0. ) alpha += 2.*TMath::Pi();
- t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha())%fN);
+ t.SetRelativeSector(Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN);
Int_t first = t.GetFirstPoint();
Int_t ri = GetRowNumber(xt);
// if ( (s1->GetClusterIndex2(i)&0xFFFF8FFF)==(s2->GetClusterIndex2(i)&0xFFFF8FFF) && s1->GetClusterIndex2(i)>0) {
if ( (s1->GetClusterIndex2(i))==(s2->GetClusterIndex2(i)) && s1->GetClusterIndex2(i)>0) {
sumshared++;
- s1->SetSharedMapBit(i, kTRUE);
- s2->SetSharedMapBit(i, kTRUE);
}
- if (s1->GetClusterIndex2(i)>0)
- s1->SetClusterMapBit(i, kTRUE);
}
if (sumshared>cutN0){
// sign clusters
if (!pt) continue;
//
if (quality[trackindex]<0){
- delete arr->RemoveAt(trackindex);
- continue;
+ fSeedsPool->MarkSlotFree( arr->RemoveAt(trackindex) );
+ continue;
}
//
//
"pt.="<<pt<<
"\n";
}
- delete arr->RemoveAt(trackindex);
+ fSeedsPool->MarkSlotFree( arr->RemoveAt(trackindex) );
continue;
}
if (pt->GetNumberOfClusters()<50&&(found-0.5*shared)<minimal){ //remove short tracks
"pt.="<<pt<<
"\n";
}
- delete arr->RemoveAt(trackindex);
+ fSeedsPool->MarkSlotFree( arr->RemoveAt(trackindex) );
continue;
}
}
for (Int_t sec=0;sec<fkNIS;sec++){
for (Int_t row=0;row<fInnerSec->GetNRows();row++){
- AliTPCclusterMI *cl = fInnerSec[sec][row].GetClusters1();
+ TClonesArray *cla = fInnerSec[sec][row].GetClusters1();
for (Int_t icl =0;icl< fInnerSec[sec][row].GetN1();icl++){
- Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
+ AliTPCclusterMI* cl = (AliTPCclusterMI*)cla->At(icl);
+ Float_t gx[3]; cl->GetGlobalXYZ(gx);
(*fDebugStreamer)<<"clDump"<<
"iter="<<iter<<
- "cl.="<<&cl[icl]<<
+ "cl.="<<cl<<
"gx0="<<gx[0]<<
"gx1="<<gx[1]<<
"gx2="<<gx[2]<<
"\n";
}
- cl = fInnerSec[sec][row].GetClusters2();
+ cla = fInnerSec[sec][row].GetClusters2();
for (Int_t icl =0;icl< fInnerSec[sec][row].GetN2();icl++){
- Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
+ AliTPCclusterMI* cl = (AliTPCclusterMI*)cla->At(icl);
+ Float_t gx[3]; cl->GetGlobalXYZ(gx);
(*fDebugStreamer)<<"clDump"<<
"iter="<<iter<<
- "cl.="<<&cl[icl]<<
+ "cl.="<<cl<<
"gx0="<<gx[0]<<
"gx1="<<gx[1]<<
"gx2="<<gx[2]<<
for (Int_t sec=0;sec<fkNOS;sec++){
for (Int_t row=0;row<fOuterSec->GetNRows();row++){
- AliTPCclusterMI *cl = fOuterSec[sec][row].GetClusters1();
+ TClonesArray *cla = fOuterSec[sec][row].GetClusters1();
for (Int_t icl =0;icl< fOuterSec[sec][row].GetN1();icl++){
- Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
+ Float_t gx[3];
+ AliTPCclusterMI* cl = (AliTPCclusterMI*) cla->At(icl);
+ cl->GetGlobalXYZ(gx);
(*fDebugStreamer)<<"clDump"<<
"iter="<<iter<<
- "cl.="<<&cl[icl]<<
+ "cl.="<<cl<<
"gx0="<<gx[0]<<
"gx1="<<gx[1]<<
"gx2="<<gx[2]<<
"\n";
}
- cl = fOuterSec[sec][row].GetClusters2();
+ cla = fOuterSec[sec][row].GetClusters2();
for (Int_t icl =0;icl< fOuterSec[sec][row].GetN2();icl++){
- Float_t gx[3]; cl[icl].GetGlobalXYZ(gx);
+ Float_t gx[3];
+ AliTPCclusterMI* cl = (AliTPCclusterMI*) cla->At(icl);
+ cl->GetGlobalXYZ(gx);
(*fDebugStreamer)<<"clDump"<<
"iter="<<iter<<
- "cl.="<<&cl[icl]<<
+ "cl.="<<cl<<
"gx0="<<gx[0]<<
"gx1="<<gx[1]<<
"gx2="<<gx[2]<<
for (Int_t sec=0;sec<fkNIS;sec++){
for (Int_t row=0;row<fInnerSec->GetNRows();row++){
- AliTPCclusterMI *cl = fInnerSec[sec][row].GetClusters1();
+ TClonesArray *cla = fInnerSec[sec][row].GetClusters1();
for (Int_t icl =0;icl< fInnerSec[sec][row].GetN1();icl++)
// if (cl[icl].IsUsed(10))
- cl[icl].Use(-1);
- cl = fInnerSec[sec][row].GetClusters2();
+ ((AliTPCclusterMI*) cla->At(icl))->Use(-1);
+ cla = fInnerSec[sec][row].GetClusters2();
for (Int_t icl =0;icl< fInnerSec[sec][row].GetN2();icl++)
//if (cl[icl].IsUsed(10))
- cl[icl].Use(-1);
+ ((AliTPCclusterMI*) cla->At(icl))->Use(-1);
}
}
for (Int_t sec=0;sec<fkNOS;sec++){
for (Int_t row=0;row<fOuterSec->GetNRows();row++){
- AliTPCclusterMI *cl = fOuterSec[sec][row].GetClusters1();
+ TClonesArray *cla = fOuterSec[sec][row].GetClusters1();
for (Int_t icl =0;icl< fOuterSec[sec][row].GetN1();icl++)
//if (cl[icl].IsUsed(10))
- cl[icl].Use(-1);
- cl = fOuterSec[sec][row].GetClusters2();
+ ((AliTPCclusterMI*) cla->At(icl))->Use(-1);
+ cla = fOuterSec[sec][row].GetClusters2();
for (Int_t icl =0;icl< fOuterSec[sec][row].GetN2();icl++)
//if (cl[icl].IsUsed(10))
- cl[icl].Use(-1);
+ ((AliTPCclusterMI*) cla->At(icl))->Use(-1);
}
}
pt->GetClusterStatistic(0,160,found, foundable,shared);
if (shared/float(found)>0.3) {
if (shared/float(found)>0.9 ){
- //delete arr->RemoveAt(i);
+ //fSeedsPool->MarkSlotFree( arr->RemoveAt(i) );
}
continue;
}
}
-void AliTPCtrackerMI::StopNotActive(const TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const
-{
- // stop not active tracks
- // take th1 as threshold for number of founded to number of foundable on last 10 active rows
- // take th2 as threshold for number of founded to number of foundable on last 20 active rows
- Int_t nseed = arr->GetEntriesFast();
- //
- for (Int_t i=0; i<nseed; i++) {
- AliTPCseed *pt=(AliTPCseed*)arr->UncheckedAt(i);
- if (!pt) {
- continue;
- }
- if (!(pt->IsActive())) continue;
- StopNotActive(pt,row0,th0, th1,th2);
- }
-}
-
-
-
-void AliTPCtrackerMI::StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1,
- Float_t th2) const
-{
- // stop not active tracks
- // take th1 as threshold for number of founded to number of foundable on last 10 active rows
- // take th2 as threshold for number of founded to number of foundable on last 20 active rows
- Int_t sumgood1 = 0;
- Int_t sumgood2 = 0;
- Int_t foundable = 0;
- Int_t maxindex = seed->GetLastPoint(); //last foundable row
- if (seed->GetNFoundable()*th0 > seed->GetNumberOfClusters()) {
- seed->Desactivate(10) ;
- return;
- }
-
- for (Int_t i=row0; i<maxindex; i++){
- Int_t index = seed->GetClusterIndex2(i);
- if (index!=-1) foundable++;
- //if (!c) continue;
- if (foundable<=30) sumgood1++;
- if (foundable<=50) {
- sumgood2++;
- }
- else{
- break;
- }
- }
- if (foundable>=30.){
- if (sumgood1<(th1*30.)) seed->Desactivate(10);
- }
- if (foundable>=50)
- if (sumgood2<(th2*50.)) seed->Desactivate(10);
-}
-
Int_t AliTPCtrackerMI::RefitInward(AliESDEvent *event)
{
AliESDtrack *esd=event->GetTrack(i);
if (seed->GetNumberOfClusters()<60 && seed->GetNumberOfClusters()<(esd->GetTPCclusters(0) -5)*0.8){
- AliInfo("Refitting track");
AliExternalTrackParam paramIn;
AliExternalTrackParam paramOut;
Int_t ncl = seed->RefitTrack(seed,¶mIn,¶mOut);
seed->PropagateTo(fkParam->GetInnerRadiusLow());
seed->UpdatePoints();
AddCovariance(seed);
- MakeBitmaps(seed);
+ MakeESDBitmaps(seed, esd);
seed->CookdEdx(0.02,0.6);
CookLabel(seed,0.1); //For comparison only
- esd->SetTPCClusterMap(seed->GetClusterMap());
- esd->SetTPCSharedMap(seed->GetSharedMap());
//
if (AliTPCReconstructor::StreamLevel()>1 && seed!=0) {
TTreeSRedirector &cstream = *fDebugStreamer;
}
esd->SetTPCsignal(dedx, sdedx, ndedx);
//
+ // fill new dEdx information
+ //
+ Double32_t signal[4];
+ Char_t ncl[3];
+ Char_t nrows[3];
+ //
+ for(Int_t iarr=0;iarr<3;iarr++) {
+ signal[iarr] = seed->GetDEDXregion(iarr+1);
+ ncl[iarr] = seed->GetNCDEDX(iarr+1);
+ nrows[iarr] = seed->GetNCDEDXInclThres(iarr+1);
+ }
+ 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();
+ 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 AliTPCseed(*seed, kTRUE);
+ if (AliTPCReconstructor::StreamLevel()>0 &&storeFriend){
+ AliTPCseed * seedCopy = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(*seed, kTRUE);
+ fSeedsPool->RegisterClone(seedCopy);
esd->AddCalibObject(seedCopy);
}
ntracks++;
}
-void AliTPCtrackerMI::DeleteSeeds()
+Int_t AliTPCtrackerMI::PostProcess(AliESDEvent *event)
{
//
- //delete Seeds
+ // Post process events
+ //
+ if (!event) return 0;
- Int_t nseed = fSeeds->GetEntriesFast();
- for (Int_t i=0;i<nseed;i++){
- AliTPCseed * seed = (AliTPCseed*)fSeeds->At(i);
- if (seed) delete fSeeds->RemoveAt(i);
+ //
+ // Set TPC event status
+ //
+
+ // event affected by HV dip
+ // reset TPC status
+ if(IsTPCHVDipEvent(event)) {
+ event->ResetDetectorStatus(AliDAQ::kTPC);
}
- delete fSeeds;
+
+ //printf("Status %d \n", event->IsDetectorOn(AliDAQ::kTPC));
+ return 0;
+}
+
+
+void AliTPCtrackerMI::DeleteSeeds()
+{
+ //
+ fSeeds->Clear();
+ fSeedsPool->Clear("C"); // nominally allocate memory
+ delete fSeeds;
fSeeds =0;
}
AliTPCtrack t(*esd);
t.SetNumberOfClusters(0);
// AliTPCseed *seed = new AliTPCseed(t,t.GetAlpha());
- AliTPCseed *seed = new AliTPCseed(t/*,t.GetAlpha()*/);
+ AliTPCseed *seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(t/*,t.GetAlpha()*/);
+ fSeedsPool->RegisterClone(seed);
seed->SetUniqueID(esd->GetID());
AddCovariance(seed); //add systematic ucertainty
for (Int_t ikink=0;ikink<3;ikink++) {
if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) == 0 ) seed->ResetCovariance(10.);
//if ( direction ==2 && ((status & AliESDtrack::kTPCout) == 0) ) {
// fSeeds->AddAt(0,i);
- // delete seed;
+ // fSeedsPool->MarkSlotFree( seed );
// continue;
//}
if ( direction ==2 &&(status & AliESDtrack::kTRDrefit) > 0 ) {
Double_t alpha=seed->GetAlpha();
if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
if (alpha < 0. ) alpha += 2.*TMath::Pi();
- Int_t ns=Int_t(alpha/fSectors->GetAlpha())%fN;
+ Int_t ns=Int_t(alpha/fSectors->GetAlpha()+0.0001)%fN;
alpha =ns*fSectors->GetAlpha() + fSectors->GetAlphaShift();
alpha-=seed->GetAlpha();
if (alpha<-TMath::Pi()) alpha += 2*TMath::Pi();
if (TMath::Abs(alpha) > 0.001) { // This should not happen normally
AliWarning(Form("Rotating track over %f",alpha));
if (!seed->Rotate(alpha)) {
- delete seed;
+ fSeedsPool->MarkSlotFree( seed );
continue;
}
}
if (esd->GetKinkIndex(0)<=0){
for (Int_t irow=0;irow<160;irow++){
Int_t index = seed->GetClusterIndex2(irow);
- if (index>0){
+ if (index >= 0){
//
AliTPCclusterMI * cl = GetClusterMI(index);
seed->SetClusterPointer(irow,cl);
Double_t x[5], c[15];
// Int_t di = i1-i2;
//
- AliTPCseed * seed = new AliTPCseed();
+ AliTPCseed * seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed();
+ fSeedsPool->RegisterClone(seed);
Double_t alpha=fSectors->GetAlpha(), shift=fSectors->GetAlphaShift();
Double_t cs=cos(alpha), sn=sin(alpha);
//
// if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue;
UInt_t index=kr1.GetIndex(is);
- seed->~AliTPCseed(); // this does not set the pointer to 0...
- AliTPCseed *track=new(seed) AliTPCseed(x1, ns*alpha+shift, x, c, index);
-
+ if (seed) {fSeedsPool->MarkSlotFree(seed); seed = 0;}
+ AliTPCseed *track = seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x1, ns*alpha+shift, x, c, index);
+ fSeedsPool->RegisterClone(seed);
track->SetIsSeeding(kTRUE);
track->SetSeed1(i1);
track->SetSeed2(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){
- seed->Reset();
- seed->~AliTPCseed();
+ fSeedsPool->MarkSlotFree(seed); seed = 0;
continue;
}
//}
if (track->GetNumberOfClusters()<(i1-i2)*0.5 ||
track->GetNumberOfClusters() < track->GetNFoundable()*0.6 ||
track->GetNShared()>0.4*track->GetNumberOfClusters() ) {
- seed->Reset();
- seed->~AliTPCseed();
+ fSeedsPool->MarkSlotFree(seed); seed = 0;
continue;
}
nout1++;
track2->SetBConstrain(kFALSE);
track2->SetSeedType(1);
arr->AddLast(track2);
- seed->Reset();
- seed->~AliTPCseed();
+ fSeedsPool->MarkSlotFree( seed ); seed = 0;
continue;
}
else{
- seed->Reset();
- seed->~AliTPCseed();
+ fSeedsPool->MarkSlotFree( seed ); seed = 0;
continue;
}
}
track->SetSeedType(0);
- arr->AddLast(track);
- seed = new AliTPCseed;
+ arr->AddLast(track); // note, track is seed, don't free the seed
+ seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed;
+ fSeedsPool->RegisterClone(seed);
nout2++;
// don't consider other combinations
if (track->GetNumberOfClusters() > track->GetNFoundable()*0.8)
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);
}
- delete seed;
+ if (seed) fSeedsPool->MarkSlotFree( seed );
}
Double_t x[5], c[15];
//
// make temporary seed
- AliTPCseed * seed = new AliTPCseed;
+ AliTPCseed * seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed;
+ fSeedsPool->RegisterClone(seed);
Double_t alpha=fOuterSec->GetAlpha(), shift=fOuterSec->GetAlphaShift();
// Double_t cs=cos(alpha), sn=sin(alpha);
//
y3 = kcl->GetY();
// apply angular cuts
if (TMath::Abs(y1-y3)>dymax) continue;
- x3 = x3;
+ //x3 = x3;
z3 = kcl->GetZ();
if (TMath::Abs(z1-z3)>dzmax) continue;
//
// if (!BuildSeed(kr1[is],kcl,0,x1,x2,x3,x,c)) continue;
index=kr1.GetIndex(is);
- seed->~AliTPCseed();
- AliTPCseed *track=new(seed) AliTPCseed(x1, sec*alpha+shift, x, c, index);
+ if (seed) {fSeedsPool->MarkSlotFree( seed ); seed = 0;}
+ AliTPCseed *track = seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x1, sec*alpha+shift, x, c, index);
+ fSeedsPool->RegisterClone(seed);
track->SetIsSeeding(kTRUE);
FollowProlongation(*track, i1-7,1);
if (track->GetNumberOfClusters() < track->GetNFoundable()*0.75 ||
track->GetNShared()>0.6*track->GetNumberOfClusters() || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.6){
- seed->Reset();
- seed->~AliTPCseed();
+ fSeedsPool->MarkSlotFree( seed ); seed = 0;
continue;
}
nout1++;
if (track->GetNumberOfClusters()<(i1-i2)*0.5 ||
track->GetNumberOfClusters()<track->GetNFoundable()*0.7 ||
track->GetNShared()>2. || track->GetChi2()/track->GetNumberOfClusters()>6 || ( track->GetSigmaY2()+ track->GetSigmaZ2())>0.5 ) {
- seed->Reset();
- seed->~AliTPCseed();
+ fSeedsPool->MarkSlotFree( seed ); seed = 0;
continue;
}
FollowProlongation(*track2, i2,1);
track2->SetBConstrain(kFALSE);
track2->SetSeedType(4);
- arr->AddLast(track2);
- seed->Reset();
- seed->~AliTPCseed();
+ arr->AddLast(track2);
+ fSeedsPool->MarkSlotFree( seed ); seed = 0;
}
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);
}
- delete seed;
+ if (seed) fSeedsPool->MarkSlotFree(seed);
}
AliTPCpolyTrack polytrack;
Int_t nclusters=fSectors[sec][row0];
- AliTPCseed * seed = new AliTPCseed;
+ AliTPCseed * seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed;
+ fSeedsPool->RegisterClone(seed);
Int_t sumused=0;
Int_t cused=0;
UInt_t index=0;
//kr0.GetIndex(is);
- seed->~AliTPCseed();
- AliTPCseed *track=new(seed) AliTPCseed(x1,sec*alpha+shift,x,c,index);
+ if (seed) {fSeedsPool->MarkSlotFree( seed ); seed = 0;}
+ AliTPCseed *track = seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x1,sec*alpha+shift,x,c,index);
+ fSeedsPool->RegisterClone(seed);
track->SetIsSeeding(kTRUE);
Int_t rc=FollowProlongation(*track, i2);
if (constrain) track->SetBConstrain(1);
if (rc==0 || track->GetNumberOfClusters()<(i1-i2)*0.5 ||
track->GetNumberOfClusters() < track->GetNFoundable()*0.6 ||
track->GetNShared()>0.4*track->GetNumberOfClusters()) {
- //delete track;
- seed->Reset();
- seed->~AliTPCseed();
+ fSeedsPool->MarkSlotFree( seed ); seed = 0;
}
else {
- arr->AddLast(track);
- seed = new AliTPCseed;
+ arr->AddLast(track); // track IS seed, don't free seed
+ seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed;
+ fSeedsPool->RegisterClone(seed);
}
nin3++;
}
if (fDebug>3){
Info("MakeSeeds2","\nSeeding statiistic:\t%d\t%d\t%d\t%d",nin0,nin1,nin2,nin3);
}
- delete seed;
+ if (seed) fSeedsPool->MarkSlotFree( seed );
}
if ( (index<p0) || x0[0]<0 ){
if (trpoint->GetX()>1){
clindex = track->GetClusterIndex2(i);
- if (clindex>0){
+ if (clindex >= 0){
x0[0] = trpoint->GetX();
x0[1] = trpoint->GetY();
x0[2] = trpoint->GetZ();
if ( (index<p1) &&(trpoint->GetX()>1)){
clindex = track->GetClusterIndex2(i);
- if (clindex>0){
+ if (clindex >= 0){
x1[0] = trpoint->GetX();
x1[1] = trpoint->GetY();
x1[2] = trpoint->GetZ();
}
if ( (index<p2) &&(trpoint->GetX()>1)){
clindex = track->GetClusterIndex2(i);
- if (clindex>0){
+ if (clindex >= 0){
x2[0] = trpoint->GetX();
x2[1] = trpoint->GetY();
x2[2] = trpoint->GetZ();
c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43;
// Int_t row1 = fSectors->GetRowNumber(x2[0]);
- AliTPCseed *seed=new AliTPCseed(x2[0], sec2*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0);
+ AliTPCseed *seed = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(x2[0], sec2*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0);
+ fSeedsPool->RegisterClone(seed);
// Double_t y0,z0,y1,z1, y2,z2;
//seed->GetProlongation(x0[0],y0,z0);
// seed->GetProlongation(x1[0],y1,z1);
c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43;
// Int_t row1 = fSectors->GetRowNumber(xyz[2][0]);
- AliTPCseed *seed=new AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0);
+ AliTPCseed *seed=new( fSeedsPool->NextFreeSlot() ) AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0);
+ fSeedsPool->RegisterClone(seed);
seed->SetLastPoint(row[2]);
seed->SetFirstPoint(row[2]);
return seed;
c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43;
// Int_t row1 = fSectors->GetRowNumber(xyz[2][0]);
- AliTPCseed *seed=new AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0);
+ AliTPCseed *seed=new( fSeedsPool->NextFreeSlot() ) AliTPCseed(xyz[2][0], sec[2]*fSectors->GetAlpha()+fSectors->GetAlphaShift(), x, c, 0);
+ fSeedsPool->RegisterClone(seed);
seed->SetLastPoint(row[2]);
seed->SetFirstPoint(row[2]);
for (Int_t i=row[0];i<row[2];i++){
//
//
//
- delete array->RemoveAt(index1);
+ fSeedsPool->MarkSlotFree( array->RemoveAt(index1) );
}
}
}
}
-
-
-
void AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd)
{
//
// find kinks
//
//
-
- TObjArray *kinks= new TObjArray(10000);
+ // 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 *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];
+ 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];
//const AliESDVertex * primvertex = esd->GetVertex();
//
// nentries = array->GetEntriesFast();
- //
-
//
//
for (Int_t i=0;i<nentries;i++){
}
}
//
- // Finf kinks loop
+ // Find kinks loop
//
+ AliKink* kink = new( fKinksPool->NextFreeSlot() ) AliKink(); fKinksPool->RegisterClone(kink);
//
for (Int_t i =0;i<nentries;i++){
if (sign[i]==0) continue;
continue;
}
//
- kinks->AddLast(kink);
- kink = new AliKink;
+ kink = new( fKinksPool->NextFreeSlot() ) AliKink(); fKinksPool->RegisterClone(kink);
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 = 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];
+ Int_t nkinks = fKinksPool->GetEntriesFast();
+ Float_t quality[nkinks];
+ Int_t indexes[nkinks];
+ AliTPCseed* mothers[nkinks];;
+ AliTPCseed* daughters[nkinks];
//
//
for (Int_t i=0;i<nkinks;i++){
quality[i] =100000;
- AliKink *kinkl = (AliKink*)kinks->At(i);
+ mothers[i] = daughters[i] = 0;
+ AliKink *kinkl = (AliKink*)fKinksPool->At(i);
//
// refit kinks towards vertex
//
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{
- delete kinks->RemoveAt(i);
- if (seed0) delete seed0;
- if (seed1) delete seed1;
+ else {
+ fKinksPool->MarkSlotFree(kinkl);
+ if (seed0) fSeedsPool->MarkSlotFree( seed0 );
+ if (seed1) fSeedsPool->MarkSlotFree( seed1 );
continue;
}
if (kinkl->GetDistance()>0.5 || kinkl->GetR()<110 || kinkl->GetR()>240) {
- delete kinks->RemoveAt(i);
- if (seed0) delete seed0;
- if (seed1) delete seed1;
+ fKinksPool->MarkSlotFree(kinkl);
+ if (seed0) fSeedsPool->MarkSlotFree( seed0 );
+ if (seed1) fSeedsPool->MarkSlotFree( seed1 );
+ mothers[i] = daughters[i] = 0;
continue;
}
- //
- delete seed0;
- delete seed1;
}
//
if (kinkl) quality[i] = 160*((0.1+kinkl->GetDistance())*(2.-kinkl->GetTPCDensityFactor()))/(sumn+40.); //the longest -clossest will win
//remove double find kinks
//
for (Int_t ikink0=1;ikink0<nkinks;ikink0++){
- AliKink * kink0 = (AliKink*) kinks->At(indexes[ikink0]);
+ AliKink * kink0 = (AliKink*) fKinksPool->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;ikink1<ikink0;ikink1++){
- kink0 = (AliKink*) kinks->At(indexes[ikink0]);
- if (!kink0) continue;
- AliKink * kink1 = (AliKink*) kinks->At(indexes[ikink1]);
+ AliKink * kink1 = (AliKink*) fKinksPool->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;
Int_t bothd = 0;
//
for (Int_t i=0;i<row0;i++){
- if (mother0.GetClusterIndex(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++;
}
}
for (Int_t i=row0;i<158;i++){
- if (daughter0.GetClusterIndex(i)>0 && daughter0.GetClusterIndex(i)>0){
+ //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)){
+ if (daughter0->GetClusterIndex(i)==daughter1->GetClusterIndex(i)){
same++;
samed++;
}
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;
- delete kinks->RemoveAt(indexes[ikink0]);
+ fKinksPool->MarkSlotFree(kink0);
+ kink0 = 0;
break;
}
else{
shared[kink1->GetIndex(0)]= kTRUE;
shared[kink1->GetIndex(1)]= kTRUE;
- delete kinks->RemoveAt(indexes[ikink1]);
+ fKinksPool->MarkSlotFree(kink1);
+ fKinksPool->MarkSlotFree(kink1);
+ kink1 = 0;
}
}
}
for (Int_t i=0;i<nkinks;i++){
- AliKink * kinkl = (AliKink*) kinks->At(indexes[i]);
+ AliKink * kinkl = (AliKink*) fKinksPool->At(indexes[i]);
if (!kinkl) continue;
kinkl->SetTPCRow0(GetRowNumber(kinkl->GetR()));
Int_t index0 = kinkl->GetIndex(0);
//
//
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]];
+ 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]];
+ }
}
}
//
AliTPCseed * track0 = (AliTPCseed*)array->At(i);
if (!track0) continue;
if (track0->GetKinkIndex(0)!=0) continue;
- if (shared[i]) delete array->RemoveAt(i);
+ if (shared[i]) fSeedsPool->MarkSlotFree( array->RemoveAt(i) );
}
-
//
//
RemoveUsed2(array,0.5,0.4,30);
}
}
if (Float_t(ishared+1)/Float_t(all+1)>0.5) {
- delete array->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( array->RemoveAt(i) );
continue;
}
//
if (track0->GetKinkIndex(0)!=0) continue;
if (track0->GetNumberOfClusters()<80) continue;
- AliTPCseed *pmother = new AliTPCseed();
- AliTPCseed *pdaughter = new AliTPCseed();
- AliKink *pkink = new AliKink;
-
+ 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 & mother = *pmother;
AliTPCseed & daughter = *pdaughter;
AliKink & kinkl = *pkink;
if (CheckKinkPoint(track0,mother,daughter, kinkl)){
if (mother.GetNumberOfClusters()<30||daughter.GetNumberOfClusters()<20) {
- delete pmother;
- delete pdaughter;
- delete pkink;
+ fSeedsPool->MarkSlotFree(pmother);
+ fSeedsPool->MarkSlotFree(pdaughter);
+ fKinksPool->MarkSlotFree(pkink);
continue; //too short tracks
}
if (mother.Pt()<1.4) {
- delete pmother;
- delete pdaughter;
- delete pkink;
+ fSeedsPool->MarkSlotFree(pmother);
+ fSeedsPool->MarkSlotFree(pdaughter);
+ fKinksPool->MarkSlotFree(pkink);
continue;
}
Int_t row0= kinkl.GetTPCRow0();
if (kinkl.GetDistance()>0.5 || kinkl.GetR()<110. || kinkl.GetR()>240.) {
- delete pmother;
- delete pdaughter;
- delete pkink;
+ fSeedsPool->MarkSlotFree(pmother);
+ fSeedsPool->MarkSlotFree(pdaughter);
+ fKinksPool->MarkSlotFree(pkink);
continue;
}
//
mother.SetKinkIndex(0,-(index+1));
daughter.SetKinkIndex(0,index+1);
if (mother.GetNumberOfClusters()>50) {
- delete array->RemoveAt(i);
- array->AddAt(new AliTPCseed(mother),i);
+ fSeedsPool->MarkSlotFree( array->RemoveAt(i) );
+ AliTPCseed* mtc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(mother);
+ fSeedsPool->RegisterClone(mtc);
+ array->AddAt(mtc,i);
}
else{
- array->AddLast(new AliTPCseed(mother));
+ AliTPCseed* mtc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(mother);
+ fSeedsPool->RegisterClone(mtc);
+ array->AddLast(mtc);
}
- array->AddLast(new AliTPCseed(daughter));
+ AliTPCseed* dtc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(daughter);
+ fSeedsPool->RegisterClone(dtc);
+ array->AddLast(dtc);
for (Int_t icl=0;icl<row0;icl++) {
if (mother.GetClusterPointer(icl)) mother.GetClusterPointer(icl)->Use(20);
}
}
//
}
- delete pmother;
- delete pdaughter;
- delete pkink;
+ fSeedsPool->MarkSlotFree(pmother);
+ fSeedsPool->MarkSlotFree(pdaughter);
+ fKinksPool->MarkSlotFree(pkink);
}
-
- delete [] daughters;
- delete [] mothers;
- //
//
- delete [] dca;
- delete []circular;
- delete []shared;
- delete []quality;
- delete []indexes;
+ for (int i=nkinks;i--;) {
+ if (daughters[i]) fSeedsPool->MarkSlotFree(daughters[i]);
+ if (mothers[i]) fSeedsPool->MarkSlotFree(mothers[i]);
+ }
+ fKinksPool->Clear();
//
- 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();
}
seed1->Reset(kTRUE);
last = seed1->GetLastPoint();
//
- AliTPCseed *seed0 = new AliTPCseed(*seed);
+ AliTPCseed *seed0 = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(*seed);
+ fSeedsPool->RegisterClone(seed0);
seed0->Reset(kFALSE);
seed0->Reset();
//
//
}
}
- delete seed0;
- delete seed1;
+ fSeedsPool->MarkSlotFree( seed0 );
+ fSeedsPool->MarkSlotFree( seed1 );
if (index<0) return 0;
//
Int_t row0 = GetRowNumber(kinks[index].GetR()); //row 0 estimate
- seed0 = new AliTPCseed(param0[index]);
- seed1 = new AliTPCseed(param1[index]);
+ seed0 = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(param0[index]);
+ fSeedsPool->RegisterClone(seed0);
+ seed1 = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(param1[index]);
+ fSeedsPool->RegisterClone(seed1);
seed0->Reset(kFALSE);
seed1->Reset(kFALSE);
seed0->ResetCovariance(10.);
//
//
if (index==-1 || param0[index].GetNumberOfClusters()+param1[index].GetNumberOfClusters()<100){
- delete seed0;
- delete seed1;
+ fSeedsPool->MarkSlotFree( seed0 );
+ fSeedsPool->MarkSlotFree( seed1 );
return 0;
}
"\n";
}
if ( chi2P2+chi2P3<AliTPCReconstructor::GetRecoParam()->GetKinkAngleCutChi2(0)){
- delete seed0;
- delete seed1;
+ fSeedsPool->MarkSlotFree( seed0 );
+ fSeedsPool->MarkSlotFree( seed1 );
return 0;
}
if ( chi2P2+chi2P3<AliTPCReconstructor::GetRecoParam()->GetKinkAngleCutChi2(1)){
mother=*seed;
}
- delete seed0;
- delete seed1;
+ fSeedsPool->MarkSlotFree( seed0 );
+ fSeedsPool->MarkSlotFree( seed1 );
//
return 1;
}
Int_t n=(Int_t)seedTree->GetEntries();
for (Int_t i=0; i<n; i++) {
seedTree->GetEvent(i);
- fSeeds->AddLast(new AliTPCseed(*seed/*,seed->GetAlpha()*/));
+ AliTPCseed* sdc = new( fSeedsPool->NextFreeSlot() ) AliTPCseed(*seed/*,seed->GetAlpha()*/);
+ fSeedsPool->RegisterClone(sdc);
+ fSeeds->AddLast(sdc);
}
- delete seed;
+ delete seed; // RS: this seed is not from the pool, delete it !!!
delete seedTree;
savedir->cd();
return 0;
{
//
// clusters to tracks
-
+ if (fPools && !fPools->GetPoolTPCSeed()) fPools->SetPool(fSeedsPool,AliPoolsSet::kPoolTPCSeed);
if (fSeeds) DeleteSeeds();
+ else fSeedsPool->Clear("C");
fEvent = esd;
AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ;
if (!pt) continue;
Int_t nc=t.GetNumberOfClusters();
if (nc<20) {
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
continue;
}
CookLabel(pt,0.1);
if (pt->GetRemoval()==10) {
if (pt->GetDensityFirst(20)>0.8 || pt->GetDensityFirst(30)>0.8 || pt->GetDensityFirst(40)>0.7)
- pt->Desactivate(10); // make track again active
+ pt->Desactivate(10); // make track again active // MvL: should be 0 ?
else{
pt->Desactivate(20);
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
}
}
}
if (!pt) continue;
Int_t nc=t.GetNumberOfClusters();
if (nc<15) {
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
continue;
}
CookLabel(pt,0.1); //For comparison only
pt->SetLab2(i);
}
else
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
}
if (!pt) continue;
Int_t nc=t.GetNumberOfClusters();
if (nc<15) {
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
continue;
}
t.SetUniqueID(i);
pt->SetLab2(i);
}
else
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
//AliTPCseed * seed1 = ReSeed(pt,0.05,0.5,1);
//if (seed1){
// FollowProlongation(*seed1,0);
if (!pt) continue;
Int_t nc=t.GetNumberOfClusters();
if (nc<15) {
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
continue;
}
t.CookdEdx(0.02,0.6);
cerr<<found++<<'\r';
}
else
- delete fSeeds->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( fSeeds->RemoveAt(i) );
pt->fLab2 = i;
}
*/
//
//
//tracking routine
- TObjArray * arr = new TObjArray;
+ static TObjArray arrTracks;
+ TObjArray * arr = &arrTracks;
//
fSectors = fOuterSec;
TStopwatch timer;
}
-void AliTPCtrackerMI::SumTracks(TObjArray *arr1,TObjArray *&arr2) const
+void AliTPCtrackerMI::SumTracks(TObjArray *arr1,TObjArray *&arr2)
{
//
//sum tracks to common container
//remove suspicious tracks
+ // RS: Attention: supplied tracks come in the static array, don't delete them
Int_t nseed = arr2->GetEntriesFast();
for (Int_t i=0;i<nseed;i++){
AliTPCseed *pt=(AliTPCseed*)arr2->UncheckedAt(i);
// remove tracks with too big curvature
//
if (TMath::Abs(pt->GetC())>AliTPCReconstructor::GetRecoParam()->GetMaxC()){
- delete arr2->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) );
continue;
}
// REMOVE VERY SHORT TRACKS
if (pt->GetNumberOfClusters()<20){
- delete arr2->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) );
continue;
}// patch 28 fev06
// NORMAL ACTIVE TRACK
}
//remove not usable tracks
if (pt->GetRemoval()!=10){
- delete arr2->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) );
continue;
}
if (pt->GetDensityFirst(20)>0.8 || pt->GetDensityFirst(30)>0.8 || pt->GetDensityFirst(40)>0.7)
arr1->AddLast(arr2->RemoveAt(i));
else{
- delete arr2->RemoveAt(i);
+ fSeedsPool->MarkSlotFree( arr2->RemoveAt(i) );
}
}
}
- delete arr2; arr2 = 0;
+ // delete arr2; arr2 = 0; // RS: this is static array, don't delete it
}
-void AliTPCtrackerMI::MakeBitmaps(AliTPCseed *t)
+void AliTPCtrackerMI::MakeESDBitmaps(AliTPCseed *t, AliESDtrack *esd)
{
//-----------------------------------------------------------------------
// Fill the cluster and sharing bitmaps of the track
AliTPCTrackerPoint *point;
AliTPCclusterMI *cluster;
+ Int_t nclsf = 0;
+ TBits clusterMap(159);
+ TBits sharedMap(159);
+ TBits fitMap(159);
for (int iter=firstpoint; iter<lastpoint; iter++) {
// Change to cluster pointers to see if we have a cluster at given padrow
+
cluster = t->GetClusterPointer(iter);
if (cluster) {
- t->SetClusterMapBit(iter, kTRUE);
+ clusterMap.SetBitNumber(iter, kTRUE);
point = t->GetTrackPoint(iter);
if (point->IsShared())
- t->SetSharedMapBit(iter,kTRUE);
- else
- t->SetSharedMapBit(iter, kFALSE);
+ sharedMap.SetBitNumber(iter,kTRUE);
}
- else {
- t->SetClusterMapBit(iter, kFALSE);
- t->SetSharedMapBit(iter, kFALSE);
+ if (t->GetClusterIndex(iter) >= 0 && (t->GetClusterIndex(iter) & 0x8000) == 0) {
+ fitMap.SetBitNumber(iter, kTRUE);
+ nclsf++;
}
}
+ esd->SetTPCClusterMap(clusterMap);
+ esd->SetTPCSharedMap(sharedMap);
+ esd->SetTPCFitMap(fitMap);
+ if (nclsf != t->GetNumberOfClusters())
+ AliWarning(Form("Inconsistency between ncls %d and indices %d (found %d)",t->GetNumberOfClusters(),nclsf,esd->GetTPCClusterMap().CountBits()));
}
Bool_t AliTPCtrackerMI::IsFindable(AliTPCseed & track){
//
seed->AddCovariance(covar);
}
+
+//_____________________________________________________________________________
+Bool_t AliTPCtrackerMI::IsTPCHVDipEvent(AliESDEvent const *esdEvent) {
+//
+// check events affected by TPC HV dip
+//
+if(!esdEvent) return kFALSE;
+
+// Init TPC OCDB
+if(!AliTPCcalibDB::Instance()) return kFALSE;
+AliTPCcalibDB::Instance()->SetRun(esdEvent->GetRunNumber());
+
+// Get HV TPC chamber sensors and calculate the median
+AliDCSSensorArray *voltageArray= AliTPCcalibDB::Instance()->GetVoltageSensors(esdEvent->GetRunNumber());
+if(!voltageArray) return kFALSE;
+
+TString sensorName="";
+Double_t kTPCHVdip = 2.0; // allow for 2V dip as compared to median from given sensor
+
+
+ for(Int_t sector=0; sector<72; sector++)
+ {
+ Char_t sideName='A';
+ if ((sector/18)%2==1) sideName='C';
+ if (sector<36){
+ //IROC
+ sensorName=Form("TPC_ANODE_I_%c%02d_VMEAS",sideName,sector%18);
+ } else {
+ //OROC
+ sensorName=Form("TPC_ANODE_O_%c%02d_0_VMEAS",sideName,sector%18);
+ }
+
+ AliDCSSensor* sensor = voltageArray->GetSensor(sensorName.Data());
+ if(!sensor) continue;
+ TGraph *graph = sensor->GetGraph();
+ if(!graph) continue;
+ Double_t median = TMath::Median(graph->GetN(), graph->GetY());
+ if(median == 0) continue;
+
+ //printf("chamber %d, sensor %s, HV %f, median %f\n", sector, sensorName.Data(), sensor->GetValue(esdEvent->GetTimeStamp()), median);
+
+ if(TMath::Abs(sensor->GetValue(esdEvent->GetTimeStamp())-median)>kTPCHVdip) {
+ return kTRUE;
+ }
+ }
+
+ return kFALSE;
+}