#include <TTree.h>
#include <Riostream.h>
#include <TMath.h>
+#include <TFile.h>
#include "AliITSUTrackerGlo.h"
#include "AliESDEvent.h"
using namespace AliITSUAux;
using namespace TMath;
-
-
//----------------- tmp stuff -----------------
ClassImp(AliITSUTrackerGlo)
: fReconstructor(rec)
,fITS(0)
,fCurrESDtrack(0)
+ ,fCurrESDtrMClb(kDummyLabel)
,fCurrMass(kPionMass)
+ ,fCountProlongationTrials(0)
+ ,fCountITSin(0)
+ ,fCountITSout(0)
+ ,fCountITSrefit(0)
,fHypStore(100)
+ ,fNBranchesAdded(0)
+ ,fNCandidatesAdded(0)
,fCurrHyp(0)
,fSeedsPool("AliITSUSeed",0)
,fFreeSeedsID(0)
,fCurrTrackCond(0)
,fTrackPhase(-1)
,fClInfo(0)
+#ifdef _FILL_CONTROL_HISTOS_
+ ,fCHistoArr(0)
+#endif
{
// Default constructor
if (rec) Init(rec);
//
delete[] fClInfo;
//
+#ifdef _FILL_CONTROL_HISTOS_
+ if (fCHistoArr) {
+ TFile* ctrOut = TFile::Open("itsuControlHistos.root","recreate");
+ ctrOut->cd();
+ AliInfo("Storing control histos");
+ fCHistoArr->Print();
+ // ctrOut->WriteObject(fCHistoArr,"controlH","kSingleKey");
+ fCHistoArr->Write();
+ ctrOut->Close();
+ delete ctrOut;
+ fCHistoArr = 0;
+ }
+#endif
+ //
}
//_________________________________________________________________________
Int_t AliITSUTrackerGlo::Clusters2Tracks(AliESDEvent *esdEv)
{
//
+ SetTrackingPhase(kClus2Tracks);
+ //
+#ifdef _FILL_CONTROL_HISTOS_
+ if (!fCHistoArr) BookControlHistos();
+#endif
+
TObjArray *trackConds = 0;
//
- SetTrackingPhase(kClus2Tracks);
+ fCountProlongationTrials = 0;
+ fCountITSin = 0;
+ fCountITSout = 0;
+ fCountITSrefit = 0;
+ //
ResetSeedsPool();
int nTrESD = esdEv->GetNumberOfTracks();
AliInfo(Form("Will try to find prolongations for %d tracks",nTrESD));
- AliITSUReconstructor::GetRecoParam()->Print();
- fHypStore.Delete();
- if (fHypStore.GetSize()<nTrESD) fHypStore.Expand(nTrESD+100);
- //
- fITS->ProcessClusters();
- //
int nTrackCond = AliITSUReconstructor::GetRecoParam()->GetNTrackingConditions();
if (nTrackCond<1) {
if (!fDefTrackConds.GetEntriesFast()) {
}
else trackConds = AliITSUReconstructor::GetRecoParam()->GetTrackingConditions();
//
+ static Bool_t first = kTRUE;
+ if (first) {
+ AliITSUReconstructor::GetRecoParam()->Print();
+ first = kFALSE;
+ }
+ fHypStore.Delete();
+ if (fHypStore.GetSize()<nTrESD) fHypStore.Expand(nTrESD+100);
+ //
+ fITS->ProcessClusters();
+ //
+ FlagSplitClusters(); // tmp RS
+ //
for (int icnd=0;icnd<nTrackCond;icnd++) {
fCurrTrackCond = (AliITSUTrackCond*)trackConds->UncheckedAt(icnd);
// select ESD tracks to propagate
for (int itr=0;itr<nTrESD;itr++) {
- AliESDtrack *esdTr = esdEv->GetTrack(itr);
- AliInfo(Form("Processing track %d | MCLabel: %d",itr,esdTr->GetTPCLabel()));
- if (!NeedToProlong(esdTr)) continue; // are we interested in this track?
- FindTrack(esdTr, itr);
+ fCurrESDtrack = esdEv->GetTrack(itr);
+ fCurrESDtrMClb = fCurrESDtrack->GetLabel();
+ //
+ if (!NeedToProlong(fCurrESDtrack)) continue; // are we interested in this track?
+ AliDebug(+1,Form("Processing track %d | M=%.3f Pt=%.3f | MCLabel: %d",itr,fCurrESDtrack->GetMass(kTRUE),fCurrESDtrack->Pt(),fCurrESDtrMClb));//RS
+ FindTrack(fCurrESDtrack, itr);
}
//
- AliInfo(Form("SeedsPool: %d, BookedUpTo: %d, free: %d",fSeedsPool.GetSize(),fSeedsPool.GetEntriesFast(),fNFreeSeeds));
- fHypStore.Print();
+ if (AliDebugLevelClass()>+2) {
+ AliInfo(Form("SeedsPool: %d, BookedUpTo: %d, free: %d",fSeedsPool.GetSize(),fSeedsPool.GetEntriesFast(),fNFreeSeeds));
+ fHypStore.Print();
+ }
FinalizeHypotheses();
}
//
+ AliInfo(Form("%d ITSin for %d tried TPC seeds out of %d ESD tracks\n",fCountITSin,fCountProlongationTrials,nTrESD));
return 0;
}
//
SetTrackingPhase(kPropBack);
int nTrESD = esdEv->GetNumberOfTracks();
- AliInfo(Form("Will propagate back %d tracks",nTrESD));
+ AliDebug(1,Form("Will propagate back %d tracks",nTrESD));
//
double bz0 = GetBz();
Double_t xyzTrk[3],xyzVtx[3]={GetX(),GetY(),GetZ()};
//
//
for (int itr=0;itr<nTrESD;itr++) {
- AliESDtrack *esdTr = esdEv->GetTrack(itr);
+ fCurrESDtrack = esdEv->GetTrack(itr);
+ fCurrESDtrMClb = fCurrESDtrack->GetLabel();
// Start time integral and add distance from current position to vertex
- if (esdTr->IsOn(AliESDtrack::kITSout)) continue; // already done
+ if (fCurrESDtrack->IsOn(AliESDtrack::kITSout)) continue; // already done
//
- esdTr->GetXYZ(xyzTrk);
+ fCurrESDtrack->GetXYZ(xyzTrk);
Double_t dst = 0.; // set initial track lenght, tof
{
double dxs = xyzTrk[0] - xyzVtx[0];
// Hence s^2/d^2 = (1+1/6 p^2)^2
dst = dxs*dxs + dys*dys;
if (dst > kWatchStep*kWatchStep) { // correct circular part for arc/segment factor
- double crv = Abs(esdTr->GetC(bz0));
+ double crv = Abs(fCurrESDtrack->GetC(bz0));
double fcarc = 1.+crv*crv*dst/6.;
dst *= fcarc*fcarc;
}
dst = Sqrt(dst);
}
//
- esdTr->SetStatus(AliESDtrack::kTIME);
+ fCurrESDtrack->SetStatus(AliESDtrack::kTIME);
//
- if (!esdTr->IsOn(AliESDtrack::kITSin)) { // case of tracks w/o ITS prolongation: just set the time integration
- dummyTr.AliExternalTrackParam::operator=(*esdTr);
+ if (!fCurrESDtrack->IsOn(AliESDtrack::kITSin)) { // case of tracks w/o ITS prolongation: just set the time integration
+ dummyTr.AliExternalTrackParam::operator=(*fCurrESDtrack);
dummyTr.StartTimeIntegral();
dummyTr.AddTimeStep(dst);
dummyTr.GetIntegratedTimes(times);
- esdTr->SetIntegratedTimes(times);
- esdTr->SetIntegratedLength(dummyTr.GetIntegratedLength());
+ fCurrESDtrack->SetIntegratedTimes(times);
+ fCurrESDtrack->SetIntegratedLength(dummyTr.GetIntegratedLength());
continue;
}
//
currTr = GetTrackHyp(itr);
currTr->StartTimeIntegral();
currTr->AddTimeStep(dst);
- printf("Before resetCov: "); currTr->AliExternalTrackParam::Print();
+ // printf("Before resetCov: "); currTr->AliExternalTrackParam::Print();
currTr->ResetCovariance(10000);
if (RefitTrack(currTr,fITS->GetRMax())) { // propagate to exit from the ITS/TPC screen
UpdateESDTrack(currTr,AliESDtrack::kITSout);
+ fCountITSout++;
}
else {
- AliInfo(Form("Refit Failed for track %d",itr));
+ AliDebug(2,Form("Refit Failed for track %d | ESDtrack#%d (MClb:%d)",itr,fCurrESDtrack->GetID(),fCurrESDtrMClb));
+ //currTr->AliExternalTrackParam::Print();
+ //currTr->GetWinner()->Print();
}
//
}
//
+ AliInfo(Form("%d ITSout in %d ITSin tracks for %d tried TPC seeds out of %d ESD tracks\n",
+ fCountITSout,fCountITSin,fCountProlongationTrials,nTrESD));
+ //
return 0;
}
//
SetTrackingPhase(kRefitInw);
Int_t nTrESD = esdEv->GetNumberOfTracks();
- AliInfo(Form("Will refit inward %d tracks",nTrESD));
+ // AliLog::SetClassDebugLevel("AliITSUTrackerGlo",10);
+
+ AliDebug(1,Form("Will refit inward %d tracks",nTrESD));
AliITSUTrackHyp *currTr=0;
//
for (int itr=0;itr<nTrESD;itr++) {
- AliESDtrack *esdTr = esdEv->GetTrack(itr);
+ fCurrESDtrack = esdEv->GetTrack(itr);
+ fCurrESDtrMClb = fCurrESDtrack->GetLabel();
// Start time integral and add distance from current position to vertex
- UInt_t trStat = esdTr->GetStatus();
+ UInt_t trStat = fCurrESDtrack->GetStatus();
if ( !(trStat & AliESDtrack::kITSout) ) continue;
if ( trStat & AliESDtrack::kITSrefit ) continue; // already done
if ( (trStat & AliESDtrack::kTPCout) && !(trStat & AliESDtrack::kTPCrefit) ) continue;
//
currTr = GetTrackHyp(itr);
- currTr->AliExternalTrackParam::operator=(*esdTr); // fetch current ESDtrack kinematics
+ currTr->AliExternalTrackParam::operator=(*fCurrESDtrack); // fetch current ESDtrack kinematics
if (RefitTrack(currTr,fITS->GetRMin())) { // propagate up to inside radius of the beam pipe
UpdateESDTrack(currTr,AliESDtrack::kITSrefit);
+ fCountITSrefit++;
}
else {
- AliInfo(Form("Refit Failed for track %d",itr));
+ AliDebug(2,Form("Refit Failed for track %d |ESDtrack#%d (MClb:%d)",itr,fCurrESDtrack->GetID(),fCurrESDtrMClb));
}
}
//
+ AliInfo(Form("%d ITSrefit in %d ITSout in %d ITSin tracks for %d tried TPC seeds out of %d ESD tracks\n",
+ fCountITSrefit,fCountITSout,fCountITSin,fCountProlongationTrials,nTrESD));
+ //
+ // AliLog::SetClassDebugLevel("AliITSUTrackerGlo",0);
return 0;
}
//
// for the outermost layer the seed is created from the ESD track
int nSeedsUp = (ilaUp==nLrActive) ? 1 : fCurrHyp->GetNSeeds(ilaUp);
+ int maxNBranches = fCurrTrackCond->GetMaxBranches(ila);
+ int maxNCandidates = fCurrTrackCond->GetMaxCandidates(ila);
//
for (int isd=0;isd<nSeedsUp;isd++) {
AliITSUSeed* seedU;
}
seedUC.ResetFMatrix(); // reset the matrix for propagation to next layer
// go till next active layer
- AliInfo(Form("working on Lr:%d Seed:%d of %d",ila,isd,nSeedsUp));
+ AliDebug(2,Form("working on Lr:%d Seed:%d of %d for esdID=%d (MClb:%d) | pT=%.3f",ila,isd,nSeedsUp,esdID,fCurrESDtrMClb,seedUC.Pt()));
if (!TransportToLayer(&seedUC, fITS->GetLrIDActive(ilaUp), fITS->GetLrIDActive(ila)) ) {
//
- AliInfo("Transport failed");
+ AliDebug(2,Form("Transport failed | esdID=%d (MClb:%d)",esdID,fCurrESDtrMClb));
// Check if the seed satisfies to track definition
if (NeedToKill(&seedUC,kTransportFailed) && seedU) KillSeed(seedU,kTRUE);
continue; // RS TODO: decide what to do with tracks stopped on higher layers w/o killing
continue;
}
int nsens = lrA->FindSensors(&fTrImpData[kTrPhi0], hitSens); // find detectors which may be hit by the track
- AliInfo(Form("Will check %d sensors on lr:%d ",nsens,ila));
+ AliDebug(2,Form("Will check %d sensors on lr:%d | esdID=%d (MClb:%d)",nsens,ila,esdID,fCurrESDtrMClb));
+ //
+ seedUC.SetLr(ila);
//
double bz = GetBz();
for (int isn=nsens;isn--;) {
- seedT = seedUC;
AliITSURecoSens* sens = hitSens[isn];
+ int ncl = sens->GetNClusters();
+ if (!ncl) continue;
+ seedT = seedUC;
//
- // We need to propagate the seed to sensor on lrA staying the frame of the sensor from prev.layer,
+ // We need to propagate the seed to sensor on lrA staying in the frame of the sensor from prev.layer,
// since the transport matrix should be defined in this frame.
double xs; // X in the TF of current seed, corresponding to intersection with sensor plane
- if (!seedT.GetTrackingXAtXAlpha(sens->GetXTF(),sens->GetPhiTF(),bz, xs)) continue;
- if (!PropagateSeed(&seedT,xs,fCurrMass)) continue;
+ if (!seedT.GetTrackingXAtXAlpha(sens->GetXTF(),sens->GetPhiTF(),bz, xs)) {
+ if (AliDebugLevelClass()>2) {
+ printf("Failed on GetTrackingXAtXAlpha: X=%.4f alp=%.3f\n",sens->GetXTF(),sens->GetPhiTF());
+ seedT.Print("etp");
+ }
+ continue;
+ }
+ if (xs<seedT.GetX()) {
+ if (!PropagateSeed(&seedT,xs,fCurrMass)) continue;
+ }
+ else { // some low precision tracks may hit the sensor plane outside of the layer radius
+ if (AliDebugLevelClass()>2) {
+ if (!seedT.ContainsFake()) {
+ printf("WRONG PROP on L%d, sens%d of %d: %.4f > %.4f\n",ila,isn,nsens,xs,seedT.GetX());
+ sens->Print();
+ seedT.Print("etp");
+ }
+ }
+ if (!seedT.PropagateParamOnlyTo(xs,bz)) continue;
+ }
// if (!seedT.PropagateToX(xs,bz)) continue;
// if (!seedT.Rotate(sens->GetPhiTF())) continue;
if (!seedT.RotateToAlpha(sens->GetPhiTF())) continue;
//
int clID0 = sens->GetFirstClusterId();
- for (int icl=sens->GetNClusters();icl--;) {
+ for (int icl=ncl;icl--;) {
+ // AliLog::SetClassDebugLevel("AliITSUTrackerGlo",10);
int res = CheckCluster(&seedT,ila,clID0+icl);
+ // AliLog::SetClassDebugLevel("AliITSUTrackerGlo", 0);
//
if (res==kStopSearchOnSensor) break; // stop looking on this sensor
if (res==kClusterNotMatching) continue; // cluster does not match
// cluster is matching and it was added to the hypotheses tree
}
}
- // cluster search is done. Do we need ta have a version of this seed skipping current layer
- seedT.SetLr(ila);
- if (!NeedToKill(&seedT,kMissingCluster)) {
- AliITSUSeed* seedSkp = NewSeedFromPool(&seedT);
+ // cluster search is done. Do we need to have a version of this seed skipping current layer
+ if (!NeedToKill(&seedUC,kMissingCluster)) {
+ AliITSUSeed* seedSkp = NewSeedFromPool(&seedUC);
double penalty = -AliITSUReconstructor::GetRecoParam()->GetMissPenalty(ila);
// to do: make penalty to account for probability to miss the cluster for good reason
seedSkp->SetChi2Cl(penalty);
AddProlongationHypothesis(seedSkp,ila);
}
+ // transfer the new branches of the seed to the hypothesis container
+ if (fNBranchesAdded) ValidateAllowedBranches(maxNBranches);
+ //
}
- ((TObjArray*)fCurrHyp->GetLayerSeeds(ila))->Sort();
- printf(">>> All hypotheses on lr %d: \n",ila);
+ if (fNCandidatesAdded) ValidateAllowedCandidates(ila,maxNCandidates);
+ // ((TObjArray*)fCurrHyp->GetLayerSeeds(ila))->Sort();
+ if (AliDebugLevelClass()>2) { //RS
+ printf(">>> All hypotheses on lr %d: \n",ila);
+ for (int ih=0;ih<fCurrHyp->GetNSeeds(ila);ih++) {printf(" #%3d ",ih); fCurrHyp->GetSeed(ila,ih)->Print();}
+ }
+ //
+ /*
for (int ih=0;ih<fCurrHyp->GetNSeeds(ila);ih++) {
- printf(" #%3d ",ih); fCurrHyp->GetSeed(ila,ih)->Print();
- //
- /*
if (ila!=0) continue;
double vecL[5] = {0};
double matL[15] = {0};
sp = (AliITSUSeed*)sp->GetParent();
}
*/
- }
}
//
SaveCurrentTrackHypotheses();
fCurrHyp = GetTrackHyp(esdID);
if (fCurrHyp) return kTRUE;
//
+ fCountProlongationTrials++;
+ //
fCurrMass = esdTr->GetMass();
- fCurrESDtrack = esdTr;
if (fCurrMass<kPionMass*0.9) fCurrMass = kPionMass; // don't trust to mu, e identification from TPCin
//
fCurrHyp = new AliITSUTrackHyp(fITS->GetNLayersActive());
//_________________________________________________________________________
Bool_t AliITSUTrackerGlo::TransportToLayer(AliITSUSeed* seed, Int_t lFrom, Int_t lTo)
{
- // transport seed from layerFrom to the entrance of layerTo
+ // transport seed from layerFrom to the entrance (along the direction of the track) of layerTo
//
//
if (lTo==lFrom) AliFatal(Form("was called with lFrom=%d lTo=%d",lFrom,lTo));
Bool_t checkFirst = kTRUE;
while(lFrom!=lTo) {
if (lrFr) {
- if (!GoToExitFromLayer(seed,lrFr,dir,checkFirst)) return kFALSE; // go till the end of current layer
+ if (!GoToExitFromLayer(seed,lrFr,dir,checkFirst)) {
+ //printf("FailHere0 Dir=%d\n",dir);
+ //seed->Print("etp");
+ return kFALSE; // go till the end of current layer
+ }
checkFirst = kFALSE;
}
AliITSURecoLayer* lrTo = fITS->GetLayer( (lFrom+=dir) );
//
// go the entrance of the layer, assuming no materials in between
double xToGo = lrTo->GetR(-dir);
- if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
- if (!PropagateSeed(seed,xToGo,fCurrMass,100, kFALSE )) return kFALSE;
+ // double xts = xToGo;
+ if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) {
+ //printf("FailHere1: %f %f %d\n",xts,xToGo,dir);
+ //seed->Print("etp");
+ //
+
+ return kFALSE;
+ }
+ AliDebug(2,Form("go in dir=%d to R=%.4f(X:%.4f)",dir,lrTo->GetR(-dir), xToGo));
+ if (!PropagateSeed(seed,xToGo,fCurrMass,100, kFALSE )) {
+ //printf("FailHere2: %f %f %d\n",xts,xToGo,dir);
+ //seed->Print("etp");
+ return kFALSE;
+ }
lrFr = lrTo;
}
return kTRUE;
AliITSURecoLayer* lrTo = fITS->GetLayer( (lFrom+=dir) );
if (!lrTo) AliFatal(Form("Layer %d does not exist",lFrom));
//
- if (!GoToExitFromLayer(seed,lrTo,dir)) return kFALSE; // go the entrance of the layer, assuming no materials in between
+ // go the entrance of the layer, assuming no materials in between
+ double xToGo = lrTo->GetR(-dir);
+ // double xts = xToGo;
+ if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) {
+ // printf("FailHere1: %f %f %d\n",xts,xToGo,dir);
+ // seed->Print("etp");
+ return kFALSE;
+ }
+ AliDebug(2,Form("go in dir=%d to R=%.4f(X:%.4f)",dir,lrTo->GetR(-dir), xToGo));
+ if (!PropagateSeed(seed,xToGo,fCurrMass,100, kFALSE )) {
+ //printf("FailHere2: %f %f %d\n",xts,xToGo,dir);
+ //seed->Print("etp");
+ return kFALSE;
+ }
+ lrFr = lrTo;
+ }
+ return kTRUE;
+ //
+}
+
+//_________________________________________________________________________
+Bool_t AliITSUTrackerGlo::TransportToLayerX(AliExternalTrackParam* seed, Int_t lFrom, Int_t lTo, Double_t xStop)
+{
+ // transport track from layerFrom to the entrance of layerTo but do not pass control parameter X
+ //
+ if (lTo==lFrom) AliFatal(Form("was called with lFrom=%d lTo=%d",lFrom,lTo));
+ //
+ int dir = lTo > lFrom ? 1:-1;
+ AliITSURecoLayer* lrFr = fITS->GetLayer(lFrom); // this can be 0 when extrapolation from TPC to ITS is requested
+ Bool_t checkFirst = kTRUE;
+ while(lFrom!=lTo) {
+ if (lrFr) {
+ if (!GoToExitFromLayer(seed,lrFr,dir,checkFirst)) return kFALSE; // go till the end of current layer
+ checkFirst = kFALSE;
+ }
+ AliITSURecoLayer* lrTo = fITS->GetLayer( (lFrom+=dir) );
+ if (!lrTo) AliFatal(Form("Layer %d does not exist",lFrom));
+ //
+ // go the entrance of the layer, assuming no materials in between
+ double xToGo = lrTo->GetR(-dir); // R of the entrance to layer
+ //
+ // double xts = xToGo;
+ if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) {
+ // printf("FailHere1: %f %f %d\n",xts,xToGo,dir);
+ // seed->Print("etp");
+ return kFALSE;
+ }
+ if ( (dir>0&&xToGo>xStop) || (dir<0&&xToGo<xStop) ) xToGo = xStop;
+ //
+ AliDebug(2,Form("go in dir=%d to R=%.4f(X:%.4f)",dir,lrTo->GetR(-dir), xToGo));
+ if (!PropagateSeed(seed,xToGo,fCurrMass,100, kFALSE )) {
+ //printf("FailHere2: %f %f %d\n",xts,xToGo,dir);
+ //seed->Print("etp");
+ return kFALSE;
+ }
lrFr = lrTo;
}
return kTRUE;
double xToGo = lr->GetR(dir);
if (check) { // do we need to track till the surface of the current layer ?
double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
- // AliInfo(Form(" dir:%d Cur: %e Tgt: %e",dir,Sqrt(curR2),xToGo));
- if (dir>0) { if (curR2-xToGo*xToGo>fgkToler) return kTRUE; } // on the surface or outside of the layer
- else if (dir<0) { if (xToGo*xToGo-curR2>fgkToler) return kTRUE; } // on the surface or outside of the layer
+ AliDebug(3,Form(" dir:%d Cur: %e Tgt: %e",dir,Sqrt(curR2),xToGo));
+ if (dir>0) { if (curR2-xToGo*xToGo>-fgkToler) return kTRUE; } // on the surface or outside of the layer
+ else if (dir<0) { if (xToGo*xToGo-curR2>-fgkToler) return kTRUE; } // on the surface or outside of the layer
}
if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
// go via layer to its boundary, applying material correction.
double xToGo = lr->GetR(dir);
if (check) { // do we need to track till the surface of the current layer ?
double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
- if (dir>0) { if (curR2-xToGo*xToGo>fgkToler) return kTRUE; } // on the surface or outside of the layer
- else if (dir<0) { if (xToGo*xToGo-curR2>fgkToler) return kTRUE; } // on the surface or outside of the layer
+ if (dir>0) { if (curR2-xToGo*xToGo>-fgkToler) return kTRUE; } // on the surface or outside of the layer
+ else if (dir<0) { if (xToGo*xToGo-curR2>-fgkToler) return kTRUE; } // on the surface or outside of the layer
}
+ AliDebug(2,Form(" dir=%d : from R=%.4f -> R=%.4f",dir,Sqrt(seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY()), xToGo));
if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
// go via layer to its boundary, applying material correction.
if (!PropagateSeed(seed,xToGo,fCurrMass, lr->GetMaxStep())) return kFALSE;
double xToGo = lr->GetR(-dir);
if (check) { // do we need to track till the surface of the current layer ?
double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
- if (dir>0) { if (curR2-xToGo*xToGo>fgkToler) return kTRUE; } // already passed
- else if (dir<0) { if (xToGo*xToGo-curR2>fgkToler) return kTRUE; } // already passed
+ if (dir>0) { if (curR2-xToGo*xToGo>-fgkToler) return kTRUE; } // already passed
+ else if (dir<0) { if (xToGo*xToGo-curR2>-fgkToler) return kTRUE; } // already passed
}
if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
// go via layer to its boundary, applying material correction.
double xToGo = lr->GetR(-dir);
if (check) { // do we need to track till the surface of the current layer ?
double curR2 = seed->GetX()*seed->GetX() + seed->GetY()*seed->GetY(); // current radius
- if (dir>0) { if (curR2-xToGo*xToGo>fgkToler) return kTRUE; } // already passed
- else if (dir<0) { if (xToGo*xToGo-curR2>fgkToler) return kTRUE; } // already passed
+ if (dir>0) { if (curR2-xToGo*xToGo>-fgkToler) return kTRUE; } // already passed
+ else if (dir<0) { if (xToGo*xToGo-curR2>-fgkToler) return kTRUE; } // already passed
}
if (!seed->GetXatLabR(xToGo,xToGo,GetBz(),dir)) return kFALSE;
// go via layer to its boundary, applying material correction.
double bz = GetBz();
AliITSURecoLayer* lrA = fITS->GetLayerActive(ilrA);
seed->GetXYZ(&fTrImpData[kTrXIn]); // lab position at the entrance from above
- static AliExternalTrackParam sc; // seed copy for manipalitions
+ static AliExternalTrackParam sc; // seed copy for manipulations
sc = *seed;
//
fTrImpData[kTrPhiIn] = ATan2(fTrImpData[kTrYIn],fTrImpData[kTrXIn]);
void AliITSUTrackerGlo::ResetSeedsPool()
{
// mark all seeds in the pool as unused
- AliInfo(Form("CurrentSize: %d, BookedUpTo: %d, free: %d",fSeedsPool.GetSize(),fSeedsPool.GetEntriesFast(),fNFreeSeeds));
+ AliDebug(-1,Form("CurrentSize: %d, BookedUpTo: %d, free: %d",fSeedsPool.GetSize(),fSeedsPool.GetEntriesFast(),fNFreeSeeds));
fNFreeSeeds = 0;
fSeedsPool.Clear(); // seeds don't allocate memory
}
AliCluster *cl = fITS->GetLayerActive(lr)->GetCluster(clID);
//
Bool_t goodCl = kFALSE;
- int currLabel = Abs(fCurrESDtrack->GetTPCLabel());
+ int currLabel = Abs(fCurrESDtrMClb);
//
if (cl->GetLabel(0)>=0) {
for (int i=0;i<3;i++) if (cl->GetLabel(i)>=0 && cl->GetLabel(i)==currLabel) {goodCl = kTRUE; break;}
}
- else goodCl = kTRUE;
+ Bool_t goodSeed = !track->ContainsFake();
//
if (TMath::Abs(cl->GetX())>kTolerX) { // if due to the misalingment X is large, propagate track only
if (!track->PropagateParamOnlyTo(track->GetX()+cl->GetX(),GetBz())) {
- if (goodCl) {printf("Loose good cl: Failed propagation. |"); cl->Print();}
+ if (goodCl&&goodSeed && AliDebugLevelClass()>2 ) {
+ AliDebug(2,Form("Lost good cl on L:%d failed propagation. |ESDtrack#%d (MClb:%d)",lr,fCurrESDtrack->GetID(),fCurrESDtrMClb));
+ track->Print("etp");
+ cl->Print();
+ }
return kStopSearchOnSensor; // propagation failed, seedT is intact
}
}
double dy = cl->GetY()-track->GetY();
double dz = cl->GetZ()-track->GetZ();
//
+#ifdef _FILL_CONTROL_HISTOS_
+ int hcOffs = fTrackPhase*kHistosPhase + lr;
+ double htrPt=-1;
+ if (goodCl&&goodSeed && fCHistoArr /*&& track->GetChi2Penalty()<1e-5*/) {
+ htrPt = track->Pt();
+ ((TH2*)fCHistoArr->At(kHResY+hcOffs))->Fill(htrPt,dy);
+ ((TH2*)fCHistoArr->At(kHResZ+hcOffs))->Fill(htrPt,dz);
+ double errY = track->GetSigmaY2();
+ double errZ = track->GetSigmaZ2();
+ if (errY>0) ((TH2*)fCHistoArr->At(kHResYP+hcOffs))->Fill(htrPt,dy/Sqrt(errY));
+ if (errZ>0) ((TH2*)fCHistoArr->At(kHResZP+hcOffs))->Fill(htrPt,dz/Sqrt(errZ));
+ }
+#endif
+ //
double dy2 = dy*dy;
double tol2 = (track->GetSigmaY2() + AliITSUReconstructor::GetRecoParam()->GetSigmaY2(lr))*
AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY()*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadY(); // RS TOOPTIMIZE
if (dy2>tol2) { // the clusters are sorted in Z(col) then in Y(row).
- if (goodCl) {printf("Loose good cl: dy2=%e > tol2=%e |",dy2,tol2); cl->Print();}
+ if (goodCl&&goodSeed && AliDebugLevelClass()>2) {
+ AliDebug(2,Form("Lost good cl: dy2=%e > tol2=%e |ESDtrack#%d (MClb:%d)",dy2,tol2,fCurrESDtrack->GetID(),fCurrESDtrMClb));
+ track->Print("etp");
+ cl->Print();
+ PrintSeedClusters(track);
+ }
if (dy>0) return kStopSearchOnSensor; // No chance that other cluster of this sensor will match (all Y's will be even larger)
else return kClusterNotMatching; // Other clusters may match
}
tol2 = (track->GetSigmaZ2() + AliITSUReconstructor::GetRecoParam()->GetSigmaZ2(lr))*
AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ()*AliITSUReconstructor::GetRecoParam()->GetNSigmaRoadZ(); // RS TOOPTIMIZE
if (dz2>tol2) {
- if (goodCl) {printf("Loose good cl: dz2=%e > tol2=%e |",dz2,tol2); cl->Print();}
+ if (goodCl&&goodSeed && AliDebugLevelClass()>2) {
+ AliDebug(2,Form("Lost good cl on L:%d : dz2=%e > tol2=%e |ESDtrack#%d (MClb:%d)",lr,dz2,tol2,fCurrESDtrack->GetID(),fCurrESDtrMClb));
+ track->Print("etp");
+ cl->Print();
+ PrintSeedClusters(track);
+ }
return kClusterNotMatching; // Other clusters may match
}
//
Double_t p[2]={cl->GetY(), cl->GetZ()};
Double_t cov[3]={cl->GetSigmaY2(), cl->GetSigmaYZ(), cl->GetSigmaZ2()};
double chi2 = track->GetPredictedChi2(p,cov);
+ //
+#ifdef _FILL_CONTROL_HISTOS_
+ if (htrPt>0) {
+ ((TH2*)fCHistoArr->At(kHChi2Cl+hcOffs))->Fill(htrPt,chi2);
+ }
+#endif
+ //
if (chi2>AliITSUReconstructor::GetRecoParam()->GetMaxTr2ClChi2(lr)) {
- if (goodCl) {
- printf("Loose good cl: Chi2=%e > Chi2Max=%e |dy: %+.3e dz: %+.3e\n",
- chi2,AliITSUReconstructor::GetRecoParam()->GetMaxTr2ClChi2(lr),dy,dz);
+ if (goodCl&&goodSeed && AliDebugLevelClass()>2) {
+ AliDebug(2,Form("Lost good cl on L:%d : Chi2=%e > Chi2Max=%e |dy: %+.3e dz: %+.3e |ESDtrack#%d (MClb:%d)\n",
+ lr,chi2,AliITSUReconstructor::GetRecoParam()->GetMaxTr2ClChi2(lr),dy,dz,fCurrESDtrack->GetID(),fCurrESDtrMClb));
track->Print("etp");
cl->Print("");
+ PrintSeedClusters(track);
}
return kClusterNotMatching;
}
//
track = NewSeedFromPool(track); // input track will be reused, use its clone for updates
if (!track->Update()) {
- if (goodCl) {printf("Loose good cl: Failed update |"); cl->Print();}
+ if (goodCl&&goodSeed && AliDebugLevelClass()>2) {
+ AliDebug(2,Form("Lost good cluster on L:%d : failed to update",lr));
+ track->Print("etp");
+ cl->Print("");
+ PrintSeedClusters(track);
+ }
MarkSeedFree(track);
return kClusterNotMatching;
}
//
track->SetFake(!goodCl);
//
- AliInfo(Form("AddCl(%d) Cl%d lr:%d: dY:%+8.4f dZ:%+8.4f (MC: %5d %5d %5d) |Chi2=%f(%c)",
+ AliDebug(2,Form("AddCl(%d) Cl%d lr:%d: dY:%+8.4f dZ:%+8.4f (MC: %5d %5d %5d) |Chi2=%f(%c)| ",
goodCl,clID,lr,dy,dz2,cl->GetLabel(0),cl->GetLabel(1),cl->GetLabel(2), chi2, track->IsFake() ? '-':'+'));
//
- AddProlongationHypothesis(track,lr);
+ AddSeedBranch(track);
//
return kClusterMatching;
}
Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
Double_t x = xpos+step;
Double_t bz=GetBz(); // getting the local Bz
- if (!seed->PropagateToX(x,bz)) return kFALSE;
+ if (!seed->PropagateToX(x,bz)) return kFALSE;
double ds = 0;
if (matCorr || updTime) {
xyz0[0]=xyz1[0]; // global pos at the beginning of step
MeanMaterialBudget(xyz0,xyz1,param);
Double_t xrho=param[0]*param[4], xx0=param[1];
if (dir>0) xrho = -xrho; // outward should be negative
- if (!seed->ApplyMaterialCorrection(xx0,xrho,mass,kFALSE)) return kFALSE;
+ if (!seed->ApplyMaterialCorrection(xx0,xrho,mass,kFALSE)) {AliInfo("Fail2"); seed->Print("etp"); return kFALSE;}
ds = param[4];
}
else { // matCorr is not requested but time integral is
Int_t dir = (xpos<xToGo) ? 1:-1;
Double_t xyz0[3],xyz1[3],param[7];
//
+ if (AliDebugLevelClass()>1) {
+ AliDebug(2,Form("Before Propagate to X=%f with M=%.3f MaxStep=%.4f MatCorr=%d",xToGo,mass,maxStep,matCorr));
+ seed->AliExternalTrackParam::Print();
+ }
Bool_t updTime = dir>0 && seed->IsStartedTimeIntegral();
if (matCorr || updTime) seed->GetXYZ(xyz1); //starting global position
while ( (xToGo-xpos)*dir > kEpsilon){
//
xpos = seed->GetX();
}
+ if (AliDebugLevelClass()>1) {
+ AliDebug(2,Form("After Propagate to X=%f",xToGo));
+ seed->AliExternalTrackParam::Print();
+ }
return kTRUE;
}
void AliITSUTrackerGlo::SaveCurrentTrackHypotheses()
{
// RS: shall we clean up killed seeds?
+ ((TObjArray*)fCurrHyp->GetLayerSeeds(0))->Sort();
fCurrHyp = 0;
// TODO
void AliITSUTrackerGlo::FinalizeHypotheses()
{
// select winner for each hypothesis, remove cl. sharing conflicts
- AliInfo("TODO");
+ AliDebug(2,"TODO");
//
int nh = fHypStore.GetEntriesFast();
for (int ih=0;ih<nh;ih++) {
AliITSUTrackHyp* hyp = (AliITSUTrackHyp*) fHypStore.UncheckedAt(ih);
if (!hyp || !hyp->DefineWinner()) continue; // TODO
+ if (hyp->GetESDTrack()->IsOn(AliESDtrack::kITSin)) continue;
+ fCountITSin++;
CookMCLabel(hyp);
UpdateESDTrack(hyp,AliESDtrack::kITSin);
}
dir = rCurr<rDest ? 1 : -1;
lrStart = fITS->FindFirstLayerID(rCurr,dir);
lrStop = fITS->FindLastLayerID(rDest,dir);
- printf("Refit %d: Lr:%d (%f) -> Lr:%d (%f)\n",dir,lrStart,rCurr, lrStop,rDest);
- printf("Before refit: "); trc->AliExternalTrackParam::Print();
+ if (AliDebugLevelClass()>2) {
+ printf("Refit %d: Lr:%d (%f) -> Lr:%d (%f)\n",dir,lrStart,rCurr, lrStop,rDest);
+ printf("Before refit: "); trc->AliExternalTrackParam::Print();
+ }
if (lrStop<0 || lrStart<0) AliFatal(Form("Failed to find start(%d) or last(%d) layers. Track from %.3f to %.3f",lrStart,lrStop,rCurr,rDest));
//
int ncl = trc->FetchClusterInfo(fClInfo);
// passive layer or active w/o hits will be traversed on the way to next cluster
if (!lr->IsActive() || fClInfo[ilrA2=(ilrA<<1)]<0) continue;
//
- if (ilr!=lrStart && !TransportToLayer(&tmpTr,lrStart,ilr)) {
- AliInfo(Form("Failed to transport %d -> %d\n",lrStart,ilr));
- return kFALSE; // go to the entrance to the layer
- }
- lrStart = ilr;
- //
// select the order in which possible 2 clusters (in case of the overlap) will be traversed and fitted
nclLr=0;
if (dir>0) { // clusters are stored in increasing radius order
iclLr[nclLr++]=fClInfo[ilrA2];
}
//
+ Bool_t transportedToLayer = kFALSE;
for (int icl=0;icl<nclLr;icl++) {
AliITSUClusterPix* clus = (AliITSUClusterPix*)lr->GetCluster(iclLr[icl]);
AliITSURecoSens* sens = lr->GetSensorFromID(clus->GetVolumeId());
if (!tmpTr.Rotate(sens->GetPhiTF())) {
- AliInfo(Form("Failed on rotate to %f",sens->GetPhiTF()));
+ AliDebug(2,Form("Failed on rotate to %f | ESDtrack#%d (MClb:%d)",sens->GetPhiTF(),fCurrESDtrack->GetID(),fCurrESDtrMClb));
return kFALSE;
}
- //printf("Refit cl:%d on lr %d Need to go %.4f -> %.4f\n",icl,ilrA,tmpTr.GetX(),sens->GetXTF()+clus->GetX());
- if (!PropagateSeed(&tmpTr,sens->GetXTF()+clus->GetX(),fCurrMass)) {
- AliInfo(Form("Failed on propagate to %f",sens->GetXTF()+clus->GetX()));
+ //
+ double xClus = sens->GetXTF()+clus->GetX();
+ if (!transportedToLayer) {
+ if (ilr!=lrStart && !TransportToLayerX(&tmpTr,lrStart,ilr,xClus)) {
+ AliDebug(2,Form("Failed to transport %d -> %d | ESDtrack#%d (MClb:%d)\n",lrStart,ilr,fCurrESDtrack->GetID(),fCurrESDtrMClb));
+ //tmpTr.AliExternalTrackParam::Print(); trc->GetWinner()->Print("etp");
+ return kFALSE; // go to the entrance to the layer
+ }
+ lrStart = ilr;
+ transportedToLayer = kTRUE;
+ }
+ //
+ if (AliDebugLevelClass()>1) {
+ AliDebug(2,Form("Propagate to cl:%d on lr %d Need to go %.4f -> %.4f",icl,ilrA,tmpTr.GetX(),xClus));
+ // printf("Before: "); tmpTr.AliExternalTrackParam::Print();
+ }
+ //
+ if (!PropagateSeed(&tmpTr,xClus,fCurrMass)) {
+ AliDebug(2,Form("Failed on propagate to %f (dir=%d) | ESDtrack#%d (MClb:%d)",xClus,dir,fCurrESDtrack->GetID(),fCurrESDtrMClb));
+ //tmpTr.AliExternalTrackParam::Print(""); trc->GetWinner()->Print("etp");
return kFALSE;
}
- if (!tmpTr.Update(clus)) {
- AliInfo(Form("Failed on Update"));
+ //
+#ifdef _FILL_CONTROL_HISTOS_
+ int hcOffs = fTrackPhase*kHistosPhase + ilrA;
+ double htrPt=-1;
+ if (fCHistoArr && trc->GetLabel()>=0/* && trc->Charge()>0*/) {
+ htrPt = tmpTr.Pt();
+ double dy = clus->GetY()-tmpTr.GetY();
+ double dz = clus->GetZ()-tmpTr.GetZ();
+ ((TH2*)fCHistoArr->At(kHResY+hcOffs))->Fill(htrPt,dy);
+ ((TH2*)fCHistoArr->At(kHResZ+hcOffs))->Fill(htrPt,dz);
+ double errY = tmpTr.GetSigmaY2();
+ double errZ = tmpTr.GetSigmaZ2();
+ if (errY>0) ((TH2*)fCHistoArr->At(kHResYP+hcOffs))->Fill(htrPt,dy/Sqrt(errY));
+ if (errZ>0) ((TH2*)fCHistoArr->At(kHResZP+hcOffs))->Fill(htrPt,dz/Sqrt(errZ));
+ }
+#endif
+ //
+ double chi2;
+ if ( (chi2=tmpTr.Update(clus))<0 ) {
+ AliDebug(2,Form("Failed on Update | ESDtrack#%d (MClb:%d)",fCurrESDtrack->GetID(),fCurrESDtrMClb));
return kFALSE;
}
- //printf("AfterRefit: "); tmpTr.AliExternalTrackParam::Print();
+#ifdef _FILL_CONTROL_HISTOS_
+ if (htrPt>0) {
+ ((TH2*)fCHistoArr->At(kHChi2Cl+hcOffs))->Fill(htrPt,chi2);
+ }
+#endif
+ if (AliDebugLevelClass()>1) {
+ printf("AfterRefit: "); tmpTr.AliExternalTrackParam::Print();
+ }
if (stopAtLastCl && ++clCount==ncl) return kTRUE; // it was requested to not propagate after last update
}
//
if (lrStart!=lrStop) {
//printf("Going to last layer %d -> %d\n",lrStart,lrStop);
if (!TransportToLayer(&tmpTr,lrStart,lrStop)) {
- AliInfo(Form("Failed on TransportToLayer %d->%d",lrStart,lrStop));
+ AliDebug(1,Form("Failed on TransportToLayer %d->%d | ESDtrack#%d (MClb:%d)",lrStart,lrStop,fCurrESDtrack->GetID(),fCurrESDtrMClb));
+ //tmpTr.AliExternalTrackParam::Print();
+ //trc->GetWinner()->Print("etp");
return kTRUE;
}
if (!GoToExitFromLayer(&tmpTr,fITS->GetLayer(lrStop),dir)) {
- AliFatal(Form("Failed on GoToExitFromLayer %d",lrStop));
+ AliDebug(3,Form("Failed on GoToExitFromLayer %d | ESDtrack#%d (MClb:%d)",lrStop,fCurrESDtrack->GetID(),fCurrESDtrMClb));
return kTRUE; // go till the exit from layer
}
//
//printf("On exit from last layer\n");
- tmpTr.AliExternalTrackParam::Print();
+ //tmpTr.AliExternalTrackParam::Print();
// go to the destination radius
if (!tmpTr.GetXatLabR(rDest,rDest,GetBz(),dir)) return kTRUE;
if (!PropagateSeed(&tmpTr,rDest,fCurrMass, 100, kFALSE)) return kTRUE;
}
trc->AliKalmanTrack::operator=(tmpTr);
- printf("After refit (now at lr %d): ",lrStart); trc->AliExternalTrackParam::Print();
+ if (AliDebugLevelClass()>2) {
+ printf("After refit (now at lr %d): ",lrStop); trc->AliExternalTrackParam::Print();
+ }
return kTRUE;
}
hyp->SetLabel( kDummyLabel );
hyp->SetITSLabel( kDummyLabel );
}
+
+//__________________________________________________________________
+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;
+ }
+ AliITSUSeed** branches = &fLayerCandidates[fNCandidatesAdded]; // note: fNCandidatesAdded is incremented after adding all branches of current seed
+ int slot=fNBranchesAdded++;
+ for (int slotF=slot;slotF--;) { // slotF is always slot-1
+ AliITSUSeed* si = branches[slotF];
+ if (si->Compare(seed)<0) break; // found the last seed with better quality
+ // otherwise, shift the worse seed to the next slot
+ branches[slot] = si;
+ slot = slotF; // slot should be slotF+1
+ }
+ // if needed, move worse seeds
+ branches[slot] = seed;
+ return kTRUE;
+ //
+}
+
+//__________________________________________________________________
+void AliITSUTrackerGlo::ValidateAllowedBranches(Int_t acceptMax)
+{
+ // keep allowed number of branches for current seed and disable extras
+ int nb = Min(fNBranchesAdded,acceptMax);
+ // if (nb<fNBranchesAdded) printf("ValidateAllowedBranches: %d of %d (%d) on lr %d\n",nb,fNBranchesAdded,fNCandidatesAdded,ilr);
+ // disable unused branches
+ AliITSUSeed** branches = &fLayerCandidates[fNCandidatesAdded];
+ for (int ib=nb;ib<fNBranchesAdded;ib++) {
+ /*
+ if (!branches[ib]->ContainsFake()) {
+ printf("Suppress good branch as %d of %d |",ib,fNBranchesAdded); branches[ib]->Print();
+ printf("Survivors : \n");
+ for (int j=0;j<nb;j++) branches[j]->Print();
+ }
+ */
+ MarkSeedFree(branches[ib]);
+ }
+ fNCandidatesAdded += nb; // update total candidates counter
+ fNBranchesAdded = 0; // reset branches counter
+ //
+}
+
+//__________________________________________________________________
+void AliITSUTrackerGlo::ValidateAllowedCandidates(Int_t ilr, Int_t acceptMax)
+{
+ // 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];
+ for (int i=fNCandidatesAdded;i--;) chi2[i] = fLayerCandidates[i]->GetChi2GloNrm();
+ Sort(fNCandidatesAdded,chi2,index,kFALSE);
+ //
+ int nb = Min(fNCandidatesAdded,acceptMax);
+ // if (nb<fNCandidatesAdded) printf("ValidateAllowedCandidates: %d of %d on lr %d\n",nb,fNCandidatesAdded,ilr);
+ //
+ for (int ib=0;ib<nb;ib++) AddProlongationHypothesis(fLayerCandidates[index[ib]],ilr);
+ // disable unused candidates
+ for (int ib=nb;ib<fNCandidatesAdded;ib++) {
+ /*
+ if (!fLayerCandidates[index[ib]]->ContainsFake()) {
+ printf("Suppress good candidate as %d of %d |",index[ib],fNCandidatesAdded); fLayerCandidates[index[ib]]->Print();
+ }
+ */
+ MarkSeedFree(fLayerCandidates[index[ib]]);
+ }
+ fNCandidatesAdded = 0; // reset candidates counter
+ //
+}
+
+//__________________________________________________________________
+void AliITSUTrackerGlo::FlagSplitClusters()
+{
+ // set special bit on split clusters using MC info
+ for (int ilr=fITS->GetNLayersActive();ilr--;) {
+ int nsplit=0;
+ AliITSURecoLayer* lr = fITS->GetLayerActive(ilr);
+ for (int isn=lr->GetNSensors();isn--;) {
+ AliITSURecoSens* sens = lr->GetSensor(isn);
+ int nCl = sens->GetNClusters();
+ if (!nCl) continue;
+ int cl0 = sens->GetFirstClusterId();
+ for (int icl=nCl;icl--;) {
+ AliITSUClusterPix *cl = (AliITSUClusterPix*)lr->GetCluster(cl0+icl);
+ for (int icl1=icl;icl1--;) {
+ AliITSUClusterPix *cl1 = (AliITSUClusterPix*)lr->GetCluster(cl0+icl1);
+ if (cl->HasCommonTrack(cl1)) {
+ if (!cl->IsSplit()) nsplit++;
+ if (!cl1->IsSplit()) nsplit++;
+ cl->SetSplit();
+ cl1->SetSplit();
+ }
+ }
+ }
+ }
+ AliInfo(Form("%4d out of %4d clusters are split",nsplit,lr->GetNClusters()));
+ }
+ //
+}
+
+//__________________________________________________________________
+Bool_t AliITSUTrackerGlo::ContainsSplitCluster(const AliITSUSeed* seed, Int_t maxSize)
+{
+ // check if the seed contains split cluster with size < maxSize
+ int lrID,clID;
+ if ( (clID=seed->GetLrCluster(lrID))>=0 ) {
+ AliITSUClusterPix* cl = (AliITSUClusterPix*)fITS->GetLayerActive(lrID)->GetCluster(clID);
+ if (cl->IsSplit() && cl->GetNPix()<maxSize ) return kTRUE;
+ }
+ return seed->GetParent() ? ContainsSplitCluster((AliITSUSeed*)seed->GetParent(),maxSize) : kFALSE;
+ //
+}
+
+//__________________________________________________________________
+void AliITSUTrackerGlo::PrintSeedClusters(const AliITSUSeed* seed, Option_t* option)
+{
+ // print seeds clusters
+ int lrID,clID;
+ if ( (clID=seed->GetLrCluster(lrID))>=0 ) {
+ AliITSUClusterPix* cl = (AliITSUClusterPix*)fITS->GetLayerActive(lrID)->GetCluster(clID);
+ cl->Print(option);
+ }
+ if (seed->GetParent()) PrintSeedClusters((AliITSUSeed*)seed->GetParent(), option);
+ //
+}
+
+#ifdef _FILL_CONTROL_HISTOS_
+//__________________________________________________________________
+void AliITSUTrackerGlo::BookControlHistos()
+{
+ // book special control histos
+ if (!fCHistoArr) { // create control histos
+ const int kNResDef=7;
+ const double kResDef[kNResDef]={0.05,0.05,0.3, 0.05,1,0.5,1.5};
+ fCHistoArr = new TObjArray();
+ fCHistoArr->SetOwner(kTRUE);
+ const double ptMax=10;
+ const double plMax=10;
+ const double chiMax=100;
+ const int nptbins=50;
+ const int nresbins=400;
+ const int nplbins=50;
+ const int nchbins=200;
+ int nblr = fITS->GetNLayersActive();
+ TString ttl;
+ for (int stp=0;stp<kNTrackingPhases;stp++) {
+ for (int ilr=0;ilr<nblr;ilr++) {
+ int hoffs = stp*kHistosPhase + ilr;
+ double mxdf = ilr>=kNResDef ? kResDef[kNResDef-1] : kResDef[ilr];
+ ttl = Form("S%d_residY%d",stp,ilr);
+ TH2F* hdy = new TH2F(ttl.Data(),ttl.Data(),nptbins,0,ptMax,nresbins,-mxdf,mxdf);
+ fCHistoArr->AddAtAndExpand(hdy,hoffs + kHResY);
+ hdy->SetDirectory(0);
+ //
+ ttl = Form("S%d_residYPull%d",stp,ilr);
+ TH2F* hdyp = new TH2F(ttl.Data(),ttl.Data(),nptbins,0,ptMax,nplbins,-plMax,plMax);
+ fCHistoArr->AddAtAndExpand(hdyp,hoffs + kHResYP);
+ hdyp->SetDirectory(0);
+ //
+ ttl = Form("S%d_residZ%d",stp,ilr);
+ TH2F* hdz = new TH2F(ttl.Data(),ttl.Data(),nptbins,0,ptMax,nresbins,-mxdf,mxdf);
+ fCHistoArr->AddAtAndExpand(hdz,hoffs + kHResZ);
+ hdz->SetDirectory(0);
+ //
+ ttl = Form("S%d_residZPull%d",stp,ilr);
+ TH2F* hdzp = new TH2F(ttl.Data(),ttl.Data(),nptbins,0,ptMax,nplbins,-plMax,plMax);
+ hdzp->SetDirectory(0);
+ fCHistoArr->AddAtAndExpand(hdzp,hoffs + kHResZP);
+ //
+ ttl = Form("S%d_chi2Cl%d",stp,ilr);
+ TH2F* hchi = new TH2F(ttl.Data(),ttl.Data(),nptbins,0,ptMax, nchbins,0.,chiMax);
+ hchi->SetDirectory(0);
+ fCHistoArr->AddAtAndExpand(hchi,hoffs + kHChi2Cl);
+ }
+ }
+ }
+ //
+}
+#endif