#include <HcalHitMaker.h>
Public Types | |
typedef ROOT::Math::Transform3DPJ | Transform3D |
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 | |
bool | addHit (const XYZPoint &point, unsigned layer=0) |
add the hit in the HCAL in global coordinates | |
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 | |
void | setSpotEnergy (double e) |
Set the spot energy. | |
~HcalHitMaker () | |
Static Public Member Functions | |
static int | getSubHcalDet (const FSimTrack *t) |
Private Attributes | |
double | currentDepth_ |
XYZPoint | ecalEntrance_ |
Transform3D | locToGlobal_ |
bool | mapCalculated_ |
EcalHitMaker & | myGrid |
const FSimTrack * | myTrack |
int | onHcal |
XYZVector | particleDirection |
double | radiusFactor_ |
Definition at line 16 of file HcalHitMaker.h.
Definition at line 22 of file HcalHitMaker.h.
Reimplemented from CaloHitMaker.
Definition at line 21 of file HcalHitMaker.h.
Reimplemented from CaloHitMaker.
Definition at line 20 of file HcalHitMaker.h.
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().
:CaloHitMaker(grid.getCalorimeter(),DetId::Hcal,HcalHitMaker::getSubHcalDet(grid.getFSimTrack()), grid.getFSimTrack()->onHcal()?grid.getFSimTrack()->onHcal():grid.getFSimTrack()->onVFcal()+1,shower), myGrid(grid), myTrack((grid.getFSimTrack())) { // normalize the direction ecalEntrance_=myGrid.ecalEntrance(); particleDirection=myTrack->ecalEntrance().Vect().Unit(); radiusFactor_=(EMSHOWER)? moliereRadius:interactionLength; mapCalculated_=false; //std::cout << " Famos HCAL " << grid.getTrack()->onHcal() << " " << grid.getTrack()->onVFcal() << " " << showerType << std::endl; if(EMSHOWER&&(abs(grid.getFSimTrack()->type())!=11 && grid.getFSimTrack()->type()!=22)) { std::cout << " FamosHcalHitMaker : Strange. The following shower has EM type" << std::endl <<* grid.getFSimTrack() << std::endl; } }
HcalHitMaker::~HcalHitMaker | ( | ) | [inline] |
Definition at line 25 of file HcalHitMaker.h.
{;}
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 EMShower::compute(), HFShower::compute(), HDShower::compute(), CalorimetryManager::HDShowerSimulation(), CalorimetryManager::MuonMipSimulation(), and HDRShower::setHit().
{ // std::cout << " FamosHcalHitMaker::addHit - radiusFactor = " << radiusFactor // << std::endl; XYZPoint point(r*radiusFactor_*std::cos(phi),r*radiusFactor_*std::sin(phi),0.); // Watch out !!!! (Point) is a real point in the MathCore terminology (not a redefined a XYZPoint which // is actually a XYZVector in the MatchCore terminology). Therefore, the Transform3D is correctly applied point = locToGlobal_((Point)point); return addHit(point,layer); }
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.
{ // Temporary nasty hacks to avoid misbehaviour of not-intended-for-that // getClosestCell in case of large (eta beyond HF ...) and in EM showers if(fabs(point.Z())>2000 || fabs(point.X())>2000 || fabs(point.Y())>2000) { if(EMSHOWER) edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point << " coming from an electromagnetic shower. - Ignoring it" << std::endl; else if(HADSHOWER) edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point << " coming from a hadron shower. - Ignoring it" << std::endl; else if(MIP) edm::LogWarning("HcalHitMaker") << "received a hit very far from the detector " << point << " coming from a muon. - Ignoring it" << std::endl; return false; } double pointeta = fabs(point.eta()); if(pointeta > 5.19) return false; DetId thecellID(myCalorimeter->getClosestCell(point,false,false)); HcalDetId myDetId(thecellID); // if ( myDetId.subdetId() == HcalForward ) { // std::cout << "HcalHitMaker : " << point.Z() << " " << myDetId.depth() << std::endl; // } // std::cout << "BEFORE" << std::endl; // std::cout << "HcalHitMaker : subdetId : " << myDetId.subdetId() << std::endl; // std::cout << "HcalHitMaker : depth : " << myDetId.depth() << std::endl; // std::cout << "HcalHitMaker : ieta : " << myDetId.ieta() << std::endl; // std::cout << "HcalHitMaker : iphi : " << myDetId.iphi() << std::endl; // std::cout << "HcalHitMaker : spotE : " << spotEnergy << std::endl; // std::cout << "HcalHitMaker : point.X : " << point.X() << std::endl; // std::cout << "HcalHitMaker : point.Y : " << point.Y() << std::endl; // std::cout << "HcalHitMaker : point.Z : " << point.Z() << std::endl; if ( myDetId.subdetId() == HcalForward ) { int mylayer = layer; if ( myDetId.depth()==2 ) { mylayer = (int)layer; } else { mylayer = 1; } HcalDetId myDetId2((HcalSubdetector)myDetId.subdetId(),myDetId.ieta(),myDetId.iphi(),mylayer); thecellID = myDetId2; } if(!thecellID.null()) { uint32_t cell(thecellID.rawId()); // std::cout << " FamosHcalHitMaker::addHit - the cell num " << cell // << std::endl; std::map<uint32_t,float>::iterator cellitr; cellitr = hitMap_.find(cell); if(cellitr==hitMap_.end()) { hitMap_.insert(std::pair<uint32_t,float>(cell,spotEnergy)); } else { cellitr->second+=spotEnergy; } return true; } return false; }
const std::map<uint32_t,float>& HcalHitMaker::getHits | ( | ) | [inline, virtual] |
Implements CaloHitMaker.
Definition at line 37 of file HcalHitMaker.h.
References CaloHitMaker::hitMap_.
Referenced by CalorimetryManager::EMShowerSimulation(), CalorimetryManager::HDShowerSimulation(), and CalorimetryManager::MuonMipSimulation().
{ return hitMap_ ;} ;
static int HcalHitMaker::getSubHcalDet | ( | const FSimTrack * | t | ) | [inline, static] |
Definition at line 56 of file HcalHitMaker.h.
References HcalBarrel, HcalEndcap, HcalForward, FSimTrack::onHcal(), and FSimTrack::onVFcal().
{ // std::cout << " getSubHcalDet " << std::endl; // According to DataFormats/ HcalDetId/ interface/ HcalSubdetector.h // std::cout << " onHcal " << t->onHcal() << " onVFcal " << t->onVFcal() << std::endl; if(t->onHcal()==1) return HcalBarrel; if(t->onHcal()==2) return HcalEndcap; if(t->onVFcal()==2) return HcalForward; return -1; }
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 EMShower::compute(), HFShower::compute(), HDShower::compute(), CalorimetryManager::HDShowerSimulation(), and HDRShower::setHit().
{ currentDepth_=depth; std::vector<CaloSegment>::const_iterator segiterator; if(inCm) { segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inSegment(currentDepth_)); } else { if(EMSHOWER) segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inX0Segment(currentDepth_)); //Hadron shower if(HADSHOWER) segiterator = find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inL0Segment(currentDepth_)); } if(segiterator==myGrid.getSegments().end()) { // Special trick - As advised by Salavat, no leakage should be simulated if(depth > myGrid.getSegments().back().sL0Exit()) { segiterator= find_if(myGrid.getSegments().begin(),myGrid.getSegments().end(),CaloSegment::inL0Segment(myGrid.getSegments().back().sL0Exit()-1.)); depth=segiterator->sL0Exit()-1.; currentDepth_=depth; if(segiterator==myGrid.getSegments().end()) { std::cout << " Could not go at such depth " << EMSHOWER << " " << currentDepth_ << std::endl; std::cout << " Track " << *(myGrid.getFSimTrack()) << std::endl; return false; } } else { std::cout << " Could not go at such depth " << EMSHOWER << " " << currentDepth_ << " " << myGrid.getSegments().back().sL0Exit() << std::endl; std::cout << " Track " << *(myGrid.getFSimTrack()) << std::endl; return false; } } XYZPoint origin; if(inCm) { origin=segiterator->positionAtDepthincm(currentDepth_); } else { if(EMSHOWER) origin=segiterator->positionAtDepthinX0(currentDepth_); if(HADSHOWER) origin=segiterator->positionAtDepthinL0(currentDepth_); } XYZVector zaxis(0,0,1); XYZVector planeVec1=(zaxis.Cross(particleDirection)).Unit(); locToGlobal_=Transform3D(Point(0,0,0), Point(0,0,1), Point(1,0,0), (Point)origin, (Point)(origin+particleDirection), (Point)(origin+planeVec1)); return true; }
void HcalHitMaker::setSpotEnergy | ( | double | e | ) | [inline, virtual] |
Set the spot energy.
Implements CaloHitMaker.
Definition at line 28 of file HcalHitMaker.h.
References ExpressReco_HICollisions_FallBack::e, and CaloHitMaker::spotEnergy.
Referenced by EMShower::compute(), HFShower::compute(), HDShower::compute(), CalorimetryManager::HDShowerSimulation(), CalorimetryManager::MuonMipSimulation(), and HDRShower::setHit().
{ spotEnergy=e;}
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().