EMShower

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
#ifndef EMShower_H
#define EMShower_H

#include "CommonTools/BaseParticlePropagator/interface/RawParticle.h"

//Famos Headers
#include "FastSimulation/ShowerDevelopment/interface/EMECALShowerParametrization.h"
#include "FastSimulation/ShowerDevelopment/interface/RadialInterval.h"
#include "CLHEP/GenericFunctions/IncompleteGamma.hh"
#include "DataFormats/Math/interface/Vector3D.h"

#include <vector>

/** 
 * \author Patrick Janot
 * \date: 25-Jan-2004
 */

class EcalHitMaker;
class PreshowerHitMaker;
class HcalHitMaker;
class GammaDistributionGenerator;
class RandomEngineAndDistribution;
class GammaFunctionGenerator;

class EMShower {
  typedef math::XYZVector XYZPoint;

  typedef std::pair<XYZPoint, double> Spot;
  typedef std::pair<unsigned int, double> Step;
  typedef std::vector<Step> Steps;
  typedef Steps::const_iterator step_iterator;

public:
  EMShower(RandomEngineAndDistribution const* engine,
           GammaFunctionGenerator* gamma,
           EMECALShowerParametrization* const myParam,
           std::vector<const RawParticle*>* const myPart,
           EcalHitMaker* const myGrid = nullptr,
           PreshowerHitMaker* const myPreshower = nullptr,
           bool bFixedLength = false);

  virtual ~EMShower() { ; }

  /// Computes the steps before the real compute
  void prepareSteps();

  /// Compute the shower longitudinal and lateral development
  void compute();

  /// get the depth of the centre of gravity of the shower(s)
  //  inline double getMeanDepth() const {return globalMeanDepth;};

  /// get the depth of the maximum of the shower
  inline double getMaximumOfShower() const { return globalMaximum; }

  /// set the grid address
  void setGrid(EcalHitMaker* const myGrid) { theGrid = myGrid; }

  /// set the preshower address
  void setPreshower(PreshowerHitMaker* const myPresh);

  /// set the HCAL address
  void setHcal(HcalHitMaker* const myHcal);

private:
  // The longitudinal development ersatzt.
  double gam(double x, double a) const;

  // Energy deposited in the layer t-dt-> t, in units of E0 (initial energy)
  double deposit(double t, double a, double b, double dt);

  // Energy deposited between 0 and t, in units of E0 (initial energy)
  double deposit(double a, double b, double t);

  // Set the intervals for the radial development
  void setIntervals(unsigned icomp, RadialInterval& rad);

  // The parametrization
  EMECALShowerParametrization* const theParam;

  // The Calorimeter properties
  const ECALProperties* theECAL;
  const HCALProperties* theHCAL;
  const PreshowerLayer1Properties* theLayer1;
  const PreshowerLayer2Properties* theLayer2;

  // The incident particle(s)
  std::vector<const RawParticle*>* const thePart;
  unsigned int nPart;

  // The basic quantities for the shower development.
  std::vector<double> theNumberOfSpots;
  std::vector<double> Etot;
  std::vector<double> E;
  std::vector<double> photos;
  std::vector<double> T;
  std::vector<double> a;
  std::vector<double> b;
  std::vector<double> Ti;
  std::vector<double> TSpot;
  std::vector<double> aSpot;
  std::vector<double> bSpot;

  // F.B : Use the maximum of the shower rather the center of gravity
  //  std::vector<double> meanDepth;
  //  double globalMeanDepth;
  std::vector<double> maximumOfShower;
  std::vector<std::vector<double> > depositedEnergy;
  std::vector<double> meanDepth;
  double innerDepth, outerDepth;

  double globalMaximum;

  double totalEnergy;

  // The steps for the longitudinal development
  Steps steps;
  unsigned nSteps;
  bool stepsCalculated;

  // The crystal grid
  EcalHitMaker* theGrid;

  // The preshower
  PreshowerHitMaker* thePreshower;

  // The HCAL hitmaker
  HcalHitMaker* theHcalHitMaker;

  // Is there a preshower ?
  bool hasPreshower;
  // Histos

  //  Histos* myHistos;
  Genfun::IncompleteGamma myIncompleteGamma;

  // Random engine
  const RandomEngineAndDistribution* random;

  // integer gamma function generator
  GammaFunctionGenerator* myGammaGenerator;

  bool bFixedLength_;
};

#endif