16#include <FairRootManager.h>
17#include <FairVolume.h>
20#include <TClonesArray.h>
23#include <TVirtualMC.h>
24#include <TVirtualMCStack.h>
36 ,
fPosIn(0.0, 0.0, 0.0, 0.0)
38 ,
fMomIn(0.0, 0.0, 0.0, 0.0)
65 ,
fPosIn(0.0, 0.0, 0.0, 0.0)
67 ,
fMomIn(0.0, 0.0, 0.0, 0.0)
106 if (gMC->IsTrackEntering()) {
107 fPdg = gMC->TrackPid();
109 fTime = gMC->TrackTime() * 1.0e09;
111 gMC->TrackPosition(
fPosIn);
112 gMC->TrackMomentum(
fMomIn);
119 if (gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()) {
120 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
123 const char* address = gMC->CurrentVolPath();
125 TString stAdd(address);
127 if (stAdd.Contains(
"/MVDscripted_0") || stAdd.Contains(
"/TwoStation_0") || stAdd.Contains(
"v25a_mcbm")) {
133 if (
fELoss == 0.)
return kFALSE;
158 if (fVerboseLevel)
Print();
185 LOG(info) << fName <<
": " << nHits <<
" points registered in this event.";
203 Int_t nEntries = cl1->GetEntriesFast();
204 LOG(info) <<
"CbmMvd: " << nEntries <<
" entries to add.";
205 TClonesArray& clref = *cl2;
207 for (
Int_t i = 0; i < nEntries; i++) {
209 Int_t index = oldpoint->GetTrackID() + offset;
210 oldpoint->SetTrackID(index);
214 LOG(info) <<
"CbmMvd: " << cl2->GetEntriesFast() <<
" merged entries.";
221 TString fileName = GetGeometryFileName();
222 if (fileName.Contains(
"mcbm")) {
224 LOG(info) <<
"mcbm geometry found ";
227 if (fileName.EndsWith(
".root")) {
228 LOG(info) <<
"Constructing MVD geometry from ROOT file " << fileName.Data();
231 else if (fileName.EndsWith(
".geo")) {
232 LOG(fatal) <<
"Don't use old .geo style geometrys for the MVD. Please use "
236 LOG(fatal) <<
"Geometry format of MVD file " << fileName.Data() <<
" not supported.";
249 FairDetector::ConstructRootGeometry();
257 LOG(info) <<
"Station Map size " <<
fStationMap.size();
258 if (
fStationMap.size() == 0) LOG(fatal) <<
"Tried to load MVD Geometry, but didn't succeed to load Sensors";
259 LOG(info) <<
"filled mvd StationMap with: " <<
fStationMap.size() <<
" new Sensors";
266 TVector3 momOut, Double_t time, Double_t length, Double_t eLoss)
271 LOG(debug2) <<
"CbmMvd: Adding Point at (" << posIn.X() <<
", " << posIn.Y() <<
", " << posIn.Z() <<
") cm, sensor "
272 << sensorNr <<
", track " << trackID <<
", energy loss " << eLoss * 1e06 <<
" keV";
273 return new (clref[
size])
CbmMvdPoint(trackID, pdg, sensorNr, posIn, posOut, momIn, momOut, time, length, eLoss);
279 TString tsname = name;
280 if (tsname.Contains(
"sensorActive") || tsname.Contains(
"MimosaActive")
281 || (tsname.Contains(
"mvdstation") && !(tsname.Contains(
"PartAss")))) {
282 LOG(debug) <<
"*** Register " << tsname <<
" as active volume.";
285 else if (tsname.EndsWith(
"-P0")) {
287 LOG(debug) <<
"*** Register " << tsname <<
" as active volume.";
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.
@ kMvd
Micro-Vertex Detector.
Helper class to extract information from the GeoManager. Addapted from TrdGeoHandler byFlorian Uhlig ...
static constexpr size_t size()
virtual void BeginEvent()
virtual void ConstructAsciiGeometry()
virtual void ConstructRootGeometry()
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
Bool_t kGeoSaved
The hit collection.
virtual void ConstructGeometry()
CbmMvdGeoHandler * fmvdHandler
TLorentzVector fMomIn
position
virtual TClonesArray * GetCollection(Int_t iColl) const
TClonesArray * fCollection
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
Int_t fGeoFlag
Map from MC volume ID to station number.
Int_t fPosIndex
energy loss
std::map< Int_t, Int_t > fStationMap
List of geometry parameters.
virtual Bool_t ProcessHits(FairVolume *vol=0)
virtual Bool_t IsSensitive(const std::string &name)
void AddPoint(ECbmModuleId iDet)