Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBCALShower_factory_KLOE.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DBCALShower_factory_KLOE.h
4 // Created: Tue Jul 3 18:25:12 EDT 2007
5 // Creator: Matthew Shepherd
6 //
7 
8 
9 #ifndef _DBCALShower_factory_KLOE_
10 #define _DBCALShower_factory_KLOE_
11 
12 #include <JANA/JFactory.h>
13 #include <JANA/JEventLoop.h>
14 using namespace jana;
15 
16 #include <BCAL/DBCALShower.h>
17 #include <BCAL/DBCALPoint.h>
18 #include <BCAL/DBCALGeometry.h>
19 
20 /// Form fully reconstructed showers from BCAL data based on the KLOE algorithm.
21 /// The showers produced by this do have calibration applied to correct the
22 /// output energy based on cluster energy and z-location. This used DBCALHit objects
23 /// as input. All clustering, merging etc. are done here as described in
24 /// <A href="http://argus.phys.uregina.ca/cgi-bin/private/DocDB/ShowDocument?docid=569">GlueX-doc-569</A>
25 ///
26 /// Author's Note: This class started as a functional clone of the default DBCALShower_factory_KLOE --
27 /// much of the logic and data structure is as written by C. Xu.
28 /// Revisions were made to get approx 10x speed gain. The intial version in the repository
29 /// It has undergone subsequent reision and as of 8-Aug-08 merged back in as the default
30 /// DBCALShower_factory_KLOE
31 ///
32 
33 class DBCALShower_factory_KLOE:public JFactory<DBCALShower>{
34 
35 public:
36 
39 
40  const char* Tag(void){return "KLOE";}
41 
42 private:
43  jerror_t init();
44  jerror_t brun(JEventLoop *loop, int32_t runnumber);
45  jerror_t evnt(JEventLoop *loop, uint64_t eventnumber); ///< Invoked via JEventProcessor virtual method
46 
47  void FindPointsInShower(int indx, JEventLoop *loop, vector<const DBCALPoint*> &pointsInShower);
48  void CellRecon(JEventLoop *loop);
49  void CeleToArray(void);
50  void PreCluster(JEventLoop *loop);
51  void Connect(int,int);
52  void ClusNorm(void);
53  void ClusAnalysis();
54  void Clus_Break(int nclust);
55 
56  void clsLoop();
57  // The following functions are for track fitting (using layer by layer
58  // method)
59 
60  void Trakfit(void);
61  void Fit_ls();
62  void Linefit(int ixyz,int mwt,float &a, float &b,float &siga,
63  float &sigb,float &chi2,float &q);
64  float Gammq(float a,float x);
65  void Gser(float &gamser,float a,float x);
66  void Gcf(float &gammcf,float a,float x);
67  float Gammln(float xx_gln);
68 
70 
71 #undef layermax_bcal
72 
73 #define modulemax_bcal 48
74 #define layermax_bcal 10
75 #define colmax_bcal 4
76 #define cellmax_bcal modulemax_bcal*layermax_bcal*colmax_bcal
77 #define clsmax_bcal modulemax_bcal*layermax_bcal*colmax_bcal
78 
79  // the following data member are used bu function CellRecon()
80 
81  // The quantities like ecel_a,ecel_b,tcel_a,tcel_b,xcel,ycel,zcel,
82  // ecel,tcel are quantities in event.inc in Kloe's code which was
83  // kept in common blocks for reconstuection function to "mess up".
84  // Now in our case we put them as a private members of class
85 
90 
91  //xx and yy are x and y positions of center of readout cells
94 
95  float fiberLength;
96  float zOffset;
97 
105  // The above data members are used by function CellRecon()
106 
107 
108  // The following data are used by function CeleToArray();
109  float ethr_cell;// MIN ENERGY THRESD OF cel in GeV
110  int celtot; //----- TOTAL NUMBER OF CELLS with readout --
111  //-------------------------------------------------------------------
112  // ARRAY NARR stores the module, layer, and col number of cells
113  // NARR = Integer data for each cell where :
114  // 1 = Module number
115  // 2 = Layer number
116  // 3 = Col number
117  //--------------------------------------------------------------------
118  int narr[4][cellmax_bcal+1];
119  int nclus[cellmax_bcal+1];
120  int next[cellmax_bcal+1];
121  float e_cel[cellmax_bcal+1];
122  float x_cel[cellmax_bcal+1];
123  float y_cel[cellmax_bcal+1];
124  float z_cel[cellmax_bcal+1];
125  float t_cel[cellmax_bcal+1];
126  float ta_cel[cellmax_bcal+1];
127  float tb_cel[cellmax_bcal+1];
128  //-------------------------------------------------------------------
129  // ARRAY CELDATA stores adc and tdc values of cells
130  // CELDATA = data for each cell where :
131  // 1 = ADC Energy in side A
132  // 2 = ADC Energy in side B
133  // 3 = Time of Arrival in side A
134  // 4 = Time of Arrival in side B
135  //--------------------------------------------------------------------
136  float celdata[4][cellmax_bcal+1];
137  // The above data are used by function CeleToArray();
138 
139  // The following data are used by function ClusNorm() and also fitting
140 
141  int clstot; //----- TOTAL NUMBER OF CLUSTERS --
142 
143  float e_cls[clsmax_bcal+1]; //----- TOTAL ENERGY OF CLUSTER -
144  float x_cls[clsmax_bcal+1]; //----- X CENTROID OF CLUSTER -
145  float y_cls[clsmax_bcal+1]; //----- Y CENTROID OF CLUSTER -
146  float z_cls[clsmax_bcal+1]; //----- Z CENTROID OF CLUSTER -
147  float t_cls[clsmax_bcal+1]; //---- <T> OF CLUSTER -
148  float ea_cls[clsmax_bcal+1]; //---- E SUM OF SIDE A OF CLUSTER -
149  float eb_cls[clsmax_bcal+1]; //---- E SUM OF SIDE B OF CLUSTER -
150 
151  float ta_cls[clsmax_bcal+1]; //--- <T> OF SIDE A OF CLUSTER -
152  float tb_cls[clsmax_bcal+1]; //--- <T> OF SIDE B OF CLUSTER -
153  float tsqr_a[clsmax_bcal+1]; //--- <T^2> OF SIDE A OF CLUSTER -
154  float tsqr_b[clsmax_bcal+1]; //--- <T^2> OF SIDE B OF CLUSTER -
155  float trms_a[clsmax_bcal+1]; //--- T RMS OF SIDE A OF CLUSTER -
156  float trms_b[clsmax_bcal+1]; //--- T RMS OF SIDE B OF CLUSTER -
157 
158  float e2_a[clsmax_bcal+1]; //--<E^2> OF SIDE A OF CLUSTER -
159  float e2_b[clsmax_bcal+1]; //--<E^2> OF SIDE B OF CLUSTER -
160 
161  int clspoi[clsmax_bcal+1]; //---POINTER TO FIRST CELL OF CLUSTER CHAIN
162  int ncltot[clsmax_bcal+1]; //---- TOTAL NUMBER OF CELLS INCLUSTER -
163  int ntopol[clsmax_bcal+1];
164 
165 
166  // ********************for fitting****************************************
167  int nlrtot[clsmax_bcal+1]; //----total layers of the cluster
168 
169  int elyr;
170  int xlyr;
171  int ylyr;
172  int zlyr;
173  int tlyr;
174 
175  // increase range of last index to match DBCALShower_factory_KLOE:1130
176  //float clslyr[6][layermax_bcal+1][clsmax_bcal];
177  float clslyr[6][layermax_bcal+1][clsmax_bcal+1];
178 
179  float apx[4][clsmax_bcal+1];
180  float eapx[4][clsmax_bcal+1];
181  float ctrk[4][clsmax_bcal+1];
182  float ectrk[4][clsmax_bcal+1];
183 
184  float ctrk_ix[4];
185  float ectrk_ix[4];
186  float apx_ix[4];
187  float eapx_ix[4];
188 
189  float x[layermax_bcal+1];
190  float y[layermax_bcal+1];
191  float z[layermax_bcal+1];
192  float e[layermax_bcal+1];
193 
194  //this is (center_radius-BCAL_inner_radius) of the n'th layer
195  float rt[layermax_bcal+1];
196 
197  float sigx[layermax_bcal+1]; // cm
198  float sigy[layermax_bcal+1]; // cm
199  float sigz[layermax_bcal+1]; // cm
200 
201  // some thresholds
202 
203  float MERGE_THRESH_DIST; // CENTROID DISTANCE THRESHOLD
204  float MERGE_THRESH_TIME; // CENTROID TIME THRESHOLD
205  float MERGE_THRESH_ZDIST; // FIBER DISTANCE THRESHOLD
206  float MERGE_THRESH_XYDIST; // CENTROID TRANSVERSE DISTANCE THRESHOLD
207  float BREAK_THRESH_TRMS; // T RMS THRESHOLD
208  float CLUST_THRESH; // MIN ENERGY THRESD OF CLUSTER IN GEV
209  float ATTEN_LENGTH; // Attenuation lenth and other parameters
210  float C_EFFECTIVE; // Effective v of light in scintillator
211 
212  // energy calibration parameters
213  float m_scaleZ_p0;
214  float m_scaleZ_p1;
215  float m_scaleZ_p2;
216  float m_scaleZ_p3;
217 
222 
224 };
225 
226 #endif // _DBCALShower_factory_KLOE_
227 
Form fully reconstructed showers from BCAL data based on the KLOE algorithm. The showers produced by ...
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
#define y
#define layermax_bcal
const DBCALGeometry * bcalGeom
TEllipse * e
#define colmax_bcal
#define clsmax_bcal
#define cellmax_bcal
#define modulemax_bcal