11 #include "Math/VectorUtil.h" 22 throw cms::Exception(
"FatalError") <<
"Failed to access geometry for DetId: " <<
id.rawId();
24 std::ostringstream oss;
29 oss <<
"(" <<
point->z() <<
", " <<
point->perp() <<
", " <<
point->eta() <<
", " <<
point->phi() <<
"), \t";
40 throw cms::Exception(
"FatalError") <<
"Failed to access geometry for DetId: " <<
id.rawId();
54 energy += (*hit)->energy();
60 energy += (*hit)->energy();
66 energy += (*hit)->energy();
72 energy += (*hit)->energy();
78 energy += (*hit)->emEnergy();
84 energy += (*hit)->hadEnergy();
90 energy += (*hit)->outerEnergy();
101 if (idPosition.
mag()<0.01)
return false;
115 if (
insideCone((*hit)->detid(),dR)) energy += (*hit)->energy();
121 if (
insideCone((*hit)->detid(),dR)) energy += (*hit)->energy();
127 if (
insideCone((*hit)->detid(),dR)) energy += (*hit)->energy();
133 if (
insideCone((*hit)->id(),dR)) energy += (*hit)->energy();
139 if (
insideCone((*hit)->id(),dR)) energy += (*hit)->emEnergy();
145 if (
insideCone((*hit)->id(),dR)) energy += (*hit)->hadEnergy();
151 if (
insideCone((*hit)->id(),dR)) energy += (*hit)->outerEnergy();
166 if (
id.rawId() == 0 )
return 0.;
174 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected CaloTower, but found:\n" <<
181 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
182 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
183 if (
abs(72-dPhi) <
dPhi ) dPhi = 72-dPhi;
184 if( dEta <= gridSize && dPhi <= gridSize ) {
187 energy += (*hit)->energy();
190 energy += (*hit)->emEnergy();
193 energy += (*hit)->hadEnergy();
196 energy += (*hit)->outerEnergy();
208 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected EcalBarrel or EcalEndcap, but found:\n" <<
216 if ((*hit)->id().subdetId() !=
EcalBarrel)
continue;
217 EBDetId neighborId((*hit)->id());
219 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
220 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
221 if (
abs(360-dPhi) <
dPhi ) dPhi = 360-dPhi;
222 if( dEta <= gridSize && dPhi <= gridSize ) {
223 energy += (*hit)->energy();
230 if ((*hit)->id().subdetId() !=
EcalEndcap)
continue;
231 EEDetId neighborId((*hit)->id());
232 if( centerId.
zside() == neighborId.zside() &&
233 abs(centerId.
ix()-neighborId.ix()) <= gridSize &&
234 abs(centerId.
iy()-neighborId.iy()) <= gridSize ) {
235 energy += (*hit)->energy();
244 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected HE or HB, but found:\n" <<
251 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
252 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
253 if (
abs(72-dPhi) <
dPhi ) dPhi = 72-dPhi;
254 if( dEta <= gridSize && dPhi <= gridSize ){
255 energy += (*hit)->energy();
263 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected HO, but found:\n" <<
270 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
271 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
272 if (
abs(72-dPhi) <
dPhi ) dPhi = 72-dPhi;
273 if( dEta <= gridSize && dPhi <= gridSize ) {
274 energy += (*hit)->energy();
280 throw cms::Exception(
"FatalError") <<
"Unkown or not implemented energy type requested, type:" <<
type;
308 throw cms::Exception(
"FatalError") <<
"Unkown or not implemented energy type requested, type:" <<
type;
341 maxEnergy = (*hit)->energy();
342 id = (*hit)->detid();
350 maxEnergy = (*hit)->energy();
351 id = (*hit)->detid();
359 maxEnergy = (*hit)->energy();
360 id = (*hit)->detid();
373 energy = (*hit)->energy();
376 energy = (*hit)->emEnergy();
379 energy = (*hit)->hadEnergy();
382 energy = (*hit)->energy();
387 if ( energy > maxEnergy ) {
394 throw cms::Exception(
"FatalError") <<
"Maximal energy deposition: unkown or not implemented energy type requested, type:" <<
type;
401 double energy_max(0);
403 if (
id.rawId() == 0 )
return id_max;
411 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected CaloTower, but found:\n" <<
418 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
419 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
420 if (
abs(72-dPhi) <
dPhi ) dPhi = 72-dPhi;
421 if( dEta <= gridSize && dPhi <= gridSize ) {
424 if ( energy_max < (*hit)->energy() ){
425 energy_max = (*hit)->energy();
426 id_max = (*hit)->id();
430 if ( energy_max < (*hit)->emEnergy() ){
431 energy_max = (*hit)->emEnergy();
432 id_max = (*hit)->id();
436 if ( energy_max < (*hit)->hadEnergy() ){
437 energy_max = (*hit)->hadEnergy();
438 id_max = (*hit)->id();
442 if ( energy_max < (*hit)->outerEnergy() ){
443 energy_max = (*hit)->outerEnergy();
444 id_max = (*hit)->id();
457 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected EcalBarrel or EcalEndcap, but found:\n" <<
465 if ((*hit)->id().subdetId() !=
EcalBarrel)
continue;
466 EBDetId neighborId((*hit)->id());
468 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
469 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
470 if (
abs(360-dPhi) <
dPhi ) dPhi = 360-dPhi;
471 if( dEta <= gridSize && dPhi <= gridSize ) {
472 if ( energy_max < (*hit)->energy() ){
473 energy_max = (*hit)->energy();
474 id_max = (*hit)->id();
482 if ((*hit)->id().subdetId() !=
EcalEndcap)
continue;
483 EEDetId neighborId((*hit)->id());
484 if( centerId.
zside() == neighborId.zside() &&
485 abs(centerId.
ix()-neighborId.ix()) <= gridSize &&
486 abs(centerId.
iy()-neighborId.iy()) <= gridSize ) {
487 if ( energy_max < (*hit)->energy() ){
488 energy_max = (*hit)->energy();
489 id_max = (*hit)->id();
499 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected HE or HB, but found:\n" <<
506 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
507 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
508 if (
abs(72-dPhi) <
dPhi ) dPhi = 72-dPhi;
509 if( dEta <= gridSize && dPhi <= gridSize ){
510 if ( energy_max < (*hit)->energy() ){
511 energy_max = (*hit)->energy();
512 id_max = (*hit)->id();
521 throw cms::Exception(
"FatalError") <<
"Wrong DetId. Expected HO, but found:\n" <<
528 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
529 int dPhi =
abs( centerId.
iphi()-neighborId.iphi() );
530 if (
abs(72-dPhi) <
dPhi ) dPhi = 72-dPhi;
531 if( dEta <= gridSize && dPhi <= gridSize ) {
532 if ( energy_max < (*hit)->energy() ){
533 energy_max = (*hit)->energy();
534 id_max = (*hit)->id();
541 throw cms::Exception(
"FatalError") <<
"Unkown or not implemented energy type requested, type:" <<
type;
570 throw cms::Exception(
"FatalError") <<
"Unkown or not implemented energy type requested, type:" <<
type;
615 numSegments +=
chamber->segments.size();
double ecalCrossedEnergy()
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
double coneEnergy(double dR, EnergyType)
math::XYZPoint trkGlobPosAtHO
GlobalPoint getPosition(const DetId &)
std::vector< const CaloTower * > crossedTowers
std::vector< const CaloTower * > towers
std::vector< const HBHERecHit * > crossedHcalRecHits
std::vector< DetId > crossedTowerIds
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< DetId > crossedEcalIds
Global3DPoint GlobalPoint
DetId findMaxDeposition(EnergyType)
Find detector elements with highest energy deposition.
const_iterator begin() const
std::vector< DetId > crossedHcalIds
std::vector< const EcalRecHit * > crossedEcalRecHits
hits in detector elements crossed by a track
double nXnEnergy(const DetId &, EnergyType, int gridSize=1)
get energy of the NxN shape (N = 2*gridSize + 1) around given detector element
math::XYZPoint trkGlobPosAtHcal
FreeTrajectoryState stateAtIP
track info
int iphi() const
get the crystal iphi
int numberOfSegments() const
std::string dumpGeometry(const DetId &)
double hcalCrossedEnergy()
std::vector< TAMuonChamberMatch > chambers
std::vector< const HBHERecHit * > hcalRecHits
int ieta() const
get the cell ieta
std::vector< DetId > crossedHOIds
int iphi() const
get the tower iphi
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
double crossedEnergy(EnergyType)
energy in detector elements crossed by the track by types
GlobalVector momentum() const
const CaloGeometry * caloGeometry
int iphi() const
get the cell iphi
int numberOfSegmentsInDetector(int detector) const
GlobalVector trkMomAtEcal
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static std::string info(const DetId &, const TrackerTopology *tTopo)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
GlobalVector trkMomAtHcal
MgrType::const_iterator const_iterator
const_iterator end() const
std::vector< const HORecHit * > crossedHORecHits
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
bool insideCone(const DetId &, const double)
int ieta() const
get the tower ieta
std::vector< const HORecHit * > hoRecHits
const SimTrack * simTrack
MC truth info.
int numberOfSegmentsInStation(int station) const
*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