StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtDriftVelocityMaker.h
1 /***************************************************************************
2  *
3  * $Id: StSvtDriftVelocityMaker.h,v 1.7 2004/01/26 23:11:44 perev Exp $
4  *
5  * Author: Marcelo Munhoz
6  ***************************************************************************
7  *
8  * Description: SVT Drift Velocity Maker
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtDriftVelocityMaker.h,v $
13  * Revision 1.7 2004/01/26 23:11:44 perev
14  * Leak off
15  *
16  * Revision 1.6 2003/09/10 19:47:34 perev
17  * ansi corrs
18  *
19  * Revision 1.5 2003/09/07 03:49:05 perev
20  * gcc 3.2 + WarnOff
21  *
22  * Revision 1.4 2002/03/04 17:06:48 willson
23  * Laser spot positions recorded
24  *
25  * Revision 1.3 2002/02/06 00:10:45 willson
26  * File entries, variable names.
27  *
28  * Revision 1.2 2002/01/18 20:53:47 willson
29  * Some bug fixes by Helen
30  *
31  *
32  **************************************************************************/
33 
34 #ifndef STSVTDRIFTVELOCITYMAKER_H
35 #define STSVTDRIFTVELOCITYMAKER_H
36 
37 #ifndef StMaker_H
38 #include "StMaker.h"
39 #endif
40 #include <string>
41 
42 #include "TH1.h"
43 #include "TH2.h"
44 
45 class StEvent;
46 class StTrack;
47 class StSvtHit;
48 class StChain;
49 class StSvtData;
52 class StSvtHitCollection;
53 
55  private:
56  StSvtHybridCollection* mSvtData;
57  StSvtData* mSvtRawData;
58  StSvtHybridCollection* mSvtDriftVeloc;
59  int mNHybridDriftVelocityHisto;
60  TH1D** mHybridDriftVelocityHisto;
61  TH2D** mHybridDriftVelocity2DHisto;
62  TH1D* mGlobalDriftVelocityHisto;
63  TH2D* mGlobalDriftVelocity2DHisto;
64  TH1D* mCalculatedDriftVelocity;
65  TH1D* mLaserSpotDistL07B3_1;
66  TH1D* mLaserSpotDistL15B3_1;
67  TH1D* mLaserSpotDistL15B3_2;
68  Int_t mEventCounter;
69  Int_t mHitCounter;
70  Int_t mNumTimeBins; // Number of time bins to use in drift velocity calculation. Default=128
71  Int_t mMaximumTB; // Max Time Bin to look at. Default=128
72  Int_t mMinimumTB; // Min Time Bin to look at. Default=0
73  bool mRaw; // Raw data? false=StEvent data
74  bool mDebug; // If true, make 2D histos, and keep everything. Also, save to TH1D instead of ascii file
75 
76  /* To calculate drift velocity, take the 1D histo of hits vs. time. Find the average number of hits
77  in some number of time bins in the middle of the histogram.
78  For mMoveFoward=true:
79  Start in the middle of the 1D histo, and move up the time bins until the number of hits per time bin
80  is LESS THAN [average*mFraction]. Record this time bin, j, and calculate drift velocity with this formula:
81  Drift Velocity = 3.0 cm/Drift Time (cm/sec)
82  Drift Time = (j-mMinimumTB-mT0Guess)*(128.0/mNumTimeBins)*(0.00000004 sec/time bucket)
83 
84  For mMoveForward=false:
85  Start at the end of the 1D histo, and move down the time bins until the number of hits per time bin are
86  GREATER THAN [average*mFraction]. Record this time bin, j, and calculate drift velocity the same way.
87 
88  mT0Guess = T0 guess (units: time bucket bins **NOT Time Buckets!**) */
89 
90  double mFraction; // Default: 0.5
91  double mT0Guess; // Default: 0.5
92  bool mMoveForward; // Default: true
93 
94  protected:
95 
96  public:
97  StSvtDriftVelocityMaker(const char *name="SvtDriftVelocity");
98  virtual ~StSvtDriftVelocityMaker();
99  virtual Int_t Init();
100  virtual Int_t Make();
101  virtual Int_t Finish();
102  // virtual Int_t Clear();
103 
104  bool accept(StEvent* event);
105  bool accept(StSvtHit* hit);
106 
107  virtual Int_t SetSvtData();
108  virtual Int_t SetSvtRawData();
109  virtual Int_t SetSvtDriftVelocity();
110  virtual Int_t FillHistogramsRaw();
111  virtual Int_t FillHistogramsStEvent();
112  virtual Int_t CalcDriftVelocity();
113  virtual Int_t GetInjectorLine(float peak);
114  virtual Int_t GetInjectorLine(float* peak);
115  virtual Float_t GetClosestToLine(float peak1, float peak2);
116  virtual Float_t GetTimeZero(int anode);
117  virtual Float_t GetDistanceInjectorLine(int line);
118  virtual Float_t FitVelocity(int nInjectorsFired, float* peak, float t0);
119  virtual Float_t CalcV1(int anode, float velocity);
120  virtual Float_t CalcV2(int anode, float velocity);
121  virtual Float_t CalcV3(int anode, float velocity);
122  virtual Int_t FillAllAnodes();
123  virtual Int_t WriteToDb(Text_t *timestamp);
124  TH1D* GetHybridHisto(int i) {return mHybridDriftVelocityHisto[i];};
125  TH2D* GetHybrid2DHisto(int i) {return mHybridDriftVelocity2DHisto[i];};
126  TH1D* GetGlobalHisto() {return mGlobalDriftVelocityHisto;};
127  TH2D* GetGlobal2DHisto() {return mGlobalDriftVelocity2DHisto;};
128  TH1D* GetFinalHisto() {return mCalculatedDriftVelocity;};
129  TH1D* GetLaserSpotDistL07B3_1() {return mLaserSpotDistL07B3_1;};
130  TH1D* GetLaserSpotDistL15B3_1() {return mLaserSpotDistL15B3_1;};
131  TH1D* GetLaserSpotDistL15B3_2() {return mLaserSpotDistL15B3_2;};
132  Int_t GetNumEvents() {return mEventCounter;};
133  Int_t GetNumHits() {return mHitCounter;};
134  Int_t GetNumTimeBins() {return mNumTimeBins;};
135  Int_t GetMaximumTB() {return mMaximumTB;};
136  Int_t GetMinimumTB() {return mMinimumTB;};
137  bool DebugIsOn() {return mDebug;};
138  bool DVCalcDoesMoveForward() {return mMoveForward;};
139  double GetDVFraction() {return mFraction;};
140  double GetDVT0Guess() {return mT0Guess;};
141  void SetNumTimeBins(const Int_t x) {mNumTimeBins = x;};
142  void SetMaximumTB(const Int_t x) {mMaximumTB = x;};
143  void SetMinimumTB(const Int_t x) {mMinimumTB = x;};
144  void SetDebug(int x) {mDebug = (x!=0);};
145  void SetMoveForward(const bool x) {mMoveForward = x;};
146  void SetFraction(const double x) {mFraction = x;};
147  void SetT0Guess(const double x) {mT0Guess = x;};
148 
149  ClassDef(StSvtDriftVelocityMaker,0) //StAF chain virtual base class for Makers
150 };
151 
152 #endif
153 
154