class AliITSUSeed: public AliExternalTrackParam
{
public:
- enum {kKilled=BIT(14),kFake=BIT(15)};
+ enum {kKilled=BIT(14),kSave=BIT(15),kFake=BIT(16)};
enum {kF02,kF04,kF12,kF13,kF14,kF24, kF44,kNFElem}; // non-trivial elems of propagation matrix
enum {kK00,kK01,kK10,kK11,kK20,kK21,kK30,kK31,kK40,kK41, kNKElem}; // non-trivial elems of gain matrix
enum {kS00,kS10,kS11,kS20,kS21,kS22,kS30,kS31,kS32,kS33,kS40,kS41,kS42,kS43,kS44,kNSElem}; // elements of 5x5 sym matrix
void SetChi2Cl(Double_t v) {fChi2Cl= v; v>0 ? fChi2Glo+=v : fChi2Penalty -= v;}
void Kill(Bool_t v=kTRUE) {SetBit(kKilled, v);}
void SetFake(Bool_t v=kTRUE) {SetBit(kFake, v);}
+ void Save(Bool_t v=kTRUE) {SetBit(kSave,v);}
+ void FlagTree(UInt_t bits, Bool_t v=kTRUE);
//
UInt_t GetLrClusterID() const {return fClID;}
Int_t GetLrCluster(Int_t &lr) const {return UnpackCluster(fClID,lr);}
Float_t GetChi2GloNrm() const;
Bool_t IsKilled() const {return TestBit(kKilled);}
Bool_t IsFake() const {return TestBit(kFake);}
+ Bool_t IsSaved() const {return TestBit(kSave);}
Bool_t ContainsFake() const;
//
Int_t GetPoolID() const {return int(GetUniqueID())-1;}
//
}
+//__________________________________________________________________
+inline void AliITSUSeed::FlagTree(UInt_t bits, Bool_t v)
+{
+ // set bits on all tree levels
+ AliITSUSeed* seed = this;
+ do {seed->SetBit(bits,v);} while ( (seed=(AliITSUSeed*)seed->GetParent()) );
+ //
+}
+
+
#endif
{
public:
enum {kCondStart,kNGroups,kMinClus,kNAuxSz};
- enum {kMaxBranches=50,kMaxCandidates=500}; // max number of branches one can create for single seed on any layer (except branch w/o cl. attached)
-
-
+ //
AliITSUTrackCond(Int_t nLayers=0);
AliITSUTrackCond(const AliITSUTrackCond& src);
AliITSUTrackCond &operator=(const AliITSUTrackCond& src);
#include "AliESDtrack.h"
#include "AliCluster.h"
#include "AliITSUAux.h"
+#include <TString.h>
ClassImp(AliITSUTrackHyp)
}
//
}
+//__________________________________________________________________
+void AliITSUTrackHyp::InitFrom(const AliITSUTrackHyp *src)
+{
+ // copy initial params
+ fNLayers = src->fNLayers;
+ fITSLabel = src->fITSLabel;
+ fESDTrack = src->fESDTrack;
+ fWinner = src->fWinner;
+ //
+}
//__________________________________________________________________
AliITSUTrackHyp &AliITSUTrackHyp::operator=(const AliITSUTrackHyp &src)
}
//__________________________________________________________________
-void AliITSUTrackHyp::Print(Option_t* ) const
+void AliITSUTrackHyp::Print(Option_t* opt) const
{
printf("Track Hyp.#%4d. NSeeds:",GetUniqueID());
- for (int i=0;i<fNLayers;i++) printf(" (%d) %3d",i,GetNSeeds(i)); printf("\n");
+ TString opts = opt;
+ opts.ToLower();
+ Bool_t prSeeds = opts.Contains("l");
+ for (int i=0;i<fNLayers;i++) {
+ printf("Lr (%d) %3d ",i,GetNSeeds(i));
+ if (prSeeds) {
+ printf("\n");
+ for (int isd=0;isd<GetNSeeds(i);isd++) ((AliITSUSeed*)GetSeed(i,isd))->Print(opt);
+ }
+ }
+ if (!prSeeds) printf("\n");
}
//__________________________________________________________________
AliITSUTrackHyp &operator=(const AliITSUTrackHyp &src);
virtual ~AliITSUTrackHyp();
//
+ void InitFrom(const AliITSUTrackHyp *src);
Int_t GetNLayers() const {return fNLayers;}
Int_t GetNSeeds(Int_t lr) const {return fLayerSeeds[lr].GetEntriesFast();}
AliITSUSeed* GetSeed(Int_t lr, Int_t id) const {return (AliITSUSeed*)fLayerSeeds[lr].UncheckedAt(id);}
+ AliITSUSeed* RemoveSeed(Int_t lr, Int_t id) const {return (AliITSUSeed*)fLayerSeeds[lr].RemoveAt(id);}
AliITSUSeed* GetWinner() const;
AliESDtrack* GetESDTrack() const {return fESDTrack;}
Int_t GetITSLabel() const {return fITSLabel;}
,fCountITSout(0)
,fCountITSrefit(0)
,fHypStore(100)
+ ,fLayerMaxCandidates(1000)
+ ,fLayerCandidates(0)
,fNBranchesAdded(0)
,fNCandidatesAdded(0)
,fCurrHyp(0)
+ ,fWorkHyp(0)
,fSeedsPool("AliITSUSeed",0)
,fFreeSeedsID(0)
,fNFreeSeeds(0)
,fLastSeedID(0)
+ ,fNLrActive(0)
,fDefTrackConds(0)
,fCurrTrackCond(0)
,fCurrActLrID(-1)
// init with external reconstructor
//
fITS = rec->GetITSInterface();
- int nLr = fITS->GetNLayersActive();
- fClInfo = new Int_t[nLr<<1];
+ fNLrActive = fITS->GetNLayersActive();
+ fClInfo = new Int_t[fNLrActive*2];
+ fWorkHyp = new AliITSUTrackHyp(fNLrActive);
//
+ if (fLayerMaxCandidates<1) fLayerMaxCandidates = 1000;
+ fLayerCandidates = new AliITSUSeed*[fLayerMaxCandidates];
fSeedsPool.ExpandCreateFast(1000); // RS TOCHECK
fFreeSeedsID.Set(1000);
//
void AliITSUTrackerGlo::CreateDefaultTrackCond()
{
// creates default tracking conditions to be used when recoparam does not provide them
- int nLr = fITS->GetNLayersActive();
- fClInfo = new Int_t[nLr<<1];
- //
+
AliITSUTrackCond* cond = new AliITSUTrackCond();
//
- cond->SetNLayers(fITS->GetNLayersActive());
- cond->AddNewCondition(nLr);
+ cond->SetNLayers(fNLrActive);
+ cond->AddNewCondition(fNLrActive);
cond->AddGroupPattern( 0xffff ); // require all layers hit
cond->Init();
//
AliLog::SetClassDebugLevel("AliITSUTrackerGlo",dbg ? 10:0);
*/
- AliDebug(1,Form("Processing track %d | M=%.3f Pt=%.3f | MCLabel: %d",itr,fCurrESDtrack->GetMass(kTRUE),fCurrESDtrack->Pt(),fCurrESDtrMClb));//RS
+ AliDebug(-1,Form("Processing track %d | M=%.3f Pt=%.3f | MCLabel: %d",itr,fCurrESDtrack->GetMass(kTRUE),fCurrESDtrack->Pt(),fCurrESDtrMClb));//RS
FindTrack(fCurrESDtrack, itr);
}
//
AliITSUSeed seedUC; // copy of the seed from the upper layer
AliITSUSeed seedT; // transient seed between the seedUC and new prolongation hypothesis
//
- if (!InitHypothesis(esdTr,esdID)) return; // initialize prolongations hypotheses tree
+ AliITSUTrackHyp* hypTr = InitHypothesis(esdTr,esdID); // initialize prolongations hypotheses tree
+ fCurrHyp = fWorkHyp;
+ fCurrHyp->InitFrom(hypTr);
//
AliITSURecoSens *hitSens[AliITSURecoSens::kNNeighbors+1];
//
TObjArray clArr; // container for transfer of clusters matching to seed
//
- int nLrActive = fITS->GetNLayersActive();
- for (int ila=nLrActive;ila--;) {
+ for (int ila=fNLrActive;ila--;) {
fCurrActLrID = ila;
fCurrLayer = fITS->GetLayerActive(ila);
Bool_t noClSharing = fCurrTrackCond->GetClSharing(ila)==0;
int ilaUp = ila+1; // prolong seeds from layer above
//
// for the outermost layer the seed is created from the ESD track
- int nSeedsUp = (ilaUp==nLrActive) ? 1 : fCurrHyp->GetNSeeds(ilaUp);
+ int nSeedsUp = (ilaUp==fNLrActive) ? 1 : fCurrHyp->GetNSeeds(ilaUp);
int maxNBranches = fCurrTrackCond->GetMaxBranches(ila);
int maxNCandidates = fCurrTrackCond->GetMaxCandidates(ila);
//
for (int isd=0;isd<nSeedsUp;isd++) {
AliITSUSeed* seedU;
- if (ilaUp==nLrActive) {
+ if (ilaUp==fNLrActive) {
seedU = 0;
seedUC.InitFromESDTrack(esdTr);
}
AliITSUSeed* sp = fCurrHyp->GetSeed(ila,ih);
while(sp->GetParent()) {
sp->Smooth(vecL,matL);
- if (sp->GetLayerID()>=fITS->GetNLayersActive()-1) break;
+ if (sp->GetLayerID()>=fNLrActive-1) break;
sp = (AliITSUSeed*)sp->GetParent();
}
*/
}
//
- SaveCurrentTrackHypotheses();
+ SaveReducedHypothesesTree(hypTr);
+ if (AliDebugLevelClass()>1) {
+ printf("\nSaved hypotheses for esdTrack %d (MCLab:%d)\n",esdID,fCurrESDtrMClb);
+ hypTr->Print("l");
+ }
+ fCurrHyp = 0;
//
}
//_________________________________________________________________________
-Bool_t AliITSUTrackerGlo::InitHypothesis(AliESDtrack *esdTr, Int_t esdID)
+AliITSUTrackHyp* AliITSUTrackerGlo::InitHypothesis(AliESDtrack *esdTr, Int_t esdID)
{
// init prolongaion candidates finding for single seed
- fCurrHyp = GetTrackHyp(esdID);
- if (fCurrHyp) return kTRUE;
+ AliITSUTrackHyp* hyp = GetTrackHyp(esdID);
+ if (hyp) return hyp;
//
fCountProlongationTrials++;
//
fCurrMass = esdTr->GetMass();
if (fCurrMass<kPionMass*0.9) fCurrMass = kPionMass; // don't trust to mu, e identification from TPCin
//
- fCurrHyp = new AliITSUTrackHyp(fITS->GetNLayersActive());
- fCurrHyp->SetESDTrack(esdTr);
- fCurrHyp->SetUniqueID(esdID);
- fCurrHyp->SetMass(fCurrMass);
- SetTrackHyp(fCurrHyp,esdID);
+ hyp = new AliITSUTrackHyp(fNLrActive);
+ hyp->SetESDTrack(esdTr);
+ hyp->SetUniqueID(esdID);
+ hyp->SetMass(fCurrMass);
+ SetTrackHyp(hyp,esdID);
//
- return kTRUE;
+ return hyp;
// TO DO
}
return kTRUE;
}
-//______________________________________________________________________________
-void AliITSUTrackerGlo::SaveCurrentTrackHypotheses()
-{
- // RS: shall we clean up killed seeds?
- ((TObjArray*)fCurrHyp->GetLayerSeeds(0))->Sort();
- fCurrHyp = 0;
- // TODO
-
-}
-
//______________________________________________________________________________
void AliITSUTrackerGlo::FinalizeHypotheses()
{
Bool_t AliITSUTrackerGlo::AddSeedBranch(AliITSUSeed* seed)
{
// add new prolongation branch for the seed to temporary array. The seeds are sorted according to Compare f-n
- if (fNCandidatesAdded+fNBranchesAdded>=AliITSUTrackCond::kMaxCandidates ) {
- AliError(Form("Number of candidates for current seed reached limit of AliITSUTrackCond::kMaxCandidates=%d, increase it",AliITSUTrackCond::kMaxCandidates));
- return kFALSE;
+ if (fNCandidatesAdded+fNBranchesAdded>=fLayerMaxCandidates ) {
+ AliInfo(Form("Number of candidates at layer %d for current seed reached %d, increasing buffer",fCurrActLrID,fLayerMaxCandidates));
+ fLayerMaxCandidates = 2*(fLayerMaxCandidates+1);
+ AliITSUSeed** tmpArr = fLayerCandidates;
+ fLayerCandidates = new AliITSUSeed*[fLayerMaxCandidates];
+ memcpy(fLayerCandidates,tmpArr,(fNCandidatesAdded+fNBranchesAdded)*sizeof(AliITSUSeed*));
+ delete tmpArr; // delete only array, not objects
}
AliITSUSeed** branches = &fLayerCandidates[fNCandidatesAdded]; // note: fNCandidatesAdded is incremented after adding all branches of current seed
int slot=fNBranchesAdded++;
// transfer allowed number of branches to hypothesis container
//
// sort candidates in increasing order of chi2
- Int_t index[AliITSUTrackCond::kMaxCandidates];
- Float_t chi2[AliITSUTrackCond::kMaxCandidates];
+ static int lastSize = 0;
+ static int *index = 0;
+ static float *chi2 = 0;
+ if (fLayerMaxCandidates>lastSize) {
+ lastSize = fLayerMaxCandidates;
+ delete[] index;
+ delete[] chi2;
+ index = new int[lastSize];
+ chi2 = new float[lastSize];
+ }
for (int i=fNCandidatesAdded;i--;) chi2[i] = fLayerCandidates[i]->GetChi2GloNrm();
Sort(fNCandidatesAdded,chi2,index,kFALSE);
//
//
}
+//__________________________________________________________________
+void AliITSUTrackerGlo::SaveReducedHypothesesTree(AliITSUTrackHyp* dest)
+{
+ // remove those hypothesis seeds which dont lead to candidates at final layer
+ //
+ // 1st, flag the seeds to save
+ int lr0 = 0;
+ for (int isd=0;isd<fCurrHyp->GetNSeeds(lr0);isd++) {
+ AliITSUSeed* seed = fCurrHyp->RemoveSeed(lr0,isd);
+ if (!seed) continue;
+ seed->FlagTree(AliITSUSeed::kSave);
+ dest->AddSeed(seed,lr0);
+ }
+ for (int ilr=1;ilr<fNLrActive;ilr++) {
+ int nsd = fCurrHyp->GetNSeeds(ilr);
+ for (int isd=0;isd<nsd;isd++) {
+ AliITSUSeed* seed = fCurrHyp->RemoveSeed(ilr,isd);
+ if (!seed) continue; // already discarded or saved
+ if (seed->IsSaved()) dest->AddSeed(seed,ilr);
+ else MarkSeedFree(seed);
+ }
+ }
+ //
+ // AliInfo(Form("SeedsPool: %d, BookedUpTo: %d, free: %d",fSeedsPool.GetSize(),fSeedsPool.GetEntriesFast(),fNFreeSeeds));
+}
+
//__________________________________________________________________
void AliITSUTrackerGlo::FlagSplitClusters()
{
// set special bit on split clusters using MC info
- for (int ilr=fITS->GetNLayersActive();ilr--;) {
+ for (int ilr=fNLrActive;ilr--;) {
int nsplit=0;
AliITSURecoLayer* lr = fITS->GetLayerActive(ilr);
for (int isn=lr->GetNSensors();isn--;) {
const int nchbins=200;
const int maxBr = 15;
const int maxCand = 200;
- int nblr = fITS->GetNLayersActive();
TString ttl;
for (int stp=0;stp<kNTrackingPhases;stp++) {
- for (int ilr=0;ilr<nblr;ilr++) {
+ for (int ilr=0;ilr<fNLrActive;ilr++) {
int hoffs = stp*kHistosPhase + ilr;
double mxdf = ilr>=kNResDef ? kResDef[kNResDef-1] : kResDef[ilr];
ttl = Form("S%d_residY%d",stp,ilr);
void Init(AliITSUReconstructor* rec);
void FindTrack(AliESDtrack* esdTr, Int_t esdID);
void CreateDefaultTrackCond();
- Bool_t InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
+ AliITSUTrackHyp* InitHypothesis(AliESDtrack *esdTr, Int_t esdID);
Bool_t TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo);
Bool_t TransportToLayer(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo);
Bool_t TransportToLayerX(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo, Double_t xStop);
AliITSUTrackHyp* GetTrackHyp(Int_t id) const {return (AliITSUTrackHyp*)fHypStore.UncheckedAt(id);}
void SetTrackHyp(AliITSUTrackHyp* hyp,Int_t id) {fHypStore.AddAtAndExpand(hyp,id);}
void DeleteLastSeedFromPool() {fSeedsPool.RemoveLast();}
- void SaveCurrentTrackHypotheses();
+ void SaveReducedHypothesesTree(AliITSUTrackHyp* dest);
void FinalizeHypotheses();
void UpdateESDTrack(AliITSUTrackHyp* hyp,Int_t flag);
void CookMCLabel(AliITSUTrackHyp* hyp);
//
// the seeds management to be optimized
TObjArray fHypStore; // storage for tracks hypotheses
- AliITSUSeed* fLayerCandidates[AliITSUTrackCond::kMaxCandidates]; // array for branches of current track prolongation
+ Int_t fLayerMaxCandidates; //! size of tmp candidates array
+ AliITSUSeed** fLayerCandidates;//! array for branches of current track prolongation
Int_t fNBranchesAdded; // number of branches created for current seed in prolongation
Int_t fNCandidatesAdded; // number of candidates added for current seed in prolongation
- AliITSUTrackHyp* fCurrHyp; // hypotheses container for current track
+ AliITSUTrackHyp* fCurrHyp; //! hypotheses container for current track
+ AliITSUTrackHyp* fWorkHyp; //! temporary hypothesis for track finding
TClonesArray fSeedsPool; //! pool for 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
+ Int_t fNLrActive; //! number of active layers
//
TObjArray fDefTrackConds; //! default tracking conditions
AliITSUTrackCond* fCurrTrackCond; //! current tracking condition
recoParamArray->AddLast(itsRecoParam);
}
//
- int nBranch[7] = {3,3,3,3,3,3,3}; // max branching for the seed on layer
- int nCands[7] = {250,200,150,100,60,40,20}; // max branching for the TPC seed
- float tr2clChi2[7] = {50,50,50,50,50,50,50}; // cut on cluster to track chi2
+ int nBranch[7] = {10,10,10,10,10,10,10}; // max branching for the seed on layer
+ int nCands[7] = {10,500,500,500,300,200,100}; // max candidates for the TPC seed
+ float tr2clChi2[7] = {50,50,50,50,50,80,100}; // cut on cluster to track chi2
+ float missPen[7] = {2.,2.,2.,2.,2.,2.,2.}; // missing cluster penalty
//
{
AliITSURecoParam * itsRecoParam = AliITSURecoParam::GetLowFluxParam();
for (int i=0;i<nLr;i++) {
trCond->SetMaxBranches(i,nBranch[i]); // each seed propagated to given layer can produce max nBranch branches
trCond->SetMaxCandidates(i,nCands[i]); // each tpc track may have at most nCands prolongations
- trCond->SetMaxTr2ClChi2(i,tr2clChi2[i]); // cut on cluster to track chi2
+ trCond->SetMaxTr2ClChi2(i,tr2clChi2[i]); // cut on cluster to track chi2
+ trCond->SetMissPenalty(i,missPen[i]); // missing cluster penalty
//
}
//
trCond->AddGroupPattern( kBit3|kBit4 );
trCond->AddGroupPattern( kBit5|kBit6 );
//
+ trCond->AddNewCondition(5); // min hits
+ trCond->AddGroupPattern( kBit0|kBit1 );
+ trCond->AddGroupPattern( kBit3|kBit4 );
+ trCond->AddGroupPattern( kBit5|kBit6 );
+ //
trCond->AddNewCondition(5);
trCond->AddGroupPattern( kBit0|kBit2 );
trCond->AddGroupPattern( kBit3|kBit4 );
trCond->SetMaxBranches(i,nBranch[i]); // each seed propagated to given layer can produce max nBranch branches
trCond->SetMaxCandidates(i,nCands[i]); // each tpc track may have at most nCands prolongations
trCond->SetMaxTr2ClChi2(i,tr2clChi2[i]); // cut on cluster to track chi2
+ trCond->SetMissPenalty(i,missPen[i]); // missing cluster penalty
//
}
//