SND@LHC Software
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 ()
 
virtual ~TimeDet ()
 
virtual void Initialize ()
 
virtual Bool_t ProcessHits (FairVolume *v=0)
 
virtual void Register ()
 
virtual TClonesArray * GetCollection (Int_t iColl) const
 
virtual void Reset ()
 
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 ()
 
TimeDetPointAddHit (Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgCode, TVector3 Lpos, TVector3 Lmom)
 
virtual void EndOfEvent ()
 
virtual void FinishPrimary ()
 
virtual void FinishRun ()
 
virtual void BeginPrimary ()
 
virtual void PostTrack ()
 
virtual void PreTrack ()
 
virtual void BeginEvent ()
 

Private Member Functions

 TimeDet (const TimeDet &)
 
TimeDetoperator= (const TimeDet &)
 
Int_t InitMedium (const char *name)
 

Private Attributes

Int_t fTrackID
 
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
 
Double_t fzPos
 energy loss
 
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.
 
TGeoVolume * fDetector
 Overlap along y.
 
TClonesArray * fTimeDetPointCollection
 

Detailed Description

Definition at line 14 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 73 of file TimeDet.cxx.

74 : FairDetector(name, active, kTimeDet),
75 fTrackID(-1),
76 fVolumeID(-1),
77 fPos(),
78 fMom(),
79 fTime(-1.),
80 fLength(-1.),
81 fELoss(-1),
82 //
83 fzPos(0),
84 fxSize(500),
85 fySize(1000),
86 fxBar(168),
87 fyBar(6),
88 fzBar(1),
89 fdzBarCol(2.4),
90 fdzBarRow(1.2),
91 fNCol(3),
92 fNRow(182),
93 fxCenter(0),
94 fyCenter(0),
95 //
96 fDetector(0),
97 //
98 fTimeDetPointCollection(new TClonesArray("TimeDetPoint"))
99{
100 fNBars = fNCol * fNRow;
101 if(fNCol>1) fxOv = (fxBar*fNCol - fxSize) / (double)(fNCol-1); else fxOv = 0;
102 if(fNRow>1) fyOv = (fyBar*fNRow - fySize) / (double)(fNRow-1); else fyOv = 0;
103
104}
@ kTimeDet
TGeoVolume * fDetector
Overlap along y.
Definition TimeDet.h:118
Double_t fxSize
z-position of veto station
Definition TimeDet.h:98
Double_t fxBar
height of the detector
Definition TimeDet.h:101
Double_t fTime
momentum at entrance
Definition TimeDet.h:91
Double_t fyOv
Overlap along x.
Definition TimeDet.h:116
Double_t fxCenter
Number of rows.
Definition TimeDet.h:111
Int_t fNRow
Number of columns.
Definition TimeDet.h:109
Int_t fNBars
y-position of the detector center
Definition TimeDet.h:114
Double_t fdzBarRow
z-distance between columns
Definition TimeDet.h:106
Double_t fySize
width of the detector
Definition TimeDet.h:99
Double_t fyBar
length of the bar
Definition TimeDet.h:102
Double_t fzPos
energy loss
Definition TimeDet.h:96
Double_t fyCenter
x-position of the detector center
Definition TimeDet.h:112
Double_t fELoss
length
Definition TimeDet.h:93
Int_t fTrackID
Definition TimeDet.h:87
Double_t fzBar
width of the bar
Definition TimeDet.h:103
TClonesArray * fTimeDetPointCollection
Definition TimeDet.h:121
Int_t fNCol
z-distance between rows
Definition TimeDet.h:108
Int_t fVolumeID
track index
Definition TimeDet.h:88
TLorentzVector fMom
position at entrance
Definition TimeDet.h:90
Double_t fdzBarCol
depth of the bar
Definition TimeDet.h:105
TLorentzVector fPos
volume id
Definition TimeDet.h:89
Double_t fLength
time
Definition TimeDet.h:92
Double_t fxOv
Number of bars.
Definition TimeDet.h:115

◆ TimeDet() [2/3]

TimeDet::TimeDet ( )

default constructor

Definition at line 39 of file TimeDet.cxx.

40 : FairDetector("TimeDet", kTRUE, kTimeDet),
41 fTrackID(-1),
42 fVolumeID(-1),
43 fPos(),
44 fMom(),
45 fTime(-1.),
46 fLength(-1.),
47 fELoss(-1),
48 //
49 fzPos(0),
50 fxSize(500),
51 fySize(1000),
52 fxBar(168),
53 fyBar(6),
54 fzBar(1),
55 fdzBarCol(2.4),
56 fdzBarRow(1.2),
57 fNCol(3),
58 fNRow(182),
59 fxCenter(0),
60 fyCenter(0),
61 //
62 fDetector(0),
63 //
64 fTimeDetPointCollection(new TClonesArray("TimeDetPoint"))
65{
66 fNBars = fNCol * fNRow;
67 if(fNCol>1) fxOv = (fxBar*fNCol - fxSize) / (double)(fNCol-1); else fxOv = 0;
68 if(fNRow>1) fyOv = (fyBar*fNRow - fySize) / (double)(fNRow-1); else fyOv = 0;
69}

◆ ~TimeDet()

TimeDet::~TimeDet ( )
virtual

destructor

Definition at line 112 of file TimeDet.cxx.

113{
115 fTimeDetPointCollection->Delete();
117 }
118}

◆ TimeDet() [3/3]

TimeDet::TimeDet ( const TimeDet )
private

Member Function Documentation

◆ AddHit()

TimeDetPoint * TimeDet::AddHit ( Int_t  trackID,
Int_t  detID,
TVector3  pos,
TVector3  mom,
Double_t  time,
Double_t  length,
Double_t  eLoss,
Int_t  pdgCode,
TVector3  Lpos,
TVector3  Lmom 
)

This method is an example of how to add your own point of type TimeDetPoint to the clones array

Definition at line 283 of file TimeDet.cxx.

287{
288 TClonesArray& clref = *fTimeDetPointCollection;
289 Int_t size = clref.GetEntriesFast();
290 // cout << "veto hit called "<< pos.z()<<endl;
291 return new(clref[size]) TimeDetPoint(trackID, detID, pos, mom,
292 time, length, eLoss, pdgCode,Lpos,Lmom);
293}

◆ BeginEvent()

virtual void TimeDet::BeginEvent ( )
inlinevirtual

Definition at line 81 of file TimeDet.h.

81{;}

◆ BeginPrimary()

virtual void TimeDet::BeginPrimary ( )
inlinevirtual

Definition at line 78 of file TimeDet.h.

78{;}

◆ ConstructGeometry()

void TimeDet::ConstructGeometry ( )

Create the detector geometry

Definition at line 244 of file TimeDet.cxx.

245{
246 TGeoVolume *top = gGeoManager->GetTopVolume();
247
248 InitMedium("polyvinyltoluene");
249 TGeoMedium *Scint =gGeoManager->GetMedium("polyvinyltoluene");
250
252
253 fDetector = new TGeoVolumeAssembly("Timing Detector");
254
255 TGeoVolume *plate = gGeoManager->MakeBox("TimeDet", Scint, fxBar/2,fyBar/2,fzBar/2);
256 plate->SetLineColor(kBlue);
257 AddSensitiveVolume(plate);
258
259 for(int ib=0; ib<fNBars; ib++) {
260
261 int irow=0, icol=0;
262 GetBarRowCol(ib,irow,icol);
263
264 double xbar=0,ybar=0,zbar=0;
265 xbar = GetXCol(icol);
266 ybar = GetYRow(irow);
267 zbar = GetZBar(irow,icol);
268
269 fDetector->AddNode(plate, ib, new TGeoTranslation( xbar,ybar,zbar) );
270
271 //printf("%3i %3i %2i %8.3f %8.3f %8.3f\n",ib, irow,icol, xbar,ybar,zbar);
272 }
273
274 top->AddNode(fDetector, 1, new TGeoTranslation(0,0,fzPos));
275
277
278 return;
279}
void GetBarRowCol(int ib, int &irow, int &icol) const
Definition TimeDet.cxx:296
double GetXCol(int ic) const
Definition TimeDet.cxx:304
Int_t InitMedium(const char *name)
Definition TimeDet.cxx:122
double GetZBar(int ir, int ic) const
Definition TimeDet.cxx:320
double GetYRow(int ir) const
Definition TimeDet.cxx:312

◆ EndOfEvent()

void TimeDet::EndOfEvent ( )
virtual

Definition at line 207 of file TimeDet.cxx.

208{
210}

◆ FinishPrimary()

virtual void TimeDet::FinishPrimary ( )
inlinevirtual

Definition at line 76 of file TimeDet.h.

76{;}

◆ FinishRun()

virtual void TimeDet::FinishRun ( )
inlinevirtual

Definition at line 77 of file TimeDet.h.

77{;}

◆ GetBarRowCol()

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

Definition at line 296 of file TimeDet.cxx.

297{
298 irow = ib / fNCol;
299 icol = (ib%fNCol);
300 return;
301}

◆ GetCollection()

TClonesArray * TimeDet::GetCollection ( Int_t  iColl) const
virtual

Gets the produced collections

Definition at line 229 of file TimeDet.cxx.

230{
231 if (iColl == 0) { return fTimeDetPointCollection; }
232 else { return NULL; }
233}

◆ GetXCol()

double TimeDet::GetXCol ( int  ic) const

Definition at line 304 of file TimeDet.cxx.

305{
306 ic += 1;
307 double x = fxBar*ic - fxOv*(ic-1) - fxBar/2;
308 return x - fxSize/2 + fxCenter;
309}

◆ GetYRow()

double TimeDet::GetYRow ( int  ir) const

Definition at line 312 of file TimeDet.cxx.

313{
314 ir += 1;
315 double y = fyBar*ir - fyOv*(ir-1) - fyBar/2;
316 return y - fySize/2 + fyCenter;
317}

◆ GetZBar()

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

Definition at line 320 of file TimeDet.cxx.

321{
322 double z = (ir%2) * fdzBarRow + (ic%2) * fdzBarCol;
323 return z;
324}

◆ Initialize()

void TimeDet::Initialize ( )
virtual

Initialization of the detector is done here

Definition at line 106 of file TimeDet.cxx.

107{
108 FairDetector::Initialize();
109}

◆ InitMedium()

Int_t TimeDet::InitMedium ( const char *  name)
private

Definition at line 122 of file TimeDet.cxx.

123{
124
125 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
126 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
127 static FairGeoMedia *media=geoFace->getMedia();
128 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
129
130 FairGeoMedium *ShipMedium=media->getMedium(name);
131
132 if (!ShipMedium)
133 {
134 Fatal("InitMedium","Material %s not defined in media file.", name);
135 return -1111;
136 }
137 TGeoMedium* medium=gGeoManager->GetMedium(name);
138 if (medium!=NULL)
139 return ShipMedium->getMediumIndex();
140
141 return geoBuild->createMedium(ShipMedium);
142
143 return 0;
144}

◆ operator=()

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

◆ PostTrack()

virtual void TimeDet::PostTrack ( )
inlinevirtual

Definition at line 79 of file TimeDet.h.

79{;}

◆ PreTrack()

virtual void TimeDet::PreTrack ( )
inlinevirtual

Definition at line 80 of file TimeDet.h.

80{;}

◆ ProcessHits()

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

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

This method is called from the MC stepping

Definition at line 148 of file TimeDet.cxx.

149{
151 //Set parameters at entrance of volume. Reset ELoss.
152 if ( gMC->IsTrackEntering() ) {
153 fELoss = 0.;
154 fTime = gMC->TrackTime() * 1.0e09;
155 fLength = gMC->TrackLength();
156 gMC->TrackPosition(fPos);
157 gMC->TrackMomentum(fMom);
158 }
159
160 // Sum energy loss for all steps in the active volume
161 fELoss += gMC->Edep();
162
163 // Create vetoPoint at exit of active volume
164 if ( gMC->IsTrackExiting() ||
165 gMC->IsTrackStop() ||
166 gMC->IsTrackDisappeared() ) {
167 if (fELoss == 0. ) { return kFALSE; }
168
169 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
170
171 Int_t uniqueId;
172 gMC->CurrentVolID(uniqueId);
173 if (uniqueId>1000000) //Solid scintillator case
174 {
175 Int_t vcpy;
176 gMC->CurrentVolOffID(1, vcpy);
177 if (vcpy==5) uniqueId+=4; //Copy of half
178 }
179
180 TParticle* p = gMC->GetStack()->GetCurrentTrack();
181 Int_t pdgCode = p->GetPdgCode();
182 TLorentzVector Pos;
183 gMC->TrackPosition(Pos);
184 TLorentzVector Mom;
185 gMC->TrackMomentum(Mom);
186 Double_t xmean = (fPos.X()+Pos.X())/2. ;
187 Double_t ymean = (fPos.Y()+Pos.Y())/2. ;
188 Double_t zmean = (fPos.Z()+Pos.Z())/2. ;
189
190 //cout << uniqueId << " :(" << xmean << ", " << ymean << ", " << zmean << "): " << gMC->CurrentVolName() << endl;
191
192 AddHit(fTrackID, uniqueId, TVector3(xmean, ymean, zmean),
193 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
194 fELoss,pdgCode,TVector3(Pos.X(), Pos.Y(), Pos.Z()),
195 TVector3(Mom.Px(), Mom.Py(), Mom.Pz()) );
196
197 // Increment number of veto det points in TParticle
198 ShipStack* stack = (ShipStack*) gMC->GetStack();
199 stack->AddPoint(kTimeDet);
200 }
201
202 return kTRUE;
203}
TimeDetPoint * AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgCode, TVector3 Lpos, TVector3 Lmom)
Definition TimeDet.cxx:283

◆ Register()

void TimeDet::Register ( )
virtual

Registers the produced collections in FAIRRootManager.

This will create a branch in the output tree called TimeDetPoint, setting the last parameter to kFALSE means: this collection will not be written to the file, it will exist only during the simulation.

Definition at line 214 of file TimeDet.cxx.

215{
216
223 FairRootManager::Instance()->Register("TimeDetPoint", "TimeDet",
225}

◆ Reset()

void TimeDet::Reset ( )
virtual

has to be called after each event to reset the containers

Definition at line 237 of file TimeDet.cxx.

238{
240}

◆ SetBarZ()

void TimeDet::SetBarZ ( Double_t  dz)
inline

Definition at line 55 of file TimeDet.h.

55{fzBar = dz;}

◆ SetBarZspacing()

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

Definition at line 50 of file TimeDet.h.

51 {
52 fdzBarRow = row;
53 fdzBarCol = column;
54 }

◆ SetSizeX()

void TimeDet::SetSizeX ( Double_t  x)
inline

Definition at line 56 of file TimeDet.h.

56{fxSize = x;}

◆ SetSizeY()

void TimeDet::SetSizeY ( Double_t  y)
inline

Definition at line 57 of file TimeDet.h.

57{fySize = y;}

◆ SetZposition()

void TimeDet::SetZposition ( Double_t  z)
inline

Sets detector position along z

Definition at line 49 of file TimeDet.h.

49{fzPos = z;}

Member Data Documentation

◆ fDetector

TGeoVolume* TimeDet::fDetector
private

Overlap along y.

Definition at line 118 of file TimeDet.h.

◆ fdzBarCol

Double_t TimeDet::fdzBarCol
private

depth of the bar

Definition at line 105 of file TimeDet.h.

◆ fdzBarRow

Double_t TimeDet::fdzBarRow
private

z-distance between columns

Definition at line 106 of file TimeDet.h.

◆ fELoss

Double_t TimeDet::fELoss
private

length

Definition at line 93 of file TimeDet.h.

◆ fLength

Double_t TimeDet::fLength
private

time

Definition at line 92 of file TimeDet.h.

◆ fMom

TLorentzVector TimeDet::fMom
private

position at entrance

Definition at line 90 of file TimeDet.h.

◆ fNBars

Int_t TimeDet::fNBars
private

y-position of the detector center

Definition at line 114 of file TimeDet.h.

◆ fNCol

Int_t TimeDet::fNCol
private

z-distance between rows

Definition at line 108 of file TimeDet.h.

◆ fNRow

Int_t TimeDet::fNRow
private

Number of columns.

Definition at line 109 of file TimeDet.h.

◆ fPos

TLorentzVector TimeDet::fPos
private

volume id

Definition at line 89 of file TimeDet.h.

◆ fTime

Double_t TimeDet::fTime
private

momentum at entrance

Definition at line 91 of file TimeDet.h.

◆ fTimeDetPointCollection

TClonesArray* TimeDet::fTimeDetPointCollection
private

container for data points

Definition at line 121 of file TimeDet.h.

◆ fTrackID

Int_t TimeDet::fTrackID
private

Track information to be stored until the track leaves the active volume.

Definition at line 87 of file TimeDet.h.

◆ fVolumeID

Int_t TimeDet::fVolumeID
private

track index

Definition at line 88 of file TimeDet.h.

◆ fxBar

Double_t TimeDet::fxBar
private

height of the detector

Definition at line 101 of file TimeDet.h.

◆ fxCenter

Double_t TimeDet::fxCenter
private

Number of rows.

Definition at line 111 of file TimeDet.h.

◆ fxOv

Double_t TimeDet::fxOv
private

Number of bars.

Definition at line 115 of file TimeDet.h.

◆ fxSize

Double_t TimeDet::fxSize
private

z-position of veto station

Definition at line 98 of file TimeDet.h.

◆ fyBar

Double_t TimeDet::fyBar
private

length of the bar

Definition at line 102 of file TimeDet.h.

◆ fyCenter

Double_t TimeDet::fyCenter
private

x-position of the detector center

Definition at line 112 of file TimeDet.h.

◆ fyOv

Double_t TimeDet::fyOv
private

Overlap along x.

Definition at line 116 of file TimeDet.h.

◆ fySize

Double_t TimeDet::fySize
private

width of the detector

Definition at line 99 of file TimeDet.h.

◆ fzBar

Double_t TimeDet::fzBar
private

width of the bar

Definition at line 103 of file TimeDet.h.

◆ fzPos

Double_t TimeDet::fzPos
private

energy loss

Detector parameters.

Definition at line 96 of file TimeDet.h.


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