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 | Static Public Member Functions | Private Attributes
HcalHitMaker Class Reference

#include <HcalHitMaker.h>

Inheritance diagram for HcalHitMaker:
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)
 add the hit in the HCAL in local coordinates More...
 
bool addHit (const XYZPoint &point, unsigned layer=0)
 add the hit in the HCAL in global coordinates More...
 
const std::map< uint32_t, float > & getHits ()
 
 HcalHitMaker (EcalHitMaker &, unsigned)
 
bool setDepth (double, bool inCm=false)
 set the depth in X0 or Lambda0 units depending on showerType More...
 
void setSpotEnergy (double e)
 Set the spot energy. More...
 
 ~HcalHitMaker ()
 
- 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 ()
 

Static Public Member Functions

static int getSubHcalDet (const FSimTrack *t)
 

Private Attributes

double currentDepth_
 
XYZPoint ecalEntrance_
 
Transform3D locToGlobal_
 
bool mapCalculated_
 
EcalHitMakermyGrid
 
const FSimTrackmyTrack
 
int onHcal
 
XYZVector particleDirection
 
double radiusFactor_
 

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< uint32_t, float > hitMap_
 
double interactionLength
 
bool MIP
 
double moliereRadius
 
const CaloGeometryHelpermyCalorimeter
 
unsigned showerType_
 
double spotEnergy
 
const CalorimeterPropertiestheCaloProperties
 

Detailed Description

Definition at line 16 of file HcalHitMaker.h.

Member Typedef Documentation

Definition at line 22 of file HcalHitMaker.h.

Definition at line 21 of file HcalHitMaker.h.

Definition at line 20 of file HcalHitMaker.h.

Constructor & Destructor Documentation

HcalHitMaker::HcalHitMaker ( EcalHitMaker grid,
unsigned  shower 
)

Definition at line 10 of file HcalHitMaker.cc.

References abs, gather_cfg::cout, EcalHitMaker::ecalEntrance(), FSimTrack::ecalEntrance(), ecalEntrance_, CaloHitMaker::EMSHOWER, EcalHitMaker::getFSimTrack(), CaloHitMaker::interactionLength, mapCalculated_, CaloHitMaker::moliereRadius, myGrid, myTrack, particleDirection, radiusFactor_, and CoreSimTrack::type().

12  grid.getFSimTrack()->onHcal()?grid.getFSimTrack()->onHcal():grid.getFSimTrack()->onVFcal()+1,shower),
13  myGrid(grid), myTrack((grid.getFSimTrack()))
14 {
15  // normalize the direction
17  particleDirection=myTrack->ecalEntrance().Vect().Unit();
19  mapCalculated_=false;
20  //std::cout << " Famos HCAL " << grid.getTrack()->onHcal() << " " << grid.getTrack()->onVFcal() << " " << showerType << std::endl;
21  if(EMSHOWER&&(abs(grid.getFSimTrack()->type())!=11 && grid.getFSimTrack()->type()!=22))
22  {
23  std::cout << " FamosHcalHitMaker : Strange. The following shower has EM type" << std::endl <<* grid.getFSimTrack() << std::endl;
24  }
25 }
const FSimTrack * myTrack
Definition: HcalHitMaker.h:45
#define abs(x)
Definition: mlp_lapack.h:159
double radiusFactor_
Definition: HcalHitMaker.h:52
const CaloGeometryHelper * getCalorimeter() const
Definition: CaloHitMaker.h:35
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:133
int onVFcal() const
Definition: FSimTrack.h:111
bool mapCalculated_
Definition: HcalHitMaker.h:53
XYZPoint ecalEntrance_
Definition: HcalHitMaker.h:46
double interactionLength
Definition: CaloHitMaker.h:49
double moliereRadius
Definition: CaloHitMaker.h:48
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:40
EcalHitMaker & myGrid
Definition: HcalHitMaker.h:43
int onHcal() const
Definition: FSimTrack.h:106
tuple cout
Definition: gather_cfg.py:121
XYZVector particleDirection
Definition: HcalHitMaker.h:47
const FSimTrack * getFSimTrack() const
To retrieve the track.
Definition: EcalHitMaker.h:125
const XYZPoint & ecalEntrance() const
used in FamosHcalHitMaker
Definition: EcalHitMaker.h:128
static int getSubHcalDet(const FSimTrack *t)
Definition: HcalHitMaker.h:56
CaloHitMaker(const CaloGeometryHelper *calo, DetId::Detector det, int subdetn, int cal, unsigned sht=0)
Definition: CaloHitMaker.cc:10
HcalHitMaker::~HcalHitMaker ( )
inline

Definition at line 25 of file HcalHitMaker.h.

25 {;}

Member Function Documentation

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

add the hit in the HCAL in local coordinates

Implements CaloHitMaker.

Definition at line 28 of file HcalHitMaker.cc.

References funct::cos(), locToGlobal_, point, radiusFactor_, and funct::sin().

Referenced by HFShower::compute(), HDShower::compute(), EMShower::compute(), CalorimetryManager::HDShowerSimulation(), CalorimetryManager::MuonMipSimulation(), and HDRShower::setHit().

29 {
30  // std::cout << " FamosHcalHitMaker::addHit - radiusFactor = " << radiusFactor
31  // << std::endl;
32 
34 
35  // Watch out !!!! (Point) is a real point in the MathCore terminology (not a redefined a XYZPoint which
36  // is actually a XYZVector in the MatchCore terminology). Therefore, the Transform3D is correctly applied
38  return addHit(point,layer);
39 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Transform3D locToGlobal_
Definition: HcalHitMaker.h:51
double radiusFactor_
Definition: HcalHitMaker.h:52
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZPoint Point
math::XYZVector XYZPoint
bool addHit(double r, double phi, unsigned layer=0)
add the hit in the HCAL in local coordinates
Definition: HcalHitMaker.cc:28
*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
Definition: DDAxes.h:10
bool HcalHitMaker::addHit ( const XYZPoint point,
unsigned  layer = 0 
)

add the hit in the HCAL in global coordinates

Definition at line 41 of file HcalHitMaker.cc.

References CaloHitMaker::EMSHOWER, CaloGeometryHelper::getClosestCell(), CaloHitMaker::HADSHOWER, HcalForward, CaloHitMaker::hitMap_, CaloHitMaker::MIP, CaloHitMaker::myCalorimeter, and CaloHitMaker::spotEnergy.

42 {
43  // Temporary nasty hacks to avoid misbehaviour of not-intended-for-that
44  // getClosestCell in case of large (eta beyond HF ...) and in EM showers
45  if(fabs(point.Z())>2000 || fabs(point.X())>2000 || fabs(point.Y())>2000)
46  {
47  if(EMSHOWER)
48  edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point << " coming from an electromagnetic shower. - Ignoring it" << std::endl;
49  else if(HADSHOWER)
50  edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point << " coming from a hadron shower. - Ignoring it" << std::endl;
51  else if(MIP)
52  edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point << " coming from a muon. - Ignoring it" << std::endl;
53  return false;
54  }
55 
56 
57  double pointeta = fabs(point.eta());
58  if(pointeta > 5.19) return false;
59 
60  DetId thecellID(myCalorimeter->getClosestCell(point,false,false));
61 
62  HcalDetId myDetId(thecellID);
63 
64 // if ( myDetId.subdetId() == HcalForward ) {
65 // std::cout << "HcalHitMaker : " << point.Z() << " " << myDetId.depth() << std::endl;
66 // }
67 
68 // std::cout << "BEFORE" << std::endl;
69 // std::cout << "HcalHitMaker : subdetId : " << myDetId.subdetId() << std::endl;
70 // std::cout << "HcalHitMaker : depth : " << myDetId.depth() << std::endl;
71 // std::cout << "HcalHitMaker : ieta : " << myDetId.ieta() << std::endl;
72 // std::cout << "HcalHitMaker : iphi : " << myDetId.iphi() << std::endl;
73 // std::cout << "HcalHitMaker : spotE : " << spotEnergy << std::endl;
74 // std::cout << "HcalHitMaker : point.X : " << point.X() << std::endl;
75 // std::cout << "HcalHitMaker : point.Y : " << point.Y() << std::endl;
76 // std::cout << "HcalHitMaker : point.Z : " << point.Z() << std::endl;
77 
78  if ( myDetId.subdetId() == HcalForward ) {
79  int mylayer = layer;
80  if ( myDetId.depth()==2 ) {
81  mylayer = (int)layer;
82  } else {
83  mylayer = 1;
84  }
85  HcalDetId myDetId2((HcalSubdetector)myDetId.subdetId(),myDetId.ieta(),myDetId.iphi(),mylayer);
86  thecellID = myDetId2;
87  }
88 
89 
90 
91  if(!thecellID.null())
92  {
93  uint32_t cell(thecellID.rawId());
94 
95  // std::cout << " FamosHcalHitMaker::addHit - the cell num " << cell
96  // << std::endl;
97 
98  std::map<uint32_t,float>::iterator cellitr;
99  cellitr = hitMap_.find(cell);
100  if(cellitr==hitMap_.end())
101  {
102  hitMap_.insert(std::pair<uint32_t,float>(cell,spotEnergy));
103  }
104  else
105  {
106  cellitr->second+=spotEnergy;
107  }
108  return true;
109  }
110  return false;
111 }
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:46
HcalSubdetector
Definition: HcalAssistant.h:32
Definition: DetId.h:20
std::map< uint32_t, float > hitMap_
Definition: CaloHitMaker.h:64
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
double spotEnergy
Definition: CaloHitMaker.h:50
*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 std::map<uint32_t,float>& HcalHitMaker::getHits ( )
inlinevirtual

Implements CaloHitMaker.

Definition at line 37 of file HcalHitMaker.h.

References CaloHitMaker::hitMap_.

Referenced by CalorimetryManager::EMShowerSimulation(), CalorimetryManager::HDShowerSimulation(), and CalorimetryManager::MuonMipSimulation().

37 { return hitMap_ ;} ;
std::map< uint32_t, float > hitMap_
Definition: CaloHitMaker.h:64
static int HcalHitMaker::getSubHcalDet ( const FSimTrack t)
inlinestatic

Definition at line 56 of file HcalHitMaker.h.

References HcalBarrel, HcalEndcap, HcalForward, FSimTrack::onHcal(), and FSimTrack::onVFcal().

57  {
58  // std::cout << " getSubHcalDet " << std::endl;
59  // According to DataFormats/ HcalDetId/ interface/ HcalSubdetector.h
60  // std::cout << " onHcal " << t->onHcal() << " onVFcal " << t->onVFcal() << std::endl;
61  if(t->onHcal()==1) return HcalBarrel;
62  if(t->onHcal()==2) return HcalEndcap;
63  if(t->onVFcal()==2) return HcalForward;
64  return -1;
65  }
int onVFcal() const
Definition: FSimTrack.h:111
int onHcal() const
Definition: FSimTrack.h:106
bool HcalHitMaker::setDepth ( double  depth,
bool  inCm = false 
)

set the depth in X0 or Lambda0 units depending on showerType

Definition at line 114 of file HcalHitMaker.cc.

References gather_cfg::cout, currentDepth_, CaloHitMaker::EMSHOWER, EcalHitMaker::getFSimTrack(), EcalHitMaker::getSegments(), CaloHitMaker::HADSHOWER, locToGlobal_, myGrid, and particleDirection.

Referenced by HFShower::compute(), HDShower::compute(), EMShower::compute(), CalorimetryManager::HDShowerSimulation(), and HDRShower::setHit().

115 {
116  currentDepth_=depth;
117  std::vector<CaloSegment>::const_iterator segiterator;
118  if(inCm)
119  {
120  segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inSegment(currentDepth_));
121  }
122  else
123  {
124  if(EMSHOWER)
125  segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inX0Segment(currentDepth_));
126 
127  //Hadron shower
128  if(HADSHOWER)
129  segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inL0Segment(currentDepth_));
130  }
131 
132  if(segiterator==myGrid.getSegments().end())
133  {
134  // Special trick - As advised by Salavat, no leakage should be simulated
135  if(depth > myGrid.getSegments().back().sL0Exit())
136  {
137  segiterator= find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inL0Segment(myGrid.getSegments().back().sL0Exit()-1.));
138  depth=segiterator->sL0Exit()-1.;
139  currentDepth_=depth;
140  if(segiterator==myGrid.getSegments().end())
141  {
142  std::cout << " Could not go at such depth " << EMSHOWER << " " << currentDepth_ << std::endl;
143  std::cout << " Track " << *(myGrid.getFSimTrack()) << std::endl;
144  return false;
145  }
146  }
147  else
148  {
149  std::cout << " Could not go at such depth " << EMSHOWER << " " << currentDepth_ << " " << myGrid.getSegments().back().sL0Exit() << std::endl;
150  std::cout << " Track " << *(myGrid.getFSimTrack()) << std::endl;
151  return false;
152  }
153  }
154 
155 
156  XYZPoint origin;
157  if(inCm)
158  {
159  origin=segiterator->positionAtDepthincm(currentDepth_);
160  }
161  else
162  {
163  if(EMSHOWER)
164  origin=segiterator->positionAtDepthinX0(currentDepth_);
165  if(HADSHOWER)
166  origin=segiterator->positionAtDepthinL0(currentDepth_);
167  }
168  XYZVector zaxis(0,0,1);
169  XYZVector planeVec1=(zaxis.Cross(particleDirection)).Unit();
171  Point(0,0,1),
172  Point(1,0,0),
173  (Point)origin,
174  (Point)(origin+particleDirection),
175  (Point)(origin+planeVec1));
176  return true;
177 }
Transform3D locToGlobal_
Definition: HcalHitMaker.h:51
std::pair< double, double > Point
Definition: CaloEllipse.h:18
math::XYZVector XYZVector
ROOT::Math::Transform3DPJ Transform3D
Definition: HcalHitMaker.h:22
math::XYZPoint Point
This class is used to determine if a point lies in the segment.
Definition: CaloSegment.h:86
math::XYZVector XYZPoint
EcalHitMaker & myGrid
Definition: HcalHitMaker.h:43
tuple cout
Definition: gather_cfg.py:121
XYZVector particleDirection
Definition: HcalHitMaker.h:47
double currentDepth_
Definition: HcalHitMaker.h:50
const FSimTrack * getFSimTrack() const
To retrieve the track.
Definition: EcalHitMaker.h:125
const std::vector< CaloSegment > & getSegments() const
Definition: EcalHitMaker.h:99
void HcalHitMaker::setSpotEnergy ( double  e)
inlinevirtual

Member Data Documentation

double HcalHitMaker::currentDepth_
private

Definition at line 50 of file HcalHitMaker.h.

Referenced by setDepth().

XYZPoint HcalHitMaker::ecalEntrance_
private

Definition at line 46 of file HcalHitMaker.h.

Referenced by HcalHitMaker().

Transform3D HcalHitMaker::locToGlobal_
private

Definition at line 51 of file HcalHitMaker.h.

Referenced by addHit(), and setDepth().

bool HcalHitMaker::mapCalculated_
private

Definition at line 53 of file HcalHitMaker.h.

Referenced by HcalHitMaker().

EcalHitMaker& HcalHitMaker::myGrid
private

Definition at line 43 of file HcalHitMaker.h.

Referenced by HcalHitMaker(), and setDepth().

const FSimTrack* HcalHitMaker::myTrack
private

Definition at line 45 of file HcalHitMaker.h.

Referenced by HcalHitMaker().

int HcalHitMaker::onHcal
private

Definition at line 48 of file HcalHitMaker.h.

XYZVector HcalHitMaker::particleDirection
private

Definition at line 47 of file HcalHitMaker.h.

Referenced by HcalHitMaker(), and setDepth().

double HcalHitMaker::radiusFactor_
private

Definition at line 52 of file HcalHitMaker.h.

Referenced by addHit(), and HcalHitMaker().