Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Florian Uhlig
cbmroot
Commits
e62a1bc3
Commit
e62a1bc3
authored
Jun 03, 2022
by
Administrator
Browse files
Remove global pointer gMC
Use the static TVirualMC::GetMC() method instead of the global pointer.
parent
12b9884d
Changes
12
Hide whitespace changes
Inline
Side-by-side
analysis/PWGDIL/dielectron/papaframework/fastsim/CbmFastDecayer.cxx
View file @
e62a1bc3
...
...
@@ -103,7 +103,7 @@ Bool_t CbmFastDecayer::ReadEvent(FairPrimaryGenerator* primGen)
}
// ---> Check for particle stack
fStack
=
dynamic_cast
<
CbmStack
*>
(
gMC
->
GetStack
());
fStack
=
dynamic_cast
<
CbmStack
*>
(
TVirtualMC
::
GetMC
()
->
GetStack
());
if
(
!
fStack
)
{
Error
(
"ReadEvent"
,
"Error: No stack found!"
);
return
kFALSE
;
...
...
analysis/PWGDIL/dielectron/papaframework/fastsim/CbmFastSim.cxx
View file @
e62a1bc3
...
...
@@ -220,7 +220,7 @@ void CbmFastSim::Exec(Option_t* opt)
///
/// get mc stack of generated particles
CbmStack
*
fStack
=
(
CbmStack
*
)
gMC
->
GetStack
();
CbmStack
*
fStack
=
(
CbmStack
*
)
TVirtualMC
::
GetGetMC
()
->
GetStack
();
Int_t
nTracks
=
fStack
->
GetNtrack
();
// Info("Exec","number of tracks **** %d",Tracks);
...
...
core/detectors/tof/CbmTofGeoHandler.cxx
View file @
e62a1bc3
...
...
@@ -22,7 +22,7 @@
#include
<TGeoVolume.h>
// for TGeoVolume
#include
<TObjArray.h>
// for TObjArray
#include
<TObject.h>
// for TObject
#include
<TVirtualMC.h>
// for TVirtualMC
, gMC
#include
<TVirtualMC.h>
// for TVirtualMC
#include
<string.h>
// for strlen, strncpy
...
...
@@ -48,7 +48,7 @@ Int_t CbmTofGeoHandler::Init(Bool_t isSimulation)
fIsSimulation
=
isSimulation
;
if
(
fIsSimulation
)
{
TString
tVirtualMCName
=
gMC
->
GetName
();
TString
tVirtualMCName
=
TVirtualMC
::
GetMC
()
->
GetName
();
if
(
tVirtualMCName
==
"TGeant3TGeo"
)
{
fMCVersion
=
0
;
}
else
if
(
tVirtualMCName
==
"TGeant4"
)
{
...
...
@@ -410,7 +410,7 @@ Int_t CbmTofGeoHandler::VolIdGeo(const char* name) const
Int_t
CbmTofGeoHandler
::
VolId
(
const
Text_t
*
name
)
const
{
if
(
fIsSimulation
)
{
return
gMC
->
VolId
(
name
);
}
if
(
fIsSimulation
)
{
return
TVirtualMC
::
GetMC
()
->
VolId
(
name
);
}
else
{
//
// Return the unique numeric identifier for volume name
...
...
@@ -426,7 +426,7 @@ Int_t CbmTofGeoHandler::VolId(const Text_t* name) const
Int_t
CbmTofGeoHandler
::
CurrentVolID
(
Int_t
&
copy
)
const
{
if
(
fIsSimulation
)
{
return
gMC
->
CurrentVolID
(
copy
);
}
if
(
fIsSimulation
)
{
return
TVirtualMC
::
GetMC
()
->
CurrentVolID
(
copy
);
}
else
{
//
// Returns the current volume ID and copy number
...
...
@@ -442,7 +442,7 @@ Int_t CbmTofGeoHandler::CurrentVolID(Int_t& copy) const
//_____________________________________________________________________________
Int_t
CbmTofGeoHandler
::
CurrentVolOffID
(
Int_t
off
,
Int_t
&
copy
)
const
{
if
(
fIsSimulation
)
{
return
gMC
->
CurrentVolOffID
(
off
,
copy
);
}
if
(
fIsSimulation
)
{
return
TVirtualMC
::
GetMC
()
->
CurrentVolOffID
(
off
,
copy
);
}
else
{
//
// Return the current volume "off" upward in the geometrical tree
...
...
@@ -460,7 +460,7 @@ Int_t CbmTofGeoHandler::CurrentVolOffID(Int_t off, Int_t& copy) const
//_____________________________________________________________________________
const
char
*
CbmTofGeoHandler
::
CurrentVolName
()
const
{
if
(
fIsSimulation
)
{
return
gMC
->
CurrentVolName
();
}
if
(
fIsSimulation
)
{
return
TVirtualMC
::
GetMC
()
->
CurrentVolName
();
}
else
{
//
// Returns the current volume name
...
...
@@ -473,7 +473,7 @@ const char* CbmTofGeoHandler::CurrentVolName() const
//_____________________________________________________________________________
const
char
*
CbmTofGeoHandler
::
CurrentVolOffName
(
Int_t
off
)
const
{
if
(
fIsSimulation
)
{
return
gMC
->
CurrentVolOffName
(
off
);
}
if
(
fIsSimulation
)
{
return
TVirtualMC
::
GetMC
()
->
CurrentVolOffName
(
off
);
}
else
{
//
// Return the current volume "off" upward in the geometrical tree
...
...
core/detectors/trd/CbmTrdGeoHandler.cxx
View file @
e62a1bc3
...
...
@@ -20,7 +20,7 @@
#include
<TGeoVolume.h>
// for TGeoVolume
#include
<TObjArray.h>
// for TObjArray
#include
<TObject.h>
// for TObject
#include
<TVirtualMC.h>
// for TVirtualMC
, gMC
#include
<TVirtualMC.h>
// for TVirtualMC
#include
<cstdlib>
// for atoi
#include
<iostream>
// for string
...
...
@@ -55,12 +55,12 @@ Int_t CbmTrdGeoHandler::GetModuleAddress()
{
// In the simulation we can not rely on the TGeoManager information
// In the simulation we get the correct information only from
gMC
// In the simulation we get the correct information only from
TVirtualMC::GetMC()
Int_t
copyNr
;
if
(
fIsSimulation
)
{
LOG
(
debug4
)
<<
gMC
->
CurrentVolPath
();
LOG
(
debug4
)
<<
TVirtualMC
::
GetMC
()
->
CurrentVolPath
();
// get the copy number of the mother volume (1 volume up in hierarchy)
gMC
->
CurrentVolOffID
(
1
,
copyNr
);
TVirtualMC
::
GetMC
()
->
CurrentVolOffID
(
1
,
copyNr
);
}
else
{
LOG
(
debug4
)
<<
gGeoManager
->
GetPath
();
...
...
mvd/CbmMvd.cxx
View file @
e62a1bc3
...
...
@@ -109,31 +109,31 @@ Bool_t CbmMvd::ProcessHits(FairVolume* /*vol*/)
// Store track parameters at entrance of sensitive volume
if
(
gMC
->
IsTrackEntering
())
{
fPdg
=
gMC
->
TrackPid
();
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
fPdg
=
TVirtualMC
::
GetMC
()
->
TrackPid
();
fELoss
=
0.
;
fTime
=
gMC
->
TrackTime
()
*
1.0e09
;
fLength
=
gMC
->
TrackLength
();
gMC
->
TrackPosition
(
fPosIn
);
gMC
->
TrackMomentum
(
fMomIn
);
fTime
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
fLength
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
TVirtualMC
::
GetMC
()
->
TrackPosition
(
fPosIn
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
fMomIn
);
}
// Sum energy loss for all steps in the active volume
fELoss
+=
gMC
->
Edep
();
fELoss
+=
TVirtualMC
::
GetMC
()
->
Edep
();
// Set additional parameters at exit of active volume. Create CbmMvdPoint.
if
(
gMC
->
IsTrackExiting
()
||
gMC
->
IsTrackStop
()
||
gMC
->
IsTrackDisappeared
())
{
fTrackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
gMC
->
TrackPosition
(
fPosOut
);
gMC
->
TrackMomentum
(
fMomOut
);
const
char
*
address
=
gMC
->
CurrentVolPath
();
if
(
TVirtualMC
::
GetMC
()
->
IsTrackExiting
()
||
TVirtualMC
::
GetMC
()
->
IsTrackStop
()
||
TVirtualMC
::
GetMC
()
->
IsTrackDisappeared
())
{
fTrackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
TVirtualMC
::
GetMC
()
->
TrackPosition
(
fPosOut
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
fMomOut
);
const
char
*
address
=
TVirtualMC
::
GetMC
()
->
CurrentVolPath
();
TString
stAdd
(
address
);
if
(
stAdd
.
Contains
(
"/MVDscripted_0"
))
{
fVolumeID
=
fmvdHandler
->
GetIDfromPath
(
stAdd
);
}
else
{
Int_t
copyNo
;
fVolumeID
=
gMC
->
CurrentVolID
(
copyNo
);
fVolumeID
=
TVirtualMC
::
GetMC
()
->
CurrentVolID
(
copyNo
);
}
if
(
fELoss
==
0.
)
return
kFALSE
;
AddHit
(
fTrackID
,
fPdg
,
fStationMap
[
fVolumeID
],
TVector3
(
fPosIn
.
X
(),
fPosIn
.
Y
(),
fPosIn
.
Z
()),
...
...
@@ -141,7 +141,7 @@ Bool_t CbmMvd::ProcessHits(FairVolume* /*vol*/)
TVector3
(
fMomOut
.
Px
(),
fMomOut
.
Py
(),
fMomOut
.
Pz
()),
fTime
,
fLength
,
fELoss
);
// Increment number of MvdPoints for this track
CbmStack
*
stack
=
(
CbmStack
*
)
gMC
->
GetStack
();
CbmStack
*
stack
=
(
CbmStack
*
)
TVirtualMC
::
GetMC
()
->
GetStack
();
stack
->
AddPoint
(
ECbmModuleId
::
kMvd
);
ResetParameters
();
...
...
sim/detectors/much/CbmMuch.cxx
View file @
e62a1bc3
...
...
@@ -134,22 +134,22 @@ CbmMuch::~CbmMuch()
Bool_t
CbmMuch
::
ProcessHits
(
FairVolume
*
/*vol*/
)
{
// cout<<" called process Hit****************** "<<endl;
if
(
gMC
->
IsTrackEntering
())
{
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
fELoss
=
0.
;
fTime
=
gMC
->
TrackTime
()
*
1.0e09
;
fLength
=
gMC
->
TrackLength
();
gMC
->
TrackPosition
(
fPosIn
);
gMC
->
TrackMomentum
(
fMomIn
);
fTime
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
fLength
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
TVirtualMC
::
GetMC
()
->
TrackPosition
(
fPosIn
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
fMomIn
);
}
// Sum energy loss for all steps in the active volume
fELoss
+=
gMC
->
Edep
();
fELoss
+=
TVirtualMC
::
GetMC
()
->
Edep
();
// Set additional parameters at exit of active volume. Create CbmMuchPoint.
if
(
gMC
->
IsTrackExiting
()
||
gMC
->
IsTrackStop
()
||
gMC
->
IsTrackDisappeared
())
{
fTrackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
if
(
TVirtualMC
::
GetMC
()
->
IsTrackExiting
()
||
TVirtualMC
::
GetMC
()
->
IsTrackStop
()
||
TVirtualMC
::
GetMC
()
->
IsTrackDisappeared
())
{
fTrackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
Int_t
copyNo
;
fVolumeID
=
gMC
->
CurrentVolID
(
copyNo
);
fVolumeID
=
TVirtualMC
::
GetMC
()
->
CurrentVolID
(
copyNo
);
Int_t
fDetectorId
=
GetDetId
();
// cout<<" check det ID 2 "<<fDetectorId<<endl;
if
(
fVerboseLevel
>
2
)
{
...
...
@@ -161,8 +161,8 @@ Bool_t CbmMuch::ProcessHits(FairVolume* /*vol*/)
printf
(
" Module: %i"
,
CbmMuchAddress
::
GetModuleIndex
(
fDetectorId
));
printf
(
" Vol %i
\n
"
,
fVolumeID
);
}
gMC
->
TrackPosition
(
fPosOut
);
gMC
->
TrackMomentum
(
fMomOut
);
TVirtualMC
::
GetMC
()
->
TrackPosition
(
fPosOut
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
fMomOut
);
/*
Int_t iStation = CbmMuchAddress::GetStationIndex(fDetectorId);
assert(iStation >= 0 && iStation < fPar->GetNStations());
...
...
@@ -182,7 +182,7 @@ Bool_t CbmMuch::ProcessHits(FairVolume* /*vol*/)
//if (fPosOut.Z()>250) printf("%f\n",fPosOut.Z());
// Increment number of MuchPoints for this track
CbmStack
*
stack
=
(
CbmStack
*
)
gMC
->
GetStack
();
CbmStack
*
stack
=
(
CbmStack
*
)
TVirtualMC
::
GetMC
()
->
GetStack
();
stack
->
AddPoint
(
ECbmModuleId
::
kMuch
);
ResetParameters
();
...
...
@@ -195,7 +195,7 @@ Bool_t CbmMuch::ProcessHits(FairVolume* /*vol*/)
Int_t
CbmMuch
::
GetDetId
(
/*FairVolume* vol*/
)
{
TString
name
=
gMC
->
CurrentVolName
();
TString
name
=
TVirtualMC
::
GetMC
()
->
CurrentVolName
();
Char_t
cStationNr
[
3
]
=
{
name
[
11
],
name
[
12
],
' '
};
Int_t
iStation
=
atoi
(
cStationNr
)
-
1
;
Int_t
iLayer
=
TString
(
name
[
18
]).
Atoi
()
-
1
;
...
...
sim/detectors/psd/CbmPsdMC.cxx
View file @
e62a1bc3
...
...
@@ -174,29 +174,29 @@ Bool_t CbmPsdMC::ProcessHits(FairVolume*)
{
// No action for neutral particles
if
(
TMath
::
Abs
(
gMC
->
TrackCharge
())
<=
0
)
return
kFALSE
;
if
(
TMath
::
Abs
(
TVirtualMC
::
GetMC
()
->
TrackCharge
())
<=
0
)
return
kFALSE
;
// --- If this is the first step for the track in the volume:
// Reset energy loss and store track parameters
if
(
gMC
->
IsTrackEntering
())
{
fTrackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
fTrackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
gMC
->
CurrentVolOffID
(
1
,
fLayerID
);
gMC
->
CurrentVolOffID
(
3
,
fModuleID
);
TVirtualMC
::
GetMC
()
->
CurrentVolOffID
(
1
,
fLayerID
);
TVirtualMC
::
GetMC
()
->
CurrentVolOffID
(
3
,
fModuleID
);
fAddress
=
fLayerID
;
gMC
->
TrackPosition
(
fPos
);
gMC
->
TrackMomentum
(
fMom
);
fTime
=
gMC
->
TrackTime
()
*
1.0e09
;
fLength
=
gMC
->
TrackLength
();
TVirtualMC
::
GetMC
()
->
TrackPosition
(
fPos
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
fMom
);
fTime
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
fLength
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
fEloss
=
0.
;
}
//? track entering
// --- For all steps within active volume: sum up differential energy loss
fEloss
+=
gMC
->
Edep
();
fEloss
+=
TVirtualMC
::
GetMC
()
->
Edep
();
// --- If track is leaving: get track parameters and create CbmstsPoint
if
(
gMC
->
IsTrackExiting
()
||
gMC
->
IsTrackStop
()
||
gMC
->
IsTrackDisappeared
())
{
if
(
TVirtualMC
::
GetMC
()
->
IsTrackExiting
()
||
TVirtualMC
::
GetMC
()
->
IsTrackStop
()
||
TVirtualMC
::
GetMC
()
->
IsTrackDisappeared
())
{
// Create CbmPsdPoint
Int_t
size
=
fPsdPoints
->
GetEntriesFast
();
...
...
@@ -205,7 +205,7 @@ Bool_t CbmPsdMC::ProcessHits(FairVolume*)
psdPoint
->
SetModuleID
(
fModuleID
+
1
);
// --- Increment number of PsdPoints for this track in the stack
CbmStack
*
stack
=
dynamic_cast
<
CbmStack
*>
(
gMC
->
GetStack
());
CbmStack
*
stack
=
dynamic_cast
<
CbmStack
*>
(
TVirtualMC
::
GetMC
()
->
GetStack
());
assert
(
stack
);
stack
->
AddPoint
(
ECbmModuleId
::
kPsd
);
...
...
sim/detectors/rich/CbmRich.cxx
View file @
e62a1bc3
...
...
@@ -104,24 +104,24 @@ Bool_t CbmRich::CheckIfSensitive(std::string name) { return IsSensitive(name); }
Bool_t
CbmRich
::
ProcessHits
(
FairVolume
*
/*vol*/
)
{
Int_t
pdgCode
=
gMC
->
TrackPid
();
Int_t
pdgCode
=
TVirtualMC
::
GetMC
()
->
TrackPid
();
Int_t
copyNo
;
Int_t
iVol
=
gMC
->
CurrentVolID
(
copyNo
);
TString
volName
=
gMC
->
CurrentVolName
();
Int_t
iVol
=
TVirtualMC
::
GetMC
()
->
CurrentVolID
(
copyNo
);
TString
volName
=
TVirtualMC
::
GetMC
()
->
CurrentVolName
();
if
(
volName
.
Contains
(
"pmt_pixel"
))
{
if
(
gMC
->
IsTrackEntering
())
{
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
// cout << gGeoManager->GetPath() << endl;
TParticle
*
part
=
gMC
->
GetStack
()
->
GetCurrentTrack
();
TParticle
*
part
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrack
();
Double_t
charge
=
part
->
GetPDG
()
->
Charge
()
/
3.
;
Int_t
trackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
Double_t
time
=
gMC
->
TrackTime
()
*
1.0e09
;
Double_t
length
=
gMC
->
TrackLength
();
Double_t
eLoss
=
gMC
->
Edep
();
Int_t
trackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
Double_t
time
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
Double_t
length
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
Double_t
eLoss
=
TVirtualMC
::
GetMC
()
->
Edep
();
TLorentzVector
tPos
,
tMom
;
gMC
->
TrackPosition
(
tPos
);
gMC
->
TrackMomentum
(
tMom
);
TVirtualMC
::
GetMC
()
->
TrackPosition
(
tPos
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
tMom
);
if
(
pdgCode
==
50000050
)
{
// Cherenkovs only
...
...
@@ -129,7 +129,7 @@ Bool_t CbmRich::ProcessHits(FairVolume* /*vol*/)
length
,
eLoss
);
// Increment number of RichPoints for this track
CbmStack
*
stack
=
(
CbmStack
*
)
gMC
->
GetStack
();
CbmStack
*
stack
=
(
CbmStack
*
)
TVirtualMC
::
GetMC
()
->
GetStack
();
stack
->
AddPoint
(
ECbmModuleId
::
kRich
);
return
kTRUE
;
}
...
...
@@ -142,7 +142,7 @@ Bool_t CbmRich::ProcessHits(FairVolume* /*vol*/)
length
,
eLoss
);
// Increment number of RichPoints for this track
CbmStack
*
stack
=
(
CbmStack
*
)
gMC
->
GetStack
();
CbmStack
*
stack
=
(
CbmStack
*
)
TVirtualMC
::
GetMC
()
->
GetStack
();
stack
->
AddPoint
(
ECbmModuleId
::
kRich
);
return
kTRUE
;
}
...
...
@@ -154,26 +154,26 @@ Bool_t CbmRich::ProcessHits(FairVolume* /*vol*/)
if
(
volName
.
Contains
(
"sens_plane"
))
{
// cout << volName << endl;
// Collecting points of tracks and imaginary plane intersection
if
(
gMC
->
IsTrackEntering
())
{
TParticle
*
part
=
gMC
->
GetStack
()
->
GetCurrentTrack
();
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
TParticle
*
part
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrack
();
Double_t
charge
=
part
->
GetPDG
()
->
Charge
()
/
3.
;
if
((
fRegisterPhotonsOnSensitivePlane
&&
pdgCode
==
50000050
)
||
(
!
fRegisterPhotonsOnSensitivePlane
&&
charge
!=
0.
))
{
Int_t
trackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
Double_t
time
=
gMC
->
TrackTime
()
*
1.0e09
;
Double_t
length
=
gMC
->
TrackLength
();
Double_t
eLoss
=
gMC
->
Edep
();
Int_t
trackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
Double_t
time
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
Double_t
length
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
Double_t
eLoss
=
TVirtualMC
::
GetMC
()
->
Edep
();
TLorentzVector
tPos
,
tMom
;
gMC
->
TrackPosition
(
tPos
);
gMC
->
TrackMomentum
(
tMom
);
TVirtualMC
::
GetMC
()
->
TrackPosition
(
tPos
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
tMom
);
AddRefPlaneHit
(
trackID
,
iVol
,
TVector3
(
tPos
.
X
(),
tPos
.
Y
(),
tPos
.
Z
()),
TVector3
(
tMom
.
Px
(),
tMom
.
Py
(),
tMom
.
Pz
()),
time
,
length
,
eLoss
);
//Increment number of RefPlanePoints for this track
CbmStack
*
stack
=
(
CbmStack
*
)
gMC
->
GetStack
();
CbmStack
*
stack
=
(
CbmStack
*
)
TVirtualMC
::
GetMC
()
->
GetStack
();
stack
->
AddPoint
(
ECbmModuleId
::
kRef
);
return
kTRUE
;
}
...
...
@@ -188,20 +188,20 @@ Bool_t CbmRich::ProcessHits(FairVolume* /*vol*/)
if
(
isMirror
)
{
// Collecting points
if
(
gMC
->
IsTrackEntering
())
{
TParticle
*
part
=
gMC
->
GetStack
()
->
GetCurrentTrack
();
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
TParticle
*
part
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrack
();
Double_t
charge
=
part
->
GetPDG
()
->
Charge
()
/
3.
;
if
(
charge
!=
0.
)
{
Int_t
trackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
Int_t
trackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
Double_t
time
=
gMC
->
TrackTime
()
*
1.0e09
;
Double_t
length
=
gMC
->
TrackLength
();
Double_t
eLoss
=
gMC
->
Edep
();
Double_t
time
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
Double_t
length
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
Double_t
eLoss
=
TVirtualMC
::
GetMC
()
->
Edep
();
TLorentzVector
tPos
,
tMom
;
gMC
->
TrackPosition
(
tPos
);
gMC
->
TrackMomentum
(
tMom
);
TVirtualMC
::
GetMC
()
->
TrackPosition
(
tPos
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
tMom
);
AddMirrorHit
(
trackID
,
iVol
,
TVector3
(
tPos
.
X
(),
tPos
.
Y
(),
tPos
.
Z
()),
TVector3
(
tMom
.
Px
(),
tMom
.
Py
(),
tMom
.
Pz
()),
time
,
length
,
eLoss
);
...
...
@@ -337,12 +337,12 @@ void CbmRich::SetRichGlassPropertiesForGeant4()
reflectivityAr
[
i
]
=
1.
-
reflectivityAr
[
i
];
}
gMC
->
DefineOpSurface
(
"RICHglassSurf"
,
kGlisur
,
kDielectric_metal
,
kPolished
,
0.0
);
gMC
->
SetMaterialProperty
(
"RICHglassSurf"
,
"REFLECTIVITY"
,
energyAr
.
size
(),
energyAr
.
data
(),
reflectivityAr
.
data
());
TVirtualMC
::
GetMC
()
->
DefineOpSurface
(
"RICHglassSurf"
,
kGlisur
,
kDielectric_metal
,
kPolished
,
0.0
);
TVirtualMC
::
GetMC
()
->
SetMaterialProperty
(
"RICHglassSurf"
,
"REFLECTIVITY"
,
energyAr
.
size
(),
energyAr
.
data
(),
reflectivityAr
.
data
());
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
if
(
gGeoManager
->
FindVolumeFast
((
"mirror_tile_type"
+
std
::
to_string
(
i
)).
c_str
())
==
nullptr
)
continue
;
gMC
->
SetSkinSurface
((
"RICHglassSkin"
+
std
::
to_string
(
i
)).
c_str
(),
(
"mirror_tile_type"
+
std
::
to_string
(
i
)).
c_str
(),
TVirtualMC
::
GetMC
()
->
SetSkinSurface
((
"RICHglassSkin"
+
std
::
to_string
(
i
)).
c_str
(),
(
"mirror_tile_type"
+
std
::
to_string
(
i
)).
c_str
(),
"RICHglassSurf"
);
}
}
...
...
sim/detectors/sts/CbmStsMC.cxx
View file @
e62a1bc3
...
...
@@ -137,7 +137,7 @@ Bool_t CbmStsMC::ProcessHits(FairVolume* /*vol*/)
// --- If this is the first step for the track in the sensor:
// Reset energy loss and store track parameters
if
(
gMC
->
IsTrackEntering
())
{
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
fEloss
=
0.
;
fStatusIn
.
Reset
();
fStatusOut
.
Reset
();
...
...
@@ -145,11 +145,11 @@ Bool_t CbmStsMC::ProcessHits(FairVolume* /*vol*/)
}
// --- For all steps within active volume: sum up differential energy loss
fEloss
+=
gMC
->
Edep
();
fEloss
+=
TVirtualMC
::
GetMC
()
->
Edep
();
// --- If track is leaving: get track parameters and create CbmstsPoint
if
(
gMC
->
IsTrackExiting
()
||
gMC
->
IsTrackStop
()
||
gMC
->
IsTrackDisappeared
())
{
if
(
TVirtualMC
::
GetMC
()
->
IsTrackExiting
()
||
TVirtualMC
::
GetMC
()
->
IsTrackStop
()
||
TVirtualMC
::
GetMC
()
->
IsTrackDisappeared
())
{
SetStatus
(
fStatusOut
);
...
...
@@ -160,7 +160,7 @@ Bool_t CbmStsMC::ProcessHits(FairVolume* /*vol*/)
CreatePoint
();
// --- Increment number of StsPoints for this track
CbmStack
*
stack
=
(
CbmStack
*
)
gMC
->
GetStack
();
CbmStack
*
stack
=
(
CbmStack
*
)
TVirtualMC
::
GetMC
()
->
GetStack
();
stack
->
AddPoint
(
ECbmModuleId
::
kSts
);
}
//? track is exiting or stopped
...
...
@@ -254,7 +254,7 @@ void CbmStsMC::SetStatus(CbmStsTrackStatus& status)
{
// --- Check for TVirtualMC and TGeomanager
if
(
!
(
gMC
&&
gGeoManager
))
{
if
(
!
(
TVirtualMC
::
GetMC
()
&&
gGeoManager
))
{
LOG
(
error
)
<<
fName
<<
": No TVirtualMC or TGeoManager instance!"
;
return
;
}
...
...
@@ -262,7 +262,7 @@ void CbmStsMC::SetStatus(CbmStsTrackStatus& status)
// --- Address of current sensor
// --- Use the geometry path from TVirtualMC; cannot rely on
// --- TGeoManager here.
TString
path
=
gMC
->
CurrentVolPath
();
TString
path
=
TVirtualMC
::
GetMC
()
->
CurrentVolPath
();
auto
it
=
fAddressMap
.
find
(
path
);
if
(
it
==
fAddressMap
.
end
())
{
LOG
(
fatal
)
<<
fName
<<
": Path not found in address map! "
<<
gGeoManager
->
GetPath
();
...
...
@@ -272,28 +272,28 @@ void CbmStsMC::SetStatus(CbmStsTrackStatus& status)
status
.
fAddress
=
it
->
second
;
// --- Index and PID of current track
status
.
fTrackId
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
status
.
fPid
=
gMC
->
GetStack
()
->
GetCurrentTrack
()
->
GetPdgCode
();
status
.
fTrackId
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
status
.
fPid
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrack
()
->
GetPdgCode
();
// --- Position
gMC
->
TrackPosition
(
status
.
fX
,
status
.
fY
,
status
.
fZ
);
TVirtualMC
::
GetMC
()
->
TrackPosition
(
status
.
fX
,
status
.
fY
,
status
.
fZ
);
// --- Momentum
Double_t
dummy
;
gMC
->
TrackMomentum
(
status
.
fPx
,
status
.
fPy
,
status
.
fPz
,
dummy
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
status
.
fPx
,
status
.
fPy
,
status
.
fPz
,
dummy
);
// --- Time and track length
status
.
fTime
=
gMC
->
TrackTime
()
*
1.e9
;
// conversion into ns
status
.
fLength
=
gMC
->
TrackLength
();
status
.
fTime
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.e9
;
// conversion into ns
status
.
fLength
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
// --- Status flag (entry/exit or new/stopped/disappeared)
if
(
gMC
->
IsTrackEntering
())
{
if
(
gMC
->
IsNewTrack
())
status
.
fFlag
=
kFALSE
;
// Track created in sensor
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
if
(
TVirtualMC
::
GetMC
()
->
IsNewTrack
())
status
.
fFlag
=
kFALSE
;
// Track created in sensor
else
status
.
fFlag
=
kTRUE
;
// Track entering
}
else
{
// exiting or stopped or disappeared
if
(
gMC
->
IsTrackDisappeared
()
||
gMC
->
IsTrackStop
())
if
(
TVirtualMC
::
GetMC
()
->
IsTrackDisappeared
()
||
TVirtualMC
::
GetMC
()
->
IsTrackStop
())
status
.
fFlag
=
kFALSE
;
// Track stopped or disappeared in sensor
else
status
.
fFlag
=
kTRUE
;
// Track exiting
...
...
sim/detectors/tof/CbmTof.cxx
View file @
e62a1bc3
...
...
@@ -281,15 +281,15 @@ Bool_t CbmTof::ProcessHits(FairVolume* /*vol*/)
{
if
(
fbOnePointPerTrack
)
{
// create/update CbmTofPoint objects for any charged particle or geantinos/rootinos
if
(
fbProcessAnyTrack
||
0
!=
gMC
->
TrackCharge
()
||
0
==
gMC
->
TrackPid
())
{
if
(
fbProcessAnyTrack
||
0
!=
TVirtualMC
::
GetMC
()
->
TrackCharge
()
||
0
==
TVirtualMC
::
GetMC
()
->
TrackPid
())
{
Int_t
iCounterID
=
fGeoHandler
->
GetUniqueCounterId
();
// If the current volume is marked insensitive, do not process the MC hit.
if
(
fInactiveCounterIDs
.
find
(
iCounterID
)
!=
fInactiveCounterIDs
.
end
())
{
return
kTRUE
;
}
Int_t
iTrackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
Int_t
iTrackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
Double_t
dTrackEnergyDeposit
=
gMC
->
Edep
();
Double_t
dTrackEnergyDeposit
=
TVirtualMC
::
GetMC
()
->
Edep
();
CbmTofPoint
*
tCounterPoint
(
0
);
Bool_t
bCounterPointExists
=
kFALSE
;
...
...
@@ -312,18 +312,18 @@ Bool_t CbmTof::ProcessHits(FairVolume* /*vol*/)
}
// first step of the track in the current gas gap (cell)
if
(
gMC
->
IsTrackEntering
())
{
Double_t
dTrackTime
=
gMC
->
TrackTime
()
*
1.0e09
;
Double_t
dTrackLength
=
gMC
->
TrackLength
();
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
Double_t
dTrackTime
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
Double_t
dTrackLength
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
Double_t
dTrackPositionX
(
0.
);
Double_t
dTrackPositionY
(
0.
);
Double_t
dTrackPositionZ
(
0.
);
gMC
->
TrackPosition
(
dTrackPositionX
,
dTrackPositionY
,
dTrackPositionZ
);
TVirtualMC
::
GetMC
()
->
TrackPosition
(
dTrackPositionX
,
dTrackPositionY
,
dTrackPositionZ
);
Double_t
dTrackMomentumX
(
0.
);
Double_t
dTrackMomentumY
(
0.
);
Double_t
dTrackMomentumZ
(
0.
);
Double_t
dTrackEnergy
(
0.
);
gMC
->
TrackMomentum
(
dTrackMomentumX
,
dTrackMomentumY
,
dTrackMomentumZ
,
dTrackEnergy
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
dTrackMomentumX
,
dTrackMomentumY
,
dTrackMomentumZ
,
dTrackEnergy
);
if
(
bCounterPointExists
)
{
tCounterPoint
->
SetTime
(
tCounterPoint
->
GetTime
()
+
dTrackTime
);
...
...
@@ -355,7 +355,7 @@ Bool_t CbmTof::ProcessHits(FairVolume* /*vol*/)
tCounterPoint
->
SetNCells
(
1
);
// Increment number of tof points for TParticle
CbmStack
*
stack
=
dynamic_cast
<
CbmStack
*>
(
gMC
->
GetStack
());
CbmStack
*
stack
=
dynamic_cast
<
CbmStack
*>
(
TVirtualMC
::
GetMC
()
->
GetStack
());
stack
->
AddPoint
(
ECbmModuleId
::
kTof
);
}
...
...
@@ -368,23 +368,23 @@ Bool_t CbmTof::ProcessHits(FairVolume* /*vol*/)
}
else
{
// Set parameters at entrance of volume. Reset ELoss.
if
(
gMC
->
IsTrackEntering
())
{
if
(
TVirtualMC
::
GetMC
()
->
IsTrackEntering
())
{
fELoss
=
0.
;
fTime
=
gMC
->
TrackTime
()
*
1.0e09
;
fLength
=
gMC
->
TrackLength
();
gMC
->
TrackPosition
(
fPos
);
gMC
->
TrackMomentum
(
fMom
);
fTime
=
TVirtualMC
::
GetMC
()
->
TrackTime
()
*
1.0e09
;
fLength
=
TVirtualMC
::
GetMC
()
->
TrackLength
();
TVirtualMC
::
GetMC
()
->
TrackPosition
(
fPos
);
TVirtualMC
::
GetMC
()
->
TrackMomentum
(
fMom
);
}
// Sum energy loss for all steps in the active volume
fELoss
+=
gMC
->
Edep
();
fELoss
+=
TVirtualMC
::
GetMC
()
->
Edep
();
// Create CbmTofPoint at exit of active volume
if
(((
0
==
gMC
->
GetStack
()
->
GetCurrentTrack
()
->
GetPdgCode
())
||
// Add geantinos/rootinos
(
gMC
->
TrackCharge
()
!=
0
))
&&
(
gMC
->
IsTrackExiting
()
||
gMC
->
IsTrackStop
()
||
gMC
->
IsTrackDisappeared
()))
{
if
(((
0
==
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrack
()
->
GetPdgCode
())
||
// Add geantinos/rootinos
(
TVirtualMC
::
GetMC
()
->
TrackCharge
()
!=
0
))
&&
(
TVirtualMC
::
GetMC
()
->
IsTrackExiting
()
||
TVirtualMC
::
GetMC
()
->
IsTrackStop
()
||
TVirtualMC
::
GetMC
()
->
IsTrackDisappeared
()))
{
fTrackID
=
gMC
->
GetStack
()
->
GetCurrentTrackNumber
();
fTrackID
=
TVirtualMC
::
GetMC
()
->
GetStack
()
->
GetCurrentTrackNumber
();
fVolumeID
=
fGeoHandler
->
GetUniqueDetectorId
();
...
...
@@ -408,7 +408,7 @@ Bool_t CbmTof::ProcessHits(FairVolume* /*vol*/)
fTime
,
fLength
,
fELoss
);