StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtSeqAdjMaker.h
1 // $Id: StSvtSeqAdjMaker.h,v 1.27 2014/08/06 11:43:46 jeromel Exp $
2 // $Log: StSvtSeqAdjMaker.h,v $
3 // Revision 1.27 2014/08/06 11:43:46 jeromel
4 // Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
5 //
6 // Revision 1.26 2007/07/12 20:10:35 fisyak
7 // Add forward declaration for ROOT 5.16
8 //
9 // Revision 1.25 2005/07/23 03:37:34 perev
10 // IdTruth + Cleanup
11 //
12 // Revision 1.24 2004/03/18 04:05:02 caines
13 // Remove from global scope variables used in debug mode as they shouldnt be there and caused erratic behaviour, also initialise some variables that valgrind was complaining about - didnt really need to as they are sent back from function which initialises them properly always but doesnt hurt
14 //
15 // Revision 1.23 2003/09/10 19:47:36 perev
16 // ansi corrs
17 //
18 // Revision 1.22 2003/09/02 17:59:08 perev
19 // gcc 3.2 updates + WarnOff
20 //
21 // Revision 1.21 2003/07/18 17:15:40 caines
22 // Fix Pedoffset to be 20 not 10 change variables to int from floats to avoid casting problems, fix that when pedestal goes negative we dont
23 //
24 // Revision 1.20 2003/01/21 01:27:44 jeromel
25 // hfile->write(0 while NULL caused spurious crash.
26 // Took the oportunity to add GetCVS()
27 // Some maniaco-compulsive //! alignement fixes ...
28 //
29 // Revision 1.19 2002/09/20 19:35:25 caines
30 // Change building of file name
31 //
32 // Revision 1.18 2002/09/19 16:17:49 caines
33 // Add code to do Juns gain calibration
34 //
35 // Revision 1.17 2002/05/09 16:55:08 munhoz
36 // add reading bad anodes from DB
37 //
38 // Revision 1.16 2002/04/22 14:52:54 caines
39 // Add the .h too
40 //
41 // Revision 1.15 2002/01/11 22:49:22 caines
42 // Fix sequence merging bugs-hopefully
43 //
44 // Revision 1.14 2001/12/13 03:08:17 caines
45 // Can now subtract common mode noise via black anodes 239 and 2
46 //
47 // Revision 1.13 2001/10/19 23:31:34 caines
48 // Correct problem that if anodes were missing didnt do average common mode noise calc
49 //
50 // Revision 1.12 2001/09/26 18:42:48 caines
51 // Fix 2 anode subtraction routines
52 //
53 // Revision 1.11 2001/09/16 22:24:26 caines
54 // Fix for when SVT isnt in every event
55 //
56 // Revision 1.10 2001/08/24 20:57:46 caines
57 // Do common mode noise suppression from first two anodes
58 //
59 // Revision 1.9 2001/07/25 14:47:47 caines
60 // Fix filling histogram only when debug is on
61 //
62 // Revision 1.8 2001/07/22 20:31:29 caines
63 // Better tuning for real data. Common mode noise calc and sub. Avoid overlapping seq. Fill histograms only in debug
64 //
65 // Revision 1.7 2001/05/02 02:07:55 caines
66 // Fix function declaration for Solaris
67 //
68 // Revision 1.6 2001/05/01 00:23:58 caines
69 // Update h files for use with zsp data
70 //
71 // Revision 1.5 2000/11/30 20:45:56 caines
72 // Dynamically calc prob values, use database
73 //
74 // Revision 1.4 2000/08/24 04:23:50 caines
75 // Improved histograms
76 //
77 // Revision 1.3 2000/08/21 12:57:31 caines
78 // Now opens and reads in ped using CalibMaker
79 //
80 // Revision 1.2 2000/07/16 22:32:23 caines
81 // Now also saves RAW data
82 //
83 // Revision 1.1 2000/06/15 20:04:54 caines
84 // Initial versions of sequence adjusting codes
85 //
86 //
87 #ifndef STAR_StSvtSeqAdj
88 #define STAR_StSvtSeqAdj
89 // //
91 // StSvtSeqAdj base class //
92 // //
94 #ifndef StMaker_H
95 #include "StMaker.h"
96 #endif
97 
98 #include <Stiostream.h>
99 #include "Stiostream.h"
100 #include <string>
101 
102 class TH1D;
103 class TH2F;
104 class TFile;
105 class StSequence;
106 class StSvtData;
107 class StSvtHybridData;
109 class StSvtPedSub;
110 class TObjectSet;
112 class StSvtBadAnode;
113 class StSvtProbValues;
114 class StMCTruth;
115 
116 class StSvtSeqAdjMaker : public StMaker
117 {
118  public:
119  StSvtSeqAdjMaker(const char *name = "SvtSeqAdj");
121  ~StSvtSeqAdjMaker();
122 
123  virtual Int_t Init();
124  virtual Int_t InitRun( int runnumber);
125  virtual Int_t Make();
126  virtual Int_t Finish();
127 
128  Int_t SetSvtData();
129  Int_t GetSvtRawData();
130  Int_t GetSvtPedestals();
131  Int_t GetBadAnodes();
132  Int_t GetPedOffset(){return mPedOffSet;};
133  void CommonModeNoiseCalc(int iAnode);
134  void CommonModeNoiseSub(int iAnode);
135  void SubtractFirstAnode(int iAnode);
136  Int_t FindBlackAnodes(); // Find Black anodes on each hybrid
137  Int_t AdjustSequences1( int iAnode, int Anode); // Find sequences based on ASICS
138  Int_t AdjustSequences2(int iAnode, int Anode); //adjust sequences base on LowInvProd
139  Int_t MergeSequences(StSequence* Seq, int nSeq,StMCTruth *Tru=0); // Merge overlapping sequences
140  Int_t CreateHist(Int_t tNuOfHyb);
141  void MakeHistogramsProb(int index,int Anode);
142  void MakeHistogramsAdc(StSvtHybridData* hybridData, int index,int Anode, int Count);
143  Int_t Reset();
144 
145  Int_t SetMinAdcLevels( int MinAdc1, int MinAbove1, int MinAdc2, int MinAbove2, int PedOffset); // Set the 2 thresholds for a sequence
146  Int_t SetPedestalFile(const char* PedFile);
147  Int_t SetLowInvProd(int LowInvProd);// Set the low threshold based on the frequency distribution
148 
149  virtual const char *GetCVS() const {
150  static const char cvs[]="Tag $Name: $ $Id: StSvtSeqAdjMaker.h,v 1.27 2014/08/06 11:43:46 jeromel Exp $ built " __DATE__ " " __TIME__ ;
151  return cvs;
152  }
153 
154  protected:
155  St_ObjectSet* mSvtDataSet;
156  StSvtData* mSvtRawData;
157  StSvtData* mSvtAdjData;
158  StSvtHybridData* mHybridRawData ;
159  StSvtHybridData* mHybridAdjData ;
160 
161  StSvtHybridCollection* mSvtBadAnodes;
162  StSvtHybridCollection* mSvtPedColl;
163 
164  StSvtInverseProducts* mInvProd;
165  StSvtPedSub* mSvtPedSub;
166  StSvtProbValues* mProbValue;
167 
168  const char* mPedFile;
169 
170  int* anolist;
171  TFile *hfile;
172  unsigned long Evt_counts;
173 
174  TH1F* mOcupancyHisto;
175  TH1F* EventOccupancy;
176  TH1D** mInvProdSeqAdj;
177  TH1F** mRawAdc;
178  TH1F** mAdcAfter;
179  TH1F* mCommonModePitch;
180  TH1F* mCommonModeCount;
181  TH2F** mTimeAn;
182  TH1F** mRawPixel;
183  int mNumOfSeq;
184  int m_n_seq_lo;
185  int m_n_seq_hi;
186  int m_thresh_lo;
187  int m_inv_prod_lo;
188  int m_thresh_hi;
189 
190  int mTotalNumberOfHybrids;
191  int mPedOffSet;
192  int mCommonModeNoise[128];
193  int mCommonModeNoiseAn[128];
194  int mNAnodes;
195  int doCommon;
196  int adcCommon[128];
197 
198  private:
199  string buildFileName(string dir, string fileName, string extention);
200  string baseName(string s);
201  ClassDef(StSvtSeqAdjMaker,0) //virtual base class for Makers
202 
203 };
204 
205 
206 #endif
virtual Int_t Make()
virtual Int_t Finish()