]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/src/AliL3ClustFinderNew.cxx
Cosmetic changes for the integration of doxygen
[u/mrichter/AliRoot.git] / HLT / src / AliL3ClustFinderNew.cxx
index 21a102424a4fcc95a37a10b0c219b1fa709cbe9d..c25b425b1e2695a184c7fa66a54ee7b861a44a8f 100644 (file)
@@ -1,12 +1,22 @@
-//Author:        Anders Strand Vestbo
-//Last Modified: 17.08.2001
+//$Id$
+
+// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
+//*-- Copyright &copy ASV 
 
 #include <iostream.h>
+#include <math.h>
 #include "AliL3Logging.h"
 #include "AliL3ClustFinderNew.h"
 #include "AliL3DigitData.h"
 #include "AliL3Transform.h"
 #include "AliL3SpacePointData.h"
+#include "AliL3MemHandler.h"
+
+//_____________________________________________________________
+// AliL3ClustFinderNew
+//
+// The current cluster finder for HLT
+// Based on STAR L3
 
 ClassImp(AliL3ClustFinderNew)
 
@@ -83,6 +93,11 @@ void AliL3ClustFinderNew::ProcessDigits()
       tmp += size;
       tempPt = (AliL3DigitRowData*)tmp;
     }
+  LOG(AliL3Log::kInformational,"AliL3ClustFinderNew::WriteClusters","Space points")
+    <<"Cluster finder found "<<fNClusters<<" clusters in slice "<<fCurrentSlice
+    <<" patch "<<fCurrentPatch<<ENDLOG;
+
+
 }
 
 
@@ -155,6 +170,13 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
 
       while(1) //Loop over current sequence
        {
+         if(data[bin].fTime >= fTransform->GetNTimeBins())
+           {
+             LOG(AliL3Log::kFatal,"AliL3ClustFinderNew::ProcessRow","Digits")
+               <<"Timebin out of range "<<(Int_t)data[bin].fTime<<ENDLOG;
+             break;
+           }
+
          //Get the current ADC-value
          UInt_t charge = data[bin].fCharge;
          
@@ -192,7 +214,8 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
        seq_mean = seq_average/seq_charge;
       else
        {
-         printf("\nCF: Should not happen\n");
+         LOG(AliL3Log::kFatal,"AliL3ClustFinderNew::ProcessRow","Data")
+           <<"Error in data given to the cluster finder"<<ENDLOG;
          seq_mean = 1;
          seq_charge = 1;
        }
@@ -302,6 +325,7 @@ void AliL3ClustFinderNew::WriteClusters(Int_t n_clusters,ClusterData *list)
            <<AliL3Log::kDec<<"Too many clusters"<<ENDLOG;
          return;
          }  
+      fSpacePointData[counter].fCharge = list[j].fTotalCharge;
       fSpacePointData[counter].fX = xyz[0];
       fSpacePointData[counter].fY = xyz[1];
       fSpacePointData[counter].fZ = xyz[2];
@@ -310,10 +334,53 @@ void AliL3ClustFinderNew::WriteClusters(Int_t n_clusters,ClusterData *list)
       fSpacePointData[counter].fZErr = fZErr;
       fSpacePointData[counter].fID = counter
        +((fCurrentSlice&0x7f)<<25)+((fCurrentPatch&0x7)<<22);//uli
-      
+#ifdef do_mc
+      Int_t trackID[3];
+      GetTrackID((Int_t)rint(fpad),(Int_t)rint(ftime),trackID);
+      //cout<<"padrow "<<fCurrentRow<<" pad "<<(Int_t)rint(fpad)<<" time "<<(Int_t)rint(ftime)<<" Trackid "<<trackID[0]<<endl;
+      fSpacePointData[counter].fTrackID[0] = trackID[0];
+      fSpacePointData[counter].fTrackID[1] = trackID[1];
+      fSpacePointData[counter].fTrackID[2] = trackID[2];
+#endif
       fNClusters++;
       counter++;
 
     }
 
+  
+}
+
+#ifdef do_mc
+void AliL3ClustFinderNew::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
+{
+  AliL3DigitRowData *rowPt = (AliL3DigitRowData*)fDigitRowData;
+  
+  trackID[0]=trackID[1]=trackID[2]=-2;
+  //cout<<"Looking for pad "<<pad<<" time "<<time<<endl;
+  for(Int_t i=fFirstRow; i<=fLastRow; i++)
+    {
+      if(rowPt->fRow < (UInt_t)fCurrentRow)
+       {
+         AliL3MemHandler::UpdateRowPointer(rowPt);
+         continue;
+       }
+      AliL3DigitData *digPt = (AliL3DigitData*)rowPt->fDigitData;
+      for(UInt_t j=0; j<rowPt->fNDigit; j++)
+       {
+         Int_t cpad = digPt[j].fPad;
+         Int_t ctime = digPt[j].fTime;
+         if(cpad != pad) continue;
+         if(ctime != time) continue;
+         //if(cpad != pad && ctime != ctime) continue;
+         //cout<<"Reading row "<<fCurrentRow<<" pad "<<cpad<<" time "<<ctime<<" trackID "<<digPt[j].fTrackID[0]<<endl;
+         trackID[0] = digPt[j].fTrackID[0];
+         trackID[1] = digPt[j].fTrackID[1];
+         trackID[2] = digPt[j].fTrackID[2];
+         break;
+         //cout<<"Reading trackID "<<trackID[0]<<endl;
+       }
+      break;
+    }
+  
 }
+#endif