SND@LHC Software
Loading...
Searching...
No Matches
simpleTarget Class Reference

#include <simpleTarget.h>

Inheritance diagram for simpleTarget:
Collaboration diagram for simpleTarget:

Public Member Functions

 simpleTarget (const char *Name, Bool_t Active)
 
 simpleTarget ()
 
virtual ~simpleTarget ()
 
virtual void Initialize ()
 
virtual Bool_t ProcessHits (FairVolume *v=0)
 
virtual void Register ()
 
virtual TClonesArray * GetCollection (Int_t iColl) const
 
virtual void Reset ()
 
void ConstructGeometry ()
 
virtual void CopyClones (TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
 
virtual void SetSpecialPhysicsCuts ()
 
virtual void EndOfEvent ()
 
virtual void FinishPrimary ()
 
virtual void FinishRun ()
 
virtual void BeginPrimary ()
 
virtual void PostTrack ()
 
virtual void PreTrack ()
 
virtual void BeginEvent ()
 
vetoPointAddHit (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)
 
void SetEnergyCut (Float_t emax)
 
void SetOnlyMuons ()
 
void SetFastMuon ()
 
void SetParameters (TString m, Float_t l, Float_t z)
 

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 fzPos
 length
 
Double_t fThick
 zPos
 
Double_t fELoss
 thickness
 
Double_t fTotalEloss
 
TString fMaterial
 
Float_t EMax
 material
 
Bool_t fOnlyMuons
 max energy to transport
 
Bool_t fFastMuon
 
TFile * fout
 for fast processing
 
TClonesArray * fsimpleTargetPointCollection
 

Detailed Description

Definition at line 14 of file simpleTarget.h.

Constructor & Destructor Documentation

◆ simpleTarget() [1/2]

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

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

◆ simpleTarget() [2/2]

simpleTarget::simpleTarget ( )

default constructor

Definition at line 35 of file simpleTarget.cxx.

36 : FairDetector("simpleTarget", kTRUE, kVETO),
37 fTrackID(-1),
38 fVolumeID(-1),
39 fPos(),
40 fMom(),
41 fTime(-1.),
42 fLength(-1.),
43 fThick(-1.),
44 fOnlyMuons(kFALSE),
45 fFastMuon(kFALSE),
46 fzPos(3E8),
47 fTotalEloss(0),
48 fsimpleTargetPointCollection(new TClonesArray("vetoPoint"))
49{}
@ kVETO
Double_t fLength
time
Bool_t fOnlyMuons
max energy to transport
TLorentzVector fMom
position at entrance
Double_t fzPos
length
Double_t fTime
momentum at entrance
TClonesArray * fsimpleTargetPointCollection
Int_t fVolumeID
track index
TLorentzVector fPos
volume id
Double_t fTotalEloss
Bool_t fFastMuon
Double_t fThick
zPos

◆ ~simpleTarget()

simpleTarget::~simpleTarget ( )
virtual

destructor

Definition at line 51 of file simpleTarget.cxx.

Member Function Documentation

◆ AddHit()

vetoPoint * simpleTarget::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 at line 146 of file simpleTarget.cxx.

150{
151 TClonesArray& clref = *fsimpleTargetPointCollection;
152 Int_t size = clref.GetEntriesFast();
153 return new(clref[size]) vetoPoint(trackID, detID, pos, mom,
154 time, length, eLoss, pdgCode,Lpos,Lmom);
155}

◆ BeginEvent()

virtual void simpleTarget::BeginEvent ( )
inlinevirtual

Definition at line 64 of file simpleTarget.h.

64{;}

◆ BeginPrimary()

virtual void simpleTarget::BeginPrimary ( )
inlinevirtual

Definition at line 61 of file simpleTarget.h.

61{;}

◆ ConstructGeometry()

void simpleTarget::ConstructGeometry ( )

Create the detector geometry

Definition at line 128 of file simpleTarget.cxx.

129{
130 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
131 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
132 static FairGeoMedia *media=geoFace->getMedia();
133 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
134
135 FairGeoMedium *ShipMedium=media->getMedium(fMaterial);
136 TGeoMedium* mat=gGeoManager->GetMedium(fMaterial);
137 if (mat==NULL)
138 geoBuild->createMedium(ShipMedium);
139 mat =gGeoManager->GetMedium(fMaterial);
140 TGeoVolume *top=gGeoManager->GetTopVolume();
141 TGeoVolume *target = gGeoManager->MakeBox("target",mat,10.*100.,10.*100.,fThick);
142 top->AddNode(target, 1, new TGeoTranslation(0, 0, fzPos));
143 AddSensitiveVolume(target);
144}
TString fMaterial

◆ CopyClones()

virtual void simpleTarget::CopyClones ( TClonesArray *  cl1,
TClonesArray *  cl2,
Int_t  offset 
)
inlinevirtual

The following methods can be implemented if you need to make any optional action in your detector during the transport.

Definition at line 55 of file simpleTarget.h.

56 {;}

◆ EndOfEvent()

void simpleTarget::EndOfEvent ( )
virtual

Definition at line 121 of file simpleTarget.cxx.

122{
124 fTotalEloss=0;
125}

◆ FinishPrimary()

virtual void simpleTarget::FinishPrimary ( )
inlinevirtual

Definition at line 59 of file simpleTarget.h.

59{;}

◆ FinishRun()

virtual void simpleTarget::FinishRun ( )
inlinevirtual

Definition at line 60 of file simpleTarget.h.

60{;}

◆ GetCollection()

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

Gets the produced collections

Definition at line 171 of file simpleTarget.cxx.

172{
173 if (iColl == 0) { return fsimpleTargetPointCollection; }
174 else { return NULL; }
175}

◆ Initialize()

void simpleTarget::Initialize ( )
virtual

Initialization of the detector is done here

Definition at line 114 of file simpleTarget.cxx.

115{
116 FairDetector::Initialize();
117 TSeqCollection* fileList=gROOT->GetListOfFiles();
118 fout = ((TFile*)fileList->At(0));
119}
TFile * fout
for fast processing

◆ PostTrack()

virtual void simpleTarget::PostTrack ( )
inlinevirtual

Definition at line 62 of file simpleTarget.h.

62{;}

◆ PreTrack()

void simpleTarget::PreTrack ( )
virtual

Definition at line 157 of file simpleTarget.cxx.

157 {
158 if (!fFastMuon){return;}
159 if (TMath::Abs(gMC->TrackPid())!=13){
160 gMC->StopTrack();
161 }
162}

◆ ProcessHits()

Bool_t simpleTarget::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 59 of file simpleTarget.cxx.

60{
62 //Set parameters at entrance of volume. Reset ELoss.
63 if ( gMC->IsTrackEntering() ) {
64 fELoss = 0.;
65 fTime = gMC->TrackTime() * 1.0e09;
66 fLength = gMC->TrackLength();
67 gMC->TrackPosition(fPos);
68 gMC->TrackMomentum(fMom);
69 }
70 // Sum energy loss for all steps in the active volume
71 fELoss += gMC->Edep();
72
73 // Create vetoPoint at exit of active volume
74 if ( gMC->IsTrackExiting() ||
75 gMC->IsTrackStop() ||
76 gMC->IsTrackDisappeared() ) {
77 if (fELoss == 0. ) { return kFALSE; }
78 // if (fOnlyMuons and fPos.Z()<140){ used for LiquidKrypton study
79 if (fOnlyMuons){
81 TClonesArray& clref = *fsimpleTargetPointCollection;
82 new (clref[0]) vetoPoint(0, 0, TVector3(0, 0, 0), TVector3(0, 0, 0),
83 0, 0, fTotalEloss, 0,TVector3(0, 0, 0), TVector3(0, 0, 0));
84 return kTRUE;}
85
86 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
87
88 Int_t veto_uniqueId;
89 gMC->CurrentVolID(veto_uniqueId);
90
91 TParticle* p=gMC->GetStack()->GetCurrentTrack();
92 Int_t pdgCode = p->GetPdgCode();
93 TLorentzVector Pos;
94 gMC->TrackPosition(Pos);
95 TLorentzVector Mom;
96 gMC->TrackMomentum(Mom);
97 Double_t xmean = (fPos.X()+Pos.X())/2. ;
98 Double_t ymean = (fPos.Y()+Pos.Y())/2. ;
99 Double_t zmean = (fPos.Z()+Pos.Z())/2. ;
100 //cout << veto_uniqueId << " :(" << xmean << ", " << ymean << ", " << zmean << "): " << fELoss << endl;
101 AddHit(fTrackID, veto_uniqueId, TVector3(xmean, ymean, zmean),
102 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
103 fELoss,pdgCode,TVector3(Pos.X(), Pos.Y(), Pos.Z()),TVector3(Mom.Px(), Mom.Py(), Mom.Pz()) );
104
105 // Increment number of veto det points in TParticle
106 ShipStack* stack = (ShipStack*) gMC->GetStack();
107 stack->AddPoint(kVETO);
108 }
109
110 return kTRUE;
111}
Double_t fELoss
thickness
vetoPoint * 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)

◆ Register()

void simpleTarget::Register ( )
virtual

Registers the produced collections in FAIRRootManager.

Definition at line 164 of file simpleTarget.cxx.

165{
166
167 FairRootManager::Instance()->Register("vetoPoint", "veto",
169}

◆ Reset()

void simpleTarget::Reset ( )
virtual

has to be called after each event to reset the containers

Definition at line 176 of file simpleTarget.cxx.

177{
179}

◆ SetEnergyCut()

void simpleTarget::SetEnergyCut ( Float_t  emax)
inline

Definition at line 70 of file simpleTarget.h.

70{EMax=emax;}// min energy to be copied to Geant4
Float_t EMax
material

◆ SetFastMuon()

void simpleTarget::SetFastMuon ( )
inline

Definition at line 72 of file simpleTarget.h.

72{fFastMuon=kTRUE;}

◆ SetOnlyMuons()

void simpleTarget::SetOnlyMuons ( )
inline

Definition at line 71 of file simpleTarget.h.

71{fOnlyMuons=kTRUE;}

◆ SetParameters()

void simpleTarget::SetParameters ( TString  m,
Float_t  l,
Float_t  z 
)
inline

Definition at line 73 of file simpleTarget.h.

◆ SetSpecialPhysicsCuts()

virtual void simpleTarget::SetSpecialPhysicsCuts ( )
inlinevirtual

Definition at line 57 of file simpleTarget.h.

57{;}

Member Data Documentation

◆ EMax

Float_t simpleTarget::EMax
private

material

Definition at line 91 of file simpleTarget.h.

◆ fELoss

Double_t simpleTarget::fELoss
private

thickness

Definition at line 88 of file simpleTarget.h.

◆ fFastMuon

Bool_t simpleTarget::fFastMuon
private

Definition at line 93 of file simpleTarget.h.

◆ fLength

Double_t simpleTarget::fLength
private

time

Definition at line 85 of file simpleTarget.h.

◆ fMaterial

TString simpleTarget::fMaterial
private

Definition at line 90 of file simpleTarget.h.

◆ fMom

TLorentzVector simpleTarget::fMom
private

position at entrance

Definition at line 83 of file simpleTarget.h.

◆ fOnlyMuons

Bool_t simpleTarget::fOnlyMuons
private

max energy to transport

Definition at line 92 of file simpleTarget.h.

◆ fout

TFile* simpleTarget::fout
private

for fast processing

Definition at line 94 of file simpleTarget.h.

◆ fPos

TLorentzVector simpleTarget::fPos
private

volume id

Definition at line 82 of file simpleTarget.h.

◆ fsimpleTargetPointCollection

TClonesArray* simpleTarget::fsimpleTargetPointCollection
private

container for data points

Definition at line 96 of file simpleTarget.h.

◆ fThick

Double_t simpleTarget::fThick
private

zPos

Definition at line 87 of file simpleTarget.h.

◆ fTime

Double_t simpleTarget::fTime
private

momentum at entrance

Definition at line 84 of file simpleTarget.h.

◆ fTotalEloss

Double_t simpleTarget::fTotalEloss
private

Definition at line 89 of file simpleTarget.h.

◆ fTrackID

Int_t simpleTarget::fTrackID
private

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

Definition at line 80 of file simpleTarget.h.

◆ fVolumeID

Int_t simpleTarget::fVolumeID
private

track index

Definition at line 81 of file simpleTarget.h.

◆ fzPos

Double_t simpleTarget::fzPos
private

length

Definition at line 86 of file simpleTarget.h.


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