19 #include "G4Region.hh" 20 #include "G4RegionStore.hh" 21 #include "G4LogicalVolumeStore.hh" 22 #include "G4ProcessTable.hh" 23 #include "G4MuonMinus.hh" 25 #include "G4PhysicalConstants.hh" 26 #include "G4SystemOfUnits.hh" 27 #include "G4VProcess.hh" 29 #include "G4ThreeVector.hh" 33 public Observer<const BeginOfTrack*>,
34 public Observer<const BeginOfEvent*>,
69 produces<float>(
"DBremEventWeight");
70 produces<float>(
"DBremLocationX");
71 produces<float>(
"DBremLocationY");
72 produces<float>(
"DBremLocationZ");
73 produces<float>(
"DBremAngle");
74 produces<float>(
"DBremInitialEnergy");
75 produces<float>(
"DBremFinalEnergy");
76 produces<float>(
"BiasFactor");
78 edm::LogVerbatim(
"DBremWatcher") <<
"DBremWatcher:: Save Sim Track if PDG code " 79 <<
"is one from the list of " <<
pdgs_.size() <<
" items";
80 for (
unsigned int k = 0;
k <
pdgs_.size(); ++
k)
85 G4Track* theTrack = (G4Track*)((*trk)());
88 int pdg = theTrack->GetDefinition()->GetPDGEncoding();
89 G4ThreeVector Vpos = theTrack->GetVertexPosition();
90 const G4VProcess* TrPro = theTrack->GetCreatorProcess();
91 if (TrPro !=
nullptr) {
92 if ((theTrack->GetCreatorProcess()->GetProcessName()) ==
"muDBrem") {
96 if (!theTrack->IsGoodForTracking()) {
97 theTrack->SetGoodForTrackingFlag(
true);
99 f_energy = theTrack->GetTotalEnergy();
112 LogDebug(
"DBremWatcher") <<
"Save SimTrack the Track " << theTrack->GetTrackID() <<
" Type " 113 << theTrack->GetDefinition()->GetParticleName() <<
" Momentum " 114 << theTrack->GetMomentum() / MeV <<
" MeV/c";
122 G4String
pname =
"muDBrem";
123 G4ProcessTable* ptable = G4ProcessTable::GetProcessTable();
132 G4Track* theTrack = (G4Track*)((*trk)());
134 const G4VProcess* TrPro = theTrack->GetCreatorProcess();
135 if (trkInfo && TrPro !=
nullptr) {
136 int pdg = theTrack->GetDefinition()->GetPDGEncoding();
139 (theTrack->GetCreatorProcess()->GetProcessName()) ==
"muDBrem") {
147 std::unique_ptr<float>
weight = std::make_unique<float>(
m_weight);
149 std::unique_ptr<float> vtxposx = std::make_unique<float>(
VertexPos.x());
150 std::unique_ptr<float> vtxposy = std::make_unique<float>(
VertexPos.y());
151 std::unique_ptr<float> vtxposz = std::make_unique<float>(
VertexPos.z());
155 std::unique_ptr<float> finalE = std::make_unique<float>(
f_energy / GeV);
157 float deflectionAngle = -1;
160 G4ThreeVector mother(
162 deflectionAngle = mother.angle(
finaltraj);
163 std::unique_ptr<float> dAngle = std::make_unique<float>(deflectionAngle);
164 std::unique_ptr<float> initialE = std::make_unique<float>(initialEnergy / CLHEP::GeV);
167 std::unique_ptr<float> bias = std::make_unique<float>(
biasFactor);
170 std::unique_ptr<float>
weight = std::make_unique<float>(0.);
Log< level::Info, true > LogVerbatim
#define DEFINE_SIMWATCHER(type)
DBremWatcher(edm::ParameterSet const &p)
void produce(edm::Event &, const edm::EventSetup &) override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
T getUntrackedParameter(std::string const &, T const &) const
Class providing the Dark Bremsstrahlung process class.
void update(const BeginOfTrack *trk) override
This routine will be called when the appropriate signal arrives.
~DBremWatcher() override=default
Power< A, B >::type pow(const A &a, const B &b)