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< CaloHitID,
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< CaloHitID, 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 funct::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
double radiusFactor_
Definition: HcalHitMaker.h:52
const CaloGeometryHelper * getCalorimeter() const
Definition: CaloHitMaker.h:36
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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:50
double moliereRadius
Definition: CaloHitMaker.h:49
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:25
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
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, CaloHitMaker::spotEnergy, and mathSSE::sqrt().

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  //calculate time of flight
61  double dist = std::sqrt(point.X()*point.X() + point.Y()*point.Y() + point.Z()*point.Z());
62  double tof = dist/29.98; //speed of light
63 
64  DetId thecellID(myCalorimeter->getClosestCell(point,false,false));
65 
66  HcalDetId myDetId(thecellID);
67 
68 // if ( myDetId.subdetId() == HcalForward ) {
69 // std::cout << "HcalHitMaker : " << point.Z() << " " << myDetId.depth() << std::endl;
70 // }
71 
72 // std::cout << "BEFORE" << std::endl;
73 // std::cout << "HcalHitMaker : subdetId : " << myDetId.subdetId() << std::endl;
74 // std::cout << "HcalHitMaker : depth : " << myDetId.depth() << std::endl;
75 // std::cout << "HcalHitMaker : ieta : " << myDetId.ieta() << std::endl;
76 // std::cout << "HcalHitMaker : iphi : " << myDetId.iphi() << std::endl;
77 // std::cout << "HcalHitMaker : spotE : " << spotEnergy << std::endl;
78 // std::cout << "HcalHitMaker : point.X : " << point.X() << std::endl;
79 // std::cout << "HcalHitMaker : point.Y : " << point.Y() << std::endl;
80 // std::cout << "HcalHitMaker : point.Z : " << point.Z() << std::endl;
81 
82  if ( myDetId.subdetId() == HcalForward ) {
83  int mylayer = layer;
84  if ( myDetId.depth()==2 ) {
85  mylayer = (int)layer;
86  } else {
87  mylayer = 1;
88  }
89  HcalDetId myDetId2((HcalSubdetector)myDetId.subdetId(),myDetId.ieta(),myDetId.iphi(),mylayer);
90  thecellID = myDetId2;
91  myDetId = myDetId2;
92  }
93 
94 
95 
96  if(!thecellID.null() && myDetId.depth()>0)
97  {
98  CaloHitID current_id(thecellID.rawId(),tof,0); //no track yet
99 
100  // std::cout << " FamosHcalHitMaker::addHit - the cell num " << cell
101  // << std::endl;
102 
103  std::map<CaloHitID,float>::iterator cellitr;
104  cellitr = hitMap_.find(current_id);
105  if(cellitr==hitMap_.end())
106  {
107  hitMap_.insert(std::pair<CaloHitID,float>(current_id,spotEnergy));
108  }
109  else
110  {
111  cellitr->second+=spotEnergy;
112  }
113  return true;
114  }
115  return false;
116 }
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:47
T sqrt(T t)
Definition: SSEVec.h:48
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:18
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:65
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
double spotEnergy
Definition: CaloHitMaker.h:51
*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<CaloHitID,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< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:65
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 119 of file HcalHitMaker.cc.

References gather_cfg::cout, currentDepth_, HLT_25ns14e33_v1_cff::depth, 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().

120 {
122  std::vector<CaloSegment>::const_iterator segiterator;
123  if(inCm)
124  {
125  segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inSegment(currentDepth_));
126  }
127  else
128  {
129  if(EMSHOWER)
130  segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inX0Segment(currentDepth_));
131 
132  //Hadron shower
133  if(HADSHOWER)
134  segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inL0Segment(currentDepth_));
135  }
136 
137  if(segiterator==myGrid.getSegments().end())
138  {
139  // Special trick - As advised by Salavat, no leakage should be simulated
140  if(depth > myGrid.getSegments().back().sL0Exit())
141  {
142  segiterator= find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inL0Segment(myGrid.getSegments().back().sL0Exit()-1.));
143  depth=segiterator->sL0Exit()-1.;
145  if(segiterator==myGrid.getSegments().end())
146  {
147  std::cout << " Could not go at such depth " << EMSHOWER << " " << currentDepth_ << std::endl;
148  std::cout << " Track " << *(myGrid.getFSimTrack()) << std::endl;
149  return false;
150  }
151  }
152  else
153  {
154  std::cout << " Could not go at such depth " << EMSHOWER << " " << currentDepth_ << " " << myGrid.getSegments().back().sL0Exit() << std::endl;
155  std::cout << " Track " << *(myGrid.getFSimTrack()) << std::endl;
156  return false;
157  }
158  }
159 
160 
161  XYZPoint origin;
162  if(inCm)
163  {
164  origin=segiterator->positionAtDepthincm(currentDepth_);
165  }
166  else
167  {
168  if(EMSHOWER)
169  origin=segiterator->positionAtDepthinX0(currentDepth_);
170  if(HADSHOWER)
171  origin=segiterator->positionAtDepthinL0(currentDepth_);
172  }
173  XYZVector zaxis(0,0,1);
174  XYZVector planeVec1=(zaxis.Cross(particleDirection)).Unit();
176  Point(0,0,1),
177  Point(1,0,0),
178  (Point)origin,
179  (Point)(origin+particleDirection),
180  (Point)(origin+planeVec1));
181  return true;
182 }
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().