77#ifdef ZDC_FASTSIM_ONNX
80#ifndef ZDC_FASTSIM_ONNX
112 o2::zdc::Hit*
addHit(int32_t trackID, int32_t parentID, int32_t sFlag,
float primaryEnergy, int32_t detID, int32_t secID,
114 int32_t nphePMC, int32_t nphePMQ);
120 void createAsideBeamLine();
121 void createCsideBeamLine();
122 void createMagnets();
123 void createDetectors();
130 void defineSensitiveVolumes();
133 Bool_t calculateTableIndexes(
int& ibeta,
int& iangle,
int& iradius);
135 void resetHitIndices();
138 bool createOrAddHit(
int detector,
148 float eDep,
float x,
float y,
float z,
float px,
float py,
float pz)
151 if (mCurrentHitsIndices[detector - 1][sector] == -1) {
152 mTotLightPMC = mTotLightPMQ = 0;
153 if (currentMediumid == mMediumPMCid) {
155 }
else if (currentMediumid == mMediumPMQid) {
159 math_utils::Vector3D<float>
pos(
x,
y,
z);
160 math_utils::Vector3D<float> mom(px, py, pz);
161 addHit(trackn, parent, issecondary, trackenergy, detector, sector,
162 pos, mom, tof, xImp, eDep, mTotLightPMC, mTotLightPMQ);
164 mCurrentHitsIndices[detector - 1][sector] = mHits->size() - 1;
169 auto& curHit = (*mHits)[mCurrentHitsIndices[detector - 1][sector]];
171 curHit.setNoNumContributingSteps(curHit.getNumContributingSteps() + 1);
172 int nPMC{0}, nPMQ{0};
173 if (currentMediumid == mMediumPMCid) {
174 mTotLightPMC += nphe;
176 }
else if (currentMediumid == mMediumPMQid) {
177 mTotLightPMQ += nphe;
181 curHit.SetEnergyLoss(curHit.GetEnergyLoss() + eDep);
182 curHit.setPMCLightYield(curHit.getPMCLightYield() + nPMC);
183 curHit.setPMQLightYield(curHit.getPMQLightYield() + nPMQ);
190 void flushSpatialResponse();
193 float mPrimaryEnergy;
194 math_utils::Vector3D<float> mXImpact;
197 int32_t mMediumPMCid = -1;
198 int32_t mMediumPMQid = -2;
202 std::vector<o2::zdc::Hit>* mHits;
204 float mLumiLength = 0;
205 float mTCLIAAPERTURE = 3.5;
206 float mTCLIAAPERTURENEG = 3.5;
207 float mVCollSideCCentreY = 0.;
209 int mZNENVVolID = -1;
210 int mZPENVVolID = -1;
215 int mLastPrincipalTrackEntered = -1;
217 static constexpr int NUMDETS = 5;
218 static constexpr int NUMSECS = 5;
223 int mCurrentHitsIndices[NUMDETS][NUMSECS] = {-1};
225 static constexpr int ZNRADIUSBINS = 18;
226 static constexpr int ZPRADIUSBINS = 28;
227 static constexpr int ANGLEBINS = 90;
229 float mLightTableZN[4][ANGLEBINS][ZNRADIUSBINS] = {1.};
230 float mLightTableZP[4][ANGLEBINS][ZPRADIUSBINS] = {1.};
232 SpatialPhotonResponse mNeutronResponseImage;
234 SpatialPhotonResponse mProtonResponseImage;
236 TParticle mCurrentPrincipalParticle{};
239 using ParticlePhotonResponse = std::vector<std::pair<TParticle,
240 std::pair<SpatialPhotonResponse, SpatialPhotonResponse>>>;
242 ParticlePhotonResponse mResponses;
243 ParticlePhotonResponse* mResponsesPtr = &mResponses;
246#ifdef ZDC_FASTSIM_ONNX
247 fastsim::NeuralFastSimulation* mFastSimClassifier =
nullptr;
248 fastsim::NeuralFastSimulation* mFastSimModelNeutron =
nullptr;
249 fastsim::NeuralFastSimulation* mFastSimModelProton =
nullptr;
252 fastsim::processors::StandardScaler* mClassifierScaler =
nullptr;
253 fastsim::processors::StandardScaler* mModelScalerNeutron =
nullptr;
254 fastsim::processors::StandardScaler* mModelScalerProton =
nullptr;
257 using FastSimResults = std::vector<std::array<long, 5>>;
258 FastSimResults mFastSimResults;
261 bool FastSimToHits(
const Ort::Value& response,
const TParticle& particle,
int detector);
264 constexpr std::pair<const int, const int> determineDetectorSize(
int detector)
266 if (detector ==
ZNA || detector ==
ZNC) {
268 }
else if (detector ==
ZPA || detector ==
ZPC) {
276 template <
typename Det>
o2::zdc::Hit * addHit(int32_t trackID, int32_t parentID, int32_t sFlag, float primaryEnergy, int32_t detID, int32_t secID, math_utils::Vector3D< float > pos, math_utils::Vector3D< float > mom, float tof, math_utils::Vector3D< float > xImpact, double energyloss, int32_t nphePMC, int32_t nphePMQ)