// $Id$
#include "AliMUON1DMap.h"
+#include "AliMUON1DMapIterator.h"
+#include "AliMpExMap.h"
#include "AliLog.h"
-#include "AliMpExMap.h"
-#include "AliMUON1DMapIterator.h"
//-----------------------------------------------------------------------------
/// \class AliMUON1DMap
//_____________________________________________________________________________
AliMUON1DMap::AliMUON1DMap(Int_t theSize)
: AliMUONVStore(),
- fMap(new AliMpExMap(true))
+ fMap(new AliMpExMap(kTRUE))
{
/// Default ctor
//_____________________________________________________________________________
AliMUON1DMap::AliMUON1DMap(const AliMUON1DMap& other)
: AliMUONVStore(),
- fMap(0x0)
+ fMap(new AliMpExMap(*other.fMap))
{
/// Copy constructor
-
- other.CopyTo(*this);
}
//_____________________________________________________________________________
AliMUON1DMap::operator=(const AliMUON1DMap& other)
{
/// Assignment operator
-
- other.CopyTo(*this);
+ *fMap = *other.fMap;
return *this;
}
//_____________________________________________________________________________
AliMUON1DMap::~AliMUON1DMap()
{
-/// dtor, we're the owner of our internal map.
-
+/// destructor
delete fMap;
}
{
/// Add an object to this, using uniqueID as the key
if (!object) return kFALSE;
- Set(object->GetUniqueID(),object,kFALSE);
- return kTRUE;
+ return Set(object->GetUniqueID(),object);
}
//_____________________________________________________________________________
AliMUON1DMap::Clear(Option_t*)
{
/// Reset
- delete fMap;
- fMap = 0x0;
-}
-
-//_____________________________________________________________________________
-void
-AliMUON1DMap::CopyTo(AliMUON1DMap& dest) const
-{
-/// Make a deep copy
-
- delete dest.fMap;
- dest.fMap = fMap;
+ fMap->Clear();
}
//_____________________________________________________________________________
AliMUON1DMap::FindObject(UInt_t i) const
{
/// Get the object located at index i, if it exists, and if i is correct.
-
return fMap->GetValue(i);
}
TIterator*
AliMUON1DMap::CreateIterator() const
{
- // Create and return an iterator on this map
- // Returned iterator must be deleted by user.
- if ( fMap )
- {
- return new AliMUON1DMapIterator(*fMap);
- }
- return 0x0;
+ /// Create and return an iterator on this map
+ /// Returned iterator must be deleted by user.
+ return new AliMUON1DMapIterator(*fMap);
}
//_____________________________________________________________________________
//_____________________________________________________________________________
Bool_t
-AliMUON1DMap::Set(Int_t i, TObject* object, Bool_t replace)
+AliMUON1DMap::Set(Int_t i, TObject* object)
{
/// Set the object located at i
-/// If replace=kFALSE and there's already an object at location i,
+/// If there's already an object at location i,
/// this method fails and returns kFALSE, otherwise it returns kTRUE
-
+
TObject* o = FindObject(i);
- if ( o && !replace )
+ if ( o )
{
AliError(Form("Object %p is already there for i=%d",o,i));
return kFALSE;
}
- if ( replace )
- {
- delete o;
- }
fMap->Add(i,object);
return kTRUE;
}
-
-
virtual Int_t GetSize() const;
private:
- void CopyTo(AliMUON1DMap& to) const;
- /** Set the object stored at i.
- if replace=false and there's already an object there, returns kFALSE
- */
- virtual Bool_t Set(Int_t i, TObject* object, Bool_t replace);
+ virtual Bool_t Set(Int_t i, TObject* object);
private:
/// \class AliMUON1DMapIterator
/// Implementation of TIterator for 1Dmaps
///
-/// A simple implementation of VDataIterator for 1Dmaps.
+/// A simple implementation of iterator for 1Dmaps.
///
/// \author Laurent Aphecetche
//-----------------------------------------------------------------------------
#include "AliMUON1DMapIterator.h"
#include "AliMpExMap.h"
-#include "AliLog.h"
-#include "AliMpIntPair.h"
-#include "AliMpExMap.h"
/// \cond CLASSIMP
ClassImp(AliMUON1DMapIterator)
/// \endcond
//_____________________________________________________________________________
-AliMUON1DMapIterator::AliMUON1DMapIterator(AliMpExMap& theMap)
+AliMUON1DMapIterator::AliMUON1DMapIterator(const AliMpExMap& theMap)
: TIterator(),
-fIter(theMap.GetIterator()),
-fCurrentI(-1)
+ fkMap(&theMap),
+ fCurrentI(-1)
{
/// default ctor
- Reset();
}
//_____________________________________________________________________________
AliMUON1DMapIterator::AliMUON1DMapIterator(const AliMUON1DMapIterator& rhs)
: TIterator(rhs),
- fIter(rhs.fIter),
+ fkMap(rhs.fkMap),
fCurrentI(rhs.fCurrentI)
{
/// copy ctor
/// assignment operator
if ( this != &rhs )
{
- fIter = rhs.fIter;
+ fkMap = rhs.fkMap;
fCurrentI = rhs.fCurrentI;
}
return *this;
if ( this != &rhs && rhs.IsA() == AliMUON1DMapIterator::Class() )
{
const AliMUON1DMapIterator& rhs1 = static_cast<const AliMUON1DMapIterator&>(rhs);
- fIter = rhs1.fIter;
+ fkMap = rhs1.fkMap;
fCurrentI = rhs1.fCurrentI;
}
return *this;
AliMUON1DMapIterator::Next()
{
/// Return next object in iteration
-
- Long_t key, value;
- Bool_t ok = fIter.Next(key,value);
- if (!ok) return 0x0;
- return reinterpret_cast<TObject*>(value);
+ return (++fCurrentI < fkMap->GetSize()) ? fkMap->GetObjectFast(fCurrentI) : 0x0;
}
//_____________________________________________________________________________
AliMUON1DMapIterator::Reset()
{
/// rewind the iterator
- fIter.Reset();
+ fCurrentI = -1;
}
class AliMUON1DMapIterator : public TIterator
{
public:
- AliMUON1DMapIterator(AliMpExMap& theMap);
+ AliMUON1DMapIterator(const AliMpExMap& theMap);
AliMUON1DMapIterator(const AliMUON1DMapIterator&);
AliMUON1DMapIterator& operator=(const AliMUON1DMapIterator& rhs);
TIterator& operator=(const TIterator& iterator);
virtual const TCollection* GetCollection() const { return 0x0; }
private:
- TExMapIter fIter; //!< iterator
- Int_t fCurrentI; //!< current index in direction i
+ const AliMpExMap* fkMap; ///< Top map we iterate upon
+ Int_t fCurrentI; ///< Current position in fMap
ClassDef(AliMUON1DMapIterator,0) // VDataIterator for 1D maps
};
ClassImp(AliMUON2DMap)
/// \endcond
+const Int_t AliMUON2DMap::fgkOptimalSizeForDEManu = 228;
+
namespace
{
//___________________________________________________________________________
//_____________________________________________________________________________
AliMUON2DMap::AliMUON2DMap(Bool_t optimizeForDEManu)
: AliMUONVStore(),
- fMap(0x0),
+ fMap(new AliMpExMap(kTRUE)),
fOptimizeForDEManu(optimizeForDEManu)
{
/// Default constructor.
- Clear();
+ // hard-coded constant in order not to depend on mapping
+ // if this number ever change, it will not break the code, simply the
+ // automatic resizing will give a warning...
+ if ( fOptimizeForDEManu ) fMap->SetSize(fgkOptimalSizeForDEManu);
}
//_____________________________________________________________________________
AliMUON2DMap::AliMUON2DMap(const AliMUON2DMap& other)
: AliMUONVStore(),
-fMap(0x0),
-fOptimizeForDEManu(kFALSE)
+ fMap(new AliMpExMap(*other.fMap)),
+ fOptimizeForDEManu(other.fOptimizeForDEManu)
{
/// Copy constructor.
-
- other.CopyTo(*this);
}
//_____________________________________________________________________________
AliMUON2DMap::operator=(const AliMUON2DMap& other)
{
/// Assignment operator
-
- other.CopyTo(*this);
+ *fMap = *other.fMap;
+ fOptimizeForDEManu = other.fOptimizeForDEManu;
return *this;
}
{
/// Destructor.
/// We delete the map, which will delete the objects, as we're owner.
-
delete fMap;
}
return new AliMUON2DMap(fOptimizeForDEManu);
}
-//_____________________________________________________________________________
-void
-AliMUON2DMap::CopyTo(AliMUON2DMap& dest) const
-{
- /// Copy this into dest.
-
- delete dest.fMap;
- dest.fMap = new AliMpExMap(*fMap);
- dest.fOptimizeForDEManu = fOptimizeForDEManu;
-}
-
//_____________________________________________________________________________
Bool_t
AliMUON2DMap::Add(TObject* object)
{
/// Add object, using the decoding of uniqueID into two ints as the key
+ if (!object) return kFALSE;
UInt_t uniqueID = object->GetUniqueID();
Int_t j = ( uniqueID & 0xFFFF0000 ) >> 16;
Int_t i = ( uniqueID & 0xFFFF);
AliMUON2DMap::FindObject(Int_t i, Int_t j) const
{
/// Return the value at position (i,j).
-
AliMpExMap* m = static_cast<AliMpExMap*>(fMap->GetValue(i));
- if (m) return m->GetValue(j);
- return 0x0;
+ return m ? m->GetValue(j) : 0x0;
}
//_____________________________________________________________________________
{
// Create and return an iterator on this map
// Returned iterator must be deleted by user.
- if ( fMap )
- {
- return new AliMUON2DMapIterator(fMap);
- }
- return 0x0;
+ return new AliMUON2DMapIterator(*fMap);
}
//_____________________________________________________________________________
{
// Create and return an iterator on this map
// Returned iterator must be deleted by user.
- if ( fMap )
- {
- return new AliMUON2DMapIteratorByI(*fMap,firstI,lastI);
- }
- return 0x0;
+ return new AliMUON2DMapIteratorByI(*fMap,firstI,lastI);
}
//_____________________________________________________________________________
void
AliMUON2DMap::Clear(Option_t*)
{
- /// Reset
- delete fMap;
-
- fMap = new AliMpExMap(kTRUE);
-
- if ( fOptimizeForDEManu )
- {
- fMap->SetSize(228); // hard-coded constant in order not to depend on mapping
- // if this number ever change, it will not break the code, simply the
- // automatic resizing will give a warning...
- }
+ /// Clear memory
+ fMap->Clear();
}
//_____________________________________________________________________________
{
/// Return the number of objects we hold
AliMpExMap* m = static_cast<AliMpExMap*>(fMap->GetValue(i));
- if (m)
- {
- return m->GetSize();
- }
- return 0;
+ return m ? m->GetSize() : 0;
}
//_____________________________________________________________________________
return kTRUE;
}
-
-
-
-
virtual Int_t GetSize(Int_t i) const;
private:
- void CopyTo(AliMUON2DMap& destination) const;
Bool_t Set(Int_t i, Int_t j, TObject* object, Bool_t replace);
private:
+ static const Int_t fgkOptimalSizeForDEManu; ///< Optimal size for DEManu
+
AliMpExMap* fMap; ///< Our internal map (an AliMpExMap of AliMpExMaps)
Bool_t fOptimizeForDEManu; ///< whether (i,j) pair is supposed to be (DetElemId,ManuId) (allow us to allocate right amount of memory, that's all it does.
/// \endcond
//_____________________________________________________________________________
-AliMUON2DMapIterator::AliMUON2DMapIterator(AliMpExMap* theMap)
-: TIterator(),
-fMap(theMap),
+AliMUON2DMapIterator::AliMUON2DMapIterator(const AliMpExMap& theMap)
+: TIterator(),
+fkMap(&theMap),
fCurrentMap(0x0),
fI(-1),
fJ(-1)
//_____________________________________________________________________________
AliMUON2DMapIterator::AliMUON2DMapIterator(const AliMUON2DMapIterator& rhs)
: TIterator(rhs),
-fMap(rhs.fMap),
+fkMap(rhs.fkMap),
fCurrentMap(rhs.fCurrentMap),
fI(rhs.fI),
fJ(rhs.fI)
/// assignment operator
if ( this != &rhs )
{
- fMap = rhs.fMap;
+ fkMap = rhs.fkMap;
fCurrentMap = rhs.fCurrentMap;
fI = rhs.fI;
fJ = rhs.fJ;
if ( this != &rhs && rhs.IsA() == AliMUON2DMapIterator::Class() )
{
const AliMUON2DMapIterator& rhs1 = static_cast<const AliMUON2DMapIterator&>(rhs);
- fMap = rhs1.fMap;
+ fkMap = rhs1.fkMap;
fCurrentMap = rhs1.fCurrentMap;
fI = rhs1.fI;
fJ = rhs1.fJ;
AliMUON2DMapIterator::Map(Int_t i) const
{
/// Get the map at a given index
- return static_cast<AliMpExMap*>(fMap->GetObjectFast(i));
+ return static_cast<AliMpExMap*>(fkMap->GetObjectFast(i));
}
//_____________________________________________________________________________
else
{
++fI;
- if ( fI < fMap->GetSize() )
+ if ( fI < fkMap->GetSize() )
{
fCurrentMap = Map(fI);
fJ = -1;
fJ = -1;
fCurrentMap = 0x0;
- if ( fMap->GetSize() > 0 )
+ if ( fkMap->GetSize() > 0 )
{
fI = 0;
fCurrentMap = Map(fI);
class AliMUON2DMapIterator : public TIterator
{
public:
- AliMUON2DMapIterator(AliMpExMap* theMap);
+ AliMUON2DMapIterator(const AliMpExMap& theMap);
AliMUON2DMapIterator(const AliMUON2DMapIterator& rhs);
AliMUON2DMapIterator& operator=(const AliMUON2DMapIterator& rhs);
TIterator& operator=(const TIterator& rhs);
AliMpExMap* Map(Int_t i) const;
private:
- AliMpExMap* fMap; ///< Top map we iterate upon
+ const AliMpExMap* fkMap; ///< Top map we iterate upon
AliMpExMap* fCurrentMap; ///< Current map (inside top map) we are iterating upon
Int_t fI; ///< Map(fI) is fCurrentMap
Int_t fJ; ///< Current position in fCurrentMap
Int_t firstI,
Int_t lastI)
: TIterator(),
-fMap(&theMap),
+fkMap(&theMap),
fIter2(0x0),
fCurrentI(-1),
fCurrentJ(-1),
//_____________________________________________________________________________
AliMUON2DMapIteratorByI::AliMUON2DMapIteratorByI(const AliMUON2DMapIteratorByI& rhs)
:TIterator(rhs),
-fMap(rhs.fMap),
+fkMap(rhs.fkMap),
fIter2(0x0),
fCurrentI(rhs.fCurrentI),
fCurrentJ(rhs.fCurrentJ),
/// assignment operator
if ( this != &rhs )
{
- fMap = rhs.fMap;
+ fkMap = rhs.fkMap;
fIter2 = 0x0;
if ( rhs.fIter2 ) fIter2 = new TExMapIter(*(rhs.fIter2));
fCurrentI = rhs.fCurrentI;
AliMUON2DMapIteratorByI::operator=(const TIterator& rhs)
{
/// overriden assigment operator (imposed by Root's declaration of TIterator ?)
- if ( this != &rhs )
+ if ( this != &rhs && rhs.IsA() == AliMUON2DMapIteratorByI::Class() )
{
const AliMUON2DMapIteratorByI& rhs1 = static_cast<const AliMUON2DMapIteratorByI&>(rhs);
- fMap = rhs1.fMap;
+ fkMap = rhs1.fkMap;
fIter2 = 0x0;
if ( rhs1.fIter2 ) fIter2 = new TExMapIter(*(rhs1.fIter2));
fCurrentI = rhs1.fCurrentI;
while ( !m && fCurrentI < fLastI )
{
++fCurrentI;
- m = static_cast<AliMpExMap*>(fMap->GetValue(fCurrentI));
+ m = static_cast<AliMpExMap*>(fkMap->GetValue(fCurrentI));
}
if (!m) return 0x0; // we are done
fIter2 = new TExMapIter(m->GetIterator());
fCurrentI = fFirstI;
AliMpExMap* m;
- while ( !( m = static_cast<AliMpExMap*>(fMap->GetValue(fCurrentI) ) ) &&
+ while ( !( m = static_cast<AliMpExMap*>(fkMap->GetValue(fCurrentI) ) ) &&
fCurrentI < fLastI )
{
++fCurrentI;
TObject* GetValue(TExMapIter& iter, Int_t& key) const;
private:
- const AliMpExMap* fMap; //!< map to iterate upon
+ const AliMpExMap* fkMap; //!< map to iterate upon
TExMapIter* fIter2; //!< second iterator
Int_t fCurrentI; //!< current index in direction i
Int_t fCurrentJ; //!< current index in direction j
for ( Int_t i = 0; i < fClusters->GetSize(); ++i )
{
TClonesArray* tca = new TClonesArray("AliMUONRawCluster",100);
- tca->SetOwner(kTRUE);
fClusters->AddAt(tca,i);
}
AliDebug(1,"");
}
//_____________________________________________________________________________
-Bool_t
+AliMUONVCluster*
AliMUONClusterStoreV1::Add(const AliMUONVCluster& vCluster)
{
/// Add a cluster to this store
TClonesArray* array = ChamberClusters(iChamber);
if (!array)
{
- return kFALSE;
+ return 0x0;
}
- new((*array)[array->GetLast()+1]) AliMUONRawCluster(*cluster);
- return kTRUE;
+
+ return new((*array)[array->GetLast()+1]) AliMUONRawCluster(*cluster);
}
//_____________________________________________________________________________
using AliMUONVClusterStore::Add;
- virtual Bool_t Add(const AliMUONVCluster& Cluster);
+ virtual AliMUONVCluster* Add(const AliMUONVCluster& Cluster);
virtual AliMUONVCluster* Add(Int_t chamberId, Int_t detElemId, Int_t /*clusterIndex*/);
/// Whether the Connect(TTree&) method is implemented
}
//_____________________________________________________________________________
-Bool_t AliMUONClusterStoreV2::Add(const AliMUONVCluster& vCluster)
+AliMUONVCluster* AliMUONClusterStoreV2::Add(const AliMUONVCluster& vCluster)
{
/// Add a cluster to this store
const AliMUONRawClusterV2* cluster = dynamic_cast<const AliMUONRawClusterV2*>(&vCluster);
if (!cluster) {
AliError(Form("Cluster is not of the expected type (%s vs AliMUONRawClusterV2)",
vCluster.ClassName()));
- return kFALSE;
+ return 0x0;
}
// check chamberId
}
// check that there is no cluster with the same Id
- if (FindObject(cluster->GetUniqueID())) {
- AliError("cluster store already contains a cluster with the same ID --> add() aborted");
- return kFALSE;
+ AliMUONVCluster *c = FindObject(cluster->GetUniqueID());
+ if (c) {
+ AliError("cluster store already contains a cluster with the same ID --> add() aborted:");
+ c->Print("FULL");
+ return 0x0;
}
// add new cluster
- AliMUONVCluster *c = new((*fClusters)[fClusters->GetLast()+1]) AliMUONRawClusterV2(*cluster);
+ c = new((*fClusters)[fClusters->GetLast()+1]) AliMUONRawClusterV2(*cluster);
if (c) UpdateMap(*c);
- return kTRUE;
+ return c;
}
//_____________________________________________________________________________
using AliMUONVClusterStore::Add;
- virtual Bool_t Add(const AliMUONVCluster& Cluster);
+ virtual AliMUONVCluster* Add(const AliMUONVCluster& Cluster);
virtual AliMUONVCluster* Add(Int_t chamberId, Int_t detElemId, Int_t clusterIndex);
virtual AliMUONVCluster* Remove(AliMUONVCluster& cluster);
private:
AliMUONVStore* fGains; //!< Gains for the MUON TRK
Bool_t fSkip; //!< whether we should skip this run (because it's dummy)
- TString fComment; //<! comment for OCDB entry
+ TString fComment; //!< comment for OCDB entry
ClassDef(AliMUONGainSubprocessor,2) // A shuttle preprocessor for MUON TRK gains
};
/// Set the status map value
virtual void SetStatusMap(UInt_t statusMap) { fStatusMap = statusMap; }
- /// Whether this digit is real or virtual (a clustering detail...)
- virtual Bool_t IsVirtual() const { return TestBit(kVirtual); }
- /// Set the virtual status
- virtual void SetVirtual(Bool_t value) { SetBit(kVirtual,value); }
-
/// Set the ADC value (should be between 0 and 4095)
virtual void SetADC(Int_t adc) { fADC = adc; }
virtual void SetPadXY(Int_t padx, Int_t pady);
{
kSaturated = BIT(20), ///< to indicate that manas amplifier has saturated
kUsed = BIT(21), ///< whether the digit is used (e.g. in a cluster)
- kCalibrated = BIT(22), ///< whether the digit has been calibrated or not
- kVirtual = BIT(23) ///< whether the digit is virtual or not (see AZ)
+ kCalibrated = BIT(22) ///< whether the digit has been calibrated or not
};
ClassDef(AliMUONRealDigit,1) // Implementation of AliMUONVDigit
static AliMUONRecoParam *GetHighFluxParam();
/// set the calibration mode
- void SetCalibrationMode(Option_t* mode) { fCalibrationMode = mode; }
+ void SetCalibrationMode(Option_t* mode) { fCalibrationMode = mode; fCalibrationMode.ToUpper();}
/// get the calibration mode
Option_t* GetCalibrationMode() const { return fCalibrationMode.Data(); }
-
+
/// set the clustering (pre-clustering) mode
- void SetClusteringMode(Option_t* mode) {fClusteringMode = mode;}
+ void SetClusteringMode(Option_t* mode) {fClusteringMode = mode; fClusteringMode.ToUpper();}
/// get the clustering (pre-clustering) mode
Option_t* GetClusteringMode() const {return fClusteringMode.Data();}
/// set the tracking mode
- void SetTrackingMode(Option_t* mode) {fTrackingMode = mode;}
+ void SetTrackingMode(Option_t* mode) {fTrackingMode = mode; fTrackingMode.ToUpper();}
/// get the tracking mode
Option_t* GetTrackingMode() const {return fTrackingMode.Data();}
#include "AliMUONTrack.h"
-#include "AliMUONTrackParam.h"
#include "AliMUONRawClusterV2.h"
-#include "AliMUONObjectPair.h"
+#include "AliMUONObjectPair.h"
#include "AliMUONConstants.h"
-#include "AliMUONTrackExtrap.h"
+#include "AliMUONTrackExtrap.h"
#include "AliLog.h"
#include "AliESDMuonTrack.h"
//__________________________________________________________________________
AliMUONTrack::AliMUONTrack()
: TObject(),
- fTrackParamAtCluster(new TClonesArray("AliMUONTrackParam",10)),
+ fTrackParamAtCluster(0x0),
fFitWithVertex(kFALSE),
fVertexErrXY2(),
fFitWithMCS(kFALSE),
fLocalTrigger(0)
{
/// Default constructor
- fTrackParamAtCluster->SetOwner(kTRUE);
fVertexErrXY2[0] = 0.;
fVertexErrXY2[1] = 0.;
}
fLocalTrigger(0)
{
/// Constructor from two clusters
- fTrackParamAtCluster->SetOwner(kTRUE);
fVertexErrXY2[0] = 0.;
fVertexErrXY2[1] = 0.;
}
// order the clusters into the track according to the station the segment belong to
- //(the cluster first attached is the one from which we will start the tracking procedure)
+ // to anticipate the direction of propagation in the first tracking step
+ // (go backward if the segment is on the last station / go forward otherwise)
AliMUONVCluster *firstCluster, *lastCluster;
- if (cluster1->GetChamberId() == 8) {
+ if (cluster1->GetChamberId() == 8) { // last station
firstCluster = cluster1;
lastCluster = cluster2;
} else {
Double_t inverseBendingMomentum = 1. / AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(bendingImpact);
- // Set track parameters at first cluster
+ // Set track parameters at first cluster (needed by any tracking algorithm)
AliMUONTrackParam trackParamAtFirstCluster;
trackParamAtFirstCluster.SetZ(z1);
trackParamAtFirstCluster.SetNonBendingCoor(nonBendingCoor1);
trackParamAtFirstCluster.SetInverseBendingMomentum(inverseBendingMomentum);
- // Set track parameters at last cluster
+ // Set track parameters at last cluster (used by Kalman only)
AliMUONTrackParam trackParamAtLastCluster;
trackParamAtLastCluster.SetZ(z2);
trackParamAtLastCluster.SetNonBendingCoor(nonBendingCoor2);
trackParamAtLastCluster.SetInverseBendingMomentum(inverseBendingMomentum);
- // Compute and set track parameters covariances at first cluster
+ // Compute and set track parameters covariances at first cluster (needed by any tracking algorithm)
TMatrixD paramCov1(5,5);
paramCov1.Zero();
// Non bending plane
trackParamAtFirstCluster.SetCovariances(paramCov1);
- // Compute and set track parameters covariances at last cluster (as if the first cluster did not exist)
+ // Compute and set track parameters covariances at last cluster as if the first cluster did not exist (used by Kalman only)
TMatrixD paramCov2(5,5);
paramCov2.Zero();
// Non bending plane
//__________________________________________________________________________
AliMUONTrack::AliMUONTrack(const AliMUONTrack& track)
: TObject(track),
- fTrackParamAtCluster(new TClonesArray("AliMUONTrackParam",10)),
+ fTrackParamAtCluster(0x0),
fFitWithVertex(track.fFitWithVertex),
fVertexErrXY2(),
fFitWithMCS(track.fFitWithMCS),
///copy constructor
// necessary to make a copy of the objects and not only the pointers in TClonesArray.
- AliMUONTrackParam *trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->First();
- while (trackParamAtCluster) {
- new ((*fTrackParamAtCluster)[GetNClusters()]) AliMUONTrackParam(*trackParamAtCluster);
- trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->After(trackParamAtCluster);
+ if (track.fTrackParamAtCluster) {
+ fTrackParamAtCluster = new TClonesArray("AliMUONTrackParam",10);
+ AliMUONTrackParam *trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->First();
+ while (trackParamAtCluster) {
+ new ((*fTrackParamAtCluster)[GetNClusters()]) AliMUONTrackParam(*trackParamAtCluster);
+ trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->After(trackParamAtCluster);
+ }
}
// copy vertex resolution square used during the tracking procedure
// base class assignement
TObject::operator=(track);
-
- // necessary to make a copy of the objects and not only the pointers in TClonesArray.
- fTrackParamAtCluster = new TClonesArray("AliMUONTrackParam",10);
- AliMUONTrackParam *trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->First();
- while (trackParamAtCluster) {
- new ((*fTrackParamAtCluster)[GetNClusters()]) AliMUONTrackParam(*trackParamAtCluster);
- trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->After(trackParamAtCluster);
+
+ // clear memory
+ Clear();
+
+ // necessary to make a copy of the objects and not only the pointers in TClonesArray
+ if (track.fTrackParamAtCluster) {
+ fTrackParamAtCluster = new TClonesArray("AliMUONTrackParam",10);
+ AliMUONTrackParam *trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->First();
+ while (trackParamAtCluster) {
+ new ((*fTrackParamAtCluster)[GetNClusters()]) AliMUONTrackParam(*trackParamAtCluster);
+ trackParamAtCluster = (AliMUONTrackParam*) track.fTrackParamAtCluster->After(trackParamAtCluster);
+ }
}
// copy cluster weights matrix if any
fClusterWeightsNonBending->ResizeTo(*(track.fClusterWeightsNonBending));
*fClusterWeightsNonBending = *(track.fClusterWeightsNonBending);
} else fClusterWeightsNonBending = new TMatrixD(*(track.fClusterWeightsNonBending));
- } else if (fClusterWeightsNonBending) {
- delete fClusterWeightsNonBending;
- fClusterWeightsNonBending = 0x0;
}
// copy cluster weights matrix if any
fClusterWeightsBending->ResizeTo(*(track.fClusterWeightsBending));
*fClusterWeightsBending = *(track.fClusterWeightsBending);
} else fClusterWeightsBending = new TMatrixD(*(track.fClusterWeightsBending));
- } else if (fClusterWeightsBending) {
- delete fClusterWeightsBending;
- fClusterWeightsBending = 0x0;
}
// copy track parameters at vertex if any
if (track.fTrackParamAtVertex) {
if (fTrackParamAtVertex) *fTrackParamAtVertex = *(track.fTrackParamAtVertex);
else fTrackParamAtVertex = new AliMUONTrackParam(*(track.fTrackParamAtVertex));
- } else if (fTrackParamAtVertex) {
- delete fTrackParamAtVertex;
- fTrackParamAtVertex = 0x0;
}
fFitWithVertex = track.fFitWithVertex;
void AliMUONTrack::Clear(Option_t* opt)
{
/// Clear arrays
- fTrackParamAtCluster->Clear(opt);
+ if (opt && opt[0] == 'C' && fTrackParamAtCluster) fTrackParamAtCluster->Clear("C");
+ else {
+ delete fTrackParamAtCluster;
+ fTrackParamAtCluster = 0x0;
+ }
delete fClusterWeightsNonBending; fClusterWeightsNonBending = 0x0;
delete fClusterWeightsBending; fClusterWeightsBending = 0x0;
delete fTrackParamAtVertex; fTrackParamAtVertex = 0x0;
}
+ //__________________________________________________________________________
+TClonesArray* AliMUONTrack::GetTrackParamAtCluster() const
+{
+ /// return array of track parameters at cluster (create it if needed)
+ if (!fTrackParamAtCluster) fTrackParamAtCluster = new TClonesArray("AliMUONTrackParam",10);
+ return fTrackParamAtCluster;
+}
+
//__________________________________________________________________________
void AliMUONTrack::AddTrackParamAtCluster(const AliMUONTrackParam &trackParam, AliMUONVCluster &cluster, Bool_t copy)
{
}
// add parameters to the array of track parameters
+ if (!fTrackParamAtCluster) fTrackParamAtCluster = new TClonesArray("AliMUONTrackParam",10);
AliMUONTrackParam* trackParamAtCluster = new ((*fTrackParamAtCluster)[GetNClusters()]) AliMUONTrackParam(trackParam);
// link parameters with the associated cluster or its copy
AliMUONVCluster *clusterCopy = static_cast<AliMUONVCluster*>(cluster.Clone());
trackParamAtCluster->SetClusterPtr(clusterCopy, kTRUE);
} else trackParamAtCluster->SetClusterPtr(&cluster);
+
+ // sort the array of track parameters
+ fTrackParamAtCluster->Sort();
}
//__________________________________________________________________________
void AliMUONTrack::RemoveTrackParamAtCluster(AliMUONTrackParam *trackParam)
{
/// Remove trackParam from the array of TrackParamAtCluster
- if (!fTrackParamAtCluster->Remove(trackParam)) {
+ if (!fTrackParamAtCluster || !fTrackParamAtCluster->Remove(trackParam)) {
AliWarning("object to remove does not exist in array fTrackParamAtCluster");
return;
}
trackParamAtCluster = (AliMUONTrackParam*) (fTrackParamAtCluster->After(trackParamAtCluster));
}
+}
+
+ //__________________________________________________________________________
+Bool_t AliMUONTrack::IsValid()
+{
+ /// check the validity of the current track (at least one cluster per station)
+
+ Int_t nClusters = GetNClusters();
+ AliMUONTrackParam *trackParam;
+ Int_t currentStation = 0, expectedStation = 0;
+
+ for (Int_t i = 0; i < nClusters; i++) {
+ trackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(i);
+
+ currentStation = trackParam->GetClusterPtr()->GetChamberId()/2;
+
+ // missing station
+ if (currentStation > expectedStation) return kFALSE;
+
+ // found station --> look for next one
+ if (currentStation == expectedStation) expectedStation++;
+
+ }
+
+ return currentStation == AliMUONConstants::NTrackingSt() - 1;
+
+}
+
+ //__________________________________________________________________________
+void AliMUONTrack::TagRemovableClusters() {
+ /// Identify clusters that can be removed from the track,
+ /// with the only requirement to have at least 1 cluster per station
+
+ Int_t nClusters = GetNClusters();
+ AliMUONTrackParam *trackParam, *nextTrackParam;
+ Int_t currentCh, nextCh;
+
+ // reset flags to default
+ for (Int_t i = 0; i < nClusters; i++) {
+ trackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(i);
+ trackParam->SetRemovable(kFALSE);
+ }
+
+ // loop over track parameters
+ for (Int_t i = 0; i < nClusters; i++) {
+ trackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(i);
+
+ currentCh = trackParam->GetClusterPtr()->GetChamberId();
+
+ // loop over next track parameters
+ for (Int_t j = i+1; j < nClusters; j++) {
+ nextTrackParam = (AliMUONTrackParam*) fTrackParamAtCluster->UncheckedAt(j);
+
+ nextCh = nextTrackParam->GetClusterPtr()->GetChamberId();
+
+ // check if the 2 clusters are on the same station
+ if (nextCh/2 != currentCh/2) break;
+
+ // set clusters in the same station as being removable
+ trackParam->SetRemovable(kTRUE);
+ nextTrackParam->SetRemovable(kTRUE);
+
+ }
+
+ }
+
}
//__________________________________________________________________________
/// - Also recompute the weight matrices of the attached clusters if accountForMCS=kTRUE
/// - Assume that track parameters at each cluster are corrects
/// - Return kFALSE if computation failed
+ AliDebug(1,"Enter ComputeLocalChi2");
+
+ if (!fTrackParamAtCluster) {
+ AliWarning("no cluster attached to this track");
+ return kFALSE;
+ }
if (accountForMCS) { // Compute local chi2 taking into account multiple scattering effects
/// - Assume that track parameters at each cluster are corrects
/// - Assume the cluster weights matrices are corrects
/// - Return negative value if chi2 computation failed
+ AliDebug(1,"Enter ComputeGlobalChi2");
+
+ if (!fTrackParamAtCluster) {
+ AliWarning("no cluster attached to this track");
+ return 1.e10;
+ }
Double_t chi2 = 0.;
/// - Use the provided MCS covariance matrix if any (otherwise build it temporarily)
/// - Assume that track parameters at each cluster are corrects
/// - Return kFALSE if computation failed
+ AliDebug(1,"Enter ComputeClusterWeights1");
+
+ if (!fTrackParamAtCluster) {
+ AliWarning("no cluster attached to this track");
+ return kFALSE;
+ }
// Alocate memory
Int_t nClusters = GetNClusters();
/// accounting for multiple scattering correlations and cluster resolution
/// - Use the provided MCS covariance matrix if any (otherwise build it temporarily)
/// - Return kFALSE if computation failed
+ AliDebug(1,"Enter ComputeClusterWeights2");
// Check MCS covariance matrix and recompute it if need
Int_t nClusters = GetNClusters();
{
/// Compute the multiple scattering covariance matrix
/// (assume that track parameters at each cluster are corrects)
+ AliDebug(1,"Enter ComputeMCSCovariances");
// Reset the size of the covariance matrix if needed
Int_t nClusters = GetNClusters();
{
/// Returns the number of clusters in common between the current track ("this")
/// and the track pointed to by "track".
+ if (!fTrackParamAtCluster || !this->fTrackParamAtCluster) return 0;
Int_t clustersInCommon = 0;
AliMUONTrackParam *trackParamAtCluster1, *trackParamAtCluster2;
// Loop over clusters of first track
Bool_t *compatibleCluster = new Bool_t[AliMUONConstants::NTrackingCh()];
for ( Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++) compatibleCluster[ch] = kFALSE;
+ if (!fTrackParamAtCluster || !this->fTrackParamAtCluster) return compatibleCluster;
+
// Loop over clusters of first track
trackParamAtCluster1 = (AliMUONTrackParam*) this->fTrackParamAtCluster->First();
while (trackParamAtCluster1) {
", LoTrgNum=" << setw(3) << GetLoTrgNum() <<
", Chi2-tracking-trigger=" << setw(8) << setprecision(5) << GetChi2MatchTrigger();
cout << Form(" HitTriggerPattern %x",fHitsPatternInTrigCh) << endl;
- fTrackParamAtCluster->First()->Print("FULL");
+ if (fTrackParamAtCluster) fTrackParamAtCluster->First()->Print("FULL");
}
//__________________________________________________________________________
AliMUONTrack (const AliMUONTrack& track); // copy constructor
AliMUONTrack& operator=(const AliMUONTrack& track); // assignment operator
-
- /// return array of track parameters at cluster
- TClonesArray* GetTrackParamAtCluster() const {return fTrackParamAtCluster;}
+ TClonesArray* GetTrackParamAtCluster() const;
void AddTrackParamAtCluster(const AliMUONTrackParam &trackParam, AliMUONVCluster &cluster, Bool_t copy = kFALSE);
void RemoveTrackParamAtCluster(AliMUONTrackParam *trackParam);
void UpdateTrackParamAtCluster();
void UpdateCovTrackParamAtCluster();
+ Bool_t IsValid();
+
+ void TagRemovableClusters();
+
/// return the number of clusters attached to the track
- Int_t GetNClusters() const {return fTrackParamAtCluster->GetEntriesFast();}
+ Int_t GetNClusters() const {return fTrackParamAtCluster ? fTrackParamAtCluster->GetEntriesFast() : 0;}
/// return kTrue if the vertex must be used to constrain the fit, kFalse if not
Bool_t FitWithVertex() const {return fFitWithVertex;}
private:
- TClonesArray* fTrackParamAtCluster; ///< Track parameters at cluster
+ mutable TClonesArray* fTrackParamAtCluster; ///< Track parameters at cluster
Bool_t fFitWithVertex; //!< kTRUE if using the vertex to constrain the fit, kFALSE if not
Double_t fVertexErrXY2[2]; //!< Vertex resolution square used during the tracking procedure if required
fClusterPtr(0x0),
fOwnCluster(kFALSE),
fRemovable(kFALSE),
- fAloneInChamber(kTRUE),
fTrackChi2(0.),
fLocalChi2(0.)
{
fClusterPtr(0x0),
fOwnCluster(theMUONTrackParam.fOwnCluster),
fRemovable(theMUONTrackParam.fRemovable),
- fAloneInChamber(theMUONTrackParam.fAloneInChamber),
fTrackChi2(theMUONTrackParam.fTrackChi2),
fLocalChi2(theMUONTrackParam.fLocalChi2)
{
fSmoothCovariances = 0x0;
}
+ if (fOwnCluster) delete fClusterPtr;
fOwnCluster = theMUONTrackParam.fOwnCluster;
if(fOwnCluster) fClusterPtr = static_cast<AliMUONVCluster*>(theMUONTrackParam.fClusterPtr->Clone());
else fClusterPtr = theMUONTrackParam.fClusterPtr;
fRemovable = theMUONTrackParam.fRemovable;
- fAloneInChamber = theMUONTrackParam.fAloneInChamber;
-
fTrackChi2 = theMUONTrackParam.fTrackChi2;
fLocalChi2 = theMUONTrackParam.fLocalChi2;
/// set the flag telling whether the associated cluster can be removed from the track it belongs to or not
void SetRemovable(Bool_t removable) {fRemovable = removable;}
- /// return kTRUE if the associated cluster alone in its chamber
- Bool_t IsAloneInChamber() const {return fAloneInChamber;}
- /// set the flag telling whether the associated hi alone in its chamber or not
- void SetAloneInChamber(Bool_t aloneInChamber) {fAloneInChamber = aloneInChamber;}
-
/// return the chi2 of the track when the associated cluster was attached
Double_t GetTrackChi2() const {return fTrackChi2;}
/// set the chi2 of the track when the associated cluster was attached
Bool_t fRemovable; //!< kTRUE if the associated cluster can be removed from the track it belongs to
- Bool_t fAloneInChamber; //!< kTRUE if the associated cluster is alone in its chamber
-
Double_t fTrackChi2; //!< Chi2 of the track when the associated cluster was attached
Double_t fLocalChi2; //!< Local chi2 of the associated cluster with respect to the track
AliMUONTrack *newTrack = 0x0;
AliMUONVCluster *clusterCh1, *clusterCh2;
AliMUONTrackParam extrapTrackParam;
+ AliMUONTrackParam extrapTrackParamAtCh;
AliMUONTrackParam extrapTrackParamAtCluster1;
AliMUONTrackParam extrapTrackParamAtCluster2;
AliMUONTrackParam bestTrackParamAtCluster1;
for (Int_t i = 0; i < nClusters; i++) clusterCh1Used[i] = kFALSE;
Int_t iCluster1;
- // Get track parameters
- AliMUONTrackParam extrapTrackParamAtCh(*(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First());
+ // Get track parameters according to the propagation direction
+ if (nextStation==4) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
+ else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
// Add MCS effect
AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
// Update TrackParamAtCluster
track.AddTrackParamAtCluster(trackParamAtCluster,*cluster);
- track.GetTrackParamAtCluster()->Sort();
}
// Update TrackParamAtCluster
track.AddTrackParamAtCluster(trackParamAtCluster1,*cluster1);
track.AddTrackParamAtCluster(trackParamAtCluster2,*cluster2);
- track.GetTrackParamAtCluster()->Sort();
}
/// w/wo multiple Coulomb scattering according to "includeMCS".
/// w/wo constraining the vertex according to "fitWithVertex".
/// calculating or not the covariance matrix according to "calcCov".
+ AliDebug(1,"Enter Fit");
Double_t benC, errorParam, invBenP, nonBenC, x, y;
AliMUONTrackParam *trackParam;
// mandatory limits in Bending to avoid NaN values of parameters
gMinuit->mnparm(2, "Y", trackParam->GetBendingCoor(), 0.10, -500.0, 500.0, status);
gMinuit->mnparm(3, "BenS", trackParam->GetBendingSlope(), 0.001, -0.5, 0.5, status);
- gMinuit->mnparm(4, "InvBenP", trackParam->GetInverseBendingMomentum(), 0.003, -0.4, 0.4, status);
+ gMinuit->mnparm(4, "InvBenP", trackParam->GetInverseBendingMomentum(), 0.003, -0.5, 0.5, status);
// minimization
gMinuit->mnexcm("MIGRAD", arg, 0, status);
// add new cluster if any
if (foundOneCluster) {
- UpdateTrack(*track,bestTrackParamAtCluster);
- bestTrackParamAtCluster.SetAloneInChamber(kFALSE);
- trackParam->SetAloneInChamber(kFALSE);
+ trackParam->SetRemovable(kTRUE);
+ bestTrackParamAtCluster.SetRemovable(kTRUE);
+ track->AddTrackParamAtCluster(bestTrackParamAtCluster,*(bestTrackParamAtCluster.GetClusterPtr()));
trackModified = kTRUE;
}
}
//__________________________________________________________________________
-void AliMUONTrackReconstructor::ImproveTracks()
+void AliMUONTrackReconstructor::ImproveTrack(AliMUONTrack &track)
{
- /// Improve tracks by removing clusters with local chi2 highter than the defined cut
+ /// Improve the given track by removing clusters with local chi2 highter than the defined cut
/// Recompute track parameters and covariances at the remaining clusters
- AliDebug(1,"Enter ImproveTracks");
+ AliDebug(1,"Enter ImproveTrack");
Double_t localChi2, worstLocalChi2;
- Int_t worstChamber, previousChamber;
- AliMUONTrack *track, *nextTrack;
- AliMUONTrackParam *trackParamAtCluster, *worstTrackParamAtCluster, *previousTrackParam, *nextTrackParam;
+ AliMUONTrackParam *trackParamAtCluster, *worstTrackParamAtCluster;
Double_t sigmaCut2 = AliMUONReconstructor::GetRecoParam()->GetSigmaCutForImprovement() *
AliMUONReconstructor::GetRecoParam()->GetSigmaCutForImprovement();
- // Remove double track to improve only "good" tracks
- RemoveDoubleTracks();
-
- track = (AliMUONTrack*) fRecTracksPtr->First();
- while (track) {
+ while (!track.IsImproved()) {
- // prepare next track in case the actual track is suppressed
- nextTrack = (AliMUONTrack*) fRecTracksPtr->After(track);
+ // identify removable clusters
+ track.TagRemovableClusters();
- while (!track->IsImproved()) {
-
- // Update track parameters and covariances
- track->UpdateCovTrackParamAtCluster();
-
- // Compute local chi2 of each clusters
- track->ComputeLocalChi2(kTRUE);
-
- // Look for the cluster to remove
- worstTrackParamAtCluster = NULL;
- worstLocalChi2 = 0.;
- trackParamAtCluster = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->First();
- while (trackParamAtCluster) {
-
- // Pick up cluster with the worst chi2
- localChi2 = trackParamAtCluster->GetLocalChi2();
- if (localChi2 > worstLocalChi2) {
- worstLocalChi2 = localChi2;
- worstTrackParamAtCluster = trackParamAtCluster;
- }
-
- trackParamAtCluster = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(trackParamAtCluster);
- }
-
- // Check if bad cluster found
- if (!worstTrackParamAtCluster) {
- track->SetImproved(kTRUE);
- break;
- }
-
- // Check whether the worst chi2 is under requirement or not
- if (worstLocalChi2 < 2. * sigmaCut2) { // 2 because 2 quantities in chi2
- track->SetImproved(kTRUE);
- break;
- }
-
- // if the worst cluster is not removable then remove the entire track
- if (!worstTrackParamAtCluster->IsRemovable() && worstTrackParamAtCluster->IsAloneInChamber()) {
- fRecTracksPtr->Remove(track);
- fNRecTracks--;
- break;
- }
-
- // Reset the second cluster in the same station as being not removable
- // or reset the second cluster in the same chamber as being alone
- worstChamber = worstTrackParamAtCluster->GetClusterPtr()->GetChamberId();
- previousTrackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->Before(worstTrackParamAtCluster);
- nextTrackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(worstTrackParamAtCluster);
- if (worstTrackParamAtCluster->IsAloneInChamber()) { // Worst cluster removable and alone in chamber
-
- if (worstChamber%2 == 0) { // Modify flags in next chamber
-
- nextTrackParam->SetRemovable(kFALSE);
- if (!nextTrackParam->IsAloneInChamber()) // Make sure both clusters in second chamber are not removable anymore
- ((AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(nextTrackParam))->SetRemovable(kFALSE);
-
- } else { // Modify flags in previous chamber
-
- previousTrackParam->SetRemovable(kFALSE);
- if (!previousTrackParam->IsAloneInChamber()) // Make sure both clusters in second chamber are not removable anymore
- ((AliMUONTrackParam*) track->GetTrackParamAtCluster()->Before(previousTrackParam))->SetRemovable(kFALSE);
-
- }
-
- } else { // Worst cluster not alone in its chamber
-
- if (previousTrackParam) previousChamber = previousTrackParam->GetClusterPtr()->GetChamberId();
- else previousChamber = -1;
-
- if (previousChamber == worstChamber) { // the second cluster on the same chamber is the previous one
-
- previousTrackParam->SetAloneInChamber(kTRUE);
- // transfert the removability to the second cluster
- if (worstTrackParamAtCluster->IsRemovable()) previousTrackParam->SetRemovable(kTRUE);
-
- } else { // the second cluster on the same chamber is the next one
-
- nextTrackParam->SetAloneInChamber(kTRUE);
- // transfert the removability to the second cluster
- if (worstTrackParamAtCluster->IsRemovable()) nextTrackParam->SetRemovable(kTRUE);
-
- }
-
- }
-
- // Remove the worst cluster
- track->RemoveTrackParamAtCluster(worstTrackParamAtCluster);
-
- // Re-fit the track:
- // Take into account the multiple scattering
- // Calculate the track parameter covariance matrix
- Fit(*track, kTRUE, kFALSE, kTRUE);
+ // Update track parameters and covariances
+ track.UpdateCovTrackParamAtCluster();
+
+ // Compute local chi2 of each clusters
+ track.ComputeLocalChi2(kTRUE);
+
+ // Look for the cluster to remove
+ worstTrackParamAtCluster = NULL;
+ worstLocalChi2 = 0.;
+ trackParamAtCluster = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
+ while (trackParamAtCluster) {
- // Printout for debuging
- if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "ImproveTracks: track " << fRecTracksPtr->IndexOf(track)+1 << " improved " << endl;
+ // Pick up cluster with the worst chi2
+ localChi2 = trackParamAtCluster->GetLocalChi2();
+ if (localChi2 > worstLocalChi2) {
+ worstLocalChi2 = localChi2;
+ worstTrackParamAtCluster = trackParamAtCluster;
}
+ trackParamAtCluster = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(trackParamAtCluster);
+ }
+
+ // Check if worst cluster found
+ if (!worstTrackParamAtCluster) {
+ AliWarning("Bad local chi2 values?");
+ break;
+ }
+
+ // Check whether the worst chi2 is under requirement or not
+ if (worstLocalChi2 < 2. * sigmaCut2) { // 2 because 2 quantities in chi2
+ track.SetImproved(kTRUE);
+ break;
+ }
+
+ // if the worst cluster is not removable then stop improvement
+ if (!worstTrackParamAtCluster->IsRemovable()) break;
+
+ // Remove the worst cluster
+ track.RemoveTrackParamAtCluster(worstTrackParamAtCluster);
+
+ // Re-fit the track:
+ // Take into account the multiple scattering
+ // Calculate the track parameter covariance matrix
+ Fit(track, kTRUE, kFALSE, kTRUE);
+
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
+ cout << "ImproveTracks: track " << fRecTracksPtr->IndexOf(&track)+1 << " improved " << endl;
}
- track = nextTrack;
}
- // compress the array in case of some tracks have been removed
- fRecTracksPtr->Compress();
-
}
//__________________________________________________________________________
-void AliMUONTrackReconstructor::Finalize()
+void AliMUONTrackReconstructor::FinalizeTrack(AliMUONTrack &track)
{
- /// Recompute track parameters and covariances at each attached cluster from those at the first one
-
- AliMUONTrack *track;
-
- track = (AliMUONTrack*) fRecTracksPtr->First();
- while (track) {
-
- // update track parameters if not already done
- if (!track->IsImproved()) track->UpdateCovTrackParamAtCluster();
-
- track = (AliMUONTrack*) fRecTracksPtr->After(track);
-
- }
-
+ /// Recompute track parameters and covariances at each attached cluster
+ /// from those at the first one, if not already done
+ AliDebug(1,"Enter FinalizeTrack");
+ if (!track.IsImproved()) track.UpdateCovTrackParamAtCluster();
}
virtual void MakeTrackCandidates(AliMUONVClusterStore& clusterStore);
virtual void FollowTracks(AliMUONVClusterStore& clusterStore);
virtual void ComplementTracks(const AliMUONVClusterStore& clusterStore);
- virtual void ImproveTracks();
- virtual void Finalize();
+ virtual void ImproveTrack(AliMUONTrack &track);
+ virtual void FinalizeTrack(AliMUONTrack &track);
private:
/// Re-run the kalman filter from the most downstream cluster to the most uptream one
AliDebug(1,"Enter RetraceTrack");
- AliMUONTrackParam* startingTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Last();
+ AliMUONTrackParam* lastTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Last();
// Reset the "seed" (= track parameters and their covariances at last cluster) if required
if (resetSeed) {
- // => Shift track parameters at the position of the last cluster
- AliMUONVCluster* cluster = startingTrackParam->GetClusterPtr();
- startingTrackParam->SetNonBendingCoor(cluster->GetX());
- startingTrackParam->SetBendingCoor(cluster->GetY());
-
- // => Re-compute and reset track parameters covariances at last cluster (as if the other clusters did not exist)
- const TMatrixD& kParamCov = startingTrackParam->GetCovariances();
- TMatrixD newParamCov(5,5);
- newParamCov.Zero();
+
+ // parameters at last cluster
+ AliMUONVCluster* cluster2 = lastTrackParam->GetClusterPtr();
+ Double_t x2 = cluster2->GetX();
+ Double_t y2 = cluster2->GetY();
+ Double_t z2 = cluster2->GetZ();
+
+ // parameters at last but one cluster
+ AliMUONTrackParam* previousTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Before(lastTrackParam);
+ AliMUONVCluster* cluster1 = previousTrackParam->GetClusterPtr();
+ Double_t x1 = cluster1->GetX();
+ Double_t y1 = cluster1->GetY();
+ Double_t z1 = cluster1->GetZ();
+
+ // reset track parameters
+ Double_t dZ = z1 - z2;
+ lastTrackParam->SetNonBendingCoor(x2);
+ lastTrackParam->SetBendingCoor(y2);
+ lastTrackParam->SetZ(z2);
+ lastTrackParam->SetNonBendingSlope((x1 - x2) / dZ);
+ lastTrackParam->SetBendingSlope((y1 - y2) / dZ);
+ Double_t bendingImpact = y2 - z2 * lastTrackParam->GetBendingSlope();
+ lastTrackParam->SetInverseBendingMomentum(1. / AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(bendingImpact));
+
+ // => Reset track parameter covariances at last cluster (as if the other clusters did not exist)
+ TMatrixD lastParamCov(5,5);
+ lastParamCov.Zero();
// Non bending plane
- newParamCov(0,0) = cluster->GetErrX2();
- newParamCov(1,1) = 100.*kParamCov(1,1);
+ lastParamCov(0,0) = cluster2->GetErrX2();
+ lastParamCov(1,1) = 100. * ( cluster1->GetErrX2() + cluster2->GetErrX2() ) / dZ / dZ;
// Bending plane
- newParamCov(2,2) = cluster->GetErrY2();
- newParamCov(3,3) = 100.*kParamCov(3,3);
- // Inverse bending momentum
- newParamCov(4,4) = 0.5*startingTrackParam->GetInverseBendingMomentum() * 0.5*startingTrackParam->GetInverseBendingMomentum();
- startingTrackParam->SetCovariances(newParamCov);
+ lastParamCov(2,2) = cluster2->GetErrY2();
+ lastParamCov(3,3) = 100. * ( cluster1->GetErrY2() + cluster2->GetErrY2() ) / dZ / dZ;
+ // Inverse bending momentum (50% error)
+ lastParamCov(4,4) = 0.5*lastTrackParam->GetInverseBendingMomentum() * 0.5*lastTrackParam->GetInverseBendingMomentum();
+ lastTrackParam->SetCovariances(lastParamCov);
// Reset the track chi2
- startingTrackParam->SetTrackChi2(0.);
+ lastTrackParam->SetTrackChi2(0.);
}
// Redo the tracking
- RetracePartialTrack(trackCandidate, startingTrackParam);
+ RetracePartialTrack(trackCandidate, lastTrackParam);
}
AliMUONTrack *newTrack = 0x0;
AliMUONVCluster *clusterCh1, *clusterCh2;
AliMUONTrackParam extrapTrackParam;
+ AliMUONTrackParam extrapTrackParamAtCh;
AliMUONTrackParam extrapTrackParamAtCluster1;
AliMUONTrackParam extrapTrackParamAtCluster2;
AliMUONTrackParam bestTrackParamAtCluster1;
for (Int_t i = 0; i < nClusters; i++) clusterCh1Used[i] = kFALSE;
Int_t iCluster1;
- // Get track parameters
- AliMUONTrackParam extrapTrackParamAtCh(*(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First());
+ // Get track parameters according to the propagation direction
+
+ if (nextStation==4) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
+ else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
// Add MCS effect
AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
// Update array of TrackParamAtCluster
track.AddTrackParamAtCluster(trackParamAtCluster,*(trackParamAtCluster.GetClusterPtr()));
- track.GetTrackParamAtCluster()->Sort();
}
// Update array of trackParamAtCluster
track.AddTrackParamAtCluster(trackParamAtCluster1,*cluster1);
track.AddTrackParamAtCluster(trackParamAtCluster2,*cluster2);
- track.GetTrackParamAtCluster()->Sort();
}
// add new cluster if any
if (foundOneCluster) {
- UpdateTrack(*track,bestTrackParamAtCluster,bestAddChi2TrackAtCluster);
- bestTrackParamAtCluster.SetAloneInChamber(kFALSE);
- trackParam->SetAloneInChamber(kFALSE);
+ trackParam->SetRemovable(kTRUE);
+ bestTrackParamAtCluster.SetRemovable(kTRUE);
+ track->AddTrackParamAtCluster(bestTrackParamAtCluster,*(bestTrackParamAtCluster.GetClusterPtr()));
trackModified = kTRUE;
}
}
//__________________________________________________________________________
-void AliMUONTrackReconstructorK::ImproveTracks()
+void AliMUONTrackReconstructorK::ImproveTrack(AliMUONTrack &track)
{
- /// Improve tracks by removing clusters with local chi2 highter than the defined cut
+ /// Improve the given track by removing removable clusters with local chi2 highter than the defined cut
+ /// Removable clusters are identified by the method AliMUONTrack::TagRemovableClusters()
/// Recompute track parameters and covariances at the remaining clusters
- AliDebug(1,"Enter ImproveTracks");
+ AliDebug(1,"Enter ImproveTrack");
Double_t localChi2, worstLocalChi2;
- Int_t worstChamber, previousChamber;
- AliMUONTrack *track, *nextTrack;
- AliMUONTrackParam *trackParamAtCluster, *worstTrackParamAtCluster, *previousTrackParam, *nextTrackParam;
+ AliMUONTrackParam *trackParamAtCluster, *worstTrackParamAtCluster, *nextTrackParam;
Bool_t smoothed;
Double_t sigmaCut2 = AliMUONReconstructor::GetRecoParam()->GetSigmaCutForImprovement() *
AliMUONReconstructor::GetRecoParam()->GetSigmaCutForImprovement();
- // Remove double track to improve only "good" tracks
- RemoveDoubleTracks();
-
- track = (AliMUONTrack*) fRecTracksPtr->First();
- while (track) {
+ while (!track.IsImproved()) {
- // prepare next track in case the actual track is suppressed
- nextTrack = (AliMUONTrack*) fRecTracksPtr->After(track);
+ // identify removable clusters
+ track.TagRemovableClusters();
- while (!track->IsImproved()) {
+ // Run smoother if required
+ smoothed = kFALSE;
+ if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) smoothed = RunSmoother(track);
+
+ // Use standard procedure to compute local chi2 if smoother not required or not working
+ if (!smoothed) {
- // Run smoother if required
- smoothed = kFALSE;
- if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) smoothed = RunSmoother(*track);
+ // Update track parameters and covariances
+ track.UpdateCovTrackParamAtCluster();
- // Use standard procedure to compute local chi2 if smoother not required or not working
- if (!smoothed) {
-
- // Update track parameters and covariances
- track->UpdateCovTrackParamAtCluster();
-
- // Compute local chi2 of each clusters
- track->ComputeLocalChi2(kTRUE);
- }
-
- // Look for the cluster to remove
- worstTrackParamAtCluster = NULL;
- worstLocalChi2 = 0.;
- trackParamAtCluster = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->First();
- while (trackParamAtCluster) {
-
- // save parameters into smooth parameters in case of smoother did not work properly
- if (AliMUONReconstructor::GetRecoParam()->UseSmoother() && !smoothed) {
- trackParamAtCluster->SetSmoothParameters(trackParamAtCluster->GetParameters());
- trackParamAtCluster->SetSmoothCovariances(trackParamAtCluster->GetCovariances());
- }
-
- // Pick up cluster with the worst chi2
- localChi2 = trackParamAtCluster->GetLocalChi2();
- if (localChi2 > worstLocalChi2) {
- worstLocalChi2 = localChi2;
- worstTrackParamAtCluster = trackParamAtCluster;
- }
-
- trackParamAtCluster = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->After(trackParamAtCluster);
- }
+ // Compute local chi2 of each clusters
+ track.ComputeLocalChi2(kTRUE);
+ }
+
+ // Look for the cluster to remove
+ worstTrackParamAtCluster = 0x0;
+ worstLocalChi2 = 0.;
+ trackParamAtCluster = (AliMUONTrackParam*)track.GetTrackParamAtCluster()->First();
+ while (trackParamAtCluster) {
- // Check if bad removable cluster found
- if (!worstTrackParamAtCluster) {
- track->SetImproved(kTRUE);
- break;
+ // save parameters into smooth parameters in case of smoother did not work properly
+ if (AliMUONReconstructor::GetRecoParam()->UseSmoother() && !smoothed) {
+ trackParamAtCluster->SetSmoothParameters(trackParamAtCluster->GetParameters());
+ trackParamAtCluster->SetSmoothCovariances(trackParamAtCluster->GetCovariances());
}
- // Check whether the worst chi2 is under requirement or not
- if (worstLocalChi2 < 2. * sigmaCut2) { // 2 because 2 quantities in chi2
- track->SetImproved(kTRUE);
- break;
- }
-
- // if the worst cluster is not removable then remove the entire track
- if (!worstTrackParamAtCluster->IsRemovable() && worstTrackParamAtCluster->IsAloneInChamber()) {
- fRecTracksPtr->Remove(track);
- fNRecTracks--;
- break;
- }
-
- // Reset the second cluster in the same station as being not removable
- // or reset the second cluster in the same chamber as being alone
- worstChamber = worstTrackParamAtCluster->GetClusterPtr()->GetChamberId();
- previousTrackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->Before(worstTrackParamAtCluster);
- nextTrackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(worstTrackParamAtCluster);
- if (worstTrackParamAtCluster->IsAloneInChamber()) { // Worst cluster removable and alone in chamber
-
- if (worstChamber%2 == 0) { // Modify flags in next chamber
-
- nextTrackParam->SetRemovable(kFALSE);
- if (!nextTrackParam->IsAloneInChamber()) // Make sure both clusters in second chamber are not removable anymore
- ((AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(nextTrackParam))->SetRemovable(kFALSE);
-
- } else { // Modify flags in previous chamber
-
- previousTrackParam->SetRemovable(kFALSE);
- if (!previousTrackParam->IsAloneInChamber()) // Make sure both clusters in second chamber are not removable anymore
- ((AliMUONTrackParam*) track->GetTrackParamAtCluster()->Before(previousTrackParam))->SetRemovable(kFALSE);
-
- }
-
- } else { // Worst cluster not alone in its chamber
-
- if (previousTrackParam) previousChamber = previousTrackParam->GetClusterPtr()->GetChamberId();
- else previousChamber = -1;
-
- if (previousChamber == worstChamber) { // the second cluster on the same chamber is the previous one
-
- previousTrackParam->SetAloneInChamber(kTRUE);
- // transfert the removability to the second cluster
- if (worstTrackParamAtCluster->IsRemovable()) previousTrackParam->SetRemovable(kTRUE);
-
- } else { // the second cluster on the same chamber is the next one
-
- nextTrackParam->SetAloneInChamber(kTRUE);
- // transfert the removability to the second cluster
- if (worstTrackParamAtCluster->IsRemovable()) nextTrackParam->SetRemovable(kTRUE);
-
- }
-
- }
-
- // Remove the worst cluster
- track->RemoveTrackParamAtCluster(worstTrackParamAtCluster);
-
- // Re-calculate track parameters
- // - from the cluster immediately downstream the one suppressed
- // - or from the begining - if parameters have been re-computed using the standard method (kalman parameters have been lost)
- // - or if the removed cluster was the last one
- if (smoothed && nextTrackParam) RetracePartialTrack(*track,nextTrackParam);
- else RetraceTrack(*track,kTRUE);
-
- // Printout for debuging
- if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
- cout << "ImproveTracks: track " << fRecTracksPtr->IndexOf(track)+1 << " improved " << endl;
+ // Pick up cluster with the worst chi2
+ localChi2 = trackParamAtCluster->GetLocalChi2();
+ if (localChi2 > worstLocalChi2) {
+ worstLocalChi2 = localChi2;
+ worstTrackParamAtCluster = trackParamAtCluster;
}
+ trackParamAtCluster = (AliMUONTrackParam*)track.GetTrackParamAtCluster()->After(trackParamAtCluster);
+ }
+
+ // Check if worst cluster found
+ if (!worstTrackParamAtCluster) {
+ AliWarning("Bad local chi2 values?");
+ break;
+ }
+
+ // Check whether the worst chi2 is under requirement or not
+ if (worstLocalChi2 < 2. * sigmaCut2) { // 2 because 2 quantities in chi2
+ track.SetImproved(kTRUE);
+ break;
+ }
+
+ // if the worst cluster is not removable then stop improvement
+ if (!worstTrackParamAtCluster->IsRemovable()) break;
+
+ // get track parameters at cluster next to the one to be removed
+ nextTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(worstTrackParamAtCluster);
+
+ // Remove the worst cluster
+ track.RemoveTrackParamAtCluster(worstTrackParamAtCluster);
+
+ // Re-calculate track parameters
+ // - from the cluster immediately downstream the one suppressed
+ // - or from the begining - if parameters have been re-computed using the standard method (kalman parameters have been lost)
+ // - or if the removed cluster was the last one
+ if (smoothed && nextTrackParam) RetracePartialTrack(track,nextTrackParam);
+ else RetraceTrack(track,kTRUE);
+
+ // Printout for debuging
+ if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
+ cout << "ImproveTracks: track " << fRecTracksPtr->IndexOf(&track)+1 << " improved " << endl;
}
- track = nextTrack;
}
- // compress the array in case of some tracks have been removed
- fRecTracksPtr->Compress();
-
}
- //__________________________________________________________________________
-void AliMUONTrackReconstructorK::Finalize()
+//__________________________________________________________________________
+void AliMUONTrackReconstructorK::FinalizeTrack(AliMUONTrack &track)
{
/// Update track parameters and covariances at each attached cluster
+ /// using smoother if required, if not already done
- AliMUONTrack *track;
AliMUONTrackParam *trackParamAtCluster;
Bool_t smoothed = kFALSE;
- track = (AliMUONTrack*) fRecTracksPtr->First();
- while (track) {
-
- // update track parameters (using smoother if required) if not already done
- if (!track->IsImproved()) {
- smoothed = kFALSE;
- if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) smoothed = RunSmoother(*track);
- if (!smoothed) track->UpdateCovTrackParamAtCluster();
- } else smoothed = AliMUONReconstructor::GetRecoParam()->UseSmoother();
+ // update track parameters (using smoother if required) if not already done
+ if (!track.IsImproved()) {
+ smoothed = kFALSE;
+ if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) smoothed = RunSmoother(track);
+ if (!smoothed) track.UpdateCovTrackParamAtCluster();
+ } else smoothed = AliMUONReconstructor::GetRecoParam()->UseSmoother();
+
+ // copy smoothed parameters and covariances if any
+ if (smoothed) {
- // copy smoothed parameters and covariances if any
- if (smoothed) {
+ trackParamAtCluster = (AliMUONTrackParam*) (track.GetTrackParamAtCluster()->First());
+ while (trackParamAtCluster) {
- trackParamAtCluster = (AliMUONTrackParam*) (track->GetTrackParamAtCluster()->First());
- while (trackParamAtCluster) {
-
- trackParamAtCluster->SetParameters(trackParamAtCluster->GetSmoothParameters());
- trackParamAtCluster->SetCovariances(trackParamAtCluster->GetSmoothCovariances());
-
- trackParamAtCluster = (AliMUONTrackParam*) (track->GetTrackParamAtCluster()->After(trackParamAtCluster));
- }
+ trackParamAtCluster->SetParameters(trackParamAtCluster->GetSmoothParameters());
+ trackParamAtCluster->SetCovariances(trackParamAtCluster->GetSmoothCovariances());
+ trackParamAtCluster = (AliMUONTrackParam*) (track.GetTrackParamAtCluster()->After(trackParamAtCluster));
}
- track = (AliMUONTrack*) fRecTracksPtr->After(track);
}
-
+
}
virtual void MakeTrackCandidates(AliMUONVClusterStore& clusterStore);
virtual void FollowTracks(AliMUONVClusterStore& clusterStore);
virtual void ComplementTracks(const AliMUONVClusterStore& clusterStore);
- virtual void ImproveTracks();
- virtual void Finalize();
+ virtual void ImproveTrack(AliMUONTrack &track);
+ virtual void FinalizeTrack(AliMUONTrack &track);
private:
fTracks(new TClonesArray("AliMUONTrack",10))
{
/// Ctor
- fTracks->SetOwner(kTRUE);
}
//_____________________________________________________________________________
}
//_____________________________________________________________________________
-void
+AliMUONTrack*
AliMUONTrackStoreV1::Add(const AliMUONTrack& track)
{
/// Add a track
- new((*fTracks)[fTracks->GetLast()+1]) AliMUONTrack(track);
+ return new((*fTracks)[fTracks->GetLast()+1]) AliMUONTrack(track);
+}
+
+//_____________________________________________________________________________
+AliMUONTrack*
+AliMUONTrackStoreV1::Remove(AliMUONTrack& track)
+{
+ /// Remove a track from the store
+ AliMUONTrack* t = static_cast<AliMUONTrack*>(fTracks->Remove(&track));
+ if (t) fTracks->Compress();
+ return t;
}
//_____________________________________________________________________________
using AliMUONVTrackStore::Add;
- virtual void Add(const AliMUONTrack& track);
+ virtual AliMUONTrack* Add(const AliMUONTrack& track);
+ virtual AliMUONTrack* Remove(AliMUONTrack& track);
+
/// Whether the Connect(TTree&) method is implemented
virtual Bool_t CanConnect() const { return kTRUE; }
static Int_t ReadCapacitances(const char* filename, AliMUONVStore& capaStore);
+ /// Error code constants
enum ErrorCode
{
kCannotOpenFile = -1, /// cannot open given file
AliMUONVCluster* cluster = dynamic_cast<AliMUONVCluster*>(object);
if (cluster)
{
- Add(*cluster);
- return kTRUE;
+ return (Add(*cluster)) ? kTRUE : kFALSE;
}
return kFALSE;
}
virtual Bool_t Add(TObject* object);
/// Add a cluster object to the store
- virtual Bool_t Add(const AliMUONVCluster& Cluster) = 0;
+ virtual AliMUONVCluster* Add(const AliMUONVCluster& Cluster) = 0;
/// Create a new cluster with an unique ID and add it to the store
virtual AliMUONVCluster* Add(Int_t chamberId, Int_t detElemId, Int_t clusterIndex) = 0;
//_____________________________________________________________________________
AliMUONVDigit::AliMUONVDigit()
+: TObject()
{
/// Default ctor
}
/// Create a concrete digitStore, given its classname
TClass* classPtr = TClass::GetClass(digitstoreclassname);
- if (!classPtr)
+ if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore"))
{
return 0x0;
}
for (Int_t i=0; i<fNRecTracks; ++i)
{
AliMUONTrack * track = (AliMUONTrack*) fRecTracksPtr->At(i);
+ track->SetUniqueID(i+1);
trackStore.Add(*track);
}
}
// list of segments
TClonesArray *segments = new TClonesArray("AliMUONObjectPair", 100);
- segments->SetOwner(kTRUE);
// Loop over clusters in the first chamber of the station
while ( ( cluster1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
// build the searching area
position.Set(extrapTrackParam.GetNonBendingCoor(), extrapTrackParam.GetBendingCoor());
-// dimensions.Set(AliMUONReconstructor::GetRecoParam()->GetMaxNonBendingDistanceToTrack() + kgMaxShift,
-// AliMUONReconstructor::GetRecoParam()->GetMaxBendingDistanceToTrack() + kgMaxShift);
AliMpArea area1(position, dimensions);
// ask to cluterize in the given area of the given chamber
Bool_t foundTwoClusters = kFALSE;
AliMUONTrack *newTrack = 0x0;
AliMUONVCluster *clusterCh1, *clusterCh2;
+ AliMUONTrackParam trackParam;
AliMUONTrackParam extrapTrackParamAtCluster1;
AliMUONTrackParam extrapTrackParamAtCluster2;
AliMUONTrackParam bestTrackParamAtCluster1;
for (Int_t i = 0; i < nClusters; i++) clusterCh1Used[i] = kFALSE;
Int_t iCluster1;
- // Get track parameters
- AliMUONTrackParam trackParam(*(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First());
+ // Get track parameters according to the propagation direction
+ if (nextStation==4) trackParam = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
+ else trackParam = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
// Add MCS effect
AliMUONTrackExtrap::AddMCSEffect(&trackParam,AliMUONConstants::ChamberThicknessInX0(),1.);
newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster1,*clusterCh1);
extrapTrackParamAtCluster2.SetRemovable(kTRUE);
newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster2,*clusterCh2);
- newTrack->GetTrackParamAtCluster()->Sort();
fNRecTracks++;
// Tag clusterCh1 as used
newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
extrapTrackParamAtCluster2.SetRemovable(kFALSE);
newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster2,*clusterCh2);
- newTrack->GetTrackParamAtCluster()->Sort();
fNRecTracks++;
// Printout for debuging
newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
extrapTrackParamAtCluster1.SetRemovable(kFALSE);
newTrack->AddTrackParamAtCluster(extrapTrackParamAtCluster1,*clusterCh1);
- newTrack->GetTrackParamAtCluster()->Sort();
fNRecTracks++;
// Printout for debuging
trackCandidate.AddTrackParamAtCluster(bestTrackParamAtCluster1,*(bestTrackParamAtCluster1.GetClusterPtr()));
bestTrackParamAtCluster2.SetRemovable(kTRUE);
trackCandidate.AddTrackParamAtCluster(bestTrackParamAtCluster2,*(bestTrackParamAtCluster2.GetClusterPtr()));
- trackCandidate.GetTrackParamAtCluster()->Sort();
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
} else if (foundOneCluster) {
bestTrackParamAtCluster1.SetRemovable(kFALSE);
trackCandidate.AddTrackParamAtCluster(bestTrackParamAtCluster1,*(bestTrackParamAtCluster1.GetClusterPtr()));
- trackCandidate.GetTrackParamAtCluster()->Sort();
// Printout for debuging
if ((AliLog::GetDebugLevel("MUON","AliMUONVTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
}
- //__________________________________________________________________________
+//__________________________________________________________________________
+void AliMUONVTrackReconstructor::ImproveTracks()
+{
+ /// 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;
+
+ // Remove double track to improve only "good" tracks
+ RemoveDoubleTracks();
+
+ 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;
+ }
+
+ // compress the array in case of some tracks have been removed
+ fRecTracksPtr->Compress();
+
+}
+
+//__________________________________________________________________________
+void AliMUONVTrackReconstructor::Finalize()
+{
+ /// Recompute track parameters and covariances at each attached cluster from those at the first one
+
+ AliMUONTrack *track;
+
+ track = (AliMUONTrack*) fRecTracksPtr->First();
+ while (track) {
+
+ FinalizeTrack(*track);
+
+ track = (AliMUONTrack*) fRecTracksPtr->After(track);
+
+ }
+
+}
+
+//__________________________________________________________________________
void AliMUONVTrackReconstructor::ValidateTracksWithTrigger(AliMUONVTrackStore& trackStore,
const AliMUONVTriggerTrackStore& triggerTrackStore,
const AliMUONVTriggerStore& triggerStore,
AliMUONVTrackReconstructor(AliMUONVClusterServer& clusterServer); // default Constructor
virtual ~AliMUONVTrackReconstructor(); // Destructor
- // Reconstructed tracks
- /// Return number of reconstructed tracks
- Int_t GetNRecTracks() const {return fNRecTracks;} // Number
- /// Set number of reconstructed tracks
- void SetNRecTracks(Int_t NRecTracks) {fNRecTracks = NRecTracks;}
- /// Return array of reconstructed tracks
- TClonesArray* GetRecTracksPtr() const {return fRecTracksPtr;} // Array
-
- // Functions
void EventReconstruct(AliMUONVClusterStore& clusterStore,
AliMUONVTrackStore& trackStore);
virtual void FollowTracks(AliMUONVClusterStore& clusterStore) = 0;
/// Complement the reconstructed tracks
virtual void ComplementTracks(const AliMUONVClusterStore& clusterStore) = 0;
- /// Improve the reconstructed tracks
- virtual void ImproveTracks() = 0;
- /// Finalize the tracking results
- virtual void Finalize() = 0;
+ void ImproveTracks();
+ /// Improve the given reconstructed track
+ virtual void ImproveTrack(AliMUONTrack &track) = 0;
+ void Finalize();
+ /// Finalize the given track
+ virtual void FinalizeTrack(AliMUONTrack &track) = 0;
TClonesArray* MakeSegmentsInStation(const AliMUONVClusterStore& clusterStore, Int_t station);
virtual Bool_t Add(TObject* object);
/// Add a track
- virtual void Add(const AliMUONTrack& track) = 0;
+ virtual AliMUONTrack* Add(const AliMUONTrack& track) = 0;
+
+ /// Remove a track from the store
+ virtual AliMUONTrack* Remove(AliMUONTrack& track) = 0;
using AliMUONVStore::Create;
AliMpExMap& m = static_cast<AliMpExMap&>(dest);
m.fKeys = fKeys;
m.fMap.Delete();
- m.fObjects.Delete();
+ m.fObjects.Clear();
for ( Int_t i = 0; i <= fObjects.GetLast(); ++i )
{
// public methods
//
+//_____________________________________________________________________________
+void AliMpExMap::Clear(Option_t* /*option*/)
+{
+/// Clear memory
+
+ fMap.Delete();
+ fObjects.Clear();
+ fKeys.Reset();
+}
+
//_____________________________________________________________________________
void AliMpExMap::Add(const AliMpIntPair& key, TObject* object)
{
AliMpExMap& operator=(const AliMpExMap& rhs);
virtual ~AliMpExMap();
+
// static methods
// conversion between varius keys and Long_t
//
static AliMpIntPair GetPair(Long_t index);
static TString GetString(Long_t index);
+ // methods from base class
+ virtual void Clear(Option_t* opt="");
+
// set methods
void Add(const AliMpIntPair& key, TObject* object);
void Add(const TString& key, TObject* object);