11 #include "Math/VectorUtil.h"
21 !
caloGeometry->getSubdetectorGeometry(
id)->getGeometry(
id) ) {
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";
39 !
caloGeometry->getSubdetectorGeometry(
id)->getGeometry(
id) ) {
40 throw cms::Exception(
"FatalError") <<
"Failed to access geometry for DetId: " <<
id.rawId();
43 return caloGeometry->getSubdetectorGeometry(
id)->getGeometry(
id)->getPosition();
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;
105 return ROOT::Math::VectorUtil::DeltaR(trackP3, idPositionRoot) < 0.5;
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;
315 trkGlobPosAtEcal(0,0,0)
316 , trkGlobPosAtHcal(0,0,0)
317 , trkGlobPosAtHO(0,0,0)
318 , trkMomAtEcal(0,0,0)
319 , trkMomAtHcal(0,0,0)
327 , ecalTrueEnergy(-999)
328 , hcalTrueEnergy(-999)
335 float maxEnergy = -9999;
340 if ( (*hit)->energy() > maxEnergy ) {
341 maxEnergy = (*hit)->energy();
342 id = (*hit)->detid();
349 if ( (*hit)->energy() > maxEnergy ) {
350 maxEnergy = (*hit)->energy();
351 id = (*hit)->detid();
358 if ( (*hit)->energy() > maxEnergy ) {
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;
614 for(std::vector<TAMuonChamberMatch>::const_iterator chamber=
chambers.begin(); chamber!=
chambers.end(); chamber++)
615 numSegments += chamber->segments.size();
621 for(std::vector<TAMuonChamberMatch>::const_iterator chamber=
chambers.begin(); chamber!=
chambers.end(); chamber++)
622 if(chamber->station()==
station) numSegments += chamber->segments.size();
628 for(std::vector<TAMuonChamberMatch>::const_iterator chamber=
chambers.begin(); chamber!=
chambers.end(); chamber++)
629 if(chamber->station()==station&&chamber->detector()==detector) numSegments += chamber->segments.size();
635 for(std::vector<TAMuonChamberMatch>::const_iterator chamber=
chambers.begin(); chamber!=
chambers.end(); chamber++)
636 if(chamber->detector()==detector) numSegments += chamber->segments.size();
double ecalCrossedEnergy()
double coneEnergy(double dR, EnergyType)
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
edm::ESHandle< CaloGeometry > caloGeometry
FreeTrajectoryState stateAtIP
track info
int iphi() const
get the crystal iphi
int numberOfSegments() const
std::string dumpGeometry(const DetId &)
double dPhi(double phi1, double phi2)
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
static std::string info(const DetId &)
int ieta() const
get the crystal ieta
double crossedEnergy(EnergyType)
energy in detector elements crossed by the track by types
GlobalVector momentum() const
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
int iphi() const
get the cell iphi
int numberOfSegmentsInDetector(int detector) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
MgrType::const_iterator const_iterator
const_iterator end() const
std::vector< const HORecHit * > crossedHORecHits
bool insideCone(const DetId &, const double)
int ieta() const
get the tower ieta
std::vector< const HORecHit * > hoRecHits
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