23#include "TGeoManager.h"
24#include "TGeoPhysicalNode.h"
28#include "TVirtualMC.h"
44 , fProcessNeutrals(kFALSE)
66 TString fileName = GetGeometryFileName();
69 if (!fileName.EndsWith(
".root")) {
70 LOG(fatal) << GetName() <<
": Geometry format of file " << fileName.Data() <<
" not supported.";
105 for (Int_t iUnit = 0; iUnit < nUnits; iUnit++) {
108 for (Int_t iLadd = 0; iLadd < nLadd; iLadd++) {
111 for (Int_t iHlad = 0; iHlad < nHlad; iHlad++) {
114 for (Int_t iModu = 0; iModu < nModu; iModu++) {
117 for (Int_t iSens = 0; iSens < nSens; iSens++) {
119 TString path = sensor->
GetPnode()->GetName();
120 if (!path.BeginsWith(
"/")) path.Prepend(
"/");
121 pair<TString, Int_t> a(path, sensor->
GetAddress());
123 TString test = sensor->
GetPnode()->GetName();
129 LOG(info) << fName <<
": Address map initialised with " << Int_t(
fAddressMap.size()) <<
" sensors. ";
132 FairDetector::Initialize();
143 if (gMC->IsTrackEntering()) {
155 if (gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()) {
192 LOG(info) << fName <<
": " <<
fStsPoints->GetEntriesFast() <<
" points registered in this event.";
242 LOG(debug2) << GetName() <<
": Creating point from track " <<
fStatusIn.
fTrackId <<
" in sensor "
243 <<
fStatusIn.
fAddress <<
", position (" << posIn.X() <<
", " << posIn.Y() <<
", " << posIn.Z()
244 <<
"), energy loss " <<
fEloss;
247 Int_t newIndex =
fStsPoints->GetEntriesFast();
248 return new ((*fStsPoints)[
fStsPoints->GetEntriesFast()])
260 if (!(gMC && gGeoManager)) {
261 LOG(error) << fName <<
": No TVirtualMC or TGeoManager instance!";
268 TString path = gMC->CurrentVolPath();
271 LOG(fatal) << fName <<
": Path not found in address map! " << gGeoManager->GetPath();
278 status.
fTrackId = gMC->GetStack()->GetCurrentTrackNumber();
279 status.
fPid = gMC->GetStack()->GetCurrentTrack()->GetPdgCode();
282 gMC->TrackPosition(status.
fX, status.
fY, status.
fZ);
286 gMC->TrackMomentum(status.
fPx, status.
fPy, status.
fPz, dummy);
289 status.
fTime = gMC->TrackTime() * 1.e9;
290 status.
fLength = gMC->TrackLength();
293 if (gMC->IsTrackEntering()) {
294 if (gMC->IsNewTrack()) status.
fFlag = kFALSE;
296 status.
fFlag = kTRUE;
299 if (gMC->IsTrackDisappeared() || gMC->IsTrackStop())
300 status.
fFlag = kFALSE;
302 status.
fFlag = kTRUE;
312 LOG(info) <<
"Importing STS geometry from ROOT file " << fgeoName.Data();
316 LOG(info) <<
"Constructing STS geometry from ROOT file " << fgeoName.Data();
317 FairModule::ConstructRootGeometry();
ClassImp(CbmConverterManager)
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
@ 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...
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
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)