WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimWCHit.cc
Go to the documentation of this file.
1 #include "WCSimWCHit.hh"
2 #include "G4UnitsTable.hh"
3 #include "G4VVisManager.hh"
4 #include "G4ParticleTypes.hh"
5 #include "G4Circle.hh"
6 #include "G4Colour.hh"
7 #include "G4VisAttributes.hh"
8 #include "G4RotationMatrix.hh"
9 #include <iomanip>
10 
11 #include "G4PhysicalConstants.hh"
12 #include "G4SystemOfUnits.hh"
13 
14 G4int WCSimWCHit::maxPe = 0;
15 
16 G4Allocator<WCSimWCHit> WCSimWCHitAllocator;
17 
18 G4double numbpmthit=0.0;
19 G4double avePe=0.0;
20 
22 {
23  totalPe = 0;
24 }
25 
27 
29  : G4VHit()
30 {
31  trackID = right.trackID;
32  tubeID = right.tubeID;
33  edep = right.edep;
34  pos = right.pos;
35 }
36 
38 {
39  trackID = right.trackID;
40  tubeID = right.tubeID;
41  edep = right.edep;
42  pos = right.pos;
43  return *this;
44 }
45 
46 G4int WCSimWCHit::operator==(const WCSimWCHit& right) const
47 {
48  return (this==&right) ? 1 : 0;
49 }
50 
52 {
53  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
54  if(pVVisManager)
55  {
56  G4Transform3D trans(rot, pos);
57  G4VisAttributes attribs;
58 
59  G4String volumeName = pLogV->GetName();
60 
61  // volumeName should be compared to ID/OD CollectionName of the SensitiveDetector
62  // instead of accessing those exactly here, just grab the substring: It should be "a" glassFaceWCPMT. Later optional check for OD?
63  if ( volumeName.find("glassFaceWCPMT") != std::string::npos ||
64  volumeName.find("glassFaceWCPMT_refl") != std::string::npos) //isn't this deprecated??
65  {
66 
67  //G4cout << "PE: " << totalPe << " Max Pe " << maxPe << G4endl;
68  //numbpmthit++;
69  //avePe += totalPe;
70  //G4cout << "Ave PE: " << avePe/numbpmthit << " Max PE: " << maxPe << G4endl;
71  if ( totalPe > maxPe*.01 )
72  {
73  G4Colour colour(1.,1.-(double(totalPe-.05*maxPe)/double(.95*maxPe)),0.0);
74  attribs.SetColour(colour);
75  // attribs.SetForceWireframe(false);
76  attribs.SetForceSolid(true);
77  pVVisManager->Draw(*pLogV,attribs,trans);
78  }
79 
80  }
81  }
82 }
83 
85 {
86 
87  G4cout.setf(std::ios::fixed);
88  G4cout.precision(1);
89 
90  G4cout << " Tube:" << std::setw(4) << tubeID
91  << " Track:" << std::setw(6) << trackID
92  << " Pe:" << totalPe
93  << " Pos:" << pos/cm << G4endl
94  << "\tTime: ";
95 
96  for (int i = 0; i < totalPe; i++)
97  {
98  G4cout << time[i]/ns << " ";
99  if ( i%10 == 0 && i != 0)
100  G4cout << G4endl << "\t";
101  }
102  G4cout << "size: " << time.size() << G4endl;
103 }
104 
105 // G. Pronost:
106 // Sort function by Hit Time (using first time, assuming hit time within a hit object are sorted)
108  const WCSimWCHit * const &a,
109  const WCSimWCHit * const &b) const {
110 
111  G4double ta, tb;
112  if ( a->time.size() > 0 )
113  ta = a->time[0];
114  else return false;
115 
116  if ( b->time.size() > 0 )
117  tb = b->time[0];
118  else return true;
119 
120  return ta < tb;
121 }
122 
G4int trackID
Definition: WCSimWCHit.hh:152
G4int operator==(const WCSimWCHit &) const
Definition: WCSimWCHit.cc:46
G4LogicalVolume * pLogV
Definition: WCSimWCHit.hh:156
std::vector< G4double > time
Definition: WCSimWCHit.hh:164
void Print()
Definition: WCSimWCHit.cc:84
G4Allocator< WCSimWCHit > WCSimWCHitAllocator
Definition: WCSimWCHit.cc:16
G4double numbpmthit
Definition: WCSimWCHit.cc:18
G4ThreeVector pos
Definition: WCSimWCHit.hh:154
static G4int maxPe
Definition: WCSimWCHit.hh:161
bool operator()(const WCSimWCHit *const &a, const WCSimWCHit *const &b) const
Definition: WCSimWCHit.cc:107
G4int tubeID
Definition: WCSimWCHit.hh:151
G4double avePe
Definition: WCSimWCHit.cc:19
const WCSimWCHit & operator=(const WCSimWCHit &)
Definition: WCSimWCHit.cc:37
void Draw()
Definition: WCSimWCHit.cc:51
G4double edep
Definition: WCSimWCHit.hh:153
G4int totalPe
Definition: WCSimWCHit.hh:163
G4RotationMatrix rot
Definition: WCSimWCHit.hh:155