~ajdobbs/maus/event-viewer

« back to all changes in this revision

Viewing changes to src/map/MapCppTOFMCDigitizer/MapCppTOFMCDigitizer.hh

  • Committer: Ao Liu
  • Date: 2015-09-01 03:14:59 UTC
  • mfrom: (910.1.8 trunk)
  • mto: (910.1.11 trunk)
  • mto: This revision was merged to the branch mainline in revision 921.
  • Revision ID: aoliu@fnal.gov-20150901031459-i0stzz3bzo7b06zh
CkovMCDigitizer with the MAUS::Data and better handling of the hits

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
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"
44
45
 
45
46
namespace MAUS {
46
47
 
47
 
class MapCppTOFMCDigitizer : public MapBase<Json::Value> {
 
48
/** @brief structure to hold -a temporary digit-
 
49
 */
 
50
typedef struct fTofDig {
 
51
    TOFChannelId* fChannelId;
 
52
    int fStation;
 
53
    int fPlane;
 
54
    int fSlab;
 
55
    int fPmt;
 
56
    double fTime;
 
57
    ThreeVector fMom;
 
58
    Hep3Vector fPos;
 
59
    double fEdep;
 
60
    bool fIsUsed;
 
61
    double fNpe;
 
62
    std::string fTofKey;
 
63
    int fLeadingTime;
 
64
    int fTrailingTime;
 
65
    double fRawTime;
 
66
    int fTriggerRequestLeadingTime;
 
67
    int fTriggerTimeTag;
 
68
    int fTimeStamp;
 
69
} tmpThisDigit;
 
70
 
 
71
/** @brief vector storage for -all temporary digits
 
72
 */
 
73
typedef std::vector<fTofDig> TofTmpDigits;
 
74
 
 
75
class MapCppTOFMCDigitizer : public MapBase<Data> {
48
76
 public:
49
77
  MapCppTOFMCDigitizer();
50
78
 
51
79
 private:
 
80
  typedef std::vector<TOF0DigitArray*> fDigsArrayPtr;
 
81
 
 
82
  /** @brief birth initialize and read data cards
 
83
   */
52
84
  void _birth(const std::string& argJsonConfigDocument);
53
85
 
 
86
  /** @brief death does nothing
 
87
   */
54
88
  void _death();
55
89
 
56
 
  void _process(Json::Value* data) const;
57
 
 
58
 
  Json::Value check_sanity_mc(Json::Value& document) const;
59
 
 
 
90
  /** @brief processes MC TOF hits */
 
91
  void _process(MAUS::Data* data) const;
 
92
 
 
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 
 
100
   */
 
101
  TofTmpDigits make_tof_digits(TOFHitArray* hits,
 
102
                               double gentime) const;
 
103
 
 
104
  /** @brief converts energy deposit to photoelectrons
 
105
   * energy deposit is converted to photoelectrons
 
106
   * the npe yield is poisson-smeared
 
107
   * then attenuated
 
108
   * then an efficiency is applied to yield the final npe
 
109
   */
60
110
  double get_npe(double dist, double edep) const;
61
111
 
62
 
  std::vector<Json::Value> make_tof_digits(Json::Value hits,
63
 
                                           double gentime,
64
 
                                           Json::Value& root) const;
65
 
 
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
 
113
   */
 
114
  std::string findTriggerPixel(TofTmpDigits& tmpDigits) const;
 
115
 
 
116
 
 
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
 
121
   */
 
122
  bool check_param(tmpThisDigit& hit1, tmpThisDigit& hit2) const;
 
123
 
 
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
 
130
   */
 
131
  void fill_tof_evt(int evnum, int snum,
 
132
                           TofTmpDigits& tmpDigits,
 
133
                           fDigsArrayPtr& digitArrayPtr,
69
134
                           std::string strig) const;
70
135
 
71
 
  bool check_param(Json::Value* hit1, Json::Value* hit2) const;
72
 
 
73
136
 private:
74
137
  MiceModule* geo_module;
75
138
  std::vector<const MiceModule*> tof_modules;
77
140
  Json::Value _configJSON;
78
141
 
79
142
  TOFCalibrationMap _map;
80
 
  std::map<int, std::string> _triggerhit_pixels;
81
 
 
82
 
  std::vector<std::string> _stationKeys;
83
143
 
84
144
  bool fDebug;
85
145
};