]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCPad.h
debug output removed
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCPad.h
index 00dec1fa8c462bc3b3bd9cf434ca67a219734b31..4eb06774b8a1fdbf29e880d379e2a1176b5cc412 100644 (file)
@@ -1,9 +1,11 @@
+// -*- Mode: C++ -*-
 // @(#) $Id$
 
-#ifndef ALIHLTPAD_H
-#define ALIHLTPAD_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
+#ifndef ALIHLTTPCPAD_H
+#define ALIHLTTPCPAD_H
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
 
 /** @file   AliHLTTPCPad.h
     @author Matthias Richter
 */
 
 #include "AliHLTLogging.h"
+#include "AliHLTTPCClusters.h"
+#include "AliHLTTPCDigitReader.h"
+#include "TH1F.h"
+#include <vector>
+
+class AliHLTTPCDigitData;
 
 typedef Int_t AliHLTTPCSignal_t;
 
+
 /**
  * @class AliHLTTPCPad
  * The class is a container for the raw ADC data of one TPCS pad. In order to
@@ -28,10 +37,16 @@ typedef Int_t AliHLTTPCSignal_t;
  * @ingroup alihlt_tpc
  */
 class AliHLTTPCPad : public AliHLTLogging {
- public:
+public:
   /** standard constructor */
   AliHLTTPCPad();
 
+  /** 
+   * Constructor
+   * @param dummy  dummy determines if one need the raw data. If a dummy number is given, the pad object will be initialized without using memory for raw data
+   */
+  AliHLTTPCPad(Int_t dummy);
+
   /** 
    * Constructor
    * @param offset   The number of bins to ignore at the beginning
@@ -40,13 +55,27 @@ class AliHLTTPCPad : public AliHLTLogging {
    */
   AliHLTTPCPad(Int_t offset, Int_t nofBins);
 
-  /** not a valid copy constructor, defined according to effective C++ style */
-  AliHLTTPCPad(const AliHLTTPCPad&);
-  /** not a valid assignment op, but defined according to effective C++ style */
-  AliHLTTPCPad& operator=(const AliHLTTPCPad&);
   /** standard destructor */
   virtual ~AliHLTTPCPad();
 
+  
+  struct AliClusterData
+  {
+    UInt_t fTotalCharge;   //tot charge of cluster
+    UInt_t fPad;           //pad value
+    UInt_t fTime;          //time value
+    ULong64_t fPad2;       //for error in XY direction
+    ULong64_t fTime2;      //for error in Z  direction
+    UInt_t fMean;          //mean in time
+    UInt_t fFlags;         //different flags
+    UInt_t fChargeFalling; //for deconvolution
+    UInt_t fLastCharge;    //for deconvolution
+    UInt_t fLastMergedPad; //dont merge twice per pad
+  }; 
+
+  typedef struct AliClusterData AliClusterData; //!
+
+
   /**
    * Set the address the pad.
    * The address consists of row and pad number.
@@ -57,11 +86,13 @@ class AliHLTTPCPad : public AliHLTLogging {
 
   /**
    * Get the row number.
+   * @return Row number
    */
   Int_t GetRowNumber() const {return fRowNo;}
 
   /**
-   * Get the pad number.
+   * Get the pad number on the row.
+   * @return Pad number on row
    */
   Int_t GetPadNumber() const {return fPadNo;}
 
@@ -85,7 +116,7 @@ class AliHLTTPCPad : public AliHLTLogging {
    * Calculate the base line from the current event data.
    * Only available within an event cycle. <br>
    * The calculation requires a minimum number of bins which contribute
-   * to the sum, which can be specified by @param reqMinCount. The base line
+   * to the sum, which can be specified by \e reqMinCount. The base line
    * calculation will also be skipped if the number of contributing bins is 
    * less than half of the total number of time bins. 
    * @param reqMinCount    the minimum number of bins contributing to the sum
@@ -192,7 +223,7 @@ class AliHLTTPCPad : public AliHLTLogging {
   /**
    * Get the base line value of a certain channel.
    * @param bin      Channel number
-   * @param base line value at bin
+   * @return base line value at bin
    */
   AliHLTTPCSignal_t GetBaseLine(Int_t bin) const;
 
@@ -222,9 +253,118 @@ class AliHLTTPCPad : public AliHLTLogging {
    * Get the size (number of time bins) of the pad
    * @return number of bins 
    */
-   Int_t GetSize() const {return fNofBins;}
+  Int_t GetSize() const {return fNofBins;}
+  
+  /*
+   * Clears the vector of cluster candidates.
+   */
+  void ClearCandidates();
+
+  /**
+   * Set the data array to -1
+   */
+  void SetDataToDefault();
+
+  /**
+   * Stores the signal in the data array, stores the timebin number of the signal,
+   * and increments a counter.
+   * @param bin       Timebin nuber of signal
+   * @param signal    Size of signal 
+   */
+  void SetDataSignal(Int_t bin,Int_t signal);
+
+  /**
+   * Returns the signal in the specified bin
+   * @param bin       Timebin number
+   * @return          Signal in the given timebin
+   */
+  Int_t GetDataSignal(Int_t bin) const;
+
+  /**
+   * Zerosuppression where one can choose wether one want to cut on sigma(default 3) or a given adc threshold above baseline
+   * It works like this: Finds the signals above baseline+threshold, it then looks to the right of the signals adding the 
+   * the signal below threshold but over the average. It stops when the adc value rises (since you should expect a fall) 
+   * or if the signal in that bin is below average. It now does the same thing to the left. 
+   * This is a very timeconsuming approach(but good), and will likely only be used only for cosmics and laser.
+   * If you use sigma approach you can give as input n sigma or stick with default=3. For channels with very large signals 
+   * the (value-average)² is not calculated when value-average>50. This is due to sigma shooting sky high for only a few values.
+   * The method is checked with 2006 cosmics data, and it looks good.
+   * If you want to use the threshold approach you HAVE to set nSigma=-1 and threshold>0. For example: If you want all signals 
+   * 30 adc counts above threshold you should call the function like this: ZeroSuppress(-1,30)
+   * @param nRMS               Specify nRMS threshold
+   * @param threshold          Specify what adc threshold above average (remember to give nRMS=-1 if you want to use this approach)
+   * @param reqMinPoint        Required minimum number of points to do zerosuppression default AliHLTTPCTransform::GetNTimeBins/2 (1024/2).
+   * @param beginTime          Lowest timebin value. Gating grid causes some problems in the first timebins.
+   * @param endTime            Highest timebin value.
+   * @param timebinsLeft       Timebins to include left of the signals above threshold (to include tails)
+   * @param timebinsRight      Timebins to include right of the signals above threshold (to include tails)
+   * @param valueBelowAverage  The number of adc-counts below the average value. (sometimes there can be useful to also add some signals below average for your signals, especially when there is a lot of noise) It means that more of the tails of the signal is added.
+   * @param speedup            Do not the full zero suppression but terminate if it is clear wheter the channel has some signal or not.
+   */
+  void ZeroSuppress(Double_t nRMS,Int_t threshold,Int_t reqMinPoint,Int_t beginTime,Int_t endTime,Int_t timebinsLeft, Int_t timebinsRight, Int_t valueBelowAverage, bool speedup=false);
+  
+  /**
+   * Bool method which returns the timein number of the first signal and number of consecutive signals, used together with GetPointer(bin) to access data 
+   * @param time            Refernence to timebin number
+   * @param bunchSize       Refernence to number of consecutive signals
+   * @return                True if there are more signals
+  */
+  Bool_t GetNextGoodSignal(Int_t &time,Int_t &bunchSize);
+
+  /**
+   * Returns number of signals added
+   * @return                Number of signals
+   */
+  UInt_t GetNAddedSignals(){return fSizeOfSignalPositionArray;}
+
+  /**
+   * Returns the pointer to the first data signal
+   * @param bin             Timebin number
+   * @return                pointer to data signal in bin
+   */
+  UInt_t* GetPointer(Int_t bin){return (UInt_t*)&fDataSignals[bin];  }
+
+  /**
+   * Adds cluster candidate to the fClusterCandidates.
+   */
+  void AddClusterCandidate(const AliHLTTPCClusters& candidate);
+
+  /**
+   * Adds the digits belonging to the candidate.
+   */
+  void AddCandidateDigits(const vector<AliHLTTPCDigitData>& candidateDigits);
+
+  
+  /**
+   * Returns the digit vector belonging to the candidate
+   */
+  vector<AliHLTTPCDigitData> *GetCandidateDigits(Int_t candidateIndex);
+
+  void ClearCandidateDigits(){fCandidateDigitsVector.clear();}
+
+  /**
+   * Prints the raw data og this pad.
+   */
+  void PrintRawData();
+
+  /**
+   * Vector of cluster candidates
+   */
+  vector<AliHLTTPCClusters> fClusterCandidates;                    //! transient
 
+  /**
+   * Vector of used clustercandidates, used so one do not use candidates multiple times
+   */
+  vector<Int_t> fUsedClusterCandidates;  //! transient
+  Bool_t fSelectedPad;                   //! transient
+  AliHLTUInt16_t fHWAddress;             //! transient
  private:
+  /** copy constructor prohibited */
+  AliHLTTPCPad(const AliHLTTPCPad&);
+  /** assignment operator prohibited */
+  AliHLTTPCPad& operator=(const AliHLTTPCPad&);
+
   /**
    * Add a value to the base line calculation.
    * The value is been added to the sum if it exceeds the current base line
@@ -235,40 +375,58 @@ class AliHLTTPCPad : public AliHLTLogging {
   Int_t AddBaseLineValue(Int_t bin, AliHLTTPCSignal_t value);
 
   /** The row number of the pad */
-  Int_t fRowNo;
+  Int_t fRowNo;                                                    // see above
   /** The pad number of the pad */
-  Int_t fPadNo;
+  Int_t fPadNo;                                                    // see above
   /** Threshold for zero suppression */
-  AliHLTTPCSignal_t fThreshold;
+  AliHLTTPCSignal_t fThreshold;                                    // see above
   /** The average base line value */
-  AliHLTTPCSignal_t fAverage;
+  AliHLTTPCSignal_t fAverage;                                      // see above
   /** Number of events included in the base line calculation*/
-  Int_t fNofEvents;
+  Int_t fNofEvents;                                                // see above
   /** The sum within one event */
-  AliHLTTPCSignal_t fSum;
+  AliHLTTPCSignal_t fSum;                                          // see above
   /** The number of bins contributing to the sum */
-  Int_t fCount;
+  Int_t fCount;                                                    // see above
   /** The total number of bins already set during the event */
-  Int_t fTotal;
+  Int_t fTotal;                                                    // see above
   /** The maximum base line value within one event */
-  AliHLTTPCSignal_t fBLMax;
+  AliHLTTPCSignal_t fBLMax;                                        // see above
   /** The bin for the maximum bl value within one event */
-  Int_t fBLMaxBin;
+  Int_t fBLMaxBin;                                                 // see above
   /** The minimum base line value within one event */
-  AliHLTTPCSignal_t fBLMin;
+  AliHLTTPCSignal_t fBLMin;                                        // see above
   /** The bin for the minimum bl value within one event */
-  Int_t fBLMinBin;
+  Int_t fBLMinBin;                                                 // see above
   /** The first bin included in the base line calculation */
-  Int_t fFirstBLBin;
+  Int_t fFirstBLBin;                                               // see above
   /** Number of bins */
-  Int_t fNofBins;
+  Int_t fNofBins;                                                  // see above
 
   /** The current read position */
-  Int_t fReadPos;
+  Int_t fReadPos;                                                  // see above
 
   /** The raw data history */
-  AliHLTTPCSignal_t* fpRawData;
+  AliHLTTPCSignal_t* fpRawData;                                    //! transient
+
+  /**
+   * Array containing the data
+   */
+  AliHLTTPCSignal_t* fDataSignals;                                 //! transient
+
+  /**
+   * Array containing info on which bins have signals
+   */
+  Int_t *fSignalPositionArray;                                     //! transient
+
+  /** Size of signals in fSignalPositionArray */
+  Int_t fSizeOfSignalPositionArray;                                //! transient
+
+  /** Number of good signals sent (good signals is signals surviving ZeroSuppression) */
+  Int_t fNGoodSignalsSent;
+  
+  vector<vector<AliHLTTPCDigitData> > fCandidateDigitsVector;
 
-  ClassDef(AliHLTTPCPad, 0)
+  ClassDef(AliHLTTPCPad, 7)
 };
-#endif
+#endif // ALIHLTTPCPAD_H