+//$Id$
-//Author: Anders Strand Vestbo
-//Last Modified: 15.12.2000
+// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
+//*-- Copyright © ASV
+
+#include "AliL3StandardIncludes.h"
+#include <sys/time.h>
-#include <iostream.h>
-#include <time.h>
-#include <math.h>
#include "AliL3ConfMapper.h"
-
-#include "AliL3Logging.h"
-#include "AliL3Transform.h"
+#include "AliL3Logging.h"
#include "AliL3Vertex.h"
#include "AliL3ConfMapTrack.h"
#include "AliL3ConfMapPoint.h"
#include "AliL3TrackArray.h"
+#include "AliL3Transform.h"
+//_____________________________________________________________
+// AliL3ConfMapper
//
-//AliL3ConfMapper
+// Conformal mapping base class
//
-//Conformal mapping base class
-
ClassImp(AliL3ConfMapper)
Double_t AliL3ConfMapper::pi=3.14159265358979323846;
fBench = (Bool_t)true;
fParamSet = (Bool_t)false;
fVertexConstraint = (Bool_t)true;
+
}
}
}
+
+void AliL3ConfMapper::InitVolumes()
+{
+ //Data organization.
+ //Allocate volumes, set conformal coordinates and pointers.
+
+ //Should be done after setting the track parameters
+
+ fNumRowSegmentPlusOne = AliL3Transform::GetNRows();//NumRows[0]; //Maximum 32.
+ fNumPhiSegmentPlusOne = fNumPhiSegment+1;
+ fNumEtaSegmentPlusOne = fNumEtaSegment+1;
+ fNumPhiEtaSegmentPlusOne = fNumPhiSegmentPlusOne*fNumEtaSegmentPlusOne;
+ fBounds = fNumRowSegmentPlusOne * fNumPhiSegmentPlusOne * fNumEtaSegmentPlusOne;
+
+ //Allocate volumes:
+ if(fVolume) delete [] fVolume;
+ if(fRow) delete [] fRow;
+
+ LOG(AliL3Log::kInformational,"AliL3ConfMapper::InitVolumes","Memory")<<AliL3Log::kDec<<
+ "Allocating "<<fBounds*sizeof(AliL3ConfMapContainer)<<" Bytes to fVolume"<<ENDLOG;
+ LOG(AliL3Log::kInformational,"AliL3ConfMapper::InitVolumes","Memory")<<AliL3Log::kDec<<
+ "Allocating "<<fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer)<<" Bytes to fRow"<<ENDLOG;
+
+ fVolume = new AliL3ConfMapContainer[fBounds];
+ fRow = new AliL3ConfMapContainer[fNumRowSegmentPlusOne];
+
+ memset(fVolume,0,fBounds*sizeof(AliL3ConfMapContainer));
+ memset(fRow,0,fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer));
+
+ Int_t max_num_of_tracks = 1000;
+ Int_t max_num_of_hits = 50000;
+
+ if(fHit)
+ delete [] fHit;
+ if(fTrack)
+ delete fTrack;
+
+ fHit = new AliL3ConfMapPoint[max_num_of_hits];
+ fTrack = new AliL3TrackArray("AliL3ConfMapTrack",max_num_of_tracks);
+}
void AliL3ConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etarange)
{
//rowrange[0]=innermost row;
//rowrange[1]=outermostrow;
//Finally you can specify etaslices to save time (assuming a good seed from TRD...)
-
- if(fHit)
- {
- delete [] fHit;
- }
-
- if(fTrack)
- {
- delete fTrack;
- }
-
+
//Define tracking area:
if(rowrange)
{
else //complete sector
{
fRowMin = 0;
- fRowMax = 173;
+ fRowMax = AliL3Transform::GetNRows() - 1;
}
if(etarange)
{
else
{
fEtaMin = 0;
+ //fEtaMax = sector < 18 ? 1 : -1;
fEtaMax = sector < 18 ? 0.9 : -0.9;
}
fPhiMin = -1.*10/todeg;//fParam->GetAngle(sector) - 10/todeg;
fPhiMax = 10/todeg;//fParam->GetAngle(sector) + 10/todeg;
- //rotation angles for sector 2:
- //cos: 0.766044 sin: 0.642788
-
- Int_t max_num_of_tracks = 3000;
- Int_t max_num_of_hits = 90000;
-
- fHit = new AliL3ConfMapPoint[max_num_of_hits];
- fTrack = new AliL3TrackArray("AliL3ConfMapTrack",max_num_of_tracks);
-
nTracks=0;
+ fMainVertexTracks = 0;
fClustersUnused = 0;
+ fEtaHitsOutOfRange=0;
+ fPhiHitsOutOfRange=0;
fNumRowSegment = fRowMax - fRowMin; //number of rows to be considered by tracker
-
+ LOG(AliL3Log::kInformational,"AliL3ConfMapper::InitSector","B-field")
+ <<"Tracker initializing with a magnetic field of "<<AliL3Transform::GetBField()<<ENDLOG;
+
+ fTrack->Reset();
}
{
Int_t nhit=(Int_t)count;
for (Int_t i=0;i<nhit;i++)
- fHit[i].ReadHits(&(hits[i]));
+ {
+ fHit[i].Reset();
+ fHit[i].ReadHits(&(hits[i]));
+ }
fClustersUnused += nhit;
- LOG(AliL3Log::kInformational,"AliL3ConfMapper::ReadHits","#hits")<<AliL3Log::kDec
- <<"hit_counter: "<<nhit<<" count: "<<count<<ENDLOG;
-
+ LOG(AliL3Log::kInformational,"AliL3ConfMapper::ReadHits","#hits")
+ <<AliL3Log::kDec<<"hit_counter: "<<nhit<<" count: "<<count<<ENDLOG;
+
return true;
}
void AliL3ConfMapper::SetPointers()
{
- //Data organization.
- //Allocate volumes, set conformal coordinates and pointers.
- fNumRowSegmentPlusOne = 174;//fNumRowSegment+1;
- fNumPhiSegmentPlusOne = fNumPhiSegment+1;
- fNumEtaSegmentPlusOne = fNumEtaSegment+1;
- fNumPhiEtaSegmentPlusOne = fNumPhiSegmentPlusOne*fNumEtaSegmentPlusOne;
- fBounds = fNumRowSegmentPlusOne * fNumPhiSegmentPlusOne * fNumEtaSegmentPlusOne;
-
- //Allocate volumes:
- if(fVolume) delete [] fVolume;
- if(fRow) delete [] fRow;
- LOG(AliL3Log::kInformational,"AliL3ConfMapper::SetPointers","Memory")<<AliL3Log::kDec<<
- "Allocating "<<fBounds*sizeof(AliL3ConfMapContainer)<<" Bytes to fVolume"<<ENDLOG;
- LOG(AliL3Log::kInformational,"AliL3ConfMapper::SetPointers","Memory")<<AliL3Log::kDec<<
- "Allocating "<<fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer)<<" Bytes to fRow"<<ENDLOG;
-
- fVolume = new AliL3ConfMapContainer[fBounds];
- fRow = new AliL3ConfMapContainer[fNumRowSegmentPlusOne];
-
- //set volumes to zero:
+ //Reset detector volumes
memset(fVolume,0,fBounds*sizeof(AliL3ConfMapContainer));
memset(fRow,0,fNumRowSegmentPlusOne*sizeof(AliL3ConfMapContainer));
Float_t phiSlice = (fPhiMax-fPhiMin)/fNumPhiSegment;
Float_t etaSlice = (fEtaMax-fEtaMin)/fNumEtaSegment;
-
+
Int_t volumeIndex;
+ Int_t local_counter=0;
for(Int_t j=0; j<fClustersUnused; j++)
{
Int_t localrow = thisHit->GetPadRow();
- //reset pointers:
- thisHit->nextVolumeHit=thisHit->nextRowHit=0;
-
if(localrow < fRowMin || localrow > fRowMax)
continue;
-
//Get indexes:
thisHit->phiIndex=(Int_t)((thisHit->GetPhi()-fPhiMin)/phiSlice +1);
fEtaHitsOutOfRange++;
continue;
}
-
- //set volume pointers
- volumeIndex = localrow*fNumPhiEtaSegmentPlusOne+thisHit->phiIndex*fNumEtaSegmentPlusOne+thisHit->etaIndex;
+ local_counter++;
+
+ volumeIndex = (localrow-fRowMin)*fNumPhiEtaSegmentPlusOne+thisHit->phiIndex*fNumEtaSegmentPlusOne+thisHit->etaIndex;
+
if(fVolume[volumeIndex].first == NULL)
fVolume[volumeIndex].first = (void *)thisHit;
else
- ((AliL3ConfMapPoint *)fVolume[volumeIndex].last)->nextVolumeHit=thisHit;
+ ((AliL3ConfMapPoint *)fVolume[volumeIndex].last)->nextVolumeHit=thisHit;
fVolume[volumeIndex].last = (void *)thisHit;
//set row pointers
- if(fRow[localrow].first == NULL)
- fRow[localrow].first = (void *)thisHit;
+ if(fRow[(localrow-fRowMin)].first == NULL)
+ fRow[(localrow-fRowMin)].first = (void *)thisHit;
else
- ((AliL3ConfMapPoint *)(fRow[localrow].last))->nextRowHit = thisHit;
- fRow[localrow].last = (void *)thisHit;
-
+ ((AliL3ConfMapPoint *)(fRow[(localrow-fRowMin)].last))->nextRowHit = thisHit;
+ fRow[(localrow-fRowMin)].last = (void *)thisHit;
+
+
}
+ if(fClustersUnused>0 && local_counter==0)
+ LOG(AliL3Log::kError,"AliL3ConfMapper::SetPointers","Parameters")
+ <<AliL3Log::kDec<<"No points passed to track finder, hits out of range: "
+ <<fEtaHitsOutOfRange+fPhiHitsOutOfRange<<ENDLOG;
+
+ LOG(AliL3Log::kInformational,"AliL3ConfMapper::SetPointers","Setup")
+ <<"Setup finished, hits out of range: "<<fEtaHitsOutOfRange+fPhiHitsOutOfRange
+ <<" hits accepted "<<fClustersUnused<<ENDLOG;
}
void AliL3ConfMapper::MainVertexTracking_a()
return;
}
-
+ Double_t initCpuTime,cpuTime;
+ initCpuTime = CpuTime();
SetPointers();
SetVertexConstraint(true);
+ cpuTime = CpuTime() - initCpuTime;
+ if(fBench)
+ LOG(AliL3Log::kInformational,"AliL3ConfMapper::MainVertexTracking_a","Timing")
+ <<AliL3Log::kDec<<"Setup finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
+
}
void AliL3ConfMapper::MainVertexTracking_b()
"Tracking parameters not set!"<<ENDLOG;
return;
}
-
+ Double_t initCpuTime,cpuTime;
+ initCpuTime = CpuTime();
+
ClusterLoop();
+
+ cpuTime = CpuTime() - initCpuTime;
+ if(fBench)
+ LOG(AliL3Log::kInformational,"AliL3ConfMapper::MainVertexTracking_b","Timing")
+ <<AliL3Log::kDec<<"Main Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
}
void AliL3ConfMapper::MainVertexTracking()
if(fBench)
LOG(AliL3Log::kInformational,"AliL3ConfMapper::MainVertexTracking","Timing")<<AliL3Log::kDec<<
"Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
-
+
return;
}
SetVertexConstraint(false);
ClusterLoop();
LOG(AliL3Log::kInformational,"AliL3ConfMapper::NonVertexTracking","ntracks")<<AliL3Log::kDec<<
- "Number of nonvertex tracks found: "<<nTracks-fMainVertexTracks<<ENDLOG;
-
+ "Number of nonvertex tracks found: "<<(nTracks-fMainVertexTracks)<<ENDLOG;
return;
}
SetMinPoints(tracklength,(Bool_t)true);
fMaxPhi=maxphi;
fMaxEta=maxeta;
-
}
void AliL3ConfMapper::NonVertexSettings(Int_t trackletlength, Int_t tracklength,
SetMinPoints(tracklength,(Bool_t)false);
}
-void AliL3ConfMapper::SetTrackCuts(Double_t hitChi2Cut, Double_t goodHitChi2, Int_t trackChi2Cut,Int_t maxdist)
+void AliL3ConfMapper::SetTrackCuts(Double_t hitChi2Cut, Double_t goodHitChi2, Double_t trackChi2Cut,Int_t maxdist,
+ Bool_t vertexconstraint)
{
//Settings for tracks. The cuts are:
//HitChi2Cut: Maximum hit chi2
//goodHitChi2: Chi2 to stop look for next hit
//trackChi2Cut: Maximum track chi2
//maxdist: Maximum distance between two clusters when forming segments
-
- fHitChi2Cut = hitChi2Cut;
- fGoodHitChi2 = goodHitChi2;
- fTrackChi2Cut = trackChi2Cut;
- fMaxDist = maxdist;
+
+ SetHitChi2Cut(hitChi2Cut,vertexconstraint);
+ SetGoodHitChi2(goodHitChi2,vertexconstraint);
+ SetTrackChi2Cut(trackChi2Cut,vertexconstraint);
+ SetMaxDist(maxdist,vertexconstraint);
}
void AliL3ConfMapper::SetTrackletCuts(Double_t maxangle,Double_t goodDist, Bool_t vertex_constraint)
for(row_segm = fRowMax; row_segm >= lastrow; row_segm--)
{
- if(fRow[row_segm].first && ((AliL3ConfMapPoint*)fRow[row_segm].first)->GetPadRow() < fRowMin + 1)
+ if(fRow[(row_segm-fRowMin)].first && ((AliL3ConfMapPoint*)fRow[(row_segm-fRowMin)].first)->GetPadRow() < fRowMin + 1)
break;
- for(hit = (AliL3ConfMapPoint*)fRow[row_segm].first; hit!=0; hit=hit->nextRowHit)
+ for(hit = (AliL3ConfMapPoint*)fRow[(row_segm-fRowMin)].first; hit!=0; hit=hit->nextRowHit)
{
if(hit->GetUsage() == true)
continue;
if(TrackletAngle(track) > fMaxAngleTracklet[fVertexConstraint])
{//proof if the first points seem to be a beginning of a track
-
track->SetProperties(false);
track->DeleteCandidate();
fTrack->RemoveLast();
for(point = fTrackletLength[fVertexConstraint]; point <= fNumRowSegment; point++)
{
- track->fChiSq[0] = fHitChi2Cut;
+ track->fChiSq[0] = fHitChi2Cut[fVertexConstraint];
closest_hit = GetNextNeighbor((AliL3ConfMapPoint*)track->lastHit,track);
if(closest_hit)
//add closest hit to track
closest_hit->SetUsage(true);
closest_hit->SetTrackNumber(tracks-1);
-
+
}//closest_hit
-
+
else
{
//closest hit does not exist
Double_t normalized_chi2 = (track->fChiSq[0]+track->fChiSq[1])/track->GetNumberOfPoints();
//remove tracks with not enough points already now
- if(track->GetNumberOfPoints() < fMinPoints[fVertexConstraint] || normalized_chi2 > fTrackChi2Cut)
+ if(track->GetNumberOfPoints() < fMinPoints[fVertexConstraint] || normalized_chi2 > fTrackChi2Cut[fVertexConstraint])
{
track->SetProperties(false);
nTracks--;
//When forming segments: Finds closest hit to input hit
//When forming tracks: Find closest hit to track fit.
- Double_t dist,closest_dist = fMaxDist;
+ Double_t dist,closest_dist = fMaxDist[fVertexConstraint];
AliL3ConfMapPoint *hit = NULL;
AliL3ConfMapPoint *closest_hit = NULL;
continue;//segment exceeds bounds->skip it
//loop over hits in this sub segment:
- volumeIndex= sub_row_segm*fNumPhiEtaSegmentPlusOne +
+ volumeIndex= (sub_row_segm-fRowMin)*fNumPhiEtaSegmentPlusOne +
sub_phi_segm*fNumEtaSegmentPlusOne + sub_eta_segm;
if(volumeIndex<0)
hit->SetS(slocal);
//if chi2 good enough, stop here:
- if(lchi2 < fGoodHitChi2)
+ if(lchi2 < fGoodHitChi2[fVertexConstraint])
return 2;
return 1;
Double_t phi_diff = fabs( hit1->GetPhi() - hit2->GetPhi() );
if (phi_diff > pi) phi_diff = twopi - phi_diff;
- return todeg*fabs(hit1->GetPadRow() - hit2->GetPadRow()) * (phi_diff + fabs( hit1->GetEta() - hit2->GetEta() ));
+ return todeg*fabs((Float_t)((hit1->GetPadRow() - hit2->GetPadRow()) * (phi_diff + fabs( hit1->GetEta() - hit2->GetEta()))));
}
Bool_t AliL3ConfMapper::VerifyRange(const AliL3ConfMapPoint *hit1,const AliL3ConfMapPoint *hit2) const
Double_t AliL3ConfMapper::CpuTime()
{
//Return the Cputime in seconds.
-
- return (Double_t)(clock()) / CLOCKS_PER_SEC;
+ struct timeval tv;
+ gettimeofday( &tv, NULL );
+ return tv.tv_sec+(((Double_t)tv.tv_usec)/1000000.);
+ //return (Double_t)(clock()) / CLOCKS_PER_SEC;
}