Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:47

0001 #ifndef SimG4CMS_CaloGVHit_h
0002 #define SimG4CMS_CaloGVHit_h 1
0003 ///////////////////////////////////////////////////////////////////////////////
0004 // File: CaloGVHit.h
0005 // Date: 10.02 Taken from CMSCaloHit
0006 //
0007 // Hit class for Calorimeters (Ecal, Hcal, ...)
0008 //
0009 // One Hit object should be created
0010 // -for each new particle entering the calorimeter
0011 // -for each detector unit (= crystal or fibre or scintillator layer)
0012 // -for each nanosecond of the shower development
0013 //
0014 // This implies that all hit objects created for a given shower
0015 // have the same value for
0016 // - Entry (= local coordinates of the entrance point of the particle
0017 //            in the unit where the shower starts)
0018 // - the TrackID (= Identification number of the incident particle)
0019 // - the IncidentEnergy (= energy of that particle)
0020 //
0021 // Modified:
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_;      //Event ID
0065   double elem_;      //EnergyDeposit of EM particles
0066   double hadr_;      //EnergyDeposit of HD particles
0067   CaloHitID hitID_;  //Identification number of the hit given
0068                      //by primary particle, Cell ID, Time of
0069                      //the hit
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