Skip to content

Commit

Permalink
Merge pull request cms-sw#3 from nsmith-/TTI_62X_TrackTriggerObjects
Browse files Browse the repository at this point in the history
TTI 62X: Updated EG Crystal Cluster code
  • Loading branch information
EmanuelPerez committed Jun 7, 2014
2 parents 4bd4d24 + c563eab commit fae4827
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class L1EGCrystalClusterProducer : public edm::EDProducer {

private:
virtual void produce(edm::Event&, const edm::EventSetup&);
virtual void beginRun(edm::Run const&, edm::EventSetup const&);

CaloGeometryHelper geometryHelper;
bool debug;
Expand Down Expand Up @@ -296,26 +295,16 @@ void L1EGCrystalClusterProducer::produce(edm::Event& iEvent, const edm::EventSet
if ( debug ) std::cout << "H/E: " << hovere << std::endl;

// Form a l1slhc::L1EGCrystalCluster
l1slhc::L1EGCrystalCluster cluster;
cluster.et = totalPt;
cluster.eta = weightedPosition.eta();
cluster.phi = weightedPosition.phi();
cluster.ieta = centerhit.id.ieta();
cluster.iphi = centerhit.id.iphi();
cluster.e = totalEnergy;
cluster.x = weightedPosition.x();
cluster.y = weightedPosition.y();
cluster.z = weightedPosition.z();
cluster.hovere = hovere;
cluster.ECALiso = ECalIsolation;
cluster.ECALetPUcorr = totalPtPUcorr;

reco::Candidate::PolarLorentzVector p4(totalPt, weightedPosition.eta(), weightedPosition.phi(), 0.);
l1slhc::L1EGCrystalCluster cluster(p4, hovere, ECalIsolation, totalPtPUcorr);
trigCrystalClusters->push_back(cluster);

// Save clusters with some cuts
if ( cluster.hovere < 2. && cluster.ECALiso < 3. )
// This is a dynamic falling quadratic cut in pt, trying to squeeze as much efficiency as possible
// out of the cut variables, which should have been pt-independent, but are not.
if ( cluster.hovere() < ((cluster.pt() > 35) ? 0.5 : 0.5+pow(cluster.pt()-35,2)/350. )
&& cluster.isolation() < ((cluster.pt() > 35) ? 1.3 : 1.3+pow(cluster.pt()-35,2)*4/(35*35) ) )
{
reco::Candidate::PolarLorentzVector p4(cluster.et, cluster.eta, cluster.phi, 0.);
l1EGammaCrystal->push_back(l1extra::L1EmParticle(p4, edm::Ref<L1GctEmCandCollection>(), 0));
}
}
Expand All @@ -324,11 +313,4 @@ void L1EGCrystalClusterProducer::produce(edm::Event& iEvent, const edm::EventSet
iEvent.put(l1EGammaCrystal, "EGammaCrystal" );
}

// ------------ method called when starting to processes a run ------------
void
L1EGCrystalClusterProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup)
{
std::cout << "Apparently beginRun() never gets called?!?!?!" << std::endl;
}

DEFINE_FWK_MODULE(L1EGCrystalClusterProducer);
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace l1extra {
class ClusterETComparator {
public:
bool operator()(const l1slhc::L1EGCrystalCluster a, const l1slhc::L1EGCrystalCluster b) const {
return a.et > b.et;
return a.pt() > b.pt();
}
};
}
Expand Down Expand Up @@ -105,8 +105,8 @@ void L1ExtraCrystalPosition::produce( edm::Event & iEvent, const edm::EventSetup
unsigned int indx = getMatchedClusterIndex(clusColl, eta, phi, deltaR);
if (indx != 9999 && deltaR < 0.3) {
l1extra::L1EmParticle* em_new = em.clone();
float eta_new = clusColl[indx].eta;
float phi_new = clusColl[indx].phi;
float eta_new = clusColl[indx].eta();
float phi_new = clusColl[indx].phi();
// float pt_new = em.pt();
// if (cosh(eta_new) > 0.0) pt_new = em.p()/cosh(eta_new);
// reco::Candidate::PolarLorentzVector lv_em_corr(pt_new, eta_new, phi_new, em.mass());
Expand All @@ -122,7 +122,6 @@ void L1ExtraCrystalPosition::produce( edm::Event & iEvent, const edm::EventSetup
// if (cosh(em_new->eta()) > 0.0) et_new = em_new->energy()/cosh(em_new->eta());
// std::cout << " Et, Energy, Eta, Phi (after correction) " << et_new << " " << em_new->energy() << " " << em_new->eta() << " " << em_new->phi() << " deltaR " << deltaR << std::endl;
// std::cout << " px, py, pz " << em_new->px() << " " << em_new->py() << " " << em_new->pz() << std::endl;
// std::cout << " x, y, z " << clusColl[indx].x << " " << clusColl[indx].y << " " << clusColl[indx].z << std::endl;
}
}
iEvent.put(l1EGammaCrystal, "EGammaCrystal" );
Expand All @@ -137,7 +136,7 @@ unsigned int L1ExtraCrystalPosition::getMatchedClusterIndex(l1slhc::L1EGCrystalC
dr_min = 999.9;
size_t index_min = 9999;
for (size_t i = 0; i < egxtals.size(); i++) {
float dr = deltaR(egxtals[i].eta, egxtals[i].phi, eta, phi);
float dr = deltaR(egxtals[i].eta(), egxtals[i].phi(), eta, phi);
if (dr < dr_min) {
index_min = i;
dr_min = dr;
Expand Down
1 change: 1 addition & 0 deletions SimDataFormats/SLHC/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<use name="FWCore/Framework"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="DataFormats/Candidate"/>
<use name="DataFormats/Math"/>
<use name="DataFormats/SiPixelDetId"/>
<use name="boost"/>
Expand Down
33 changes: 17 additions & 16 deletions SimDataFormats/SLHC/interface/L1EGCrystalCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
#define L1EGammaCrystalsCluster_h

#include <vector>
#include "DataFormats/Candidate/interface/LeafCandidate.h"

namespace l1slhc
{

class L1EGCrystalCluster {
public:
float et ;
float eta ;
float phi ;
float e ;
float x ;
float y ;
float z ;
float hovere ;

float ECALiso ;
float ECALetPUcorr;

int ieta;
int iphi;
class L1EGCrystalCluster : public reco::LeafCandidate {
public:
L1EGCrystalCluster() : LeafCandidate(), hovere_(0.), iso_(0.), PUcorrPt_(0.) {};
L1EGCrystalCluster(const PolarLorentzVector& p4, float hovere, float iso, float PUcorrPt = 0.) : LeafCandidate(0, p4), hovere_(hovere), iso_(iso), PUcorrPt_(PUcorrPt) {};
L1EGCrystalCluster(const LorentzVector& p4, float hovere, float iso, float PUcorrPt = 0.) : LeafCandidate(0, p4), hovere_(hovere), iso_(iso), PUcorrPt_(PUcorrPt) {};
virtual ~L1EGCrystalCluster() {};
inline float hovere() const { return hovere_; };
inline float isolation() const { return iso_; };
inline float PUcorrPt() const { return PUcorrPt_; };

private:
// HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster
float hovere_;
// ECal isolation (for outer window size, again look in producer)
float iso_;
// Pileup-corrected energy deposit, not studied carefully yet, don't use
float PUcorrPt_;
};


Expand Down

0 comments on commit fae4827

Please sign in to comment.