16#include <FairRootManager.h>
17#include <FairVolume.h>
20#include <TClonesArray.h>
23#include <TVirtualMC.h>
24#include <TVirtualMCStack.h>
35 , fPosIn(0.0, 0.0, 0.0, 0.0)
36 , fPosOut(0.0, 0.0, 0.0, 0.0)
37 , fMomIn(0.0, 0.0, 0.0, 0.0)
38 , fMomOut(0.0, 0.0, 0.0, 0.0)
43 , fCollection(new TClonesArray(
"CbmMvdPoint"))
45 , fGeoPar(new TList())
47 , fmvdHandler(nullptr)
63 , fPosIn(0.0, 0.0, 0.0, 0.0)
64 , fPosOut(0.0, 0.0, 0.0, 0.0)
65 , fMomIn(0.0, 0.0, 0.0, 0.0)
66 , fMomOut(0.0, 0.0, 0.0, 0.0)
71 , fCollection(new TClonesArray(
"CbmMvdPoint"))
73 , fGeoPar(new TList())
75 , fmvdHandler(nullptr)
105 if (gMC->IsTrackEntering()) {
106 fPdg = gMC->TrackPid();
108 fTime = gMC->TrackTime() * 1.0e09;
110 gMC->TrackPosition(
fPosIn);
111 gMC->TrackMomentum(
fMomIn);
118 if (gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()) {
119 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
122 const char* address = gMC->CurrentVolPath();
124 TString stAdd(address);
130 if (
fELoss == 0.)
return kFALSE;
155 if (fVerboseLevel)
Print();
182 LOG(info) << fName <<
": " << nHits <<
" points registered in this event.";
200 Int_t nEntries = cl1->GetEntriesFast();
201 LOG(info) <<
"CbmMvd: " << nEntries <<
" entries to add.";
202 TClonesArray& clref = *cl2;
204 for (Int_t i = 0; i < nEntries; i++) {
206 Int_t index = oldpoint->GetTrackID() + offset;
207 oldpoint->SetTrackID(index);
211 LOG(info) <<
"CbmMvd: " << cl2->GetEntriesFast() <<
" merged entries.";
218 TString fileName = GetGeometryFileName();
219 if (fileName.EndsWith(
".root")) {
220 LOG(info) <<
"Constructing MVD geometry from ROOT file " << fileName.Data();
223 else if (fileName.EndsWith(
".geo")) {
224 LOG(fatal) <<
"Don't use old .geo style geometrys for the MVD. Please use "
228 LOG(fatal) <<
"Geometry format of MVD file " << fileName.Data() <<
" not supported.";
239 FairDetector::ConstructRootGeometry();
243 if (
fStationMap.size() == 0) LOG(fatal) <<
"Tried to load MVD Geometry, but didn't succeed to load Sensors";
244 LOG(debug) <<
"filled mvd StationMap with: " <<
fStationMap.size() <<
" new Sensors";
251 TVector3 momOut, Double_t time, Double_t length, Double_t eLoss)
254 Int_t
size = clref.GetEntriesFast();
256 LOG(debug2) <<
"CbmMvd: Adding Point at (" << posIn.X() <<
", " << posIn.Y() <<
", " << posIn.Z() <<
") cm, sensor "
257 << sensorNr <<
", track " << trackID <<
", energy loss " << eLoss * 1e06 <<
" keV";
258 return new (clref[
size])
CbmMvdPoint(trackID, pdg, sensorNr, posIn, posOut, momIn, momOut, time, length, eLoss);
264 TString tsname = name;
265 if (tsname.Contains(
"sensorActive") || tsname.Contains(
"MimosaActive")
266 || (tsname.Contains(
"mvdstation") && !(tsname.Contains(
"PartAss")))) {
267 LOG(debug) <<
"*** Register " << tsname <<
" as active volume.";
270 else if (tsname.EndsWith(
"-P0")) {
272 LOG(debug) <<
"*** Register " << tsname <<
" as active volume.";
ClassImp(CbmConverterManager)
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
@ kMvd
Micro-Vertex Detector.
Helper class to extract information from the GeoManager. Addapted from TrdGeoHandler byFlorian Uhlig ...
static constexpr size_t size()
void Init(Bool_t isSimulation=kFALSE)
Int_t GetIDfromPath(TString path)
std::map< Int_t, Int_t > GetMap()
virtual void BeginEvent()
virtual void ConstructAsciiGeometry()
virtual void EndOfEvent()
Int_t fVolumeID
track particle type
virtual Bool_t CheckIfSensitive(std::string name)
CbmMvdPoint * AddHit(Int_t trackID, Int_t pdg, Int_t sensorNr, TVector3 posIn, TVector3 pos_out, TVector3 momIn, TVector3 momOut, Double_t time, Double_t length, Double_t eLoss)
TLorentzVector fPosIn
volume id
virtual void Print(Option_t *="") const
virtual void ConstructGeometry()
CbmMvdGeoHandler * fmvdHandler
Map from MC volume ID to station number.
TLorentzVector fMomIn
position
virtual TClonesArray * GetCollection(Int_t iColl) const
TClonesArray * fCollection
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
Int_t fPosIndex
energy loss
std::map< Int_t, Int_t > fStationMap
List of geometry parameters.
virtual void ConstructRootGeometry(TGeoMatrix *shift=nullptr)
virtual Bool_t ProcessHits(FairVolume *vol=0)
virtual Bool_t IsSensitive(const std::string &name)
void AddPoint(ECbmModuleId iDet)