File indexing completed on 2024-04-06 12:29:47
0001 #ifndef SimG4CMS_CaloGVHit_h
0002 #define SimG4CMS_CaloGVHit_h 1
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include "SimG4CMS/Calo/interface/CaloHitID.h"
0026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0027 #include "DataFormats/Math/interface/Point3D.h"
0028 #include <iostream>
0029
0030 class CaloGVHit {
0031 public:
0032 CaloGVHit();
0033 ~CaloGVHit();
0034 CaloGVHit(const CaloGVHit& right);
0035 const CaloGVHit& operator=(const CaloGVHit& right);
0036 bool operator==(const CaloGVHit&) { return false; }
0037
0038 public:
0039 inline double getEM() const { return elem_; }
0040 inline void setEM(double e) { elem_ = e; }
0041
0042 inline double getHadr() const { return hadr_; }
0043 inline void setHadr(double e) { hadr_ = e; }
0044
0045 inline int getEventID() const { return eventID_; }
0046 inline void setEventID(int id) { eventID_ = id; }
0047
0048 inline int getTrackID() const { return hitID_.trackID(); }
0049 inline uint32_t getUnitID() const { return hitID_.unitID(); }
0050 inline double getTimeSlice() const { return hitID_.timeSlice(); }
0051 inline int getTimeSliceID() const { return hitID_.timeSliceID(); }
0052 inline uint16_t getDepth() const { return hitID_.depth(); }
0053
0054 inline CaloHitID getID() const { return hitID_; }
0055 inline void setID(uint32_t i, double d, int j, uint16_t k = 0) { hitID_.setID(i, d, j, k); }
0056 inline void setID(const CaloHitID& id) { hitID_ = id; }
0057
0058 void addEnergyDeposit(double em, double hd);
0059 void addEnergyDeposit(const CaloGVHit& aHit);
0060
0061 inline double getEnergyDeposit() const { return (elem_ + hadr_); }
0062
0063 private:
0064 int eventID_;
0065 double elem_;
0066 double hadr_;
0067 CaloHitID hitID_;
0068
0069
0070 };
0071
0072 class CaloGVHitLess {
0073 public:
0074 inline bool operator()(const CaloGVHit* a, const CaloGVHit* b) {
0075 if (a->getEventID() != b->getEventID()) {
0076 return (a->getEventID() < b->getEventID());
0077 } else if (a->getTrackID() != b->getTrackID()) {
0078 return (a->getTrackID() < b->getTrackID());
0079 } else if (a->getUnitID() != b->getUnitID()) {
0080 return (a->getUnitID() < b->getUnitID());
0081 } else if (a->getDepth() != b->getDepth()) {
0082 return (a->getDepth() < b->getDepth());
0083 } else {
0084 return (a->getTimeSliceID() < b->getTimeSliceID());
0085 }
0086 }
0087 };
0088
0089 class CaloGVHitEqual {
0090 public:
0091 inline bool operator()(const CaloGVHit* a, const CaloGVHit* b) {
0092 return (a->getEventID() == b->getEventID() && a->getTrackID() == b->getTrackID() &&
0093 a->getUnitID() == b->getUnitID() && a->getDepth() == b->getDepth() &&
0094 a->getTimeSliceID() == b->getTimeSliceID());
0095 }
0096 };
0097
0098 std::ostream& operator<<(std::ostream&, const CaloGVHit&);
0099
0100 #endif