]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDmcmSim.h
Fix by Hermes that resets -1 and adds additional checks
[u/mrichter/AliRoot.git] / TRD / AliTRDmcmSim.h
1 #ifndef ALITRDMCMSIM_H
2 #define ALITRDMCMSIM_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ///////////////////////////////////////////////////////
9 //                                                   //
10 //  Multi Chip Module Simulation Class               //
11 //                                                   //
12 ///////////////////////////////////////////////////////
13
14 #include <TObject.h>
15
16 class AliTRDfeeParam;
17 class AliTRDSimParam;
18 class AliTRDcalibDB;
19 class AliTRDgeometry;
20 class AliTRDtrapAlu;
21 class AliTRDpadPlane;
22 class AliTRDarrayADC;
23
24 class AliTRDmcmSim : public TObject {
25
26  public:
27
28                     AliTRDmcmSim();
29                     AliTRDmcmSim(const AliTRDmcmSim &m);
30   virtual          ~AliTRDmcmSim();
31   AliTRDmcmSim      &operator=(const AliTRDmcmSim &m);
32
33   virtual void      Copy(TObject &m) const;
34
35           void      Init( Int_t cha, Int_t rob, Int_t mcm, Bool_t newEvent );   // Initialize MCM by the position parameters
36   //void      Init( Int_t cha, Int_t rob, Int_t mcm );   // Initialize MCM by the position parameters
37           void      SetData(Int_t iadc, Int_t *adc);           // Set ADC data with array 
38           void      SetData(Int_t iadc, Int_t it, Int_t adc ); // Set ADC data
39           void      SetDataPedestal(Int_t iadc );              // Fill ADC data with pedestal values
40
41           Int_t     GetChaId() const  { return fChaId;  };     // Returns Chamber ID (0-539)
42           Int_t     GetRobPos() const { return fRobPos; };     // Returns ROB position (0-7)
43           Int_t     GetMcmPos() const { return fMcmPos; };     // Returns MCM position (0-17) (16,17 are mergers)
44           Int_t     GetRow() const    { return fRow;    };     // Returns Row number on chamber where the MCM is sitting
45           Int_t     GetCol( Int_t iadc );                      // Get corresponding column (0-143) from for ADC channel iadc = [0:20]
46           // for the ADC/Col mapping, see: http://wiki.kip.uni-heidelberg.de/ti/TRD/index.php/Image:ROB_MCM_numbering.pdf
47
48           Int_t*    GetPosLUT();
49
50           Int_t     ProduceRawStream( UInt_t *buf, Int_t bufsize );   // Produce raw data stream from this MCM - old
51           Int_t     ProduceRawStreamV2( UInt_t *buf, Int_t bufsize ); // Produce raw data stream - Read data format
52           Int_t     ProduceTrackletStream( UInt_t *buf, Int_t bufsize ); // produce the tracklet stream for this MCM
53           void      Filter();                                  // Apply digital filters for existing data
54           void      ZSMapping();                               // Do ZS mapping for existing data
55           void      DumpData( char *f, char *target );         // Dump data stored (only for debugging)
56           void      Tracklet();
57           void      SetPosLUT();
58           void      CopyArrays();                              // Copy arrays between containers, internal consistency
59           void      GeneratefZSM1Dim();                        // Generate the ZSM1Dim based on digits array info
60           void      StartfastZS(Int_t pads, Int_t timebis);                    // For ZS in the digitizer
61           void      FlagDigitsArray(AliTRDarrayADC *tempdigs, Int_t valrow);   //Set flags on the digits array
62           void      RestoreZeros(); 
63
64  protected:
65
66           Bool_t    fInitialized;                       // Status whether the class is initialized or not
67           Int_t    fNextEvent;                         // 0, if new event; 1 if not
68           Int_t     fMaxTracklets;                      // maximum number of tracklet-words submitted per mcm **new**
69           Int_t     fChaId;                             // Chamber ID
70           Int_t     fSector;                            // Sector number of the supermodule
71           Int_t     fStack;                             // Chamber stack ID
72           Int_t     fLayer;                             // Chamber layer ID
73           Int_t     fRobPos;                            // ROB Position on chamber
74           Int_t     fMcmPos;                            // MCM Position on chamber
75           Int_t     fNADC;                              // Number of ADC (usually 21)
76           Int_t     fNTimeBin;                          // Number of Timebins (variable)
77           Int_t     fRow;                               // Pad row number (0-11 or 0-15) of the MCM on chamber
78           Int_t   **fADCR;                              // Array with MCM ADC values (Raw)
79           Int_t   **fADCF;                              // Array with MCM ADC values (Filtered)
80           Int_t   **fADCT;                              // Array with MCM ADC values (filtered) for tracklet (12bits) //***NEW***
81           Int_t    *fPosLUT;                            // position lookup table **new**
82           UInt_t   *fMCMT;                              // tracklet word for one mcm/trap-chip **new**
83           Int_t   **fZSM;                               // Zero suppression map
84           Int_t    *fZSM1Dim;                           // Zero suppression map (1 dimensional projection)
85
86         
87         
88
89
90           // Parameter classes
91           AliTRDfeeParam *fFeeParam;                    // FEE parameters
92           AliTRDSimParam *fSimParam;                    // Simulation parameters
93           AliTRDcalibDB  *fCal;                         // Calibration interface
94           AliTRDgeometry *fGeo;                         // Geometry
95
96           Bool_t    CheckInitialized();                 // Check whether the class is initialized
97           void      FilterPedestal();                   // Apply pedestal filter
98           void      FilterGain();                       // Apply gain filter
99           void      FilterTail();                       // Apply tail filter
100
101           // Here are the several sub functions used only in FilterTail
102           void      FilterSimDeConvExpA(Int_t *source, Double_t *target, Int_t n, Int_t nexp);
103           void      FilterSimDeConvExpD(Int_t *source, Int_t *target, Int_t n, Int_t nexp);
104           void      FilterSimDeConvExpMI(Int_t *source, Double_t *target, Int_t n);
105           void      FilterSimTailMakerSpline(Double_t *ampin, Double_t *ampout, Double_t lambda, Int_t n);
106           void      FilterSimTailCancelationMI(Double_t *ampin, Double_t *ampout, Double_t norm, Double_t lambda, Int_t n);
107           void      FilterSimDeConvExpEl(Int_t *source, Int_t *target, Int_t n, Int_t nexp);
108
109   ClassDef(AliTRDmcmSim,3)
110
111 };
112
113 #endif