105 geometry_(iConfig.getParameter<
edm::
ParameterSet>(
"trackerDefinition"), consumesCollector()),
106 caloGeometry_(iConfig.getParameter<
edm::
ParameterSet>(
"caloDefinition"), consumesCollector()),
107 beamPipeRadius_(iConfig.getParameter<double>(
"beamPipeRadius")),
108 deltaRchargedMother_(iConfig.getParameter<double>(
"deltaRchargedMother")),
109 particleFilter_(iConfig.getParameter<
edm::
ParameterSet>(
"particleFilter")),
110 _randomEngine(nullptr),
129 std::unique_ptr<fastsim::InteractionModel> interactionModel(
131 if (!interactionModel.get()) {
146 std::make_unique<CalorimetryManager>(
nullptr,
151 consumesCollector());
159 produces<edm::SimTrackContainer>();
160 produces<edm::SimVertexContainer>();
163 interactionModel->registerProducts(producesCollector());
165 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
166 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
167 produces<edm::PCaloHitContainer>(
"EcalHitsES");
168 produces<edm::PCaloHitContainer>(
"HcalHits");
169 produces<edm::SimTrackContainer>(
"MuonSimTracks");
209 if (newGeom || newTopo) {
214 myCalorimetry->getCalorimeter()->setupTopology(theCaloTopology);
217 myCalorimetry->getHFShowerLibrary()->initHFShowerLibrary(iSetup);
225 std::vector<FSimTrack> myFSimTracks;
228 <<
"\n###############################";
231 for (std::unique_ptr<fastsim::Particle> particle = particleManager.nextParticle(*
_randomEngine); particle !=
nullptr;
242 if (particle->position().Perp2() < 128. * 128. &&
std::abs(particle->position().Z()) < 302.) {
258 particle->resetOnLayer();
263 if (particle->position().T() > 25) {
266 particle->resetOnLayer();
272 if (
layer->getThickness(particle->position(), particle->momentum()) > 1E-10) {
273 int nSecondaries = 0;
277 std::vector<std::unique_ptr<fastsim::Particle> > secondaries;
279 nSecondaries += secondaries.size();
280 particleManager.addSecondaries(particle->position(), particle->simTrackIndex(), secondaries,
layer);
286 if (nSecondaries == 0)
287 particleManager.addEndVertex(particle.get());
294 <<
"\n-------------------------------";
298 if (!particle->isStable() && particle->remainingProperLifeTimeC() < 1E-10) {
300 std::vector<std::unique_ptr<fastsim::Particle> > secondaries;
304 particleManager.addSecondaries(particle->position(), particle->simTrackIndex(), secondaries);
309 <<
"\n###############################";
319 if (particle->position().Perp2() >= 128. * 128. ||
std::abs(particle->position().Z()) >= 302.) {
323 myFSimTracks.push_back(
createFSimTrack(particle.get(), &particleManager, pdt));
325 if (!particle->isStable() && particle->remainingProperLifeTimeC() < 1E-10) {
330 <<
"\n###############################";
338 <<
"\n###############################";
346 interactionModel->storeProducts(
iEvent);
353 for (
auto myFSimTrack : myFSimTracks) {
410 if (particle->
position().T() > 50) {
425 if (!myFSimTrack.
onEcal()) {
429 if (!myFSimTrack.
onHcal()) {
480 if (!myFSimTrack.
onEcal()) {
486 if (!myFSimTrack.
onHcal()) {
505 <<
"\n-------------------------------";
513 std::vector<std::unique_ptr<fastsim::Particle> > secondaries;
void beginStream(edm::StreamID id) override
std::vector< std::unique_ptr< fastsim::InteractionModel > > interactionModels_
All defined interaction models.
edm::ESWatcher< CaloGeometryRecord > watchCaloGeometry_
bool isStable() const
Returns true if particle is considered stable.
T getParameter(std::string const &) const
CaloType getCaloType() const
Hack to interface "old" Calorimetry with "new" Tracker.
std::vector< PCaloHit > PCaloHitContainer
fastsim::Geometry caloGeometry_
Hack to interface "old" calo to "new" tracking.
std::unique_ptr< RandomEngineAndDistribution > _randomEngine
The random engine.
The core class of the new SimplifiedGeometryPropagator.
Implementation of a generic detector layer (base class for forward/barrel layers).
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void update(const edm::EventSetup &iSetup, const std::map< std::string, InteractionModel *> &interactionModelMap)
Initializes the tracker geometry.
virtual const double getThickness(const math::XYZTLorentzVector &position) const =0
Return thickness of the layer at a given position.
Handles/tracks (possible) intersections of particle's trajectory and tracker layers.
Manages GenParticles and Secondaries from interactions.
double deltaRchargedMother_
Cut on deltaR for ClosestChargedDaughter algorithm (FastSim tracking)
def create(alignables, pedeDump, additionalData, outputFile, config)
HepPDT::ParticleDataTable ParticleDataTable
fastsim::Geometry geometry_
The definition of the tracker according to python config.
void decay(const Particle &particle, std::vector< std::unique_ptr< Particle > > &secondaries, CLHEP::HepRandomEngine &engine) const
Decay particle using pythia.
edm::EDGetTokenT< edm::HepMCProduct > genParticlesToken_
Token to get the genParticles.
void setEcal(const RawParticle &pp, int success)
Set the ecal variables.
fastsim::Decayer decayer_
Handles decays of non-stable particles using pythia.
void setGlobal()
particle did not decay before more detectors (useful for newProducer)
const math::XYZTLorentzVector & position() const
Return position of the particle.
virtual FSimTrack createFSimTrack(fastsim::Particle *particle, fastsim::ParticleManager *particleManager, HepPDT::ParticleDataTable const &particleTable)
void setLayer2(const RawParticle &pp, int success)
Set the preshower layer2 variables.
bool moveParticleToNextLayer(Particle &particle, const SimplifiedGeometry *&layer)
Move particle along its trajectory to the next intersection with any of the tracker layers...
const SimVertex getSimVertex(unsigned i)
Returns the position of a given SimVertex. Needed for interfacing the code with the old calorimetry...
double remainingProperLifeTimeC() const
Return the particle's remaining proper lifetime[in ct].
const SimTrack getSimTrack(unsigned i)
Returns a given SimTrack. Needed for interfacing the code with the old calorimetry.
RawParticle makeParticle(HepPDT::ParticleDataTable const *, int id, const math::XYZTLorentzVector &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Base class for any interaction model between a particle and a tracker layer.
~FastSimProducer() override
const edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > particleDataTableESToken_
void setLayer1(const RawParticle &pp, int success)
Set the preshower layer1 variables.
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryESToken_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
void addSecondaries(const math::XYZTLorentzVector &vertexPosition, int motherSimTrackId, std::vector< std::unique_ptr< Particle > > &secondaries, const SimplifiedGeometry *layer=nullptr)
Adds secondaries that are produced by any of the interactions (or particle decay) to the buffer...
double beamPipeRadius_
The radius of the beampipe.
int simTrackIndex() const
Return index of the SimTrack.
void produce(edm::Event &, const edm::EventSetup &) override
int simVertexIndex() const
Return index of the origin vertex.
bool acceptsEn(const Particle &particle) const
Kinematic cuts on the particle.
int pdgId() const
Return pdgId of the particle.
edm::ESWatcher< CaloTopologyRecord > watchCaloTopology_
virtual bool isForward() const =0
Returns false/true depending if the object is a (non-abstract) barrel/forward layer.
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyESToken_
std::vector< SimVertex > SimVertexContainer
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
FastSimProducer(const edm::ParameterSet &)
Definition the tracker geometry (vectors of forward/barrel layers).
double getMagneticFieldZ(const math::XYZTLorentzVector &position) const
Initializes the tracker geometry.
std::map< std::string, fastsim::InteractionModel * > interactionModelMap_
Each interaction model has a unique name.
static const std::string MESSAGECATEGORY
Category of debugging messages ("FastSimulation")
std::unique_ptr< CalorimetryManager > myCalorimetry
bool check(const edm::EventSetup &iSetup)
double charge() const
Return charge of the particle.
Implementation of non-stable particle decays.
void setVFcal(const RawParticle &pp, int success)
Set the hcal variables.
(Kinematic) cuts on the particles that are propagated.
void setHcal(const RawParticle &pp, int success)
Set the hcal variables.
Definition of a generic FastSim Particle which can be propagated through the detector (formerly Parti...
void endStream() override
std::vector< SimTrack > SimTrackContainer
std::vector< std::string > getParameterNames() const
fastsim::ParticleFilter particleFilter_
Decides which particles have to be propagated.
int genParticleIndex() const
Return index of the particle in the genParticle vector.