Skip to content
Snippets Groups Projects
Commit f90acd83 authored by John Derek Chapman's avatar John Derek Chapman Committed by Graeme Stewart
Browse files

python/LArG4FastSimulationConfig.py (getFCALFastShower, getFCAL2FastShower):...

python/LArG4FastSimulationConfig.py (getFCALFastShower, getFCAL2FastShower): increase EMinEneShowerLib from 0.51 MeV to 3 MeV. ATLASSIM-2188. Tagging: LArG4FastSimulation-05-00-08-01 (LArG4FastSimulation-05-00-08-01)

	* Branch for 20.3.7.7 and 21.0.15
	* python/LArG4FastSimulationConfig.py
	(getFCALFastShower, getFCAL2FastShower): increase EMinEneShowerLib
	from 0.51 MeV to 3 MeV. ATLASSIM-2188
	* Tagging: LArG4FastSimulation-05-00-08-01

2016-09-01 Steve Farrell <Steven.Farrell@cern.ch>
	* Cleaned up long lines, whitespace, variable naming conventions.
	* Changed loop-by-value to loop-by-reference over EnergySpot in
	  LArFastShower to prevent unnecessary copies.
	* Fixed thread-unsafe usage of static LArG4Identifiers in the fastsim
	  SDs by converting them into class members.
	* Tagging: LArG4FastSimulation-05-00-08

2016-06-01  Zach Marshall <ZLMarshall@lbl.gov>

	* Tagging: LArG4FastSimulation-05-00-07
	* No shower libraries at very low energy.  Skipping the application for
	such particles.
...
(Long ChangeLog diff - truncated)


Former-commit-id: 5fb22dfd
parent 7f550a7a
No related branches found
No related tags found
No related merge requests found
Showing
with 202 additions and 154 deletions
...@@ -20,6 +20,7 @@ def getEMBFastShower(name="EMBFastShower", **kwargs): ...@@ -20,6 +20,7 @@ def getEMBFastShower(name="EMBFastShower", **kwargs):
kwargs.setdefault("AbsCrackEta2", 1.1) kwargs.setdefault("AbsCrackEta2", 1.1)
kwargs.setdefault("DetectorTag", 100000) kwargs.setdefault("DetectorTag", 100000)
kwargs.setdefault("SensitiveDetector", "BarrelFastSimDedicatedSD") kwargs.setdefault("SensitiveDetector", "BarrelFastSimDedicatedSD")
kwargs.setdefault("EMinEneShowerLib", 0.51)
return CfgMgr.LArFastShowerTool(name, **kwargs) return CfgMgr.LArFastShowerTool(name, **kwargs)
def getEMECFastShower(name="EMECFastShower", **kwargs): def getEMECFastShower(name="EMECFastShower", **kwargs):
...@@ -37,6 +38,7 @@ def getEMECFastShower(name="EMECFastShower", **kwargs): ...@@ -37,6 +38,7 @@ def getEMECFastShower(name="EMECFastShower", **kwargs):
kwargs.setdefault("AbsCrackEta2", 2.8) kwargs.setdefault("AbsCrackEta2", 2.8)
kwargs.setdefault("DetectorTag", 200000) kwargs.setdefault("DetectorTag", 200000)
kwargs.setdefault("SensitiveDetector", "EndcapFastSimDedicatedSD") kwargs.setdefault("SensitiveDetector", "EndcapFastSimDedicatedSD")
kwargs.setdefault("EMinEneShowerLib", 0.51)
return CfgMgr.LArFastShowerTool(name, **kwargs) return CfgMgr.LArFastShowerTool(name, **kwargs)
def getFCALFastShower(name="FCALFastShower", **kwargs): def getFCALFastShower(name="FCALFastShower", **kwargs):
...@@ -51,6 +53,7 @@ def getFCALFastShower(name="FCALFastShower", **kwargs): ...@@ -51,6 +53,7 @@ def getFCALFastShower(name="FCALFastShower", **kwargs):
kwargs.setdefault("AbsHighEta", 4.4) kwargs.setdefault("AbsHighEta", 4.4)
kwargs.setdefault("DetectorTag", 300000) kwargs.setdefault("DetectorTag", 300000)
kwargs.setdefault("SensitiveDetector", "FCALFastSimDedicatedSD") kwargs.setdefault("SensitiveDetector", "FCALFastSimDedicatedSD")
kwargs.setdefault("EMinEneShowerLib", 3.0)
return CfgMgr.LArFastShowerTool(name, **kwargs) return CfgMgr.LArFastShowerTool(name, **kwargs)
def getFCAL2FastShower(name="FCAL2FastShower", **kwargs): def getFCAL2FastShower(name="FCAL2FastShower", **kwargs):
...@@ -65,4 +68,5 @@ def getFCAL2FastShower(name="FCAL2FastShower", **kwargs): ...@@ -65,4 +68,5 @@ def getFCAL2FastShower(name="FCAL2FastShower", **kwargs):
kwargs.setdefault("AbsHighEta", 4.4) kwargs.setdefault("AbsHighEta", 4.4)
kwargs.setdefault("DetectorTag", 400000) kwargs.setdefault("DetectorTag", 400000)
kwargs.setdefault("SensitiveDetector", "FCALFastSimDedicatedSD") kwargs.setdefault("SensitiveDetector", "FCALFastSimDedicatedSD")
kwargs.setdefault("EMinEneShowerLib", 1.0)
return CfgMgr.LArFastShowerTool(name, **kwargs) return CfgMgr.LArFastShowerTool(name, **kwargs)
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "LArReadoutGeometry/EMBAccordionDetails.h" #include "LArReadoutGeometry/EMBAccordionDetails.h"
#include "LArReadoutGeometry/GeoStraightAccSection.h" #include "LArReadoutGeometry/GeoStraightAccSection.h"
#include "LArG4Code/EnergySpot.h" #include "LArG4Code/EnergySpot.h"
#include "LArG4Code/LArG4Identifier.h"
#include "StoreGate/StoreGateSvc.h" #include "StoreGate/StoreGateSvc.h"
using HepGeom::Point3D; using HepGeom::Point3D;
...@@ -138,17 +137,17 @@ void BarrelFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){ ...@@ -138,17 +137,17 @@ void BarrelFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){
} }
} }
static LArG4Identifier id; //static LArG4Identifier id;
id.clear(); m_larID.clear();
id << 4 // LArCalorimeter m_larID << 4 // LArCalorimeter
<< 1 // LArEM << 1 // LArEM
<< ((zIndex==0) ? -1:1) << ((zIndex==0) ? -1:1)
<< samplingIndex << samplingIndex
<< regionIndex << regionIndex
<< etaIndex << etaIndex
<< phiIndex; << phiIndex;
// call process to add this to the collection // call process to add this to the collection
SimpleHit(id, spot.GetTime(), spot.GetEnergy()); SimpleHit(m_larID, spot.GetTime(), spot.GetEnergy());
return; return;
} }
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
// of: we DO want it to execute it's end- // of: we DO want it to execute it's end-
#include "IFastSimDedicatedSD.h" #include "IFastSimDedicatedSD.h"
#include "LArG4Code/LArG4Identifier.h"
// Forward declarations
class EnergySpot; class EnergySpot;
class G4HCofThisEvent; class G4HCofThisEvent;
class LArVHitMerger; class LArVHitMerger;
...@@ -19,6 +21,7 @@ class EMBAccordionDetails; ...@@ -19,6 +21,7 @@ class EMBAccordionDetails;
class GeoStraightAccSection; class GeoStraightAccSection;
class StoreGateSvc; class StoreGateSvc;
/// NEEDS DOCUMENTATION
class BarrelFastSimDedicatedSD : public IFastSimDedicatedSD class BarrelFastSimDedicatedSD : public IFastSimDedicatedSD
{ {
...@@ -39,6 +42,8 @@ private: ...@@ -39,6 +42,8 @@ private:
const EMBAccordionDetails *m_accordionDetails; const EMBAccordionDetails *m_accordionDetails;
const GeoStraightAccSection *m_absorberSections; const GeoStraightAccSection *m_absorberSections;
/// My LAr identifier
LArG4Identifier m_larID;
}; };
#endif //LARG4FASTSIMULATION_BARRELFASTSIMDEDICATEDSD_H #endif //LARG4FASTSIMULATION_BARRELFASTSIMDEDICATEDSD_H
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "LArReadoutGeometry/EMECDetectorRegion.h" #include "LArReadoutGeometry/EMECDetectorRegion.h"
#include "LArG4Code/EnergySpot.h" #include "LArG4Code/EnergySpot.h"
#include "LArSimEvent/LArHitContainer.h" #include "LArSimEvent/LArHitContainer.h"
#include "LArG4Code/LArG4Identifier.h"
#include "GeoSpecialShapes/LArWheelCalculator.h" #include "GeoSpecialShapes/LArWheelCalculator.h"
#include "StoreGate/StoreGateSvc.h" #include "StoreGate/StoreGateSvc.h"
...@@ -113,9 +112,9 @@ void EndcapFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){ ...@@ -113,9 +112,9 @@ void EndcapFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){
//std::cout << didIt << "Compare phi gap: " << nGaps << ' ' << nBins << ' ' << gapsPerBin << ':' << phiBin << '/' << phiIndex << std::endl; //std::cout << didIt << "Compare phi gap: " << nGaps << ' ' << nBins << ' ' << gapsPerBin << ':' << phiBin << '/' << phiIndex << std::endl;
static LArG4Identifier id; //static LArG4Identifier id;
id.clear(); m_larID.clear();
id << 4 // LArCalorimeter m_larID << 4 // LArCalorimeter
<< 1 // LArEM << 1 // LArEM
<< sWheel << sWheel
<< samplingIndex << samplingIndex
...@@ -123,7 +122,7 @@ void EndcapFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){ ...@@ -123,7 +122,7 @@ void EndcapFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){
<< etaIndex << etaIndex
<< phiBin; << phiBin;
// call process to add this to the collection // call process to add this to the collection
SimpleHit(id, spot.GetTime(), spot.GetEnergy()); SimpleHit(m_larID, spot.GetTime(), spot.GetEnergy());
return; return;
} }
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// of: we DO want it to execute it's end- // of: we DO want it to execute it's end-
#include "IFastSimDedicatedSD.h" #include "IFastSimDedicatedSD.h"
#include "LArG4Code/LArG4Identifier.h"
class EnergySpot; class EnergySpot;
class G4HCofThisEvent; class G4HCofThisEvent;
...@@ -18,6 +19,7 @@ class EMECDetectorManager; ...@@ -18,6 +19,7 @@ class EMECDetectorManager;
class LArWheelCalculator; class LArWheelCalculator;
class StoreGateSvc; class StoreGateSvc;
/// NEEDS DOCUMENTATION
class EndcapFastSimDedicatedSD : public IFastSimDedicatedSD class EndcapFastSimDedicatedSD : public IFastSimDedicatedSD
{ {
...@@ -40,6 +42,8 @@ private: ...@@ -40,6 +42,8 @@ private:
LArWheelCalculator * m_outerWheelCalculatorPos; LArWheelCalculator * m_outerWheelCalculatorPos;
LArWheelCalculator * m_outerWheelCalculatorNeg; LArWheelCalculator * m_outerWheelCalculatorNeg;
/// My LAr identifier
LArG4Identifier m_larID;
}; };
#endif //LARG4FASTSIMULATION_ENDCAPFASTSIMDEDICATEDSD_H #endif //LARG4FASTSIMULATION_ENDCAPFASTSIMDEDICATEDSD_H
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "LArReadoutGeometry/FCALModule.h" #include "LArReadoutGeometry/FCALModule.h"
#include "LArG4Code/EnergySpot.h" #include "LArG4Code/EnergySpot.h"
#include "LArSimEvent/LArHitContainer.h" #include "LArSimEvent/LArHitContainer.h"
#include "LArG4Code/LArG4Identifier.h"
#include "GeoModelKernel/GeoTubs.h" #include "GeoModelKernel/GeoTubs.h"
#include "StoreGate/StoreGateSvc.h" #include "StoreGate/StoreGateSvc.h"
...@@ -83,20 +82,20 @@ void FCALFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){ ...@@ -83,20 +82,20 @@ void FCALFastSimDedicatedSD::ProcessSpot(const EnergySpot & spot){
// zSide is negative if z<0. // zSide is negative if z<0.
int zSide = iAmPositive ? 2:-2; int zSide = iAmPositive ? 2:-2;
static LArG4Identifier id; //static LArG4Identifier id;
id.clear(); m_larID.clear();
if (ok){ if (ok){
id << 4 // LArCalorimeter m_larID << 4 // LArCalorimeter
<< 3 // LArFCAL << 3 // LArFCAL
<< zSide // EndCap << zSide // EndCap
<< sampling // FCal Module # << sampling // FCal Module #
<< etaIndex << etaIndex
<< phiIndex; << phiIndex;
} else { } else {
return; return;
} }
// call process to add this to the collection // call process to add this to the collection
SimpleHit(id, spot.GetTime(), spot.GetEnergy()); SimpleHit(m_larID, spot.GetTime(), spot.GetEnergy());
return; return;
} }
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
// of: we DO want it to execute it's end- // of: we DO want it to execute it's end-
#include "IFastSimDedicatedSD.h" #include "IFastSimDedicatedSD.h"
#include "LArG4Code/LArG4Identifier.h"
class EnergySpot; class EnergySpot;
class LArVHitMerger; class LArVHitMerger;
class FCALDetectorManager; class FCALDetectorManager;
class StoreGateSvc; class StoreGateSvc;
/// NEEDS DOCUMENTATION
class FCALFastSimDedicatedSD : public IFastSimDedicatedSD class FCALFastSimDedicatedSD : public IFastSimDedicatedSD
{ {
public: public:
...@@ -32,6 +34,9 @@ public: ...@@ -32,6 +34,9 @@ public:
private: private:
FCALDetectorManager * m_fcalManager; FCALDetectorManager * m_fcalManager;
/// My LAr identifier
LArG4Identifier m_larID;
}; };
#endif //LARG4FASTSIMULATION_FCALFASTSIMDEDICATEDSD_H #endif //LARG4FASTSIMULATION_FCALFASTSIMDEDICATEDSD_H
...@@ -5,21 +5,21 @@ ...@@ -5,21 +5,21 @@
#ifndef LARG4FASTSIMULATION_IFASTSIMDEDICATEDSD_H #ifndef LARG4FASTSIMULATION_IFASTSIMDEDICATEDSD_H
#define LARG4FASTSIMULATION_IFASTSIMDEDICATEDSD_H #define LARG4FASTSIMULATION_IFASTSIMDEDICATEDSD_H
// This is the interface for the fast simulation dedicated sensitive detector.
#include "LArG4Code/LArG4SimpleSD.h" #include "LArG4Code/LArG4SimpleSD.h"
class EnergySpot; class EnergySpot;
class StoreGateSvc; class StoreGateSvc;
/// This is the interface for the fast simulation dedicated sensitive detector.
class IFastSimDedicatedSD : public LArG4SimpleSD { class IFastSimDedicatedSD : public LArG4SimpleSD {
public: public:
// Simple constructor and destructor /// Simple constructor and destructor
IFastSimDedicatedSD( std::string name , StoreGateSvc * detStore ) : LArG4SimpleSD( name , detStore ) {} IFastSimDedicatedSD( std::string name , StoreGateSvc * detStore ) : LArG4SimpleSD( name , detStore ) {}
~IFastSimDedicatedSD() {} ~IFastSimDedicatedSD() {}
// ProcessHitsMethod /// ProcessHitsMethod
/** Process a single energy spot from a frozen shower. /** Process a single energy spot from a frozen shower.
The appropriate region of the sensitive detector is calculated and a LArIdentifier is constructed*/ The appropriate region of the sensitive detector is calculated and a LArIdentifier is constructed*/
virtual void ProcessSpot(const EnergySpot & spot) = 0; virtual void ProcessSpot(const EnergySpot & spot) = 0;
......
...@@ -30,16 +30,18 @@ ...@@ -30,16 +30,18 @@
#undef _INFO_FSM_ #undef _INFO_FSM_
LArFastShower::LArFastShower(const std::string& name, const FastShowerConfigStruct& config, IFastSimDedicatedSD* fastSimDedicatedSD): LArFastShower::LArFastShower(const std::string& name, const FastShowerConfigStruct& config,
IFastSimDedicatedSD* fastSimDedicatedSD):
G4VFastSimulationModel(name), G4VFastSimulationModel(name),
m_configuration(config), m_configuration(config),
m_FastSimDedicatedSD(fastSimDedicatedSD), m_fastSimDedicatedSD(fastSimDedicatedSD),
m_showerLibSvc(nullptr), m_showerLibSvc(nullptr),
m_generate_starting_points(false), m_generate_starting_points(false),
m_starting_points_file(), m_starting_points_file(),
m_eventNum(0) m_eventNum(0)
{ {
enum DETECTOR {EMB=100000,EMEC=200000,FCAL1=300000,FCAL2=400000,FCAL3=500000,HECLOC=600000,HEC=700000}; enum DETECTOR { EMB=100000, EMEC=200000, FCAL1=300000, FCAL2=400000,
FCAL3=500000, HECLOC=600000, HEC=700000 };
m_detmap["EMB"]=EMB; m_detmap["EMB"]=EMB;
m_detmap["EMEC"]=EMEC; m_detmap["EMEC"]=EMEC;
...@@ -52,10 +54,10 @@ LArFastShower::LArFastShower(const std::string& name, const FastShowerConfigStru ...@@ -52,10 +54,10 @@ LArFastShower::LArFastShower(const std::string& name, const FastShowerConfigStru
IFastSimDedicatedSD* LArFastShower::fastShowerSD() IFastSimDedicatedSD* LArFastShower::fastShowerSD()
{ {
if ( !m_FastSimDedicatedSD ) { if ( !m_fastSimDedicatedSD ) {
throw std::runtime_error("LArFastShower: no pointer to IFastSimDedicatedSD!"); throw std::runtime_error("LArFastShower: no pointer to IFastSimDedicatedSD!");
} }
return m_FastSimDedicatedSD; return m_fastSimDedicatedSD;
} }
...@@ -86,8 +88,10 @@ G4bool LArFastShower::IsApplicable(const G4ParticleDefinition& particleType) ...@@ -86,8 +88,10 @@ G4bool LArFastShower::IsApplicable(const G4ParticleDefinition& particleType)
return m_applicableMap.find(particleType.GetPDGEncoding())->second; return m_applicableMap.find(particleType.GetPDGEncoding())->second;
} }
bool rez = false; bool rez = false;
if (( flagToShowerLib(particleType) ) if ( flagToShowerLib(particleType) &&
&& ( m_generate_starting_points || showerLibSvc()->checkLibrary( particleType.GetPDGEncoding() , m_configuration.m_detector_tag ) )) ( m_generate_starting_points ||
showerLibSvc()->checkLibrary( particleType.GetPDGEncoding(),
m_configuration.m_detector_tag ) ))
rez = true; rez = true;
m_applicableMap[particleType.GetPDGEncoding()] = rez; m_applicableMap[particleType.GetPDGEncoding()] = rez;
return rez; return rez;
...@@ -95,12 +99,12 @@ G4bool LArFastShower::IsApplicable(const G4ParticleDefinition& particleType) ...@@ -95,12 +99,12 @@ G4bool LArFastShower::IsApplicable(const G4ParticleDefinition& particleType)
G4bool LArFastShower::ModelTrigger(const G4FastTrack& fastTrack) G4bool LArFastShower::ModelTrigger(const G4FastTrack& fastTrack)
{ {
/* ============================================================================================================ /* ==========================================================================
Determine if the particle is to be returned to full Geant4 simulation. Determine if the particle is to be returned to full Geant4 simulation.
In the event where the particle is EITHER killed and parameterised OR simply killed, this must be done In the event where the particle is EITHER killed and parameterised OR
in the appropriate LArFastShower DoIt method. simply killed, this must be done in the appropriate LArFastShower DoIt method.
This method Checks: 1) Geometry; 2) Energy; 3) (for e+/e-) Containment This method Checks: 1) Geometry; 2) Energy; 3) (for e+/e-) Containment
============================================================================================================ */ ========================================================================== */
#ifdef _TRACE_FSM_ #ifdef _TRACE_FSM_
G4cout << "LArFastShower::commonTrigger" << G4endl; G4cout << "LArFastShower::commonTrigger" << G4endl;
...@@ -109,20 +113,20 @@ G4bool LArFastShower::ModelTrigger(const G4FastTrack& fastTrack) ...@@ -109,20 +113,20 @@ G4bool LArFastShower::ModelTrigger(const G4FastTrack& fastTrack)
// We are in a parameterized volume // We are in a parameterized volume
// Check if the particle is within energy bounds // Check if the particle is within energy bounds
G4double ParticleEnergy = fastTrack.GetPrimaryTrack()->GetKineticEnergy(); G4double particleEnergy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
G4ParticleDefinition& ParticleType = *(fastTrack.GetPrimaryTrack()->GetDefinition()); const G4ParticleDefinition& particleType = *(fastTrack.GetPrimaryTrack()->GetDefinition());
if ( flagToShowerLib(ParticleType) == true && if ( flagToShowerLib(particleType) == true &&
ParticleEnergy > minEneToShowerLib(ParticleType) && particleEnergy > minEneToShowerLib(particleType) &&
ParticleEnergy < maxEneToShowerLib(ParticleType) ) { particleEnergy < maxEneToShowerLib(particleType) ) {
#ifdef _TRACE_FSM_ #ifdef _TRACE_FSM_
G4cout << "Particle has energy (" << ParticleEnergy << ") for shower lib and shower lib is on! Accept particle!" << G4endl; G4cout << "Particle has energy (" << particleEnergy << ") for shower lib and shower lib is on! Accept particle!" << G4endl;
#endif #endif
} else { } else {
#ifdef _TRACE_FSM_ #ifdef _TRACE_FSM_
G4cout << "Particle has energy (" << ParticleEnergy << ") outside killing, shower lib and parametrisation " G4cout << "Particle has energy (" << particleEnergy << ") outside killing, shower lib and parametrisation "
<< "or some features are switched off ... returning it to Geant " << G4endl; << "or some features are switched off ... returning it to Geant " << G4endl;
#endif #endif
...@@ -132,7 +136,7 @@ G4bool LArFastShower::ModelTrigger(const G4FastTrack& fastTrack) ...@@ -132,7 +136,7 @@ G4bool LArFastShower::ModelTrigger(const G4FastTrack& fastTrack)
if (ForcedAccept(fastTrack)) return true; if (ForcedAccept(fastTrack)) return true;
if (ForcedDeny(fastTrack)) return false; if (ForcedDeny(fastTrack)) return false;
if( CheckContainment(fastTrack)==false) { if (CheckContainment(fastTrack)==false) {
#ifdef _TRACE_FSM_ #ifdef _TRACE_FSM_
G4cout << "LArFastShower::ModelTrigger() particle failed CheckContainment()... will not be parameterised: " << G4endl; G4cout << "LArFastShower::ModelTrigger() particle failed CheckContainment()... will not be parameterised: " << G4endl;
#endif #endif
...@@ -202,17 +206,19 @@ void LArFastShower::UseShowerLib(const G4FastTrack& fastTrack, G4FastStep& fastS ...@@ -202,17 +206,19 @@ void LArFastShower::UseShowerLib(const G4FastTrack& fastTrack, G4FastStep& fastS
// ----------------------------- // -----------------------------
// Get Shower from ShowerLibSvc // Get Shower from ShowerLibSvc
// ----------------------------- // -----------------------------
const std::vector<EnergySpot> shower = showerLibSvc()->getShower(fastTrack, m_configuration.m_detector_tag); const std::vector<EnergySpot> shower =
showerLibSvc()->getShower(fastTrack, m_configuration.m_detector_tag);
#ifdef _TRACE_DOIT_ #ifdef _TRACE_DOIT_
G4cout << "Got shower (" << shower.size() << ") from shower lib" << G4endl; G4cout << "Got shower (" << shower.size() << ") from shower lib" << G4endl;
#endif #endif
// loop over hits in shower // loop over hits in shower
for (auto a_spot : shower) { for (const auto& a_spot : shower) {
#ifdef _TRACE_DOIT_ #ifdef _TRACE_DOIT_
G4cout << "Make Spot: " << a_spot.GetPosition().x() << " " << a_spot.GetPosition().y() << " " << a_spot.GetPosition().z() G4cout << "Make Spot: " << a_spot.GetPosition().x() << " "
<< a_spot.GetPosition().y() << " " << a_spot.GetPosition().z()
<< " " << a_spot.GetEnergy() << " " << a_spot.GetTime() << G4endl; << " " << a_spot.GetEnergy() << " " << a_spot.GetTime() << G4endl;
#endif #endif
fastShowerSD()->ProcessSpot(a_spot); fastShowerSD()->ProcessSpot(a_spot);
...@@ -229,6 +235,8 @@ void LArFastShower::UseShowerLib(const G4FastTrack& fastTrack, G4FastStep& fastS ...@@ -229,6 +235,8 @@ void LArFastShower::UseShowerLib(const G4FastTrack& fastTrack, G4FastStep& fastS
return; return;
} }
// FIXME: Catching all exceptions and suppressing them? That's awful!!
catch (const std::exception & e) { catch (const std::exception & e) {
G4cout << "FastShower::UseShowerLib ERROR Handling an exception in LArFastShower::" << e.what() << G4endl; G4cout << "FastShower::UseShowerLib ERROR Handling an exception in LArFastShower::" << e.what() << G4endl;
return; return;
...@@ -239,14 +247,14 @@ void LArFastShower::UseShowerLib(const G4FastTrack& fastTrack, G4FastStep& fastS ...@@ -239,14 +247,14 @@ void LArFastShower::UseShowerLib(const G4FastTrack& fastTrack, G4FastStep& fastS
G4bool LArFastShower::CheckContainment(const G4FastTrack &fastTrack) G4bool LArFastShower::CheckContainment(const G4FastTrack &fastTrack)
{ {
G4ThreeVector DirectionShower = fastTrack.GetPrimaryTrack()->GetMomentumDirection(); G4ThreeVector showerDirection = fastTrack.GetPrimaryTrack()->GetMomentumDirection();
G4ThreeVector InitialPositionShower = fastTrack.GetPrimaryTrack()->GetPosition(); G4ThreeVector initialShowerPosition = fastTrack.GetPrimaryTrack()->GetPosition();
G4ThreeVector OrthoShower = DirectionShower.orthogonal(); G4ThreeVector orthoShower = showerDirection.orthogonal();
G4ThreeVector CrossShower = DirectionShower.cross(OrthoShower); G4ThreeVector crossShower = showerDirection.cross(orthoShower);
#ifdef _TRACE_FSM_ #ifdef _TRACE_FSM_
G4cout << "LArFastShower::CheckContainment() OrthoShower: " << OrthoShower << G4endl; G4cout << "LArFastShower::CheckContainment() orthoShower: " << orthoShower << G4endl;
G4cout << "LArFastShower::CheckContainment() CrossShower: " << CrossShower << G4endl; G4cout << "LArFastShower::CheckContainment() crossShower: " << crossShower << G4endl;
#endif #endif
//Build 5 points at the shower max. edges and far end //Build 5 points at the shower max. edges and far end
...@@ -267,42 +275,46 @@ G4bool LArFastShower::CheckContainment(const G4FastTrack &fastTrack) ...@@ -267,42 +275,46 @@ G4bool LArFastShower::CheckContainment(const G4FastTrack &fastTrack)
G4double R = showerLibSvc()->getContainmentR(fastTrack,m_configuration.m_detector_tag); G4double R = showerLibSvc()->getContainmentR(fastTrack,m_configuration.m_detector_tag);
if (Z == 0.0 && R == 0.0) { if (Z == 0.0 && R == 0.0) {
//no containment check // no containment check
return true; return true;
} }
G4double Zmx = Z / 3; //<-here is OUR magic number. looking on the hit distribution plot, it seems that that way most of hits will be inside
G4int CosPhi[4] = {1,0,-1,0}; // Here is OUR magic number. Looking on the hit distribution plot,
G4int SinPhi[4] = {0,1,0,-1}; // it seems that that way most of hits will be inside
G4double Zmx = Z / 3;
G4int cosPhi[4] = {1,0,-1,0};
G4int sinPhi[4] = {0,1,0,-1};
#ifdef _TRACE_FSM_ #ifdef _TRACE_FSM_
G4cout << "LArFastShower::CheckContainment() R = " << R << G4endl; G4cout << "LArFastShower::CheckContainment() R = " << R << G4endl;
G4cout << "LArFastShower::CheckContainment() Z = " << Z << G4endl; G4cout << "LArFastShower::CheckContainment() Z = " << Z << G4endl;
#endif #endif
G4ThreeVector Position; G4ThreeVector position;
G4VSolid* SolidCalo = fastTrack.GetEnvelopeSolid(); G4VSolid* caloSolid = fastTrack.GetEnvelopeSolid();
const G4AffineTransform* AffineTransformation = fastTrack.GetAffineTransformation(); const G4AffineTransform* affineTransformation = fastTrack.GetAffineTransformation();
//Startpoint //Startpoint
Position = InitialPositionShower; position = initialShowerPosition;
AffineTransformation->ApplyPointTransform(Position); affineTransformation->ApplyPointTransform(position);
if(SolidCalo->Inside(Position) == kOutside) if(caloSolid->Inside(position) == kOutside)
return false; return false;
//Longitudinal Endpoint //Longitudinal Endpoint
Position = InitialPositionShower + Z*DirectionShower; position = initialShowerPosition + Z*showerDirection;
AffineTransformation->ApplyPointTransform(Position); affineTransformation->ApplyPointTransform(position);
if(SolidCalo->Inside(Position) == kOutside) if(caloSolid->Inside(position) == kOutside)
return false; return false;
//Lateral Spread //Lateral Spread
for(int i=0; i<4 ;i++) for(int i=0; i<4 ;i++)
{ {
Position = InitialPositionShower + Zmx*DirectionShower + R*CosPhi[i]*OrthoShower + R*SinPhi[i]*CrossShower; position = initialShowerPosition + Zmx*showerDirection +
AffineTransformation->ApplyPointTransform(Position); R*cosPhi[i]*orthoShower + R*sinPhi[i]*crossShower;
if(SolidCalo->Inside(Position) == kOutside) affineTransformation->ApplyPointTransform(position);
if(caloSolid->Inside(position) == kOutside)
return false; return false;
} }
...@@ -316,8 +328,8 @@ G4bool LArFastShower::CheckContainment(const G4FastTrack &fastTrack) ...@@ -316,8 +328,8 @@ G4bool LArFastShower::CheckContainment(const G4FastTrack &fastTrack)
HepMC::GenEvent * LArFastShower::GetGenEvent(const G4FastTrack &fastTrack) HepMC::GenEvent * LArFastShower::GetGenEvent(const G4FastTrack &fastTrack)
{ {
G4ThreeVector PositionShower = fastTrack.GetPrimaryTrack()->GetPosition(); G4ThreeVector showerPos = fastTrack.GetPrimaryTrack()->GetPosition();
G4ThreeVector MomentumShower = fastTrack.GetPrimaryTrack()->GetMomentum(); G4ThreeVector showerMom = fastTrack.GetPrimaryTrack()->GetMomentum();
G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy(); G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
...@@ -325,12 +337,15 @@ HepMC::GenEvent * LArFastShower::GetGenEvent(const G4FastTrack &fastTrack) ...@@ -325,12 +337,15 @@ HepMC::GenEvent * LArFastShower::GetGenEvent(const G4FastTrack &fastTrack)
if (pdgcode < 0) pdgcode = -pdgcode; // hack for positrons. let it be electrons. if (pdgcode < 0) pdgcode = -pdgcode; // hack for positrons. let it be electrons.
// new event. Signal processing = 0, event number "next" // new event. Signal processing = 0, event number "next"
HepMC::GenEvent * ge = new HepMC::GenEvent( 0, ++m_eventNum); HepMC::GenEvent* ge = new HepMC::GenEvent( 0, ++m_eventNum);
// vertex. Position of the shower, time = 0 // vertex. Position of the shower, time = 0
HepMC::GenVertex * gv = new HepMC::GenVertex(HepMC::FourVector(PositionShower.x(),PositionShower.y(),PositionShower.z(),0)); HepMC::GenVertex* gv = new HepMC::GenVertex(
HepMC::FourVector(showerPos.x(), showerPos.y(), showerPos.z(), 0) );
ge->add_vertex(gv); ge->add_vertex(gv);
// particle. FourVector of the shower, pdgcode, status = 1 // particle. FourVector of the shower, pdgcode, status = 1
HepMC::GenParticle * gp = new HepMC::GenParticle(HepMC::FourVector(MomentumShower.x(),MomentumShower.y(),MomentumShower.z(),energy), pdgcode,1); HepMC::GenParticle* gp = new HepMC::GenParticle(
HepMC::FourVector(showerMom.x(), showerMom.y(), showerMom.z(), energy),
pdgcode, 1 );
gv->add_particle_out(gp); gv->add_particle_out(gp);
// return auto_pointer. will be deleted automatically // return auto_pointer. will be deleted automatically
...@@ -393,25 +408,25 @@ bool LArFastShower::generateFSStartingPoint( const HepMC::GenEvent * ge ) const ...@@ -393,25 +408,25 @@ bool LArFastShower::generateFSStartingPoint( const HepMC::GenEvent * ge ) const
} }
G4bool LArFastShower::ForcedAccept(const G4FastTrack & fastTrack) G4bool LArFastShower::ForcedAccept(const G4FastTrack & fastTrack)
{ {
G4ThreeVector InitialPositionShower = fastTrack.GetPrimaryTrack()->GetPosition(); G4ThreeVector initialShowerPosition = fastTrack.GetPrimaryTrack()->GetPosition();
// if ( !m_configuration.m_containHigh && // if ( !m_configuration.m_containHigh &&
// ( InitialPositionShower.eta()>=m_configuration.m_absHighEta || // ( initialShowerPosition.eta()>=m_configuration.m_absHighEta ||
// InitialPositionShower.eta()<=-m_configuration.m_absHighEta ) ) return true; // initialShowerPosition.eta()<=-m_configuration.m_absHighEta ) ) return true;
if ( !m_configuration.m_containHigh && if ( !m_configuration.m_containHigh &&
( InitialPositionShower.eta()>m_configuration.m_absHighEta || ( initialShowerPosition.eta()>m_configuration.m_absHighEta ||
InitialPositionShower.eta()<-m_configuration.m_absHighEta ) ) return true; initialShowerPosition.eta()<-m_configuration.m_absHighEta ) ) return true;
if ( !m_configuration.m_containCrack && if ( !m_configuration.m_containCrack &&
( ( InitialPositionShower.eta()>m_configuration.m_absCrackEta1 && ( ( initialShowerPosition.eta()>m_configuration.m_absCrackEta1 &&
InitialPositionShower.eta()<m_configuration.m_absCrackEta2 ) || initialShowerPosition.eta()<m_configuration.m_absCrackEta2 ) ||
( InitialPositionShower.eta()<-m_configuration.m_absCrackEta1 && ( initialShowerPosition.eta()<-m_configuration.m_absCrackEta1 &&
InitialPositionShower.eta()>-m_configuration.m_absCrackEta2 ) ) ) return true; initialShowerPosition.eta()>-m_configuration.m_absCrackEta2 ) ) ) return true;
if ( !m_configuration.m_containLow && if ( !m_configuration.m_containLow &&
( InitialPositionShower.eta()<m_configuration.m_absLowEta || ( initialShowerPosition.eta()<m_configuration.m_absLowEta ||
InitialPositionShower.eta()>-m_configuration.m_absLowEta ) ) return true; initialShowerPosition.eta()>-m_configuration.m_absLowEta ) ) return true;
return false; return false;
} }
......
...@@ -5,14 +5,17 @@ ...@@ -5,14 +5,17 @@
#ifndef LARG4FASTSIMULATION_LARFASTSHOWER_H #ifndef LARG4FASTSIMULATION_LARFASTSHOWER_H
#define LARG4FASTSIMULATION_LARFASTSHOWER_H #define LARG4FASTSIMULATION_LARFASTSHOWER_H
// STL includes
#include <string>
#include <map>
// Geant4 includes
#include "G4VFastSimulationModel.hh" #include "G4VFastSimulationModel.hh"
// Needed by the tool handle // Local includes
#include "FastShowerConfigStruct.h" #include "FastShowerConfigStruct.h"
#include <string> // Forward declarations
#include <map>
namespace HepMC { namespace HepMC {
class GenEvent; class GenEvent;
class IO_GenEvent; class IO_GenEvent;
...@@ -20,63 +23,76 @@ namespace HepMC { ...@@ -20,63 +23,76 @@ namespace HepMC {
class IFastSimDedicatedSD; class IFastSimDedicatedSD;
class ILArG4ShowerLibSvc; class ILArG4ShowerLibSvc;
class LArFastShower: public G4VFastSimulationModel
/// NEEDS DOCUMENTATION
class LArFastShower : public G4VFastSimulationModel
{ {
public: public:
LArFastShower(const std::string& name, const FastShowerConfigStruct& config, IFastSimDedicatedSD *fastSimDedicatedSD); //!< Default constructor /// Constructor
LArFastShower(const std::string& name, const FastShowerConfigStruct& config,
IFastSimDedicatedSD* fastSimDedicatedSD);
virtual ~LArFastShower() {} //!< Default destructor /// Empty destructor
virtual ~LArFastShower() {}
/** Determines the applicability of the fast sim model to this particle type /** Determines the applicability of the fast sim model to this particle type
Called once for each track picked up by Geant as it enters a region with the fast sim assigned to it. Called once for each track picked up by Geant as it enters a region with the fast sim assigned to it.
Currently returns false for all but photons and electrons.*/ Currently returns false for all but photons and electrons.*/
G4bool IsApplicable(const G4ParticleDefinition&) override; G4bool IsApplicable(const G4ParticleDefinition&) override;
/** Determines the applicability of the fast sim model to this particular track. /** Determines the applicability of the fast sim model to this particular track.
Checks that geometric location, energy, and particle type are within bounds. Also checks for Checks that geometric location, energy, and particle type are within bounds. Also checks for
containment of the particle's shower within a specific detector region.*/ containment of the particle's shower within a specific detector region.*/
virtual G4bool ModelTrigger(const G4FastTrack &) override; virtual G4bool ModelTrigger(const G4FastTrack &) override;
virtual G4bool ForcedAccept(const G4FastTrack &);//!< If it returns true, the particle will be parameterized without further checks virtual G4bool ForcedAccept(const G4FastTrack &);//!< If it returns true, the particle will be parameterized without further checks
virtual G4bool ForcedDeny (const G4FastTrack &); //!< If it returns true, the particle will be returned to G4 without further checks virtual G4bool ForcedDeny (const G4FastTrack &); //!< If it returns true, the particle will be returned to G4 without further checks
/** Assigns the track to the appropriate method for application of the fast simulation. /** Assigns the track to the appropriate method for application of the fast simulation.
Only called if ModelTrigger returns true.*/ Only called if ModelTrigger returns true.*/
void DoIt(const G4FastTrack&, G4FastStep&) override; void DoIt(const G4FastTrack&, G4FastStep&) override;
protected:
IFastSimDedicatedSD* fastShowerSD();
ILArG4ShowerLibSvc* showerLibSvc();
private: /// Method to kill a particle and deposit its energy using exponential decay function
const FastShowerConfigStruct m_configuration; void KillParticle(const G4FastTrack&, G4FastStep&);
protected: /// Function for the application of shower library
void UseShowerLib(const G4FastTrack&, G4FastStep&);
IFastSimDedicatedSD *m_FastSimDedicatedSD; //!< Shower library sensitive detector for this shower /// Function to check the containment of a shower within a regular detector region
IFastSimDedicatedSD* fastShowerSD(); virtual G4bool CheckContainment(const G4FastTrack &fastTrack);
ILArG4ShowerLibSvc *m_showerLibSvc; //!< Pointer to the shower library service
ILArG4ShowerLibSvc* showerLibSvc();
// Method to kill a particle and deposit its energy using exponential decay function HepMC::GenEvent* GetGenEvent(const G4FastTrack &fastTrack);
void KillParticle(const G4FastTrack&, G4FastStep&); //!< Simple kill function for low energy particles
void UseShowerLib(const G4FastTrack&, G4FastStep&); //!< Function for the application of shower library
virtual G4bool CheckContainment(const G4FastTrack &fastTrack); //!< Function to check the containment of a shower within a regular detector region /// get switch for frozen showers
bool flagToShowerLib ( const G4ParticleDefinition& particleType ) const;
/// get lower energy limit for frozen showers
double maxEneToShowerLib( const G4ParticleDefinition& particleType ) const;
/// get upper energy limit for frozen showers
double minEneToShowerLib( const G4ParticleDefinition& particleType ) const;
HepMC::GenEvent * GetGenEvent(const G4FastTrack &fastTrack); bool generateFSStartingPoint( const HepMC::GenEvent * ge) const;
// data members for configuration private:
bool m_generate_starting_points; const FastShowerConfigStruct m_configuration;
HepMC::IO_GenEvent *m_starting_points_file;
std::string m_detector_tag_str;
std::map<std::string,int> m_detmap;
bool flagToShowerLib ( const G4ParticleDefinition& particleType ) const; //!< get switch for frozen showers /// Shower library sensitive detector for this shower
double maxEneToShowerLib( const G4ParticleDefinition& particleType ) const; //!< get lower energy limit for frozen showers IFastSimDedicatedSD *m_fastSimDedicatedSD;
double minEneToShowerLib( const G4ParticleDefinition& particleType ) const; //!< get upper energy limit for frozen showers /// Pointer to the shower library service
ILArG4ShowerLibSvc *m_showerLibSvc;
bool generateFSStartingPoint( const HepMC::GenEvent * ge) const; // data members for configuration
bool m_generate_starting_points;
HepMC::IO_GenEvent* m_starting_points_file;
std::string m_detector_tag_str;
std::map<std::string,int> m_detmap;
private: int m_eventNum;
int m_eventNum; std::map<int,bool> m_applicableMap;
std::map<int,bool> m_applicableMap;
}; };
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
#include "LArFastShower.h" #include "LArFastShower.h"
#include "G4SDManager.hh" #include "G4SDManager.hh"
LArFastShowerTool::LArFastShowerTool(const std::string& type, const std::string& name, const IInterface *parent): LArFastShowerTool::LArFastShowerTool(const std::string& type, const std::string& name,
FastSimulationBase(type,name,parent), const IInterface *parent)
m_FastSimDedicatedSD (""), //Empty by default. FIXME Currently : FastSimulationBase(type, name, parent),
//public tool to reproduce old output, m_fastSimDedicatedSD (""), // Empty by default.
//switch to be private tool eventually. m_showerLibSvc("LArG4ShowerLibSvc", name)
m_showerLibSvc( "LArG4ShowerLibSvc" , name )
{ {
declareProperty("EFlagToShowerLib", m_configuration.m_e_FlagShowerLib = true, "Switch for e+/- frozen showers"); declareProperty("EFlagToShowerLib", m_configuration.m_e_FlagShowerLib = true, "Switch for e+/- frozen showers");
declareProperty("EMinEneShowerLib", m_configuration.m_e_MinEneShowerLib = 0.0*CLHEP::GeV, "Minimum energy for e+/- frozen showers"); declareProperty("EMinEneShowerLib", m_configuration.m_e_MinEneShowerLib = 0.0*CLHEP::GeV, "Minimum energy for e+/- frozen showers");
...@@ -32,27 +31,28 @@ LArFastShowerTool::LArFastShowerTool(const std::string& type, const std::string& ...@@ -32,27 +31,28 @@ LArFastShowerTool::LArFastShowerTool(const std::string& type, const std::string&
declareProperty("PionMinEneShowerLib", m_configuration.m_Pion_MinEneShowerLib = 0.0*CLHEP::GeV, "Minimum energy for neutron frozen showers"); declareProperty("PionMinEneShowerLib", m_configuration.m_Pion_MinEneShowerLib = 0.0*CLHEP::GeV, "Minimum energy for neutron frozen showers");
declareProperty("PionMaxEneShowerLib", m_configuration.m_Pion_MaxEneShowerLib = 2.0*CLHEP::GeV, "Maximum energy for neutron frozen showers"); declareProperty("PionMaxEneShowerLib", m_configuration.m_Pion_MaxEneShowerLib = 2.0*CLHEP::GeV, "Maximum energy for neutron frozen showers");
declareProperty("ContainLow", m_configuration.m_containLow = true, "Switch for containment at low eta"); declareProperty("ContainLow", m_configuration.m_containLow = true, "Switch for containment at low eta");
declareProperty("AbsLowEta", m_configuration.m_absLowEta, ""); declareProperty("AbsLowEta", m_configuration.m_absLowEta, "");
declareProperty("ContainHigh", m_configuration.m_containHigh = true, "Switch for containment at high eta"); declareProperty("ContainHigh", m_configuration.m_containHigh = true, "Switch for containment at high eta");
declareProperty("AbsHighEta", m_configuration.m_absHighEta, ""); declareProperty("AbsHighEta", m_configuration.m_absHighEta, "");
declareProperty("ContainCrack", m_configuration.m_containCrack = true, "Switch for containment in the crack region"); declareProperty("ContainCrack", m_configuration.m_containCrack = true, "Switch for containment in the crack region");
declareProperty("AbsCrackEta1", m_configuration.m_absCrackEta1, ""); declareProperty("AbsCrackEta1", m_configuration.m_absCrackEta1, "");
declareProperty("AbsCrackEta2", m_configuration.m_absCrackEta2, ""); declareProperty("AbsCrackEta2", m_configuration.m_absCrackEta2, "");
declareProperty("GeneratedStartingPointsFile", m_configuration.m_generated_starting_points_file = "", "Name of file for generated SPs. Do not touch until you want to produce a new library"); declareProperty("GeneratedStartingPointsFile", m_configuration.m_generated_starting_points_file = "",
"Name of file for generated SPs. Do not touch until you want to produce a new library");
declareProperty("GeneratedStartingPointsRatio", m_configuration.m_generated_starting_points_ratio = 0.02, "Ratio of SPs that goes to output"); declareProperty("GeneratedStartingPointsRatio", m_configuration.m_generated_starting_points_ratio = 0.02, "Ratio of SPs that goes to output");
declareProperty("DetectorTag", m_configuration.m_detector_tag, "Which detector is this?"); declareProperty("DetectorTag", m_configuration.m_detector_tag, "Which detector is this?");
declareProperty("SensitiveDetector" , m_FastSimDedicatedSD , "Fast sim dedicated SD for this setup"); declareProperty("SensitiveDetector" , m_fastSimDedicatedSD , "Fast sim dedicated SD for this setup");
declareProperty("ShowerLibSvc" , m_showerLibSvc, "Handle on the shower library service"); declareProperty("ShowerLibSvc" , m_showerLibSvc, "Handle on the shower library service");
m_configuration.m_showerLibSvcName=m_showerLibSvc.name(); m_configuration.m_showerLibSvcName = m_showerLibSvc.name();
declareInterface<IFastSimulation>(this); declareInterface<IFastSimulation>(this);
} }
StatusCode LArFastShowerTool::initialize() StatusCode LArFastShowerTool::initialize()
{ {
ATH_MSG_VERBOSE( name() << "::initialize()"); ATH_MSG_VERBOSE( name() << "::initialize()" );
CHECK( m_showerLibSvc.retrieve() ); CHECK( m_showerLibSvc.retrieve() );
return FastSimulationBase::initialize(); return FastSimulationBase::initialize();
} }
...@@ -60,23 +60,24 @@ StatusCode LArFastShowerTool::initialize() ...@@ -60,23 +60,24 @@ StatusCode LArFastShowerTool::initialize()
G4VFastSimulationModel* LArFastShowerTool::makeFastSimModel() G4VFastSimulationModel* LArFastShowerTool::makeFastSimModel()
{ {
ATH_MSG_DEBUG( "Initializing Fast Sim Model" ); ATH_MSG_DEBUG( "Initializing Fast Sim Model" );
IFastSimDedicatedSD * fastSD = dynamic_cast<IFastSimDedicatedSD*>(G4SDManager::GetSDMpointer()->FindSensitiveDetector(m_FastSimDedicatedSD,false)); IFastSimDedicatedSD* fastSD = dynamic_cast<IFastSimDedicatedSD*>(
G4SDManager::GetSDMpointer()->FindSensitiveDetector(m_fastSimDedicatedSD, false) );
if (fastSD){ if (fastSD){
ATH_MSG_INFO( "SD " << m_FastSimDedicatedSD << " already created." ); ATH_MSG_INFO( "SD " << m_fastSimDedicatedSD << " already created." );
} else if ("BarrelFastSimDedicatedSD"==m_FastSimDedicatedSD){ } else if ("BarrelFastSimDedicatedSD" == m_fastSimDedicatedSD){
fastSD = new BarrelFastSimDedicatedSD( &*detStore() ); fastSD = new BarrelFastSimDedicatedSD( &*detStore() );
} else if ("EndcapFastSimDedicatedSD"==m_FastSimDedicatedSD){ } else if ("EndcapFastSimDedicatedSD" == m_fastSimDedicatedSD){
fastSD = new EndcapFastSimDedicatedSD( &*detStore() ); fastSD = new EndcapFastSimDedicatedSD( &*detStore() );
} else if ("FCALFastSimDedicatedSD"==m_FastSimDedicatedSD){ } else if ("FCALFastSimDedicatedSD" == m_fastSimDedicatedSD){
fastSD = new FCALFastSimDedicatedSD( &*detStore() ); fastSD = new FCALFastSimDedicatedSD( &*detStore() );
} else { } else {
ATH_MSG_FATAL( "Fast sim SD type " << m_FastSimDedicatedSD << " not found!" ); ATH_MSG_FATAL( "Fast sim SD type " << m_fastSimDedicatedSD << " not found!" );
throw std::runtime_error("Bad SD name"); throw std::runtime_error("Bad SD name");
} }
G4SDManager::GetSDMpointer()->AddNewDetector(fastSD); G4SDManager::GetSDMpointer()->AddNewDetector(fastSD);
// Create a fresh Fast Sim Model // Create a fresh Fast Sim Model
return new LArFastShower(name(),m_configuration, fastSD); return new LArFastShower(name(), m_configuration, fastSD);
} }
StatusCode LArFastShowerTool::EndOfAthenaEvent() StatusCode LArFastShowerTool::EndOfAthenaEvent()
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
class G4FastSimulationModel; class G4FastSimulationModel;
/// NEEDS DOCUMENTATION
class LArFastShowerTool: public FastSimulationBase class LArFastShowerTool: public FastSimulationBase
{ {
public: public:
...@@ -37,7 +38,7 @@ protected: ...@@ -37,7 +38,7 @@ protected:
virtual G4VFastSimulationModel* makeFastSimModel() override final; virtual G4VFastSimulationModel* makeFastSimModel() override final;
private: private:
std::string m_FastSimDedicatedSD; //!< Shower library sensitive detector for this shower std::string m_fastSimDedicatedSD; //!< Shower library sensitive detector for this shower
ServiceHandle<ILArG4ShowerLibSvc> m_showerLibSvc; //!< Pointer to the shower library service ServiceHandle<ILArG4ShowerLibSvc> m_showerLibSvc; //!< Pointer to the shower library service
FastShowerConfigStruct m_configuration; FastShowerConfigStruct m_configuration;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment