14 #include "FairGeoTransform.h"
15 #include "FairGeoInterface.h"
16 #include "FairGeoLoader.h"
17 #include "FairGeoNode.h"
18 #include "FairGeoMedium.h"
19 #include "FairGeoInterface.h"
20 #include "FairGeoMedia.h"
23 #include "FairGeoRootBuilder.h"
25 #include "FairRootManager.h"
26 #include "FairVolume.h"
27 #include "FairRuntimeDb.h"
32 #include "TClonesArray.h"
33 #include "TGeoManager.h"
34 #include "TLorentzVector.h"
35 #include "TParticle.h"
36 #include "TVirtualMC.h"
40 #include "TGeoMCGeometry.h"
41 #include "TObjArray.h"
42 #include "TGeoVoxelFinder.h"
43 #include "TGeoMatrix.h"
52 using std::ostringstream;
56 : FairDetector(),fListOfSensitives(),
57 par(), fTrackID(-1), fVolumeID(-1), fEventID(-1), fPosIn(), fMomIn(), fPosOut(), fMomOut(),
58 fPLout(0), fPLin(0), fTime(0), fLength(0), fELoss(0), fPosIndex(-1), fpdgCode(-1),
59 SiId(0), CId(0), alId(0), beId(0), CpipeId(0), fcharge(0), fmass(0), fdist(0), fFtofCollection(0)
76 : FairDetector(name, active),
77 fListOfSensitives(),
par(), fTrackID(-1), fVolumeID(-1), fEventID(-1), fPosIn(), fMomIn(), fPosOut(), fMomOut(),
78 fPLout(0), fPLin(0), fTime(0), fLength(0), fELoss(0), fPosIndex(-1), fpdgCode(-1),
79 SiId(0), CId(0), alId(0), beId(0), CpipeId(0), fcharge(0), fmass(0), fdist(0), fFtofCollection(0)
111 FairRun*
sim = FairRun::Instance();
112 FairRuntimeDb*
rtdb=sim->GetRuntimeDb();
115 par->setInputVersion(sim->GetRunId(),1);
118 std::cout<<
" -I- Initializing PndFtof()"<<std::endl;
121 std::cout<<
" -E- No gGeoManager in PndFtof::Initialize()!"<<std::endl;
138 if (gMC->TrackCharge()==0)
return kTRUE;
142 if ( gMC->IsTrackEntering() )
146 fTime = gMC->TrackTime() * 1.0e09;
148 fmass = gMC->TrackMass();
151 gMC->TrackPosition(
fPosIn);
152 gMC->TrackMomentum(
fMomIn);
153 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
163 gMC->TrackMomentum(PL);
165 if ( (gMC->IsTrackExiting() ||
166 gMC->IsTrackStop() ||
167 gMC->IsTrackDisappeared() ))
169 Int_t TrNo=gMC->GetStack()->GetCurrentTrackNumber();
173 gMC->CurrentVolOffID(1,cp) ;
176 TString FullName = gMC->CurrentVolPath();
210 if (fVerboseLevel)
Print();
218 FairRootManager::Instance()->Register(
"FtofPoint",
"PndFtof",
fFtofCollection, kTRUE);
237 cout <<
"-I- PndFtof: " << nHits <<
" points registered in this event."
259 Int_t nEntries = cl1->GetEntriesFast();
261 TClonesArray& clref = *cl2;
263 for (Int_t
i=0;
i<nEntries;
i++) {
265 Int_t index = oldpoint->GetTrackID() +
offset;
266 oldpoint->SetTrackID(index);
270 cout <<
" -I- PndFtof: " << cl2->GetEntriesFast() <<
" merged entries."
277 TString fileName=GetGeometryFileName();
279 if(fileName.EndsWith(
".root")){
280 ConstructRootGeometry();
291 FairGeoLoader*
geoLoad = FairGeoLoader::Instance();
292 FairGeoInterface*
geoFace = geoLoad->getGeoInterface();
294 FairGeoMedia *
Media = geoFace->getMedia();
295 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
297 FairGeoMedium *CbmMediumSci = Media->getMedium(
"polyvinyltoluene");
301 geobuild->createMedium(CbmMediumSci);
303 TGeoVolume* vcave =
gGeoManager->FindVolumeFast(vname);
329 TGeoVolumeAssembly*
SubunitVol =
new TGeoVolumeAssembly(
"Ftof_strips");
343 for(
int i=0;
i<26;
i++){
344 bx[
i]=-40+kBCentX*((2*
i)+1);
347 for(
int i=0;
i<26;
i++){
349 TGeoCombiTrans*
trc1;
352 sprintf (name,
"Centshape%d",
i);
353 sprintf (name1,
"Ftof_Central_Strip%d",
i);
355 CentShape =
new TGeoBBox(
"Centshape",kBCentX,kBCentY,kBCentZ);
356 CentVol =
new TGeoVolume(
"Ftof_Central_Strip",CentShape,
gGeoManager->GetMedium(
"polyvinyltoluene"));
357 if(
i<8)trc1=
new TGeoCombiTrans(bx[
i],0,750,
new TGeoRotation ());
358 else if (i>17)trc1=
new TGeoCombiTrans(bx[i-5],0,750,
new TGeoRotation ());
361 trc1->RegisterYourself();
362 SubunitVol->AddNode(CentVol,i,trc1);
363 AddSensitiveVolume(CentVol);
367 sprintf (namB,
"Beamshape%d",
i);
368 sprintf (namB1,
"Ftof_Beam_Strip%02d",
i);
369 BeamShape =
new TGeoBBox(
"Beamshape",kBBeamX,kBBeamY,kBBeamZ);
370 BeamVol =
new TGeoVolume(
"Ftof_Beam_Strip",BeamShape,
gGeoManager->GetMedium(
"polyvinyltoluene"));
374 (
i==8 ? (offset = -70+kBBeamY) : (offset = 70-kBBeamY));
375 TGeoCombiTrans*
trc1=
new TGeoCombiTrans(bx[8],offset,750,
new TGeoRotation ());
378 trc1->RegisterYourself();
379 SubunitVol->AddNode(BeamVol,
i,trc1);
380 AddSensitiveVolume(BeamVol);
384 (
i==10 ? (offset = -70+kBBeamY) : (offset = 70-kBBeamY));
385 TGeoCombiTrans*
trc1=
new TGeoCombiTrans(bx[9],offset,750,
new TGeoRotation ());
388 trc1->RegisterYourself();
389 SubunitVol->AddNode(BeamVol,
i,trc1);
390 AddSensitiveVolume(BeamVol);
394 (
i==12 ? (offset = -70+kBBeamY) : (offset = 70-kBBeamY));
395 TGeoCombiTrans*
trc1=
new TGeoCombiTrans(bx[10],offset,750,
new TGeoRotation ());
398 trc1->RegisterYourself();
399 SubunitVol->AddNode(BeamVol,
i,trc1);
400 AddSensitiveVolume(BeamVol);
404 (
i==14 ? (offset = -70+kBBeamY) : (offset = 70-kBBeamY));
405 TGeoCombiTrans*
trc1=
new TGeoCombiTrans(bx[11],offset,750,
new TGeoRotation ());
408 trc1->RegisterYourself();
409 SubunitVol->AddNode(BeamVol,
i,trc1);
410 AddSensitiveVolume(BeamVol);
414 (
i==16 ? (offset = -70+kBBeamY) : (offset = 70-kBBeamY));
415 TGeoCombiTrans*
trc1=
new TGeoCombiTrans(bx[12],offset,750,
new TGeoRotation ());
418 trc1->RegisterYourself();
419 SubunitVol->AddNode(BeamVol,
i,trc1);
420 AddSensitiveVolume(BeamVol);
426 for(
int i=0;
i<24;
i++){
427 bvx[
i]=-280+kBVertX*((2*
i)+1);
430 for(
int i=0;
i<26;
i++){
432 bvx[
i+24]=60+kBVertX*((2*
i)+1);
435 for(
int i=0;
i<50;
i++){
438 sprintf (namV,
"VertShape%d",
i);
439 sprintf (namV1,
"Ftof_Vertical_Strip%d",
i);
441 VertShape =
new TGeoBBox(
"VertShape",kBVertX,kBVertY,kBVertZ);
442 VertVol =
new TGeoVolume(
"Ftof_Vertical_Strip",VertShape,
gGeoManager->GetMedium(
"polyvinyltoluene"));
443 TGeoCombiTrans*
trc1=
new TGeoCombiTrans(bvx[
i],0,750,
new TGeoRotation ());
446 trc1->RegisterYourself();
447 SubunitVol->AddNode(VertVol,i,trc1);
448 AddSensitiveVolume(VertVol);
452 vcave->AddNode(SubunitVol,0,
new TGeoCombiTrans());
472 TVector3
pos, TVector3
mom,
483 Int_t size = clref.GetEntriesFast();
484 return new(clref[size])
PndFtofPoint(trackID, evtID,detID, detName,pos, mom,
486 fTime, length, eLoss,charge,
virtual void Print() const
sim(Int_t nEvents=1, TString SimEngine="TGeant4", Float_t mom=6.231552)
void ConstructASCIIGeometry()
virtual void ConstructGeometry()
virtual Bool_t ProcessHits(FairVolume *vol=0)
virtual TClonesArray * GetCollection(Int_t iColl) const
TGeoManager * gGeoManager
void AddPoint(DetectorId iDet)
FairGeoBuilder * geobuild
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
void ResetParameters()
Hit collection.
virtual void BeginEvent()
PndFtofPoint * AddHit(Int_t trackID, Int_t evtID, Int_t detID, TString detName, TVector3 posin, TVector3 momin, TVector3 posout, TVector3 momout, Double_t tof, Double_t length, Double_t eLoss, Double_t charge, Double_t mass, Int_t pdgCode, Double_t dist, Double_t PLin, Double_t PLout)
virtual void Initialize()
std::vector< std::string > fListOfSensitives
FairGeoInterface * geoFace
virtual void EndOfEvent()
bool CheckIfSensitive(std::string name)
TClonesArray * fFtofCollection