40
40
#include "TRandom.h"
41
41
#include "Config/MiceModule.hh"
42
#include "DataStructure/Primary.hh"
42
43
#include "Utils/TOFCalibrationMap.hh"
43
44
#include "API/MapBase.hh"
47
class MapCppTOFMCDigitizer : public MapBase<Json::Value> {
48
/** @brief structure to hold -a temporary digit-
50
typedef struct fTofDig {
51
TOFChannelId* fChannelId;
66
int fTriggerRequestLeadingTime;
71
/** @brief vector storage for -all temporary digits
73
typedef std::vector<fTofDig> TofTmpDigits;
75
class MapCppTOFMCDigitizer : public MapBase<Data> {
49
77
MapCppTOFMCDigitizer();
80
typedef std::vector<TOF0DigitArray*> fDigsArrayPtr;
82
/** @brief birth initialize and read data cards
52
84
void _birth(const std::string& argJsonConfigDocument);
86
/** @brief death does nothing
56
void _process(Json::Value* data) const;
58
Json::Value check_sanity_mc(Json::Value& document) const;
90
/** @brief processes MC TOF hits */
91
void _process(MAUS::Data* data) const;
93
/** @brief digitizes tof hits
94
* finds the tof slab corresponding to the hit
95
* propagates hit to PMTs at either end of slab
96
* digitizes the hit time
97
* the digitized hits are stored in a temporary array
98
* @param TofTmpDigits is the temporary vector storage for all digits
99
* @param the vector is of type struct tmpThisDigit
101
TofTmpDigits make_tof_digits(TOFHitArray* hits,
102
double gentime) const;
104
/** @brief converts energy deposit to photoelectrons
105
* energy deposit is converted to photoelectrons
106
* the npe yield is poisson-smeared
108
* then an efficiency is applied to yield the final npe
60
110
double get_npe(double dist, double edep) const;
62
std::vector<Json::Value> make_tof_digits(Json::Value hits,
64
Json::Value& root) const;
66
std::string findTriggerPixel(std::vector<Json::Value> _alldigits) const;
67
Json::Value fill_tof_evt(int evnum, int snum,
68
std::vector<Json::Value> _alldigits,
112
/** @brief sets the pixel that would have triggered this hit
114
std::string findTriggerPixel(TofTmpDigits& tmpDigits) const;
117
/** @brief checks for multiple hits in the same slab
118
* there is only digit created per slab,
119
* photoelectrons from hits in the same slab are added up
120
* the time of the earliest hit is taken as the slab digit time
122
bool check_param(tmpThisDigit& hit1, tmpThisDigit& hit2) const;
124
/** @brief sets the digit for each tof station
125
* goes through all the temporary digits
126
* weed out multiple hits
127
* set the digit data structure corresponding to the station hit
128
* @param TofTmpDigits contains all the digits
129
* @param fDigsArrayPtr: vector of pointers to TOF0/1/2 digit datastructure
131
void fill_tof_evt(int evnum, int snum,
132
TofTmpDigits& tmpDigits,
133
fDigsArrayPtr& digitArrayPtr,
69
134
std::string strig) const;
71
bool check_param(Json::Value* hit1, Json::Value* hit2) const;
74
137
MiceModule* geo_module;
75
138
std::vector<const MiceModule*> tof_modules;