9#include <background/modules/BeamBkgNeutron/BeamBkgNeutronModule.h>
15#include <simulation/dataobjects/BeamBackHit.h>
16#include <mdst/dataobjects/MCParticle.h>
17#include <pxd/dataobjects/PXDSimHit.h>
18#include <svd/dataobjects/SVDSimHit.h>
19#include <cdc/dataobjects/CDCSimHit.h>
20#include <arich/dataobjects/ARICHSimHit.h>
21#include <top/dataobjects/TOPSimHit.h>
22#include <ecl/dataobjects/ECLSimHit.h>
23#include <klm/dataobjects/KLMSimHit.h>
24#include <simulation/dataobjects/MCParticleTrajectory.h>
27#include <framework/datastore/StoreArray.h>
28#include <framework/datastore/RelationIndex.h>
29#include <framework/datastore/RelationArray.h>
32#include <framework/logging/Logger.h>
33#include <framework/gearbox/Const.h>
34#include <framework/geometry/B2Vector3.h>
58 setDescription(
"BeamBkgNeutronModule module. Used to extract information relevant for the neutron background from background files");
74 m_tree1 =
new TTree(
"tree1",
"BeamBackHit data");
75 m_tree2 =
new TTree(
"tree2",
"SimHits data");
117 B2INFO(
"BeamBkgNeutron: Processing. ");
134 for (Int_t i = 0; i < 13; i++) {
149 for (Int_t hit = 0; hit <
m_nSimHits[7]; hit++) {
154 if (280.0 < posZ && posZ < 288.0)
m_nSimHits[9]++;
155 else if (400.0 < posZ && posZ < 406.0)
m_nSimHits[10]++;
156 else if (-194.0 < posZ && posZ < -186.0)
m_nSimHits[11]++;
157 else if (-294.0 < posZ && posZ < -286.0)
m_nSimHits[12]++;
173 for (Int_t iHit = 0; iHit <
m_nSimHits[detID]; iHit++) {
189 for (Int_t iHit = 0; iHit <
m_nSimHits[detID]; iHit++) {
205 for (Int_t iHit = 0; iHit <
m_nSimHits[detID]; iHit++) {
221 for (Int_t iHit = 0; iHit <
m_nSimHits[detID]; iHit++) {
237 for (Int_t iHit = 0; iHit <
m_nSimHits[detID]; iHit++) {
253 for (Int_t iHit = 0; iHit <
m_nSimHits[detID]; iHit++) {
268 for (Int_t iHit = 0; iHit <
m_nSimHits[detID]; iHit++) {
291 for (Int_t iHit = 0; iHit < nHits; iHit++) {
294 if (bkgHit->
getPDG() == 2112) {
324 auto m_vtxProd = currParticle->
getVertex();
334 for (
auto rel : mcTrajectories.relations()) {
336 if (rel.weight <= 0)
continue;
368 B2INFO(
"BeamBkgNeutron finished.");
Class ARICHSimHit - Geant4 simulated hit for ARICH.
Class BeamBackHit - Stores hits from beam background simulation.
double getNeutronWeight() const
get the effective neutron weight
double getEnergy() const
Get energy of the particle.
int getTrackID() const
the traci ID of the particle
double getEnergyDeposit() const
Get particle energy deposit in sensitive volume.
double getEnergyAtExit() const
Get energy of the particle.
int getPDG() const
Get the lund code of the particle that hit the sensitive area.
double getTrackLength() const
the length of the track in the volume
ROOT::Math::XYZVector getMomentum() const
Get momentum of the particle hit.
ROOT::Math::XYZVector getPosition() const
Get global position of the particle hit.
int getIdentifier() const
Get the identifier of subdetector component in which hit occurred.
int getSubDet() const
Det the index of subdetector in which hit occurred.
Float_t m_mass
McParticle mass [GeV].
std::vector< Float_t > m_trj_pz
Z component of trajectory momentum.
Float_t m_lifeTime
McParticle lifetime [ns].
Float_t m_E_init
McParticle energy [GeV].
Float_t m_vtxProdX
McParticle prod.
Int_t m_iEntry
Entry identifier.
std::vector< Float_t > m_trj_py
Y component of trajectory momentum.
Float_t m_momentumY
Y component of momentum.
std::vector< Float_t > m_trj_z
Z component of trajectory position.
Float_t m_E_end
Ending energy.
std::vector< Float_t > m_trj_y
Y component of trajectory position.
Float_t m_positionY
Y component of position.
Float_t m_positionX
X component of position.
Float_t m_vtxProdZ
McParticle prod.
TTree * m_tree1
Output tree.
Float_t m_vtxProdY
McParticle prod.
Float_t m_momentumZ
Z component of momentum.
std::vector< Float_t > m_trj_x
X component of trajectory position.
TTree * m_tree2
Output tree.
Float_t m_E_start
Starting energy.
Int_t m_subDet
Subdetector.
Int_t m_nSimHits[13]
Array with number of SimHits.
std::string m_filename
Output file name.
Int_t m_momPDG[13]
Array with PDG momentum.
Int_t m_hitPDG[13]
Array with PDG hits.
Float_t m_eDep
Deposited energy.
Float_t m_trackLength
Track length.
Int_t m_iEvent
Event identifier.
TFile * m_ff
Output root file.
Float_t m_positionZ
Z component of position.
std::vector< Float_t > m_trj_px
X component of trajectory momentum.
Float_t m_momentumX
X component of momentum.
ClassECLSimHit - Geant4 simulated hit for the ECL.
float getPositionZ() const
Get hit global position z coordinate.
Class to save the full simulated trajectory of a particle.
A Class to store the Monte Carlo particle information.
float getEnergy() const
Return particle energy in GeV.
float getLifetime() const
Return the lifetime in ns.
float getMass() const
Return the particle mass in GeV.
ROOT::Math::XYZVector getVertex() const
Return production vertex position, shorthand for getProductionVertex().
int getPDG() const
Return PDG code of particle.
void setDescription(const std::string &description)
Sets the description of the module.
Class PXDSimHit - Geant4 simulated hit for the PXD.
Provides access to fast ( O(log n) ) bi-directional lookups on a specified relation.
const Element * getFirstElementTo(const TO &to) const
Return a pointer to the first relation Element of the given object.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
Class SVDSimHit - Geant4 simulated hit for the SVD.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Class to store simulated hits of Cherenkov photons on PMT's input for digitization module (TOPDigitiz...
virtual void event()
Event processor.
virtual void initialize()
Initialize the Module.
virtual void beginRun()
Called when entering a new run.
BeamBkgNeutronModule()
Constructor.
virtual void terminate()
Termination action.
virtual void endRun()
End-of-run action.
virtual ~BeamBkgNeutronModule()
Destructor.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
MCParticle * getMother() const
Returns a pointer to the mother particle.
bool isPrimaryParticle() const
Check if particle is a primary particle which was created by the generator (and not,...
Abstract base class for different kinds of events.
Small struct to encode a position/momentum without additional overhead.
const FROM * from
pointer of the element from which the relation points.