Skip to content

Commit

Permalink
Add a new tool for charge isolation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Feb 15, 2018
1 parent 3882b21 commit 61e0fe5
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 88 deletions.
Expand Up @@ -94,7 +94,7 @@ class AlCaIsoTracksFilter : public edm::stream::EDFilter<edm::GlobalCache<AlCaIs
const double maxRestrictionP_, slopeRestrictionP_;
const double eIsolate_, pTrackLow_, pTrackHigh_;
const int preScale_;
std::string theTrackQuality_;
const std::string theTrackQuality_;
spr::trackSelectionParameters selectionParameter_;
double a_charIsoR_;
unsigned int nRun_, nAll_, nGood_, nRange_;
Expand Down Expand Up @@ -139,6 +139,7 @@ AlCaIsoTracksFilter::AlCaIsoTracksFilter(const edm::ParameterSet& iConfig, const
pTrackLow_(iConfig.getParameter<double>("momentumRangeLow")),
pTrackHigh_(iConfig.getParameter<double>("momentumRangeHigh")),
preScale_(iConfig.getParameter<int>("preScaleFactor")),
theTrackQuality_(iConfig.getParameter<std::string>("trackQuality")),
nRun_(0), nAll_(0), nGood_(0), nRange_(0) {
//now do what ever initialization is needed
const double isolationRadius(28.9);
Expand All @@ -147,7 +148,6 @@ AlCaIsoTracksFilter::AlCaIsoTracksFilter(const edm::ParameterSet& iConfig, const
// Eta dependent cut uses (maxRestrictionP_ * exp(|ieta|*log(2.5)/18))
// with the factor for exponential slopeRestrictionP_ = log(2.5)/18
// maxRestrictionP_ = 8 GeV as came from a study
theTrackQuality_ = iConfig.getParameter<std::string>("trackQuality");
reco::TrackBase::TrackQuality trackQuality_=reco::TrackBase::qualityByName(theTrackQuality_);
selectionParameter_.minPt = iConfig.getParameter<double>("minTrackPt");;
selectionParameter_.minQuality = trackQuality_;
Expand Down
2 changes: 1 addition & 1 deletion Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc
Expand Up @@ -123,7 +123,7 @@ class HcalIsoTrkAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns,edm::
HLTConfigProvider hltConfig_;
const std::vector<std::string> trigNames_;
spr::trackSelectionParameters selectionParameter_;
std::string theTrackQuality_;
const std::string theTrackQuality_;
const std::string processName_, l1Filter_;
const std::string l2Filter_, l3Filter_;
const double a_coneR_, a_mipR_, pTrackMin_, eEcalMax_;
Expand Down
8 changes: 4 additions & 4 deletions Calibration/IsolatedParticles/interface/CaloPropagateTrack.h
Expand Up @@ -92,10 +92,10 @@ namespace spr{
// Returns a vector of DetID's of closest cell on the ECAL/HCAL surface of
// all the tracks in the collection. Also saves a boolean if extrapolation
// is satisfactory
std::vector<spr::propagatedTrackID> propagateCosmicCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, bool debug=false);
std::vector<spr::propagatedTrackID> propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, bool debug=false);
void propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, std::vector<spr::propagatedTrackID>& vdets, bool debug=false);
void propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, std::string & theTrackQuality, std::vector<spr::propagatedTrackDirection>& trkDir, bool debug=false);
std::vector<spr::propagatedTrackID> propagateCosmicCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, const std::string & theTrackQuality, bool debug=false);
std::vector<spr::propagatedTrackID> propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, const std::string & theTrackQuality, bool debug=false);
void propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, const std::string & theTrackQuality, std::vector<spr::propagatedTrackID>& vdets, bool debug=false);
void propagateCALO(edm::Handle<reco::TrackCollection>& trkCollection, const CaloGeometry* geo, const MagneticField* bField, const std::string & theTrackQuality, std::vector<spr::propagatedTrackDirection>& trkDir, bool debug=false);
spr::propagatedTrackID propagateCALO(const reco::Track*, const CaloGeometry* geo, const MagneticField* bField, bool debug=false);
std::vector<spr::propagatedGenTrackID> propagateCALO(const HepMC::GenEvent * genEvent, edm::ESHandle<ParticleDataTable>& pdt, const CaloGeometry* geo, const MagneticField* bField, double etaMax=3.0, bool debug=false);
std::vector<spr::propagatedGenParticleID> propagateCALO(edm::Handle<reco::GenParticleCollection>& genParticles, edm::ESHandle<ParticleDataTable>& pdt, const CaloGeometry* geo, const MagneticField* bField, double etaMax=3.0, bool debug=false);
Expand Down
7 changes: 4 additions & 3 deletions Calibration/IsolatedParticles/interface/ChargeIsolation.h
Expand Up @@ -45,7 +45,7 @@ namespace spr{
// Returns the maximum energy of a track within a NxN matrix around the
// impact of a given track on the ECAL surface. It extrapolates all tracks
// in the collection to the ECAL surface in order to do the tests
double chargeIsolationEcal(const DetId& coreDet, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const CaloGeometry* geo, const CaloTopology* caloTopology, const MagneticField* bField, int ieta, int iphi, std::string& theTrackQuality, bool debug=false);
double chargeIsolationEcal(const DetId& coreDet, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const CaloGeometry* geo, const CaloTopology* caloTopology, const MagneticField* bField, int ieta, int iphi, const std::string& theTrackQuality, bool debug=false);

// Returns the maximum energy of a track within a NxN matrix around the
// impact of a given track on the HCAL surface. It assumes that all tracks
Expand All @@ -55,14 +55,15 @@ namespace spr{
// Returns the maximum energy of a track within a NxN matrix around the
// impact of a given track on the HCAL surface. It extrapolates all tracks
// in the collection to the HCAL surface in order to do the tests
double chargeIsolationHcal(reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const DetId ClosestCell, const HcalTopology* topology, const CaloSubdetectorGeometry* gHB, const MagneticField* bField, int ieta, int iphi, std::string& theTrackQuality, bool debug=false);
double chargeIsolationHcal(reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const DetId ClosestCell, const HcalTopology* topology, const CaloSubdetectorGeometry* gHB, const MagneticField* bField, int ieta, int iphi, const std::string& theTrackQuality, bool debug=false);

bool chargeIsolation(const DetId anyCell, std::vector<DetId>& vdets) ;

// Returns the maximum energy of a track within a cone of radius *dR*
// around the impact poiunt to the ECAL surface
double coneChargeIsolation(const edm::Event& iEvent, const edm::EventSetup& iSetup, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, std::string theTrackQuality, int &nNearTRKs, int &nLayers_maxNearP, int &trkQual_maxNearP, double &maxNearP_goodTrk, const GlobalPoint& hpoint1, const GlobalVector& trackMom, double dR);
double coneChargeIsolation(const edm::Event& iEvent, const edm::EventSetup& iSetup, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, const std::string& theTrackQuality, int &nNearTRKs, int &nLayers_maxNearP, int &trkQual_maxNearP, double &maxNearP_goodTrk, const GlobalPoint& hpoint1, const GlobalVector& trackMom, double dR);
double chargeIsolationCone(unsigned int trkIndex, std::vector<spr::propagatedTrackDirection> & trkDirs, double dR, int & nNearTRKs, bool debug=false);
std::pair<double,double> chargeIsolationCone(unsigned int trkIndex, std::vector<spr::propagatedTrackDirection> & trkDirs, double dR, bool debug=false);

int coneChargeIsolation(const GlobalPoint& hpoint1, const GlobalPoint& point2, const GlobalVector& trackMom, double dR);

Expand Down
Expand Up @@ -31,13 +31,13 @@

namespace spr{

double chargeIsolation(const edm::Event& iEvent, const edm::EventSetup& iSetup, CaloNavigator<DetId>& navigator, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const CaloSubdetectorGeometry* gEB, const CaloSubdetectorGeometry* gEE, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, int ieta, int iphi, std::string& theTrackQuality, bool debug=false);
double chargeIsolation(const edm::Event& iEvent, const edm::EventSetup& iSetup, CaloNavigator<DetId>& navigator, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const CaloSubdetectorGeometry* gEB, const CaloSubdetectorGeometry* gEE, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, int ieta, int iphi, const std::string& theTrackQuality, bool debug=false);

bool chargeIsolation(const DetId anyCell, CaloNavigator<DetId>& navigator, int deta, int dphi);

double chargeIsolationEcal(const edm::Event& iEvent, const edm::EventSetup& iSetup, const DetId& coreDet, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const CaloGeometry* geo, const CaloTopology* caloTopology, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, int ieta, int iphi, std::string& theTrackQuality, bool debug=false);
double chargeIsolationEcal(const edm::Event& iEvent, const edm::EventSetup& iSetup, const DetId& coreDet, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const CaloGeometry* geo, const CaloTopology* caloTopology, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, int ieta, int iphi, const std::string& theTrackQuality, bool debug=false);

double chargeIsolationHcal(const edm::Event& iEvent, const edm::EventSetup& iSetup, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const DetId ClosestCell, const HcalTopology* topology, const CaloSubdetectorGeometry* gHB, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, int ieta, int iphi, std::string& theTrackQuality, bool debug=false);
double chargeIsolationHcal(const edm::Event& iEvent, const edm::EventSetup& iSetup, reco::TrackCollection::const_iterator trkItr, edm::Handle<reco::TrackCollection> trkCollection, const DetId ClosestCell, const HcalTopology* topology, const CaloSubdetectorGeometry* gHB, TrackDetectorAssociator& associator, TrackAssociatorParameters& parameters_, int ieta, int iphi, const std::string& theTrackQuality, bool debug=false);

}

Expand Down
2 changes: 0 additions & 2 deletions Calibration/IsolatedParticles/plugins/HcalRaddamMuon.cc
Expand Up @@ -117,12 +117,10 @@ class HcalRaddamMuon : public edm::one::EDAnalyzer<edm::one::WatchRuns,edm::one:
std::vector<int> v_RH_h3x3_iphi;
std::vector<double> v_RH_h3x3_ene, PxGlob, PyGlob,PzGlob,Pthetha;
std::vector<double> PCharge,PChi2,PD0, PD0Error,dxyWithBS,dzWithBS,PdxyTrack, PdzTrack,PNormalizedChi2, PNDoF, PValidHits, PLostHits, NPvx, NPvy, NPvz, NQOverP, NQOverPError, NTrkMomentum, NRefPointX, NRefPointY, NRefPointZ;
std::vector<bool> NTrkQuality;
double h3x3, h3x3Calo;
unsigned int RunNumber, EventNumber , LumiNumber, BXNumber;
double _RecoMuon1TrackIsoSumPtMaxCutValue_03, _RecoMuon1TrackIsoSumPtMaxCutValue_04;
int ntriggers;
std::string theTrackQuality;
std::vector <double> track_cosmic_xposition , track_cosmic_yposition, track_cosmic_zposition, track_cosmic_xmomentum,track_cosmic_ymomentum, track_cosmic_zmomentum, track_cosmic_rad, track_cosmic_detid;

edm::EDGetTokenT<edm::PCaloHitContainer> tok_hcal_;
Expand Down
87 changes: 40 additions & 47 deletions Calibration/IsolatedParticles/plugins/IsoTrackCalib.cc
Expand Up @@ -99,29 +99,26 @@ class IsoTrackCalib : public edm::one::EDAnalyzer<edm::one::WatchRuns,edm::one::
double dR(math::XYZTLorentzVector&, math::XYZTLorentzVector&);
double deltaR(double eta1,double eta2,double phi1,double phi2);

edm::Service<TFileService> fs_;
HLTConfigProvider hltConfig_;
L1GtUtils m_l1GtUtils;
std::vector<std::string> l1Names_;
int verbosity_;
spr::trackSelectionParameters selectionParameters_;
std::string theTrackQuality_;
double a_mipR_, a_coneR_, a_charIsoR_;
const L1GtTriggerMenu *m_l1GtMenu;
std::vector<bool> *t_l1bits;
edm::InputTag triggerEvent_, theTriggerResultsLabel_;
edm::EDGetTokenT<trigger::TriggerEvent> tok_trigEvt;
edm::EDGetTokenT<edm::TriggerResults> tok_trigRes;

edm::EDGetTokenT<reco::TrackCollection> tok_genTrack_;
edm::EDGetTokenT<reco::VertexCollection> tok_recVtx_;
edm::EDGetTokenT<reco::BeamSpot> tok_bs_;
edm::EDGetTokenT<EcalRecHitCollection> tok_EB_;
edm::EDGetTokenT<EcalRecHitCollection> tok_EE_;
edm::EDGetTokenT<HBHERecHitCollection> tok_hbhe_;
edm::EDGetTokenT<GenEventInfoProduct> tok_ew_;
edm::EDGetTokenT<reco::GenJetCollection> tok_jets_;
edm::EDGetTokenT<reco::PFJetCollection> tok_pfjets_;
edm::Service<TFileService> fs_;
HLTConfigProvider hltConfig_;
L1GtUtils m_l1GtUtils;
const L1GtTriggerMenu *m_l1GtMenu;
const int verbosity_;
const std::vector<std::string> l1Names_;
spr::trackSelectionParameters selectionParameters_;
const std::string theTrackQuality_;
const double a_coneR_, a_charIsoR_, a_mipR_;
std::vector<bool> *t_l1bits;

const edm::EDGetTokenT<reco::TrackCollection> tok_genTrack_;
const edm::EDGetTokenT<reco::VertexCollection> tok_recVtx_;
const edm::EDGetTokenT<reco::BeamSpot> tok_bs_;
edm::EDGetTokenT<EcalRecHitCollection> tok_EB_;
edm::EDGetTokenT<EcalRecHitCollection> tok_EE_;
edm::EDGetTokenT<HBHERecHitCollection> tok_hbhe_;
const edm::EDGetTokenT<GenEventInfoProduct> tok_ew_;
const edm::EDGetTokenT<reco::GenJetCollection> tok_jets_;
const edm::EDGetTokenT<reco::PFJetCollection> tok_pfjets_;
edm::EDGetTokenT<l1extra::L1JetParticleCollection> tok_L1extTauJet_;
edm::EDGetTokenT<l1extra::L1JetParticleCollection> tok_L1extCenJet_;
edm::EDGetTokenT<l1extra::L1JetParticleCollection> tok_L1extFwdJet_;
Expand All @@ -147,14 +144,23 @@ class IsoTrackCalib : public edm::one::EDAnalyzer<edm::one::WatchRuns,edm::one::

static const bool useL1GtTriggerMenuLite(true);
IsoTrackCalib::IsoTrackCalib(const edm::ParameterSet& iConfig) :
m_l1GtUtils(iConfig, consumesCollector(), useL1GtTriggerMenuLite, *this){

usesResource("TFileService");

//now do whatever initialization is needed
verbosity_ = iConfig.getUntrackedParameter<int>("Verbosity",0);
l1Names_ = iConfig.getUntrackedParameter<std::vector<std::string> >("L1Seed");
theTrackQuality_ = iConfig.getUntrackedParameter<std::string>("TrackQuality","highPurity");
m_l1GtUtils(iConfig, consumesCollector(), useL1GtTriggerMenuLite, *this),
verbosity_(iConfig.getUntrackedParameter<int>("Verbosity",0)),
l1Names_(iConfig.getUntrackedParameter<std::vector<std::string> >("L1Seed")),
theTrackQuality_(iConfig.getUntrackedParameter<std::string>("TrackQuality","highPurity")),
a_coneR_(iConfig.getUntrackedParameter<double>("ConeRadius",34.98)),
a_charIsoR_(a_coneR_+28.9),
a_mipR_(iConfig.getUntrackedParameter<double>("ConeRadiusMIP",14.0)),
tok_genTrack_(consumes<reco::TrackCollection>(edm::InputTag("generalTracks"))),
tok_recVtx_(consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"))),
tok_bs_(consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"))),
tok_ew_(consumes<GenEventInfoProduct>(edm::InputTag("generatorSmeared"))),
tok_jets_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("JetSource"))),
tok_pfjets_(consumes<reco::PFJetCollection>(edm::InputTag("ak5PFJets"))) {

usesResource(TFileService::kSharedResource);

//now do whatever initialization is needed
reco::TrackBase::TrackQuality trackQuality_=reco::TrackBase::qualityByName(theTrackQuality_);
selectionParameters_.minPt = iConfig.getUntrackedParameter<double>("MinTrackPt", 10.0);
selectionParameters_.minQuality = trackQuality_;
Expand All @@ -166,26 +172,12 @@ IsoTrackCalib::IsoTrackCalib(const edm::ParameterSet& iConfig) :
selectionParameters_.minLayerCrossed= iConfig.getUntrackedParameter<int>("MinLayerCrossed", 8);
selectionParameters_.maxInMiss = iConfig.getUntrackedParameter<int>("MaxInMiss", 0);
selectionParameters_.maxOutMiss = iConfig.getUntrackedParameter<int>("MaxOutMiss", 0);
a_coneR_ = iConfig.getUntrackedParameter<double>("ConeRadius",34.98);
a_charIsoR_ = a_coneR_ + 28.9;
a_mipR_ = iConfig.getUntrackedParameter<double>("ConeRadiusMIP",14.0);
bool isItAOD = iConfig.getUntrackedParameter<bool>("IsItAOD", false);
triggerEvent_ = edm::InputTag("hltTriggerSummaryAOD","","HLT");
theTriggerResultsLabel_ = edm::InputTag("TriggerResults","","HLT");
edm::InputTag L1extraTauJetSource_ = iConfig.getParameter<edm::InputTag> ("L1extraTauJetSource" );
edm::InputTag L1extraCenJetSource_ = iConfig.getParameter<edm::InputTag> ("L1extraCenJetSource" );
edm::InputTag L1extraFwdJetSource_ = iConfig.getParameter<edm::InputTag> ("L1extraFwdJetSource" );

// define tokens for access
tok_trigEvt = consumes<trigger::TriggerEvent>(triggerEvent_);
tok_trigRes = consumes<edm::TriggerResults>(theTriggerResultsLabel_);
tok_genTrack_ = consumes<reco::TrackCollection>(edm::InputTag("generalTracks"));
tok_recVtx_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
tok_bs_ = consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"));
tok_ew_ = consumes<GenEventInfoProduct>(edm::InputTag("generatorSmeared"));
tok_L1extTauJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraTauJetSource_);
tok_L1extCenJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraCenJetSource_);
tok_L1extFwdJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraFwdJetSource_);
if (isItAOD) {
tok_EB_ = consumes<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEB"));
tok_EE_ = consumes<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEE"));
Expand All @@ -195,8 +187,9 @@ IsoTrackCalib::IsoTrackCalib(const edm::ParameterSet& iConfig) :
tok_EE_ = consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit","EcalRecHitsEE"));
tok_hbhe_ = consumes<HBHERecHitCollection>(edm::InputTag("hbhereco"));
}
tok_jets_ = consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("JetSource"));
tok_pfjets_ = consumes<reco::PFJetCollection>(edm::InputTag("ak5PFJets"));
tok_L1extTauJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraTauJetSource_);
tok_L1extCenJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraCenJetSource_);
tok_L1extFwdJet_ = consumes<l1extra::L1JetParticleCollection>(L1extraFwdJetSource_);
if (verbosity_>=0) {
edm::LogInfo("IsoTrack")
<<"Parameters read from config file \n"
Expand Down
2 changes: 1 addition & 1 deletion Calibration/IsolatedParticles/plugins/StudyHLT.cc
Expand Up @@ -110,7 +110,7 @@ class StudyHLT : public edm::one::EDAnalyzer<edm::one::WatchRuns,edm::one::Share
edm::Service<TFileService> fs_;
const int verbosity_;
const std::vector<std::string> trigNames_, newNames_;
std::string theTrackQuality_;
const std::string theTrackQuality_;
const double minTrackP_, maxTrackEta_;
const double tMinE_, tMaxE_, tMinH_, tMaxH_;
const bool isItAOD_, doTree_;
Expand Down

0 comments on commit 61e0fe5

Please sign in to comment.