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.

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 }

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

◆ ~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.

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.);
94  point = (layer == 1) ? locToGlobal1_((Point)point) : locToGlobal2_((Point)point);
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 }

References anglecorrection1_, anglecorrection2_, funct::cos(), EcalPreshowerGeometry::getClosestCellInPlane(), Calorimeter::getEcalPreshowerGeometry(), CaloSubdetectorGeometry::getGeometry(), CaloHitMaker::hitMap_, LandauFluctuationGenerator::landau(), 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().

◆ getHits()

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

Implements CaloHitMaker.

Definition at line 30 of file PreshowerHitMaker.h.

30 { return hitMap_; };

References CaloHitMaker::hitMap_.

Referenced by CalorimetryManager::EMShowerSimulation().

◆ layer1Calibrated()

float PreshowerHitMaker::layer1Calibrated ( ) const
inline

Definition at line 39 of file PreshowerHitMaker.h.

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

References totalLayer1_.

◆ layer2Calibrated()

float PreshowerHitMaker::layer2Calibrated ( ) const
inline

Definition at line 40 of file PreshowerHitMaker.h.

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

References totalLayer2_.

◆ setMipEnergy()

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

Definition at line 32 of file PreshowerHitMaker.h.

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

References StorageManager_cfg::e1, mip1_, and mip2_.

Referenced by CalorimetryManager::EMShowerSimulation().

◆ setSpotEnergy()

void PreshowerHitMaker::setSpotEnergy ( double  e)
inlineoverridevirtual

Implements CaloHitMaker.

Definition at line 27 of file PreshowerHitMaker.h.

27 { spotEnergy = e; }

References MillePedeFileConverter_cfg::e, and CaloHitMaker::spotEnergy.

Referenced by EMShower::compute().

◆ totalCalibrated()

float PreshowerHitMaker::totalCalibrated ( ) const
inline

Definition at line 41 of file PreshowerHitMaker.h.

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

References totalLayer1_, and totalLayer2_.

◆ totalLayer1()

float PreshowerHitMaker::totalLayer1 ( ) const
inline

Definition at line 37 of file PreshowerHitMaker.h.

37 { return totalLayer1_; }

References totalLayer1_.

◆ totalLayer2()

float PreshowerHitMaker::totalLayer2 ( ) const
inline

Definition at line 38 of file PreshowerHitMaker.h.

38 { return totalLayer2_; }

References 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().

L1TowerCalibrationProducer_cfi.calo
calo
Definition: L1TowerCalibrationProducer_cfi.py:59
PreshowerHitMaker::theGenerator
const LandauFluctuationGenerator * theGenerator
The Landau Fluctuation generator.
Definition: PreshowerHitMaker.h:58
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
PreshowerHitMaker::XYZPoint
math::XYZVector XYZPoint
Definition: PreshowerHitMaker.h:14
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
Point
ROOT::Math::Transform3DPJ::Point Point
Definition: PreshowerHitMaker.cc:14
PreshowerHitMaker::locToGlobal1_
Transform3D locToGlobal1_
Definition: PreshowerHitMaker.h:50
LaserClient_cfi.zaxis
zaxis
Definition: LaserClient_cfi.py:91
Plane3D
ROOT::Math::Plane3D Plane3D
Definition: PreshowerHitMaker.cc:13
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DetId
Definition: DetId.h:17
PreshowerHitMaker::psLayer2Dir_
XYZVector psLayer2Dir_
Definition: PreshowerHitMaker.h:47
PreshowerHitMaker::anglecorrection2_
float anglecorrection2_
Definition: PreshowerHitMaker.h:53
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
PreshowerHitMaker::psLayer2Entrance_
XYZPoint psLayer2Entrance_
Definition: PreshowerHitMaker.h:46
PreshowerHitMaker::mip2_
double mip2_
Definition: PreshowerHitMaker.h:54
DDAxes::z
PreshowerHitMaker::layer2valid_
bool layer2valid_
Definition: PreshowerHitMaker.h:49
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
CaloHitMaker::intersect
static XYZPoint intersect(const Plane3D &p, const XYZPoint &a, const XYZPoint &b, double &t, bool segment, bool debug=false)
Definition: CaloHitMaker.cc:41
EcalPreshowerGeometry::getClosestCellInPlane
virtual DetId getClosestCellInPlane(const GlobalPoint &r, int plane) const
Definition: EcalPreshowerGeometry.cc:130
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
PreshowerHitMaker::mip1_
double mip1_
Definition: PreshowerHitMaker.h:54
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
PreshowerHitMaker::totalLayer1_
float totalLayer1_
Definition: PreshowerHitMaker.h:55
PreshowerHitMaker::Transform3D
ROOT::Math::Transform3DPJ Transform3D
Definition: PreshowerHitMaker.h:15
LandauFluctuationGenerator::landau
double landau(RandomEngineAndDistribution const *random) const
Random generator of the dE/dX spread (Landau function)
Definition: LandauFluctuationGenerator.h:29
CaloSubdetectorGeometry::getGeometry
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: CaloSubdetectorGeometry.cc:36
DetId::Ecal
Definition: DetId.h:27
CaloHitMaker::spotEnergy
double spotEnergy
Definition: CaloHitMaker.h:48
XYZPoint
math::XYZVector XYZPoint
Definition: CalorimetryManager.cc:66
CaloGeometryHelper::preshowerZPosition
double preshowerZPosition(int layer) const
Definition: CaloGeometryHelper.h:33
CaloHitMaker::myCalorimeter
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:44
PreshowerHitMaker::psLayer1Dir_
XYZVector psLayer1Dir_
Definition: PreshowerHitMaker.h:45
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
EcalPreshower
Definition: EcalSubdetector.h:10
PreshowerHitMaker::psLayer1Entrance_
XYZPoint psLayer1Entrance_
Definition: PreshowerHitMaker.h:44
CaloHitID
Definition: CaloHitID.h:11
CaloHitMaker::hitMap_
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:61
PreshowerHitMaker::locToGlobal2_
Transform3D locToGlobal2_
Definition: PreshowerHitMaker.h:51
Calorimeter::getEcalPreshowerGeometry
const EcalPreshowerGeometry * getEcalPreshowerGeometry() const
Definition: Calorimeter.h:54
CaloHitMaker::CaloHitMaker
CaloHitMaker(const CaloGeometryHelper *calo, DetId::Detector det, int subdetn, int cal, unsigned sht=0)
Definition: CaloHitMaker.cc:12
point
*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
PreshowerHitMaker::random
const RandomEngineAndDistribution * random
Definition: PreshowerHitMaker.h:59
PreshowerHitMaker::anglecorrection1_
float anglecorrection1_
Definition: PreshowerHitMaker.h:52
CaloHitMaker::moliereRadius
double moliereRadius
Definition: CaloHitMaker.h:46
PreshowerHitMaker::totalLayer2_
float totalLayer2_
Definition: PreshowerHitMaker.h:56
PreshowerHitMaker::layer1valid_
bool layer1valid_
Definition: PreshowerHitMaker.h:48
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37