9#include "FairGeoVolume.h"
10#include "FairGeoNode.h"
11#include "FairRootManager.h"
12#include "FairGeoLoader.h"
13#include "FairGeoInterface.h"
14#include "FairGeoMedia.h"
15#include "FairGeoBuilder.h"
17#include "FairRuntimeDb.h"
21#include "TClonesArray.h"
22#include "TVirtualMC.h"
23#include "TGeoManager.h"
25#include "TGeoCompositeShape.h"
27#include "TGeoMaterial.h"
28#include "TGeoMedium.h"
40 : FairDetector(
"TimeDet", kTRUE,
kTimeDet),
64 fTimeDetPointCollection(new TClonesArray(
"TimeDetPoint"))
74 : FairDetector(name, active,
kTimeDet),
98 fTimeDetPointCollection(new TClonesArray(
"TimeDetPoint"))
108 FairDetector::Initialize();
125 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
126 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
127 static FairGeoMedia *media=geoFace->getMedia();
128 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
130 FairGeoMedium *ShipMedium=media->getMedium(name);
134 Fatal(
"InitMedium",
"Material %s not defined in media file.", name);
137 TGeoMedium* medium=gGeoManager->GetMedium(name);
139 return ShipMedium->getMediumIndex();
141 return geoBuild->createMedium(ShipMedium);
152 if ( gMC->IsTrackEntering() ) {
154 fTime = gMC->TrackTime() * 1.0e09;
156 gMC->TrackPosition(
fPos);
157 gMC->TrackMomentum(
fMom);
164 if ( gMC->IsTrackExiting() ||
165 gMC->IsTrackStop() ||
166 gMC->IsTrackDisappeared() ) {
167 if (
fELoss == 0. ) {
return kFALSE; }
169 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
172 gMC->CurrentVolID(uniqueId);
173 if (uniqueId>1000000)
176 gMC->CurrentVolOffID(1, vcpy);
177 if (vcpy==5) uniqueId+=4;
180 TParticle* p = gMC->GetStack()->GetCurrentTrack();
181 Int_t pdgCode = p->GetPdgCode();
183 gMC->TrackPosition(Pos);
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. ;
194 fELoss,pdgCode,TVector3(Pos.X(), Pos.Y(), Pos.Z()),
195 TVector3(Mom.Px(), Mom.Py(), Mom.Pz()) );
223 FairRootManager::Instance()->Register(
"TimeDetPoint",
"TimeDet",
232 else {
return NULL; }
246 TGeoVolume *top = gGeoManager->GetTopVolume();
249 TGeoMedium *Scint =gGeoManager->GetMedium(
"polyvinyltoluene");
253 fDetector =
new TGeoVolumeAssembly(
"Timing Detector");
255 TGeoVolume *plate = gGeoManager->MakeBox(
"TimeDet", Scint,
fxBar/2,
fyBar/2,
fzBar/2);
256 plate->SetLineColor(kBlue);
257 AddSensitiveVolume(plate);
259 for(
int ib=0; ib<
fNBars; ib++) {
264 double xbar=0,ybar=0,zbar=0;
269 fDetector->AddNode(plate, ib,
new TGeoTranslation( xbar,ybar,zbar) );
284 TVector3 pos, TVector3 mom,
285 Double_t time, Double_t length,
286 Double_t eLoss, Int_t pdgCode,TVector3 Lpos, TVector3 Lmom)
289 Int_t size = clref.GetEntriesFast();
291 return new(clref[size])
TimeDetPoint(trackID, detID, pos, mom,
292 time, length, eLoss, pdgCode,Lpos,Lmom);
TGeoVolume * fDetector
Overlap along y.
Double_t fxSize
z-position of veto station
Double_t fxBar
height of the detector
Double_t fTime
momentum at entrance
Double_t fyOv
Overlap along x.
Double_t fxCenter
Number of rows.
void GetBarRowCol(int ib, int &irow, int &icol) const
double GetXCol(int ic) const
Int_t fNRow
Number of columns.
Int_t fNBars
y-position of the detector center
Double_t fdzBarRow
z-distance between columns
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)
Int_t InitMedium(const char *name)
Double_t fySize
width of the detector
Double_t fyBar
length of the bar
Double_t fzPos
energy loss
Double_t fyCenter
x-position of the detector center
virtual TClonesArray * GetCollection(Int_t iColl) const
Double_t fzBar
width of the bar
TClonesArray * fTimeDetPointCollection
Int_t fNCol
z-distance between rows
TLorentzVector fMom
position at entrance
Double_t fdzBarCol
depth of the bar
double GetZBar(int ir, int ic) const
virtual Bool_t ProcessHits(FairVolume *v=0)
virtual void EndOfEvent()
TLorentzVector fPos
volume id
virtual void Initialize()
Double_t fxOv
Number of bars.
double GetYRow(int ir) const
ClassImp(ecalContFact) ecalContFact