From: shahoian Date: Mon, 26 Nov 2012 23:33:11 +0000 (+0000) Subject: New class for track validation conditions X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=3c18eefd16bc3cc0f428d361c9098f065d2e120d New class for track validation conditions --- diff --git a/ITS/UPGRADE/AliITSUAux.cxx b/ITS/UPGRADE/AliITSUAux.cxx index b218e7c20de..f8fe128877d 100644 --- a/ITS/UPGRADE/AliITSUAux.cxx +++ b/ITS/UPGRADE/AliITSUAux.cxx @@ -1 +1,9 @@ #include "AliITSUAux.h" + +//_______________________________________________________________ +void AliITSUAux::PrintBits(ULong64_t patt, Int_t maxBits) +{ + // print maxBits of the pattern + maxBits = Min(64,maxBits); + for (int i=0;i>i)&0x1) ? '+':'-'); +} diff --git a/ITS/UPGRADE/AliITSUAux.h b/ITS/UPGRADE/AliITSUAux.h index 88c5f0faae7..ef5c7f51ec3 100644 --- a/ITS/UPGRADE/AliITSUAux.h +++ b/ITS/UPGRADE/AliITSUAux.h @@ -27,6 +27,7 @@ namespace AliITSUAux { Int_t UnpackCluster(UInt_t p); Bool_t IsCluster(UInt_t p); Int_t NumberOfBitsSet(UInt_t x); + void PrintBits(ULong64_t patt, Int_t maxBits); // const Double_t kNominalBz = 5.01; // nominal field const Double_t kPionMass = 1.3957e-01; diff --git a/ITS/UPGRADE/AliITSUTrackCond.cxx b/ITS/UPGRADE/AliITSUTrackCond.cxx new file mode 100644 index 00000000000..031e27229cb --- /dev/null +++ b/ITS/UPGRADE/AliITSUTrackCond.cxx @@ -0,0 +1,103 @@ +#include "AliITSUTrackCond.h" +#include "AliITSUAux.h" +#include "AliLog.h" + +using namespace AliITSUAux; + +//______________________________________________________________ +AliITSUTrackCond::AliITSUTrackCond(int nLayers) + :fNLayers(nLayers) + ,fNConditions(0) + ,fConditions(0) + ,fAuxData(0) +{ + // def c-tor +} + +//______________________________________________________________ +AliITSUTrackCond::AliITSUTrackCond(const AliITSUTrackCond& src) + :TObject(src), + fNLayers(src.fNLayers) + ,fNConditions(src.fNConditions) + ,fConditions(src.fConditions) + ,fAuxData(src.fAuxData) +{ + // copy c-tor +} + +//______________________________________________________________ +AliITSUTrackCond& AliITSUTrackCond::operator=(const AliITSUTrackCond& src) +{ + // copy op. + if (this!=&src) { + fNLayers = src.fNLayers; + fNConditions = src.fNConditions; + fConditions = src.fConditions; + fAuxData = src.fAuxData; + } + return *this; +} + +//______________________________________________________________ +void AliITSUTrackCond::AddGroupPattern(UShort_t patt) +{ + // add new group pattern to last condition + if (fNConditions<1) AliFatal("Can be called only after AddCondition"); + int ind = fConditions.GetSize(); + fConditions.Set(ind+1); + fConditions[ind] = patt; + fAuxData[(fNConditions-1)*kNAuxSz + kNGroups]++; +} + +//______________________________________________________________ +void AliITSUTrackCond::AddNewCondition(Int_t minClusters) +{ + // add new track condition + fAuxData.Set( (1+fNConditions)*kNAuxSz ); + fAuxData[fNConditions*kNAuxSz+kCondStart] = fConditions.GetSize(); + fAuxData[fNConditions*kNAuxSz+kNGroups] = 0; + fAuxData[fNConditions*kNAuxSz+kMinClus] = minClusters; + fNConditions++; + // +} + +//______________________________________________________________ +Bool_t AliITSUTrackCond::CheckPattern(Int_t ncl,UShort_t patt) const +{ + // check if the pattern matches to some condition + Short_t *arrAux = (Short_t*)fAuxData.GetArray(); + Short_t *arrGrp = (Short_t*)fConditions.GetArray(); + int cntCond = 0; + for (int ic=0;icncl) {cntCond+=kNAuxSz; continue;} // check number of clusters + int grAddr = arrAux[cntCond+kCondStart]; // 1st group pattern address in the condition + Bool_t ok = kTRUE; + // if every group of the condition does not match, check next contition + for (int ig=arrAux[cntCond+kNGroups];ig--;) if ( !(patt&arrGrp[grAddr++]) ) {ok = kFALSE; break;} + if (ok) return kTRUE; + cntCond += kNAuxSz; + } + return kFALSE; +} + +//______________________________________________________________ +void AliITSUTrackCond::Print(Option_t*) const +{ + // print conditions + int nc = GetNConditions(); + Short_t *arrAux = (Short_t*)fAuxData.GetArray(); + Short_t *arrGrp = (Short_t*)fConditions.GetArray(); + int cntCond = 0; + printf("Conditions set ID=%d : %d entries\n",GetID(),nc); + for (int i=0;i +#include + +//------------------------------------------------------------------------------ +// +// This class defines a set of hit patterns (conditions) to consider the track reconstructable +// Each condidition (few consequitive elements from fConditions array) is set of bit patterns, +// with each element of condition defining a group of layers which must be present in the tracks. +// For instance, if we require the track to have contributions from +// {lr0 or lr1 or lr2} AND {lr2 or lr 3 or lr 4} AND {lr5 or lr6} then the condition should +// be {BIT(0)|BIT(1)|BIT(2), BIT(2)|BIT(3)|BIT(4), BIT(5)|BIT(6)}. +// Additionally, each condition may request min number of hits to be present +// +// Each AliITSUTrackCond should correspond to single track finding pass and may contain multiple +// conditions. To consider the track reconstructable it is enough to satisfy 1 condition +// +//------------------------------------------------------------------------------ + + +class AliITSUTrackCond : public TObject +{ + public: + enum {kCondStart,kNGroups,kMinClus,kNAuxSz}; + + AliITSUTrackCond(Int_t nLayers=0); + AliITSUTrackCond(const AliITSUTrackCond& src); + AliITSUTrackCond &operator=(const AliITSUTrackCond& src); + + ~AliITSUTrackCond() {} + + void SetNLayers(Int_t nl) {fNLayers = nl;} + void SetID(Int_t id) {SetUniqueID(id);} + void AddNewCondition(Int_t minClusters); + void AddGroupPattern(UShort_t patt); + + Int_t GetID() const {return GetUniqueID();} + Int_t GetNConditions() const {return fNConditions;} + UShort_t GetGroup(Int_t condID,Int_t grID) const {return fConditions[fAuxData[condID*kNAuxSz+kCondStart]+grID];} + Bool_t CheckPattern(Int_t ncl,UShort_t patt) const; + // + virtual void Print(Option_t* option = "") const; + + protected: + // + Short_t fNLayers; // total number of layers + Short_t fNConditions; // number of conditions defined + TArrayS fConditions; //[fNConditions] set of conditions + TArrayS fAuxData; // condition beginning (1st group), n groups, min clus + // + ClassDef(AliITSUTrackCond,1) // set of requirements on track hits pattern +}; + + + +#endif diff --git a/ITS/UPGRADE/CMakelibITSUpgradeRec.pkg b/ITS/UPGRADE/CMakelibITSUpgradeRec.pkg index f9038e55336..3d5ca2c9274 100644 --- a/ITS/UPGRADE/CMakelibITSUpgradeRec.pkg +++ b/ITS/UPGRADE/CMakelibITSUpgradeRec.pkg @@ -36,6 +36,7 @@ set ( SRCS AliITSUClusterPix.cxx AliITSUSeed.cxx AliITSUTrackerGlo.cxx + AliITSUTrackCond.cxx # # v0/AliITSlayerUpgrade.cxx # v0/AliITStrackerUpgrade.cxx diff --git a/ITS/UPGRADE/ITSUpgradeRecLinkDef.h b/ITS/UPGRADE/ITSUpgradeRecLinkDef.h index a6e5c9267b3..78a3c93cb53 100644 --- a/ITS/UPGRADE/ITSUpgradeRecLinkDef.h +++ b/ITS/UPGRADE/ITSUpgradeRecLinkDef.h @@ -22,7 +22,7 @@ #pragma link C++ class AliITSUClusterPix+; #pragma link C++ class AliITSUSeed+; #pragma link C++ class AliITSUTrackerGlo+; - +#pragma link C++ class AliITSUTrackCond+; // // old v0