New class for track validation conditions
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Nov 2012 23:33:11 +0000 (23:33 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Nov 2012 23:33:11 +0000 (23:33 +0000)
ITS/UPGRADE/AliITSUAux.cxx
ITS/UPGRADE/AliITSUAux.h
ITS/UPGRADE/AliITSUTrackCond.cxx [new file with mode: 0644]
ITS/UPGRADE/AliITSUTrackCond.h [new file with mode: 0644]
ITS/UPGRADE/CMakelibITSUpgradeRec.pkg
ITS/UPGRADE/ITSUpgradeRecLinkDef.h

index b218e7c..f8fe128 100644 (file)
@@ -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<maxBits;i++) printf("%c",((patt>>i)&0x1) ? '+':'-');
+}
index 88c5f0f..ef5c7f5 100644 (file)
@@ -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 (file)
index 0000000..031e272
--- /dev/null
@@ -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;ic<fNConditions;ic++) {
+    if (arrAux[cntCond+kMinClus]>ncl) {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<nc;i++) {
+    printf("#%2d: MinCl:%2d | %d groups :",i,arrAux[cntCond+kMinClus],arrAux[cntCond+kNGroups]);
+    int grAddr = arrAux[cntCond+kCondStart];
+    for (int ig=arrAux[cntCond+kNGroups];ig--;) {
+      printf("{");
+      PrintBits(arrGrp[grAddr++], fNLayers);
+      printf("}");
+    }
+    printf("\n");
+    cntCond += kNAuxSz;
+  }
+}
diff --git a/ITS/UPGRADE/AliITSUTrackCond.h b/ITS/UPGRADE/AliITSUTrackCond.h
new file mode 100644 (file)
index 0000000..756d01b
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef ALIITSUTRACKCOND_H
+#define ALIITSUTRACKCOND_H
+
+#include <TObject.h>
+#include <TArrayS.h>
+
+//------------------------------------------------------------------------------
+//
+// 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
index f9038e5..3d5ca2c 100644 (file)
@@ -36,6 +36,7 @@ set ( SRCS
     AliITSUClusterPix.cxx
     AliITSUSeed.cxx
     AliITSUTrackerGlo.cxx
+    AliITSUTrackCond.cxx
 #
 #    v0/AliITSlayerUpgrade.cxx 
 #    v0/AliITStrackerUpgrade.cxx 
index a6e5c92..78a3c93 100644 (file)
@@ -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