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 
16 public:
17 
18  FiberG4Hit();
19  FiberG4Hit(G4LogicalVolume* logVol, G4int tower, G4int depth, G4int tkID);
20  virtual ~FiberG4Hit();
21  FiberG4Hit(const FiberG4Hit &right);
22  const FiberG4Hit& operator=(const FiberG4Hit &right);
23  G4int operator==(const FiberG4Hit &right) const;
24 
25  inline void *operator new(size_t);
26  inline void operator delete(void *aHit);
27 
28 private:
29 
30  G4int theTowerId;
31  G4int theDepth;
32  G4int theTrackId;
33  G4int theNpe;
34  G4double theTime;
36  std::vector<HFShowerPhoton> thePhoton;
37  const G4LogicalVolume* theLogV;
38 
39 public:
40 
41  inline void setTowerId(G4int tower) {theTowerId = tower;}
42  inline void setDepth(G4int depth) {theDepth = depth;}
43  inline void setNpe(G4int npe) {theNpe = npe;}
44  inline void setPos(const math::XYZPoint& xyz) {theHitPos = xyz;}
45  inline void setTime(G4double t) {theTime = t; }
46  inline void setPhoton(const std::vector<HFShowerPhoton>& photon) {thePhoton = photon; }
47 
48  inline G4int towerId() const {return theTowerId;}
49  inline G4int depth() const {return theDepth;}
50  inline G4int trackId() const {return theTrackId;}
51  inline G4int npe() const {return theNpe;}
52  math::XYZPoint hitPos() const {return theHitPos;};
53  inline G4double time() const {return theTime;}
54  std::vector<HFShowerPhoton> photon() const {return thePhoton;}
55  inline void add(G4int npe) {theNpe +=npe;}
56 };
57 
58 typedef G4THitsCollection<FiberG4Hit> FiberG4HitsCollection;
59 
60 extern G4ThreadLocal G4Allocator<FiberG4Hit> *fFiberG4HitAllocator;
61 
62 inline void* FiberG4Hit::operator new(size_t) {
64  new G4Allocator<FiberG4Hit>;
65  return (void*)fFiberG4HitAllocator->MallocSingle();
66 }
67 
68 inline void FiberG4Hit::operator delete(void *aHit) {
69  fFiberG4HitAllocator->FreeSingle((FiberG4Hit*) aHit);
70 }
71 #endif
G4int theTrackId
Definition: FiberG4Hit.h:32
G4int depth() const
Definition: FiberG4Hit.h:49
G4double theTime
Definition: FiberG4Hit.h:34
void setNpe(G4int npe)
Definition: FiberG4Hit.h:43
G4int operator==(const FiberG4Hit &right) const
Definition: FiberG4Hit.cc:39
std::vector< HFShowerPhoton > thePhoton
Definition: FiberG4Hit.h:36
G4int theTowerId
Definition: FiberG4Hit.h:30
G4int towerId() const
Definition: FiberG4Hit.h:48
std::vector< HFShowerPhoton > photon() const
Definition: FiberG4Hit.h:54
G4double time() const
Definition: FiberG4Hit.h:53
void setTowerId(G4int tower)
Definition: FiberG4Hit.h:41
const FiberG4Hit & operator=(const FiberG4Hit &right)
Definition: FiberG4Hit.cc:29
math::XYZPoint hitPos() const
Definition: FiberG4Hit.h:52
const G4LogicalVolume * theLogV
Definition: FiberG4Hit.h:37
void setPos(const math::XYZPoint &xyz)
Definition: FiberG4Hit.h:44
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
G4THitsCollection< FiberG4Hit > FiberG4HitsCollection
Definition: FiberG4Hit.h:58
G4int theNpe
Definition: FiberG4Hit.h:33
G4int npe() const
Definition: FiberG4Hit.h:51
virtual ~FiberG4Hit()
Definition: FiberG4Hit.cc:18
math::XYZPoint theHitPos
Definition: FiberG4Hit.h:35
void setTime(G4double t)
Definition: FiberG4Hit.h:45
G4ThreadLocal G4Allocator< FiberG4Hit > * fFiberG4HitAllocator
Definition: FiberG4Hit.cc:4
void add(G4int npe)
Definition: FiberG4Hit.h:55
G4int theDepth
Definition: FiberG4Hit.h:31
G4int trackId() const
Definition: FiberG4Hit.h:50
void setPhoton(const std::vector< HFShowerPhoton > &photon)
Definition: FiberG4Hit.h:46
void setDepth(G4int depth)
Definition: FiberG4Hit.h:42