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

#include <muon.h>

Inheritance diagram for muon:
Collaboration diagram for muon:

Public Member Functions

 muon (const char *Name, Bool_t Active)
 
 muon ()
 
virtual ~muon ()
 
virtual void Initialize ()
 
virtual Bool_t ProcessHits (FairVolume *v=0)
 
virtual void Register ()
 
virtual TClonesArray * GetCollection (Int_t iColl) const
 
virtual void Reset ()
 
void SetZStationPositions (Double_t z0, Double_t z1, Double_t z2, Double_t z3)
 
void SetZFilterPositions (Double_t z0, Double_t z1, Double_t z2)
 
void SetActiveThickness (Double_t activeThickness)
 
void SetFilterThickness (Double_t filterThickness)
 
void SetXMax (Double_t xMax)
 
void SetYMax (Double_t yMax)
 
void ConstructGeometry ()
 
muonPointAddHit (Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgcode)
 
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 ()
 

Private Member Functions

 muon (const muon &)
 
muonoperator= (const muon &)
 
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 fM0z
 energy loss
 
Double_t fM1z
 z-position of veto station
 
Double_t fM2z
 z-position of tracking station 1
 
Double_t fM3z
 z-position of tracking station 2
 
Double_t fF0z
 z-position of tracking station 3
 
Double_t fF1z
 z-position of veto station
 
Double_t fF2z
 z-position of tracking station 1
 
Double_t fFilterThickness
 z-position of tracking station 2
 
Double_t fActiveThickness
 
Double_t fXMax
 
Double_t fYMax
 
TClonesArray * fmuonPointCollection
 

Detailed Description

Definition at line 13 of file muon.h.

Constructor & Destructor Documentation

◆ muon() [1/3]

muon::muon ( 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 49 of file muon.cxx.

50 : FairDetector(name, active, kMuon),
51 fTrackID(-1),
52 fVolumeID(-1),
53 fPos(),
54 fMom(),
55 fTime(-1.),
56 fLength(-1.),
57 fELoss(-1),
58 fmuonPointCollection(new TClonesArray("muonPoint"))
59{
60}
@ kMuon
TLorentzVector fMom
position at entrance
Definition muon.h:97
Int_t fTrackID
Definition muon.h:94
Double_t fLength
time
Definition muon.h:99
TClonesArray * fmuonPointCollection
Definition muon.h:115
Double_t fTime
momentum at entrance
Definition muon.h:98
Double_t fELoss
length
Definition muon.h:100
TLorentzVector fPos
volume id
Definition muon.h:96
Int_t fVolumeID
track index
Definition muon.h:95

◆ muon() [2/3]

muon::muon ( )

default constructor

Definition at line 36 of file muon.cxx.

37 : FairDetector("muon", kTRUE, kMuon),
38 fTrackID(-1),
39 fVolumeID(-1),
40 fPos(),
41 fMom(),
42 fTime(-1.),
43 fLength(-1.),
44 fELoss(-1),
45 fmuonPointCollection(new TClonesArray("muonPoint"))
46{
47}

◆ ~muon()

muon::~muon ( )
virtual

destructor

Definition at line 62 of file muon.cxx.

63{
65 fmuonPointCollection->Delete();
67 }
68}

◆ muon() [3/3]

muon::muon ( const muon )
private

Member Function Documentation

◆ AddHit()

muonPoint * muon::AddHit ( Int_t  trackID,
Int_t  detID,
TVector3  pos,
TVector3  mom,
Double_t  time,
Double_t  length,
Double_t  eLoss,
Int_t  pdgcode 
)

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

Definition at line 254 of file muon.cxx.

258{
259 TClonesArray& clref = *fmuonPointCollection;
260 Int_t size = clref.GetEntriesFast();
261 // cout << "muon hit called"<< pos.z()<<endl;
262 return new(clref[size]) muonPoint(trackID, detID, pos, mom,
263 time, length, eLoss, pdgCode);
264}

◆ BeginEvent()

virtual void muon::BeginEvent ( )
inlinevirtual

Definition at line 86 of file muon.h.

86{;}

◆ BeginPrimary()

virtual void muon::BeginPrimary ( )
inlinevirtual

Definition at line 83 of file muon.h.

83{;}

◆ ConstructGeometry()

void muon::ConstructGeometry ( )

Create the detector geometry

If you are using the standard ASCII input for the geometry just copy this and use it for your detector, otherwise you can implement here you own way of constructing the geometry.

Definition at line 200 of file muon.cxx.

201{
206 TGeoVolume *top=gGeoManager->GetTopVolume();
207 TGeoVolume *tMuon = new TGeoVolumeAssembly("MuonDetector");
208
209 InitMedium("iron");
210 InitMedium("Scintillator");
211
212 TGeoMedium *Al =gGeoManager->GetMedium("Scintillator");
213 TGeoMedium *A2 =gGeoManager->GetMedium("iron");
214
215// TGeoBBox *detbox1 = new TGeoBBox("detbox1", 250, 250, 10);
216// TGeoBBox *detbox2 = new TGeoBBox("detbox2", 245, 245, 10);
217
218// TGeoCompositeShape *detcomp1 = new TGeoCompositeShape("detcomp1", "detbox1-detbox2");
219
220// TGeoVolume *detmu1 = new TGeoVolume("MuX", detcomp1, Al);
221 TGeoVolume *muondet0 = gGeoManager->MakeBox("muondet0", Al, fXMax, fYMax, fActiveThickness);
222 TGeoVolume *muondet1 = gGeoManager->MakeBox("muondet1", Al, fXMax, fYMax, fActiveThickness);
223 TGeoVolume *muondet2 = gGeoManager->MakeBox("muondet2", Al, fXMax, fYMax, fActiveThickness);
224 TGeoVolume *muondet3 = gGeoManager->MakeBox("muondet3", Al, fXMax, fYMax, fActiveThickness);
225
226 TGeoVolume *muonfilter = gGeoManager->MakeBox("muonfilter", A2, fXMax, fYMax, fFilterThickness);
227// 10cm iron to shield against backsplash from cavern
228 TGeoVolume *muonshield = gGeoManager->MakeBox("muonshield", A2, fXMax, fYMax, 5.);
229
230 AddSensitiveVolume(muondet0);
231 AddSensitiveVolume(muondet1);
232 AddSensitiveVolume(muondet2);
233 AddSensitiveVolume(muondet3);
234 muondet0->SetLineColor(kGreen);
235 muondet1->SetLineColor(kGreen);
236 muondet2->SetLineColor(kGreen);
237 muondet3->SetLineColor(kGreen);
238 muonfilter->SetLineColor(kBlue);
239 Double_t zStartMuon = fM0z;
240 Double_t totLength = fM3z-fM0z+2*fActiveThickness+15.;
241 Double_t relPos = zStartMuon-fActiveThickness+totLength/2.;
242 tMuon->AddNode(muondet0, 1, new TGeoTranslation(0, 0, fM0z-relPos));
243 tMuon->AddNode(muonfilter, 0, new TGeoTranslation(0, 0, fF0z-relPos));
244 tMuon->AddNode(muondet1, 1, new TGeoTranslation(0, 0, fM1z-relPos));
245 tMuon->AddNode(muonfilter, 1, new TGeoTranslation(0, 0, fF1z-relPos));
246 tMuon->AddNode(muondet2, 1, new TGeoTranslation(0, 0, fM2z-relPos));
247 tMuon->AddNode(muonfilter, 2, new TGeoTranslation(0, 0, fF2z-relPos));
248 tMuon->AddNode(muondet3, 1, new TGeoTranslation(0, 0, fM3z-relPos));
249 tMuon->AddNode(muonshield, 1, new TGeoTranslation(0, 0, fM3z+fActiveThickness+10.-relPos));
250 //finish assembly and position
251 top->AddNode(tMuon, 1, new TGeoTranslation(0, 0,relPos));
252}
Double_t fF1z
z-position of veto station
Definition muon.h:106
Double_t fActiveThickness
Definition muon.h:110
Double_t fM0z
energy loss
Definition muon.h:101
Int_t InitMedium(const char *name)
Definition muon.cxx:77
Double_t fM3z
z-position of tracking station 2
Definition muon.h:104
Double_t fF0z
z-position of tracking station 3
Definition muon.h:105
Double_t fF2z
z-position of tracking station 1
Definition muon.h:107
Double_t fM1z
z-position of veto station
Definition muon.h:102
Double_t fFilterThickness
z-position of tracking station 2
Definition muon.h:109
Double_t fM2z
z-position of tracking station 1
Definition muon.h:103
Double_t fXMax
Definition muon.h:111
Double_t fYMax
Definition muon.h:112

◆ CopyClones()

virtual void muon::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 77 of file muon.h.

78 {;}

◆ EndOfEvent()

void muon::EndOfEvent ( )
virtual

Definition at line 136 of file muon.cxx.

137{
138
139 fmuonPointCollection->Clear();
140
141}

◆ FinishPrimary()

virtual void muon::FinishPrimary ( )
inlinevirtual

Definition at line 81 of file muon.h.

81{;}

◆ FinishRun()

virtual void muon::FinishRun ( )
inlinevirtual

Definition at line 82 of file muon.h.

82{;}

◆ GetCollection()

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

Gets the produced collections

Definition at line 160 of file muon.cxx.

161{
162 if (iColl == 0) { return fmuonPointCollection; }
163 else { return NULL; }
164}

◆ Initialize()

void muon::Initialize ( )
virtual

Initialization of the detector is done here

Definition at line 70 of file muon.cxx.

71{
72 FairDetector::Initialize();
73// FairRuntimeDb* rtdb= FairRun::Instance()->GetRuntimeDb();
74// muonGeoPar* par=(muonGeoPar*)(rtdb->getContainer("muonGeoPar"));
75}

◆ InitMedium()

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

Definition at line 77 of file muon.cxx.

78{
79 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
80 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
81 static FairGeoMedia *media=geoFace->getMedia();
82 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
83
84 FairGeoMedium *ShipMedium=media->getMedium(name);
85
86 if (!ShipMedium)
87 {
88 Fatal("InitMedium","Material %s not defined in media file.", name);
89 return -1111;
90 }
91 TGeoMedium* medium=gGeoManager->GetMedium(name);
92 if (medium!=NULL)
93 return ShipMedium->getMediumIndex();
94
95 return geoBuild->createMedium(ShipMedium);
96}

◆ operator=()

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

◆ PostTrack()

virtual void muon::PostTrack ( )
inlinevirtual

Definition at line 84 of file muon.h.

84{;}

◆ PreTrack()

virtual void muon::PreTrack ( )
inlinevirtual

Definition at line 85 of file muon.h.

85{;}

◆ ProcessHits()

Bool_t muon::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 97 of file muon.cxx.

98{
100 //Set parameters at entrance of volume. Reset ELoss.
101 if ( gMC->IsTrackEntering() ) {
102 fELoss = 0.;
103 fTime = gMC->TrackTime() * 1.0e09;
104 fLength = gMC->TrackLength();
105 gMC->TrackPosition(fPos);
106 gMC->TrackMomentum(fMom);
107 }
108
109 // Sum energy loss for all steps in the active volume
110 fELoss += gMC->Edep();
111
112 // Create muonPoint at exit of active volume
113 if ( gMC->IsTrackExiting() ||
114 gMC->IsTrackStop() ||
115 gMC->IsTrackDisappeared() ) {
116 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
117 //fVolumeID = vol->getMCid();
118 //cout << "muon proc "<< fVolumeID<<" "<<vol->GetName()<<" "<<vol->getVolumeId() <<endl;
119 //cout << " "<< gGeoManager->FindVolumeFast(vol->GetName())->GetNumber()<<endl;
120 fVolumeID = gGeoManager->FindVolumeFast(vol->GetName())->GetNumber();
121 if (fELoss == 0. ) { return kFALSE; }
122 TParticle* p=gMC->GetStack()->GetCurrentTrack();
123 Int_t pdgCode = p->GetPdgCode();
124 AddHit(fTrackID, fVolumeID, TVector3(fPos.X(), fPos.Y(), fPos.Z()),
125 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()), fTime, fLength,
126 fELoss,pdgCode);
127
128 // Increment number of muon det points in TParticle
129 ShipStack* stack = (ShipStack*) gMC->GetStack();
130 stack->AddPoint(kMuon);
131 }
132
133 return kTRUE;
134}
muonPoint * AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss, Int_t pdgcode)
Definition muon.cxx:254

◆ Register()

void muon::Register ( )
virtual

Registers the produced collections in FAIRRootManager.

This will create a branch in the output tree called muonPoint, 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 145 of file muon.cxx.

146{
147
154 FairRootManager::Instance()->Register("muonPoint", "muon",
155 fmuonPointCollection, kTRUE);
156
157}

◆ Reset()

void muon::Reset ( )
virtual

has to be called after each event to reset the containers

Definition at line 166 of file muon.cxx.

167{
168 fmuonPointCollection->Clear();
169}

◆ SetActiveThickness()

void muon::SetActiveThickness ( Double_t  activeThickness)

Definition at line 184 of file muon.cxx.

185{
186 fActiveThickness=activeThickness;
187}

◆ SetFilterThickness()

void muon::SetFilterThickness ( Double_t  filterThickness)

Definition at line 188 of file muon.cxx.

189{
190 fFilterThickness=filterThickness;
191}

◆ SetSpecialPhysicsCuts()

virtual void muon::SetSpecialPhysicsCuts ( )
inlinevirtual

Definition at line 79 of file muon.h.

79{;}

◆ SetXMax()

void muon::SetXMax ( Double_t  xMax)

Definition at line 192 of file muon.cxx.

193{
194 fXMax=xMax;
195}

◆ SetYMax()

void muon::SetYMax ( Double_t  yMax)

Definition at line 196 of file muon.cxx.

197{
198 fYMax=yMax;
199}

◆ SetZFilterPositions()

void muon::SetZFilterPositions ( Double_t  z0,
Double_t  z1,
Double_t  z2 
)

Definition at line 178 of file muon.cxx.

179{
180 fF0z=z0;
181 fF1z=z1;
182 fF2z=z2;
183}

◆ SetZStationPositions()

void muon::SetZStationPositions ( Double_t  z0,
Double_t  z1,
Double_t  z2,
Double_t  z3 
)

Definition at line 171 of file muon.cxx.

172{
173 fM0z=z0;
174 fM1z=z1;
175 fM2z=z2;
176 fM3z=z3;
177}

Member Data Documentation

◆ fActiveThickness

Double_t muon::fActiveThickness
private

Definition at line 110 of file muon.h.

◆ fELoss

Double_t muon::fELoss
private

length

Definition at line 100 of file muon.h.

◆ fF0z

Double_t muon::fF0z
private

z-position of tracking station 3

Definition at line 105 of file muon.h.

◆ fF1z

Double_t muon::fF1z
private

z-position of veto station

Definition at line 106 of file muon.h.

◆ fF2z

Double_t muon::fF2z
private

z-position of tracking station 1

Definition at line 107 of file muon.h.

◆ fFilterThickness

Double_t muon::fFilterThickness
private

z-position of tracking station 2

Definition at line 109 of file muon.h.

◆ fLength

Double_t muon::fLength
private

time

Definition at line 99 of file muon.h.

◆ fM0z

Double_t muon::fM0z
private

energy loss

Definition at line 101 of file muon.h.

◆ fM1z

Double_t muon::fM1z
private

z-position of veto station

Definition at line 102 of file muon.h.

◆ fM2z

Double_t muon::fM2z
private

z-position of tracking station 1

Definition at line 103 of file muon.h.

◆ fM3z

Double_t muon::fM3z
private

z-position of tracking station 2

Definition at line 104 of file muon.h.

◆ fMom

TLorentzVector muon::fMom
private

position at entrance

Definition at line 97 of file muon.h.

◆ fmuonPointCollection

TClonesArray* muon::fmuonPointCollection
private

container for data points

Definition at line 115 of file muon.h.

◆ fPos

TLorentzVector muon::fPos
private

volume id

Definition at line 96 of file muon.h.

◆ fTime

Double_t muon::fTime
private

momentum at entrance

Definition at line 98 of file muon.h.

◆ fTrackID

Int_t muon::fTrackID
private

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

Definition at line 94 of file muon.h.

◆ fVolumeID

Int_t muon::fVolumeID
private

track index

Definition at line 95 of file muon.h.

◆ fXMax

Double_t muon::fXMax
private

Definition at line 111 of file muon.h.

◆ fYMax

Double_t muon::fYMax
private

Definition at line 112 of file muon.h.


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