CMS 3D CMS Logo

CaloG4Hit.h

Go to the documentation of this file.
00001 #ifndef SimG4CMS_CaloG4Hit_h
00002 #define SimG4CMS_CaloG4Hit_h 1
00004 // File: CaloG4Hit.h
00005 // Date: 10.02 Taken from CMSCaloHit
00006 // 
00007 // Hit class for Calorimeters (Ecal, Hcal, ...)
00008 //
00009 // One Hit object should be created
00010 // -for each new particle entering the calorimeter
00011 // -for each detector unit (= crystal or fibre or scintillator layer)
00012 // -for each nanosecond of the shower development
00013 //
00014 // This implies that all hit objects created for a given shower
00015 // have the same value for
00016 // - Entry (= local coordinates of the entrance point of the particle
00017 //            in the unit where the shower starts) 
00018 // - the TrackID (= Identification number of the incident particle)
00019 // - the IncidentEnergy (= energy of that particle)
00020 //
00021 // Modified: 
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;             //Entry point (Global coordinate)
00082   math::XYZPoint   entryLocal;        //Entry point (Local  coordinate)
00083   math::XYZPoint   pos;               //Position    (Global coordinate)
00084   double           elem;              //EnergyDeposit of EM particles
00085   double           hadr;              //EnergyDeposit of HD particles
00086   double           theIncidentEnergy; //Energy of the primary particle
00087   CaloHitID        hitID;             //Identification number of the hit given 
00088                                       //by primary particle, Cell ID, Time of 
00089                                       //the hit
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

Generated on Tue Jun 9 17:46:48 2009 for CMSSW by  doxygen 1.5.4