#include <TString.h>
#include <TRandom.h>
#include <TTreeStream.h>
+#include <TVector3.h>
#include "AliLog.h"
+#include "AliGeomManager.h"
#include "AliITSPlaneEff.h"
-#include "AliITSCalibrationSPD.h"
-#include "AliITSCalibrationSDD.h"
-#include "AliITSCalibrationSSD.h"
-#include "AliCDBEntry.h"
-#include "AliCDBManager.h"
-#include "AliAlignObj.h"
#include "AliTrackPointArray.h"
-#include "AliESDVertex.h"
#include "AliESDEvent.h"
#include "AliESDtrack.h"
#include "AliV0.h"
-#include "AliHelix.h"
#include "AliITSChannelStatus.h"
#include "AliITSDetTypeRec.h"
#include "AliITSRecPoint.h"
+#include "AliITSRecPointContainer.h"
#include "AliITSgeomTGeo.h"
#include "AliITSReconstructor.h"
#include "AliITSClusterParam.h"
#include "AliITSPlaneEffSSD.h"
#include "AliITSV0Finder.h"
#include "AliITStrackerMI.h"
+#include "AliMathBase.h"
ClassImp(AliITStrackerMI)
//Default constructor
Int_t i;
for(i=0;i<4;i++) fSPDdetzcentre[i]=0.;
- for(i=0;i<2;i++) {fxOverX0Shield[i]=-1.;fxTimesRhoShield[i]=-1.;}
+ for(i=0;i<2;i++) {
+ fxOverX0Shield[i]=-1.;
+ fxTimesRhoShield[i]=-1.;
+ fConstraint[i]=0;
+ }
for(i=0;i<6;i++) {fxOverX0Layer[i]=-1.;fxTimesRhoLayer[i]=-1.;}
+ fOriginal.SetOwner();
+ for(i=0;i<AliITSgeomTGeo::kNLayers;i++)fForceSkippingOfLayer[i]=0;
+ for(i=0;i<100000;i++)fBestTrackIndex[i]=0;
+
}
//------------------------------------------------------------------------
AliITStrackerMI::AliITStrackerMI(const Char_t *geom) : AliTracker(),
AliWarning("\"geom\" is actually a dummy argument !");
}
+ fOriginal.SetOwner();
fCoefficients = 0;
fAfterV0 = kFALSE;
Int_t ndet=AliITSgeomTGeo::GetNDetectors(i);
Double_t xyz[3], &x=xyz[0], &y=xyz[1], &z=xyz[2];
- AliITSgeomTGeo::GetOrigTranslation(i,1,1,xyz);
+ AliITSgeomTGeo::GetTranslation(i,1,1,xyz);
Double_t poff=TMath::ATan2(y,x);
Double_t zoff=z;
+
+ AliITSgeomTGeo::GetOrigTranslation(i,1,1,xyz);
Double_t r=TMath::Sqrt(x*x + y*y);
AliITSgeomTGeo::GetOrigTranslation(i,1,2,xyz);
} // end loop on detectors
} // end loop on ladders
- fForceSkippingOfLayer[i] = 0;
+ fForceSkippingOfLayer[i-1] = 0;
} // end loop on layers
}
// store positions of centre of SPD modules (in z)
+ // The convetion is that fSPDdetzcentre is ordered from -z to +z
Double_t tr[3];
AliITSgeomTGeo::GetTranslation(1,1,1,tr);
- fSPDdetzcentre[0] = tr[2];
- AliITSgeomTGeo::GetTranslation(1,1,2,tr);
- fSPDdetzcentre[1] = tr[2];
- AliITSgeomTGeo::GetTranslation(1,1,3,tr);
- fSPDdetzcentre[2] = tr[2];
- AliITSgeomTGeo::GetTranslation(1,1,4,tr);
- fSPDdetzcentre[3] = tr[2];
+ if (tr[2]<0) { // old geom (up to v5asymmPPR)
+ AliITSgeomTGeo::GetTranslation(1,1,1,tr);
+ fSPDdetzcentre[0] = tr[2];
+ AliITSgeomTGeo::GetTranslation(1,1,2,tr);
+ fSPDdetzcentre[1] = tr[2];
+ AliITSgeomTGeo::GetTranslation(1,1,3,tr);
+ fSPDdetzcentre[2] = tr[2];
+ AliITSgeomTGeo::GetTranslation(1,1,4,tr);
+ fSPDdetzcentre[3] = tr[2];
+ } else { // new geom (from v11Hybrid)
+ AliITSgeomTGeo::GetTranslation(1,1,4,tr);
+ fSPDdetzcentre[0] = tr[2];
+ AliITSgeomTGeo::GetTranslation(1,1,3,tr);
+ fSPDdetzcentre[1] = tr[2];
+ AliITSgeomTGeo::GetTranslation(1,1,2,tr);
+ fSPDdetzcentre[2] = tr[2];
+ AliITSgeomTGeo::GetTranslation(1,1,1,tr);
+ fSPDdetzcentre[3] = tr[2];
+ }
fUseTGeo = AliITSReconstructor::GetRecoParam()->GetUseTGeoInTracker();
if(AliITSReconstructor::GetRecoParam()->GetExtendedEtaAcceptance() && fUseTGeo!=1 && fUseTGeo!=3) {
for(Int_t i=0;i<2;i++) {fxOverX0Shield[i]=-1.;fxTimesRhoShield[i]=-1.;}
for(Int_t i=0;i<6;i++) {fxOverX0Layer[i]=-1.;fxTimesRhoLayer[i]=-1.;}
- fDebugStreamer = new TTreeSRedirector("ITSdebug.root");
+ if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0)
+ fDebugStreamer = new TTreeSRedirector("ITSdebug.root");
// only for plane efficiency evaluation
if (AliITSReconstructor::GetRecoParam()->GetComputePlaneEff() &&
if(AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) fPlaneEff->SetCreateHistos(kTRUE);
}
}
+/*
//------------------------------------------------------------------------
AliITStrackerMI::AliITStrackerMI(const AliITStrackerMI &tracker):AliTracker(tracker),
fI(tracker.fI),
fkDetTypeRec(tracker.fkDetTypeRec),
fPlaneEff(tracker.fPlaneEff) {
//Copy constructor
+ fOriginal.SetOwner();
Int_t i;
for(i=0;i<4;i++) {
fSPDdetzcentre[i]=tracker.fSPDdetzcentre[i];
fxTimesRhoShield[i]=tracker.fxTimesRhoShield[i];
}
}
+
//------------------------------------------------------------------------
AliITStrackerMI & AliITStrackerMI::operator=(const AliITStrackerMI &tracker){
//Assignment operator
new(this) AliITStrackerMI(tracker);
return *this;
}
+*/
//------------------------------------------------------------------------
AliITStrackerMI::~AliITStrackerMI()
{
if(det.IsBad()) {nBadDetsPerLayer++;}
} // end loop on detectors
} // end loop on ladders
- Info("ReadBadFromDetTypeRec",Form("Layer %d: %d bad out of %d",i-1,nBadDetsPerLayer,ndet*AliITSgeomTGeo::GetNLadders(i)));
+ AliInfo(Form("Layer %d: %d bad out of %d",i-1,nBadDetsPerLayer,ndet*AliITSgeomTGeo::GetNLadders(i)));
} // end loop on layers
return;
//--------------------------------------------------------------------
//This function loads ITS clusters
//--------------------------------------------------------------------
- TBranch *branch=cTree->GetBranch("ITSRecPoints");
- if (!branch) {
- Error("LoadClusters"," can't get the branch !\n");
- return 1;
- }
-
- static TClonesArray dummy("AliITSRecPoint",10000), *clusters=&dummy;
- branch->SetAddress(&clusters);
+
+ TClonesArray *clusters = NULL;
+ AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
+ clusters=rpcont->FetchClusters(0,cTree);
+ if(!clusters) return 1;
+ if(!(rpcont->IsSPDActive() || rpcont->IsSDDActive() || rpcont->IsSSDActive())){
+ AliError("ITS is not in a known running configuration: SPD, SDD and SSD are not active");
+ return 1;
+ }
Int_t i=0,j=0,ndet=0;
Int_t detector=0;
for (i=0; i<AliITSgeomTGeo::GetNLayers(); i++) {
ndet=fgLayers[i].GetNdetectors();
Int_t jmax = j + fgLayers[i].GetNladders()*ndet;
for (; j<jmax; j++) {
- if (!cTree->GetEvent(j)) continue;
+ // if (!cTree->GetEvent(j)) continue;
+ clusters = rpcont->UncheckedGetClusters(j);
+ if(!clusters)continue;
Int_t ncl=clusters->GetEntriesFast();
SignDeltas(clusters,GetZ());
detector=c->GetDetectorIndex();
if (!c->Misalign()) AliWarning("Can't misalign this cluster !");
-
- fgLayers[i].InsertCluster(new AliITSRecPoint(*c));
+
+ Int_t retval = fgLayers[i].InsertCluster(new AliITSRecPoint(*c));
+ if(retval) {
+ AliWarning(Form("Too many clusters on layer %d!",i));
+ break;
+ }
}
- clusters->Clear();
+
// add dead zone "virtual" cluster in SPD, if there is a cluster within
// zwindow cm from the dead zone
+ // This method assumes that fSPDdetzcentre is ordered from -z to +z
if (i<2 && AliITSReconstructor::GetRecoParam()->GetAddVirtualClustersInDeadZone()) {
for (Float_t xdead = 0; xdead < AliITSRecoParam::GetSPDdetxlength(); xdead += (i+1.)*AliITSReconstructor::GetRecoParam()->GetXPassDeadZoneHits()) {
Int_t lab[4] = {0,0,0,detector};
Int_t info[3] = {0,0,i};
Float_t q = 0.; // this identifies virtual clusters
- Float_t hit[5] = {xdead,
+ Float_t hit[6] = {xdead,
0.,
AliITSReconstructor::GetRecoParam()->GetSigmaXDeadZoneHit2(),
AliITSReconstructor::GetRecoParam()->GetSigmaZDeadZoneHit2(),
- q};
+ q,
+ 0.};
Bool_t local = kTRUE;
Double_t zwindow = AliITSReconstructor::GetRecoParam()->GetZWindowDeadZone();
hit[1] = fSPDdetzcentre[0]+0.5*AliITSRecoParam::GetSPDdetzlength();
}
}
// temporary
-
+ Int_t noesd = 0;
{/* Read ESD tracks */
Double_t pimass = TDatabasePDG::Instance()->GetParticle(211)->Mass();
Int_t nentr=event->GetNumberOfTracks();
- Info("Clusters2Tracks", "Number of ESD tracks: %d\n", nentr);
+ noesd=nentr;
+ // Info("Clusters2Tracks", "Number of ESD tracks: %d\n", nentr);
while (nentr--) {
AliESDtrack *esd=event->GetTrack(nentr);
// ---- for debugging:
if (esd->GetStatus()&AliESDtrack::kTPCout) continue;
if (esd->GetStatus()&AliESDtrack::kITSin) continue;
if (esd->GetKinkIndex(0)>0) continue; //kink daughter
- AliITStrackMI *t=0;
- try {
- t=new AliITStrackMI(*esd);
- } catch (const Char_t *msg) {
- //Warning("Clusters2Tracks",msg);
- delete t;
- continue;
- }
+ AliITStrackMI *t = new AliITStrackMI(*esd);
t->GetDZ(GetX(),GetY(),GetZ(),t->GetDP()); //I.B.
Double_t vdist = TMath::Sqrt(t->GetD(0)*t->GetD(0)+t->GetD(1)*t->GetD(1));
if(AliITSReconstructor::GetRecoParam()->GetFindV0s()) AliITSV0Finder::FindV02(event,this);
fAfterV0 = kTRUE;
//
- itsTracks.Delete();
+ itsTracks.Clear();
//
Int_t entries = fTrackHypothesys.GetEntriesFast();
for (Int_t ientry=0; ientry<entries; ientry++) {
}
fTrackHypothesys.Delete();
+ entries = fBestHypothesys.GetEntriesFast();
+ for (Int_t ientry=0; ientry<entries; ientry++) {
+ TObjArray * array =(TObjArray*)fBestHypothesys.UncheckedAt(ientry);
+ if (array) array->Delete();
+ delete fBestHypothesys.RemoveAt(ientry);
+ }
fBestHypothesys.Delete();
fOriginal.Clear();
delete [] fCoefficients;
fCoefficients=0;
DeleteTrksMaterialLUT();
- Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk);
+ AliInfo(Form("Number of prolonged tracks: %d out of %d ESD tracks",ntrk,noesd));
fTrackingPhase="Default";
//--------------------------------------------------------------------
fTrackingPhase="PropagateBack";
Int_t nentr=event->GetNumberOfTracks();
- Info("PropagateBack", "Number of ESD tracks: %d\n", nentr);
+ // Info("PropagateBack", "Number of ESD tracks: %d\n", nentr);
Int_t ntrk=0;
for (Int_t i=0; i<nentr; i++) {
if ((esd->GetStatus()&AliESDtrack::kITSin)==0) continue;
if (esd->GetStatus()&AliESDtrack::kITSout) continue;
- AliITStrackMI *t=0;
- try {
- t=new AliITStrackMI(*esd);
- } catch (const Char_t *msg) {
- //Warning("PropagateBack",msg);
- delete t;
- continue;
- }
+ AliITStrackMI *t = new AliITStrackMI(*esd);
+
t->SetExpQ(TMath::Max(0.8*t->GetESDtrack()->GetTPCsignal(),30.));
ResetTrackToFollow(*t);
delete t;
}
- Info("PropagateBack","Number of back propagated ITS tracks: %d\n",ntrk);
+ AliInfo(Form("Number of back propagated ITS tracks: %d out of %d ESD tracks",ntrk,nentr));
fTrackingPhase="Default";
if(AliITSReconstructor::GetRecoParam()->GetFindV0s()) AliITSV0Finder::RefitV02(event,this);
+ Bool_t doExtra=AliITSReconstructor::GetRecoParam()->GetSearchForExtraClusters();
+ if(!doExtra) AliDebug(2,"Do not search for extra clusters");
+
Int_t nentr=event->GetNumberOfTracks();
- Info("RefitInward", "Number of ESD tracks: %d\n", nentr);
+ // Info("RefitInward", "Number of ESD tracks: %d\n", nentr);
Int_t ntrk=0;
for (Int_t i=0; i<nentr; i++) {
if (esd->GetStatus()&AliESDtrack::kTPCout)
if ((esd->GetStatus()&AliESDtrack::kTPCrefit)==0) continue;
- AliITStrackMI *t=0;
- try {
- t=new AliITStrackMI(*esd);
- } catch (const Char_t *msg) {
- //Warning("RefitInward",msg);
- delete t;
- continue;
- }
+ AliITStrackMI *t = new AliITStrackMI(*esd);
+
t->SetExpQ(TMath::Max(0.8*t->GetESDtrack()->GetTPCsignal(),30.));
if (!CorrectForTPCtoITSDeadZoneMaterial(t)) {
delete t;
ResetTrackToFollow(*t);
fTrackToFollow.ResetClusters();
- if ((esd->GetStatus()&AliESDtrack::kTPCin)==0)
+ // ITS standalone tracks
+ if ((esd->GetStatus()&AliESDtrack::kTPCin)==0) {
fTrackToFollow.ResetCovariance(10.);
+ // protection for loopers that can have parameters screwed up
+ if(TMath::Abs(fTrackToFollow.GetY())>1000. ||
+ TMath::Abs(fTrackToFollow.GetZ())>1000.) {
+ delete t;
+ continue;
+ }
+ }
//Refitting...
Bool_t pe=(AliITSReconstructor::GetRecoParam()->GetComputePlaneEff() &&
AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff()>=0);
AliDebug(2,Form("Refit LABEL %d %d",t->GetLabel(),t->GetNumberOfClusters()));
- if (RefitAt(AliITSRecoParam::GetrInsideSPD1(),&fTrackToFollow,t,kTRUE,pe)) {
+ if (RefitAt(AliITSRecoParam::GetrInsideSPD1(),&fTrackToFollow,t,doExtra,pe)) {
AliDebug(2," refit OK");
fTrackToFollow.SetLabel(t->GetLabel());
// fTrackToFollow.CookdEdx();
delete t;
}
- Info("RefitInward","Number of refitted tracks: %d\n",ntrk);
+ AliInfo(Form("Number of refitted tracks: %d out of %d ESD tracks",ntrk,nentr));
fTrackingPhase="Default";
detxy[1] = det.GetR()*TMath::Sin(det.GetPhi());
Double_t alpha = t->GetAlpha();
Double_t xdetintrackframe = detxy[0]*TMath::Cos(alpha)+detxy[1]*TMath::Sin(alpha);
- Float_t phi = TMath::ASin(t->GetSnpAt(xdetintrackframe,GetBz()));
+ Float_t phi = TMath::ASin(t->GetSnpAt(xdetintrackframe+cl->GetX(),GetBz()));
phi += alpha-det.GetPhi();
Float_t tgphi = TMath::Tan(phi);
TObjArray *bestarray = (TObjArray*)fBestHypothesys.At(esdindex);
if (!bestarray){
bestarray = new TObjArray(5);
+ bestarray->SetOwner();
fBestHypothesys.AddAt(bestarray,esdindex);
}
if(LocalModuleCoord(ilayer,idet,vtrack,xloc,zloc)) { // local module coords
vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc);
}
- if(constrain) vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+ if(constrain && AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
ntracks[ilayer]++;
continue;
}
TMath::Abs(updatetrack->GetD(1)/(1.+ilayer)) > // z
AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk()) isPrim=kFALSE;
}
- if (isPrim) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+ if (isPrim && AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
}
updatetrack->SetNDeadZone(updatetrack->GetNDeadZone()+1);
if (dead) {
while ((cl=layer.GetNextCluster(clidx))!=0) {
if (ntracks[ilayer]>95) break; //space for skipped clusters
Bool_t changedet =kFALSE;
- if (cl->GetQ()==0 && deadzoneSPD==kTRUE) continue;
+ if (TMath::Abs(cl->GetQ())<1.e-13 && deadzoneSPD==kTRUE) continue;
Int_t idetc=cl->GetDetectorIndex();
if (currenttrack->GetDetectorIndex()==idetc) { // track already on the cluster's detector
(currenttrack->GetY()-cl->GetY())*(currenttrack->GetY()-cl->GetY())*msy > 1. )
{ // cluster not associated to track
AliDebug(2,"not associated");
+ // MvL: added here as well
+ // bring track back to ideal detector plane
+ currenttrack->Propagate(xTrOrig);
continue;
}
// bring track back to ideal detector plane
// chi2 cut
AliDebug(2,Form("chi2 %f max %f",chi2trkcl,AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)));
if (chi2trkcl < AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)) {
- if (cl->GetQ()==0) deadzoneSPD=kTRUE; // only 1 prolongation with virtual cluster
+ if (TMath::Abs(cl->GetQ())<1.e-13) deadzoneSPD=kTRUE; // only 1 prolongation with virtual cluster
if (ntracks[ilayer]>=100) continue;
AliITStrackMI * updatetrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(*currenttrack);
updatetrack->SetClIndex(ilayer,-1);
if (changedet) new (¤ttrack2) AliITStrackMI(backuptrack);
- if (cl->GetQ()!=0) { // real cluster
+ if (TMath::Abs(cl->GetQ())>1.e-13) { // real cluster
if (!UpdateMI(updatetrack,cl,chi2trkcl,(ilayer<<28)+clidx)) {
AliDebug(2,"update failed");
continue;
TMath::Abs(updatetrack->GetD(1)/(1.+ilayer)) > // z
AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk()) isPrim=kFALSE;
}
- if (isPrim) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+ if (isPrim && AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
} //apply vertex constrain
ntracks[ilayer]++;
} // create new hypothesis
} // loop over possible prolongations
// allow one prolongation without clusters
- if (constrain && itrack<=1 && currenttrack1.GetNSkipped()==0 && deadzoneSPD==kFALSE && ntracks[ilayer]<100) {
+ if (constrain && itrack<=1 && TMath::Abs(currenttrack1.GetNSkipped())<1.e-13 && deadzoneSPD==kFALSE && ntracks[ilayer]<100) {
AliITStrackMI* vtrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(currenttrack1);
// apply correction for material of the current layer
CorrectForLayerMaterial(vtrack,ilayer,trackGlobXYZ1,"inward");
vtrack->SetClIndex(ilayer,-1);
modstatus = 3; // skipped
vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc);
- vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+ if(AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
vtrack->IncrementNSkipped();
ntracks[ilayer]++;
}
-
- // allow one prolongation without clusters for tracks with |tgl|>1.1
- if (constrain && itrack==0 && TMath::Abs(currenttrack1.GetTgl())>1.1) { //big theta - for low flux
- AliITStrackMI* vtrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(currenttrack1);
- // apply correction for material of the current layer
- CorrectForLayerMaterial(vtrack,ilayer,trackGlobXYZ1,"inward");
- vtrack->SetClIndex(ilayer,-1);
- modstatus = 3; // skipped
- vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc);
- vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
- vtrack->SetNDeadZone(vtrack->GetNDeadZone()+1);
- ntracks[ilayer]++;
- }
-
+
} // loop over tracks in layer ilayer+1
//loop over track candidates for the current layer
for (Int_t i=0;i<TMath::Min(2,ntracks[2]);i++) {
AliITStrackMI & track= tracks[2][nindexes[2][i]];
if (track.GetNumberOfClusters()<3) continue;
- if (!constrain && track.GetNormChi2(2) >
+ if (track.GetNormChi2(2) >
AliITSReconstructor::GetRecoParam()->GetMaxNormChi2NonCForHypothesis()) continue;
- if (constrain) track.SetNSkipped(track.GetNSkipped()+2);
- if (!constrain){
- track.SetD(0,track.GetD(GetX(),GetY()));
- track.SetNSkipped(track.GetNSkipped()+7./(7.+8.*TMath::Abs(track.GetD(0))));
- if (track.GetNumberOfClusters()+track.GetNDeadZone()+track.GetNSkipped()>6) {
- track.SetNSkipped(6-track.GetNumberOfClusters()+track.GetNDeadZone());
- }
+ track.SetD(0,track.GetD(GetX(),GetY()));
+ track.SetNSkipped(track.GetNSkipped()+7./(7.+8.*TMath::Abs(track.GetD(0))));
+ if (track.GetNumberOfClusters()+track.GetNDeadZone()+track.GetNSkipped()>6) {
+ track.SetNSkipped(6-track.GetNumberOfClusters()+track.GetNDeadZone());
}
AddTrackHypothesys(new AliITStrackMI(track), esdindex);
}
Double_t xrp[3]; vertex->GetXYZ(xrp[0],xrp[1],xrp[2]); //I.B.
Int_t nearestold = GetNearestLayer(xrp); //I.B.
Int_t nearest = nearestold;
- for (Int_t ilayer =nearest;ilayer<8;ilayer++){
+ for (Int_t ilayer =nearest;ilayer<7;ilayer++){
if (ntracks[nearest]==0){
nearest = ilayer;
}
fClusterTracks[0][i]=-1;
fClusterTracks[1][i]=-1;
fClusterTracks[2][i]=-1;
- fClusterTracks[3][i]=-1;
+ fClusterTracks[3][i]=-1;
+ fY[i]=0;
+ fZ[i]=0;
+ }
+ fYB[0]=0;
+ fYB[1]=0;
+
+ for (Int_t j=0; j<AliITSRecoParam::fgkMaxClusterPerLayer5; j++) {
+ for (Int_t j1=0; j1<6; j1++) {
+ fClusters5[j1][j]=0;
+ fClusterIndex5[j1][j]=-1;
+ fY5[j1][j]=0;
+ fZ5[j1][j]=0;
+ fN5[j1]=0;
+ fBy5[j1][0]=0;
+ fBy5[j1][1]=0;
+ }
+ }
+
+ for (Int_t j=0; j<AliITSRecoParam::fgkMaxClusterPerLayer10; j++) {
+ for (Int_t j1=0; j1<11; j1++) {
+ fClusters10[j1][j]=0;
+ fClusterIndex10[j1][j]=-1;
+ fY10[j1][j]=0;
+ fZ10[j1][j]=0;
+ fN10[j1]=0;
+ fBy10[j1][0]=0;
+ fBy10[j1][1]=0;
+ }
+ }
+
+ for (Int_t j=0; j<AliITSRecoParam::fgkMaxClusterPerLayer20; j++) {
+ for (Int_t j1=0; j1<21; j1++) {
+ fClusters20[j1][j]=0;
+ fClusterIndex20[j1][j]=-1;
+ fY20[j1][j]=0;
+ fZ20[j1][j]=0;
+ fN20[j1]=0;
+ fBy20[j1][0]=0;
+ fBy20[j1][1]=0;
+ }
+ }
+ for(Int_t i=0;i<AliITSRecoParam::fgkMaxClusterPerLayer;i++){
+ fClusters[i]=NULL;
+ fClusterIndex[i]=0;
}
}
//------------------------------------------------------------------------
//--------------------------------------------------------------------
fDetectors=new AliITSdetector[fNladders*fNdetectors];
fRoad=2*fR*TMath::Sqrt(TMath::Pi()/1.);//assuming that there's only one cluster
+
+ for (Int_t i=0; i<AliITSRecoParam::GetMaxClusterPerLayer(); i++) {
+ fClusterWeight[i]=0;
+ fClusterTracks[0][i]=-1;
+ fClusterTracks[1][i]=-1;
+ fClusterTracks[2][i]=-1;
+ fClusterTracks[3][i]=-1;
+ fY[i]=0;
+ fZ[i]=0;
+ }
+
+ fYB[0]=0;
+ fYB[1]=0;
+
+ for (Int_t j=0; j<AliITSRecoParam::fgkMaxClusterPerLayer5; j++) {
+ for (Int_t j1=0; j1<6; j1++) {
+ fClusters5[j1][j]=0;
+ fClusterIndex5[j1][j]=-1;
+ fY5[j1][j]=0;
+ fZ5[j1][j]=0;
+ fN5[j1]=0;
+ fBy5[j1][0]=0;
+ fBy5[j1][1]=0;
+ }
+ }
+
+ for (Int_t j=0; j<AliITSRecoParam::fgkMaxClusterPerLayer10; j++) {
+ for (Int_t j1=0; j1<11; j1++) {
+ fClusters10[j1][j]=0;
+ fClusterIndex10[j1][j]=-1;
+ fY10[j1][j]=0;
+ fZ10[j1][j]=0;
+ fN10[j1]=0;
+ fBy10[j1][0]=0;
+ fBy10[j1][1]=0;
+ }
+ }
+
+ for (Int_t j=0; j<AliITSRecoParam::fgkMaxClusterPerLayer20; j++) {
+ for (Int_t j1=0; j1<21; j1++) {
+ fClusters20[j1][j]=0;
+ fClusterIndex20[j1][j]=-1;
+ fY20[j1][j]=0;
+ fZ20[j1][j]=0;
+ fN20[j1]=0;
+ fBy20[j1][0]=0;
+ fBy20[j1][1]=0;
+ }
+ }
+ for(Int_t i=0;i<AliITSRecoParam::fgkMaxClusterPerLayer;i++){
+ fClusters[i]=NULL;
+ fClusterIndex[i]=0;
+ }
}
+/*
//------------------------------------------------------------------------
AliITStrackerMI::AliITSlayer::AliITSlayer(const AliITSlayer& layer):
fR(layer.fR),
{
//Copy constructor
}
+*/
//------------------------------------------------------------------------
AliITStrackerMI::AliITSlayer::~AliITSlayer() {
//--------------------------------------------------------------------
//This function adds a cluster to this layer
//--------------------------------------------------------------------
if (fN==AliITSRecoParam::GetMaxClusterPerLayer()) {
- ::Error("InsertCluster","Too many clusters !\n");
return 1;
}
fCurrentSlice=-1;
Double_t dz=fZOffset-z;
Double_t nnz = dz*(fNdetectors-1)*0.5/fZOffset+0.5;
Int_t nz = (nnz<0 ? -1 : (Int_t)nnz);
- if (nz>=fNdetectors) return -1;
- if (nz<0) return -1;
+ if (nz>=fNdetectors || nz<0) {
+ //printf("ndet %d phi %f z %f np %d nz %d\n",fNdetectors,phi,z,np,nz);
+ return -1;
+ }
// ad hoc correction for 3rd ladder of SDD inner layer,
// which is reversed (rotated by pi around local y)
// this correction is OK only from AliITSv11Hybrid onwards
if (GetR()>12. && GetR()<20.) { // SDD inner
if(np==2) { // 3rd ladder
- nz = (fNdetectors-1) - nz;
- }
+ Double_t posMod252[3];
+ AliITSgeomTGeo::GetTranslation(252,posMod252);
+ // check the Z coordinate of Mod 252: if negative
+ // (old SDD geometry in AliITSv11Hybrid)
+ // the swap of numeration whould be applied
+ if(posMod252[2]<0.){
+ nz = (fNdetectors-1) - nz;
+ }
+ }
}
//printf("ndet %d phi %f z %f np %d nz %d\n",fNdetectors,phi,z,np,nz);
if (z+fNMaxSigmaCl*TMath::Sqrt(fClusters[i]->GetSigmaZ2())<fZmin+fNMaxSigmaCl*fMaxSigmaClZ) continue;
if (z-fNMaxSigmaCl*TMath::Sqrt(fClusters[i]->GetSigmaZ2())>fZmax-fNMaxSigmaCl*fMaxSigmaClZ) continue;
//
- if (fClusters[i]->GetQ()==0&&fSkip==2) continue;
+ if (TMath::Abs(fClusters[i]->GetQ())<1.e-13 && fSkip==2) continue;
ci=i;
if (!test) fI=i+1;
return fClusters[i];
for (Int_t i=fI; i<fImax; i++) {
if (fYcs[i]<fYmin) continue;
if (fYcs[i]>fYmax) continue;
- if (fClustersCs[i]->GetQ()==0&&fSkip==2) continue;
+ if (TMath::Abs(fClustersCs[i]->GetQ())<1.e-13 && fSkip==2) continue;
ci=fClusterIndexCs[i];
if (!test) fI=i+1;
return fClustersCs[i];
index[k]=clusters[k];
}
- // special for cosmics: check which the innermost layer crossed
- // by the track
- Int_t innermostlayer=5;
- Double_t drphi = TMath::Abs(track->GetD(0.,0.));
- for(innermostlayer=0; innermostlayer<AliITSgeomTGeo::GetNLayers(); innermostlayer++) {
- if(drphi < fgLayers[innermostlayer].GetR()) break;
+ // special for cosmics and TPC prolonged tracks:
+ // propagate to the innermost of:
+ // - innermost layer crossed by the track
+ // - innermost layer where a cluster was associated to the track
+ static AliITSRecoParam *repa = NULL;
+ if(!repa){
+ repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
+ if(!repa){
+ repa = AliITSRecoParam::GetHighFluxParam();
+ AliWarning("Using default AliITSRecoParam class");
+ }
+ }
+ Int_t evsp=repa->GetEventSpecie();
+ ULong_t trStatus=0;
+ if(track->GetESDtrack()) trStatus=track->GetStatus();
+ Int_t innermostlayer=0;
+ if((evsp&AliRecoParam::kCosmic) || (trStatus&AliESDtrack::kTPCin)) {
+ innermostlayer=5;
+ Double_t drphi = TMath::Abs(track->GetD(0.,0.));
+ for(innermostlayer=0; innermostlayer<AliITSgeomTGeo::GetNLayers(); innermostlayer++) {
+ if( (drphi < (fgLayers[innermostlayer].GetR()+1.)) ||
+ index[innermostlayer] >= 0 ) break;
+ }
+
+ AliDebug(2,Form(" drphi %f innermost %d",drphi,innermostlayer));
}
- AliDebug(2,Form(" drphi %f innermost %d",drphi,innermostlayer));
Int_t modstatus=1; // found
Float_t xloc,zloc;
const AliITSdetector &det=layer.GetDetector(idet);
+ // only for ITS-SA tracks refit
+ if (ilayer>1 && fTrackingPhase.Contains("RefitInward") && !(track->GetStatus()&AliESDtrack::kTPCin)) track->SetCheckInvariant(kFALSE);
+ //
if (!track->Propagate(det.GetPhi(),det.GetR())) return kFALSE;
track->SetDetectorIndex(idet);
track->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc);
- if (extra) { // search for extra clusters in overlapped modules
+ if (extra && clAcc) { // search for extra clusters in overlapped modules
AliITStrackV2 tmp(*track);
if (!ComputeRoad(track,ilayer,idet,zmin,zmax,ymin,ymax)) return kFALSE;
layer.SelectClusters(zmin,zmax,ymin,ymax);
// cross material
// add time if going outward
if(!CorrectForLayerMaterial(track,ilayer,oldGlobXYZ,dir)) return kFALSE;
-
+ track->SetCheckInvariant(kTRUE);
} // end loop on layers
if (!track->PropagateTo(xx,0.,0.)) return kFALSE;
// or there is a dead from OCDB)
Float_t deadzonefactor = 0.;
if (track->GetNDeadZone()>0.) {
- Float_t sumDeadZoneProbability=0;
- for(Int_t ilay=0;ilay<6;ilay++) sumDeadZoneProbability+=track->GetDeadZoneProbability(ilay);
- Float_t nDeadZoneWithProbNot1=(Float_t)(track->GetNDeadZone())-sumDeadZoneProbability;
- if(nDeadZoneWithProbNot1>0.) {
- Float_t deadZoneProbability = sumDeadZoneProbability - (Float_t)((Int_t)sumDeadZoneProbability);
- deadZoneProbability /= nDeadZoneWithProbNot1;
+ Int_t sumDeadZoneProbability=0;
+ for(Int_t ilay=0;ilay<6;ilay++) {
+ if(track->GetDeadZoneProbability(ilay)>0.) sumDeadZoneProbability++;
+ }
+ Int_t nDeadZoneWithProbNot1=(Int_t)(track->GetNDeadZone())-sumDeadZoneProbability;
+ if(nDeadZoneWithProbNot1>0) {
+ Float_t deadZoneProbability = track->GetNDeadZone()-(Float_t)sumDeadZoneProbability;
+ AliDebug(2,Form("nDeadZone %f sumDZProbability %d nDZWithProbNot1 %d deadZoneProb %f\n",track->GetNDeadZone(),sumDeadZoneProbability,nDeadZoneWithProbNot1,deadZoneProbability));
+ deadZoneProbability /= (Float_t)nDeadZoneWithProbNot1;
+ Float_t one = 1.;
+ deadZoneProbability = TMath::Min(deadZoneProbability,one);
deadzonefactor = 3.*(1.1-deadZoneProbability);
}
}
Double_t normchi2 = 2*track->GetNSkipped()+match+deadzonefactor+(1+(2*track->GetNSkipped()+deadzonefactor)/track->GetNumberOfClusters())*
(chi2)/TMath::Max(double(sum-track->GetNSkipped()),
1./(1.+track->GetNSkipped()));
-
- return normchi2;
+ AliDebug(2,Form("match %f deadzonefactor %f chi2 %f sum %f skipped %f\n",match,deadzonefactor,chi2,sum,track->GetNSkipped()));
+ AliDebug(2,Form("NormChi2 %f cls %d\n",normchi2,track->GetNumberOfClusters()));
+ return normchi2;
}
//------------------------------------------------------------------------
Double_t AliITStrackerMI::GetMatchingChi2(const AliITStrackMI * track1,const AliITStrackMI * track2)
//
// return probability that given point (characterized by z position and error)
// is in SPD dead zone
+ // This method assumes that fSPDdetzcentre is ordered from -z to +z
//
Double_t probability = 0.;
- Double_t absz = TMath::Abs(zpos);
- Double_t nearestz = (absz<2.) ? 0.5*(fSPDdetzcentre[1]+fSPDdetzcentre[2]) :
- 0.5*(fSPDdetzcentre[2]+fSPDdetzcentre[3]);
- if (TMath::Abs(absz-nearestz)>0.25+3.*zerr) return probability;
+ Double_t nearestz = 0.,distz=0.;
+ Int_t nearestzone = -1;
+ Double_t mindistz = 1000.;
+
+ // find closest dead zone
+ for (Int_t i=0; i<3; i++) {
+ distz=TMath::Abs(zpos-0.5*(fSPDdetzcentre[i]+fSPDdetzcentre[i+1]));
+ if (distz<mindistz) {
+ nearestzone=i;
+ nearestz=0.5*(fSPDdetzcentre[i]+fSPDdetzcentre[i+1]);
+ mindistz=distz;
+ }
+ }
+
+ // too far from dead zone
+ if (TMath::Abs(zpos-nearestz)>0.25+3.*zerr) return probability;
+
+
Double_t zmin, zmax;
- if (zpos<-6.) { // dead zone at z = -7
+ if (nearestzone==0) { // dead zone at z = -7
zmin = fSPDdetzcentre[0] + 0.5*AliITSRecoParam::GetSPDdetzlength();
zmax = fSPDdetzcentre[1] - 0.5*AliITSRecoParam::GetSPDdetzlength();
- } else if (zpos>6.) { // dead zone at z = +7
- zmin = fSPDdetzcentre[2] + 0.5*AliITSRecoParam::GetSPDdetzlength();
- zmax = fSPDdetzcentre[3] - 0.5*AliITSRecoParam::GetSPDdetzlength();
- } else if (absz<2.) { // dead zone at z = 0
+ } else if (nearestzone==1) { // dead zone at z = 0
zmin = fSPDdetzcentre[1] + 0.5*AliITSRecoParam::GetSPDdetzlength();
zmax = fSPDdetzcentre[2] - 0.5*AliITSRecoParam::GetSPDdetzlength();
+ } else if (nearestzone==2) { // dead zone at z = +7
+ zmin = fSPDdetzcentre[2] + 0.5*AliITSRecoParam::GetSPDdetzlength();
+ zmax = fSPDdetzcentre[3] - 0.5*AliITSRecoParam::GetSPDdetzlength();
} else {
zmin = 0.;
zmax = 0.;
}
// probability that the true z is in the range [zmin,zmax] (i.e. inside
// dead zone)
- probability = 0.5*( TMath::Erf((zpos-zmin)/zerr/TMath::Sqrt(2.)) -
- TMath::Erf((zpos-zmax)/zerr/TMath::Sqrt(2.)) );
+ probability = 0.5*( AliMathBase::ErfFast((zpos-zmin)/zerr/TMath::Sqrt(2.)) -
+ AliMathBase::ErfFast((zpos-zmax)/zerr/TMath::Sqrt(2.)) );
+ AliDebug(2,Form("zpos %f +- %f nearestzone %d zmin zmax %f %f prob %f\n",zpos,zerr,nearestzone,zmin,zmax,probability));
return probability;
}
//------------------------------------------------------------------------
Int_t l=(index & 0xf0000000) >> 28;
Int_t c=(index & 0x0fffffff) >> 00;
if (c>fgLayers[l].GetNumberOfClusters()) continue;
- if (ny[l]==0){
- printf("problem\n");
- }
+ // if (ny[l]<1.e-13){
+ // printf("problem\n");
+ // }
AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(index);
Float_t weight=1;
//
if (fgLayers[l].GetClusterTracks(itrack,c)>=0 && fgLayers[l].GetClusterTracks(itrack,c)!=id){
list[l]=index;
clist[l] = (AliITSRecPoint*)GetCluster(index);
+ track->SetSharedWeight(l,weight);
shared+=weight;
break;
}
Int_t index = clusterlist[icluster];
Int_t l=(index & 0xf0000000) >> 28;
Int_t c=(index & 0x0fffffff) >> 00;
- if (ny[l]==0){
- printf("problem\n");
- }
+ // if (ny[l]<1.e-13){
+ // printf("problem\n");
+ // }
if (c>fgLayers[l].GetNumberOfClusters()) continue;
//if (l>3) continue;
AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(index);
for (Int_t itrack=0;itrack<entries;itrack++){
AliITStrackMI * track = (AliITStrackMI*)array->At(itrack);
if (track){
+ AliDebug(2,Form("track %d ncls %d\n",itrack,track->GetNumberOfClusters()));
track->SetChi2MIP(0,GetNormalizedChi2(track, mode));
if (track->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0))
chi2[itrack] = track->GetChi2MIP(0);
//
TMath::Sort(entries,chi2,index,kFALSE);
besttrack = (AliITStrackMI*)array->At(index[0]);
+ if(besttrack) AliDebug(2,Form("ncls best track %d\n",besttrack->GetNumberOfClusters()));
if (besttrack&&besttrack->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0)){
for (Int_t j=0;j<6;j++){
if (besttrack->GetClIndex(j)>=0){
for (Int_t itrack=0;itrack<entries;itrack++){
AliITStrackMI * track = (AliITStrackMI*)array->At(itrack);
if (track){
- track->SetChi2MIP(0,GetNormalizedChi2(track,mode));
+ track->SetChi2MIP(0,GetNormalizedChi2(track,mode));
+ AliDebug(2,Form("track %d ncls %d\n",itrack,track->GetNumberOfClusters()));
if (track->GetChi2MIP(0)<AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(0))
chi2[itrack] = track->GetChi2MIP(0)-0*(track->GetNumberOfClusters()+track->GetNDeadZone());
else
TMath::Sort(entries,chi2,index,kFALSE);
besttrack = (AliITStrackMI*)array->At(index[0]);
if (besttrack){
+ AliDebug(2,Form("ncls best track %d %f %f\n",besttrack->GetNumberOfClusters(),besttrack->GetChi2MIP(0),chi2[index[0]]));
//
for (Int_t j=0;j<6;j++){
if (besttrack->GetNz(j)>0&&besttrack->GetNy(j)>0){
backtrack = new(backtrack) AliITStrackMI(*track);
if (track->GetConstrain()) {
if (!CorrectForPipeMaterial(backtrack,"inward")) continue;
- if (!backtrack->Improve(0,xyzVtx,ersVtx)) continue;
+ if (AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) {
+ if (!backtrack->Improve(0,xyzVtx,ersVtx)) continue;
+ }
backtrack->ResetCovariance(10.);
}else{
backtrack->ResetCovariance(10.);
}
delete backtrack;
delete forwardtrack;
+
+ if (!besttrack) return 0;
+
Int_t accepted=0;
for (Int_t i=0;i<entries;i++){
AliITStrackMI * track = (AliITStrackMI*)array->At(i);
if (besttrack&&fAfterV0) {
UpdateESDtrack(besttrack,AliESDtrack::kITSin);
}
- if (besttrack&&fConstraint[fPass])
- UpdateESDtrack(besttrack,AliESDtrack::kITSin);
- if (besttrack->GetChi2MIP(0)+besttrack->GetNUsed()>1.5 && fConstraint[fPass]) {
- if ( TMath::Abs(besttrack->GetD(0))>0.1 ||
- TMath::Abs(besttrack->GetD(1))>0.1 ) track->SetReconstructed(kFALSE);
- }
-
+ if (besttrack) {
+ if (fConstraint[fPass]) UpdateESDtrack(besttrack,AliESDtrack::kITSin);
+ if (besttrack->GetChi2MIP(0)+besttrack->GetNUsed()>1.5 && fConstraint[fPass]) {
+ if ( TMath::Abs(besttrack->GetD(0))>0.1 ||
+ TMath::Abs(besttrack->GetD(1))>0.1 ) track->SetReconstructed(kFALSE);
+ }
+ }
}
}
}
//--------------------------------------------------------------------
Int_t tpcLabel=-1;
- if ( track->GetESDtrack()) tpcLabel = TMath::Abs(track->GetESDtrack()->GetTPCLabel());
-
+ if (track->GetESDtrack()){
+ tpcLabel = track->GetESDtrack()->GetTPCLabel();
+ ULong_t trStatus=track->GetESDtrack()->GetStatus();
+ if(!(trStatus&AliESDtrack::kTPCin)) tpcLabel=track->GetLabel(); // for ITSsa tracks
+ }
track->SetChi2MIP(9,0);
Int_t nwrong=0;
for (Int_t i=0;i<track->GetNumberOfClusters();i++){
AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(cindex);
Int_t isWrong=1;
for (Int_t ind=0;ind<3;ind++){
- if (tpcLabel>0)
- if (cl->GetLabel(ind)==tpcLabel) isWrong=0;
- AliDebug(2,Form("icl %d ilab %d lab %d",i,ind,cl->GetLabel(ind)));
+ if (cl->GetLabel(ind)==TMath::Abs(tpcLabel)) isWrong=0;
+ //AliDebug(2,Form("icl %d ilab %d lab %d",i,ind,cl->GetLabel(ind)));
}
track->SetChi2MIP(9,track->GetChi2MIP(9)+isWrong*(2<<l));
nwrong+=isWrong;
Int_t nclusters = track->GetNumberOfClusters();
if (nclusters > 0) //PH Some tracks don't have any cluster
track->SetFakeRatio(double(nwrong)/double(nclusters));
- if (tpcLabel>0){
- if (track->GetFakeRatio()>wrong) track->SetLabel(-tpcLabel);
- else
- track->SetLabel(tpcLabel);
+ if (tpcLabel>0 && track->GetFakeRatio()>wrong) {
+ track->SetLabel(-tpcLabel);
+ } else {
+ track->SetLabel(tpcLabel);
}
AliDebug(2,Form(" nls %d wrong %d label %d tpcLabel %d\n",nclusters,nwrong,track->GetLabel(),tpcLabel));
}
//------------------------------------------------------------------------
-void AliITStrackerMI::CookdEdx(AliITStrackMI* track)
-{
+void AliITStrackerMI::CookdEdx(AliITStrackMI* track){
+ //
+ // Fill the dE/dx in this track
//
track->SetChi2MIP(9,0);
for (Int_t i=0;i<track->GetNumberOfClusters();i++){
//
// Compute predicted chi2
//
+ // Take into account the mis-alignment (bring track to cluster plane)
+ Double_t xTrOrig=track->GetX();
+ if (!track->Propagate(xTrOrig+cluster->GetX())) return 1000.;
Float_t erry,errz,covyz;
Float_t theta = track->GetTgl();
Float_t phi = track->GetSnp();
- phi = TMath::Abs(phi)*TMath::Sqrt(1./((1.-phi)*(1.+phi)));
+ phi *= TMath::Sqrt(1./((1.-phi)*(1.+phi)));
AliITSClusterParam::GetError(layer,cluster,theta,phi,track->GetExpQ(),erry,errz,covyz);
AliDebug(2,Form(" chi2: tr-cl %f %f tr X %f cl X %f",track->GetY()-cluster->GetY(),track->GetZ()-cluster->GetZ(),track->GetX(),cluster->GetX()));
- // Take into account the mis-alignment (bring track to cluster plane)
- Double_t xTrOrig=track->GetX();
- if (!track->Propagate(xTrOrig+cluster->GetX())) return 1000.;
AliDebug(2,Form(" chi2: tr-cl %f %f tr X %f cl X %f",track->GetY()-cluster->GetY(),track->GetZ()-cluster->GetZ(),track->GetX(),cluster->GetX()));
Double_t chi2 = track->GetPredictedChi2MI(cluster->GetY(),cluster->GetZ(),erry,errz,covyz);
// Bring the track back to detector plane in ideal geometry
}
}
- if (cl->GetQ()<=0) return 0; // ingore the "virtual" clusters
+ if (TMath::Abs(cl->GetQ())<1.e-13) return 0; // ingore the "virtual" clusters
// Take into account the mis-alignment (bring track to cluster plane)
//to be paramterized using external parameters in future
//
//
- sigmarfi = 0.0040+1.4 *TMath::Abs(track->GetC())+332.*track->GetC()*track->GetC();
- sigmaz = 0.0110+4.37*TMath::Abs(track->GetC());
+ Double_t curv=track->GetC();
+ sigmarfi = 0.0040+1.4 *TMath::Abs(curv)+332.*curv*curv;
+ sigmaz = 0.0110+4.37*TMath::Abs(curv);
}
//------------------------------------------------------------------------
void AliITStrackerMI::SignDeltas(const TObjArray *clusterArray, Float_t vz)
AliITStrackMI * oldtrack = (AliITStrackMI*)(track->GetESDtrack()->GetITStrack());
if (oldtrack) delete oldtrack;
track->GetESDtrack()->SetITStrack(new AliITStrackMI(*track));
- if (TMath::Abs(track->GetDnorm(1))<0.000000001){
- printf("Problem\n");
- }
+ // if (TMath::Abs(track->GetDnorm(1))<0.000000001){
+ // printf("Problem\n");
+ // }
}
//------------------------------------------------------------------------
Int_t AliITStrackerMI::GetNearestLayer(const Double_t *xr) const{
//-----------------------------------------------------------------
const AliEventInfo *eventInfo = GetEventInfo();
-
+
for(Int_t l=0; l<AliITSgeomTGeo::kNLayers; l++) {
fForceSkippingOfLayer[l] = 0;
// check reco param
if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(l)) fForceSkippingOfLayer[l] = 1;
// check run info
- if(eventInfo) {
+ if(eventInfo &&
+ AliITSReconstructor::GetRecoParam()->GetSkipSubdetsNotInTriggerCluster()) {
AliDebug(2,Form("GetEventInfo->GetTriggerCluster: %s",eventInfo->GetTriggerCluster()));
if(l==0 || l==1) {
if(!strstr(eventInfo->GetTriggerCluster(),"ITSSPD")) fForceSkippingOfLayer[l] = 1;
// without clusters, because there is a dead zone in the road.
// In this case the return value is > 0:
// return 1: dead zone at z=0,+-7cm in SPD
+ // This method assumes that fSPDdetzcentre is ordered from -z to +z
// return 2: all road is "bad" (dead or noisy) from the OCDB
// return 3: at least a chip is "bad" (dead or noisy) from the OCDB
// return 4: at least a single channel is "bad" (dead or noisy) from the OCDB
fSPDdetzcentre[3] - 0.5*AliITSRecoParam::GetSPDdetzlength()};
for (Int_t i=0; i<3; i++)
if (track->GetZ()-dz<zmaxdead[i] && track->GetZ()+dz>zmindead[i]) {
- AliDebug(2,Form("crack SPD %d",ilayer));
- return 1;
+ AliDebug(2,Form("crack SPD %d track z %f %f %f %f\n",ilayer,track->GetZ(),dz,zmaxdead[i],zmindead[i]));
+ if (GetSPDDeadZoneProbability(track->GetZ(),TMath::Sqrt(track->GetSigmaZ2()))>0.1) return 1;
}
}
// check if the road overlaps with bad chips
Float_t xloc,zloc;
- LocalModuleCoord(ilayer,idet,track,xloc,zloc);
+ if(!(LocalModuleCoord(ilayer,idet,track,xloc,zloc)))return 0;
Float_t zlocmin = zloc-dz;
Float_t zlocmax = zloc+dz;
Float_t xlocmin = xloc-dy;
// check if road goes out of detector
Bool_t touchNeighbourDet=kFALSE;
- if (TMath::Abs(xlocmin)>0.5*detSizeX) {xlocmin=-0.5*detSizeX; touchNeighbourDet=kTRUE;}
- if (TMath::Abs(xlocmax)>0.5*detSizeX) {xlocmax=+0.5*detSizeX; touchNeighbourDet=kTRUE;}
- if (TMath::Abs(zlocmin)>0.5*detSizeZ) {zlocmin=-0.5*detSizeZ; touchNeighbourDet=kTRUE;}
- if (TMath::Abs(zlocmax)>0.5*detSizeZ) {zlocmax=+0.5*detSizeZ; touchNeighbourDet=kTRUE;}
+ if (TMath::Abs(xlocmin)>0.5*detSizeX) {xlocmin=-0.4999*detSizeX; touchNeighbourDet=kTRUE;}
+ if (TMath::Abs(xlocmax)>0.5*detSizeX) {xlocmax=+0.4999*detSizeX; touchNeighbourDet=kTRUE;}
+ if (TMath::Abs(zlocmin)>0.5*detSizeZ) {zlocmin=-0.4999*detSizeZ; touchNeighbourDet=kTRUE;}
+ if (TMath::Abs(zlocmax)>0.5*detSizeZ) {zlocmax=+0.4999*detSizeZ; touchNeighbourDet=kTRUE;}
AliDebug(2,Form("layer %d det %d zmim zmax %f %f xmin xmax %f %f %f %f",ilayer,idet,zlocmin,zlocmax,xlocmin,xlocmax,detSizeZ,detSizeX));
// check if this detector is bad
return kTRUE;
}
//------------------------------------------------------------------------
+//------------------------------------------------------------------------
Bool_t AliITStrackerMI::IsOKForPlaneEff(const AliITStrackMI* track, const Int_t *clusters, Int_t ilayer) const {
//
// Method to be optimized further:
AliITStrackMI tmp(*track);
// require a minimal number of cluster in other layers and eventually clusters in closest layers
- Int_t ncl=0;
- for(Int_t lay=AliITSgeomTGeo::kNLayers-1;lay>ilayer;lay--) {
+ Int_t ncl_out=0; Int_t ncl_in=0;
+ for(Int_t lay=AliITSgeomTGeo::kNLayers-1;lay>ilayer;lay--) { // count n. of cluster in outermost layers
+ AliDebug(2,Form("trak=%d lay=%d ; index=%d ESD label= %d",tmp.GetLabel(),lay,
+ tmp.GetClIndex(lay),((AliESDtrack*)tmp.GetESDtrack())->GetLabel())) ;
+ // if (tmp.GetClIndex(lay)>=0) ncl_out++;
+if(index[lay]>=0)ncl_out++;
+ }
+ for(Int_t lay=ilayer-1; lay>=0;lay--) { // count n. of cluster in innermost layers
AliDebug(2,Form("trak=%d lay=%d ; index=%d ESD label= %d",tmp.GetLabel(),lay,
tmp.GetClIndex(lay),((AliESDtrack*)tmp.GetESDtrack())->GetLabel())) ;
- if (tmp.GetClIndex(lay)>=0) ncl++;
+ if (index[lay]>=0) ncl_in++;
}
+ Int_t ncl=ncl_out+ncl_in;
Bool_t nextout = kFALSE;
if(ilayer==AliITSgeomTGeo::kNLayers-1) nextout=kTRUE; // you are already on the outermost layer
else nextout = ((tmp.GetClIndex(ilayer+1)>=0)? kTRUE : kFALSE );
Bool_t nextin = kFALSE;
if(ilayer==0) nextin=kTRUE; // you are already on the innermost layer
else nextin = ((index[ilayer-1]>=0)? kTRUE : kFALSE );
- if(ncl<AliITSgeomTGeo::kNLayers-(ilayer+1)-AliITSReconstructor::GetRecoParam()->GetMaxMissingClustersPlaneEff())
+ // maximum number of missing clusters allowed in outermost layers
+ if(ncl_out<AliITSgeomTGeo::kNLayers-(ilayer+1)-AliITSReconstructor::GetRecoParam()->GetMaxMissingClustersOutPlaneEff())
+ return kFALSE;
+ // maximum number of missing clusters allowed (both in innermost and in outermost layers)
+ if(ncl<AliITSgeomTGeo::kNLayers-1-AliITSReconstructor::GetRecoParam()->GetMaxMissingClustersPlaneEff())
return kFALSE;
if(AliITSReconstructor::GetRecoParam()->GetRequireClusterInOuterLayerPlaneEff() && !nextout) return kFALSE;
if(AliITSReconstructor::GetRecoParam()->GetRequireClusterInInnerLayerPlaneEff() && !nextin) return kFALSE;
//***************
// DEFINITION OF SEARCH ROAD FOR accepting a track
//
- //For the time being they are hard-wired, later on from AliITSRecoParam
- // Double_t nsigx=AliITSRecoParam::GetNSigXFarFromBoundary();
- // Double_t nsigz=AliITSRecoParam::GetNSigZFarFromBoundary();
- Double_t nsigz=4;
- Double_t nsigx=4;
+ Double_t nsigx=AliITSReconstructor::GetRecoParam()->GetNSigXFromBoundaryPlaneEff();
+ Double_t nsigz=AliITSReconstructor::GetRecoParam()->GetNSigZFromBoundaryPlaneEff();
Double_t dx=nsigx*TMath::Sqrt(tmp.GetSigmaY2()); // those are precisions in the tracking reference system
Double_t dz=nsigz*TMath::Sqrt(tmp.GetSigmaZ2()); // Use it also for the module reference system, as it is
- // done for RecPoints
+ // done for RecPoints
// exclude tracks at boundary between detectors
//Double_t boundaryWidth=AliITSRecoParam::GetBoundaryWidthPlaneEff();
AliDebug(2,Form("Tracking: track impact x=%f, y=%f, z=%f",tmp.GetX(), tmp.GetY(), tmp.GetZ()));
AliDebug(2,Form("Local: track impact x=%f, z=%f",locx,locz));
AliDebug(2,Form("Search Road. Tracking: dy=%f , dz=%f",dx,dz));
-
if ( (locx-dx < blockXmn+boundaryWidth) ||
(locx+dx > blockXmx-boundaryWidth) ||
(locz-dz < blockZmn+boundaryWidth) ||
Float_t tr[4]={99999.,99999.,9999.,9999.}; // initialize to high values
Float_t clu[4]={-99999.,-99999.,9999.,9999.}; // (in some cases GetCov fails)
Int_t cltype[2]={-999,-999};
+ // and the module
+
+Float_t AngleModTrack[3]={99999.,99999.,99999.}; // angles (phi, z and "absolute angle") between the track and the mormal to the module (see below)
tr[0]=locx;
tr[1]=locz;
clu[3]=TMath::Sqrt(c.GetSigmaZ2());
//}
}
- fPlaneEff->FillHistos(key,found,tr,clu,cltype);
+ // Compute the angles between the track and the module
+ // compute the angle "in phi direction", i.e. the angle in the transverse plane
+ // between the normal to the module and the projection (in the transverse plane) of the
+ // track trajectory
+ // tgphi and tglambda of the track in tracking frame with alpha=det.GetPhi
+ Float_t tgl = tmp.GetTgl();
+ Float_t phitr = tmp.GetSnp();
+ phitr = TMath::ASin(phitr);
+ Int_t volId = AliGeomManager::LayerToVolUIDSafe(ilayer+1 ,idet );
+
+ Double_t tra[3]; AliGeomManager::GetOrigTranslation(volId,tra);
+ Double_t rot[9]; AliGeomManager::GetOrigRotation(volId,rot);
+ Double_t alpha =0.;
+ alpha = tmp.GetAlpha();
+ Double_t phiglob = alpha+phitr;
+ Double_t p[3];
+ p[0] = TMath::Cos(phiglob);
+ p[1] = TMath::Sin(phiglob);
+ p[2] = tgl;
+ TVector3 pvec(p[0],p[1],p[2]);
+ TVector3 normvec(rot[1],rot[4],rot[7]);
+ Double_t angle = pvec.Angle(normvec);
+
+ if(angle>0.5*TMath::Pi()) angle = (TMath::Pi()-angle);
+ angle *= 180./TMath::Pi();
+
+ //Trasverse Plane
+ TVector3 pt(p[0],p[1],0);
+ TVector3 normt(rot[1],rot[4],0);
+ Double_t anglet = pt.Angle(normt);
+
+ Double_t phiPt = TMath::ATan2(p[1],p[0]);
+ if(phiPt<0)phiPt+=2.*TMath::Pi();
+ Double_t phiNorm = TMath::ATan2(rot[4],rot[1]);
+ if(phiNorm<0) phiNorm+=2.*TMath::Pi();
+ if(anglet>0.5*TMath::Pi()) anglet = (TMath::Pi()-anglet);
+ if(phiNorm>phiPt) anglet*=-1.;// pt-->normt clockwise: anglet>0
+ if((phiNorm-phiPt)>TMath::Pi()) anglet*=-1.;
+ anglet *= 180./TMath::Pi();
+
+ AngleModTrack[2]=(Float_t) angle;
+ AngleModTrack[0]=(Float_t) anglet;
+ // now the "angle in z" (much easier, i.e. the angle between the z axis and the track momentum + 90)
+ AngleModTrack[1]=TMath::ACos(tgl/TMath::Sqrt(tgl*tgl+1.));
+ AngleModTrack[1]-=TMath::Pi()/2.; // range of angle is -pi/2 , pi/2
+ AngleModTrack[1]*=180./TMath::Pi(); // in degree
+
+ fPlaneEff->FillHistos(key,found,tr,clu,cltype,AngleModTrack);
}
return;
}