Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-26 07:05:34

0001 /**
0002  \file
0003  Declaration of class Smear::Detector.
0004  
0005  \author    Michael Savastio
0006  \date      2011-08-19
0007  \copyright 2011 Brookhaven National Lab
0008  */
0009 
0010 #ifndef INCLUDE_EICSMEAR_SMEAR_DETECTOR_H_
0011 #define INCLUDE_EICSMEAR_SMEAR_DETECTOR_H_
0012 
0013 #include <list>
0014 #include <vector>
0015 
0016 #include <TObject.h>
0017 #include <TString.h>
0018 
0019 namespace erhic {
0020 
0021 class EventDis;
0022 class VirtualParticle;
0023 
0024 }  // namespace erhic
0025 
0026 namespace Smear {
0027 
0028 class Event;
0029 class ParticleMCS;
0030 class Smearer;
0031 
0032 /**
0033  The detector structure.
0034  A detector posseses a collection of Smearer objects, each smearing
0035  some variable(s).
0036  It contains a detector-level smearing function which
0037  applies smearing of all its devices to the provided ParticleMCS.
0038  The detector can also generate event-wise smeared
0039  kinematics if provided with smeared particles from that event.
0040  
0041  \todo Add consts where possible.
0042  \todo Implement data hiding
0043  */
0044 class Detector : public TObject {
0045  public:
0046   /**
0047    Default contructor.
0048    */
0049   Detector();
0050 
0051   /**
0052    Copy constructor.
0053    */
0054   Detector(const Detector&);
0055 
0056   /**
0057    Assignment operator.
0058    */
0059   Detector& operator=(const Detector&);
0060 
0061   /**
0062    Destructor.
0063    */
0064   virtual ~Detector();
0065 
0066   /**
0067    Adds a copy of the smearing device to this detector.
0068    The detector will use all its devices when applying smearing. 
0069    */
0070   void AddDevice(Smearer& device);
0071 
0072   /** 
0073    Set the method for calculating event kinematics if FillEventKinematics
0074    is used. String must contain "NM" for null momentum approximation
0075    (using scattered lepton), "JB" for Jacquet Blondel method,
0076    or "DA" for double angle method.
0077    Strings not containing one of these turns the method off.
0078    \remark Simply accessing the EventKinematicsComputer may be more
0079    straightforward
0080    */
0081   void SetEventKinematicsCalculator(TString);
0082 
0083   /**
0084    Delete all devices in the detector.
0085    */
0086   void DeleteAllDevices();
0087 
0088   /**
0089    Return a pointer to device number n from the detector.
0090    Devices are labeled in the order in which they are added minus 1.
0091    Do not delete the returned pointer.
0092    */
0093   Smearer* GetDevice(int index);
0094 
0095   /** Returns the number of devices in the detector */
0096   UInt_t GetNDevices() const;
0097 
0098   /**
0099    Calculate event-wise smeared kinematics for an event which has already
0100    had its particles smeared and stored in eventS.
0101    Newly calculated values are stored in eventS.
0102    
0103    This uses the null momentum (m->0) approximation for the scattered
0104    lepton, so you should be careful about using low energy muons, and if
0105    for some strange reason you want to use taus, this probably won't work
0106    too well.
0107    
0108    Also, the smeared lepton momentum (as opposed to energy) is used in
0109    the assumption that its smearing is less severe.
0110    */
0111   void FillEventKinematics(Event* event);
0112 
0113   /**
0114    Detector level particle smearing.
0115    Returns a pointer to a new smeared particle, which is a version of
0116    the input Particle that has been smeared by all the detector's devices.
0117    Smearing is only be applied to final-state particles.
0118    If the input particle is unstable or an initial- or intermediate-
0119    state particle, returns a null ParticleS pointer.  
0120    */
0121   ParticleMCS* Smear(const erhic::VirtualParticle&) const;
0122 
0123   /**
0124    Print information about all smearers to standard output.
0125    */
0126   virtual void Print(Option_t* = "") const;
0127 
0128   /**
0129    Returns the list of devices in this detector that accept a particle.
0130    */
0131   std::list<Smear::Smearer*> Accept(const erhic::VirtualParticle&) const;
0132 
0133   /**
0134      Turn off consistency checks and momentum regularization in Smear().
0135      Use only for legacy smear scripts from earlier versions (<~1.0.4)
0136   */
0137   virtual void SetLegacyMode( const bool mode=true );
0138   
0139   /**
0140      Check status of legacy mode.
0141   */
0142   virtual bool GetLegacyMode() const;
0143   
0144  protected:
0145   /**
0146    Returns pointers to new copies of all devices.
0147    */
0148   std::vector<Smear::Smearer*> CopyDevices() const;
0149 
0150   bool LegacyMode=false;
0151 
0152   bool useNM;
0153   bool useJB;
0154   bool useDA;
0155   std::vector<Smearer*> Devices;
0156 
0157   ClassDef(Smear::Detector, 1)
0158 };
0159 
0160 inline UInt_t Detector::GetNDevices() const {
0161   return Devices.size();
0162 }
0163 
0164 }  // namespace Smear
0165 
0166 #endif  // INCLUDE_EICSMEAR_SMEAR_DETECTOR_H_