Skip to content

Commit

Permalink
Merge pull request cms-sw#2044 from lgray/fixes_EXODQM_1986CodeReview
Browse files Browse the repository at this point in the history
Reco fixes -- Fixes to Cluster Shape Variables monitored in EXO DQM + cms-sw#1986 Code Review
  • Loading branch information
ktf committed Jan 17, 2014
2 parents 047c6d6 + 36340ca commit 2287a23
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 175 deletions.
25 changes: 19 additions & 6 deletions RecoEcal/EgammaClusterAlgos/src/PFECALSuperClusterAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ namespace {

double getPFClusterEnergy(const PFClusterPtr& p) {
return p->energy();
}
}

inline double ptFast( const double energy,
const math::XYZPoint& position,
const math::XYZPoint& origin ) {
const auto v = position - origin;
return energy*std::sqrt(v.perp2()/v.mag2());
}

struct SumPSEnergy : public std::binary_function<double,
const PFClusterPtr&,
Expand All @@ -63,8 +69,11 @@ namespace {

struct GreaterByEt : public ClusBinaryFunction {
bool operator()(const CalibClusterPtr& x,
const CalibClusterPtr& y) {
return x->energy()/std::cosh(x->eta()) > y->energy()/std::cosh(y->eta());
const CalibClusterPtr& y) {
const math::XYZPoint zero(0,0,0);
const double xpt = ptFast(x->energy(),x->the_ptr()->position(),zero);
const double ypt = ptFast(y->energy(),y->the_ptr()->position(),zero);
return xpt > ypt;
}
};

Expand All @@ -74,8 +83,9 @@ namespace {
IsASeed(double thresh, bool useETcut = false) :
threshold(thresh), cutET(useETcut) {}
bool operator()(const CalibClusterPtr& x) {
const math::XYZPoint zero(0,0,0);
double e_or_et = x->energy();
if( cutET ) e_or_et /= std::cosh(x->eta());
if( cutET ) e_or_et = ptFast(e_or_et,x->the_ptr()->position(),zero);
return e_or_et > threshold;
}
};
Expand Down Expand Up @@ -408,6 +418,7 @@ buildSuperCluster(CalibClusterPtr& seed,

// now build the supercluster
reco::SuperCluster new_sc(corrSCEnergy,math::XYZPoint(posX,posY,posZ));
new_sc.setCorrectedEnergy(corrSCEnergy);
new_sc.setSeed(clustered.front()->the_ptr());
new_sc.setPreshowerEnergy(corrPS1Energy+corrPS2Energy);
new_sc.setPreshowerEnergyPlane1(corrPS1Energy);
Expand Down Expand Up @@ -469,8 +480,10 @@ buildSuperCluster(CalibClusterPtr& seed,
//Note that Et is computed here with respect to the beamspot position
//in order to be consistent with the cut applied in the
//ElectronSeedProducer
double scetaBeamSpot = (new_sc.position()-beamSpot_->position()).eta();
if ( new_sc.energy()/cosh(scetaBeamSpot) > threshSuperClusterEt_ ) {
double scEtBS =
ptFast(new_sc.energy(),new_sc.position(),beamSpot_->position());

if ( scEtBS > threshSuperClusterEt_ ) {
switch( seed->the_ptr()->layer() ) {
case PFLayer::ECAL_BARREL:
superClustersEB_->push_back(new_sc);
Expand Down
20 changes: 10 additions & 10 deletions RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static std::vector<float> scLocalCovariances(const reco::SuperCluster &cluster,
static Cluster2ndMoments cluster2ndMoments( const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true);

static Cluster2ndMoments cluster2ndMoments( const reco::SuperCluster &superCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true);
static Cluster2ndMoments cluster2ndMoments( const std::vector<const EcalRecHit*>& RH_ptrs, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true);
static Cluster2ndMoments cluster2ndMoments( const std::vector<std::pair<const EcalRecHit*, float> >& RH_ptrs_fracs, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true);

static double zernike20( const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, double R0 = 6.6, bool logW = true, float w0 = 4.7 );
static double zernike42( const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, double R0 = 6.6, bool logW = true, float w0 = 4.7 );
Expand Down Expand Up @@ -192,7 +192,7 @@ static std::pair<DetId, float> getMaximum( const std::vector< std::pair<DetId, f
//Shower shape variables return vector <Roundness, Angle> of a photon
static std::vector<float> roundnessBarrelSuperClusters( const reco::SuperCluster &superCluster ,const EcalRecHitCollection &recHits, int weightedPositionMethod = 0, float energyThreshold = 0.0);
static std::vector<float> roundnessBarrelSuperClustersUserExtended( const reco::SuperCluster &superCluster ,const EcalRecHitCollection &recHits, int ieta_delta=0, int iphi_delta=0, float energyRHThresh=0.00000, int weightedPositionMethod=0);
static std::vector<float> roundnessSelectedBarrelRecHits(const std::vector<const EcalRecHit*>&rhVector, int weightedPositionMethod = 0);
static std::vector<float> roundnessSelectedBarrelRecHits(const std::vector<std::pair<const EcalRecHit*,float> >&rhVector, int weightedPositionMethod = 0);
private:
struct EcalClusterEnergyDeposition
{
Expand Down Expand Up @@ -244,14 +244,14 @@ static std::pair<float,float> mean5x5PositionInXY(const reco::BasicCluster &clus
static float getDPhiEndcap(const DetId& crysId,float meanX,float meanY);
static float getNrCrysDiffInEta(const DetId& crysId,const DetId& orginId);
static float getNrCrysDiffInPhi(const DetId& crysId,const DetId& orginId);

//useful functions for showerRoundnessBarrel function
static int deltaIEta(int seed_ieta, int rh_ieta);
static int deltaIPhi(int seed_iphi, int rh_iphi);
static std::vector<int> getSeedPosition(const std::vector<const EcalRecHit*>&RH_ptrs);
static float getSumEnergy(const std::vector<const EcalRecHit*>&RH_ptrs);
static float computeWeight(float eRH, float energyTotal, int weightedPositionMethod);

//useful functions for showerRoundnessBarrel function
static int deltaIEta(int seed_ieta, int rh_ieta);
static int deltaIPhi(int seed_iphi, int rh_iphi);
static std::vector<int> getSeedPosition(const std::vector<std::pair<const EcalRecHit*,float> >&RH_ptrs);
static float getSumEnergy(const std::vector<std::pair<const EcalRecHit*,float> >&RH_ptrs_fracs);
static float computeWeight(float eRH, float energyTotal, int weightedPositionMethod);
};

#endif
Loading

0 comments on commit 2287a23

Please sign in to comment.