Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBCALTDCHit_factory.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DBCALTDCHit_factory.h
4 // Created: Tue Aug 6 11:04:11 EDT 2013
5 // Creator: davidl (on Darwin harriet.jlab.org 11.4.2 i386)
6 //
7 
8 #ifndef _DBCALTDCHit_factory_
9 #define _DBCALTDCHit_factory_
10 
11 #include <JANA/JFactory.h>
12 #include "TTAB/DTTabUtilities.h"
13 #include "DBCALTDCHit.h"
14 
15 // store up/down-stream values for each detector cell
16 typedef pair<double,double> cell_calib_t;
17 typedef vector<cell_calib_t> bcal_digi_constants_t;
18 
19 class DBCALTDCHit_factory:public jana::JFactory<DBCALTDCHit>{
20  public:
23 
24  // shortcut geometry factors
25  // these should really be taken from
26  // DBCALGeometry/DGeometry objects
27  static const int BCAL_NUM_MODULES = 48;
28  static const int BCAL_NUM_TDC_LAYERS = 3;
29  static const int BCAL_NUM_LAYERS = 4;
30  static const int BCAL_NUM_SECTORS = 4;
31  static const int BCAL_MAX_TDC_CHANNELS = 1152;
32  static const int BCAL_MAX_CHANNELS = 1536;
33 
34  // overall scale factors
35  double t_scale;
36  double t_base;
38 
42 
43  const int GetCalibIndex( int module, int layer, int sector ) const {
44  return BCAL_NUM_TDC_LAYERS*BCAL_NUM_SECTORS*(module-1) + BCAL_NUM_SECTORS*(layer-1) + (sector-1);
45  }
46 
47  const double GetConstant( const bcal_digi_constants_t &the_table,
48  const int in_module, const int in_layer,
49  const int in_sector, const int in_end) const;
50  const double GetConstant( const bcal_digi_constants_t &the_table,
51  const DBCALTDCDigiHit *the_digihit) const;
52  const double GetConstant( const bcal_digi_constants_t &the_table,
53  const DBCALTDCHit *the_hit) const;
54  //const double GetConstant( const bcal_digi_constants_t &the_table,
55  // const DTranslationTable *ttab,
56  // const int in_rocid, const int in_slot, const int in_channel) const;
57 
58 
59  private:
60  jerror_t init(void); ///< Called once at program start.
61  jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
62  jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber); ///< Called every event.
63  jerror_t erun(void); ///< Called everytime run number changes, provided brun has been called.
64  jerror_t fini(void); ///< Called after last event of last event source has been processed.
65 
67  const vector<double> &raw_table);
69  const vector<double> &raw_table);
70 };
71 
72 #endif // _DBCALTDCHit_factory_
73 
static const int BCAL_MAX_TDC_CHANNELS
Int_t layer
jerror_t init(void)
Called once at program start.
static const int BCAL_MAX_CHANNELS
void FillCalibTable(bcal_digi_constants_t &table, const vector< double > &raw_table)
void FillCalibTableShort(bcal_digi_constants_t &table, const vector< double > &raw_table)
bcal_digi_constants_t time_offsets
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
bcal_digi_constants_t tdiff_u_d
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
bcal_digi_constants_t channel_global_offset
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
pair< double, double > cell_calib_t
const int GetCalibIndex(int module, int layer, int sector) const
static const int BCAL_NUM_SECTORS
const double GetConstant(const bcal_digi_constants_t &the_table, const int in_module, const int in_layer, const int in_sector, const int in_end) const
vector< cell_calib_t > bcal_digi_constants_t
static const int BCAL_NUM_MODULES
jerror_t fini(void)
Called after last event of last event source has been processed.
static const int BCAL_NUM_LAYERS
static const int BCAL_NUM_TDC_LAYERS