179{
180
181 const ShowerLib::IShowerLib* library =
getShowerLib(
track.GetPrimaryTrack()->GetDefinition()->GetPDGEncoding(), detectorTag);
182
183 if (library == nullptr) {
184
185 ATH_MSG_ERROR(
"No library for location: " << detectorTag <<
"/" <<
track.GetPrimaryTrack()->GetDefinition()->GetPDGEncoding());
186 return std::vector<EnergySpot>();
187 }
188
189
190 G4ThreeVector PositionShower =
track.GetPrimaryTrack()->GetPosition();
191
192
193 int randomShift = 0;
194 randomShift = (
int)(CLHEP::RandGaussZiggurat::shoot(G4Random::getTheEngine(), 0., 2.5)+0.5);
195
196#ifdef DEBUG_FrozenShowers
198#else
199 std::vector<EnergySpot>* shower = library->getShower(
track.GetPrimaryTrack(),
nullptr, randomShift);
200#endif
201
202
203 if (shower == nullptr) {
204 return std::vector<EnergySpot>();
205 }
206
207
208 G4ThreeVector DirectionShower =
track.GetPrimaryTrack()->GetMomentumDirection();
209
210
211 G4double tof =
track.GetPrimaryTrack()->GetGlobalTime() / Units::ns;
212 G4double
time = tof - (
track.GetPrimaryTrack()->GetPosition().
mag()/Units::c_light ) / Units::ns;
213
214 std::vector<EnergySpot>::iterator hit;
215
216
217 for (hit = shower->begin(); hit != shower->end(); ++hit) {
218 G4ThreeVector hitpos = (*hit).GetPosition();
219 hitpos.rotateUz(DirectionShower);
220 (*hit).SetPosition(hitpos+PositionShower);
221 (*hit).SetTime((*hit).GetTime() + time);
222 }
223
226 for (std::vector<EnergySpot>::const_iterator iter = shower->begin(); iter != shower->end(); ++iter) {
228 <<
" " <<
iter->GetEnergy() <<
" " <<
iter->GetTime());
229 }
230 }
231
232 return *std::unique_ptr< std::vector<EnergySpot> >(shower);
233}
Scalar mag() const
mag method
#define ATH_MSG_VERBOSE(x)
virtual std::vector< EnergySpot > * getShower(const G4Track *track, ShowerLibStatistics *stats, int randomShift) const =0
get shower for given G4 track
time(flags, cells_name, *args, **kw)
msgSvc
Provide convenience handles for various services.