27#include <fairlogger/Logger.h>
33#include "TVirtualMC.h"
34#include "TLorentzVector.h"
37#include <TGeoVolume.h>
38#include <TGeoCompositeShape.h>
39#include <TGeoMedium.h>
41#include <TGeoManager.h>
55 mGeometryTGeo(nullptr),
74 mTrackData = rhs.mTrackData;
90 LOG(info) <<
"Initialize Forward Detector";
92 defineSensitiveVolumes();
93 definePassiveVolumes();
99 if (!(
fMC->TrackCharge())) {
104 int volId =
fMC->CurrentVolID(copy);
105 int detId = mChannelId[volId];
110 int particlePdg =
fMC->TrackPid();
111 bool startHit =
false, stopHit =
false;
112 if ((
fMC->IsTrackEntering()) || (
fMC->IsTrackInside() && !mTrackData.mHitStarted)) {
114 }
else if ((
fMC->IsTrackExiting() ||
fMC->IsTrackOut() ||
fMC->IsTrackStop())) {
120 mTrackData.mEnergyLoss +=
fMC->Edep();
122 if (!(startHit | stopHit)) {
127 mTrackData.mHitStarted =
true;
128 mTrackData.mEnergyLoss = 0.;
129 fMC->TrackMomentum(mTrackData.mMomentumStart);
130 fMC->TrackPosition(mTrackData.mPositionStart);
131 mTrackData.mTrkStatusStart =
true;
135 TLorentzVector positionStop;
136 fMC->TrackPosition(positionStop);
137 int trackId =
stack->GetCurrentTrackNumber();
139 math_utils::Point3D<float> posStart(mTrackData.mPositionStart.X(), mTrackData.mPositionStart.Y(), mTrackData.mPositionStart.Z());
140 math_utils::Point3D<float> posStop(positionStop.X(), positionStop.Y(), positionStop.Z());
141 math_utils::Vector3D<float> momStart(mTrackData.mMomentumStart.Px(), mTrackData.mMomentumStart.Py(), mTrackData.mMomentumStart.Pz());
143 Hit* p =
addHit(trackId, detId, posStart, posStop,
144 momStart, mTrackData.mMomentumStart.E(),
145 positionStop.T(), mTrackData.mEnergyLoss, particlePdg);
154 const math_utils::Point3D<float>& startPos,
155 const math_utils::Point3D<float>& endPos,
156 const math_utils::Vector3D<float>& startMom,
162 mHits->emplace_back(trackId, detId, startPos,
163 endPos, startMom, startE, endTime, eLoss, particlePdg);
164 return &(mHits->back());
199 const int unsens = 0, sens = 1;
204 float aScint[2] = {1.00784, 12.0107};
205 float zScint[2] = {1, 6};
206 float wScint[2] = {0.07085, 0.92915};
207 const float dScint = 1.023;
210 float aglass[2] = {28.0855, 15.9994};
211 float zglass[2] = {14., 8.};
212 float wglass[2] = {1., 2.};
213 const float dglass = 2.2;
220 float tmaxfd3 = -10.0;
224 float stepmin = -0.001;
228 tmaxfd3, stepmax, deemax, epsil, stepmin);
236 10., .01, .1, .003, .01);
241 LOGP(info,
"Creating FD3 geometry");
245 auto topVolume = (TGeoVolume*)gGeoManager->GetVolume(
"barrel");
249 TGeoVolumeAssembly *vFD3_ScintA, *vFD3_ScintC, *vFD3_CherA, *vFD3_CherC;
251 vFD3_ScintA = buildModuleScint(Constants::etaMin, baseParam.isSymmetric ? Constants::etaMax : Constants::etaMax2);
252 vFD3_ScintC = buildModuleScint(Constants::etaMin, Constants::etaMax);
253 vFD3_CherA = baseParam.isSymmetric ? buildModuleCherenkov_v1() : buildModuleCherenkov_v2();
254 vFD3_CherC = buildModuleCherenkov_v1();
256 vFD3_ScintA->SetName(
"FD3_ScintA");
257 vFD3_ScintC->SetName(
"FD3_ScintC");
258 vFD3_CherA->SetName(
"FD3_CherA");
259 vFD3_CherC->SetName(
"FD3_CherC");
261 topVolume->AddNode(vFD3_ScintA, 1,
new TGeoTranslation(0., 30.f, Constants::zScint));
262 topVolume->AddNode(vFD3_ScintC, 1,
new TGeoTranslation(0., 30.f, -Constants::zScint));
264 topVolume->AddNode(vFD3_CherA, 1,
new TGeoTranslation(0., 30.f, Constants::zCher));
265 topVolume->AddNode(vFD3_CherC, 1,
new TGeoTranslation(0., 30.f, -Constants::zCher));
268TGeoVolumeAssembly* Detector::buildModuleScint(
float etaMin,
float etaMax)
270 auto mod =
new TGeoVolumeAssembly(
"");
272 const TGeoMedium* medium = gGeoManager->GetMedium(
"FD3_Scintillator");
274 int nrings = Constants::nRingsScint, nsect = Constants::nSectScint;
275 float zmod = Constants::zScint, dz = Constants::dzScint;
277 for (
int ir = 0;
ir < nrings;
ir++) {
278 float eta1 = etaMax -
ir * (etaMax - etaMin) / nrings;
279 float eta2 = etaMax - (
ir + 1) * (etaMax - etaMin) / nrings;
280 float r1 = getRingSize(zmod, eta1), r2 = getRingSize(zmod, eta2);
281 LOG(info) <<
"Scintillator ring " <<
ir + 1 <<
": from " << r1 <<
" to " << r2;
282 for (
int ic = 0; ic < nsect; ic++) {
283 int cellId = mChannelCounter++;
285 float phi1 = ic * 360. / nsect;
286 float phi2 = (ic + 1) * 360. / nsect;
287 auto tbs =
new TGeoTubeSeg(
"tbs", r1, r2, dz / 2, phi1, phi2);
288 auto node =
new TGeoVolume(nodeName.c_str(), tbs, medium);
289 if (cellId < nrings * nsect) {
290 node->SetLineColor((
ir + ic) % 2 == 0 ? kRed : kRed - 7);
292 node->SetLineColor((
ir + ic) % 2 == 0 ? kBlue : kBlue - 7);
294 mod->AddNode(
node, 1);
301TGeoVolumeAssembly* Detector::buildModuleCherenkov_v1()
303 auto mod =
new TGeoVolumeAssembly(
"");
305 TGeoMedium* medium = gGeoManager->GetMedium(
"FD3_OpticalGlass");
307 float rsizeq = Constants::rsizeq, dz = Constants::dzCher;
311 float x[N] = {7.5f, 7.5f, 6.4f, 3.2f, 0.f, -3.2f, -6.4f, -7.5f, -7.5f, -7.5f, -6.4f, -3.2f,
312 0.f, 3.2f, 6.4f, 7.5f, 10.7f, 10.7f, 9.6f, 9.6f, 6.4f, 3.2f, 0.f, -3.2f,
313 -6.4f, -9.6f, -9.6f, -10.7f, -10.7f, -10.7f, -9.6f, -9.6f, -6.4f, -3.2f, 0.f, 3.2f,
314 6.4f, 9.6f, 9.6f, 10.7f, 13.9f, 13.9f, 12.8f, 12.8f, 9.6f, 6.4f, 3.2f, 0.f,
315 -3.2f, -6.4f, -9.6f, -12.8f, -12.8f, -13.9f, -13.9f, -13.9f, -12.8f, -12.8f, -9.6f, -6.4f,
316 -3.2f, 0.f, 3.2f, 6.4f, 9.6f, 12.8f, 12.8f, 13.9f};
318 float y[N] = {0.f, 3.2f, 6.4f, 7.5f, 7.5f, 7.5f, 6.4f, 3.2f, 0.f, -3.2f, -6.4f, -7.5f,
319 -7.5f, -7.5f, -6.4f, -3.2f, 0.f, 3.2f, 6.4f, 9.6f, 9.6f, 10.7f, 10.7f, 10.7f,
320 9.6f, 9.6f, 6.4f, 3.2f, 0.f, -3.2f, -6.4f, -9.6f, -9.6f, -10.7f, -10.7f, -10.7f,
321 -9.6f, -9.6f, -6.4f, -3.2f, 0.f, 3.2f, 6.4f, 9.6f, 12.8f, 12.8f, 13.9f, 13.9f,
322 13.9f, 12.8f, 12.8f, 9.6f, 6.4f, 3.2f, 0.f, -3.2f, -6.4f, -9.6f, -12.8f, -12.8f,
323 -13.9f, -13.9f, -13.9f, -12.8f, -12.8f, -9.6f, -6.4f, -3.2f};
325 for (
int i = 0;
i < N;
i++) {
326 int cellId = mChannelCounter++;
329 auto node =
new TGeoVolume(nodeName.c_str(),
box, medium);
330 node->SetLineColor(kOrange + 7);
331 mod->AddNode(
node, 1,
new TGeoTranslation(
x[
i],
y[
i], 0));
337TGeoVolumeAssembly* Detector::buildModuleCherenkov_v2()
339 auto mod =
new TGeoVolumeAssembly(
"");
341 TGeoMedium* medium = gGeoManager->GetMedium(
"FD3_OpticalGlass");
343 float rsizeq = Constants::rsizeq, dz = Constants::dzCher;
347 float x[N] = {4.6f, 3.2f, 0.f, -3.2f, -4.6f, -3.2f, 0.f, 3.2f, 7.8f, 6.4f, 6.4f, 3.2f,
348 0.f, -3.2f, -6.4f, -6.4f, -7.8f, -6.4f, -6.4f, -3.2f, 0.f, 3.2f, 6.4f, 6.4f,
349 11.f, 9.6f, 9.6f, 9.6f, 6.4f, 3.2f, 0.f, -3.2f, -6.4f, -9.6f, -9.6f, -9.6f,
350 -11.f, -9.6f, -9.6f, -9.6f, -6.4f, -3.2f, 0.f, 3.2f, 6.4f, 9.6f, 9.6f, 9.6f,
351 14.2f, 12.8f, 12.8f, 6.4f, 3.2f, 0.f, -3.2f, -6.4f, -12.8f, -12.8f, -14.2f, -12.8f,
352 -12.8f, -6.4f, -3.2f, 0.f, 3.2f, 6.4f, 12.8f, 12.8f};
354 float y[N] = {0.f, 3.2f, 4.6f, 3.2f, 0.f, -3.2f, -4.6f, -3.2f, 0.f, 3.2f, 6.4f, 6.4f,
355 7.8f, 6.4f, 6.4f, 3.2f, 0.f, -3.2f, -6.4f, -6.4f, -7.8f, -6.4f, -6.4f, -3.2f,
356 0.f, 3.2f, 6.4f, 9.6f, 9.6f, 9.6f, 11.f, 9.6f, 9.6f, 9.6f, 6.4f, 3.2f,
357 0.f, -3.2f, -6.4f, -9.6f, -9.6f, -9.6f, -11.f, -9.6f, -9.6f, -9.6f, -6.4f, -3.2f,
358 0.f, 3.2f, 6.4f, 12.8f, 12.8f, 14.2f, 12.8f, 12.8f, 6.4f, 3.2f, 0.f, -3.2f,
359 -6.4f, -12.8f, -12.8f, -14.2f, -12.8f, -12.8f, -6.4f, -3.2f};
361 for (
int i = 0;
i < N;
i++) {
362 int cellId = mChannelCounter++;
365 auto node =
new TGeoVolume(nodeName.c_str(),
box, medium);
366 node->SetLineColor(kOrange + 7);
367 mod->AddNode(
node, 1,
new TGeoTranslation(
x[
i],
y[
i], 0));
373void Detector::defineSensitiveVolumes()
375 LOG(info) <<
"Adding FD3 sentitive volumes...";
379 for (
int ivol = 0; ivol < mChannelCounter; ivol++) {
381 auto v = (TGeoVolume*)gGeoManager->GetVolume(volumeName.c_str());
386 mChannelId[volId] = ivol;
391void Detector::definePassiveVolumes()
396float Detector::getRingSize(
float z,
float eta)
398 return z * TMath::Tan(2 * TMath::ATan(TMath::Exp(-eta)));
Definition of the Stack class.
General constants in FD3.
std::unique_ptr< expressions::Node > node
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc true
Definition of the MagF class.
Definition of the Detector class.
TVirtualMC * fMC
flag for initialisation
void RegisterAny(const char *name, T *&obj, Bool_t toFile)
static FairRootManager * Instance()
int registerSensitiveVolumeAndGetVolID(std::string const &name)
Detector & operator=(const Detector &)
void Mixture(Int_t imat, const char *name, Float_t *a, Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat)
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)
static void initFieldTrackingParams(int &mode, float &maxfield)
std::string addNameTo(const char *ext) const
static const FD3BaseParam & Instance()
o2::fd3::Hit * addHit(int trackId, unsigned int detId, const math_utils::Point3D< float > &startPos, const math_utils::Point3D< float > &endPos, const math_utils::Vector3D< float > &startMom, double startE, double endTime, double eLoss, int particlePdg)
This method is an example of how to add your own point of type Hit to the clones array.
void InitializeO2Detector() override
void EndOfEvent() override
void ConstructGeometry() override
bool ProcessHits(FairVolume *v=nullptr) override
static GeometryTGeo * Instance()
static ShmManager & Instance()
GLsizei const GLint * box
GLdouble GLdouble GLdouble z
void freeSimVector(std::vector< T > *ptr)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)
Common utility functions.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)