Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-28 07:02:49

0001 /**
0002  \file
0003  Declaration of class Smear::EventSmear.
0004  
0005  \author    Michael Savastio
0006  \date      2011-10-10
0007  \copyright 2011 Brookhaven National Lab
0008  */
0009 
0010 #ifndef INCLUDE_EICSMEAR_SMEAR_EVENTSMEAR_H_
0011 #define INCLUDE_EICSMEAR_SMEAR_EVENTSMEAR_H_
0012 
0013 #include <cmath>
0014 #include <list>
0015 #include <vector>
0016 
0017 #include <TObject.h>
0018 
0019 #include "eicsmear/erhic/EventDis.h"
0020 #include "eicsmear/erhic/Kinematics.h"
0021 #include "eicsmear/smear/ParticleMCS.h"
0022 #include "eicsmear/erhic/VirtualParticle.h"
0023 
0024 namespace Smear {
0025 
0026 /*
0027  A generator-independent DIS event with smeared kinematics and particles.
0028  */
0029 class Event : public erhic::EventDis {
0030  public:
0031   /**
0032    Default constructor.
0033    */
0034   Event();
0035 
0036   /**
0037    Destructor.
0038    */
0039   virtual ~Event();
0040 
0041   /**
0042    Clear the particle list, sets event properties to default values.
0043    */
0044   virtual void Reset();
0045 
0046   /**
0047    Clears particle array, leaves event variables unchanged.
0048    */
0049   virtual void ClearParticles();
0050 
0051   /**
0052    Returns the number of tracks in the event.
0053    */
0054   virtual UInt_t GetNTracks() const;
0055 
0056   /**
0057    Returns the nth track.
0058    Returns NULL if the track number is out of the range [0, GetNTracks()).
0059    @param [in] The track index, in the range [0, GetNTracks()).
0060    */
0061   virtual const ParticleMCS* GetTrack(UInt_t) const;
0062 
0063   /**
0064    Returns the nth track.
0065    Returns NULL if the track number is out of the range [0, GetNTracks()).
0066    @param [in] The track index, in the range [0, GetNTracks()).
0067    */
0068   virtual ParticleMCS* GetTrack(UInt_t);
0069 
0070   virtual void SetQ2(double Q2) { QSquared = Q2; }
0071 
0072   virtual void SetX(double xB) { x = xB; }
0073 
0074   virtual void SetY(double inelasticity) { y = inelasticity; }
0075 
0076   virtual void SetW2(double W2) { WSquared = W2; }
0077 
0078   virtual void SetNu(double Nu) { nu = Nu; }
0079 
0080   /**
0081    Returns a pointer to the incident lepton beam particle.
0082    Returns a NULL pointer if the particle cannot be located in the event.
0083    IMPORTANT - DO NOT DELETE THE POINTER OR BAD THINGS WILL HAPPEN!
0084    
0085    In the standard eRHIC Monte Carlo format, the incident lepton beam
0086    is assumed to be the first particle in the particle list.
0087    This is the behaviour implemented here.
0088    Derived classes can implement other selection mechanisms depending on
0089    their data format.
0090    */
0091   virtual const ParticleMCS* BeamLepton() const;
0092 
0093   /**
0094    Returns a pointer to the incident hadron beam particle.
0095    See also notes in BeamLepton().
0096    
0097    In the standard eRHIC Monte Carlo format, the incident hadron beam
0098    is assumed to be the second particle in the particle list.
0099    */
0100   virtual const ParticleMCS* BeamHadron() const;
0101 
0102   /**
0103    Returns a pointer to the exchanged boson.
0104    See also notes in BeamLepton().
0105    
0106    In the standard eRHIC Monte Carlo format, the exchanged boson
0107    is assumed to be the third particle in the particle list.
0108    */
0109   virtual const ParticleMCS* ExchangeBoson() const;
0110 
0111   /**
0112    Returns a pointer to the lepton beam particle after scattering.
0113    See also notes in BeamLepton().
0114    
0115    In the standard eRHIC Monte Carlo format, the scattered lepton beam
0116    is assumed to be the first final-state particle in the particle list
0117    with the same PDG code as the incident lepton beam.
0118    */
0119   virtual const ParticleMCS* ScatteredLepton() const;
0120 
0121   /**
0122    Add a new track to the end of the track list.
0123    The track must be allocated via new and is subsequently owned
0124    by the Event.
0125    */
0126   virtual void AddLast(ParticleMCS* particle);
0127 
0128   /**
0129    Yields all particles that belong to the hadronic final state.
0130    This is the same as the result of FinalState(), minus the scattered
0131    beam lepton (i.e. including leptons and bosons).
0132    */
0133   void HadronicFinalState(ParticlePtrList&) const;
0134 
0135   /**
0136    Returns a vector of pointers to all tracks in the event.
0137    Note that this includes NULL pointers to tracks that were not detected.
0138    Do not delete the pointers.
0139    */
0140   std::vector<const erhic::VirtualParticle*> GetTracks() const;
0141 
0142   /**
0143    Set which particle is the scattered lepton.
0144    */
0145   virtual void SetScattered(int index);
0146 
0147   /**
0148    Prints the attributes of this event to standard output.
0149    Prints event-wise kinematic values, and all tracks in the event.
0150    */
0151   virtual void Print(Option_t* = "") const;
0152 
0153  protected:
0154   Int_t nTracks;  ///< Number of particles (intermediate + final)
0155   std::vector<ParticleMCS*> particles;  ///< The smeared particle list
0156   Int_t mScatteredIndex;
0157 
0158   ClassDef(Smear::Event, 1)
0159 };
0160 
0161 inline UInt_t Event::GetNTracks() const {
0162   return particles.size();
0163 }
0164 
0165 inline const Smear::ParticleMCS* Event::GetTrack(UInt_t u) const {
0166   return (u < particles.size() ? particles.at(u) : NULL);
0167 }
0168 
0169 inline Smear::ParticleMCS* Event::GetTrack(UInt_t u) {
0170   return (u < particles.size() ? particles.at(u) : NULL);
0171 }
0172 
0173 inline const ParticleMCS* Event::BeamLepton() const {
0174   return (particles.empty() ? NULL : particles.front());
0175 }
0176 
0177 inline const ParticleMCS* Event::BeamHadron() const {
0178   return (particles.size() > 1 ? particles.at(1) : NULL);
0179 }
0180 
0181 inline const ParticleMCS* Event::ExchangeBoson() const {
0182   return NULL;
0183 }
0184 
0185 }  // namespace Smear
0186 
0187 typedef Smear::Event EventS;
0188 
0189 #endif  // INCLUDE_EICSMEAR_SMEAR_EVENTSMEAR_H_