CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
const std::map< CaloHitID,
float > & 
getHits ()
 
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)
 
float totalCalibrated () const
 
float totalLayer1 () const
 
float totalLayer2 () const
 
 ~PreshowerHitMaker ()
 
- 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

Definition at line 17 of file PreshowerHitMaker.h.

Definition at line 16 of file PreshowerHitMaker.h.

Definition at line 15 of file PreshowerHitMaker.h.

Constructor & Destructor Documentation

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_, and detailsBasic3DVector::z.

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

Definition at line 27 of file PreshowerHitMaker.h.

27 {;}

Member Function Documentation

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

Implements CaloHitMaker.

Definition at line 91 of file PreshowerHitMaker.cc.

References anglecorrection1_, anglecorrection2_, funct::cos(), EcalPreshowerGeometry::getClosestCellInPlane(), Calorimeter::getEcalPreshowerGeometry(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloHitMaker::hitMap_, LandauFluctuationGenerator::landau(), layer1valid_, layer2valid_, locToGlobal1_, locToGlobal2_, PV3DBase< T, PVType, FrameType >::mag(), mip1_, mip2_, CaloHitMaker::moliereRadius, CaloHitMaker::myCalorimeter, point, CaloGeometryHelper::preshowerZPosition(), random, funct::sin(), theGenerator, totalLayer1_, totalLayer2_, and detailsBasic3DVector::z.

Referenced by EMShower::compute().

92 {
93  if((layer==1&&!layer1valid_)||((layer==2&&!layer2valid_))) return false;
94 
97  point = (layer==1) ? locToGlobal1_((Point)point) : locToGlobal2_((Point)point);
98  // std::cout << " Point " << point << std::endl;
99  int z=(point.z()>0) ? 1: -1;
101  // std::cout << "r " << r << " Point after " << point << std::endl;
102  // std::cout << " Layer " << layer << " " << point << std::endl;
104 
105  float meanspot=(layer==1) ? mip1_ : mip2_;
106  float spote = meanspot + 0.000021*theGenerator->landau(random);
107  spote *= ( (layer==1) ? anglecorrection1_ : anglecorrection2_ );
108 
109  if(!strip.null())
110  {
111  //calculate time of flight
112  double tof = (myCalorimeter->getEcalPreshowerGeometry()->getGeometry(strip)->getPosition().mag())/29.98;//speed of light
113  CaloHitID current_id(strip.rawId(),tof,0); //no track yet
114  std::map<CaloHitID,float>::iterator cellitr;
115  cellitr = hitMap_.find(current_id);
116  if( cellitr==hitMap_.end())
117  {
118  hitMap_.insert(std::pair<CaloHitID,float>(current_id,spote));
119  }
120  else
121  {
122  cellitr->second+=spote;
123  }
124  // std::cout << " found " << stripNumber << " " << spote <<std::endl;
125  if(layer==1){
126  totalLayer1_+=spote;
127  }
128  else if (layer==2) {
129  totalLayer2_+=spote;
130  }
131  return true;
132  }
133  // std::cout << " Could not find a cell " << point << std::endl;
134  return false;
135 }
double preshowerZPosition(int layer) const
math::XYZVector XYZPoint
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const EcalPreshowerGeometry * getEcalPreshowerGeometry() const
Definition: Calorimeter.h:55
Transform3D locToGlobal1_
float float float z
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
T mag() const
Definition: PV3DBase.h:67
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZPoint Point
virtual DetId getClosestCellInPlane(const GlobalPoint &r, int plane) const
double landau(RandomEngineAndDistribution const *random) const
Random generator of the dE/dX spread (Landau function)
Definition: DetId.h:18
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:65
Transform3D locToGlobal2_
double moliereRadius
Definition: CaloHitMaker.h:49
math::XYZVector XYZPoint
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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
Definition: DDAxes.h:10
const std::map<CaloHitID,float>& PreshowerHitMaker::getHits ( )
inlinevirtual

Implements CaloHitMaker.

Definition at line 32 of file PreshowerHitMaker.h.

References CaloHitMaker::hitMap_.

Referenced by CalorimetryManager::EMShowerSimulation().

32 { return hitMap_ ;} ;
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:65
float PreshowerHitMaker::layer1Calibrated ( ) const
inline

Definition at line 38 of file PreshowerHitMaker.h.

References totalLayer1_.

38 { return 0.024/81.1E-6*totalLayer1_;}
float PreshowerHitMaker::layer2Calibrated ( ) const
inline

Definition at line 39 of file PreshowerHitMaker.h.

References totalLayer2_.

39 { return 0.024*0.7/81.1E-6*totalLayer2_;}
void PreshowerHitMaker::setMipEnergy ( double  e1,
double  e2 
)
inline

Definition at line 34 of file PreshowerHitMaker.h.

References mip1_, and mip2_.

Referenced by CalorimetryManager::EMShowerSimulation().

34 { mip1_=e1 ; mip2_=e2;}
void PreshowerHitMaker::setSpotEnergy ( double  e)
inlinevirtual

Implements CaloHitMaker.

Definition at line 29 of file PreshowerHitMaker.h.

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

Referenced by EMShower::compute().

29 { spotEnergy=e;}
double spotEnergy
Definition: CaloHitMaker.h:51
float PreshowerHitMaker::totalCalibrated ( ) const
inline

Definition at line 40 of file PreshowerHitMaker.h.

References totalLayer1_, and totalLayer2_.

40 { return 0.024/81.1E-6*(totalLayer1_+0.7*totalLayer2_);}
float PreshowerHitMaker::totalLayer1 ( ) const
inline

Definition at line 36 of file PreshowerHitMaker.h.

References totalLayer1_.

36 { return totalLayer1_;}
float PreshowerHitMaker::totalLayer2 ( ) const
inline

Definition at line 37 of file PreshowerHitMaker.h.

References totalLayer2_.

37 { return totalLayer2_;}

Member Data Documentation

float PreshowerHitMaker::anglecorrection1_
private

Definition at line 52 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

float PreshowerHitMaker::anglecorrection2_
private

Definition at line 53 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

bool PreshowerHitMaker::layer1valid_
private

Definition at line 48 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

bool PreshowerHitMaker::layer2valid_
private

Definition at line 49 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

Transform3D PreshowerHitMaker::locToGlobal1_
private

Definition at line 50 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

Transform3D PreshowerHitMaker::locToGlobal2_
private

Definition at line 51 of file PreshowerHitMaker.h.

Referenced by addHit(), and PreshowerHitMaker().

double PreshowerHitMaker::mip1_
private

Definition at line 54 of file PreshowerHitMaker.h.

Referenced by addHit(), and setMipEnergy().

double PreshowerHitMaker::mip2_
private

Definition at line 54 of file PreshowerHitMaker.h.

Referenced by addHit(), and setMipEnergy().

XYZVector PreshowerHitMaker::psLayer1Dir_
private

Definition at line 45 of file PreshowerHitMaker.h.

XYZPoint PreshowerHitMaker::psLayer1Entrance_
private

Definition at line 44 of file PreshowerHitMaker.h.

Referenced by PreshowerHitMaker().

XYZVector PreshowerHitMaker::psLayer2Dir_
private

Definition at line 47 of file PreshowerHitMaker.h.

XYZPoint PreshowerHitMaker::psLayer2Entrance_
private

Definition at line 46 of file PreshowerHitMaker.h.

Referenced by PreshowerHitMaker().

const RandomEngineAndDistribution* PreshowerHitMaker::random
private

Definition at line 59 of file PreshowerHitMaker.h.

Referenced by addHit().

const LandauFluctuationGenerator* PreshowerHitMaker::theGenerator
private

The Landau Fluctuation generator.

Definition at line 58 of file PreshowerHitMaker.h.

Referenced by addHit().

float PreshowerHitMaker::totalLayer1_
private

Definition at line 55 of file PreshowerHitMaker.h.

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

float PreshowerHitMaker::totalLayer2_
private

Definition at line 56 of file PreshowerHitMaker.h.

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