Skip to content

Commit

Permalink
Update geometry access for Hcal cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jul 25, 2017
1 parent 3b3a9c0 commit 3f48997
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions RecoMET/METAlgorithms/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<use name="TrackingTools/GeomPropagators"/>
<use name="TrackingTools/TrackAssociator"/>
<use name="Geometry/CaloTopology"/>
<use name="Geometry/HcalTowerAlgo"/>
<use name="Geometry/CSCGeometry"/>
<use name="RecoEcal/EgammaCoreTools"/>
<use name="DataFormats/ParticleFlowCandidate"/>
Expand Down
11 changes: 3 additions & 8 deletions RecoMET/METAlgorithms/interface/HcalHaloAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@

#include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
#include "Geometry/CaloTopology/interface/EcalEndcapTopology.h"
#include "DataFormats/CaloRecHit/interface/CaloID.h"

#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"

#include "DataFormats/DetId/interface/DetId.h"

#include "DataFormats/CaloRecHit/interface/CaloID.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/ESDetId.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHit.h"

Expand Down Expand Up @@ -89,7 +83,8 @@ class HcalHaloAlgo{
float SumEnergyThreshold;
int NHitsThreshold;

const CaloGeometry *geo;
const CaloGeometry *geo_;
const HcalGeometry *hgeo_;
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx);

};
Expand Down
15 changes: 9 additions & 6 deletions RecoMET/METAlgorithms/src/HcalHaloAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ bool CompareTowers(const CaloTower* x, const CaloTower* y ){
return x->iphi()*1000 + x->ieta() < y->iphi()*1000 + y->ieta();
}

HcalHaloAlgo::HcalHaloAlgo()
HcalHaloAlgo::HcalHaloAlgo() : geo_(0), hgeo_(0)
{
HBRecHitEnergyThreshold = 0.;
HERecHitEnergyThreshold = 0.;
SumEnergyThreshold = 0.;
NHitsThreshold = 0;

geo = 0;
}

HcalHaloData HcalHaloAlgo::Calculate(const CaloGeometry& TheCaloGeometry, edm::Handle<HBHERecHitCollection>& TheHBHERecHits, edm::Handle<EBRecHitCollection>& TheEBRecHits,edm::Handle<EERecHitCollection>& TheEERecHits,const edm::EventSetup& TheSetup){
Expand Down Expand Up @@ -224,10 +222,10 @@ HcalHaloData HcalHaloAlgo::Calculate(const CaloGeometry& TheCaloGeometry, edm::H
prevHadEt = tower->hadEt();
}

geo = 0;
edm::ESHandle<CaloGeometry> pGeo;
TheSetup.get<CaloGeometryRecord>().get(pGeo);
geo = pGeo.product();
geo_ = pGeo.product();
hgeo_ = dynamic_cast<const HcalGeometry*>(geo_->getSubdetectorGeometry(DetId::Hcal, 1));

//Halo cluster building:
//Various clusters are built, depending on the subdetector.
Expand Down Expand Up @@ -520,7 +518,12 @@ bool HcalHaloAlgo::HEClusterShapeandTimeStudy( HaloClusterCandidateHCAL hcand, b

math::XYZPoint HcalHaloAlgo::getPosition(const DetId &id, reco::Vertex::Point vtx){

const GlobalPoint& pos=geo->getPosition(id);
GlobalPoint pos;
if (id.det() == 4) {
pos = hgeo_->getPosition(id);
} else {
pos = GlobalPoint(geo_->getPosition(id));
}
math::XYZPoint posV(pos.x() - vtx.x(),pos.y() - vtx.y(),pos.z() - vtx.z());
return posV;
}
Expand Down

0 comments on commit 3f48997

Please sign in to comment.