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();
129 static Bool_t withZEM();
136 void defineSensitiveVolumes();
139 Bool_t calculateTableIndexes(
int& ibeta,
int& iangle,
int& iradius);
141 void resetHitIndices();
144 bool createOrAddHit(
int detector,
154 float eDep,
float x,
float y,
float z,
float px,
float py,
float pz)
157 if (mCurrentHitsIndices[detector - 1][sector] == -1) {
158 mTotLightPMC = mTotLightPMQ = 0;
159 if (currentMediumid == mMediumPMCid) {
161 }
else if (currentMediumid == mMediumPMQid) {
165 math_utils::Vector3D<float>
pos(
x,
y,
z);
166 math_utils::Vector3D<float> mom(px, py, pz);
167 addHit(trackn, parent, issecondary, trackenergy, detector, sector,
168 pos, mom, tof, xImp, eDep, mTotLightPMC, mTotLightPMQ);
170 mCurrentHitsIndices[detector - 1][sector] = mHits->size() - 1;
175 auto& curHit = (*mHits)[mCurrentHitsIndices[detector - 1][sector]];
177 curHit.setNoNumContributingSteps(curHit.getNumContributingSteps() + 1);
178 int nPMC{0}, nPMQ{0};
179 if (currentMediumid == mMediumPMCid) {
180 mTotLightPMC += nphe;
182 }
else if (currentMediumid == mMediumPMQid) {
183 mTotLightPMQ += nphe;
187 curHit.SetEnergyLoss(curHit.GetEnergyLoss() + eDep);
188 curHit.setPMCLightYield(curHit.getPMCLightYield() + nPMC);
189 curHit.setPMQLightYield(curHit.getPMQLightYield() + nPMQ);
196 void flushSpatialResponse();
199 float mPrimaryEnergy;
200 math_utils::Vector3D<float> mXImpact;
203 int32_t mMediumPMCid = -1;
204 int32_t mMediumPMQid = -2;
208 std::vector<o2::zdc::Hit>* mHits;
210 float mLumiLength = 0;
211 float mTCLIAAPERTURE = 3.5;
212 float mTCLIAAPERTURENEG = 3.5;
213 float mVCollSideCCentreY = 0.;
215 int mZNENVVolID = -1;
216 int mZPENVVolID = -1;
221 int mLastPrincipalTrackEntered = -1;
223 static constexpr int NUMDETS = 5;
224 static constexpr int NUMSECS = 5;
229 int mCurrentHitsIndices[NUMDETS][NUMSECS] = {-1};
231 static constexpr int ZNRADIUSBINS = 18;
232 static constexpr int ZPRADIUSBINS = 28;
233 static constexpr int ANGLEBINS = 90;
235 float mLightTableZN[4][ANGLEBINS][ZNRADIUSBINS] = {1.};
236 float mLightTableZP[4][ANGLEBINS][ZPRADIUSBINS] = {1.};
238 SpatialPhotonResponse mNeutronResponseImage;
240 SpatialPhotonResponse mProtonResponseImage;
242 TParticle mCurrentPrincipalParticle{};
245 using ParticlePhotonResponse = std::vector<std::pair<TParticle,
246 std::pair<SpatialPhotonResponse, SpatialPhotonResponse>>>;
248 ParticlePhotonResponse mResponses;
249 ParticlePhotonResponse* mResponsesPtr = &mResponses;
252#ifdef ZDC_FASTSIM_ONNX
253 fastsim::NeuralFastSimulation* mFastSimClassifier =
nullptr;
254 fastsim::NeuralFastSimulation* mFastSimModelNeutron =
nullptr;
255 fastsim::NeuralFastSimulation* mFastSimModelProton =
nullptr;
258 fastsim::processors::StandardScaler* mClassifierScaler =
nullptr;
259 fastsim::processors::StandardScaler* mModelScalerNeutron =
nullptr;
260 fastsim::processors::StandardScaler* mModelScalerProton =
nullptr;
263 using FastSimResults = std::vector<std::array<long, 5>>;
264 FastSimResults mFastSimResults;
267 bool FastSimToHits(
const Ort::Value& response,
const TParticle& particle,
int detector);
270 constexpr std::pair<const int, const int> determineDetectorSize(
int detector)
272 if (detector ==
ZNA || detector ==
ZNC) {
274 }
else if (detector ==
ZPA || detector ==
ZPC) {
282 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)