Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:11

0001 #ifndef SimG4CMS_ShowerLibraryProducer_FiberG4Hit_h
0002 #define SimG4CMS_ShowerLibraryProducer_FiberG4Hit_h
0003 
0004 #include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h"
0005 #include "DataFormats/Math/interface/Point3D.h"
0006 
0007 #include "G4VHit.hh"
0008 #include "G4THitsCollection.hh"
0009 #include "G4Allocator.hh"
0010 #include "G4LogicalVolume.hh"
0011 
0012 #include <vector>
0013 
0014 class FiberG4Hit : public G4VHit {
0015 public:
0016   FiberG4Hit();
0017   FiberG4Hit(G4LogicalVolume *logVol, G4int tower, G4int depth, G4int tkID);
0018   ~FiberG4Hit() override;
0019   FiberG4Hit(const FiberG4Hit &right);
0020   const FiberG4Hit &operator=(const FiberG4Hit &right);
0021   G4int operator==(const FiberG4Hit &right) const;
0022 
0023   inline void *operator new(size_t);
0024   inline void operator delete(void *aHit);
0025 
0026 private:
0027   G4int theTowerId;
0028   G4int theDepth;
0029   G4int theTrackId;
0030   G4int theNpe;
0031   G4double theTime;
0032   math::XYZPoint theHitPos;
0033   std::vector<HFShowerPhoton> thePhoton;
0034   const G4LogicalVolume *theLogV;
0035 
0036 public:
0037   inline void setTowerId(G4int tower) { theTowerId = tower; }
0038   inline void setDepth(G4int depth) { theDepth = depth; }
0039   inline void setNpe(G4int npe) { theNpe = npe; }
0040   inline void setPos(const math::XYZPoint &xyz) { theHitPos = xyz; }
0041   inline void setTime(G4double t) { theTime = t; }
0042   inline void setPhoton(const std::vector<HFShowerPhoton> &photon) { thePhoton = photon; }
0043 
0044   inline G4int towerId() const { return theTowerId; }
0045   inline G4int depth() const { return theDepth; }
0046   inline G4int trackId() const { return theTrackId; }
0047   inline G4int npe() const { return theNpe; }
0048   math::XYZPoint hitPos() const { return theHitPos; };
0049   inline G4double time() const { return theTime; }
0050   std::vector<HFShowerPhoton> photon() const { return thePhoton; }
0051   inline void add(G4int npe) { theNpe += npe; }
0052 };
0053 
0054 typedef G4THitsCollection<FiberG4Hit> FiberG4HitsCollection;
0055 
0056 extern G4ThreadLocal G4Allocator<FiberG4Hit> *fFiberG4HitAllocator;
0057 
0058 inline void *FiberG4Hit::operator new(size_t) {
0059   if (!fFiberG4HitAllocator)
0060     fFiberG4HitAllocator = new G4Allocator<FiberG4Hit>;
0061   return (void *)fFiberG4HitAllocator->MallocSingle();
0062 }
0063 
0064 inline void FiberG4Hit::operator delete(void *aHit) { fFiberG4HitAllocator->FreeSingle((FiberG4Hit *)aHit); }
0065 #endif