123 std::unique_ptr<fastsim::InteractionModel> interactionModel(
125 if (!interactionModel.get()) {
151 produces<edm::SimTrackContainer>();
152 produces<edm::SimVertexContainer>();
155 interactionModel->registerProducts(*
this);
157 produces<edm::PCaloHitContainer>(
"EcalHitsEB");
158 produces<edm::PCaloHitContainer>(
"EcalHitsEE");
159 produces<edm::PCaloHitContainer>(
"EcalHitsES");
160 produces<edm::PCaloHitContainer>(
"HcalHits");
161 produces<edm::SimTrackContainer>(
"MuonSimTracks");
207 myCalorimetry->getCalorimeter()->setupTopology(*theCaloTopology);
210 myCalorimetry->getHFShowerLibrary()->initHFShowerLibrary(iSetup);
218 std::vector<FSimTrack> myFSimTracks;
221 <<
"\n###############################";
224 for (std::unique_ptr<fastsim::Particle> particle = particleManager.nextParticle(*
_randomEngine); particle !=
nullptr;
235 if (particle->position().Perp2() < 128. * 128. &&
std::abs(particle->position().Z()) < 302.) {
251 particle->resetOnLayer();
256 if (particle->position().T() > 25) {
259 particle->resetOnLayer();
265 if (layer->
getThickness(particle->position(), particle->momentum()) > 1E-10) {
266 int nSecondaries = 0;
270 std::vector<std::unique_ptr<fastsim::Particle> > secondaries;
271 interactionModel->interact(*particle, *layer, secondaries, *
_randomEngine);
272 nSecondaries += secondaries.size();
273 particleManager.addSecondaries(particle->position(), particle->simTrackIndex(), secondaries, layer);
277 if (!particleFilter_.acceptsEn(*particle)) {
279 if (nSecondaries == 0)
280 particleManager.addEndVertex(particle.get());
287 <<
"\n-------------------------------";
291 if (!particle->isStable() && particle->remainingProperLifeTimeC() < 1E-10) {
293 std::vector<std::unique_ptr<fastsim::Particle> > secondaries;
296 particleManager.addSecondaries(particle->position(), particle->simTrackIndex(), secondaries);
301 <<
"\n###############################";
311 if (particle->position().Perp2() >= 128. * 128. ||
std::abs(particle->position().Z()) >= 302.) {
315 myFSimTracks.push_back(
createFSimTrack(particle.get(), &particleManager, *pdt));
317 if (!particle->isStable() && particle->remainingProperLifeTimeC() < 1E-10) {
322 <<
"\n###############################";
330 <<
"\n###############################";
338 interactionModel->storeProducts(iEvent);
345 for (
auto myFSimTrack : myFSimTracks) {
402 if (particle->
position().T() > 50) {
417 if (!myFSimTrack.
onEcal()) {
421 if (!myFSimTrack.
onHcal()) {
472 if (!myFSimTrack.
onEcal()) {
473 myFSimTrack.
setEcal(PP, success);
478 if (!myFSimTrack.
onHcal()) {
479 myFSimTrack.
setHcal(PP, success);
497 <<
"\n-------------------------------";
505 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_
T getParameter(std::string const &) const
void update(const edm::EventSetup &iSetup, const std::map< std::string, InteractionModel * > &interactionModelMap)
Initializes the tracker geometry.
std::vector< PCaloHit > PCaloHitContainer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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).
const math::XYZTLorentzVector & position() const
Return position of the particle.
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
fastsim::Geometry geometry_
The definition of the tracker according to python config.
double remainingProperLifeTimeC() const
Return the particle's remaining proper lifetime[in ct].
int genParticleIndex() const
Return index of the particle in the genParticle vector.
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)
virtual bool isForward() const =0
Returns false/true depending if the object is a (non-abstract) barrel/forward layer.
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.
int pdgId() const
Return pdgId of the particle.
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...
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)
bool getData(T &iHolder) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Base class for any interaction model between a particle and a tracker layer.
int simVertexIndex() const
Return index of the origin vertex.
~FastSimProducer() override
void setLayer1(const RawParticle &pp, int success)
Set the preshower layer1 variables.
#define DEFINE_FWK_MODULE(type)
const std::vector< InteractionModel * > & getInteractionModels() const
Return the vector of all interaction models that are assigned with a layer.
CaloType getCaloType() const
Hack to interface "old" Calorimetry with "new" Tracker.
Abs< T >::type abs(const T &t)
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.
std::vector< std::string > getParameterNames() const
void decay(const Particle &particle, std::vector< std::unique_ptr< Particle > > &secondaries, CLHEP::HepRandomEngine &engine) const
Decay particle using pythia.
int simTrackIndex() const
Return index of the SimTrack.
void produce(edm::Event &, const edm::EventSetup &) override
const HepMC::GenEvent * GetEvent() const
edm::ESWatcher< CaloTopologyRecord > watchCaloTopology_
double charge() const
Return charge of the particle.
std::vector< SimVertex > SimVertexContainer
FastSimProducer(const edm::ParameterSet &)
virtual const double getThickness(const math::XYZTLorentzVector &position) const =0
Return thickness of the layer at a given position.
Definition the tracker geometry (vectors of forward/barrel layers).
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)
Implementation of non-stable particle decays.
bool isStable() const
Returns true if particle is considered stable.
void setVFcal(const RawParticle &pp, int success)
Set the hcal variables.
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
(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
double getMagneticFieldZ(const math::XYZTLorentzVector &position) const
Initializes the tracker geometry.
fastsim::ParticleFilter particleFilter_
Decides which particles have to be propagated.
T get(const Candidate &c)