Making online tracklets usable in offline reconstruction
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Jun 2009 15:52:01 +0000 (15:52 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Jun 2009 15:52:01 +0000 (15:52 +0000)
TRD/AliTRDReconstructor.cxx
TRD/AliTRDReconstructor.h
TRD/AliTRDcluster.cxx
TRD/AliTRDcluster.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDclusterizer.h

index b45dcc0..17687a6 100644 (file)
@@ -49,6 +49,7 @@
 ClassImp(AliTRDReconstructor)
 
 TClonesArray *AliTRDReconstructor::fgClusters = 0x0;
+TClonesArray *AliTRDReconstructor::fgTracklets = 0x0;
 Char_t* AliTRDReconstructor::fgSteerNames[kNsteer] = {
   "DigitsConversion       "
  ,"Tail Cancellation      "
@@ -65,6 +66,7 @@ Char_t* AliTRDReconstructor::fgSteerNames[kNsteer] = {
  ,"Tracklet Improve       "
  ,"HLT Mode              "
  ,"Cosmic Reconstruction "
+ ,"Process Online Tracklets"
 };
 Char_t* AliTRDReconstructor::fgSteerFlags[kNsteer] = {
   "dc"// digits conversion [false]
@@ -82,6 +84,7 @@ Char_t* AliTRDReconstructor::fgSteerFlags[kNsteer] = {
  ,"ti"// improve tracklets in stand alone track finder [true]
  ,"hlt"// HLT reconstruction [false]
  ,"cos"// Cosmic Reconstruction [false]
+ ,"tp"// also use online tracklets for reconstruction [false]
 };
 Char_t* AliTRDReconstructor::fgTaskNames[kNtasks] = {
   "RawReader"
@@ -153,6 +156,9 @@ AliTRDReconstructor::~AliTRDReconstructor()
   if(fgClusters) {
     fgClusters->Delete(); delete fgClusters;
   }
+  if(fgTracklets) {
+    fgTracklets->Delete(); delete fgTracklets;
+  }
   if(fSteerParam&kOwner){
     for(Int_t itask = 0; itask < kNtasks; itask++)
       if(fDebugStream[itask]) delete fDebugStream[itask];
@@ -216,6 +222,10 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
   // take over ownership of clusters
   fgClusters = clusterer.RecPoints();
   clusterer.SetClustersOwner(kFALSE);
+
+  // take over ownership of online tracklets
+  fgTracklets = clusterer.TrackletsArray();
+  clusterer.SetTrackletsOwner(kFALSE);
 }
 
 //_____________________________________________________________________________
@@ -239,6 +249,10 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree
   // take over ownership of clusters
   fgClusters = clusterer.RecPoints();
   clusterer.SetClustersOwner(kFALSE);
+
+  // take over ownership of online tracklets
+  fgTracklets = clusterer.TrackletsArray();
+  clusterer.SetTrackletsOwner(kFALSE);
 }
 
 //_____________________________________________________________________________
index 69164dd..927dcf0 100644 (file)
@@ -38,8 +38,9 @@ public:
     ,kImproveTracklet   = BIT(12) // Improve tracklet in the SA TRD track finder 
     ,kHLT            = BIT(13)
     ,kCosmic         = BIT(14)
-    ,kOwner          = BIT(15)
-    ,kNsteer         = 15       // number of tasks
+    ,kProcTracklets  = BIT(15) // process online tracklets
+    ,kOwner          = BIT(16)
+    ,kNsteer         = 16       // number of tasks
   };
   enum ETRDReconstructorTask {
     kRawReader    = 0
@@ -67,6 +68,7 @@ public:
   virtual void        FillESD(AliRawReader *, TTree *clusterTree, AliESDEvent *esd) const { FillESD((TTree * )NULL, clusterTree, esd);                    }
   virtual void        FillESD(TTree *digitsTree, TTree *clusterTree, AliESDEvent *esd) const;
   static TClonesArray* GetClusters() {return fgClusters;}
+  static TClonesArray* GetTracklets() {return fgTracklets;}
   Int_t               GetNdEdxSlices() const     { return (Int_t)AliTRDpidUtil::GetNdEdxSlices(GetPIDMethod());}
   ETRDReconstructorGas GetDriftGas() const        { return fSteerParam&kDriftGas ? kAr : kXe;}
   AliTRDpidUtil::ETRDPIDMethod       GetPIDMethod() const       { return fSteerParam&kSteerPID ? AliTRDpidUtil::kNN : AliTRDpidUtil::kLQ;}
@@ -86,12 +88,14 @@ public:
   Bool_t              UseLUT() const             { return fSteerParam&kLUT;}
   Bool_t              UseGAUS() const             { return fSteerParam&kGAUS;}
   Bool_t              UseTailCancelation() const { return fSteerParam&kTC;}
+  Bool_t              IsProcessingTracklets() const { return fSteerParam&kProcTracklets;}
   
   static void         Options(UInt_t steer=0, UChar_t *stream=0x0);
   virtual void        Reconstruct(AliRawReader *rawReader, TTree *clusterTree) const;
   virtual void        Reconstruct(TTree *digitsTree, TTree *clusterTree) const;
 
   static void         SetClusters(TClonesArray *clusters) {fgClusters = clusters;}
+  static void         SetTracklets(TClonesArray *tracklets) {fgTracklets = tracklets;}
   void               SetOption(Option_t *opt);
   inline void         SetTCParams(Double_t *par);
   void                SetStreamLevel(Int_t level, ETRDReconstructorTask task= kTracker);
@@ -107,6 +111,7 @@ private:
   TTreeSRedirector *fDebugStream[kNtasks];// Debug Streamer container;
  
   static TClonesArray *fgClusters;    // list of clusters for local reconstructor
+  static TClonesArray *fgTracklets;   // list of online tracklets for local reconstructor
 
   ClassDef(AliTRDReconstructor, 2)    //  Class for the TRD reconstruction
 
index a1fec9c..b02d1cd 100644 (file)
@@ -14,7 +14,6 @@
  **************************************************************************/
 
 /* $Id$ */
-
  
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -28,6 +27,7 @@
 #include "AliTRDcluster.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDCommonParam.h"
+#include "AliTRDtrackletWord.h"
 
 ClassImp(AliTRDcluster)
 
@@ -114,6 +114,24 @@ AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
 }
 
 //_____________________________________________________________________________
+AliTRDcluster::AliTRDcluster(const AliTRDtrackletWord *const tracklet, Int_t det, UShort_t volid)
+  :AliCluster(volid,tracklet->GetX(),tracklet->GetY(),tracklet->GetZ(),0,0,0)
+  ,fPadCol(0)
+  ,fPadRow(0)
+  ,fPadTime(0)
+  ,fLocalTimeBin(0)
+  ,fNPads(0)
+  ,fClusterMasking(0)
+  ,fDetector(det)
+  ,fQ(0.)
+  ,fCenter(0.)
+{
+  //
+  // Constructor from online tracklet 
+  //
+}
+
+//_____________________________________________________________________________
 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
   :AliCluster(c)
   ,fPadCol(c.fPadCol)
index 409cf11..52a46b2 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "AliCluster.h"
 
+class AliTRDtrackletWord;
+
 class AliTRDcluster : public AliCluster {
 public:
   enum ETRDclusterStatus { 
@@ -35,6 +37,7 @@ public:
     Int_t *tracks, Char_t npads, Short_t *signals,
     UChar_t col, UChar_t row, UChar_t time,
     Char_t timebin, Float_t center, UShort_t volid);
+  AliTRDcluster(const AliTRDtrackletWord *const tracklet, Int_t det, UShort_t volid);
   AliTRDcluster(const AliTRDcluster &c);
   virtual ~AliTRDcluster() {};
 
index b8acae8..07e6dd4 100644 (file)
@@ -49,6 +49,7 @@
 #include "AliTRDSignalIndex.h"
 #include "AliTRDrawStreamBase.h"
 #include "AliTRDfeeParam.h"
+#include "AliTRDtrackletWord.h"
 
 #include "TTreeStream.h"
 
@@ -65,6 +66,7 @@ AliTRDclusterizer::AliTRDclusterizer(const AliTRDReconstructor *const rec)
   ,fRunLoader(NULL)
   ,fClusterTree(NULL)
   ,fRecPoints(NULL)
+  ,fTracklets(NULL)
   ,fTrackletTree(NULL)
   ,fDigitsManager(new AliTRDdigitsManager())
   ,fTrackletContainer(NULL)
@@ -122,6 +124,7 @@ AliTRDclusterizer::AliTRDclusterizer(const Text_t *name, const Text_t *title, co
   ,fRunLoader(NULL)
   ,fClusterTree(NULL)
   ,fRecPoints(NULL)
+  ,fTracklets(NULL)
   ,fTrackletTree(NULL)
   ,fDigitsManager(new AliTRDdigitsManager())
   ,fTrackletContainer(NULL)
@@ -174,6 +177,7 @@ AliTRDclusterizer::AliTRDclusterizer(const AliTRDclusterizer &c)
   ,fRunLoader(NULL)
   ,fClusterTree(NULL)
   ,fRecPoints(NULL)
+  ,fTracklets(NULL)
   ,fTrackletTree(NULL)
   ,fDigitsManager(NULL)
   ,fTrackletContainer(NULL)
@@ -222,6 +226,11 @@ AliTRDclusterizer::~AliTRDclusterizer()
     delete fRecPoints;
   }
 
+  if (fTracklets){
+    fTracklets->Delete();
+    delete fTracklets;
+  }
+
   if (fDigitsManager) {
     delete fDigitsManager;
     fDigitsManager = NULL;
@@ -237,11 +246,6 @@ AliTRDclusterizer::~AliTRDclusterizer()
     fTransform     = NULL;
   }
 
-//   if (fLUT) {
-//     delete [] fLUT;
-//     fLUT           = NULL;
-//   }
-
 }
 
 //_____________________________________________________________________________
@@ -629,7 +633,7 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
   fDigitsManager->SetUseDictionaries(TestBit(kLabels));
 
   // tracklet container for raw tracklet writing
-  if (!fTrackletContainer && fReconstructor->IsWritingTracklets()) {
+  if (!fTrackletContainer && ( fReconstructor->IsWritingTracklets() || fReconstructor->IsProcessingTracklets() )) {
     // maximum tracklets for one HC
     const Int_t kTrackletChmb=256;
     fTrackletContainer = new UInt_t *[2];
@@ -654,7 +658,7 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
     if (*(fTrackletContainer[0]) > 0 || *(fTrackletContainer[1]) > 0) WriteTracklets(det);
   }
   
-  if (fReconstructor->IsWritingTracklets()){
+  if (fTrackletContainer){
     delete [] fTrackletContainer[0];
     delete [] fTrackletContainer[1];
     delete [] fTrackletContainer;
@@ -780,6 +784,9 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   Int_t    iGeoModule = istack + AliTRDgeometry::Nstack() * isector;
   fVolid      = AliGeomManager::LayerToVolUID(iGeoLayer,iGeoModule); 
 
+  if(fReconstructor->IsProcessingTracklets() && fTrackletContainer)
+    AddTrackletsToArray();
+
   fColMax    = fDigits->GetNcol();
   //Int_t nRowMax    = fDigits->GetNrow();
   fTimeTotal = fDigits->GetNtime();
@@ -1028,6 +1035,26 @@ void AliTRDclusterizer::AddClusterToArray(AliTRDcluster *cluster)
 }
 
 //_____________________________________________________________________________
+void AliTRDclusterizer::AddTrackletsToArray()
+{
+  //
+  // Add the online tracklets of this chamber to the array
+  //
+
+  UInt_t* trackletword;
+  for(Int_t side=0; side<2; side++)
+    {
+      Int_t trkl=0;
+      trackletword=fTrackletContainer[side];
+      do{
+       Int_t n = TrackletsArray()->GetEntriesFast();
+       new((*TrackletsArray())[n]) AliTRDcluster(&AliTRDtrackletWord(trackletword[trkl]),fDet,fVolid);
+       trkl++;
+      }while(trackletword[trkl]>0);
+    }
+}
+
+//_____________________________________________________________________________
 Bool_t AliTRDclusterizer::AddLabels()
 {
   //
@@ -1325,3 +1352,19 @@ TClonesArray *AliTRDclusterizer::RecPoints()
 
 }
 
+//_____________________________________________________________________________
+TClonesArray *AliTRDclusterizer::TrackletsArray() 
+{
+  //
+  // Returns the list of rec points
+  //
+
+  if (!fTracklets && fReconstructor->IsProcessingTracklets()) {
+    fTracklets = new TClonesArray("AliTRDcluster", 2*MAX_TRACKLETS_PERHC);
+    //SetClustersOwner(kTRUE);
+    //AliTRDReconstructor::SetTracklets(0x0);
+  }
+  return fTracklets;
+
+}
+
index dc7bc44..f6adbf3 100644 (file)
@@ -39,7 +39,8 @@ class AliTRDclusterizer : public TNamed
 
   // steering flags
   enum{
-    kOwner  = BIT(14)  //  toggle cluster ownership
+    kTrOwner= BIT(13)  //  toggle online tracklets ownership
+   ,kClOwner= BIT(14)  //  toggle cluster ownership
    ,kLabels = BIT(15)  //  toggle MC labels for clusters
    ,kHLT    = BIT(16)  //  HLT mode
    ,kLUT    = BIT(17)  //  using look up table for cluster's r-phi position
@@ -81,6 +82,7 @@ class AliTRDclusterizer : public TNamed
   Bool_t   WriteClusters(Int_t det);
   void     ResetRecPoints();
   virtual TClonesArray    *RecPoints();
+  TClonesArray    *TrackletsArray();
   Bool_t   WriteTracklets(Int_t det);
 
   Bool_t   Raw2Clusters(AliRawReader *rawReader);
@@ -96,8 +98,9 @@ class AliTRDclusterizer : public TNamed
   static UChar_t   GetStatus(Short_t &signal);
   Int_t            GetAddedClusters() {return fNoOfClusters;}
 
-  Bool_t   IsClustersOwner() const {return TestBit(kOwner);}
-  virtual void     SetClustersOwner(Bool_t own=kTRUE) {SetBit(kOwner, own); if(!own) {fRecPoints = 0x0; fNoOfClusters=0;} }
+  Bool_t   IsClustersOwner() const {return TestBit(kClOwner);}
+  virtual void     SetClustersOwner(Bool_t own=kTRUE) {SetBit(kTrOwner, own); if(!own) {fRecPoints = 0x0; fNoOfClusters=0;} }
+  void     SetTrackletsOwner(Bool_t own=kTRUE) {SetBit(kTrOwner, own); if(!own) {fTracklets = 0x0; } }
 
 protected:
 
@@ -106,8 +109,6 @@ protected:
   void             TailCancelation();
 
   Float_t  Unfold(Double_t eps, Int_t layer, Double_t *padSignal) const;
-  //Double_t GetCOG(Double_t signal[5]) const; 
-  //Double_t LUTposition(Int_t ilayer, Double_t ampL, Double_t ampC, Double_t ampR) const;
   
   void             SetPadStatus(const UChar_t status, UChar_t &encoding);
   UChar_t          GetPadStatus(UChar_t encoding) const;
@@ -118,11 +119,13 @@ protected:
   void             CreateCluster(const MaxStruct &Max); 
   inline void      CalcAdditionalInfo(const MaxStruct &Max, Short_t *const signals, Int_t &nPadCount);
   virtual void     AddClusterToArray(AliTRDcluster *cluster);
+  inline void      AddTrackletsToArray();
 
   const AliTRDReconstructor *fReconstructor; //! reconstructor
   AliRunLoader        *fRunLoader;           //! Run Loader
   TTree               *fClusterTree;         //! Tree with the cluster
   TClonesArray        *fRecPoints;           //! Array of clusters
+  TClonesArray        *fTracklets;           //! Array of online tracklets
 
   TTree               *fTrackletTree;        //! Tree for tracklets