20#include "TGeoManager.h"
21#include "TGeoPhysicalNode.h"
25#include "TVirtualMC.h"
68 TString fileName = GetGeometryFileName();
71 if (!fileName.EndsWith(
".root")) {
72 LOG(fatal) << GetName() <<
": Geometry format of file " << fileName.Data() <<
" not supported.";
107 for (
Int_t iUnit = 0; iUnit < nUnits; iUnit++) {
110 for (
Int_t iLadd = 0; iLadd < nLadd; iLadd++) {
113 for (
Int_t iHlad = 0; iHlad < nHlad; iHlad++) {
116 for (
Int_t iModu = 0; iModu < nModu; iModu++) {
119 for (
Int_t iSens = 0; iSens < nSens; iSens++) {
121 TString path = sensor->
GetPnode()->GetName();
122 if (!path.BeginsWith(
"/")) {
125 pair<TString, Int_t> a(path, sensor->
GetAddress());
127 TString test = sensor->
GetPnode()->GetName();
133 LOG(info) << fName <<
": Address map initialised with " <<
Int_t(
fAddressMap.size()) <<
" sensors. ";
136 FairDetector::Initialize();
147 if (gMC->IsTrackEntering()) {
159 if (gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()) {
199 LOG(info) << fName <<
": " <<
fStsPoints->GetEntriesFast() <<
" points registered in this event.";
215 LOG(error) << GetName() <<
": inconsistent detector addresses " <<
fStatusIn.fAddress <<
" " <<
fStatusOut.fAddress;
221 LOG(error) << GetName() <<
": inconsistent track Id " <<
fStatusIn.fTrackId <<
" " <<
fStatusOut.fTrackId;
227 LOG(error) << GetName() <<
": inconsistent track PID " <<
fStatusIn.fPid <<
" " <<
fStatusOut.fPid;
253 LOG(debug2) << GetName() <<
": Creating point from track " <<
fStatusIn.fTrackId <<
" in sensor "
254 <<
fStatusIn.fAddress <<
", position (" << posIn.X() <<
", " << posIn.Y() <<
", " << posIn.Z()
255 <<
"), energy loss " <<
fEloss;
259 return new ((*fStsPoints)[
fStsPoints->GetEntriesFast()])
271 if (!(gMC && gGeoManager)) {
272 LOG(error) << fName <<
": No TVirtualMC or TGeoManager instance!";
279 TString path = gMC->CurrentVolPath();
282 LOG(fatal) << fName <<
": Path not found in address map! " << gGeoManager->GetPath();
290 status.
fTrackId = gMC->GetStack()->GetCurrentTrackNumber();
291 status.
fPid = gMC->GetStack()->GetCurrentTrack()->GetPdgCode();
294 gMC->TrackPosition(status.
fX, status.
fY, status.
fZ);
298 gMC->TrackMomentum(status.
fPx, status.
fPy, status.
fPz, dummy);
301 status.
fTime = gMC->TrackTime() * 1.e9;
302 status.
fLength = gMC->TrackLength();
305 if (gMC->IsTrackEntering()) {
306 if (gMC->IsNewTrack()) {
307 status.
fFlag = kFALSE;
310 status.
fFlag = kTRUE;
314 if (gMC->IsTrackDisappeared() || gMC->IsTrackStop()) {
315 status.
fFlag = kFALSE;
318 status.
fFlag = kTRUE;
329 LOG(info) <<
"Importing STS geometry from ROOT file " << fgeoName.Data();
333 LOG(info) <<
"Constructing STS geometry from ROOT file " << fgeoName.Data();
334 FairModule::ConstructRootGeometry();
ClassImp(CbmConverterManager)
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Converts an element of enum class to its underlying integral type.
ECbmModuleId
Enumerator for module Identifiers.
@ kSts
Silicon Tracking System.
void AddPoint(ECbmModuleId iDet)
Class representing an element of the STS setup.
TGeoPhysicalNode * GetPnode() const
Int_t GetNofDaughters() const
CbmStsElement * GetDaughter(Int_t index) const
Class for the MC transport of the CBM-STS.
TClonesArray * fStsPoints
Double_t fEloss
Track status at exit of sensor.
virtual void Initialize()
Initialisation.
virtual void Reset()
Clear output array and reset current track status.
CbmStsMC(Bool_t active=kTRUE, const char *name="STSMC")
CbmStsSetup * fSetup
Output array (CbmStsPoint)
CbmStsTrackStatus fStatusIn
CbmStsPoint * CreatePoint()
Create a new StsPoint Creates a new CbmStsPoint using the current track status information and adds i...
virtual void ConstructRootGeometry(TGeoMatrix *shift=NULL)
std::map< TString, Int_t > fAddressMap
Accumulated energy loss for current track.
virtual void EndOfEvent()
Action at end of event.
virtual void Print(Option_t *opt="") const
Screen log Prints current number of StsPoints in array. Virtual from TObject.
virtual Bool_t ProcessHits(FairVolume *vol=0)
Action for a track step in a sensitive node of the STS.
Bool_t fProcessNeutrals
Transformation matrix for geometry positioning.
CbmStsTrackStatus fStatusOut
Track status at entry of sensor.
TGeoCombiTrans * fCombiTrans
Pointer to static instance of CbmStsSetup.
virtual void ConstructGeometry()
Construct the STS geometry in the TGeoManager.
void SetStatus(CbmStsTrackStatus &status)
Set the current track status Set the current track status (in or out) with parameters obtained from T...
static CbmStsSetup * Instance()
Stores status of track during transport. Auxiliary for CbmSts.
Int_t fTrackId
MCTrack index.
Int_t fPid
MCTrack PID [PDG code].
Double_t fY
x position [cm]
Double_t fPz
Momentum x component [GeV].
Double_t fX
x position [cm]
Int_t fAddress
Unique address.
Double_t fZ
x position [cm]
Double_t fPx
Momentum x component [GeV].
Double_t fLength
Length since track creation [cm].
Bool_t fFlag
Status flag. TRUE if normal entry/exit, else FALSE.
Double_t fTime
Time since track creation [ns].
Double_t fPy
Momentum x component [GeV].
Bool_t IsNewGeometryFile(TString &filename)
void ImportRootGeometry(TString &filename, FairModule *mod, TGeoMatrix *mat)