Go to the documentation of this file.
11 #include "TGeoManager.h"
12 #include "TGeoPhysicalNode.h"
14 #include "TParticle.h"
16 #include "TVirtualMC.h"
19 #include "FairLogger.h"
40 , fProcessNeutrals(kFALSE) {}
58 TString fileName = GetGeometryFileName();
61 if (!fileName.EndsWith(
".root")) {
62 LOG(fatal) << GetName() <<
": Geometry format of file " << fileName.Data()
96 for (Int_t iUnit = 0; iUnit < nUnits; iUnit++) {
99 for (Int_t iLadd = 0; iLadd < nLadd; iLadd++) {
102 for (Int_t iHlad = 0; iHlad < nHlad; iHlad++) {
105 for (Int_t iModu = 0; iModu < nModu; iModu++) {
108 for (Int_t iSens = 0; iSens < nSens; iSens++) {
110 TString path = sensor->
GetPnode()->GetName();
111 if (!path.BeginsWith(
"/")) path.Prepend(
"/");
112 pair<TString, Int_t> a(path, sensor->
GetAddress());
114 TString test = sensor->
GetPnode()->GetName();
120 LOG(info) << fName <<
": Address map initialised with "
124 FairDetector::Initialize();
134 if (gMC->IsTrackEntering()) {
146 if (gMC->IsTrackExiting() || gMC->IsTrackStop()
147 || gMC->IsTrackDisappeared()) {
182 LOG(info) << fName <<
": " <<
fStsPoints->GetEntriesFast()
183 <<
" points registered in this event.";
198 LOG(error) << GetName() <<
": inconsistent detector addresses "
212 LOG(error) << GetName() <<
": inconsistent track PID " <<
fStatusIn.
fPid
235 LOG(debug2) << GetName() <<
": Creating point from track "
237 <<
", position (" << posIn.X() <<
", " << posIn.Y() <<
", "
238 << posIn.Z() <<
"), energy loss " <<
fEloss;
241 Int_t newIndex =
fStsPoints->GetEntriesFast();
242 return new ((*fStsPoints)[
fStsPoints->GetEntriesFast()])
264 if (!(gMC && gGeoManager)) {
265 LOG(error) << fName <<
": No TVirtualMC or TGeoManager instance!";
272 TString path = gMC->CurrentVolPath();
275 LOG(fatal) << fName <<
": Path not found in address map! "
276 << gGeoManager->GetPath();
282 status.
fTrackId = gMC->GetStack()->GetCurrentTrackNumber();
283 status.
fPid = gMC->GetStack()->GetCurrentTrack()->GetPdgCode();
286 gMC->TrackPosition(status.
fX, status.
fY, status.
fZ);
290 gMC->TrackMomentum(status.
fPx, status.
fPy, status.
fPz, dummy);
293 status.
fTime = gMC->TrackTime() * 1.e9;
294 status.
fLength = gMC->TrackLength();
297 if (gMC->IsTrackEntering()) {
298 if (gMC->IsNewTrack())
299 status.
fFlag = kFALSE;
301 status.
fFlag = kTRUE;
303 if (gMC->IsTrackDisappeared() || gMC->IsTrackStop())
304 status.
fFlag = kFALSE;
306 status.
fFlag = kTRUE;
315 LOG(info) <<
"Importing STS geometry from ROOT file " << fgeoName.Data();
318 LOG(info) <<
"Constructing STS geometry from ROOT file " << fgeoName.Data();
319 FairModule::ConstructRootGeometry();
Class for the MC transport of the CBM-STS.
virtual Bool_t ProcessHits(FairVolume *vol=0)
Action for a track step in a sensitive node of the STS.
virtual void EndOfEvent()
Action at end of event.
Int_t fAddress
Unique address.
Bool_t fProcessNeutrals
Transformation matrix for geometry positioning.
Int_t fPid
MCTrack PID [PDG code].
CbmStsPoint * CreatePoint()
Create a new StsPoint Creates a new CbmStsPoint using the current track status information and adds i...
Double_t fPy
Momentum x component [GeV].
Double_t fZ
x position [cm]
Double_t fTime
Time since track creation [ns].
static CbmStsSetup * Instance()
Int_t fTrackId
MCTrack index.
Double_t fX
x position [cm]
void SetStatus(CbmStsTrackStatus &status)
Set the current track status Set the current track status (in or out) with parameters obtained from T...
CbmStsSetup * fSetup
Output array (CbmStsPoint)
virtual void ConstructGeometry()
Construct the STS geometry in the TGeoManager.
TClonesArray * fStsPoints
TGeoPhysicalNode * GetPnode() const
virtual void Reset()
Clear output array and reset current track status.
void AddPoint(ECbmModuleId iDet)
Stores status of track during transport. Auxiliary for CbmSts.
Bool_t IsNewGeometryFile(TString &filename)
std::map< TString, Int_t > fAddressMap
Accumulated energy loss for current track.
Double_t fEloss
Track status at exit of sensor.
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
TGeoCombiTrans * fCombiTrans
Pointer to static instance of CbmStsSetup.
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
Double_t fY
x position [cm]
Double_t fPz
Momentum x component [GeV].
Bool_t fFlag
Status flag. TRUE if normal entry/exit, else FALSE.
Double_t fPx
Momentum x component [GeV].
CbmStsMC(Bool_t active=kTRUE, const char *name="STSMC")
virtual void ConstructRootGeometry(TGeoMatrix *shift=NULL)
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
CbmStsElement * GetDaughter(Int_t index) const
Int_t GetNofDaughters() const
virtual void Initialize()
Initialisation.
void ImportRootGeometry(TString &filename, FairModule *mod, TGeoMatrix *mat)
virtual void Print(Option_t *opt="") const
Screen log Prints current number of StsPoints in array. Virtual from TObject.
@ kSts
Silicon Tracking System.
CbmStsTrackStatus fStatusOut
Track status at entry of sensor.
Class representing an element of the STS setup.
CbmStsTrackStatus fStatusIn
Double_t fLength
Length since track creation [cm].