StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcClusterFinder.hh
1 // $Id: StFtpcClusterFinder.hh,v 1.23 2009/11/25 19:50:15 jcs Exp $
2 //
3 // $Log: StFtpcClusterFinder.hh,v $
4 // Revision 1.23 2009/11/25 19:50:15 jcs
5 // remove all references to StFtpcSoftwareMonitor
6 //
7 // Revision 1.22 2007/01/15 07:49:22 jcs
8 // replace printf, cout and gMesMgr with Logger
9 //
10 // Revision 1.21 2006/03/19 19:29:45 jcs
11 // Move cluster struct definitions to StFtpcClustersStructures.hh
12 // Create DEBUGFILE with bfc option 'fdbg'
13 //
14 // Revision 1.20 2004/06/18 12:04:57 jcs
15 // replace #ifdef...#elif...#endif conditional compiler directives with #ifdef...#endif #ifdef...#endif
16 //
17 // Revision 1.19 2004/06/18 09:04:40 jcs
18 // replace obsolete DEBUGFILE code with code to write out a root file for cluster/laser analysis
19 //
20 // Revision 1.18 2004/05/24 13:37:57 jcs
21 // save number of clusters found in StFtpcSoftwareMonitor
22 //
23 // Revision 1.17 2003/05/07 15:09:49 putschke
24 // improvements for cathode offset corretions
25 //
26 // Revision 1.16 2003/04/15 11:35:51 putschke
27 // Include corrections for inner cathode offset and move some parameter to database
28 //
29 // Revision 1.15 2002/08/02 11:26:41 oldi
30 // Chargestep corrected (it was looping over the sequences twice).
31 //
32 // Revision 1.14 2002/07/15 13:31:01 jcs
33 // incorporate charge step histos into cluster finder and remove StFtpcChargeStep
34 //
35 // Revision 1.13 2002/06/04 12:33:13 putschke
36 // new 2-dimenisional hitfinding algorithm
37 // correct error in padposition numbering
38 //
39 // Revision 1.12 2002/03/01 14:22:20 jcs
40 // add additional histograms to monitor cluster finding
41 //
42 // Revision 1.10 2002/02/10 21:12:32 jcs
43 // add deltaAirPressure to calcpadtrans call
44 //
45 // Revision 1.9 2001/04/02 12:10:16 jcs
46 // get FTPC calibrations,geometry from MySQL database and code parameters
47 // from StarDb/ftpc
48 //
49 // Revision 1.8 2001/03/06 23:33:46 jcs
50 // use database instead of params
51 //
52 // Revision 1.7 2001/01/25 15:25:30 oldi
53 // Fix of several bugs which caused memory leaks:
54 // - Some arrays were not allocated and/or deleted properly.
55 // - TClonesArray seems to have a problem (it could be that I used it in a
56 // wrong way in StFtpcTrackMaker form where Holm cut and pasted it).
57 // I changed all occurences to TObjArray which makes the program slightly
58 // slower but much more save (in terms of memory usage).
59 //
60 // Revision 1.6 2000/08/03 14:39:00 hummler
61 // Create param reader to keep parameter tables away from cluster finder and
62 // fast simulator. StFtpcClusterFinder now knows nothing about tables anymore!
63 //
64 // Revision 1.4 2000/01/27 09:47:18 hummler
65 // implement raw data reader, remove type ambiguities that bothered kcc
66 //
67 // Revision 1.3 2000/01/03 12:48:52 jcs
68 // Add CVS Id strings
69 //
70 
71 #ifndef STAR_StFtpcClusterFinder
72 #define STAR_StFtpcClusterFinder
73 // #define DEBUG 1
74 
75 
76 #include <stdio.h>
77 #include <stdlib.h>
78 #include "TObjArray.h"
79 #include "StDaqLib/GENERIC/EventReader.hh"
80 #include "StDAQMaker/StDAQReader.h"
81 #include "StDAQMaker/StFTPCReader.h"
82 #include "StFtpcParamReader.hh"
83 #include "StFtpcDbReader.hh"
84 #include "TH1.h"
85 #include "TH2.h"
86 
87 #include "StFtpcClusterDebug.hh"
88 
89 #define TRUE 1
90 #define FALSE 0
91 #define sqr(x) ((x)*(x))
92 
93 
95 {
96 
97  private:
98  TPCSequence test;
99  TObjArray *mPoint;
100  StFTPCReader *mReader;
101  StFtpcParamReader *mParam;
102  StFtpcDbReader *mDb;
103  TH1F *mHistoW;
104  TH1F *mHistoE;
105  TH2F *mHisto;
106  TH2F *mhpad, *mhtime;
107 
108  StFtpcClusterDebug *mcldebug;
109 
110  int MAXSEQPEAKS;
111  int MAXPEAKS;
112  int MAXLOOPS;
113  int MAXFASTLOOPS;
114  float UNFOLDLIMIT;
115  float UNFOLDFAILEDLIMIT;
116  int MAXPADLENGTH;
117 
118  int mMinTimeBin;
119  int mMinTimeBinMed;
120  int mMinTimeBinOut;
121 
122  int mMaxPadlength;
123  int mMaxTimelength;
124  int mMaxPadlengthMed;
125  int mMaxTimelengthMed;
126  int mMaxPadlengthOut;
127  int mMaxTimelengthOut;
128 
129  int DeltaTime;
130  int DeltaPad;
131 
132  int iHardRow;
133  int iHardSec;
134 
135  float mOffsetCathodeWest;
136  float mOffsetCathodeEast;
137 
138  float mAngleOffsetWest;
139  float mAngleOffsetEast;
140 
141  float mMinChargeWindow;
142 
143  public:
145  StFtpcParamReader *paramReader,
146  StFtpcDbReader *dbReader,
147  TObjArray *pointarray,
148  TH2F *hpad,
149  TH2F *htime,
150  TH2F *histo,
151  TH1F *histoW,
152  TH1F *histoE);
153 // For cluster and laser run analysis
155  StFtpcParamReader *paramReader,
156  StFtpcDbReader *dbReader,
157  TObjArray *pointarray,
158  TH2F *hpad,
159  TH2F *htime,
160  TH2F *histo,
161  TH1F *histoW,
162  TH1F *histoE,
163  StFtpcClusterDebug *cldebug);
164 
166  Bool_t DebugOn;
167  int search();
168  int findHits(TClusterUC *Cluster, int, int, double*, double*, float *);
169  int fitPoints(TClusterUC*, int, int, double*, double*, TPeak*, int, float*);
170  int padtrans(TPeak*, int, int, double*, double*);
171  float gauss_2d(int, int, float, float, float, float, float);
172  float sigmax(float);
173  float sigmat(float);
174  int calcpadtrans(double*, double*, double);
175  int cucInit(TClusterUC*, int*, int*);
176  TClusterUC *cucAlloc(TClusterUC*, int*, int*);
177  int cucFree(TClusterUC*, int*, int*, TClusterUC*);
178  bool geometryCut(TClusterUC*);
179 };
180 
181 #endif