FairShip
Loading...
Searching...
No Matches
TimeDet Class Reference

#include <TimeDet.h>

Inheritance diagram for TimeDet:
Collaboration diagram for TimeDet:

Public Member Functions

 TimeDet (const char *Name, Bool_t Active)
 
 TimeDet ()
 
Bool_t ProcessHits (FairVolume *v=0) override
 
void SetZposition (Double_t z)
 
void SetBarZspacing (Double_t row, Double_t column)
 
void SetBarZ (Double_t dz)
 
void SetSizeX (Double_t x)
 
void SetSizeY (Double_t y)
 
double GetXCol (int ic) const
 
double GetYRow (int ir) const
 
void GetBarRowCol (int ib, int &irow, int &icol) const
 
double GetZBar (int ir, int ic) const
 
void ConstructGeometry () override
 
- Public Member Functions inherited from SHiP::Detector< TimeDetPoint >
 Detector ()=default
 
 Detector (const char *Name, Bool_t Active, Int_t detID)
 
 Detector (const char *Name, Bool_t Active)
 
 ~Detector () override=default
 
TimeDetPointAddHit (Args &&... args)
 
void ConstructGeometry () override=0
 
void Initialize () override
 
void Reset () override
 
void EndOfEvent () override
 
void Register () override
 
TClonesArray * GetCollection (Int_t iColl) const override
 
void UpdatePointTrackIndices (const std::map< Int_t, Int_t > &indexMap) override
 Update track indices in point collection after track filtering.
 
void SetSpecialPhysicsCuts () override
 
void FinishPrimary () override
 
void FinishRun () override
 
void BeginPrimary () override
 
void PostTrack () override
 
void PreTrack () override
 
void BeginEvent () override
 
void CopyClones (TClonesArray *cl1, TClonesArray *cl2, Int_t offset) override
 
- Public Member Functions inherited from ISTLPointContainer
virtual void UpdatePointTrackIndices (const std::map< Int_t, Int_t > &indexMap)=0
 Update track indices in point collection after track filtering.
 
virtual ~ISTLPointContainer ()=default
 

Private Member Functions

 TimeDet (const TimeDet &)=delete
 Overlap along y.
 
TimeDetoperator= (const TimeDet &)=delete
 

Private Attributes

Double_t fzPos
 
Double_t fxSize
 z-position of veto station
 
Double_t fySize
 width of the detector
 
Double_t fxBar
 height of the detector
 
Double_t fyBar
 length of the bar
 
Double_t fzBar
 width of the bar
 
Double_t fdzBarCol
 depth of the bar
 
Double_t fdzBarRow
 z-distance between columns
 
Int_t fNCol
 z-distance between rows
 
Int_t fNRow
 Number of columns.
 
Double_t fxCenter
 Number of rows.
 
Double_t fyCenter
 x-position of the detector center
 
Int_t fNBars
 y-position of the detector center
 
Double_t fxOv
 Number of bars.
 
Double_t fyOv
 Overlap along x.
 

Additional Inherited Members

- Protected Attributes inherited from SHiP::Detector< TimeDetPoint >
Int_t fEventID
 
Int_t fTrackID
 event index
 
Int_t fVolumeID
 track index
 
TLorentzVector fPos
 volume id
 
TLorentzVector fMom
 position at entrance
 
Double_t fTime
 momentum at entrance
 
Double_t fLength
 time
 
Double_t fELoss
 length
 
std::vector< TimeDetPoint > * fDetPoints
 energy loss
 
TGeoVolume * fDetector
 

Detailed Description

Definition at line 19 of file TimeDet.h.

Constructor & Destructor Documentation

◆ TimeDet() [1/3]

TimeDet::TimeDet ( const char *  Name,
Bool_t  Active 
)

Name : Detector Name Active: kTRUE for active detectors (ProcessHits() will be called) kFALSE for inactive detectors

Definition at line 67 of file TimeDet.cxx.

68 : Detector(name, active, kTimeDet),
69 //
70 fzPos(0),
71 fxSize(450),
72 fySize(650),
73 fxBar(168),
74 fyBar(6),
75 fzBar(1),
76 fdzBarCol(2.4),
77 fdzBarRow(1.2),
78 fNCol(3),
79 fNRow(148),
80 fxCenter(0),
81 fyCenter(0) {
82 fNBars = fNCol * fNRow;
83 if (fNCol > 1)
84 fxOv = (fxBar * fNCol - fxSize) / static_cast<double>(fNCol - 1);
85 else
86 fxOv = 0;
87 if (fNRow > 1)
88 fyOv = (fyBar * fNRow - fySize) / static_cast<double>(fNRow - 1);
89 else
90 fyOv = 0;
91}
@ kTimeDet
Double_t fxSize
z-position of veto station
Definition: TimeDet.h:57
Double_t fxBar
height of the detector
Definition: TimeDet.h:60
Double_t fyOv
Overlap along x.
Definition: TimeDet.h:75
Double_t fxCenter
Number of rows.
Definition: TimeDet.h:70
Int_t fNRow
Number of columns.
Definition: TimeDet.h:68
Int_t fNBars
y-position of the detector center
Definition: TimeDet.h:73
Double_t fdzBarRow
z-distance between columns
Definition: TimeDet.h:65
Double_t fySize
width of the detector
Definition: TimeDet.h:58
Double_t fyBar
length of the bar
Definition: TimeDet.h:61
Double_t fzPos
Definition: TimeDet.h:55
Double_t fyCenter
x-position of the detector center
Definition: TimeDet.h:71
Double_t fzBar
width of the bar
Definition: TimeDet.h:62
Int_t fNCol
z-distance between rows
Definition: TimeDet.h:67
Double_t fdzBarCol
depth of the bar
Definition: TimeDet.h:64
Double_t fxOv
Number of bars.
Definition: TimeDet.h:74

◆ TimeDet() [2/3]

TimeDet::TimeDet ( )

default constructor

Definition at line 42 of file TimeDet.cxx.

43 : Detector("TimeDet", kTRUE, kTimeDet),
44 fzPos(0),
45 fxSize(450),
46 fySize(650),
47 fxBar(168),
48 fyBar(6),
49 fzBar(1),
50 fdzBarCol(2.4),
51 fdzBarRow(1.2),
52 fNCol(3),
53 fNRow(148),
54 fxCenter(0),
55 fyCenter(0) {
56 fNBars = fNCol * fNRow;
57 if (fNCol > 1)
58 fxOv = (fxBar * fNCol - fxSize) / static_cast<double>(fNCol - 1);
59 else
60 fxOv = 0;
61 if (fNRow > 1)
62 fyOv = (fyBar * fNRow - fySize) / static_cast<double>(fNRow - 1);
63 else
64 fyOv = 0;
65}

◆ TimeDet() [3/3]

TimeDet::TimeDet ( const TimeDet )
privatedelete

Overlap along y.

Member Function Documentation

◆ ConstructGeometry()

void TimeDet::ConstructGeometry ( )
overridevirtual

Create the detector geometry

Implements SHiP::Detector< TimeDetPoint >.

Definition at line 151 of file TimeDet.cxx.

151 {
152 TGeoVolume* top = gGeoManager->GetTopVolume();
153
154 ShipGeo::InitMedium("polyvinyltoluene");
155 TGeoMedium* Scint = gGeoManager->GetMedium("polyvinyltoluene");
156
158
159 fDetector = new TGeoVolumeAssembly("Timing Detector");
160
161 TGeoVolume* plate =
162 gGeoManager->MakeBox("TimeDet", Scint, fxBar / 2, fyBar / 2, fzBar / 2);
163 plate->SetLineColor(kBlue);
164 AddSensitiveVolume(plate);
165
166 for (int ib = 0; ib < fNBars; ib++) {
167 int irow = 0, icol = 0;
168 GetBarRowCol(ib, irow, icol);
169
170 double xbar = 0, ybar = 0, zbar = 0;
171 xbar = GetXCol(icol);
172 ybar = GetYRow(irow);
173 zbar = GetZBar(irow, icol);
174
175 fDetector->AddNode(plate, ib, new TGeoTranslation(xbar, ybar, zbar));
176
177 // printf("%3i %3i %2i %8.3f %8.3f %8.3f\n",ib, irow,icol,
178 // xbar,ybar,zbar);
179 }
180
181 top->AddNode(fDetector, 1, new TGeoTranslation(0, 0, fzPos));
182
184
185 return;
186}
void GetBarRowCol(int ib, int &irow, int &icol) const
Definition: TimeDet.cxx:188
double GetXCol(int ic) const
Definition: TimeDet.cxx:194
double GetZBar(int ir, int ic) const
Definition: TimeDet.cxx:206
double GetYRow(int ir) const
Definition: TimeDet.cxx:200
Int_t InitMedium(const char *name)
Definition: ShipGeoUtil.h:20

◆ GetBarRowCol()

void TimeDet::GetBarRowCol ( int  ib,
int &  irow,
int &  icol 
) const

Definition at line 188 of file TimeDet.cxx.

188 {
189 irow = ib / fNCol;
190 icol = (ib % fNCol);
191 return;
192}

◆ GetXCol()

double TimeDet::GetXCol ( int  ic) const

Definition at line 194 of file TimeDet.cxx.

194 {
195 ic += 1;
196 double x = fxBar * ic - fxOv * (ic - 1) - fxBar / 2;
197 return x - fxSize / 2 + fxCenter;
198}

◆ GetYRow()

double TimeDet::GetYRow ( int  ir) const

Definition at line 200 of file TimeDet.cxx.

200 {
201 ir += 1;
202 double y = fyBar * ir - fyOv * (ir - 1) - fyBar / 2;
203 return y - fySize / 2 + fyCenter;
204}

◆ GetZBar()

double TimeDet::GetZBar ( int  ir,
int  ic 
) const

Definition at line 206 of file TimeDet.cxx.

206 {
207 double z = (ir % 2) * fdzBarRow + (ic % 2) * fdzBarCol;
208 return z;
209}

◆ operator=()

TimeDet & TimeDet::operator= ( const TimeDet )
privatedelete

◆ ProcessHits()

Bool_t TimeDet::ProcessHits ( FairVolume *  v = 0)
override

this method is called for each step during simulation (see FairMCApplication::Stepping())

This method is called from the MC stepping

Definition at line 93 of file TimeDet.cxx.

93 {
95 // Set parameters at entrance of volume. Reset ELoss.
96 if (gMC->IsTrackEntering()) {
97 fELoss = 0.;
98 fTime = gMC->TrackTime() * 1.0e09;
99 fLength = gMC->TrackLength();
100 gMC->TrackPosition(fPos);
101 gMC->TrackMomentum(fMom);
102 }
103
104 // Sum energy loss for all steps in the active volume
105 fELoss += gMC->Edep();
106
107 // Create vetoPoint at exit of active volume
108 if (gMC->IsTrackExiting() || gMC->IsTrackStop() ||
109 gMC->IsTrackDisappeared()) {
110 if (fELoss == 0.) {
111 return kFALSE;
112 }
113
114 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
115 fEventID = gMC->CurrentEvent();
116 Int_t uniqueId;
117 gMC->CurrentVolID(uniqueId);
118 if (uniqueId > 1000000) // Solid scintillator case
119 {
120 Int_t vcpy;
121 gMC->CurrentVolOffID(1, vcpy);
122 if (vcpy == 5) uniqueId += 4; // Copy of half
123 }
124
125 TParticle* p = gMC->GetStack()->GetCurrentTrack();
126 Int_t pdgCode = p->GetPdgCode();
127 TLorentzVector Pos;
128 gMC->TrackPosition(Pos);
129 TLorentzVector Mom;
130 gMC->TrackMomentum(Mom);
131 Double_t xmean = (fPos.X() + Pos.X()) / 2.;
132 Double_t ymean = (fPos.Y() + Pos.Y()) / 2.;
133 Double_t zmean = (fPos.Z() + Pos.Z()) / 2.;
134
135 // cout << uniqueId << " :(" << xmean << ", " << ymean << ", " << zmean <<
136 // "): " << gMC->CurrentVolName() << endl;
137
138 AddHit(fEventID, fTrackID, uniqueId, TVector3(xmean, ymean, zmean),
139 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength, fELoss,
140 pdgCode, TVector3(Pos.X(), Pos.Y(), Pos.Z()),
141 TVector3(Mom.Px(), Mom.Py(), Mom.Pz()));
142
143 // Increment number of veto det points in TParticle
144 ShipStack* stack = dynamic_cast<ShipStack*>(gMC->GetStack());
145 stack->AddPoint(kTimeDet);
146 }
147
148 return kTRUE;
149}
Int_t fTrackID
event index
Definition: Detector.h:85
TLorentzVector fPos
volume id
Definition: Detector.h:87
Double_t fTime
momentum at entrance
Definition: Detector.h:89
TimeDetPoint * AddHit(Args &&... args)
Definition: Detector.h:38
TLorentzVector fMom
position at entrance
Definition: Detector.h:88
ROOT p
Definition: makeDecay.py:76

◆ SetBarZ()

void TimeDet::SetBarZ ( Double_t  dz)
inline

Definition at line 41 of file TimeDet.h.

41{ fzBar = dz; }

◆ SetBarZspacing()

void TimeDet::SetBarZspacing ( Double_t  row,
Double_t  column 
)
inline

Definition at line 37 of file TimeDet.h.

37 {
38 fdzBarRow = row;
39 fdzBarCol = column;
40 }

◆ SetSizeX()

void TimeDet::SetSizeX ( Double_t  x)
inline

Definition at line 42 of file TimeDet.h.

42{ fxSize = x; }

◆ SetSizeY()

void TimeDet::SetSizeY ( Double_t  y)
inline

Definition at line 43 of file TimeDet.h.

43{ fySize = y; }

◆ SetZposition()

void TimeDet::SetZposition ( Double_t  z)
inline

Sets detector position along z

Definition at line 36 of file TimeDet.h.

36{ fzPos = z; }

Member Data Documentation

◆ fdzBarCol

Double_t TimeDet::fdzBarCol
private

depth of the bar

Definition at line 64 of file TimeDet.h.

◆ fdzBarRow

Double_t TimeDet::fdzBarRow
private

z-distance between columns

Definition at line 65 of file TimeDet.h.

◆ fNBars

Int_t TimeDet::fNBars
private

y-position of the detector center

Definition at line 73 of file TimeDet.h.

◆ fNCol

Int_t TimeDet::fNCol
private

z-distance between rows

Definition at line 67 of file TimeDet.h.

◆ fNRow

Int_t TimeDet::fNRow
private

Number of columns.

Definition at line 68 of file TimeDet.h.

◆ fxBar

Double_t TimeDet::fxBar
private

height of the detector

Definition at line 60 of file TimeDet.h.

◆ fxCenter

Double_t TimeDet::fxCenter
private

Number of rows.

Definition at line 70 of file TimeDet.h.

◆ fxOv

Double_t TimeDet::fxOv
private

Number of bars.

Definition at line 74 of file TimeDet.h.

◆ fxSize

Double_t TimeDet::fxSize
private

z-position of veto station

Definition at line 57 of file TimeDet.h.

◆ fyBar

Double_t TimeDet::fyBar
private

length of the bar

Definition at line 61 of file TimeDet.h.

◆ fyCenter

Double_t TimeDet::fyCenter
private

x-position of the detector center

Definition at line 71 of file TimeDet.h.

◆ fyOv

Double_t TimeDet::fyOv
private

Overlap along x.

Definition at line 75 of file TimeDet.h.

◆ fySize

Double_t TimeDet::fySize
private

width of the detector

Definition at line 58 of file TimeDet.h.

◆ fzBar

Double_t TimeDet::fzBar
private

width of the bar

Definition at line 62 of file TimeDet.h.

◆ fzPos

Double_t TimeDet::fzPos
private

Detector parameters.

Definition at line 55 of file TimeDet.h.


The documentation for this class was generated from the following files: