Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:20

0001 #ifndef FASTSIM_INTERACTIONMODEL
0002 #define FASTSIM_INTERACTIONMODEL
0003 
0004 #include "FWCore/Framework/interface/ProducesCollector.h"
0005 
0006 #include <string>
0007 #include <vector>
0008 #include <memory>
0009 
0010 ///////////////////////////////////////////////
0011 // Author: L. Vanelderen, S. Kurz
0012 // Date: 29 May 2017
0013 //////////////////////////////////////////////////////////
0014 
0015 namespace edm {
0016   class Event;
0017 }  // namespace edm
0018 
0019 class RandomEngineAndDistribution;
0020 
0021 namespace fastsim {
0022   class SimplifiedGeometry;
0023   class Particle;
0024 
0025   //! Base class for any interaction model between a particle and a tracker layer.
0026   /*!
0027         Every instance should have a distinct std::string name.
0028     */
0029   class InteractionModel {
0030   public:
0031     //! Constructor.
0032     /*!
0033             \param name Enique name for every instance.
0034         */
0035     InteractionModel(std::string name) : name_(name) {}
0036 
0037     //! Default destructor.
0038     virtual ~InteractionModel() { ; }
0039 
0040     //! Perform the interaction.
0041     /*!
0042             \param particle The particle that interacts with the matter.
0043             \param layer The detector layer that interacts with the particle.
0044             \param secondaries Particles that are produced in the interaction (if any).
0045             \param random The Random Engine.
0046         */
0047     virtual void interact(Particle& particle,
0048                           const SimplifiedGeometry& layer,
0049                           std::vector<std::unique_ptr<Particle> >& secondaries,
0050                           const RandomEngineAndDistribution& random) = 0;
0051 
0052     //! In case interaction produces and stores content in the event (e.g. TrackerSimHits).
0053     virtual void registerProducts(edm::ProducesCollector) const {}
0054 
0055     //! In case interaction produces and stores content in the event (e.g. TrackerSimHits).
0056     virtual void storeProducts(edm::Event& iEvent) { ; }
0057 
0058     //! Return (unique) name of this interaction.
0059     const std::string getName() { return name_; }
0060 
0061     //! Basic information output.
0062     friend std::ostream& operator<<(std::ostream& o, const InteractionModel& model);
0063 
0064   private:
0065     const std::string name_;  //!< A unique name for every instance of any interaction.
0066   };
0067   std::ostream& operator<<(std::ostream& os, const InteractionModel& interactionModel);
0068 
0069 }  // namespace fastsim
0070 
0071 #endif