CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PreshowerHitMaker Class Reference

#include <PreshowerHitMaker.h>

Inheritance diagram for PreshowerHitMaker:
CaloHitMaker

Public Types

typedef ROOT::Math::Transform3DPJ Transform3D
 
typedef math::XYZVector XYZPoint
 
typedef math::XYZVector XYZVector
 
- Public Types inherited from CaloHitMaker
typedef ROOT::Math::Plane3D Plane3D
 
typedef math::XYZVector XYZPoint
 
typedef math::XYZVector XYZVector
 

Public Member Functions

bool addHit (double r, double phi, unsigned layer=0) override
 
const std::map< CaloHitID, float > & getHits () override
 
float layer1Calibrated () const
 
float layer2Calibrated () const
 
 PreshowerHitMaker (CaloGeometryHelper *calo, const XYZPoint &, const XYZVector &, const XYZPoint &, const XYZVector &, const LandauFluctuationGenerator *aGenerator, const RandomEngineAndDistribution *engine)
 
void setMipEnergy (double e1, double e2)
 
void setSpotEnergy (double e) override
 
float totalCalibrated () const
 
float totalLayer1 () const
 
float totalLayer2 () const
 
 ~PreshowerHitMaker () override
 
- Public Member Functions inherited from CaloHitMaker
 CaloHitMaker (const CaloGeometryHelper *calo, DetId::Detector det, int subdetn, int cal, unsigned sht=0)
 
const CaloGeometryHelpergetCalorimeter () const
 
virtual ~CaloHitMaker ()
 

Private Attributes

float anglecorrection1_
 
float anglecorrection2_
 
bool layer1valid_
 
bool layer2valid_
 
Transform3D locToGlobal1_
 
Transform3D locToGlobal2_
 
double mip1_
 
double mip2_
 
XYZVector psLayer1Dir_
 
XYZPoint psLayer1Entrance_
 
XYZVector psLayer2Dir_
 
XYZPoint psLayer2Entrance_
 
const RandomEngineAndDistributionrandom
 
const LandauFluctuationGeneratortheGenerator
 The Landau Fluctuation generator. More...
 
float totalLayer1_
 
float totalLayer2_
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloHitMaker
static XYZPoint intersect (const Plane3D &p, const XYZPoint &a, const XYZPoint &b, double &t, bool segment, bool debug=false)
 
- Protected Attributes inherited from CaloHitMaker
bool EMSHOWER
 
bool HADSHOWER
 
std::map< CaloHitID, float > hitMap_
 
double interactionLength
 
bool MIP
 
double moliereRadius
 
const CaloGeometryHelpermyCalorimeter
 
unsigned showerType_
 
double spotEnergy
 
const CalorimeterPropertiestheCaloProperties
 

Detailed Description

Definition at line 11 of file PreshowerHitMaker.h.

Member Typedef Documentation

◆ Transform3D

Definition at line 15 of file PreshowerHitMaker.h.

◆ XYZPoint

Definition at line 14 of file PreshowerHitMaker.h.

◆ XYZVector

Definition at line 13 of file PreshowerHitMaker.h.

Constructor & Destructor Documentation

◆ PreshowerHitMaker()

PreshowerHitMaker::PreshowerHitMaker ( CaloGeometryHelper calo,
const XYZPoint layer1entrance,
const XYZVector layer1dir,
const XYZPoint layer2entrance,
const XYZVector layer2dir,
const LandauFluctuationGenerator aGenerator,
const RandomEngineAndDistribution engine 
)

Definition at line 18 of file PreshowerHitMaker.cc.

References anglecorrection1_, anglecorrection2_, CaloHitMaker::intersect(), layer1valid_, layer2valid_, locToGlobal1_, locToGlobal2_, CaloHitMaker::myCalorimeter, CaloGeometryHelper::preshowerZPosition(), psLayer1Entrance_, psLayer2Entrance_, z, and LaserClient_cfi::zaxis.

26  psLayer1Entrance_(layer1entrance),
27  psLayer1Dir_(layer1dir),
28  psLayer2Entrance_(layer2entrance),
29  psLayer2Dir_(layer2dir),
30  totalLayer1_(0.),
31  totalLayer2_(0.),
32  theGenerator(aGenerator),
33  random(engine) {
34  double dummyt;
35  anglecorrection1_ = 0.;
36  anglecorrection2_ = 0.;
37  // Check if the entrance points are really on the wafers
38  // Layer 1
39  layer1valid_ = (layer1entrance.Mag2() > 0.);
40  if (layer1valid_) {
41  int z = (psLayer1Entrance_.z() > 0) ? 1 : -1;
42  Plane3D plan1(0., 0., 1., -z * myCalorimeter->preshowerZPosition(1));
43 
44  psLayer1Entrance_ = intersect(plan1, layer1entrance, layer1entrance + layer1dir, dummyt, false);
45 
46  XYZVector zaxis(0, 0, 1);
47  XYZVector planeVec1 = (zaxis.Cross(layer1dir)).Unit();
48  locToGlobal1_ = Transform3D(Point(0, 0, 0),
49  Point(0, 0, 1),
50  Point(1, 0, 0),
52  (Point)(psLayer1Entrance_ + layer1dir),
53  (Point)(psLayer1Entrance_ + planeVec1));
54 
55  anglecorrection1_ = fabs(zaxis.Dot(layer1dir));
56  if (anglecorrection1_ != 0.)
58  // std::cout << " Layer 1 entrance " << psLayer1Entrance_ << std::endl;
59  // std::cout << " Layer 1 corr " << anglecorrection1_ << std::endl;
60  }
61 
62  // Layer 2
63  layer2valid_ = (layer2entrance.Mag2() > 0.);
64  if (layer2valid_) {
65  int z = (psLayer2Entrance_.z() > 0) ? 1 : -1;
66  Plane3D plan2(0., 0., 1., -z * myCalorimeter->preshowerZPosition(2));
67 
68  psLayer2Entrance_ = intersect(plan2, layer2entrance, layer2entrance + layer2dir, dummyt, false);
69 
70  XYZVector zaxis(0, 0, 1);
71  XYZVector planeVec2 = (zaxis.Cross(layer2dir)).Unit();
72  locToGlobal2_ = Transform3D(Point(0, 0, 0),
73  Point(0, 0, 1),
74  Point(1, 0, 0),
76  (Point)(psLayer2Entrance_ + layer2dir),
77  (Point)(psLayer2Entrance_ + planeVec2));
78 
79  anglecorrection2_ = fabs(zaxis.Dot(layer2dir));
80  if (anglecorrection2_ != 0.)
82  // std::cout << " Layer 2 entrance " << psLayer2Entrance_ << std::endl;
83  // std::cout << " Layer 2 corr " << anglecorrection2_ << std::endl;
84  }
85  // theGenerator=LandauFluctuationGenerator();
86 }
double preshowerZPosition(int layer) const
Transform3D locToGlobal1_
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:44
static XYZPoint intersect(const Plane3D &p, const XYZPoint &a, const XYZPoint &b, double &t, bool segment, bool debug=false)
Definition: CaloHitMaker.cc:41
ROOT::Math::Transform3DPJ Transform3D
Transform3D locToGlobal2_
ROOT::Math::Transform3DPJ::Point Point
Structure Point Contains parameters of Gaussian fits to DMRs.
math::XYZVector XYZVector
Definition: RawParticle.h:26
const LandauFluctuationGenerator * theGenerator
The Landau Fluctuation generator.
ROOT::Math::Plane3D Plane3D
Definition: Common.h:9
const RandomEngineAndDistribution * random
CaloHitMaker(const CaloGeometryHelper *calo, DetId::Detector det, int subdetn, int cal, unsigned sht=0)
Definition: CaloHitMaker.cc:12

◆ ~PreshowerHitMaker()

PreshowerHitMaker::~PreshowerHitMaker ( )
inlineoverride

Definition at line 25 of file PreshowerHitMaker.h.

25 { ; }

Member Function Documentation

◆ addHit()

bool PreshowerHitMaker::addHit ( double  r,
double  phi,
unsigned  layer = 0 
)
overridevirtual

Implements CaloHitMaker.

Definition at line 88 of file PreshowerHitMaker.cc.

References anglecorrection1_, anglecorrection2_, funct::cos(), EcalPreshowerGeometry::getClosestCellInPlane(), Calorimeter::getEcalPreshowerGeometry(), CaloSubdetectorGeometry::getGeometry(), CaloHitMaker::hitMap_, LandauFluctuationGenerator::landau(), phase1PixelTopology::layer, layer1valid_, layer2valid_, locToGlobal1_, locToGlobal2_, mip1_, mip2_, CaloHitMaker::moliereRadius, CaloHitMaker::myCalorimeter, phi, point, CaloGeometryHelper::preshowerZPosition(), alignCSCRings::r, random, funct::sin(), digitizers_cfi::strip, theGenerator, totalLayer1_, totalLayer2_, and z.

Referenced by EMShower::compute().

88  {
89  if ((layer == 1 && !layer1valid_) || ((layer == 2 && !layer2valid_)))
90  return false;
91 
92  r *= moliereRadius;
93  XYZPoint point(r * std::cos(phi), r * std::sin(phi), 0.);
95  // std::cout << " Point " << point << std::endl;
96  int z = (point.z() > 0) ? 1 : -1;
98  // std::cout << "r " << r << " Point after " << point << std::endl;
99  // std::cout << " Layer " << layer << " " << point << std::endl;
101  GlobalPoint(point.x(), point.y(), point.z()), layer);
102 
103  float meanspot = (layer == 1) ? mip1_ : mip2_;
104  float spote = meanspot + 0.000021 * theGenerator->landau(random);
105  spote *= ((layer == 1) ? anglecorrection1_ : anglecorrection2_);
106 
107  if (!strip.null()) {
108  //calculate time of flight
109  double tof =
110  (myCalorimeter->getEcalPreshowerGeometry()->getGeometry(strip)->getPosition().mag()) / 29.98; //speed of light
111  CaloHitID current_id(strip.rawId(), tof, 0); //no track yet
112  std::map<CaloHitID, float>::iterator cellitr;
113  cellitr = hitMap_.find(current_id);
114  if (cellitr == hitMap_.end()) {
115  hitMap_.insert(std::pair<CaloHitID, float>(current_id, spote));
116  } else {
117  cellitr->second += spote;
118  }
119  // std::cout << " found " << stripNumber << " " << spote <<std::endl;
120  if (layer == 1) {
121  totalLayer1_ += spote;
122  } else if (layer == 2) {
123  totalLayer2_ += spote;
124  }
125  return true;
126  }
127  // std::cout << " Could not find a cell " << point << std::endl;
128  return false;
129 }
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:61
math::XYZVector XYZPoint
double preshowerZPosition(int layer) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Transform3D locToGlobal1_
constexpr std::array< uint8_t, layerIndexSize > layer
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:44
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Definition: DetId.h:17
double landau(RandomEngineAndDistribution const *random) const
Random generator of the dE/dX spread (Landau function)
Transform3D locToGlobal2_
double moliereRadius
Definition: CaloHitMaker.h:46
math::XYZVector XYZPoint
Structure Point Contains parameters of Gaussian fits to DMRs.
const EcalPreshowerGeometry * getEcalPreshowerGeometry() const
Definition: Calorimeter.h:54
virtual DetId getClosestCellInPlane(const GlobalPoint &r, int plane) const
const LandauFluctuationGenerator * theGenerator
The Landau Fluctuation generator.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
const RandomEngineAndDistribution * random

◆ getHits()

const std::map<CaloHitID, float>& PreshowerHitMaker::getHits ( )
inlineoverridevirtual

Implements CaloHitMaker.

Definition at line 30 of file PreshowerHitMaker.h.

References CaloHitMaker::hitMap_.

Referenced by CalorimetryManager::EMShowerSimulation().

30 { return hitMap_; };
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:61

◆ layer1Calibrated()

float PreshowerHitMaker::layer1Calibrated ( ) const
inline

Definition at line 39 of file PreshowerHitMaker.h.

References totalLayer1_.

39 { return 0.024 / 81.1E-6 * totalLayer1_; }

◆ layer2Calibrated()

float PreshowerHitMaker::layer2Calibrated ( ) const
inline

Definition at line 40 of file PreshowerHitMaker.h.

References totalLayer2_.

40 { return 0.024 * 0.7 / 81.1E-6 * totalLayer2_; }

◆ setMipEnergy()

void PreshowerHitMaker::setMipEnergy ( double  e1,
double  e2 
)
inline

Definition at line 32 of file PreshowerHitMaker.h.

References StorageManager_cfg::e1, mip1_, and mip2_.

Referenced by CalorimetryManager::EMShowerSimulation().

32  {
33  mip1_ = e1;
34  mip2_ = e2;
35  }

◆ setSpotEnergy()

void PreshowerHitMaker::setSpotEnergy ( double  e)
inlineoverridevirtual

◆ totalCalibrated()

float PreshowerHitMaker::totalCalibrated ( ) const
inline

Definition at line 41 of file PreshowerHitMaker.h.

References totalLayer1_, and totalLayer2_.

41 { return 0.024 / 81.1E-6 * (totalLayer1_ + 0.7 * totalLayer2_); }

◆ totalLayer1()

float PreshowerHitMaker::totalLayer1 ( ) const
inline

Definition at line 37 of file PreshowerHitMaker.h.

References totalLayer1_.

37 { return totalLayer1_; }

◆ totalLayer2()

float PreshowerHitMaker::totalLayer2 ( ) const
inline

Definition at line 38 of file PreshowerHitMaker.h.

References totalLayer2_.

38 { return totalLayer2_; }

Member Data Documentation

◆ anglecorrection1_

float PreshowerHitMaker::anglecorrection1_
private

Definition at line 52 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

◆ anglecorrection2_

float PreshowerHitMaker::anglecorrection2_
private

Definition at line 53 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

◆ layer1valid_

bool PreshowerHitMaker::layer1valid_
private

Definition at line 48 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

◆ layer2valid_

bool PreshowerHitMaker::layer2valid_
private

Definition at line 49 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

◆ locToGlobal1_

Transform3D PreshowerHitMaker::locToGlobal1_
private

Definition at line 50 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

◆ locToGlobal2_

Transform3D PreshowerHitMaker::locToGlobal2_
private

Definition at line 51 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

◆ mip1_

double PreshowerHitMaker::mip1_
private

Definition at line 54 of file PreshowerHitMaker.h.

Referenced by addHit(), and setMipEnergy().

◆ mip2_

double PreshowerHitMaker::mip2_
private

Definition at line 54 of file PreshowerHitMaker.h.

Referenced by addHit(), and setMipEnergy().

◆ psLayer1Dir_

XYZVector PreshowerHitMaker::psLayer1Dir_
private

Definition at line 45 of file PreshowerHitMaker.h.

◆ psLayer1Entrance_

XYZPoint PreshowerHitMaker::psLayer1Entrance_
private

Definition at line 44 of file PreshowerHitMaker.h.

Referenced by PreshowerHitMaker().

◆ psLayer2Dir_

XYZVector PreshowerHitMaker::psLayer2Dir_
private

Definition at line 47 of file PreshowerHitMaker.h.

◆ psLayer2Entrance_

XYZPoint PreshowerHitMaker::psLayer2Entrance_
private

Definition at line 46 of file PreshowerHitMaker.h.

Referenced by PreshowerHitMaker().

◆ random

const RandomEngineAndDistribution* PreshowerHitMaker::random
private

Definition at line 59 of file PreshowerHitMaker.h.

Referenced by addHit().

◆ theGenerator

const LandauFluctuationGenerator* PreshowerHitMaker::theGenerator
private

The Landau Fluctuation generator.

Definition at line 58 of file PreshowerHitMaker.h.

Referenced by addHit().

◆ totalLayer1_

float PreshowerHitMaker::totalLayer1_
private

Definition at line 55 of file PreshowerHitMaker.h.

Referenced by addHit(), layer1Calibrated(), totalCalibrated(), and totalLayer1().

◆ totalLayer2_

float PreshowerHitMaker::totalLayer2_
private

Definition at line 56 of file PreshowerHitMaker.h.

Referenced by addHit(), layer2Calibrated(), totalCalibrated(), and totalLayer2().