CMS 3D CMS Logo

FiberG4Hit.h
Go to the documentation of this file.
1 #ifndef SimG4CMS_ShowerLibraryProducer_FiberG4Hit_h
2 #define SimG4CMS_ShowerLibraryProducer_FiberG4Hit_h
3 
6 
7 #include "G4VHit.hh"
8 #include "G4THitsCollection.hh"
9 #include "G4Allocator.hh"
10 #include "G4LogicalVolume.hh"
11 
12 #include <vector>
13 
14 class FiberG4Hit : public G4VHit {
15 public:
16  FiberG4Hit();
17  FiberG4Hit(G4LogicalVolume *logVol, G4int tower, G4int depth, G4int tkID);
18  ~FiberG4Hit() override;
19  FiberG4Hit(const FiberG4Hit &right);
20  const FiberG4Hit &operator=(const FiberG4Hit &right);
21  G4int operator==(const FiberG4Hit &right) const;
22 
23  inline void *operator new(size_t);
24  inline void operator delete(void *aHit);
25 
26 private:
27  G4int theTowerId;
28  G4int theDepth;
29  G4int theTrackId;
30  G4int theNpe;
31  G4double theTime;
33  std::vector<HFShowerPhoton> thePhoton;
34  const G4LogicalVolume *theLogV;
35 
36 public:
37  inline void setTowerId(G4int tower) { theTowerId = tower; }
38  inline void setDepth(G4int depth) { theDepth = depth; }
39  inline void setNpe(G4int npe) { theNpe = npe; }
40  inline void setPos(const math::XYZPoint &xyz) { theHitPos = xyz; }
41  inline void setTime(G4double t) { theTime = t; }
42  inline void setPhoton(const std::vector<HFShowerPhoton> &photon) { thePhoton = photon; }
43 
44  inline G4int towerId() const { return theTowerId; }
45  inline G4int depth() const { return theDepth; }
46  inline G4int trackId() const { return theTrackId; }
47  inline G4int npe() const { return theNpe; }
48  math::XYZPoint hitPos() const { return theHitPos; };
49  inline G4double time() const { return theTime; }
50  std::vector<HFShowerPhoton> photon() const { return thePhoton; }
51  inline void add(G4int npe) { theNpe += npe; }
52 };
53 
54 typedef G4THitsCollection<FiberG4Hit> FiberG4HitsCollection;
55 
56 extern G4ThreadLocal G4Allocator<FiberG4Hit> *fFiberG4HitAllocator;
57 
58 inline void *FiberG4Hit::operator new(size_t) {
60  fFiberG4HitAllocator = new G4Allocator<FiberG4Hit>;
61  return (void *)fFiberG4HitAllocator->MallocSingle();
62 }
63 
64 inline void FiberG4Hit::operator delete(void *aHit) { fFiberG4HitAllocator->FreeSingle((FiberG4Hit *)aHit); }
65 #endif
G4int depth() const
Definition: FiberG4Hit.h:45
G4int theTrackId
Definition: FiberG4Hit.h:29
math::XYZPoint hitPos() const
Definition: FiberG4Hit.h:48
~FiberG4Hit() override
Definition: FiberG4Hit.cc:15
G4int towerId() const
Definition: FiberG4Hit.h:44
G4double theTime
Definition: FiberG4Hit.h:31
void setNpe(G4int npe)
Definition: FiberG4Hit.h:39
G4int operator==(const FiberG4Hit &right) const
Definition: FiberG4Hit.cc:36
std::vector< HFShowerPhoton > thePhoton
Definition: FiberG4Hit.h:33
G4int theTowerId
Definition: FiberG4Hit.h:27
std::vector< HFShowerPhoton > photon() const
Definition: FiberG4Hit.h:50
void setTowerId(G4int tower)
Definition: FiberG4Hit.h:37
const FiberG4Hit & operator=(const FiberG4Hit &right)
Definition: FiberG4Hit.cc:26
const G4LogicalVolume * theLogV
Definition: FiberG4Hit.h:34
void setPos(const math::XYZPoint &xyz)
Definition: FiberG4Hit.h:40
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
Definition: FiberG4Hit.h:54
G4int theNpe
Definition: FiberG4Hit.h:30
G4int trackId() const
Definition: FiberG4Hit.h:46
G4int npe() const
Definition: FiberG4Hit.h:47
math::XYZPoint theHitPos
Definition: FiberG4Hit.h:32
void setTime(G4double t)
Definition: FiberG4Hit.h:41
G4ThreadLocal G4Allocator< FiberG4Hit > * fFiberG4HitAllocator
Definition: FiberG4Hit.cc:4
void add(G4int npe)
Definition: FiberG4Hit.h:51
G4int theDepth
Definition: FiberG4Hit.h:28
G4double time() const
Definition: FiberG4Hit.h:49
void setPhoton(const std::vector< HFShowerPhoton > &photon)
Definition: FiberG4Hit.h:42
void setDepth(G4int depth)
Definition: FiberG4Hit.h:38