|
| 1 | +/** |
| 2 | + * @file sbnobj/Common/CRTPMTMatching.hh |
| 3 | + * @brief data product to store CRT PMT Matches |
| 4 | + * @author Anna Heggestuen (aheggest@colostate.edu) and Francesco Poppi ( poppi@bo.infn.it ) |
| 5 | + * @date June 1 2023. |
| 6 | + */ |
| 7 | + |
| 8 | +#ifndef CRTPMTMATCHING_hh_ |
| 9 | +#define CRTPMTMATCHING_hh_ |
| 10 | + |
| 11 | +// C++ includes |
| 12 | +#include <vector> |
| 13 | +#include <limits> |
| 14 | +#include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h" |
| 15 | + |
| 16 | +namespace sbn::crt { |
| 17 | + |
| 18 | + /// Type of match between a TPC object (e.g. PMT flash) and CRT system. |
| 19 | + enum class MatchType { /// perhaps it would be better to define these in icaruscode |
| 20 | + noMatch = 0, ///< No CRT match. |
| 21 | + enTop = 1, ///< Matched with Top CRT hit before optical flash. |
| 22 | + enSide = 2, ///< Matched with Side CRT hit before optical flash. |
| 23 | + enTop_exSide = 3, ///< Matched with one Top CRT hit before the optical flash and matched with one Side CRT hit after the optical flash. |
| 24 | + exTop = 4, ///< Matched with a Top CRT after the optical flash. |
| 25 | + exSide = 5, ///< Matched with a Side CRT after the optical flash. |
| 26 | + enTop_mult = 6, ///< Matched with multiple Top CRT hits before the optical flash. |
| 27 | + enTop_exSide_mult = 7, ///< Matched with multiple Top CRT hits before the optical flash and more then 1 side CRT hits after the optical flash. |
| 28 | + enBottom = 8, ///< Matched with bottom CRT hit before the optical flash. |
| 29 | + exBottom = 10, ///< Matched with Bottom CRT hit after the optical flash. |
| 30 | + enTop_exBottom = 11, ///< Matched with one Top CRT hit before the optical flash and |
| 31 | + enSide_exBottom = 12, ///< Matched with one Side CRT hit before the optical flash and matched with one Bottom CRT hit after the optical flash. |
| 32 | + exTop_enBottom = 13, ///< Matched with one Bottom CRT hit before the optical flash and matched with one Top CRT hit after the optical flash. |
| 33 | + exSide_enBottom = 14, ///< Matched with one Bottom CRT hit before the optical flash and matched with one Side CRT hit after the optical flash. |
| 34 | + others = 9 ///< All the other cases. |
| 35 | + }; |
| 36 | + /// Information about a CRT hit matched with a PMT flash. |
| 37 | + struct MatchedCRT { |
| 38 | + |
| 39 | + /// Special value to indicate the lack of information on a time. |
| 40 | + static constexpr double NoTime = std::numeric_limits<double>::lowest(); |
| 41 | + |
| 42 | + /// Special value to indicate no information on the hit location. |
| 43 | + static constexpr int NoLocation = -1; |
| 44 | + |
| 45 | + geo::Point_t position; ///< Hit location [cm] |
| 46 | + double PMTTimeDiff; //= NoTime; < CRT hit time minus PMT flash time [us] (instead maybe wanna set NoTime vars in |
| 47 | + double time;// = NoTime; ///< CRT hit time [us] |
| 48 | + int sys; // = NoLocation; ///< CRT subdetector the hit fell into. |
| 49 | + int region;// = NoLocation; ///< Region the matched CRT hit fell into. |
| 50 | + }; |
| 51 | + |
| 52 | + struct CRTPMTMatching{ |
| 53 | + /// Special value to indicate the lack of information on an ID. |
| 54 | + static constexpr int NoID = std::numeric_limits<int>::min(); |
| 55 | + |
| 56 | + /// Special value to indicate the lack of information on a counter. |
| 57 | + static constexpr unsigned int NoCount |
| 58 | + = std::numeric_limits<unsigned int>::max(); |
| 59 | + |
| 60 | + /// Special value to indicate the lack of information on a time. |
| 61 | + static constexpr double NoTime = std::numeric_limits<double>::lowest(); |
| 62 | + |
| 63 | + /// Special value to indicate the lack of information on flash photoelectrons. |
| 64 | + static constexpr double NoPE = -1.0; |
| 65 | + |
| 66 | + /// Special value to indicate the lack of information on flash width. |
| 67 | + static constexpr double NoWidth = -1.0; |
| 68 | + |
| 69 | + |
| 70 | + int flashID;// = NoID; ///< ID of the optical flash. |
| 71 | + double flashTime;// = NoTime; ///< Time of the optical flash w.r.t. the global trigger [us] |
| 72 | + double flashGateTime;// = NoTime; ///< Time of the optical flash w.r.t. the beam gate opening [us] |
| 73 | + double firstOpHitPeakTime;// = NoTime; ///< Time of the first optical hit peak time w.r.t. the global trigger [us] |
| 74 | + double firstOpHitStartTime;// = NoTime; ///< Time of the first optical hit start time w.r.t. the global trigger [us] |
| 75 | + bool flashInGate;// = false; ///< Flash within gate or not. |
| 76 | + bool flashInBeam ;// = false; ///< Flash within the beam window of the gate or not. |
| 77 | + double flashPE;// = -1.0; ///< Total reconstructed light in the flash [photoelectrons] |
| 78 | + geo::Point_t flashPosition; ///< Flash barycenter coordinates evaluated using ADCs as weights. |
| 79 | + double flashYWidth;// = NoWidth; ///< Flash spread along Y. |
| 80 | + double flashZWidth;// = NoWidth; ///< Flash spread along Z. |
| 81 | + MatchType flashClassification;// = MatchType::noMatch; ///< Classification of the optical flash. |
| 82 | + std::vector<MatchedCRT> matchedCRTHits; ///< Matched CRT Hits with the optical flash. |
| 83 | + unsigned int nTopCRTHitsBefore = NoCount; ///< Number of Top CRT Hits before the optical flash. |
| 84 | + unsigned int nTopCRTHitsAfter = NoCount; ///< Number of Top CRT Hits after the optical flash. |
| 85 | + unsigned int nSideCRTHitsBefore = NoCount; ///< Number of Side CRT Hits before the optical flash. |
| 86 | + unsigned int nSideCRTHitsAfter = NoCount; ///< Number of Side CRT Hits after the optical flash. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + /// Returns whether the information in this record is in any way valid. |
| 91 | + bool isValid() const { return flashID != NoID; } |
| 92 | + |
| 93 | + }; |
| 94 | + |
| 95 | + /// Additional information about the matching of one flash and one CRT hit. |
| 96 | + /// |
| 97 | + /// Intended as association metadata. |
| 98 | + struct CRTPMTMatchingInfo { |
| 99 | + |
| 100 | + enum class Dir { unknown, entering, exiting }; |
| 101 | + |
| 102 | + /// Special value to indicate the lack of information on a time. |
| 103 | + static constexpr double NoTime = std::numeric_limits<double>::lowest(); |
| 104 | + |
| 105 | + /// Whether CRT hit describes a particle entering the detector of exiting. |
| 106 | + Dir direction = Dir::unknown; |
| 107 | + double timeOfFlight = NoTime; ///< CRT hit time minus PMT flash time [us] |
| 108 | + double distance; ///< Distance between CRT Hit and optical flash centroid [cm] |
| 109 | + |
| 110 | + }; // CRTPMTMatchingInfo |
| 111 | + |
| 112 | + |
| 113 | +} // namespace sbn::crt |
| 114 | + |
| 115 | + |
| 116 | +#endif |
0 commit comments