/[PAMELA software]/DarthVader/ToFLevel2/inc/ToFLevel2.h
ViewVC logotype

Diff of /DarthVader/ToFLevel2/inc/ToFLevel2.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by pam-de, Thu Mar 1 10:48:25 2007 UTC revision 1.21 by mocchiut, Fri Apr 18 18:55:51 2008 UTC
# Line 11  Line 11 
11  #include <TArrayF.h>  #include <TArrayF.h>
12  #include <TClonesArray.h>  #include <TClonesArray.h>
13    
14    #include <math.h> // EMILIANO
15    #include <iostream> // from ToFLevel2.cpp
16    #include <fstream> // Emiliano
17    #include <sstream> // Emiliano
18    #include <string> // Emiliano
19    
20    
21  #include <ToFStruct.h>  #include <ToFStruct.h>
22    
23    #include <TrkLevel2.h> // Emiliano
24    #include <TrigLevel2.h> // Emiliano
25    #include <GLTables.h> // Emiliano
26    #include <OrbitalInfo.h> // Emiliano
27    #include <ToFCore.h> // Emiliano
28    //
29    // Declaration of the core fortran routines
30    //
31    #define tofl2com tofl2com_
32    extern "C" int tofl2com();
33    #define toftrk toftrk_
34    extern "C" int toftrk();
35    #define rdtofcal rdtofcal_
36    extern "C" int rdtofcal(char [], int *);
37    
38  //  //
39  // class which contains track related variables  // class which contains track related variables
# Line 28  Line 49 
49  /**  /**
50   * \brief  Class which contains the PMT data   * \brief  Class which contains the PMT data
51   *   *
52     * If there is a valid ADC or a TDC value (value<4095) for a PMT, both ADC and TDC data
53     * are stored in the PMT class.
54     * Look in the ToFLevel2Ex.cxx example in the repository how to read the PMT class.
55   */   */
56  class ToFPMT : public TObject {  class ToFPMT : public TObject {
57    
# Line 35  class ToFPMT : public TObject { Line 59  class ToFPMT : public TObject {
59    
60   public:   public:
61      Int_t pmt_id;     ///<the identification number of the PMT from 0 to 47      Int_t pmt_id;     ///<the identification number of the PMT from 0 to 47
62      Float_t adc;      ///<raw ADC values adc[4,12]      Float_t adc;      ///<raw ADC value for this PMT
63      Float_t tdc_tw;   ///<time-walk corrected TDC values tdc_tw[4,12]      Float_t tdc;      ///<raw TDC value for this PMT
64        Float_t tdc_tw;   ///<time-walk corrected TDC value for this PMT
65      //      //
66      ToFPMT();      ToFPMT();
67      ToFPMT(const ToFPMT&);      ToFPMT(const ToFPMT&);
68      //      //
69      ToFPMT* GetToFPMT(){return this;};      ToFPMT* GetToFPMT(){return this;};
70      void Clear();      void Clear(Option_t *t="");
71    
72    
73    
74      ClassDef(ToFPMT,1);      ClassDef(ToFPMT,2);
75  };  };
76    
77    
78  /**  /**
79   * \brief Class which contains the tracker realated variables   * \brief Class which contains the tracker related variables
80   *   *
81     * We can use the ToF standalone to find hitted paddles, calculate beta, etc..
82     * These results are then stored with the "trkseqno" = -1.
83     * If we use the track from the tracker, then the penetration points in the
84     * scintillators are calculated, which defines the hitted paddles. For these paddles
85     * we calculate then all the output.
86     * Note: The artificial ADC values are stored as dEdx in the output, the dEdx will be
87     * by definition = 1. However, the artificial TDC values are just used internally
88     * and not stored in the output. But one can see in both cases which PMT has artificial
89     * values using "adcflag" and "tdcflag".
90     * Look in the ToFLevel2Ex.cxx example in the repository how to read the tracker related
91     * variables.
92   */   */
93  class ToFTrkVar : public TObject {  class ToFTrkVar : public TObject {
94    
# Line 62  class ToFTrkVar : public TObject { Line 98  class ToFTrkVar : public TObject {
98    //    //
99    Int_t trkseqno; ///< tracker sequ. number: -1=ToF standalone, 0=first Tracker track, ...    Int_t trkseqno; ///< tracker sequ. number: -1=ToF standalone, 0=first Tracker track, ...
100    //    //
101    Int_t npmttdc;  ///<number of TDC used to evaluate beta    Int_t npmttdc;  ///<number of the TDC measurements used to evaluate beta
102    TArrayI pmttdc;  ///<contains the PMT ID for the tdc used to evaluate beta    TArrayI pmttdc;  ///<contains the ID (0..47) for the PMT used to evaluate beta
103    TArrayI tdcflag; ///<array  flagging the artificial TDCs, "0" if normal TDC value    TArrayI tdcflag; ///<flag for artificial TDC, "0" if normal TDC value
   Float_t beta[13]; ///<beta, 12 measurements for the 12  combinations, beta[13] is weighted mean  
   //  
   Int_t npmtadc;  ///<number of ADCs used for dEdx evaluation  
   TArrayI pmtadc; ///<contains the PMT ID for the adc used in evaluate dedx=adc_c  
   TArrayI adcflag; ///<array flagging the artificial ADCs, "0" if normal ADC value  
   TArrayF dedx;    ///<energy loss in mip  
   //  
   Float_t xtofpos[3];  ///<x-measurement using the TDC values and the calibration  
   Float_t ytofpos[3];  ///<x-measurement using the TDC values and the calibration  
104    
105    /**
106     * \brief beta, 12 measurements for the 12  combinations, beta[13] is modified weighted mean
107     *
108     * The 12 measurements are S11-S31, S11-S32, S12-S31, S12-S32, and then analogue for
109     * S2-S3 and S1-S2.
110     * The calculation of beta[13] is now modified:
111     * We check the individual weights for artificial TDC values, then calculate
112     * am mean beta for the first time. In a second step we loop again through
113     * the single measurements, checking for the residual from the mean
114     * The cut on the residual reject measurements > "x"-sigma. A chi2 value is
115     * calculated, furthermore a "quality" value by adding the weights which
116     * are finally used. If all measurements are taken, "quality" will be = 505.
117     * A chi2 cut around 3-4 and a quality-cut > 400 is needed for clean beta
118     * The Level2 beta[12] which is derived in the fortran routines uses: 10.,200.,20.
119     * This is not a very high quality measurement. One can re-calculate a new beta[13]
120     * using the L2-method "CalcBeta"
121     */
122      Float_t beta[13];
123      //
124      Int_t npmtadc;  ///<number of the ADC measurements used for dEdx evaluation
125      TArrayI pmtadc; ///<contains the ID (0..47) for the PMT used to evaluate dEdx
126      TArrayI adcflag; ///<flag for artificial ADCs, "0" if normal ADC value
127      TArrayF dedx;    ///<energy loss for this PMT in mip
128      //
129      Float_t xtofpos[3];  ///<x-measurement using the TDC values and the calibration from S12, S21, S32
130      Float_t ytofpos[3];  ///<x-measurement using the TDC values and the calibration from S11, S22, S31
131      //
132      Float_t xtr_tof[6];  ///<x-measurement in the ToF layers from tracker
133      Float_t ytr_tof[6];  ///<x-measurement in the ToF layers from tracker
134    //    //
135    ToFTrkVar();    ToFTrkVar();
136    ToFTrkVar(const ToFTrkVar&);    ToFTrkVar(const ToFTrkVar&);
137    
138    ToFTrkVar* GetToFTrkVar(){return this;};    ToFTrkVar* GetToFTrkVar(){return this;};
139    void Clear();    void Clear(Option_t *t="");
140    
141    ClassDef(ToFTrkVar,1);    ClassDef(ToFTrkVar,1);
142    //    //
# Line 99  class ToFLevel2 : public TObject { Line 155  class ToFLevel2 : public TObject {
155    TClonesArray *PMT; ///<class needed to store PMT hit informations    TClonesArray *PMT; ///<class needed to store PMT hit informations
156    TClonesArray *ToFTrk; ///<track related variable class    TClonesArray *ToFTrk; ///<track related variable class
157    Int_t tof_j_flag[6];  ///<number of hitted paddle(s) for each ToF layer: flag = flag + 2**(paddlenumber-1)    Int_t tof_j_flag[6];  ///<number of hitted paddle(s) for each ToF layer: flag = flag + 2**(paddlenumber-1)
158      //
159      Int_t unpackError;///< zero if no error presente
160      Int_t default_calib; ///< one if the default calibration has been used to process the data, zero otherwise
161      //
162      Float_t GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl); // gf Apr 07
163    
164      Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut);  //  wm feb 08
165    
   Int_t unpackError;  
166    //    //
167    Float_t GetdEdx(Int_t notrack, Int_t plane);  //  Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t chi2cut, Float_t qualitycut);   // wm feb 08
168    //    //
169    // methods to make life simplier during the analysis, returns a pointer to the ToFTrkVar class containing track related variables    // methods to make life simplier during the analysis, returns a pointer to the ToFTrkVar class containing track related variables
170    //    //
# Line 116  class ToFLevel2 : public TObject { Line 178  class ToFLevel2 : public TObject {
178    ToFPMT *GetToFPMT(Int_t nohit);    ToFPMT *GetToFPMT(Int_t nohit);
179    Int_t GetPMTid(Int_t gg, Int_t hh);    Int_t GetPMTid(Int_t gg, Int_t hh);
180    TString GetPMTName(Int_t ind);    TString GetPMTName(Int_t ind);
181      
182    Int_t GetPlaneIndex(Int_t pmt_id);    Int_t GetPlaneIndex(Int_t pmt_id);
183    void GetMatrix(Int_t notrack, Float_t adc[4][12], Float_t tdc[4][12]);    void GetMatrix(Int_t notrack, Float_t adc[4][12], Float_t tdc[4][12]);
184    void GetPMTIndex(Int_t pmt_id, Int_t &gg, Int_t &hh);    void GetPMTIndex(Int_t pmt_id, Int_t &gg, Int_t &hh);
185    
186      // gf Apr 07
187      void GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning); // gf Apr 07
188      TString GetPMTName(Int_t ind, Int_t &iplane, Int_t &ipaddle,Int_t &ipmt);
189      Int_t GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane); // gf Apr 07
190      void GetPMTPaddle(Int_t pmt_id, Int_t &plane, Int_t &paddle); // gf Apr 07
191      void GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright); // gf Apr 07
192      void GetPaddleGeometry(Int_t plane, Int_t paddle, Float_t &xleft, Float_t &xright, Float_t &yleft, Float_t &yright); // gf Apr 07
193      Int_t GetPaddleid(Int_t plane, Int_t paddle);
194      void GetPaddlePlane(Int_t padid, Int_t &plane, Int_t &paddle);
195      Int_t GetNPaddle(Int_t plane);
196      //
197      //
198      //
199      Int_t Process(TrkLevel2 *trk, TrigLevel2 *trg, GL_RUN *run, OrbitalInfo *orb, Bool_t force); // Emiliano
200      
201    //    //
202    // constructor    // constructor
203    //    //
204    ToFLevel2();    ToFLevel2();
205    ~ToFLevel2(){Delete();}; //ELENA    ~ToFLevel2(){Delete();}; //ELENA
206    void Delete(); //ELENA    void Delete(Option_t *t=""); //ELENA
207    void Set();//ELENA    void Set();//ELENA
208    //    //
209    //    //
210    ToFLevel2*   GetToFLevel2(){return this;};    ToFLevel2*   GetToFLevel2(){return this;};
211    
212  /**  /**
213   * Method to get the z-position of the 6 TOF layers from th plane ID   * Method to get the z-position of the 6 TOF layers from the plane ID
214   * @param plane_id Plane ID (11 12 21 22 31 32)   * @param plane_id Plane ID (11 12 21 22 31 32)
215   */   */
216    Float_t      GetZTOF(Int_t plane_id){    Float_t      GetZTOF(Int_t plane_id){
# Line 162  class ToFLevel2 : public TObject { Line 241  class ToFLevel2 : public TObject {
241      Int_t  GetToFPlaneIndex(Int_t plane_id);      Int_t  GetToFPlaneIndex(Int_t plane_id);
242      Bool_t HitPaddle(Int_t ,Int_t);      Bool_t HitPaddle(Int_t ,Int_t);
243      Int_t  GetNHitPaddles(Int_t plane);      Int_t  GetNHitPaddles(Int_t plane);
244      void Clear();      void Clear(Option_t *t="");
245      //      //
246      ClassDef(ToFLevel2,2);      ClassDef(ToFLevel2,4);
247  };  };
248    
249  #endif  #endif

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.23