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 (double r, double phi, unsigned layer=0) override
 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 () 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.

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

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 }
const FSimTrack * myTrack
Definition: HcalHitMaker.h:43
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:143
double radiusFactor_
Definition: HcalHitMaker.h:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool mapCalculated_
Definition: HcalHitMaker.h:51
XYZPoint ecalEntrance_
Definition: HcalHitMaker.h:44
XYZVector Vect() const
the momentum threevector
Definition: RawParticle.h:323
double interactionLength
Definition: CaloHitMaker.h:47
double moliereRadius
Definition: CaloHitMaker.h:46
EcalHitMaker & myGrid
Definition: HcalHitMaker.h:41
XYZVector particleDirection
Definition: HcalHitMaker.h:45
const XYZPoint & ecalEntrance() const
used in FamosHcalHitMaker
Definition: EcalHitMaker.h:123
static int getSubHcalDet(const FSimTrack *t)
Definition: HcalHitMaker.h:54
CaloHitMaker(const CaloGeometryHelper *calo, DetId::Detector det, int subdetn, int cal, unsigned sht=0)
Definition: CaloHitMaker.cc:12

◆ ~HcalHitMaker()

HcalHitMaker::~HcalHitMaker ( )
inlineoverride

Definition at line 23 of file HcalHitMaker.h.

23 { ; }

Member Function Documentation

◆ addHit() [1/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.

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

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

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 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Transform3D locToGlobal_
Definition: HcalHitMaker.h:49
double radiusFactor_
Definition: HcalHitMaker.h:50
constexpr std::array< uint8_t, layerIndexSize > layer
bool addHit(double r, double phi, unsigned layer=0) override
add the hit in the HCAL in local coordinates
Definition: HcalHitMaker.cc:30
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZVector XYZPoint
Structure Point Contains parameters of Gaussian fits to DMRs.
*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

◆ addHit() [2/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.

References CaloHitMaker::EMSHOWER, CaloGeometryHelper::getClosestCell(), CaloHitMaker::HADSHOWER, HcalForward, CaloHitMaker::hitMap_, createfilelist::int, phase1PixelTopology::layer, CaloHitMaker::MIP, CaloHitMaker::myCalorimeter, point, 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  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 }
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:61
constexpr std::array< uint8_t, layerIndexSize > layer
const CaloGeometryHelper * myCalorimeter
Definition: CaloHitMaker.h:44
T sqrt(T t)
Definition: SSEVec.h:19
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:17
Log< level::Warning, false > LogWarning
double spotEnergy
Definition: CaloHitMaker.h:48
*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

◆ getHits()

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

Implements CaloHitMaker.

Definition at line 35 of file HcalHitMaker.h.

References CaloHitMaker::hitMap_.

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

35 { return hitMap_; };
std::map< CaloHitID, float > hitMap_
Definition: CaloHitMaker.h:61

◆ getSubHcalDet()

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

Definition at line 54 of file HcalHitMaker.h.

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

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  }

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

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

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 }
const std::vector< CaloSegment > & getSegments() const
Definition: EcalHitMaker.h:95
Transform3D locToGlobal_
Definition: HcalHitMaker.h:49
ROOT::Math::Transform3DPJ::Point Point
Definition: HcalHitMaker.cc:8
ROOT::Math::Transform3DPJ Transform3D
Definition: HcalHitMaker.h:20
This class is used to determine if a point lies in the segment.
Definition: CaloSegment.h:87
const FSimTrack * getFSimTrack() const
To retrieve the track.
Definition: EcalHitMaker.h:120
math::XYZVector XYZPoint
EcalHitMaker & myGrid
Definition: HcalHitMaker.h:41
Structure Point Contains parameters of Gaussian fits to DMRs.
XYZVector particleDirection
Definition: HcalHitMaker.h:45
math::XYZVector XYZVector
Definition: RawParticle.h:26
double currentDepth_
Definition: HcalHitMaker.h:48

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