10#include <generators/modules/GeneratorPreselectionModule.h>
11#include <analysis/utility/PCmsLabTransform.h>
12#include <framework/gearbox/Unit.h>
30 setDescription(
"Preselection based on generator truth information. Returns 0 if no cut have been passed, 1 if only the charged cut has been passed, 10 if only the photon cut has been passed, and 11 if both charged and photon cuts have been passed.");
39 addParam(
"applyInCMS",
m_applyInCMS,
"if true apply the P,Pt,theta, and energy cuts in the center of mass frame",
false);
40 addParam(
"stableParticles",
m_stableParticles,
"if true apply the selection criteria for stable particles in the generator",
false);
51 B2DEBUG(29,
"GeneratorPreselectionModule initialize");
77 B2DEBUG(250,
"number of charged passing cuts: " <<
m_nCharged);
78 B2DEBUG(250,
"number of photons passing cuts: " <<
m_nPhoton);
90 B2DEBUG(250,
"return value: " << retvalue);
107 const ROOT::Math::XYZVector& p = mc.getMomentum();
108 double energy = mc.getEnergy();
110 double theta = p.Theta();
116 theta = p_cms.Theta();
119 if (mc.getPDG() == 22) {
126 if (abs(mc.getCharge()) > 0.) {
127 B2DEBUG(250,
"pt = " << p.Rho() <<
" p=" << mom <<
" theta=" << theta <<
" thetamin=" <<
m_MinChargedTheta <<
" thetamax=" <<
138 B2RESULT(
"Final results of the preselection module:");
140 B2RESULT(
"\tPreselection with result " << finalResult.first <<
": " << finalResult.second <<
" times.");
143 return lhs + rhs.second;
146 B2RESULT(
"Total number of tested events: " << sumCounters);
bool m_stableParticles
if true apply the selection criteria for only stable particles in the generator
double m_nPhoton
number of photons
void initialize() override
Initialize the parameters.
int m_nPhotonMin
minimum number of photons.
double m_MaxPhotonTheta
maximum theta for each photon.
double m_MinPhotonTheta
minimum theta for each photon.
void event() override
Event processor.
double m_MaxChargedTheta
maximum theta for each charged particle.
GeneratorPreselectionModule()
Constructor: Sets the description, the properties and the parameters of the module.
StoreArray< MCParticle > m_mcparticles
store array for the MCParticles
void terminate() override
Print the results of the cuts.
double m_MinChargedP
selection criteria for charged
double m_MinChargedPt
minimum pT for each charged particle.
int m_nChargedMin
minimum number of charged particles.
bool m_applyInCMS
if true apply the selection criteria for charged in the center of mass system
int m_nPhotonMax
minimum number of photons.
void checkParticle(const MCParticle &mc)
called for each particle, checks for cuts.
StoreObjPtr< MCInitialParticles > m_initial
pointer to the actual beam parameters
std::string m_particleList
The name of the MCParticle collection.
std::map< double, unsigned int > m_resultCounter
final result
double m_MinPhotonEnergy
selection criteria for photons
double m_MinChargedTheta
minimum theta for each charged particle.
int m_nChargedMax
minimum number of charged particles.
A Class to store the Monte Carlo particle information.
@ c_Initial
bit 5: Particle is initial such as e+ or e- and not going to Geant4
@ c_PrimaryParticle
bit 0: Particle is primary particle.
@ c_IsVirtual
bit 4: Particle is virtual and not going to Geant4.
@ c_StableInGenerator
bit 1: Particle is stable, i.e., not decaying in the generator.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
void setReturnValue(int value)
Sets the return value for this module as integer.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
static const double deg
degree to radians
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.
Abstract base class for different kinds of events.