Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DFDCPseudo_factory.h
Go to the documentation of this file.
1 //******************************************************************
2 // DFDCPseudo_factory.h: class definition for a factory creating
3 // pseudopoints from anode hits and cathode clusters.
4 // Author: Craig Bookwalter
5 // Date: Apr 2006
6 // Several revisions made by Simon Taylor, Fall 2006
7 //******************************************************************
8 #ifndef DFACTORY_DFDCPSEUDO_H
9 #define DFACTORY_DFDCPSEUDO_H
10 
11 #include <JANA/JFactory.h>
12 #include <JANA/JObject.h>
13 #include <JANA/JException.h>
14 #include <JANA/JStreamLog.h>
15 using namespace jana;
16 
17 #include "DFDCPseudo.h"
18 #include "DFDCCathodeCluster.h"
19 #include "DFDCHit.h"
20 #include "DFDCGeometry.h"
21 #include "HDGEOMETRY/DGeometry.h"
22 #include <TRACKING/DMCTrackHit.h>
23 
24 #include <DMatrix.h>
25 #include <DMatrixSIMD.h>
26 #include <TDecompLU.h>
27 #include <TH2.h>
28 #include <TH1.h>
29 
30 #include <algorithm>
31 #include <map>
32 #include <cmath>
33 
34 ///
35 /// class DFDCPseudo_factory: definition for a JFactory that
36 /// produces pseudopoints from anode hits and DFDCCathodeClusters.
37 /// For now, it is purely geometry-based.
38 ///
39 class DFDCPseudo_factory : public JFactory<DFDCPseudo> {
40  public:
41 
42  ///
43  /// DFDCPseudo_factory::DFDCPseudo_factory():
44  /// default constructor -- initializes log file
45  ///
47 
48  ///
49  /// DFDCPseudo_factory::~DFDCPseudo_factory():
50  /// default destructor -- closes log file
51  ///
53 
54 
55  protected:
56  ///
57  /// DFDCPseudo_factory::evnt():
58  /// this is the place that anode hits and DFDCCathodeClusters
59  /// are organized into pseudopoints.
60  /// For now, this is done purely by geometry, with no drift
61  /// information. See also
62  /// DFDCPseudo_factory::makePseudo().
63  ///
64  jerror_t init(void);
65  jerror_t evnt(JEventLoop *eventLoop, uint64_t eventNo);
66  jerror_t brun(JEventLoop *loop, int32_t runnumber);
67  jerror_t erun(void);
68 
69  ///
70  /// DFDCPseudo_factory::makePseudo():
71  /// performs UV+X matching to create pseudopoints
72  ///
73  void makePseudo( vector<const DFDCHit*>& x,
74  vector<const DFDCCathodeCluster*>& u,
75  vector<const DFDCCathodeCluster*>& v,
76  int layer,
77  vector<const DMCTrackHit*> &mctrackhits);
78 
79  ///
80  /// DFDCPseudo_factory::CalcMeanTime()
81  /// Calculates mean and RMS time for a cluster of cathode hits
82  ///
83  void CalcMeanTime(const vector<const DFDCHit*>& H, double &t, double &t_rms);
84  void CalcMeanTime(vector<const DFDCHit *>::const_iterator peak, double &t, double &t_rms);
85 
86  ///
87  /// DFDCPseudo_factory::FindCentroid()
88  /// Calculates the centroids of groups of three adjacent strips
89  /// containing a peak.
90  ///
91  jerror_t FindCentroid(const vector<const DFDCHit*>& H,
92  vector<const DFDCHit *>::const_iterator peak,
93  vector<centroid_t> &centroids);
94  // Backtracking routine needed by FindCentroid
95  jerror_t FindNewParmVec(const DMatrix3x1 &N,const DMatrix3x1 &X,
96  const DMatrix3x1 &F,const DMatrix3x3 &J,
97  const DMatrix3x1 &par,
98  DMatrix3x1 &newpar);
99 
100  ///
101  /// DFDCPseudo_factory::TwoStripCluster()
102  /// Calculates the center-of-gravity of two adjacent strips
103  ///
104  jerror_t TwoStripCluster(const vector<const DFDCHit*>& H,
105  vector<const DFDCHit *>::const_iterator peak,
106  vector<centroid_t> &centroids);
107 
108  ///
109  /// DFDCPseudo_factory::ThreeStripCluster()
110  /// Calculates the center-of-gravity of Three adjacent strips
111  ///
112  jerror_t ThreeStripCluster(const vector<const DFDCHit*>& H,
113  vector<const DFDCHit *>::const_iterator peak,
114  vector<centroid_t> &centroids);
115 
116 
117  private:
118  vector<vector<DFDCWire*> >fdcwires;
119  vector<vector<DFDCCathode*> >fdccathodes;
120  vector<double>xshifts;
121  vector<double>yshifts;
122 
123  double dX[4],dY[4];
124 
125  double ROUT_FIDUCIAL,RIN_FIDUCIAL;
126  double r2_out,r2_in;
128  unsigned int MAX_ALLOWED_FDC_HITS;
129 // bool DEBUG_HISTS,USE_FDC,MATCH_TRUTH_HITS;
130  bool DEBUG_HISTS,USE_FDC;
132  double FDC_RES_PAR1,FDC_RES_PAR2;
134  double DELTA_X_CUT;
135 
136  TH2F *qv_vs_qu, *dtv_vs_dtu;
137  TH2F *uv_dt_vs_u,*uv_dt_vs_v,*v_wire_dt_vs_wire;
138  TH2F *tv_vs_tu,*u_wire_dt_vs_wire;
139  TH2F *Hxy[24],*ut_vs_u,*vt_vs_v;
140  TH2F *v_vs_u,*dx_vs_dE;
141  TH1F *u_cl_size, *v_cl_size, *u_cl_n, *v_cl_n, *x_dist_2, *x_dist_3, *x_dist_23, *x_dist_33;
142  TH1F *d_uv;
143 
144 // JStreamLog* _log;
145 };
146 
147 #endif // DFACTORY_DFDCPSEUDO_H
148 
#define F(x, y, z)
vector< double > yshifts
unsigned int MAX_ALLOWED_FDC_HITS
Int_t layer
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
#define X(str)
Definition: hddm-c.cpp:83
#define H(x, y, z)
vector< vector< DFDCCathode * > > fdccathodes
class DFDCPseudo_factory: definition for a JFactory that produces pseudopoints from anode hits and DF...
vector< double > xshifts
vector< vector< DFDCWire * > > fdcwires
union @6::@8 u