Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DCDCHit_factory_Calib.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DCDCHit_factory_Calib.h
4 // Created: Fri Mar 9 16:57:04 EST 2018
5 // Creator: B. Zihlmann derived/copyed from DCDCHit_factory.h
6 //
7 
8 #ifndef _DCDCHit_factory_Calib_
9 #define _DCDCHit_factory_Calib_
10 
11 #include <vector>
12 using namespace std;
13 
14 #include <JANA/JFactory.h>
15 #include <HDGEOMETRY/DGeometry.h>
16 #include <TTAB/DTranslationTable.h>
17 #include <DAQ/Df125PulseIntegral.h>
18 #include <DAQ/Df125Config.h>
19 #include <DAQ/Df125CDCPulse.h>
20 
21 #include "DCDCHit.h"
22 #include "DCDCDigiHit.h"
23 #include "DCDCWire.h"
24 
25 // store constants indexed by ring/straw number
26 typedef vector< vector<double> > cdc_digi_constants_t;
27 
28 class DCDCHit_factory_Calib:public jana::JFactory<DCDCHit>{
29  public:
32  const char* Tag(void){return "Calib";}
33 
34  // overall scale factors.
35  double a_scale, amp_a_scale;
36  double t_scale;
37  double t_base;
38 
39  // calibration constant tables
43 
44  const double GetConstant(const cdc_digi_constants_t &the_table,
45  const int in_ring, const int in_straw) const;
46  const double GetConstant(const cdc_digi_constants_t &the_table,
47  const DCDCDigiHit *the_digihit) const;
48  const double GetConstant(const cdc_digi_constants_t &the_table,
49  const DCDCHit *the_hit) const;
50  //const double GetConstant(const cdc_digi_constants_t &the_table,
51  // const DTranslationTable *ttab,
52  // const int in_rocid, const int in_slot, const int in_channel) const;
53 
54  private:
55  jerror_t init(void); ///< Called once at program start.
56  jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
57  jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber); ///< Called every event.
58  jerror_t erun(void); ///< Called everytime run number changes, provided brun has been called.
59  jerror_t fini(void); ///< Called after last event of last event source has been processed.
60 
61  void CalcNstraws(jana::JEventLoop *eventLoop, int32_t runnumber, vector<unsigned int> &Nstraws);
62  void FillCalibTable(vector< vector<double> > &table, vector<double> &raw_table,
63  vector<unsigned int> &Nstraws);
64 
65  // Geometry information
66  unsigned int maxChannels;
67  unsigned int Nrings; // number of rings (layers)
68  vector<unsigned int> Nstraws; // number of straws for each ring
69 
70 };
71 
72 #endif // _DCDCHit_factory_Calib_
73 
cdc_digi_constants_t time_offsets
vector< unsigned int > Nstraws
cdc_digi_constants_t pedestals
vector< vector< double > > cdc_digi_constants_t
cdc_digi_constants_t gains