]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDmcmSim.h
Compare method fixed (Plamen)
[u/mrichter/AliRoot.git] / TRD / AliTRDmcmSim.h
index 5cddbed5bca918a571ec406f8682e64ed91770ca..090958ce5d4baae18b0dfd1240921bd878e4b19f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ALITRDMCMSIMNEW_H
-#define ALITRDMCMSIMNEW_H
+#ifndef ALITRDMCMSIM_H
+#define ALITRDMCMSIM_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
 ///////////////////////////////////////////////////////
 
 #include <TObject.h>
-#include <TClonesArray.h>
+#include "AliTRDCommonParam.h"
+#include "AliTRDcalibDB.h"
+
+class TClonesArray;
 
 class AliRunLoader;
 class AliTRDfeeParam;
@@ -22,6 +25,7 @@ class AliTRDcalibDB;
 class AliTRDgeometry;
 class AliTRDpadPlane;
 class AliTRDarrayADC;
+class AliTRDdigitsManager;
 
 class AliTRDmcmSim : public TObject {
  public:
@@ -31,13 +35,17 @@ class AliTRDmcmSim : public TObject {
           void      Init( Int_t cha, Int_t rob, Int_t mcm, Bool_t newEvent = kFALSE );   // Initialize MCM by the position parameters
          void      Reset();                                   // clears filter registers and internal data
 
-         Bool_t    LoadMCM(AliRunLoader *runloader, Int_t det, Int_t rob, Int_t mcm);
+         Bool_t    LoadMCM(AliRunLoader* const runloader, Int_t det, Int_t rob, Int_t mcm);
          void      NoiseTest(Int_t nsamples, Int_t mean, Int_t sigma, Int_t inputGain = 1, Int_t inputTail = 2);
 
+         Int_t     GetDataRaw(Int_t iadc, Int_t timebin)      { return (fADCR[iadc][timebin] >> 2); } // Get unfiltered ADC data 
+         Int_t     GetDataFiltered(Int_t iadc, Int_t timebin) { return (fADCF[iadc][timebin] >> 2); } // Get filtered ADC data
           void      SetData(Int_t iadc, Int_t *adc);           // Set ADC data with array 
           void      SetData(Int_t iadc, Int_t it, Int_t adc ); // Set ADC data
-         void      SetData(AliTRDarrayADC *adcArray);         // Set ADC data from adcArray
+         void      SetData(AliTRDarrayADC *adcArray, 
+                           AliTRDdigitsManager *digitsManager = 0x0);         // Set ADC data from adcArray
           void      SetDataPedestal(Int_t iadc );              // Fill ADC data with pedestal values
+  static  void      SetApplyCut(Bool_t applyCut) { fgApplyCut = applyCut; }
 
           Int_t     GetDetector() const  { return fDetector;  };     // Returns Chamber ID (0-539)
           Int_t     GetRobPos() const { return fRobPos; };     // Returns ROB position (0-7)
@@ -45,8 +53,10 @@ class AliTRDmcmSim : public TObject {
           Int_t     GetRow() const    { return fRow;    };     // Returns Row number on chamber where the MCM is sitting
          Int_t     GetCol( Int_t iadc );                      // Get corresponding column (0-143) from for ADC channel iadc = [0:20]
          // for the ADC/Col mapping, see: http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf
+  static  Bool_t    GetApplyCut() { return fgApplyCut; }
 
          void WriteData(AliTRDarrayADC *digits);
+         Bool_t StoreTracklets();                             // Stores tracklets via runloader
 
          Int_t     ProduceRawStream( UInt_t *buf, Int_t bufsize, UInt_t iEv = 0 ); // Produce raw data stream - Read data format
          Int_t     ProduceTrackletStream( UInt_t *buf, Int_t bufsize ); // produce the tracklet stream for this MCM
@@ -79,11 +89,11 @@ class AliTRDmcmSim : public TObject {
          void      TrackletSelection();
          void      FitTracklet();
 
-         TClonesArray* GetTrackletArray() { return fTrackletArray; }
+         TClonesArray* GetTrackletArray() const { return fTrackletArray; }
 
          // data display
-         void      Print(Option_t* option="") const;   // print stored data to stdout
-         void      Draw(Option_t *option ="");         // draw data (ADC data, hits and tracklets)
+         void      Print(Option_t* const option="") const;   // print stored data to stdout
+         void      Draw(Option_t* const option ="");         // draw data (ADC data, hits and tracklets)
          void      DumpData( char *f, char *target );  // Dump data stored (only for debugging)
 
  protected:
@@ -114,9 +124,12 @@ class AliTRDmcmSim : public TObject {
          AliTRDfeeParam    *fFeeParam;                 // FEE parameters
          AliTRDtrapConfig  *fTrapConfig;               // TRAP config
          AliTRDSimParam    *fSimParam;                 // Simulation parameters
+         AliTRDCommonParam *fCommonParam;              // common parameters
          AliTRDcalibDB     *fCal;                      // Calibration interface
          AliTRDgeometry    *fGeo;                      // Geometry
 
+         AliTRDdigitsManager *fDigitsManager;          // pointer to digits manager used for MC label calculation
+
          // internal filter registers
          UInt_t*   fPedAcc;                            // Accumulator for pedestal filter
          UInt_t*   fGainCounterA;                      // Counter for values above FGTA in the gain filter
@@ -126,30 +139,30 @@ class AliTRDmcmSim : public TObject {
 
          // hit detection
          // individual hits can be stored as MC info
-         struct Hit_t {
-           Int_t channel;
-           Int_t timebin;
-           Int_t qtot;
-           Int_t ypos;
-           Int_t label;
-         } fHits[fgkNHitsMC];                          // Array of detected hits (only available in MC)
+         struct Hit_t {                                // Array of detected hits (only available in MC)
+           Int_t fChannel;                             // ADC channel of the hit
+           Int_t fTimebin;                             // timebin of the hit
+           Int_t fQtot;                                // total charge of the hit
+           Int_t fYpos;                                // calculated y-position
+           Int_t fLabel;                               // label (only in MC)
+         } fHits[fgkNHitsMC];
          Int_t fNHits;                                 // Number of detected hits
 
          // tracklet calculation
-         struct FitReg_t {
-           Int_t   Nhits;
-           UInt_t Q0;
-           UInt_t Q1;
-           UInt_t SumX;
-           Int_t SumY;
-           UInt_t SumX2;
-           UInt_t SumY2;
-           Int_t SumXY;
-         } *fFitReg;                                   // pointer to the 18 fit registers 
+         struct FitReg_t {                             // pointer to the 18 fit registers 
+           Int_t   fNhits;                             // number of hits
+           UInt_t fQ0;                                 // charge accumulated in first window
+           UInt_t fQ1;                                 // charge accumulated in second window
+           UInt_t fSumX;                               // sum x
+           Int_t fSumY;                                // sum y 
+           UInt_t fSumX2;                              // sum x**2
+           UInt_t fSumY2;                              // sum y**2
+           Int_t fSumXY;                               // sum x*y
+         } *fFitReg;
 
          //??? cleaning up
          void Sort2(UShort_t  idx1i, UShort_t  idx2i, UShort_t  val1i, UShort_t  val2i, 
-                    UShort_t *idx1o, UShort_t *idx2o, UShort_t *val1o, UShort_t *val2o);
+                    UShort_t *idx1o, UShort_t *idx2o, UShort_t *val1o, UShort_t *val2o) const;
          void Sort3(UShort_t  idx1i, UShort_t  idx2i, UShort_t  idx3i, 
                     UShort_t  val1i, UShort_t  val2i, UShort_t  val3i, 
                     UShort_t *idx1o, UShort_t *idx2o, UShort_t *idx3o, 
@@ -162,12 +175,13 @@ class AliTRDmcmSim : public TObject {
                             UShort_t  val1i, UShort_t  val2i, UShort_t  val3i, UShort_t  val4i, UShort_t  val5i, UShort_t  val6i, 
                             UShort_t *idx5o, UShort_t *idx6o);
 
-         UInt_t AddUintClipping(UInt_t a, UInt_t b, UInt_t nbits);  // Add a and b (unsigned) with clipping to the maximum value representable by nbits
+         UInt_t AddUintClipping(UInt_t a, UInt_t b, UInt_t nbits) const;  // Add a and b (unsigned) with clipping to the maximum value representable by nbits
 
  private:
          AliTRDmcmSim(const AliTRDmcmSim &m);             // not implemented
          AliTRDmcmSim &operator=(const AliTRDmcmSim &m);  // not implemented
 
+         static Bool_t fgApplyCut;
 
   ClassDef(AliTRDmcmSim,4)
 };