16#include <TVirtualMC.h>
22#include "TGeoManager.h"
33Float_t Detector::mDensityFactor = 1.0;
34std::vector<int> o2::base::Detector::sDetId2HitBitIndex{};
54 FairDetector::operator=(rhs);
63 mgr.Material(GetName(), imat,
name,
a,
z, dens, radl, absl,
buf, nwbuf);
69 mgr.Mixture(GetName(), imat,
name,
a,
z, dens, nlmat, wmat);
77 mgr.Medium(GetName(), numed,
name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
83 mgr.SpecialCuts(GetName(), numed, parIDValMap);
89 mgr.SpecialCut(GetName(), numed, parID,
val);
95 mgr.SpecialProcesses(GetName(), numed, parIDValMap);
101 mgr.SpecialProcess(GetName(), numed, parID,
val);
107 TVirtualMC::GetMC()->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
112void Detector::defineLayer(
const Int_t nlay,
const double phi0,
const Double_t
r,
const Int_t nladd,
const Int_t nmod,
113 const Double_t lthick,
const Double_t dthick,
const UInt_t dettypeID,
const Int_t buildLevel)
118 Double_t tilt, Double_t lthick, Double_t dthick, UInt_t dettypeID, Int_t buildLevel)
128 LOG(info) <<
"Setting special cuts for " << GetName();
129 const char* aliceO2env = std::getenv(
"O2_ROOT");
130 std::string inputFile;
132 inputFile = std::string(aliceO2env);
134 inputFile +=
"/share/Detectors/" + std::string(GetName()) +
"/simulation/data/simcuts.dat";
136 matmgr.loadCutsAndProcessesFromFile(GetName(), inputFile.c_str());
148 auto vmc = TVirtualMC::GetMC();
150 auto field = vmc->GetMagField();
153 integration = o2field->Integral();
154 maxfield = o2field->Max();
158 LOG(info) <<
"No magnetic field found; using default tracking values " << integration <<
" " << maxfield
159 <<
" to initialize media\n";
164 LOG(warning) <<
"GetCollection interface no longer supported";
165 LOG(warning) <<
"Use the GetHits function on invidiual detectors";
171 LOG(warning) <<
"Alignable volumes are not yet defined for " << GetName();
181 this->FairModule::AddSensitiveVolume(
const_cast<TGeoVolume*
>(vol));
183 const int volid = TVirtualMC::GetMC()->VolId(vol->GetName());
185 LOG(error) <<
"Could not retrieve VMC volume ID for " << vol->GetName();
193 auto vol = gGeoManager->GetVolume(
name.c_str());
195 LOG(error) <<
"Volume " <<
name <<
" not found in geometry; Cannot register sensitive volume";
201#include <fairmq/Message.h>
202#include <fairmq/Parts.h>
203#include <fairmq/Channel.h>
209 auto msg = channel.Transport()->CreateMessage(4096, fair::mq::Alignment{64});
216 parts.AddPart(std::move(
msg));
220 std::unique_ptr<fair::mq::Message>
message(channel.NewSimpleMessage(
id));
221 parts.AddPart(std::move(
message));
223void attachShmMessage(
void* hits_ptr, fair::mq::Channel& channel, fair::mq::Parts& parts,
bool* busy_ptr)
232 shmcontext info{instance.getShmID(), hits_ptr, busy_ptr};
234 LOG(
debug) <<
"-- OBJ PTR -- " << info.object_ptr <<
" ";
235 assert(instance.isPointerOk(info.object_ptr));
237 std::unique_ptr<fair::mq::Message>
message(channel.NewSimpleMessage(info));
238 parts.AddPart(std::move(
message));
242 auto rawmessage = std::move(dataparts.At(
index));
249 shmcontext* info = (shmcontext*)rawmessage->GetData();
251 busy = info->busy_ptr;
252 return info->object_ptr;
257 auto rawmessage = std::move(dataparts.At(
index));
260 auto* cl =
buffer.ReadClass();
261 buffer.SetBufferOffset(0);
263 return buffer.ReadObjectAny(cl);
Definition of the Detector class.
Definition of the MagF class.
void SpecialProcess(Int_t numed, EProc parID, int val)
Set process by name and value.
int registerSensitiveVolumeAndGetVolID(std::string const &name)
~Detector() override
Default Destructor.
Detector & operator=(const Detector &)
virtual void defineLayerTurbo(Int_t nlay, Double_t phi0, Double_t r, Int_t nladd, Int_t nmod, Double_t width, Double_t tilt, Double_t lthick=0., Double_t dthick=0., UInt_t detType=0, Int_t buildFlag=0)
TClonesArray * GetCollection(int iColl) const final
virtual void fillParallelWorld() const
fill parallel geometry with sensitive volumes of detector
void SpecialCuts(Int_t numed, const std::initializer_list< std::pair< ECut, Float_t > > &parIDValMap)
Custom processes and transport cuts.
void SpecialCut(Int_t numed, ECut parID, Float_t val)
Set cut by name and value.
void SpecialProcesses(Int_t numed, const std::initializer_list< std::pair< EProc, int > > &parIDValMap)
void Matrix(Int_t &nmat, Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2, Float_t theta3, Float_t phi3) const
Detector()
Default Constructor.
virtual void setNumberOfWrapperVolumes(Int_t n)
Books arrays for wrapper volumes.
void Mixture(Int_t imat, const char *name, Float_t *a, Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat)
virtual void addAlignableVolumes() const
declare alignable volumes of detector
void Medium(Int_t numed, const char *name, Int_t nmat, Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin, Float_t *ubuf=nullptr, Int_t nbuf=0)
void SetSpecialPhysicsCuts() override
static void initFieldTrackingParams(int &mode, float &maxfield)
virtual void defineWrapperVolume(Int_t id, Double_t rmin, Double_t rmax, Double_t zspan)
Sets per wrapper volume parameters.
virtual void defineLayer(Int_t nlay, Double_t phi0, Double_t r, Int_t nladd, Int_t nmod, Double_t lthick=0., Double_t dthick=0., UInt_t detType=0, Int_t buildFlag=0)
void Material(Int_t imat, const char *name, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl, Float_t *buf=nullptr, Int_t nwbuf=0)
static MaterialManager & Instance()
Static class with identifiers, bitmasks and names for ALICE detectors.
static ShmManager & Instance()
GLuint const GLchar * name
GLuint GLsizei const GLchar * message
GLboolean GLboolean GLboolean GLboolean a
GLenum GLuint GLenum GLsizei const GLchar * buf
GLdouble GLdouble GLdouble z
void attachShmMessage(void *hitsptr, fair::mq::Channel &channel, fair::mq::Parts &parts, bool *busy_ptr)
void * decodeTMessageCore(fair::mq::Parts &dataparts, int index)
void attachMessageBufferToParts(fair::mq::Parts &parts, fair::mq::Channel &channel, void *data, TClass *cl)
void * decodeShmCore(fair::mq::Parts &dataparts, int index, bool *&busy)
void attachDetIDHeaderMessage(int id, fair::mq::Channel &channel, fair::mq::Parts &parts)
static void serialize(o2::framework::FairOutputTBuffer &msg, const TObject *input)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
uint64_t const void const *restrict const msg