00001 #ifndef SimG4CMS_CaloG4Hit_h
00002 #define SimG4CMS_CaloG4Hit_h 1
00004 // File: CaloG4Hit.h
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #include "SimG4CMS/Calo/interface/CaloHitID.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027 #include "G4VHit.hh"
00028 #include "DataFormats/Math/interface/Point3D.h"
00029 #include <iostream>
00030
00031 class CaloG4Hit : public G4VHit {
00032
00033 public:
00034
00035 CaloG4Hit();
00036 ~CaloG4Hit();
00037 CaloG4Hit(const CaloG4Hit &right);
00038 const CaloG4Hit& operator=(const CaloG4Hit &right);
00039 bool operator==(const CaloG4Hit &){return false;}
00040
00041 void Draw(){}
00042 void Print();
00043
00044 public:
00045
00046 math::XYZPoint getEntry() const {return entry;}
00047 void setEntry(double x, double y, double z) {entry.SetCoordinates(x,y,z);}
00048
00049 math::XYZPoint getEntryLocal() const {return entryLocal;}
00050 void setEntryLocal(double x, double y, double z) {entryLocal.SetCoordinates(x,y,z);}
00051
00052 math::XYZPoint getPosition() const {return pos;}
00053 void setPosition(double x, double y, double z) {pos.SetCoordinates(x,y,z);}
00054
00055 double getEM() const {return elem;}
00056 void setEM (double e) {elem = e;}
00057
00058 double getHadr() const {return hadr;}
00059 void setHadr (double e) {hadr = e;}
00060
00061 double getIncidentEnergy() const {return theIncidentEnergy;}
00062 void setIncidentEnergy (double e) {theIncidentEnergy = e;}
00063
00064 int getTrackID() const {return hitID.trackID();}
00065 uint32_t getUnitID() const {return hitID.unitID();}
00066 double getTimeSlice() const {return hitID.timeSlice();}
00067 int getTimeSliceID() const {return hitID.timeSliceID();}
00068 uint16_t getDepth() const {return hitID.depth();}
00069
00070 CaloHitID getID() const {return hitID;}
00071 void setID (uint32_t i, double d, int j, uint16_t k=0) { hitID.setID(i,d,j,k);}
00072 void setID (CaloHitID id) {hitID = id;}
00073
00074 void addEnergyDeposit(double em, double hd);
00075 void addEnergyDeposit(const CaloG4Hit& aHit);
00076
00077 double getEnergyDeposit() const {return (elem+hadr);}
00078
00079 private:
00080
00081 math::XYZPoint entry;
00082 math::XYZPoint entryLocal;
00083 math::XYZPoint pos;
00084 double elem;
00085 double hadr;
00086 double theIncidentEnergy;
00087 CaloHitID hitID;
00088
00089
00090 };
00091
00092 class CaloG4HitLess {
00093 public:
00094 bool operator()( const CaloG4Hit* a, const CaloG4Hit* b) {
00095 if (a->getTrackID() != b->getTrackID()) {
00096 return (a->getTrackID() < b->getTrackID());
00097 } else if (a->getUnitID() != b->getUnitID()) {
00098 return (a->getUnitID() < b->getUnitID());
00099 } else if (a->getDepth() != b->getDepth()) {
00100 return (a->getDepth() < b->getDepth());
00101 } else {
00102 return (a->getTimeSliceID() < b->getTimeSliceID());
00103 }
00104 }
00105 };
00106
00107 class CaloG4HitEqual {
00108 public:
00109 bool operator()( const CaloG4Hit* a, const CaloG4Hit* b) {
00110 return (a->getTrackID() == b->getTrackID() &&
00111 a->getUnitID() == b->getUnitID() &&
00112 a->getDepth() == b->getDepth() &&
00113 a->getTimeSliceID() == b->getTimeSliceID());
00114 }
00115 };
00116
00117 std::ostream& operator<<(std::ostream&, const CaloG4Hit&);
00118
00119 #endif