17 #include "Randomize.hh"
26 declareProperty(
"FileNameList",
m_fileNameList,
"List of filenames for direct reading" );
29 enum DETECTOR {
EMB=100000,
EMEC=200000,
FCAL1=300000,
FCAL2=400000,FCAL3=500000,HECLOC=600000,
HEC=700000};
51 if (resolvedFilename.empty()) {
55 ATH_MSG_DEBUG(
"Resolving input filename to " << resolvedFilename);
58 TFile
rootfile(resolvedFilename.c_str(),
"READ");
61 ATH_MSG_WARNING(
"File " << resolvedFilename <<
" is not a valid ROOT file");
71 if (library ==
nullptr) {
72 ATH_MSG_WARNING(
"File " << resolvedFilename <<
" is not a valid library file");
77 ATH_MSG_WARNING(
"Library " << resolvedFilename <<
" is produced for unknown detector: " << library->
detector());
82 std::stringstream location;
104 #ifdef DEBUG_FrozenShowers
112 return StatusCode::SUCCESS;
120 libmap::const_iterator iter;
128 ATH_MSG_DEBUG(
"No statistics available for this kind of library");
130 delete (*iter).second ;
133 return StatusCode::SUCCESS;
144 location = detectorTag + particleCode;
146 libmap::const_iterator iter =
m_libraryMap.find(location);
148 return (*iter).second;
158 if (library !=
nullptr)
return true;
168 #ifdef DEBUG_FrozenShowers
169 std::vector<EnergySpot>
172 std::vector<EnergySpot>
179 if (library ==
nullptr) {
181 ATH_MSG_ERROR(
"No library for location: " << detectorTag <<
"/" <<
track.GetPrimaryTrack()->GetDefinition()->GetPDGEncoding());
182 return std::vector<EnergySpot>();
186 G4ThreeVector PositionShower =
track.GetPrimaryTrack()->GetPosition();
190 randomShift = (
int)(CLHEP::RandGaussZiggurat::shoot(G4Random::getTheEngine(), 0., 2.5)+0.5);
192 #ifdef DEBUG_FrozenShowers
193 std::vector<EnergySpot>* shower = library->
getShower(
track.GetPrimaryTrack(), m_statisticsMap[library], randomShift);
195 std::vector<EnergySpot>* shower = library->
getShower(
track.GetPrimaryTrack(),
nullptr, randomShift);
199 if (shower ==
nullptr) {
200 return std::vector<EnergySpot>();
204 G4ThreeVector DirectionShower =
track.GetPrimaryTrack()->GetMomentumDirection();
207 G4double tof =
track.GetPrimaryTrack()->GetGlobalTime() /
Units::ns;
213 for (hit = shower->begin(); hit != shower->end(); ++hit) {
214 G4ThreeVector hitpos = (*hit).GetPosition();
215 hitpos.rotateUz(DirectionShower);
216 (*hit).SetPosition(hitpos+PositionShower);
217 (*hit).SetTime((*hit).GetTime() +
time);
222 for (std::vector<EnergySpot>::const_iterator iter = shower->begin(); iter != shower->end(); ++iter) {
223 ATH_MSG_VERBOSE(
"EnergySpot: " << iter->GetPosition().x() <<
" " << iter->GetPosition().y() <<
" " << iter->GetPosition().z()
224 <<
" " << iter->GetEnergy() <<
" " << iter->GetTime());
228 return *std::unique_ptr< std::vector<EnergySpot> >(shower);
237 if (library ==
nullptr) {
250 if (library ==
nullptr) {