Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DPSCHit_factory.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DPSCHit_factory.h
4 // Created: Wed Oct 15 16:45:33 EDT 2014
5 // Creator: staylor (on Linux gluon05.jlab.org 2.6.32-358.18.1.el6.x86_64 x86_64)
6 //
7 
8 #ifndef _DPSCHit_factory_
9 #define _DPSCHit_factory_
10 
11 #include <vector>
12 #include <utility>
13 
14 #include <JANA/JFactory.h>
15 #include "TTAB/DTTabUtilities.h"
16 
17 #include "DPSCHit.h"
18 #include "DPSCDigiHit.h"
19 #include "DPSCTDCDigiHit.h"
20 #include "DPSGeometry.h"
21 
22 typedef vector< pair<double,double> > psc_digi_constants_t;
23 
24 class DPSCHit_factory:public jana::JFactory<DPSCHit>{
25  public:
28 
29  // config. parameters
30  double DELTA_T_ADC_TDC_MAX;
31  double ADC_THRESHOLD;
32 
33  // overall scale factors
34  double a_scale;
35  double t_scale;
36  double t_base;
37  double t_tdc_base;
38 
39  // timewalk parameters per module
40  vector<vector<double> > tw_parameters;
41  double c0;
42  double c1;
43  double c2;
44  double thresh;
45  double P_0;
46 
47  // calibration constants stored by channel
52 
53  const DPSGeometry::Arm GetArm(const int counter_id,const int num_counters_per_arm) const;
54  const int GetModule(const int counter_id,const int num_counters_per_arm) const;
55  DPSCHit* FindMatch(DPSGeometry::Arm arm, int module, double T);
56 
57  const double GetConstant( const psc_digi_constants_t &the_table,
58  const DPSGeometry::Arm in_arm, const int in_module,
59  const DPSGeometry &psGeom ) const;
60  const double GetConstant( const psc_digi_constants_t &the_table,
61  const DPSCDigiHit *the_digihit, const DPSGeometry &psGeom ) const;
62  const double GetConstant( const psc_digi_constants_t &the_table,
63  const DPSCTDCDigiHit *the_hit, const DPSGeometry &psGeom ) const;
64  const double GetConstant( const psc_digi_constants_t &the_table,
65  const DPSCHit *the_hit, const DPSGeometry &psGeom ) const;
66 
67  private:
68  jerror_t init(void); ///< Called once at program start.
69  jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
70  jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber); ///< Called every event.
71  jerror_t erun(void); ///< Called everytime run number changes, provided brun has been called.
72  jerror_t fini(void); ///< Called after last event of last event source has been processed.
73 
74  void FillCalibTable(psc_digi_constants_t &table, vector<double> &raw_table,
75  const DPSGeometry &tofGeom);
76 
78 };
79 
80 #endif // _DPSCHit_factory_
81 
vector< pair< double, double > > psc_digi_constants_t
jerror_t init(void)
Called once at program start.
double DELTA_T_ADC_TDC_MAX
const int GetModule(const int counter_id, const int num_counters_per_arm) const
psc_digi_constants_t adc_pedestals
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
void FillCalibTable(psc_digi_constants_t &table, vector< double > &raw_table, const DPSGeometry &tofGeom)
psc_digi_constants_t tdc_time_offsets
const DPSGeometry::Arm GetArm(const int counter_id, const int num_counters_per_arm) const
jerror_t fini(void)
Called after last event of last event source has been processed.
DPSCHit * FindMatch(DPSGeometry::Arm arm, int module, double T)
psc_digi_constants_t adc_time_offsets
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
psc_digi_constants_t adc_gains
vector< vector< double > > tw_parameters
const double GetConstant(const psc_digi_constants_t &the_table, const DPSGeometry::Arm in_arm, const int in_module, const DPSGeometry &psGeom) const