/// \class AliMUONVTrackReconstructor
/// Virtual MUON track reconstructor in ALICE (class renamed from AliMUONEventReconstructor)
///
-/// This class contains as data:
-/// * a pointer to the array of hits to be reconstructed (the event)
-/// * a pointer to the array of reconstructed tracks
+/// This class contains as data a pointer to the array of reconstructed tracks
///
/// It contains as methods, among others:
/// * EventReconstruct to build the muon tracks
/// * EventReconstructTrigger to build the trigger tracks
+/// * ValidateTracksWithTrigger to match tracker/trigger tracks
///
-/// Several options and adjustable parameters are available for both Kalman and Original
-/// tracking algorithms (hard coded for the moment in AliMUONVTrackReconstructor.cxx):
+/// Several options and adjustable parameters are available for both KALMAN and ORIGINAL
+/// tracking algorithms. They can be changed through the AliMUONRecoParam object
+/// set in the reconstruction macro or read from the CDB
+/// (see methods in AliMUONRecoParam.h file for details)
+///
+/// Main parameters and options are:
/// - *fgkSigmaToCutForTracking* : quality cut used to select new clusters to be
/// attached to the track candidate and to select good tracks.
/// - *fgkMakeTrackCandidatesFast* : if this flag is set to 'true', the track candidates
/// previous station.
/// - *fgkImproveTracks* : if this flag is set to 'true', we try to improve the quality
/// of the tracks at the end of the tracking by removing clusters that do not pass
-/// new quality cut (within the limit that we must keep at least one cluster per
-/// the station).
+/// new quality cut (the track is removed is it does not contain enough cluster anymore).
+/// - *fgkComplementTracks* : if this flag is set to 'true', we try to improve the quality
+/// of the tracks at the end of the tracking by adding potentially missing clusters
+/// (we may have 2 clusters in the same chamber because of the overlapping of detection
+/// elements, which is not handle by the tracking algorithm).
/// - *fgkSigmaToCutForImprovement* : quality cut used when we try to improve the
/// quality of the tracks.
///
#include "AliMUONVTrackReconstructor.h"
#include "AliMUONConstants.h"
-#include "AliMUONRawCluster.h"
-#include "AliMUONHitForRec.h"
#include "AliMUONObjectPair.h"
#include "AliMUONTriggerTrack.h"
#include "AliMUONTriggerCircuit.h"
#include "AliMUONTrackHitPattern.h"
#include "AliMUONVTrackStore.h"
#include "AliMUONVClusterStore.h"
-#include "AliMUONRawCluster.h"
+#include "AliMUONVCluster.h"
+#include "AliMUONVClusterServer.h"
#include "AliMUONVTriggerStore.h"
#include "AliMUONVTriggerTrackStore.h"
+#include "AliMUONRecoParam.h"
+
#include "AliMpDEManager.h"
+#include "AliMpArea.h"
+
+#include "AliMpDDLStore.h"
+#include "AliMpVSegmentation.h"
+#include "AliMpSegmentation.h"
+#include "AliMpPad.h"
#include "AliLog.h"
#include "AliCodeTimer.h"
#include <TClonesArray.h>
#include <TMath.h>
#include <TMatrixD.h>
+#include <TVector2.h>
#include <Riostream.h>
ClassImp(AliMUONVTrackReconstructor) // Class implementation in ROOT context
/// \endcond
-
-//************* Defaults parameters for reconstruction
-const Double_t AliMUONVTrackReconstructor::fgkDefaultMinBendingMomentum = 3.0;
-const Double_t AliMUONVTrackReconstructor::fgkDefaultMaxBendingMomentum = 3000.0;
-const Double_t AliMUONVTrackReconstructor::fgkDefaultMaxNormChi2MatchTrigger = 16.0;
-const Double_t AliMUONVTrackReconstructor::fgkMaxTrackingDistanceBending = 2.;
-const Double_t AliMUONVTrackReconstructor::fgkMaxTrackingDistanceNonBending = 2.;
-
-const Double_t AliMUONVTrackReconstructor::fgkSigmaToCutForTracking = 6.0;
-const Bool_t AliMUONVTrackReconstructor::fgkMakeTrackCandidatesFast = kFALSE;
-const Bool_t AliMUONVTrackReconstructor::fgkTrackAllTracks = kTRUE;
-const Bool_t AliMUONVTrackReconstructor::fgkRecoverTracks = kTRUE;
-const Bool_t AliMUONVTrackReconstructor::fgkComplementTracks = kTRUE;
-const Bool_t AliMUONVTrackReconstructor::fgkImproveTracks = kTRUE;
-const Double_t AliMUONVTrackReconstructor::fgkSigmaToCutForImprovement = 5.0;
-
-
//__________________________________________________________________________
-AliMUONVTrackReconstructor::AliMUONVTrackReconstructor()
- : TObject(),
- fMinBendingMomentum(fgkDefaultMinBendingMomentum),
- fMaxBendingMomentum(fgkDefaultMaxBendingMomentum),
- fMaxNormChi2MatchTrigger(fgkDefaultMaxNormChi2MatchTrigger),
- fHitsForRecPtr(0x0),
- fNHitsForRec(0),
- fNHitsForRecPerChamber(0x0),
- fIndexOfFirstHitForRecPerChamber(0x0),
- fRecTracksPtr(0x0),
- fNRecTracks(0)
+AliMUONVTrackReconstructor::AliMUONVTrackReconstructor(const AliMUONRecoParam* recoParam,
+ AliMUONVClusterServer* clusterServer)
+: TObject(),
+fRecTracksPtr(0x0),
+fNRecTracks(0),
+fClusterServer(clusterServer),
+fkRecoParam(recoParam),
+fMaxMCSAngle2(0x0)
{
/// Constructor for class AliMUONVTrackReconstructor
- fNHitsForRecPerChamber = new Int_t[AliMUONConstants::NTrackingCh()];
- fIndexOfFirstHitForRecPerChamber = new Int_t[AliMUONConstants::NTrackingCh()];
-
- // Memory allocation for the TClonesArray of hits for reconstruction
- // Is 10000 the right size ????
- fHitsForRecPtr = new TClonesArray("AliMUONHitForRec", 10000);
+ /// WARNING: if clusterServer=0x0, no clusterization will be possible at this level
// Memory allocation for the TClonesArray of reconstructed tracks
- fRecTracksPtr = new TClonesArray("AliMUONTrack", 10);
+ fRecTracksPtr = new TClonesArray("AliMUONTrack", 100);
// set the magnetic field for track extrapolations
- const AliMagF* kField = AliTracker::GetFieldMap();
- if (!kField) AliFatal("No field available");
- AliMUONTrackExtrap::SetField(kField);
+ AliMUONTrackExtrap::SetField();
+
+ // set the maximum MCS angle in chamber from the minimum acceptable momentum
+ AliMUONTrackParam param;
+ Double_t inverseBendingP = (GetRecoParam()->GetMinBendingMomentum() > 0.) ? 1./GetRecoParam()->GetMinBendingMomentum() : 1.;
+ param.SetInverseBendingMomentum(inverseBendingP);
+ fMaxMCSAngle2 = new Double_t [AliMUONConstants::NTrackingCh()];
+ for (Int_t iCh=0; iCh<AliMUONConstants::NTrackingCh(); iCh++)
+ fMaxMCSAngle2[iCh] = AliMUONTrackExtrap::GetMCSAngle2(param, AliMUONConstants::ChamberThicknessInX0(iCh), 1.);
+
}
//__________________________________________________________________________
AliMUONVTrackReconstructor::~AliMUONVTrackReconstructor()
{
/// Destructor for class AliMUONVTrackReconstructor
- delete [] fNHitsForRecPerChamber;
- delete [] fIndexOfFirstHitForRecPerChamber;
- delete fHitsForRecPtr;
delete fRecTracksPtr;
-}
-
- //__________________________________________________________________________
-void AliMUONVTrackReconstructor::ResetHitsForRec()
-{
- /// To reset the TClonesArray of HitsForRec,
- /// and the number of HitForRec and the index of the first HitForRec per chamber
- if (fHitsForRecPtr) fHitsForRecPtr->Clear("C");
- fNHitsForRec = 0;
- for (Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++) {
- fNHitsForRecPerChamber[ch] = 0;
- fIndexOfFirstHitForRecPerChamber[ch] = 0;
- }
+ delete[] fMaxMCSAngle2;
}
//__________________________________________________________________________
}
//__________________________________________________________________________
-void AliMUONVTrackReconstructor::EventReconstruct(const AliMUONVClusterStore& clusterStore, AliMUONVTrackStore& trackStore)
+void AliMUONVTrackReconstructor::EventReconstruct(AliMUONVClusterStore& clusterStore, AliMUONVTrackStore& trackStore)
{
/// To reconstruct one event
AliDebug(1,"");
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
+ // Reset array of tracks
ResetTracks();
- ResetHitsForRec();
- AddHitsForRecFromRawClusters(clusterStore);
- MakeTracks();
-
+
+ // Look for candidates from clusters in stations(1..) 4 and 5 (abort in case of failure)
+ if (!MakeTrackCandidates(clusterStore)) return;
+
+ // Look for extra candidates from clusters in stations(1..) 4 and 5 (abort in case of failure)
+ if (GetRecoParam()->MakeMoreTrackCandidates()) {
+ if (!MakeMoreTrackCandidates(clusterStore)) return;
+ }
+
+ // Stop tracking if no candidate found
+ if (fRecTracksPtr->GetEntriesFast() == 0) return;
+
+ // Follow tracks in stations(1..) 3, 2 and 1 (abort in case of failure)
+ if (!FollowTracks(clusterStore)) return;
+
+ // Complement the reconstructed tracks
+ if (GetRecoParam()->ComplementTracks()) {
+ if (ComplementTracks(clusterStore)) RemoveIdenticalTracks();
+ }
+
+ // Improve the reconstructed tracks
+ if (GetRecoParam()->ImproveTracks()) ImproveTracks();
+
+ // Remove connected tracks
+ RemoveConnectedTracks(3, 4, kFALSE);
+ RemoveConnectedTracks(2, 2, kFALSE);
+ if (GetRecoParam()->RemoveConnectedTracksInSt12()) RemoveConnectedTracks(0, 1, kFALSE);
+
+ // Fill AliMUONTrack data members
+ Finalize();
+ if (!GetRecoParam()->RemoveConnectedTracksInSt12()) TagConnectedTracks(0, 1, kTRUE);
+
// Add tracks to MUON data container
- for (Int_t i=0; i<fNRecTracks; ++i)
+ for (Int_t i=0; i<fNRecTracks; ++i)
{
AliMUONTrack * track = (AliMUONTrack*) fRecTracksPtr->At(i);
- trackStore.Add(*track);
+ if (track->GetGlobalChi2() < AliMUONTrack::MaxChi2()) {
+ track->SetUniqueID(i+1);
+ trackStore.Add(*track);
+ } else AliWarning("problem occur somewhere during track refitting --> discard track");
}
}
- //__________________________________________________________________________
-void AliMUONVTrackReconstructor::AddHitsForRecFromRawClusters(const AliMUONVClusterStore& clusterStore)
+//__________________________________________________________________________
+Bool_t AliMUONVTrackReconstructor::IsAcceptable(AliMUONTrackParam &trackParam)
{
- /// Build internal array of hit for rec from clusterStore
+ /// Return kTRUE if the track is within given limits on momentum/angle/origin
- TIter next(clusterStore.CreateIterator());
- AliMUONRawCluster* clus(0x0);
- Int_t iclus(0);
+ const TMatrixD& kParamCov = trackParam.GetCovariances();
+ Int_t chamber = trackParam.GetClusterPtr()->GetChamberId();
+ Double_t z = trackParam.GetZ();
+ Double_t sigmaCut = GetRecoParam()->GetSigmaCutForTracking();
- while ( ( clus = static_cast<AliMUONRawCluster*>(next()) ) )
- {
- // new AliMUONHitForRec from raw cluster
- // and increment number of AliMUONHitForRec's (total and in chamber)
- AliMUONHitForRec* hitForRec = new ((*fHitsForRecPtr)[fNHitsForRec]) AliMUONHitForRec(clus);
- fNHitsForRec++;
- // more information into HitForRec
- hitForRec->SetBendingReso2(clus->GetErrY() * clus->GetErrY());
- hitForRec->SetNonBendingReso2(clus->GetErrX() * clus->GetErrX());
- // original raw cluster
- Int_t ch = AliMpDEManager::GetChamberId(clus->GetDetElemId());
- hitForRec->SetChamberNumber(ch);
- hitForRec->SetHitNumber(iclus);
- // Z coordinate of the raw cluster (cm)
- hitForRec->SetZ(clus->GetZ());
- if (AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 3) {
- cout << "Chamber " << ch <<" raw cluster " << iclus << " : " << endl;
- clus->Print("full");
- cout << "AliMUONHitForRec number (1...): " << fNHitsForRec << endl;
- hitForRec->Print("full");
+ // MCS dipersion
+ Double_t angleMCS2 = 0.;
+ Double_t impactMCS2 = 0.;
+ if (AliMUONTrackExtrap::IsFieldON() && chamber < 6) {
+
+ // track momentum is known
+ for (Int_t iCh=0; iCh<=chamber; iCh++) {
+ Double_t localMCS2 = AliMUONTrackExtrap::GetMCSAngle2(trackParam, AliMUONConstants::ChamberThicknessInX0(iCh), 1.);
+ angleMCS2 += localMCS2;
+ impactMCS2 += AliMUONConstants::DefaultChamberZ(chamber) * AliMUONConstants::DefaultChamberZ(chamber) * localMCS2;
}
- ++iclus;
- } // end of chamber loop
-
- SortHitsForRecWithIncreasingChamber();
-
- AliDebug(1,"End of AddHitsForRecFromRawClusters");
-
- if (AliLog::GetGlobalDebugLevel() > 0)
- {
- AliDebug(1, Form("NHitsForRec: %d",fNHitsForRec));
- for (Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++)
- {
- AliDebug(1, Form("Chamber(0...): %d",ch));
- AliDebug(1, Form("NHitsForRec: %d", fNHitsForRecPerChamber[ch]));
- AliDebug(1, Form("Index(first HitForRec): %d", fIndexOfFirstHitForRecPerChamber[ch]));
- for (Int_t hit = fIndexOfFirstHitForRecPerChamber[ch];
- hit < fIndexOfFirstHitForRecPerChamber[ch] + fNHitsForRecPerChamber[ch];
- hit++) {
- AliDebug(1, Form("HitForRec index(0...): %d",hit));
- ((*fHitsForRecPtr)[hit])->Dump();
- }
+
+ } else {
+
+ // track momentum is unknown
+ for (Int_t iCh=0; iCh<=chamber; iCh++) {
+ angleMCS2 += fMaxMCSAngle2[iCh];
+ impactMCS2 += AliMUONConstants::DefaultChamberZ(chamber) * AliMUONConstants::DefaultChamberZ(chamber) * fMaxMCSAngle2[iCh];
}
+
}
-}
-
- //__________________________________________________________________________
-void AliMUONVTrackReconstructor::SortHitsForRecWithIncreasingChamber()
-{
- /// Sort HitsForRec's in increasing order with respect to chamber number.
- /// Uses the function "Compare".
- /// Update the information for HitsForRec per chamber too.
- Int_t ch, nhits, prevch;
- fHitsForRecPtr->Sort();
- for (ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++) {
- fNHitsForRecPerChamber[ch] = 0;
- fIndexOfFirstHitForRecPerChamber[ch] = 0;
+
+ // ------ track selection in non bending direction ------
+ if (GetRecoParam()->SelectOnTrackSlope()) {
+
+ // check if non bending slope is within tolerances
+ Double_t nonBendingSlopeErr = TMath::Sqrt(kParamCov(1,1) + angleMCS2);
+ if ((TMath::Abs(trackParam.GetNonBendingSlope()) - sigmaCut * nonBendingSlopeErr) > GetRecoParam()->GetMaxNonBendingSlope()) return kFALSE;
+
+ } else {
+
+ // or check if non bending impact parameter is within tolerances
+ Double_t nonBendingImpactParam = TMath::Abs(trackParam.GetNonBendingCoor() - z * trackParam.GetNonBendingSlope());
+ Double_t nonBendingImpactParamErr = TMath::Sqrt(kParamCov(0,0) + z * z * kParamCov(1,1) - 2. * z * kParamCov(0,1) + impactMCS2);
+ if ((nonBendingImpactParam - sigmaCut * nonBendingImpactParamErr) > (3. * GetRecoParam()->GetNonBendingVertexDispersion())) return kFALSE;
+
}
- prevch = 0; // previous chamber
- nhits = 0; // number of hits in current chamber
- // Loop over HitsForRec
- for (Int_t hit = 0; hit < fNHitsForRec; hit++) {
- // chamber number (0...)
- ch = ((AliMUONHitForRec*) ((*fHitsForRecPtr)[hit]))->GetChamberNumber();
- // increment number of hits in current chamber
- (fNHitsForRecPerChamber[ch])++;
- // update index of first HitForRec in current chamber
- // if chamber number different from previous one
- if (ch != prevch) {
- fIndexOfFirstHitForRecPerChamber[ch] = hit;
- prevch = ch;
+
+ // ------ track selection in bending direction ------
+ if (AliMUONTrackExtrap::IsFieldON()) { // depending whether the field is ON or OFF
+
+ // check if bending momentum is within tolerances
+ Double_t bendingMomentum = TMath::Abs(1. / trackParam.GetInverseBendingMomentum());
+ Double_t bendingMomentumErr = TMath::Sqrt(kParamCov(4,4)) * bendingMomentum * bendingMomentum;
+ if (chamber < 6 && (bendingMomentum + sigmaCut * bendingMomentumErr) < GetRecoParam()->GetMinBendingMomentum()) return kFALSE;
+ else if ((bendingMomentum + 3. * bendingMomentumErr) < GetRecoParam()->GetMinBendingMomentum()) return kFALSE;
+
+ } else {
+
+ if (GetRecoParam()->SelectOnTrackSlope()) {
+
+ // check if bending slope is within tolerances
+ Double_t bendingSlopeErr = TMath::Sqrt(kParamCov(3,3) + angleMCS2);
+ if ((TMath::Abs(trackParam.GetBendingSlope()) - sigmaCut * bendingSlopeErr) > GetRecoParam()->GetMaxBendingSlope()) return kFALSE;
+
+ } else {
+
+ // or check if bending impact parameter is within tolerances
+ Double_t bendingImpactParam = TMath::Abs(trackParam.GetBendingCoor() - z * trackParam.GetBendingSlope());
+ Double_t bendingImpactParamErr = TMath::Sqrt(kParamCov(2,2) + z * z * kParamCov(3,3) - 2. * z * kParamCov(2,3) + impactMCS2);
+ if ((bendingImpactParam - sigmaCut * bendingImpactParamErr) > (3. * GetRecoParam()->GetBendingVertexDispersion())) return kFALSE;
+
}
+
}
- return;
-}
-
- //__________________________________________________________________________
-void AliMUONVTrackReconstructor::MakeTracks()
-{
- /// To make the tracks from the list of segments and points in all stations
- AliDebug(1,"Enter MakeTracks");
- // Look for candidates from at least 3 aligned points in stations(1..) 4 and 5
- MakeTrackCandidates();
- if (fRecTracksPtr->GetEntriesFast() == 0) return;
- // Follow tracks in stations(1..) 3, 2 and 1
- FollowTracks();
- // Complement the reconstructed tracks
- if (fgkComplementTracks) ComplementTracks();
- // Improve the reconstructed tracks
- if (fgkImproveTracks) ImproveTracks();
- // Remove double tracks
- RemoveDoubleTracks();
- // Fill AliMUONTrack data members
- Finalize();
+
+ return kTRUE;
+
}
- //__________________________________________________________________________
-TClonesArray* AliMUONVTrackReconstructor::MakeSegmentsInStation(Int_t station)
+//__________________________________________________________________________
+TClonesArray* AliMUONVTrackReconstructor::MakeSegmentsBetweenChambers(const AliMUONVClusterStore& clusterStore, Int_t ch1, Int_t ch2)
{
- /// To make the list of segments in station(0..) "Station" from the list of hits to be reconstructed.
+ /// To make the list of segments from the list of clusters in the 2 given chambers.
/// Return a new TClonesArray of segments.
/// It is the responsibility of the user to delete it afterward.
- AliDebug(1,Form("Enter MakeSegmentsPerStation (0...) %d",station));
+ AliDebug(1,Form("Enter MakeSegmentsBetweenChambers (1..) %d-%d", ch1+1, ch2+1));
+ AliCodeTimerAuto("",0);
- AliMUONHitForRec *hit1Ptr, *hit2Ptr;
+ AliMUONVCluster *cluster1, *cluster2;
AliMUONObjectPair *segment;
- Double_t bendingSlope = 0, impactParam = 0., bendingMomentum = 0.; // to avoid compilation warning
- // first and second chambers (0...) in the station
- Int_t ch1 = 2 * station;
- Int_t ch2 = ch1 + 1;
+ Double_t z1 = 0., z2 = 0., dZ = 0.;
+ Double_t nonBendingSlope = 0., nonBendingSlopeErr = 0., nonBendingImpactParam = 0., nonBendingImpactParamErr = 0.;
+ Double_t bendingSlope = 0., bendingSlopeErr = 0., bendingImpactParam = 0., bendingImpactParamErr = 0., bendingImpactParamErr2 = 0.;
+ Double_t bendingMomentum = 0., bendingMomentumErr = 0.;
+ Double_t bendingVertexDispersion2 = GetRecoParam()->GetBendingVertexDispersion() * GetRecoParam()->GetBendingVertexDispersion();
+ Double_t angleMCS2 = 0.; // maximum angular dispersion**2 due to MCS in chamber
+ Double_t impactMCS2 = 0.; // maximum impact parameter dispersion**2 due to MCS in chamber
+ for (Int_t iCh=0; iCh<=ch1; iCh++) {
+ angleMCS2 += fMaxMCSAngle2[iCh];
+ impactMCS2 += AliMUONConstants::DefaultChamberZ(iCh) * AliMUONConstants::DefaultChamberZ(iCh) * fMaxMCSAngle2[iCh];
+ }
+ Double_t sigmaCut = GetRecoParam()->GetSigmaCutForTracking();
+
+ // Create iterators to loop over clusters in both chambers
+ TIter nextInCh1(clusterStore.CreateChamberIterator(ch1,ch1));
+ TIter nextInCh2(clusterStore.CreateChamberIterator(ch2,ch2));
// list of segments
- TClonesArray *segments = new TClonesArray("AliMUONObjectPair", fNHitsForRecPerChamber[ch2]);
- segments->SetOwner(kTRUE);
+ TClonesArray *segments = new TClonesArray("AliMUONObjectPair", 100);
- // Loop over HitForRec's in the first chamber of the station
- for (Int_t hit1 = fIndexOfFirstHitForRecPerChamber[ch1];
- hit1 < fIndexOfFirstHitForRecPerChamber[ch1] + fNHitsForRecPerChamber[ch1];
- hit1++)
- {
- // pointer to the HitForRec
- hit1Ptr = (AliMUONHitForRec*) ((*fHitsForRecPtr)[hit1]);
- // Loop over HitsForRec's in the second chamber of the station
- for (Int_t hit2 = fIndexOfFirstHitForRecPerChamber[ch2];
- hit2 < fIndexOfFirstHitForRecPerChamber[ch2] + fNHitsForRecPerChamber[ch2];
- hit2++)
- {
- // pointer to the HitForRec
- hit2Ptr = (AliMUONHitForRec*) ((*fHitsForRecPtr)[hit2]);
- if ( hit1Ptr->GetZ() - hit2Ptr->GetZ() != 0. )
- {
- // bending slope
- bendingSlope = (hit1Ptr->GetBendingCoor() - hit2Ptr->GetBendingCoor()) / (hit1Ptr->GetZ() - hit2Ptr->GetZ());
- // impact parameter
- impactParam = hit1Ptr->GetBendingCoor() - hit1Ptr->GetZ() * bendingSlope;
- // absolute value of bending momentum
- bendingMomentum = TMath::Abs(AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(impactParam));
- } else
- {
- AliWarning("hit1Ptr->GetZ() = hit2Ptr->GetZ(): no segment created");
- continue;
- }
- // check for bending momentum within tolerances
- if ((bendingMomentum < fMaxBendingMomentum) && (bendingMomentum > fMinBendingMomentum))
- {
- // make new segment
- segment = new ((*segments)[segments->GetLast()+1]) AliMUONObjectPair(hit1Ptr, hit2Ptr, kFALSE, kFALSE);
- if (AliLog::GetGlobalDebugLevel() > 1) {
- cout << "segmentIndex(0...): " << segments->GetLast() << endl;
- segment->Dump();
- cout << "HitForRec in first chamber" << endl;
- hit1Ptr->Dump();
- cout << "HitForRec in second chamber" << endl;
- hit2Ptr->Dump();
- }
+ // Loop over clusters in the first chamber of the station
+ while ( ( cluster1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
+ z1 = cluster1->GetZ();
+
+ // reset cluster iterator of chamber 2
+ nextInCh2.Reset();
+
+ // Loop over clusters in the second chamber of the station
+ while ( ( cluster2 = static_cast<AliMUONVCluster*>(nextInCh2()) ) ) {
+ z2 = cluster2->GetZ();
+ dZ = z1 - z2;
+
+ // ------ track selection in non bending direction ------
+ nonBendingSlope = (cluster1->GetX() - cluster2->GetX()) / dZ;
+ if (GetRecoParam()->SelectOnTrackSlope()) {
+
+ // check if non bending slope is within tolerances
+ nonBendingSlopeErr = TMath::Sqrt((cluster1->GetErrX2() + cluster2->GetErrX2()) / dZ / dZ + angleMCS2);
+ if ((TMath::Abs(nonBendingSlope) - sigmaCut * nonBendingSlopeErr) > GetRecoParam()->GetMaxNonBendingSlope()) continue;
+
+ } else {
+
+ // or check if non bending impact parameter is within tolerances
+ nonBendingImpactParam = TMath::Abs(cluster1->GetX() - cluster1->GetZ() * nonBendingSlope);
+ nonBendingImpactParamErr = TMath::Sqrt((z1 * z1 * cluster2->GetErrX2() + z2 * z2 * cluster1->GetErrX2()) / dZ / dZ + impactMCS2);
+ if ((nonBendingImpactParam - sigmaCut * nonBendingImpactParamErr) > (3. * GetRecoParam()->GetNonBendingVertexDispersion())) continue;
+
+ }
+
+ // ------ track selection in bending direction ------
+ bendingSlope = (cluster1->GetY() - cluster2->GetY()) / dZ;
+ if (AliMUONTrackExtrap::IsFieldON()) { // depending whether the field is ON or OFF
+
+ // check if bending momentum is within tolerances
+ bendingImpactParam = cluster1->GetY() - cluster1->GetZ() * bendingSlope;
+ bendingImpactParamErr2 = (z1 * z1 * cluster2->GetErrY2() + z2 * z2 * cluster1->GetErrY2()) / dZ / dZ + impactMCS2;
+ bendingMomentum = TMath::Abs(AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(bendingImpactParam));
+ bendingMomentumErr = TMath::Sqrt((bendingVertexDispersion2 + bendingImpactParamErr2) /
+ bendingImpactParam / bendingImpactParam + 0.01) * bendingMomentum;
+ if ((bendingMomentum + 3. * bendingMomentumErr) < GetRecoParam()->GetMinBendingMomentum()) continue;
+
+ } else {
+
+ if (GetRecoParam()->SelectOnTrackSlope()) {
+
+ // check if bending slope is within tolerances
+ bendingSlopeErr = TMath::Sqrt((cluster1->GetErrY2() + cluster2->GetErrY2()) / dZ / dZ + angleMCS2);
+ if ((TMath::Abs(bendingSlope) - sigmaCut * bendingSlopeErr) > GetRecoParam()->GetMaxBendingSlope()) continue;
+
+ } else {
+
+ // or check if bending impact parameter is within tolerances
+ bendingImpactParam = TMath::Abs(cluster1->GetY() - cluster1->GetZ() * bendingSlope);
+ bendingImpactParamErr = TMath::Sqrt((z1 * z1 * cluster2->GetErrY2() + z2 * z2 * cluster1->GetErrY2()) / dZ / dZ + impactMCS2);
+ if ((bendingImpactParam - sigmaCut * bendingImpactParamErr) > (3. * GetRecoParam()->GetBendingVertexDispersion())) continue;
+
+ }
+
+ }
+
+ // make new segment
+ segment = new ((*segments)[segments->GetLast()+1]) AliMUONObjectPair(cluster1, cluster2, kFALSE, kFALSE);
+
+ // Printout for debug
+ if (AliLog::GetGlobalDebugLevel() > 1) {
+ cout << "segmentIndex(0...): " << segments->GetLast() << endl;
+ segment->Dump();
+ cout << "Cluster in first chamber" << endl;
+ cluster1->Print();
+ cout << "Cluster in second chamber" << endl;
+ cluster2->Print();
}
- } //for (Int_t hit2
- } // for (Int_t hit1...
- AliDebug(1,Form("Station: %d NSegments: %d ", station, segments->GetEntriesFast()));
+
+ }
+
+ }
+
+ // Printout for debug
+ AliDebug(1,Form("chambers%d-%d: NSegments = %d ", ch1+1, ch2+1, segments->GetEntriesFast()));
+
return segments;
}
+ //__________________________________________________________________________
+void AliMUONVTrackReconstructor::RemoveUsedSegments(TClonesArray& segments)
+{
+ /// To remove pairs of clusters already attached to a track
+ AliDebug(1,"Enter RemoveUsedSegments");
+ Int_t nSegments = segments.GetEntriesFast();
+ Int_t nTracks = fRecTracksPtr->GetEntriesFast();
+ AliMUONObjectPair *segment;
+ AliMUONTrack *track;
+ AliMUONVCluster *cluster, *cluster1, *cluster2;
+ Bool_t foundCluster1, foundCluster2, removeSegment;
+
+ // Loop over segments
+ for (Int_t iSegment=0; iSegment<nSegments; iSegment++) {
+ segment = (AliMUONObjectPair*) segments.UncheckedAt(iSegment);
+
+ cluster1 = (AliMUONVCluster*) segment->First();
+ cluster2 = (AliMUONVCluster*) segment->Second();
+ removeSegment = kFALSE;
+
+ // Loop over tracks
+ for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
+ track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iTrack);
+
+ // skip empty slot
+ if (!track) continue;
+
+ foundCluster1 = kFALSE;
+ foundCluster2 = kFALSE;
+
+ // Loop over clusters
+ Int_t nClusters = track->GetNClusters();
+ for (Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
+ cluster = ((AliMUONTrackParam*) track->GetTrackParamAtCluster()->UncheckedAt(iCluster))->GetClusterPtr();
+
+ // check if both clusters are in that track
+ if (cluster == cluster1) foundCluster1 = kTRUE;
+ else if (cluster == cluster2) foundCluster2 = kTRUE;
+
+ if (foundCluster1 && foundCluster2) {
+ removeSegment = kTRUE;
+ break;
+ }
+
+ }
+
+ if (removeSegment) break;
+
+ }
+
+ if (removeSegment) segments.RemoveAt(iSegment);
+
+ }
+
+ segments.Compress();
+
+ // Printout for debug
+ AliDebug(1,Form("NSegments = %d ", segments.GetEntriesFast()));
+}
+
//__________________________________________________________________________
void AliMUONVTrackReconstructor::RemoveIdenticalTracks()
{
/// To remove identical tracks:
- /// Tracks are considered identical if they have all their hits in common.
- /// One keeps the track with the larger number of hits if need be
- AliMUONTrack *track1, *track2, *trackToRemove;
- Int_t hitsInCommon, nHits1, nHits2;
- Bool_t removedTrack1;
+ /// Tracks are considered identical if they have all their clusters in common.
+ /// One keeps the track with the larger number of clusters if need be
+ AliMUONTrack *track1, *track2;
+ Int_t nTracks = fRecTracksPtr->GetEntriesFast();
+ Int_t clustersInCommon, nClusters1, nClusters2;
// Loop over first track of the pair
- track1 = (AliMUONTrack*) fRecTracksPtr->First();
- while (track1) {
- removedTrack1 = kFALSE;
- nHits1 = track1->GetNTrackHits();
+ for (Int_t iTrack1 = 0; iTrack1 < nTracks; iTrack1++) {
+ track1 = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iTrack1);
+ // skip empty slot
+ if (!track1) continue;
+ nClusters1 = track1->GetNClusters();
// Loop over second track of the pair
- track2 = (AliMUONTrack*) fRecTracksPtr->After(track1);
- while (track2) {
- nHits2 = track2->GetNTrackHits();
- // number of hits in common between two tracks
- hitsInCommon = track1->HitsInCommon(track2);
+ for (Int_t iTrack2 = iTrack1+1; iTrack2 < nTracks; iTrack2++) {
+ track2 = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iTrack2);
+ // skip empty slot
+ if (!track2) continue;
+ nClusters2 = track2->GetNClusters();
+ // number of clusters in common between two tracks
+ clustersInCommon = track1->ClustersInCommon(track2);
// check for identical tracks
- if ((hitsInCommon == nHits1) || (hitsInCommon == nHits2)) {
+ if ((clustersInCommon == nClusters1) || (clustersInCommon == nClusters2)) {
// decide which track to remove
- if (nHits2 > nHits1) {
+ if (nClusters2 > nClusters1) {
// remove track1 and continue the first loop with the track next to track1
- trackToRemove = track1;
- track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
- fRecTracksPtr->Remove(trackToRemove);
- fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
+ fRecTracksPtr->RemoveAt(iTrack1);
fNRecTracks--;
- removedTrack1 = kTRUE;
break;
} else {
// remove track2 and continue the second loop with the track next to track2
- trackToRemove = track2;
- track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
- fRecTracksPtr->Remove(trackToRemove);
- fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
+ fRecTracksPtr->RemoveAt(iTrack2);
fNRecTracks--;
}
- } else track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
+ }
} // track2
- if (removedTrack1) continue;
- track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
} // track1
- return;
+ fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
}
//__________________________________________________________________________
void AliMUONVTrackReconstructor::RemoveDoubleTracks()
{
/// To remove double tracks:
- /// Tracks are considered identical if more than half of the hits of the track
- /// which has the smaller number of hits are in common with the other track.
- /// Among two identical tracks, one keeps the track with the larger number of hits
+ /// Tracks are considered identical if more than half of the clusters of the track
+ /// which has the smaller number of clusters are in common with the other track.
+ /// Among two identical tracks, one keeps the track with the larger number of clusters
/// or, if these numbers are equal, the track with the minimum chi2.
- AliMUONTrack *track1, *track2, *trackToRemove;
- Int_t hitsInCommon, nHits1, nHits2;
- Bool_t removedTrack1;
+ AliMUONTrack *track1, *track2;
+ Int_t nTracks = fRecTracksPtr->GetEntriesFast();
+ Int_t clustersInCommon2, nClusters1, nClusters2;
// Loop over first track of the pair
- track1 = (AliMUONTrack*) fRecTracksPtr->First();
- while (track1) {
- removedTrack1 = kFALSE;
- nHits1 = track1->GetNTrackHits();
+ for (Int_t iTrack1 = 0; iTrack1 < nTracks; iTrack1++) {
+ track1 = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iTrack1);
+ // skip empty slot
+ if (!track1) continue;
+ nClusters1 = track1->GetNClusters();
// Loop over second track of the pair
- track2 = (AliMUONTrack*) fRecTracksPtr->After(track1);
- while (track2) {
- nHits2 = track2->GetNTrackHits();
- // number of hits in common between two tracks
- hitsInCommon = track1->HitsInCommon(track2);
+ for (Int_t iTrack2 = iTrack1+1; iTrack2 < nTracks; iTrack2++) {
+ track2 = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iTrack2);
+ // skip empty slot
+ if (!track2) continue;
+ nClusters2 = track2->GetNClusters();
+ // number of clusters in common between two tracks
+ clustersInCommon2 = 2 * track1->ClustersInCommon(track2);
// check for identical tracks
- if (((nHits1 < nHits2) && (2 * hitsInCommon > nHits1)) || (2 * hitsInCommon > nHits2)) {
+ if (clustersInCommon2 > nClusters1 || clustersInCommon2 > nClusters2) {
// decide which track to remove
- if ((nHits1 > nHits2) || ((nHits1 == nHits2) && (track1->GetFitFMin() <= track2->GetFitFMin()))) {
+ if ((nClusters1 > nClusters2) || ((nClusters1 == nClusters2) && (track1->GetGlobalChi2() <= track2->GetGlobalChi2()))) {
// remove track2 and continue the second loop with the track next to track2
- trackToRemove = track2;
- track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
- fRecTracksPtr->Remove(trackToRemove);
- fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
+ fRecTracksPtr->RemoveAt(iTrack2);
fNRecTracks--;
} else {
// else remove track1 and continue the first loop with the track next to track1
- trackToRemove = track1;
- track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
- fRecTracksPtr->Remove(trackToRemove);
- fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
+ fRecTracksPtr->RemoveAt(iTrack1);
fNRecTracks--;
- removedTrack1 = kTRUE;
break;
}
- } else track2 = (AliMUONTrack*) fRecTracksPtr->After(track2);
+ }
} // track2
- if (removedTrack1) continue;
- track1 = (AliMUONTrack*) fRecTracksPtr->After(track1);
} // track1
- return;
+ fRecTracksPtr->Compress(); // this is essential to retrieve the TClonesArray afterwards
}
//__________________________________________________________________________
-Double_t AliMUONVTrackReconstructor::TryOneHitForRec(const AliMUONTrackParam &trackParam, AliMUONHitForRec* hitForRec,
- AliMUONTrackParam &trackParamAtHit, Bool_t updatePropagator)
+void AliMUONVTrackReconstructor::RemoveConnectedTracks(Int_t stMin, Int_t stMax, Bool_t all)
{
-/// Test the compatibility between the track and the hitForRec (using trackParam's covariance matrix):
-/// return the corresponding Chi2
-/// return trackParamAtHit
+ /// Find and remove tracks sharing 1 cluster or more in station(s) [stMin, stMax].
+ /// For each couple of connected tracks, one removes the one with the smallest
+ /// number of clusters or with the highest chi2 value in case of equality.
+ /// If all=kTRUE: both tracks are removed.
- // extrapolate track parameters and covariances at the z position of the tested hit
- trackParamAtHit = trackParam;
- AliMUONTrackExtrap::ExtrapToZCov(&trackParamAtHit, hitForRec->GetZ(), updatePropagator);
+ // tag the tracks to be removed
+ TagConnectedTracks(stMin, stMax, all);
- // set pointer to hit into trackParamAtHit
- trackParamAtHit.SetHitForRecPtr(hitForRec);
+ // remove them
+ Int_t nTracks = fRecTracksPtr->GetEntriesFast();
+ for (Int_t i = 0; i < nTracks; i++) {
+ if (((AliMUONTrack*) fRecTracksPtr->UncheckedAt(i))->IsConnected()) {
+ fRecTracksPtr->RemoveAt(i);
+ fNRecTracks--;
+ }
+ }
+
+ // remove holes in the array if any
+ fRecTracksPtr->Compress();
+}
+
+ //__________________________________________________________________________
+void AliMUONVTrackReconstructor::TagConnectedTracks(Int_t stMin, Int_t stMax, Bool_t all)
+{
+ /// Find and tag tracks sharing 1 cluster or more in station(s) [stMin, stMax].
+ /// For each couple of connected tracks, one tags the one with the smallest
+ /// number of clusters or with the highest chi2 value in case of equality.
+ /// If all=kTRUE: both tracks are tagged.
- // Set differences between trackParam and hitForRec in the bending and non bending directions
- Double_t dX = hitForRec->GetNonBendingCoor() - trackParamAtHit.GetNonBendingCoor();
- Double_t dY = hitForRec->GetBendingCoor() - trackParamAtHit.GetBendingCoor();
+ AliMUONTrack *track1, *track2;
+ Int_t nClusters1, nClusters2;
+ Int_t nTracks = fRecTracksPtr->GetEntriesFast();
+
+ // reset the tags
+ for (Int_t i = 0; i < nTracks; i++) ((AliMUONTrack*) fRecTracksPtr->UncheckedAt(i))->Connected(kFALSE);
+
+ // Loop over first track of the pair
+ for (Int_t iTrack1 = 0; iTrack1 < nTracks; iTrack1++) {
+ track1 = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iTrack1);
+
+ // Loop over second track of the pair
+ for (Int_t iTrack2 = iTrack1+1; iTrack2 < nTracks; iTrack2++) {
+ track2 = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iTrack2);
+
+ // check for connected tracks and tag them
+ if (track1->ClustersInCommon(track2, stMin, stMax) > 0) {
+
+ if (all) {
+
+ // tag both tracks
+ track1->Connected();
+ track2->Connected();
+
+ } else {
+
+ // tag only the worst track
+ nClusters1 = track1->GetNClusters();
+ nClusters2 = track2->GetNClusters();
+ if ((nClusters1 > nClusters2) || ((nClusters1 == nClusters2) && (track1->GetGlobalChi2() <= track2->GetGlobalChi2()))) {
+ track2->Connected();
+ } else {
+ track1->Connected();
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+}
+
+ //__________________________________________________________________________
+void AliMUONVTrackReconstructor::AskForNewClustersInChamber(const AliMUONTrackParam &trackParam,
+ AliMUONVClusterStore& clusterStore, Int_t chamber)
+{
+ /// Ask the clustering to reconstruct new clusters around the track candidate position
+
+ // check if the current chamber is useable
+ if (!fClusterServer || !GetRecoParam()->UseChamber(chamber)) return;
+
+ // maximum distance between the center of the chamber and a detection element
+ // (accounting for the inclination of the chamber)
+ static const Double_t kMaxDZ = 15.; // 15 cm
+
+ // extrapolate track parameters to the chamber
+ AliMUONTrackParam extrapTrackParam(trackParam);
+ if (!AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParam, AliMUONConstants::DefaultChamberZ(chamber))) return;
+
+ // build the searching area using the track and chamber resolutions and the maximum-distance-to-track value
+ const TMatrixD& kParamCov = extrapTrackParam.GetCovariances();
+ Double_t errX2 = kParamCov(0,0) + kMaxDZ * kMaxDZ * kParamCov(1,1) + 2. * kMaxDZ * TMath::Abs(kParamCov(0,1)) +
+ GetRecoParam()->GetDefaultNonBendingReso(chamber) * GetRecoParam()->GetDefaultNonBendingReso(chamber);
+ Double_t errY2 = kParamCov(2,2) + kMaxDZ * kMaxDZ * kParamCov(3,3) + 2. * kMaxDZ * TMath::Abs(kParamCov(2,3)) +
+ GetRecoParam()->GetDefaultBendingReso(chamber) * GetRecoParam()->GetDefaultBendingReso(chamber);
+ Double_t dX = TMath::Abs(trackParam.GetNonBendingSlope()) * kMaxDZ +
+ GetRecoParam()->GetMaxNonBendingDistanceToTrack() +
+ GetRecoParam()->GetSigmaCutForTracking() * TMath::Sqrt(2. * errX2);
+ Double_t dY = TMath::Abs(trackParam.GetBendingSlope()) * kMaxDZ +
+ GetRecoParam()->GetMaxBendingDistanceToTrack() +
+ GetRecoParam()->GetSigmaCutForTracking() * TMath::Sqrt(2. * errY2);
+ AliMpArea area(extrapTrackParam.GetNonBendingCoor(),
+ extrapTrackParam.GetBendingCoor(),
+ dX, dY);
+
+ // ask to cluterize in the given area of the given chamber
+ fClusterServer->Clusterize(chamber, clusterStore, area, GetRecoParam());
+
+}
+
+ //__________________________________________________________________________
+void AliMUONVTrackReconstructor::AskForNewClustersInStation(const AliMUONTrackParam &trackParam,
+ AliMUONVClusterStore& clusterStore, Int_t station)
+{
+ /// Ask the clustering to reconstruct new clusters around the track candidate position
+ /// in the 2 chambers of the given station
+ AskForNewClustersInChamber(trackParam, clusterStore, 2*station+1);
+ AskForNewClustersInChamber(trackParam, clusterStore, 2*station);
+}
+
+ //__________________________________________________________________________
+Double_t AliMUONVTrackReconstructor::TryOneCluster(const AliMUONTrackParam &trackParam, AliMUONVCluster* cluster,
+ AliMUONTrackParam &trackParamAtCluster, Bool_t updatePropagator)
+{
+/// Test the compatibility between the track and the cluster (using trackParam's covariance matrix):
+/// return the corresponding Chi2
+/// return trackParamAtCluster
+
+ // extrapolate track parameters and covariances at the z position of the tested cluster
+ // and set pointer to cluster into trackParamAtCluster
+ trackParamAtCluster = trackParam;
+ trackParamAtCluster.SetClusterPtr(cluster);
+ if (!AliMUONTrackExtrap::ExtrapToZCov(&trackParamAtCluster, cluster->GetZ(), updatePropagator))
+ return 2.*AliMUONTrack::MaxChi2();
+
+ // Set differences between trackParam and cluster in the bending and non bending directions
+ Double_t dX = cluster->GetX() - trackParamAtCluster.GetNonBendingCoor();
+ Double_t dY = cluster->GetY() - trackParamAtCluster.GetBendingCoor();
// Calculate errors and covariances
- const TMatrixD& kParamCov = trackParamAtHit.GetCovariances();
- Double_t sigma2X = kParamCov(0,0) + hitForRec->GetNonBendingReso2();
- Double_t sigma2Y = kParamCov(2,2) + hitForRec->GetBendingReso2();
+ const TMatrixD& kParamCov = trackParamAtCluster.GetCovariances();
+ Double_t sigmaX2 = kParamCov(0,0) + cluster->GetErrX2();
+ Double_t sigmaY2 = kParamCov(2,2) + cluster->GetErrY2();
+ Double_t covXY = kParamCov(0,2);
+ Double_t det = sigmaX2 * sigmaY2 - covXY * covXY;
// Compute chi2
- return dX * dX / sigma2X + dY * dY / sigma2Y;
+ if (det == 0.) return 2.*AliMUONTrack::MaxChi2();
+ return (dX * dX * sigmaY2 + dY * dY * sigmaX2 - 2. * dX * dY * covXY) / det;
}
//__________________________________________________________________________
-Bool_t AliMUONVTrackReconstructor::TryOneHitForRecFast(const AliMUONTrackParam &trackParam, AliMUONHitForRec* hitForRec)
+Bool_t AliMUONVTrackReconstructor::TryOneClusterFast(const AliMUONTrackParam &trackParam, const AliMUONVCluster* cluster)
{
-/// Test the compatibility between the track and the hitForRec within a wide fix window
-/// assuming linear propagation of the track:
+/// Test the compatibility between the track and the cluster
+/// given the track and cluster resolutions + the maximum-distance-to-track value
+/// and assuming linear propagation of the track:
/// return kTRUE if they are compatibles
- Double_t dZ = hitForRec->GetZ() - trackParam.GetZ();
- Double_t dX = hitForRec->GetNonBendingCoor() - (trackParam.GetNonBendingCoor() + trackParam.GetNonBendingSlope() * dZ);
- Double_t dY = hitForRec->GetBendingCoor() - (trackParam.GetBendingCoor() + trackParam.GetBendingSlope() * dZ);
+ Double_t dZ = cluster->GetZ() - trackParam.GetZ();
+ Double_t dX = cluster->GetX() - (trackParam.GetNonBendingCoor() + trackParam.GetNonBendingSlope() * dZ);
+ Double_t dY = cluster->GetY() - (trackParam.GetBendingCoor() + trackParam.GetBendingSlope() * dZ);
+ const TMatrixD& kParamCov = trackParam.GetCovariances();
+ Double_t errX2 = kParamCov(0,0) + dZ * dZ * kParamCov(1,1) + 2. * dZ * kParamCov(0,1) + cluster->GetErrX2();
+ Double_t errY2 = kParamCov(2,2) + dZ * dZ * kParamCov(3,3) + 2. * dZ * kParamCov(2,3) + cluster->GetErrY2();
+
+ Double_t dXmax = GetRecoParam()->GetSigmaCutForTracking() * TMath::Sqrt(2. * errX2) +
+ GetRecoParam()->GetMaxNonBendingDistanceToTrack();
+ Double_t dYmax = GetRecoParam()->GetSigmaCutForTracking() * TMath::Sqrt(2. * errY2) +
+ GetRecoParam()->GetMaxBendingDistanceToTrack();
- if (TMath::Abs(dX) > fgkMaxTrackingDistanceNonBending || TMath::Abs(dY) > fgkMaxTrackingDistanceBending) return kFALSE;
+ if (TMath::Abs(dX) > dXmax || TMath::Abs(dY) > dYmax) return kFALSE;
return kTRUE;
}
//__________________________________________________________________________
-Double_t AliMUONVTrackReconstructor::TryTwoHitForRecFast(const AliMUONTrackParam &trackParamAtHit1, AliMUONHitForRec* hitForRec2,
- AliMUONTrackParam &trackParamAtHit2)
+Double_t AliMUONVTrackReconstructor::TryTwoClustersFast(const AliMUONTrackParam &trackParamAtCluster1, AliMUONVCluster* cluster2,
+ AliMUONTrackParam &trackParamAtCluster2)
{
-/// Test the compatibility between the track and the 2 hitForRec together (using trackParam's covariance matrix)
-/// assuming linear propagation between the two hits:
-/// return the corresponding Chi2 accounting for covariances between the 2 hitForRec
-/// return trackParamAtHit1 & 2
+/// Test the compatibility between the track and the 2 clusters together (using trackParam's covariance matrix)
+/// assuming linear propagation between the two clusters:
+/// return the corresponding Chi2 accounting for covariances between the 2 clusters
+/// return trackParamAtCluster2
- // extrapolate linearly track parameters at the z position of the second hit
- trackParamAtHit2 = trackParamAtHit1;
- AliMUONTrackExtrap::LinearExtrapToZ(&trackParamAtHit2, hitForRec2->GetZ());
+ // extrapolate linearly track parameters and covariances at the z position of the second cluster
+ trackParamAtCluster2 = trackParamAtCluster1;
+ AliMUONTrackExtrap::LinearExtrapToZCov(&trackParamAtCluster2, cluster2->GetZ());
- // set pointer to hit2 into trackParamAtHit2
- trackParamAtHit2.SetHitForRecPtr(hitForRec2);
+ // set pointer to cluster2 into trackParamAtCluster2
+ trackParamAtCluster2.SetClusterPtr(cluster2);
- // Set differences between track and hitForRec in the bending and non bending directions
- AliMUONHitForRec* hitForRec1 = trackParamAtHit1.GetHitForRecPtr();
- Double_t dX1 = hitForRec1->GetNonBendingCoor() - trackParamAtHit1.GetNonBendingCoor();
- Double_t dX2 = hitForRec2->GetNonBendingCoor() - trackParamAtHit2.GetNonBendingCoor();
- Double_t dY1 = hitForRec1->GetBendingCoor() - trackParamAtHit1.GetBendingCoor();
- Double_t dY2 = hitForRec2->GetBendingCoor() - trackParamAtHit2.GetBendingCoor();
+ // Set differences between track and clusters in the bending and non bending directions
+ AliMUONVCluster* cluster1 = trackParamAtCluster1.GetClusterPtr();
+ Double_t dX1 = cluster1->GetX() - trackParamAtCluster1.GetNonBendingCoor();
+ Double_t dX2 = cluster2->GetX() - trackParamAtCluster2.GetNonBendingCoor();
+ Double_t dY1 = cluster1->GetY() - trackParamAtCluster1.GetBendingCoor();
+ Double_t dY2 = cluster2->GetY() - trackParamAtCluster2.GetBendingCoor();
// Calculate errors and covariances
- const TMatrixD& kParamCov1 = trackParamAtHit1.GetCovariances();
- const TMatrixD& kParamCov2 = trackParamAtHit2.GetCovariances();
- Double_t dZ = trackParamAtHit2.GetZ() - trackParamAtHit1.GetZ();
- Double_t sigma2X1 = kParamCov1(0,0) + hitForRec1->GetNonBendingReso2();
- Double_t sigma2X2 = kParamCov2(0,0) + hitForRec2->GetNonBendingReso2();
+ const TMatrixD& kParamCov1 = trackParamAtCluster1.GetCovariances();
+ const TMatrixD& kParamCov2 = trackParamAtCluster2.GetCovariances();
+ Double_t dZ = trackParamAtCluster2.GetZ() - trackParamAtCluster1.GetZ();
+ Double_t sigma2X1 = kParamCov1(0,0) + cluster1->GetErrX2();
+ Double_t sigma2X2 = kParamCov2(0,0) + cluster2->GetErrX2();
Double_t covX1X2 = kParamCov1(0,0) + dZ * kParamCov1(0,1);
- Double_t sigma2Y1 = kParamCov1(2,2) + hitForRec1->GetBendingReso2();
- Double_t sigma2Y2 = kParamCov2(2,2) + hitForRec2->GetBendingReso2();
+ Double_t sigma2Y1 = kParamCov1(2,2) + cluster1->GetErrY2();
+ Double_t sigma2Y2 = kParamCov2(2,2) + cluster2->GetErrY2();
Double_t covY1Y2 = kParamCov1(2,2) + dZ * kParamCov1(2,3);
// Compute chi2
Double_t detX = sigma2X1 * sigma2X2 - covX1X2 * covX1X2;
Double_t detY = sigma2Y1 * sigma2Y2 - covY1Y2 * covY1Y2;
- if (detX == 0. || detY == 0.) return 1.e10;
+ if (detX == 0. || detY == 0.) return 2.*AliMUONTrack::MaxChi2();
return (dX1 * dX1 * sigma2X2 + dX2 * dX2 * sigma2X1 - 2. * dX1 * dX2 * covX1X2) / detX
+ (dY1 * dY1 * sigma2Y2 + dY2 * dY2 * sigma2Y1 - 2. * dY1 * dY2 * covY1Y2) / detY;
}
//__________________________________________________________________________
-Bool_t AliMUONVTrackReconstructor::FollowLinearTrackInStation(AliMUONTrack &trackCandidate, Int_t nextStation)
+Bool_t AliMUONVTrackReconstructor::FollowLinearTrackInChamber(AliMUONTrack &trackCandidate, const AliMUONVClusterStore& clusterStore,
+ Int_t nextChamber)
{
- /// Follow trackCandidate in station(0..) nextStation assuming linear propagation, and search for compatible HitForRec(s)
+ /// Follow trackCandidate in chamber(0..) nextChamber assuming linear propagation, and search for compatible cluster(s)
/// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks:
/// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of
/// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure.
/// Remove the obsolete "trackCandidate" at the end.
- /// kFALSE: add only the best hit(s) to the "trackCandidate". Try to add a couple of hits in priority.
- /// return kTRUE if new hits have been found (otherwise return kFALSE)
+ /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority.
+ /// return kTRUE if new cluster(s) have been found (otherwise return kFALSE)
+ AliDebug(1,Form("Enter FollowLinearTrackInChamber(1..) %d", nextChamber+1));
+
+ Double_t chi2WithOneCluster = AliMUONTrack::MaxChi2();
+ Double_t maxChi2WithOneCluster = 2. * GetRecoParam()->GetSigmaCutForTracking() *
+ GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
+ Double_t bestChi2WithOneCluster = maxChi2WithOneCluster;
+ Bool_t foundOneCluster = kFALSE;
+ AliMUONTrack *newTrack = 0x0;
+ AliMUONVCluster *cluster;
+ AliMUONTrackParam trackParam;
+ AliMUONTrackParam extrapTrackParamAtCluster;
+ AliMUONTrackParam bestTrackParamAtCluster;
+
+ // Get track parameters according to the propagation direction
+ if (nextChamber > 7) trackParam = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
+ else trackParam = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
+
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
+ cout<<endl<<"Track parameters and covariances at first cluster:"<<endl;
+ trackParam.GetParameters().Print();
+ trackParam.GetCovariances().Print();
+ }
+
+ // Add MCS effect
+ AliMUONTrackExtrap::AddMCSEffect(&trackParam,AliMUONConstants::ChamberThicknessInX0(trackParam.GetClusterPtr()->GetChamberId()),-1.);
+
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
+ cout << "FollowLinearTrackInChamber: look for cluster in chamber(1..): " << nextChamber+1 << endl;
+ }
+
+ // Create iterators to loop over clusters in chamber
+ TIter next(clusterStore.CreateChamberIterator(nextChamber,nextChamber));
+
+ // look for candidates in chamber
+ while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) ) {
+
+ // try to add the current cluster fast
+ if (!TryOneClusterFast(trackParam, cluster)) continue;
+
+ // try to add the current cluster accuratly
+ extrapTrackParamAtCluster = trackParam;
+ AliMUONTrackExtrap::LinearExtrapToZCov(&extrapTrackParamAtCluster, cluster->GetZ());
+ chi2WithOneCluster = TryOneCluster(extrapTrackParamAtCluster, cluster, extrapTrackParamAtCluster);
+
+ // if good chi2 then consider to add cluster
+ if (chi2WithOneCluster < maxChi2WithOneCluster) {
+ foundOneCluster = kTRUE;
+
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
+ cout << "FollowLinearTrackInChamber: found one cluster in chamber(1..): " << nextChamber+1
+ << " (Chi2 = " << chi2WithOneCluster << ")" << endl;
+ cluster->Print();
+ }
+
+ if (GetRecoParam()->TrackAllTracks()) {
+ // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
+ newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
+ if (GetRecoParam()->RequestStation(nextChamber/2))
+ extrapTrackParamAtCluster.SetRemovable(kFALSE);
+ else extrapTrackParamAtCluster.SetRemovable(kTRUE);
+ newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster,*cluster);
+ newTrack->SetGlobalChi2(trackCandidate.GetGlobalChi2()+chi2WithOneCluster);
+ fNRecTracks++;
+
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
+ cout << "FollowLinearTrackInChamber: added one cluster in chamber(1..): " << nextChamber+1 << endl;
+ if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
+ }
+
+ } else if (chi2WithOneCluster < bestChi2WithOneCluster) {
+ // keep track of the best cluster
+ bestChi2WithOneCluster = chi2WithOneCluster;
+ bestTrackParamAtCluster = extrapTrackParamAtCluster;
+ }
+
+ }
+
+ }
+
+ // fill out the best track if required else clean up the fRecTracksPtr array
+ if (!GetRecoParam()->TrackAllTracks()) {
+ if (foundOneCluster) {
+ if (GetRecoParam()->RequestStation(nextChamber/2))
+ bestTrackParamAtCluster.SetRemovable(kFALSE);
+ else bestTrackParamAtCluster.SetRemovable(kTRUE);
+ trackCandidate.AddTrackParamAtCluster(bestTrackParamAtCluster,*(bestTrackParamAtCluster.GetClusterPtr()));
+ trackCandidate.SetGlobalChi2(trackCandidate.GetGlobalChi2()+bestChi2WithOneCluster);
+
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
+ cout << "FollowLinearTrackInChamber: added the best cluster in chamber(1..): " << bestTrackParamAtCluster.GetClusterPtr()->GetChamberId()+1 << endl;
+ if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
+ }
+
+ } else return kFALSE;
+
+ } else if (foundOneCluster) {
+
+ // remove obsolete track
+ fRecTracksPtr->Remove(&trackCandidate);
+ fNRecTracks--;
+
+ } else return kFALSE;
+
+ return kTRUE;
+
+}
+
+//__________________________________________________________________________
+Bool_t AliMUONVTrackReconstructor::FollowLinearTrackInStation(AliMUONTrack &trackCandidate, const AliMUONVClusterStore& clusterStore,
+ Int_t nextStation)
+{
+ /// Follow trackCandidate in station(0..) nextStation assuming linear propagation, and search for compatible cluster(s)
+ /// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks:
+ /// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of
+ /// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure.
+ /// Remove the obsolete "trackCandidate" at the end.
+ /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority.
+ /// return kTRUE if new cluster(s) have been found (otherwise return kFALSE)
AliDebug(1,Form("Enter FollowLinearTrackInStation(1..) %d", nextStation+1));
// Order the chamber according to the propagation direction (tracking starts with chamber 2):
ch2 = 2*nextStation+1;
}
- Double_t chi2WithOneHitForRec = 1.e10;
- Double_t chi2WithTwoHitForRec = 1.e10;
- Double_t maxChi2WithOneHitForRec = 2. * fgkSigmaToCutForTracking * fgkSigmaToCutForTracking; // 2 because 2 quantities in chi2
- Double_t maxChi2WithTwoHitForRec = 4. * fgkSigmaToCutForTracking * fgkSigmaToCutForTracking; // 4 because 4 quantities in chi2
- Double_t bestChi2WithOneHitForRec = maxChi2WithOneHitForRec;
- Double_t bestChi2WithTwoHitForRec = maxChi2WithTwoHitForRec;
- Bool_t foundOneHit = kFALSE;
- Bool_t foundTwoHits = kFALSE;
+ Double_t chi2WithOneCluster = AliMUONTrack::MaxChi2();
+ Double_t chi2WithTwoClusters = AliMUONTrack::MaxChi2();
+ Double_t maxChi2WithOneCluster = 2. * GetRecoParam()->GetSigmaCutForTracking() *
+ GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
+ Double_t maxChi2WithTwoClusters = 4. * GetRecoParam()->GetSigmaCutForTracking() *
+ GetRecoParam()->GetSigmaCutForTracking(); // 4 because 4 quantities in chi2
+ Double_t bestChi2WithOneCluster = maxChi2WithOneCluster;
+ Double_t bestChi2WithTwoClusters = maxChi2WithTwoClusters;
+ Bool_t foundOneCluster = kFALSE;
+ Bool_t foundTwoClusters = kFALSE;
AliMUONTrack *newTrack = 0x0;
- AliMUONHitForRec *hitForRecCh1, *hitForRecCh2;
- AliMUONTrackParam extrapTrackParamAtHit1;
- AliMUONTrackParam extrapTrackParamAtHit2;
- AliMUONTrackParam bestTrackParamAtHit1;
- AliMUONTrackParam bestTrackParamAtHit2;
- Bool_t *hitForRecCh1Used = new Bool_t[fNHitsForRecPerChamber[ch1]];
- for (Int_t hit1 = 0; hit1 < fNHitsForRecPerChamber[ch1]; hit1++) hitForRecCh1Used[hit1] = kFALSE;
+ AliMUONVCluster *clusterCh1, *clusterCh2;
+ AliMUONTrackParam trackParam;
+ AliMUONTrackParam extrapTrackParamAtCluster1;
+ AliMUONTrackParam extrapTrackParamAtCluster2;
+ AliMUONTrackParam bestTrackParamAtCluster1;
+ AliMUONTrackParam bestTrackParamAtCluster2;
+
+ Int_t nClusters = clusterStore.GetSize();
+ Bool_t *clusterCh1Used = new Bool_t[nClusters];
+ for (Int_t i = 0; i < nClusters; i++) clusterCh1Used[i] = kFALSE;
+ Int_t iCluster1;
+
+ // Get track parameters according to the propagation direction
+ if (nextStation==4) trackParam = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
+ else trackParam = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
- // Get track parameters
- AliMUONTrackParam trackParam(*(AliMUONTrackParam*)trackCandidate.GetTrackParamAtHit()->First());
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
+ cout<<endl<<"Track parameters and covariances at first cluster:"<<endl;
+ trackParam.GetParameters().Print();
+ trackParam.GetCovariances().Print();
+ }
// Add MCS effect
- AliMUONTrackExtrap::AddMCSEffect(&trackParam,AliMUONConstants::ChamberThicknessInX0(),1.);
+ AliMUONTrackExtrap::AddMCSEffect(&trackParam,AliMUONConstants::ChamberThicknessInX0(trackParam.GetClusterPtr()->GetChamberId()),-1.);
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: look for hits in chamber(1..): " << ch2+1 << endl;
+ cout << "FollowLinearTrackInStation: look for clusters in chamber(1..): " << ch2+1 << endl;
}
- // look for candidates in chamber 2
- for (Int_t hit2 = 0; hit2 < fNHitsForRecPerChamber[ch2]; hit2++) {
-
- hitForRecCh2 = (AliMUONHitForRec*) fHitsForRecPtr->UncheckedAt(fIndexOfFirstHitForRecPerChamber[ch2]+hit2);
+ // Create iterators to loop over clusters in both chambers
+ TIter nextInCh1(clusterStore.CreateChamberIterator(ch1,ch1));
+ TIter nextInCh2(clusterStore.CreateChamberIterator(ch2,ch2));
+
+ // look for candidates in chamber 2
+ while ( ( clusterCh2 = static_cast<AliMUONVCluster*>(nextInCh2()) ) ) {
- // try to add the current hit fast
- if (!TryOneHitForRecFast(trackParam, hitForRecCh2)) continue;
+ // try to add the current cluster fast
+ if (!TryOneClusterFast(trackParam, clusterCh2)) continue;
- // try to add the current hit accuratly
- extrapTrackParamAtHit2 = trackParam;
- AliMUONTrackExtrap::LinearExtrapToZ(&extrapTrackParamAtHit2, hitForRecCh2->GetZ());
- chi2WithOneHitForRec = TryOneHitForRec(extrapTrackParamAtHit2, hitForRecCh2, extrapTrackParamAtHit2);
+ // try to add the current cluster accuratly
+ extrapTrackParamAtCluster2 = trackParam;
+ AliMUONTrackExtrap::LinearExtrapToZCov(&extrapTrackParamAtCluster2, clusterCh2->GetZ());
+ chi2WithOneCluster = TryOneCluster(extrapTrackParamAtCluster2, clusterCh2, extrapTrackParamAtCluster2);
- // if good chi2 then try to attach a hitForRec in the other chamber too
- if (chi2WithOneHitForRec < maxChi2WithOneHitForRec) {
- Bool_t foundSecondHit = kFALSE;
+ // if good chi2 then try to attach a cluster in the other chamber too
+ if (chi2WithOneCluster < maxChi2WithOneCluster) {
+ Bool_t foundSecondCluster = kFALSE;
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: found one hit in chamber(1..): " << ch2+1
- << " (Chi2 = " << chi2WithOneHitForRec << ")" << endl;
- cout << " look for second hits in chamber(1..): " << ch1+1 << " ..." << endl;
+ cout << "FollowLinearTrackInStation: found one cluster in chamber(1..): " << ch2+1
+ << " (Chi2 = " << chi2WithOneCluster << ")" << endl;
+ clusterCh2->Print();
+ cout << " look for second clusters in chamber(1..): " << ch1+1 << " ..." << endl;
}
// add MCS effect
- AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtHit2,AliMUONConstants::ChamberThicknessInX0(),1.);
+ AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCluster2,AliMUONConstants::ChamberThicknessInX0(ch2),-1.);
- for (Int_t hit1 = 0; hit1 < fNHitsForRecPerChamber[ch1]; hit1++) {
-
- hitForRecCh1 = (AliMUONHitForRec*) fHitsForRecPtr->UncheckedAt(fIndexOfFirstHitForRecPerChamber[ch1]+hit1);
+ // reset cluster iterator of chamber 1
+ nextInCh1.Reset();
+ iCluster1 = -1;
+
+ // look for second candidates in chamber 1
+ while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
+ iCluster1++;
- // try to add the current hit fast
- if (!TryOneHitForRecFast(extrapTrackParamAtHit2, hitForRecCh1)) continue;
+ // try to add the current cluster fast
+ if (!TryOneClusterFast(extrapTrackParamAtCluster2, clusterCh1)) continue;
- // try to add the current hit in addition to the one found on the previous chamber
- chi2WithTwoHitForRec = TryTwoHitForRecFast(extrapTrackParamAtHit2, hitForRecCh1, extrapTrackParamAtHit1);
+ // try to add the current cluster in addition to the one found in the previous chamber
+ chi2WithTwoClusters = TryTwoClustersFast(extrapTrackParamAtCluster2, clusterCh1, extrapTrackParamAtCluster1);
- // if good chi2 then consider to add the 2 hitForRec to the "trackCandidate"
- if (chi2WithTwoHitForRec < maxChi2WithTwoHitForRec) {
- foundSecondHit = kTRUE;
- foundTwoHits = kTRUE;
+ // if good chi2 then consider to add the 2 clusters to the "trackCandidate"
+ if (chi2WithTwoClusters < maxChi2WithTwoClusters) {
+ foundSecondCluster = kTRUE;
+ foundTwoClusters = kTRUE;
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: found one hit in chamber(1..): " << ch1+1
- << " (Chi2 = " << chi2WithTwoHitForRec << ")" << endl;
+ cout << "FollowLinearTrackInStation: found one cluster in chamber(1..): " << ch1+1
+ << " (Chi2 = " << chi2WithTwoClusters << ")" << endl;
+ clusterCh1->Print();
}
- if (fgkTrackAllTracks) {
- // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new hitForRec's
+ if (GetRecoParam()->TrackAllTracks()) {
+ // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new clusters
newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
- extrapTrackParamAtHit1.SetRemovable(kTRUE);
- newTrack->AddTrackParamAtHit(&extrapTrackParamAtHit1,hitForRecCh1);
- extrapTrackParamAtHit2.SetRemovable(kTRUE);
- newTrack->AddTrackParamAtHit(&extrapTrackParamAtHit2,hitForRecCh2);
- newTrack->GetTrackParamAtHit()->Sort();
+ extrapTrackParamAtCluster1.SetRemovable(kTRUE);
+ newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster1,*clusterCh1);
+ extrapTrackParamAtCluster2.SetRemovable(kTRUE);
+ newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster2,*clusterCh2);
+ newTrack->SetGlobalChi2(newTrack->GetGlobalChi2()+chi2WithTwoClusters);
fNRecTracks++;
- // Tag hitForRecCh1 as used
- hitForRecCh1Used[hit1] = kTRUE;
+ // Tag clusterCh1 as used
+ clusterCh1Used[iCluster1] = kTRUE;
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: added two hits in station(1..): " << nextStation+1 << endl;
+ cout << "FollowLinearTrackInStation: added two clusters in station(1..): " << nextStation+1 << endl;
if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
}
- } else if (chi2WithTwoHitForRec < bestChi2WithTwoHitForRec) {
- // keep track of the best couple of hits
- bestChi2WithTwoHitForRec = chi2WithTwoHitForRec;
- bestTrackParamAtHit1 = extrapTrackParamAtHit1;
- bestTrackParamAtHit2 = extrapTrackParamAtHit2;
+ } else if (chi2WithTwoClusters < bestChi2WithTwoClusters) {
+ // keep track of the best couple of clusters
+ bestChi2WithTwoClusters = chi2WithTwoClusters;
+ bestTrackParamAtCluster1 = extrapTrackParamAtCluster1;
+ bestTrackParamAtCluster2 = extrapTrackParamAtCluster2;
}
}
}
- // if no hitForRecCh1 found then consider to add hitForRecCh2 only
- if (!foundSecondHit) {
- foundOneHit = kTRUE;
+ // if no cluster found in chamber1 then consider to add clusterCh2 only
+ if (!foundSecondCluster) {
+ foundOneCluster = kTRUE;
- if (fgkTrackAllTracks) {
- // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new hitForRec's
+ if (GetRecoParam()->TrackAllTracks()) {
+ // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
- extrapTrackParamAtHit2.SetRemovable(kFALSE);
- newTrack->AddTrackParamAtHit(&extrapTrackParamAtHit2,hitForRecCh2);
- newTrack->GetTrackParamAtHit()->Sort();
+ if (GetRecoParam()->RequestStation(nextStation))
+ extrapTrackParamAtCluster2.SetRemovable(kFALSE);
+ else extrapTrackParamAtCluster2.SetRemovable(kTRUE);
+ newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster2,*clusterCh2);
+ newTrack->SetGlobalChi2(newTrack->GetGlobalChi2()+chi2WithOneCluster);
fNRecTracks++;
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: added one hit in chamber(1..): " << ch2+1 << endl;
+ cout << "FollowLinearTrackInStation: added one cluster in chamber(1..): " << ch2+1 << endl;
if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
}
- } else if (!foundTwoHits && chi2WithOneHitForRec < bestChi2WithOneHitForRec) {
- // keep track of the best single hitForRec except if a couple of hits has already been found
- bestChi2WithOneHitForRec = chi2WithOneHitForRec;
- bestTrackParamAtHit1 = extrapTrackParamAtHit2;
+ } else if (!foundTwoClusters && chi2WithOneCluster < bestChi2WithOneCluster) {
+ // keep track of the best cluster except if a couple of clusters has already been found
+ bestChi2WithOneCluster = chi2WithOneCluster;
+ bestTrackParamAtCluster1 = extrapTrackParamAtCluster2;
}
}
}
// look for candidates in chamber 1 not already attached to a track
- // if we want to keep all possible tracks or if no good couple of hitForRec has been found
- if (fgkTrackAllTracks || !foundTwoHits) {
+ // if we want to keep all possible tracks or if no good couple of clusters has been found
+ if (GetRecoParam()->TrackAllTracks() || !foundTwoClusters) {
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: look for single hits in chamber(1..): " << ch1+1 << endl;
+ cout << "FollowLinearTrackInStation: look for single cluster in chamber(1..): " << ch1+1 << endl;
}
//Extrapolate trackCandidate to chamber "ch2"
- AliMUONTrackExtrap::LinearExtrapToZ(&trackParam, AliMUONConstants::DefaultChamberZ(ch2));
+ AliMUONTrackExtrap::LinearExtrapToZCov(&trackParam, AliMUONConstants::DefaultChamberZ(ch2));
// add MCS effect for next step
- AliMUONTrackExtrap::AddMCSEffect(&trackParam,AliMUONConstants::ChamberThicknessInX0(),1.);
+ AliMUONTrackExtrap::AddMCSEffect(&trackParam,AliMUONConstants::ChamberThicknessInX0(ch2),-1.);
+
+ // reset cluster iterator of chamber 1
+ nextInCh1.Reset();
+ iCluster1 = -1;
+
+ // look for second candidates in chamber 1
+ while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
+ iCluster1++;
- for (Int_t hit1 = 0; hit1 < fNHitsForRecPerChamber[ch1]; hit1++) {
+ if (clusterCh1Used[iCluster1]) continue; // Skip clusters already used
- hitForRecCh1 = (AliMUONHitForRec*) fHitsForRecPtr->UncheckedAt(fIndexOfFirstHitForRecPerChamber[ch1]+hit1);
+ // try to add the current cluster fast
+ if (!TryOneClusterFast(trackParam, clusterCh1)) continue;
- if (hitForRecCh1Used[hit1]) continue; // Skip hitForRec already used
+ // try to add the current cluster accuratly
+ extrapTrackParamAtCluster1 = trackParam;
+ AliMUONTrackExtrap::LinearExtrapToZCov(&extrapTrackParamAtCluster1, clusterCh1->GetZ());
+ chi2WithOneCluster = TryOneCluster(extrapTrackParamAtCluster1, clusterCh1, extrapTrackParamAtCluster1);
- // try to add the current hit fast
- if (!TryOneHitForRecFast(trackParam, hitForRecCh1)) continue;
-
- // try to add the current hit accuratly
- extrapTrackParamAtHit1 = trackParam;
- AliMUONTrackExtrap::LinearExtrapToZ(&extrapTrackParamAtHit1, hitForRecCh1->GetZ());
- chi2WithOneHitForRec = TryOneHitForRec(extrapTrackParamAtHit1, hitForRecCh1, extrapTrackParamAtHit1);
-
- // if good chi2 then consider to add hitForRecCh1
- // We do not try to attach a hitForRec in the other chamber too since it has already been done above
- if (chi2WithOneHitForRec < maxChi2WithOneHitForRec) {
- foundOneHit = kTRUE;
+ // if good chi2 then consider to add clusterCh1
+ // We do not try to attach a cluster in the other chamber too since it has already been done above
+ if (chi2WithOneCluster < maxChi2WithOneCluster) {
+ foundOneCluster = kTRUE;
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: found one hit in chamber(1..): " << ch1+1
- << " (Chi2 = " << chi2WithOneHitForRec << ")" << endl;
+ cout << "FollowLinearTrackInStation: found one cluster in chamber(1..): " << ch1+1
+ << " (Chi2 = " << chi2WithOneCluster << ")" << endl;
+ clusterCh1->Print();
}
- if (fgkTrackAllTracks) {
- // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new hitForRec's
+ if (GetRecoParam()->TrackAllTracks()) {
+ // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
- extrapTrackParamAtHit1.SetRemovable(kFALSE);
- newTrack->AddTrackParamAtHit(&extrapTrackParamAtHit1,hitForRecCh1);
- newTrack->GetTrackParamAtHit()->Sort();
+ if (GetRecoParam()->RequestStation(nextStation))
+ extrapTrackParamAtCluster1.SetRemovable(kFALSE);
+ else extrapTrackParamAtCluster1.SetRemovable(kTRUE);
+ newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster1,*clusterCh1);
+ newTrack->SetGlobalChi2(newTrack->GetGlobalChi2()+chi2WithOneCluster);
fNRecTracks++;
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: added one hit in chamber(1..): " << ch1+1 << endl;
+ cout << "FollowLinearTrackInStation: added one cluster in chamber(1..): " << ch1+1 << endl;
if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
}
- } else if (chi2WithOneHitForRec < bestChi2WithOneHitForRec) {
- // keep track of the best single hitForRec except if a couple of hits has already been found
- bestChi2WithOneHitForRec = chi2WithOneHitForRec;
- bestTrackParamAtHit1 = extrapTrackParamAtHit1;
+ } else if (chi2WithOneCluster < bestChi2WithOneCluster) {
+ // keep track of the best cluster except if a couple of clusters has already been found
+ bestChi2WithOneCluster = chi2WithOneCluster;
+ bestTrackParamAtCluster1 = extrapTrackParamAtCluster1;
}
}
}
// fill out the best track if required else clean up the fRecTracksPtr array
- if (!fgkTrackAllTracks) {
- if (foundTwoHits) {
- bestTrackParamAtHit1.SetRemovable(kTRUE);
- trackCandidate.AddTrackParamAtHit(&bestTrackParamAtHit1,bestTrackParamAtHit1.GetHitForRecPtr());
- bestTrackParamAtHit2.SetRemovable(kTRUE);
- trackCandidate.AddTrackParamAtHit(&bestTrackParamAtHit2,bestTrackParamAtHit2.GetHitForRecPtr());
- trackCandidate.GetTrackParamAtHit()->Sort();
+ if (!GetRecoParam()->TrackAllTracks()) {
+ if (foundTwoClusters) {
+ bestTrackParamAtCluster1.SetRemovable(kTRUE);
+ trackCandidate.AddTrackParamAtCluster(bestTrackParamAtCluster1,*(bestTrackParamAtCluster1.GetClusterPtr()));
+ bestTrackParamAtCluster2.SetRemovable(kTRUE);
+ trackCandidate.AddTrackParamAtCluster(bestTrackParamAtCluster2,*(bestTrackParamAtCluster2.GetClusterPtr()));
+ trackCandidate.SetGlobalChi2(trackCandidate.GetGlobalChi2()+bestChi2WithTwoClusters);
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: added the two best hits in station(1..): " << nextStation+1 << endl;
+ cout << "FollowLinearTrackInStation: added the two best clusters in station(1..): " << nextStation+1 << endl;
if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
}
- } else if (foundOneHit) {
- bestTrackParamAtHit1.SetRemovable(kFALSE);
- trackCandidate.AddTrackParamAtHit(&bestTrackParamAtHit1,bestTrackParamAtHit1.GetHitForRecPtr());
- trackCandidate.GetTrackParamAtHit()->Sort();
+ } else if (foundOneCluster) {
+ if (GetRecoParam()->RequestStation(nextStation))
+ bestTrackParamAtCluster1.SetRemovable(kFALSE);
+ else bestTrackParamAtCluster1.SetRemovable(kTRUE);
+ trackCandidate.AddTrackParamAtCluster(bestTrackParamAtCluster1,*(bestTrackParamAtCluster1.GetClusterPtr()));
+ trackCandidate.SetGlobalChi2(trackCandidate.GetGlobalChi2()+bestChi2WithOneCluster);
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "FollowLinearTrackInStation: added the best hit in chamber(1..): " << bestTrackParamAtHit1.GetHitForRecPtr()->GetChamberNumber()+1 << endl;
+ cout << "FollowLinearTrackInStation: added the best cluster in chamber(1..): " << bestTrackParamAtCluster1.GetClusterPtr()->GetChamberId()+1 << endl;
if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
}
} else {
- delete [] hitForRecCh1Used;
+ delete [] clusterCh1Used;
return kFALSE;
}
- } else if (foundOneHit || foundTwoHits) {
+ } else if (foundOneCluster || foundTwoClusters) {
// remove obsolete track
fRecTracksPtr->Remove(&trackCandidate);
fNRecTracks--;
} else {
- delete [] hitForRecCh1Used;
+ delete [] clusterCh1Used;
return kFALSE;
}
- delete [] hitForRecCh1Used;
+ delete [] clusterCh1Used;
return kTRUE;
}
- //__________________________________________________________________________
-void AliMUONVTrackReconstructor::ValidateTracksWithTrigger(AliMUONVTrackStore& trackStore,
- const AliMUONVTriggerTrackStore& triggerTrackStore,
- const AliMUONVTriggerStore& triggerStore,
- const AliMUONTrackHitPattern& trackHitPattern)
+//__________________________________________________________________________
+void AliMUONVTrackReconstructor::ImproveTracks()
{
- /// Try to match track from tracking system with trigger track
- AliCodeTimerAuto("");
+ /// Improve tracks by removing clusters with local chi2 highter than the defined cut
+ /// Recompute track parameters and covariances at the remaining clusters
+ AliDebug(1,"Enter ImproveTracks");
+
+ AliMUONTrack *track, *nextTrack;
+
+ track = (AliMUONTrack*) fRecTracksPtr->First();
+ while (track) {
+
+ // prepare next track in case the actual track is suppressed
+ nextTrack = (AliMUONTrack*) fRecTracksPtr->After(track);
+
+ ImproveTrack(*track);
+
+ // remove track if improvement failed
+ if (!track->IsImproved()) {
+ fRecTracksPtr->Remove(track);
+ fNRecTracks--;
+ }
+
+ track = nextTrack;
+ }
- static const Double_t kDistSigma[3]={1,1,0.02}; // sigma of distributions (trigger-track) X,Y,slopeY
+ // compress the array in case of some tracks have been removed
+ fRecTracksPtr->Compress();
- Int_t matchTrigger;
- Int_t loTrgNum(-1);
- Double_t distTriggerTrack[3];
- Double_t xTrack, yTrack, ySlopeTrack, chi2MatchTrigger, minChi2MatchTrigger, chi2;
+}
- TIter itTrack(trackStore.CreateIterator());
- AliMUONTrack* track;
+//__________________________________________________________________________
+void AliMUONVTrackReconstructor::Finalize()
+{
+ /// Recompute track parameters and covariances at each attached cluster
+ /// Set the label pointing to the corresponding MC track
+ /// Remove the track if finalization failed
- while ( ( track = static_cast<AliMUONTrack*>(itTrack()) ) )
- {
- matchTrigger = 0;
- chi2MatchTrigger = 0.;
- loTrgNum = -1;
- Int_t doubleMatch=-1; // Check if track matches 2 trigger tracks
- Double_t doubleChi2 = -1.;
-
- AliMUONTrackParam trackParam(*((AliMUONTrackParam*) (track->GetTrackParamAtHit()->Last())));
- AliMUONTrackExtrap::ExtrapToZ(&trackParam, AliMUONConstants::DefaultChamberZ(10)); // extrap to 1st trigger chamber
-
- xTrack = trackParam.GetNonBendingCoor();
- yTrack = trackParam.GetBendingCoor();
- ySlopeTrack = trackParam.GetBendingSlope();
- minChi2MatchTrigger = 999.;
-
- AliMUONTriggerTrack *triggerTrack;
- TIter itTriggerTrack(triggerTrackStore.CreateIterator());
- while ( ( triggerTrack = static_cast<AliMUONTriggerTrack*>(itTriggerTrack() ) ) )
- {
- distTriggerTrack[0] = (triggerTrack->GetX11()-xTrack)/kDistSigma[0];
- distTriggerTrack[1] = (triggerTrack->GetY11()-yTrack)/kDistSigma[1];
- distTriggerTrack[2] = (TMath::Tan(triggerTrack->GetThetay())-ySlopeTrack)/kDistSigma[2];
- chi2 = 0.;
- for (Int_t iVar = 0; iVar < 3; iVar++) chi2 += distTriggerTrack[iVar]*distTriggerTrack[iVar];
- chi2 /= 3.; // Normalized Chi2: 3 degrees of freedom (X,Y,slopeY)
- if (chi2 < fMaxNormChi2MatchTrigger)
- {
- Bool_t isDoubleTrack = (TMath::Abs(chi2 - minChi2MatchTrigger)<1.);
- if (chi2 < minChi2MatchTrigger && chi2 < fMaxNormChi2MatchTrigger)
- {
- if(isDoubleTrack)
- {
- doubleMatch = loTrgNum;
- doubleChi2 = chi2MatchTrigger;
- }
- minChi2MatchTrigger = chi2;
- chi2MatchTrigger = chi2;
- loTrgNum = triggerTrack->GetLoTrgNum();
- AliMUONLocalTrigger* locTrg = triggerStore.FindLocal(loTrgNum);
- matchTrigger=1;
- if(locTrg->LoLpt()>0)matchTrigger=2;
- if(locTrg->LoHpt()>0)matchTrigger=3;
- }
- else if(isDoubleTrack)
- {
- doubleMatch = triggerTrack->GetLoTrgNum();
- doubleChi2 = chi2;
- }
- }
- }
- if(doubleMatch>=0)
- { // If two trigger tracks match, select the one passing more trigger cuts
- AliDebug(1, Form("Two candidates found: %i and %i",loTrgNum,doubleMatch));
- AliMUONLocalTrigger* locTrg1 = triggerStore.FindLocal(doubleMatch);
- if((locTrg1->LoLpt()>0 && matchTrigger<2) || (locTrg1->LoHpt() && matchTrigger<3))
- {
- if(locTrg1->LoHpt()>0)matchTrigger=3;
- else matchTrigger=2;
- loTrgNum = doubleMatch;
- chi2MatchTrigger=doubleChi2;
- }
- }
+ AliMUONTrack *track, *nextTrack;
+ Bool_t trackRemoved = kFALSE;
+
+ track = (AliMUONTrack*) fRecTracksPtr->First();
+ while (track) {
- track->SetMatchTrigger(matchTrigger);
- track->SetLoTrgNum(loTrgNum);
- track->SetChi2MatchTrigger(chi2MatchTrigger);
+ nextTrack = (AliMUONTrack*) fRecTracksPtr->After(track);
- AliMUONLocalTrigger* locTrg = static_cast<AliMUONLocalTrigger*>(triggerStore.FindLocal(loTrgNum));
+ if (FinalizeTrack(*track)) track->FindMCLabel();
+ else {
+ fRecTracksPtr->Remove(track);
+ fNRecTracks--;
+ trackRemoved = kTRUE;
+ }
- if (locTrg)
- {
- track->SetLocalTrigger(locTrg->LoCircuit(),
- locTrg->LoStripX(),
- locTrg->LoStripY(),
- locTrg->LoDev(),
- locTrg->LoLpt(),
- locTrg->LoHpt());
- }
- }
+ track = nextTrack;
+
+ }
+
+ // compress array of tracks if needed
+ if (trackRemoved) fRecTracksPtr->Compress();
- trackHitPattern.GetHitPattern(trackStore,triggerStore);
}
- //__________________________________________________________________________
+//__________________________________________________________________________
+void AliMUONVTrackReconstructor::ValidateTracksWithTrigger(AliMUONVTrackStore& trackStore,
+ const AliMUONVTriggerTrackStore& triggerTrackStore,
+ const AliMUONVTriggerStore& triggerStore,
+ const AliMUONTrackHitPattern& trackHitPattern)
+{
+ /// Try to match track from tracking system with trigger track
+ AliCodeTimerAuto("",0);
+
+ trackHitPattern.ExecuteValidation(trackStore, triggerTrackStore, triggerStore);
+}
+
+
+//__________________________________________________________________________
void AliMUONVTrackReconstructor::EventReconstructTrigger(const AliMUONTriggerCircuit& circuit,
const AliMUONVTriggerStore& triggerStore,
AliMUONVTriggerTrackStore& triggerTrackStore)
{
- /// To make the trigger tracks from Local Trigger
+ /// Fill trigger track store from local trigger
AliDebug(1, "");
- AliCodeTimerAuto("");
-
+ AliCodeTimerAuto("",0);
+
AliMUONGlobalTrigger* globalTrigger = triggerStore.Global();
UChar_t gloTrigPat = 0;
gloTrigPat = globalTrigger->GetGlobalResponse();
}
+ AliMUONTriggerTrack triggerTrack;
+
TIter next(triggerStore.CreateIterator());
AliMUONLocalTrigger* locTrg(0x0);
-
- Float_t z11 = AliMUONConstants::DefaultChamberZ(10);
- Float_t z21 = AliMUONConstants::DefaultChamberZ(12);
-
- AliMUONTriggerTrack triggerTrack;
while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(next()) ) )
{
- Bool_t xTrig=kFALSE;
- Bool_t yTrig=kFALSE;
-
- Int_t localBoardId = locTrg->LoCircuit();
- if ( locTrg->LoSdev()==1 && locTrg->LoDev()==0 &&
- locTrg->LoStripX()==0) xTrig=kFALSE; // no trigger in X
- else xTrig=kTRUE; // trigger in X
- if (locTrg->LoTrigY()==1 &&
- locTrg->LoStripY()==15 ) yTrig = kFALSE; // no trigger in Y
- else yTrig = kTRUE; // trigger in Y
-
- if (xTrig && yTrig)
+ if ( locTrg->IsTrigX() && locTrg->IsTrigY() )
{ // make Trigger Track if trigger in X and Y
- Float_t y11 = circuit.GetY11Pos(localBoardId, locTrg->LoStripX());
- // need first to convert deviation to [0-30]
- // (see AliMUONLocalTriggerBoard::LocalTrigger)
- Int_t deviation = locTrg->LoDev();
- Int_t sign = 0;
- if ( !locTrg->LoSdev() && deviation ) sign=-1;
- if ( !locTrg->LoSdev() && !deviation ) sign= 0;
- if ( locTrg->LoSdev() == 1 ) sign=+1;
- deviation *= sign;
- deviation += 15;
- Int_t stripX21 = locTrg->LoStripX()+deviation+1;
- Float_t y21 = circuit.GetY21Pos(localBoardId, stripX21);
- Float_t x11 = circuit.GetX11Pos(localBoardId, locTrg->LoStripY());
-
- AliDebug(1, Form(" MakeTriggerTrack %d %d %d %d %f %f %f \n",locTrg->LoCircuit(),
- locTrg->LoStripX(),locTrg->LoStripX()+locTrg->LoDev()+1,locTrg->LoStripY(),y11, y21, x11));
-
- Float_t thetax = TMath::ATan2( x11 , z11 );
- Float_t thetay = TMath::ATan2( (y21-y11) , (z21-z11) );
-
- triggerTrack.SetX11(x11);
- triggerTrack.SetY11(y11);
- triggerTrack.SetThetax(thetax);
- triggerTrack.SetThetay(thetay);
- triggerTrack.SetGTPattern(gloTrigPat);
- triggerTrack.SetLoTrgNum(localBoardId);
-
+ TriggerToTrack(circuit, *locTrg, triggerTrack, gloTrigPat);
+
triggerTrackStore.Add(triggerTrack);
} // board is fired
} // end of loop on Local Trigger
}
+//__________________________________________________________________________
+void AliMUONVTrackReconstructor::TriggerToTrack(const AliMUONTriggerCircuit& circuit,
+ const AliMUONLocalTrigger& locTrg,
+ AliMUONTriggerTrack& triggerTrack,
+ UChar_t globalTriggerPattern)
+{
+ /// To make the trigger tracks from Local Trigger
+ const Double_t kTrigNonBendReso = AliMUONConstants::TriggerNonBendingReso();
+ const Double_t kTrigBendReso = AliMUONConstants::TriggerBendingReso();
+ const Double_t kSqrt12 = TMath::Sqrt(12.);
+
+ TMatrixD trigCov(3,3);
+
+ Int_t localBoardId = locTrg.LoCircuit();
+
+ Float_t y11 = circuit.GetY11Pos(localBoardId, locTrg.LoStripX());
+ Float_t z11 = circuit.GetZ11Pos(localBoardId, locTrg.LoStripX());
+ // need first to convert deviation to [0-30]
+ // (see AliMUONLocalTriggerBoard::LocalTrigger)
+ Int_t deviation = locTrg.GetDeviation();
+ Int_t stripX21 = locTrg.LoStripX()+deviation+1;
+ Float_t y21 = circuit.GetY21Pos(localBoardId, stripX21);
+ Float_t z21 = circuit.GetZ21Pos(localBoardId, stripX21);
+ Float_t x11 = circuit.GetX11Pos(localBoardId, locTrg.LoStripY());
+
+ AliDebug(1, Form(" MakeTriggerTrack %3d %2d %2d %2d (%f %f %f) (%f %f)\n",locTrg.LoCircuit(),
+ locTrg.LoStripX(),locTrg.LoStripX()+deviation+1,locTrg.LoStripY(),x11, y11, z11, y21, z21));
+
+ Double_t deltaZ = z11 - z21;
+
+ Float_t slopeX = x11/z11;
+ Float_t slopeY = (y11-y21) / deltaZ;
+
+ Float_t sigmaX = circuit.GetX11Width(localBoardId, locTrg.LoStripY()) / kSqrt12;
+ Float_t sigmaY = circuit.GetY11Width(localBoardId, locTrg.LoStripX()) / kSqrt12;
+ Float_t sigmaY21 = circuit.GetY21Width(localBoardId, locTrg.LoStripX()) / kSqrt12;
+
+ trigCov.Zero();
+ trigCov(0,0) = kTrigNonBendReso * kTrigNonBendReso + sigmaX * sigmaX;
+ trigCov(1,1) = kTrigBendReso * kTrigBendReso + sigmaY * sigmaY;
+ trigCov(2,2) =
+ (2. * kTrigBendReso * kTrigBendReso + sigmaY * sigmaY + sigmaY21 * sigmaY21 ) / deltaZ / deltaZ;
+ trigCov(1,2) = trigCov(2,1) = trigCov(1,1) / deltaZ;
+
+ triggerTrack.SetX11(x11);
+ triggerTrack.SetY11(y11);
+ triggerTrack.SetZ11(z11);
+ triggerTrack.SetZ21(z21);
+ triggerTrack.SetSlopeX(slopeX);
+ triggerTrack.SetSlopeY(slopeY);
+ triggerTrack.SetGTPattern(globalTriggerPattern);
+ triggerTrack.SetLoTrgNum(localBoardId);
+ triggerTrack.SetCovariances(trigCov);
+ triggerTrack.SetUniqueID(locTrg.GetUniqueID());
+}