CMS 3D CMS Logo

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 (const XYZPoint &point, unsigned layer=0)
 add the hit in the HCAL in global coordinates More...
 
bool addHit (double r, double phi, unsigned layer=0) override
 add the hit in the HCAL in local coordinates More...
 
const std::map< CaloHitID, float > & getHits () override
 
 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) override
 Set the spot energy. More...
 
 ~HcalHitMaker () 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 ()
 

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

◆ Transform3D

Definition at line 20 of file HcalHitMaker.h.

◆ XYZPoint

Definition at line 19 of file HcalHitMaker.h.

◆ XYZVector

Definition at line 18 of file HcalHitMaker.h.

Constructor & Destructor Documentation

◆ HcalHitMaker()

HcalHitMaker::HcalHitMaker ( EcalHitMaker grid,
unsigned  shower 
)

Definition at line 10 of file HcalHitMaker.cc.

11  : CaloHitMaker(grid.getCalorimeter(),
13  HcalHitMaker::getSubHcalDet(grid.getFSimTrack()),
14  grid.getFSimTrack()->onHcal() ? grid.getFSimTrack()->onHcal() : grid.getFSimTrack()->onVFcal() + 1,
15  shower),
16  myGrid(grid),
17  myTrack((grid.getFSimTrack())) {
18  // normalize the direction
22  mapCalculated_ = false;
23  //std::cout << " Famos HCAL " << grid.getTrack()->onHcal() << " " << grid.getTrack()->onVFcal() << " " << showerType << std::endl;
24  if (EMSHOWER && (abs(grid.getFSimTrack()->type()) != 11 && grid.getFSimTrack()->type() != 22)) {
25  std::cout << " FamosHcalHitMaker : Strange. The following shower has EM type" << std::endl
26  << *grid.getFSimTrack() << std::endl;
27  }
28 }

References funct::abs(), gather_cfg::cout, EcalHitMaker::ecalEntrance(), FSimTrack::ecalEntrance(), ecalEntrance_, CaloHitMaker::EMSHOWER, getRunAppsInfo::grid, CaloHitMaker::interactionLength, mapCalculated_, CaloHitMaker::moliereRadius, myGrid, myTrack, particleDirection, radiusFactor_, and RawParticle::Vect().

◆ ~HcalHitMaker()

HcalHitMaker::~HcalHitMaker ( )
inlineoverride

Definition at line 23 of file HcalHitMaker.h.

23 { ; }

Member Function Documentation

◆ addHit() [1/2]

bool HcalHitMaker::addHit ( const XYZPoint point,
unsigned  layer = 0 
)

add the hit in the HCAL in global coordinates

Definition at line 42 of file HcalHitMaker.cc.

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  if (EMSHOWER)
47  edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point
48  << " 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
51  << " coming from a hadron shower. - Ignoring it" << std::endl;
52  else if (MIP)
53  edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point
54  << " coming from a muon. - Ignoring it" << std::endl;
55  return false;
56  }
57 
58  double pointeta = fabs(point.eta());
59  if (pointeta > 5.19)
60  return false;
61 
62  //calculate time of flight
63  double dist = std::sqrt(point.X() * point.X() + point.Y() * point.Y() + point.Z() * point.Z());
64  double tof = dist / 29.98; //speed of light
65 
66  DetId thecellID(myCalorimeter->getClosestCell(point, false, false));
67 
68  HcalDetId myDetId(thecellID);
69 
70  // if ( myDetId.subdetId() == HcalForward ) {
71  // std::cout << "HcalHitMaker : " << point.Z() << " " << myDetId.depth() << std::endl;
72  // }
73 
74  // std::cout << "BEFORE" << std::endl;
75  // std::cout << "HcalHitMaker : subdetId : " << myDetId.subdetId() << std::endl;
76  // std::cout << "HcalHitMaker : depth : " << myDetId.depth() << std::endl;
77  // std::cout << "HcalHitMaker : ieta : " << myDetId.ieta() << std::endl;
78  // std::cout << "HcalHitMaker : iphi : " << myDetId.iphi() << std::endl;
79  // std::cout << "HcalHitMaker : spotE : " << spotEnergy << std::endl;
80  // std::cout << "HcalHitMaker : point.X : " << point.X() << std::endl;
81  // std::cout << "HcalHitMaker : point.Y : " << point.Y() << std::endl;
82  // std::cout << "HcalHitMaker : point.Z : " << point.Z() << std::endl;
83 
84  if (myDetId.subdetId() == HcalForward) {
85  int mylayer = layer;
86  if (myDetId.depth() == 2) {
87  mylayer = (int)layer;
88  } else {
89  mylayer = 1;
90  }
91  HcalDetId myDetId2((HcalSubdetector)myDetId.subdetId(), myDetId.ieta(), myDetId.iphi(), mylayer);
92  thecellID = myDetId2;
93  myDetId = myDetId2;
94  }
95 
96  if (!thecellID.null() && myDetId.depth() > 0) {
97  CaloHitID current_id(thecellID.rawId(), tof, 0); //no track yet
98 
99  // std::cout << " FamosHcalHitMaker::addHit - the cell num " << cell
100  // << std::endl;
101 
102  std::map<CaloHitID, float>::iterator cellitr;
103  cellitr = hitMap_.find(current_id);
104  if (cellitr == hitMap_.end()) {
105  hitMap_.insert(std::pair<CaloHitID, float>(current_id, spotEnergy));
106  } else {
107  cellitr->second += spotEnergy;
108  }
109  return true;
110  }
111  return false;
112 }

References CaloHitMaker::EMSHOWER, CaloGeometryHelper::getClosestCell(), CaloHitMaker::HADSHOWER, HcalForward, CaloHitMaker::hitMap_, createfilelist::int, CaloHitMaker::MIP, CaloHitMaker::myCalorimeter, point, CaloHitMaker::spotEnergy, and mathSSE::sqrt().

◆ addHit() [2/2]

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

add the hit in the HCAL in local coordinates

Implements CaloHitMaker.

Definition at line 30 of file HcalHitMaker.cc.

30  {
31  // std::cout << " FamosHcalHitMaker::addHit - radiusFactor = " << radiusFactor
32  // << std::endl;
33 
35 
36  // Watch out !!!! (Point) is a real point in the MathCore terminology (not a redefined a XYZPoint which
37  // is actually a XYZVector in the MatchCore terminology). Therefore, the Transform3D is correctly applied
39  return addHit(point, layer);
40 }

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

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

◆ getHits()

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

◆ getSubHcalDet()

static int HcalHitMaker::getSubHcalDet ( const FSimTrack t)
inlinestatic

Definition at line 54 of file HcalHitMaker.h.

54  {
55  // std::cout << " getSubHcalDet " << std::endl;
56  // According to DataFormats/ HcalDetId/ interface/ HcalSubdetector.h
57  // std::cout << " onHcal " << t->onHcal() << " onVFcal " << t->onVFcal() << std::endl;
58  if (t->onHcal() == 1)
59  return HcalBarrel;
60  if (t->onHcal() == 2)
61  return HcalEndcap;
62  if (t->onVFcal() == 2)
63  return HcalForward;
64  return -1;
65  }

References HcalBarrel, HcalEndcap, HcalForward, and OrderedSet::t.

◆ setDepth()

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.

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

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

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

◆ setSpotEnergy()

void HcalHitMaker::setSpotEnergy ( double  e)
inlineoverridevirtual

Member Data Documentation

◆ currentDepth_

double HcalHitMaker::currentDepth_
private

Definition at line 48 of file HcalHitMaker.h.

Referenced by setDepth().

◆ ecalEntrance_

XYZPoint HcalHitMaker::ecalEntrance_
private

Definition at line 44 of file HcalHitMaker.h.

Referenced by HcalHitMaker().

◆ locToGlobal_

Transform3D HcalHitMaker::locToGlobal_
private

Definition at line 49 of file HcalHitMaker.h.

Referenced by addHit(), and setDepth().

◆ mapCalculated_

bool HcalHitMaker::mapCalculated_
private

Definition at line 51 of file HcalHitMaker.h.

Referenced by HcalHitMaker().

◆ myGrid

EcalHitMaker& HcalHitMaker::myGrid
private

Definition at line 41 of file HcalHitMaker.h.

Referenced by HcalHitMaker(), and setDepth().

◆ myTrack

const FSimTrack* HcalHitMaker::myTrack
private

Definition at line 43 of file HcalHitMaker.h.

Referenced by HcalHitMaker().

◆ onHcal

int HcalHitMaker::onHcal
private

Definition at line 46 of file HcalHitMaker.h.

◆ particleDirection

XYZVector HcalHitMaker::particleDirection
private

Definition at line 45 of file HcalHitMaker.h.

Referenced by HcalHitMaker(), and setDepth().

◆ radiusFactor_

double HcalHitMaker::radiusFactor_
private

Definition at line 50 of file HcalHitMaker.h.

Referenced by addHit(), and HcalHitMaker().

HcalHitMaker::Transform3D
ROOT::Math::Transform3DPJ Transform3D
Definition: HcalHitMaker.h:20
HcalHitMaker::particleDirection
XYZVector particleDirection
Definition: HcalHitMaker.h:45
HcalHitMaker::mapCalculated_
bool mapCalculated_
Definition: HcalHitMaker.h:51
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DetId::Hcal
Definition: DetId.h:28
HcalHitMaker::locToGlobal_
Transform3D locToGlobal_
Definition: HcalHitMaker.h:49
getRunAppsInfo.grid
grid
Definition: getRunAppsInfo.py:92
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
CaloHitMaker::EMSHOWER
bool EMSHOWER
Definition: CaloHitMaker.h:50
CaloHitMaker::interactionLength
double interactionLength
Definition: CaloHitMaker.h:47
HcalBarrel
Definition: HcalAssistant.h:33
LaserClient_cfi.zaxis
zaxis
Definition: LaserClient_cfi.py:91
CaloHitMaker::MIP
bool MIP
Definition: CaloHitMaker.h:52
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
EcalHitMaker::ecalEntrance
const XYZPoint & ecalEntrance() const
used in FamosHcalHitMaker
Definition: EcalHitMaker.h:123
DetId
Definition: DetId.h:17
CaloGeometryHelper::getClosestCell
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
Definition: CaloGeometryHelper.cc:58
EcalHitMaker::getFSimTrack
const FSimTrack * getFSimTrack() const
To retrieve the track.
Definition: EcalHitMaker.h:120
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Point
ROOT::Math::Transform3DPJ::Point Point
Definition: HcalHitMaker.cc:8
CaloSegment::inSegment
Definition: CaloSegment.h:131
HcalHitMaker::myGrid
EcalHitMaker & myGrid
Definition: HcalHitMaker.h:41
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalHitMaker::ecalEntrance_
XYZPoint ecalEntrance_
Definition: HcalHitMaker.h:44
FSimTrack::ecalEntrance
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:143
OrderedSet.t
t
Definition: OrderedSet.py:90
HcalHitMaker::currentDepth_
double currentDepth_
Definition: HcalHitMaker.h:48
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
RawParticle::Vect
XYZVector Vect() const
the momentum threevector
Definition: RawParticle.h:323
HcalHitMaker::getSubHcalDet
static int getSubHcalDet(const FSimTrack *t)
Definition: HcalHitMaker.h:54
edm::LogWarning
Definition: MessageLogger.h:141
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
EcalHitMaker::getSegments
const std::vector< CaloSegment > & getSegments() const
Definition: EcalHitMaker.h:95
CaloHitMaker::spotEnergy
double spotEnergy
Definition: CaloHitMaker.h:48
XYZPoint
math::XYZVector XYZPoint
Definition: CalorimetryManager.cc:66
CaloHitMaker::myCalorimeter
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:44
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalForward
Definition: HcalAssistant.h:36
DDAxes::phi
CaloHitMaker::HADSHOWER
bool HADSHOWER
Definition: CaloHitMaker.h:51
HcalEndcap
Definition: HcalAssistant.h:34
CaloHitID
Definition: CaloHitID.h:11
CaloHitMaker::hitMap_
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:61
HcalHitMaker::addHit
bool addHit(double r, double phi, unsigned layer=0) override
add the hit in the HCAL in local coordinates
Definition: HcalHitMaker.cc:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalHitMaker::radiusFactor_
double radiusFactor_
Definition: HcalHitMaker.h:50
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
CaloHitMaker::moliereRadius
double moliereRadius
Definition: CaloHitMaker.h:46
HcalHitMaker::myTrack
const FSimTrack * myTrack
Definition: HcalHitMaker.h:43
CaloSegment::inL0Segment
Definition: CaloSegment.h:109
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
CaloSegment::inX0Segment
This class is used to determine if a point lies in the segment.
Definition: CaloSegment.h:87