14 #include <boost/regex.hpp> 94 return std::make_unique<AlCaIsoTracks::Counters>();
98 void endStream()
override;
142 trigNames_(iConfig.getParameter<
std::vector<
std::
string> >(
"triggers")),
143 theTrackQuality_(iConfig.getParameter<
std::
string>(
"trackQuality")),
144 processName_(iConfig.getParameter<
std::
string>(
"processName")),
145 a_coneR_(iConfig.getParameter<double>(
"coneRadius")),
146 a_mipR_(iConfig.getParameter<double>(
"coneRadiusMIP")),
147 maxRestrictionP_(iConfig.getParameter<double>(
"maxTrackP")),
148 slopeRestrictionP_(iConfig.getParameter<double>(
"slopeTrackP")),
149 pTrackMin_(iConfig.getParameter<double>(
"minimumTrackP")),
150 eEcalMax_(iConfig.getParameter<double>(
"maximumEcalEnergy")),
151 eIsolate_(iConfig.getParameter<double>(
"isolationEnergy")),
152 pTrackLow_(iConfig.getParameter<double>(
"momentumRangeLow")),
153 pTrackHigh_(iConfig.getParameter<double>(
"momentumRangeHigh")),
154 preScale_(iConfig.getParameter<
int>(
"preScaleFactor")),
155 labelGenTrack_(iConfig.getParameter<
edm::InputTag>(
"TrackLabel")),
156 labelRecVtx_(iConfig.getParameter<
edm::InputTag>(
"VertexLabel")),
157 labelBS_(iConfig.getParameter<
edm::InputTag>(
"BeamSpotLabel")),
158 labelEB_(iConfig.getParameter<
edm::InputTag>(
"EBRecHitLabel")),
159 labelEE_(iConfig.getParameter<
edm::InputTag>(
"EERecHitLabel")),
160 labelHBHE_(iConfig.getParameter<
edm::InputTag>(
"HBHERecHitLabel")),
161 labelHltGT_(iConfig.getParameter<
edm::InputTag>(
"L1GTSeedLabel")),
162 labelTriggerEvent_(iConfig.getParameter<
edm::InputTag>(
"TriggerEventLabel")),
163 labelTriggerResults_(iConfig.getParameter<
edm::InputTag>(
"TriggerResultLabel")),
164 labelIsoTk_(iConfig.getParameter<
std::
string>(
"IsoTrackLabel")) {
171 const double isolationRadius(28.9);
195 edm::LogInfo(
"HcalIsoTrack") <<
"Parameters read from config file \n" 208 <<
"\t a_charIsoR " << a_charIsoR_
223 produces<reco::HcalIsolatedTrackCandidateCollection>(
labelIsoTk_);
229 edm::LogInfo(
"HcalIsoTrack") <<
" Expected to produce the collections:\n" 230 <<
"reco::HcalIsolatedTrackCandidateCollection " 231 <<
" with label HcalIsolatedTrackCollection\n" 233 <<
"EcalRecHitCollection with label EcalRecHitsEB\n" 234 <<
"EcalRecHitCollection with label EcalRecHitsEE\n" 253 desc.
add<
std::string>(
"IsoTrackLabel",
"HcalIsolatedTrackCollection");
254 std::vector<std::string> triggers = {
"HLT_IsoTrackHB",
"HLT_IsoTrackHE"};
255 desc.
add<std::vector<std::string> >(
"triggers", triggers);
259 desc.
add<
double>(
"minTrackPt", 1.0);
260 desc.
add<
double>(
"maxDxyPV", 10.0);
261 desc.
add<
double>(
"maxDzPV", 100.0);
262 desc.
add<
double>(
"maxChi2", 5.0);
263 desc.
add<
double>(
"maxDpOverP", 0.1);
264 desc.
add<
int>(
"minOuterHit", 4);
265 desc.
add<
int>(
"minLayerCrossed", 8);
266 desc.
add<
int>(
"maxInMiss", 2);
267 desc.
add<
int>(
"maxOutMiss", 2);
269 desc.
add<
double>(
"coneRadius", 34.98);
270 desc.
add<
double>(
"minimumTrackP", 20.0);
272 desc.
add<
double>(
"coneRadiusMIP", 14.0);
273 desc.
add<
double>(
"maximumEcalEnergy",2.0);
275 desc.
add<
double>(
"maxTrackP", 8.0);
276 desc.
add<
double>(
"slopeTrackP", 0.05090504066);
277 desc.
add<
double>(
"isolationEnergy", 10.0);
279 desc.
add<
double>(
"momentumRangeLow", 20.0);
280 desc.
add<
double>(
"momentumRangeHigh",40.0);
281 desc.
add<
int>(
"preScaleFactor", 10);
282 descriptions.
add(
"alcaisotrk",desc);
290 << iEvent.
id().
event() <<
" Luminosity " 299 if (!triggerEventHandle.
isValid()) {
305 if (!triggerResults.
isValid()) {
312 if (!trkCollection.
isValid()) {
328 if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
331 }
else if (beamSpotH.
isValid()) {
336 edm::LogInfo(
"HcalIsoTrack") <<
"Primary Vertex " << leadPV;
341 if (!barrelRecHitsHandle.
isValid()) {
347 if (!endcapRecHitsHandle.
isValid()) {
359 double ptL1(0), etaL1(0), phiL1(0);
364 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
368 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
372 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
379 auto outputHcalIsoTrackColl = std::make_unique<reco::HcalIsolatedTrackCandidateCollection>();
380 auto outputVColl = std::make_unique<reco::VertexCollection>();
381 auto outputEBColl = std::make_unique<EBRecHitCollection>();
382 auto outputEEColl = std::make_unique<EERecHitCollection>();
383 auto outputHBHEColl = std::make_unique<HBHERecHitCollection>();
387 edm::LogWarning(
"HcalIsoTrack") <<
"Error! Can't get some of the products";
390 if (triggerResults.
isValid()) {
392 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
395 edm::LogInfo(
"HcalIsoTrack") <<
"AlCaIsoTracksProducer::select returns " 396 << isotk->size() <<
" isolated tracks";
399 if (!isotk->empty()) {
400 int ntrin(0), ntrout(0);
401 for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr=isotk->begin(); itr!=isotk->end(); ++itr) {
405 bool selectEvent = ntrout > 0;
406 if (!selectEvent && ntrin > 0) {
412 for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr=isotk->begin(); itr!=isotk->end(); ++itr)
413 outputHcalIsoTrackColl->push_back(*itr);
415 for (reco::VertexCollection::const_iterator
vtx=recVtxs->begin();
vtx!=recVtxs->end(); ++
vtx)
416 outputVColl->push_back(*
vtx);
419 outputEBColl->push_back(*ehit);
422 outputEEColl->push_back(*ehit);
424 for (std::vector<HBHERecHit>::const_iterator hhit=hbhe->
begin(); hhit!=hbhe->
end(); ++hhit)
425 outputHBHEColl->push_back(*hhit);
439 globalCache()->nAll_ +=
nAll_;
440 globalCache()->nGood_ +=
nGood_;
441 globalCache()->nRange_ +=
nRange_;
447 <<
" events in the momentum raange";
470 const std::vector<std::string> & triggerNames_,
475 double ptL1,
double etaL1,
double phiL1) {
481 for (
unsigned int iHLT=0; iHLT<triggerResults->
size(); iHLT++) {
488 edm::LogInfo(
"HcalIsoTrack") <<
"The trigger we are looking for " 489 << triggerNames_[iHLT] <<
" Flag " 496 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
498 trkCaloDirections,
false);
500 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
501 unsigned int nTracks(0), nselTracks(0);
502 for (trkDetItr = trkCaloDirections.begin(),
nTracks=0;
503 trkDetItr != trkCaloDirections.end(); trkDetItr++,
nTracks++) {
504 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
506 pTrack->
pz(), pTrack->
p());
509 <<
" (pt|eta|phi|p) :" << pTrack->
pt()
510 <<
"|" << pTrack->
eta() <<
"|" 511 << pTrack->
phi() <<
"|" << pTrack->
p();
516 edm::LogInfo(
"HcalIsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag
517 <<
"|" << trkDetItr->okECAL <<
"|" 518 << trkDetItr->okHCAL;
520 if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) {
521 double t_p = pTrack->
p();
523 int nRH_eMipDR(0), nNearTRKs(0);
526 trkDetItr->pointHCAL,
528 trkDetItr->directionECAL,
540 <<
" (pt|eta|phi|p) :" << pTrack->
pt()
541 <<
"|" << pTrack->
eta() <<
"|" 542 << pTrack->
phi() <<
"|" << t_p
543 <<
" e_MIP " << eMipDR
544 <<
" Chg Isolation " << hmaxNearP
545 <<
":" << eIsolation;
549 newCandidate.
SetMaxP(hmaxNearP);
551 newCandidate.
setL1(ptL1,etaL1,phiL1);
553 (trkDetItr->pointECAL).
phi());
556 (trkDetItr->pointHCAL).
phi(),
559 for (reco::TrackCollection::const_iterator trkItr1=trkCollection->begin();
560 trkItr1 != trkCollection->end(); ++trkItr1,++indx) {
562 if (pTrack1 == pTrack) {
568 trackCollection->push_back(newCandidate);
577 for (
unsigned int p=0;
p<objref.size();
p++) {
578 if (objref[
p]->
pt()>ptL1) {
579 ptL1 = objref[
p]->pt();
580 phiL1 = objref[
p]->phi();
581 etaL1 = objref[
p]->eta();
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
EventNumber_t event() const
const std::string labelIsoTk_
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
const unsigned int nTracks(const reco::Vertex &sv)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
const edm::InputTag labelEE_
The single EDProduct to be saved for each event (AOD case)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
AlCaIsoTracksProducer(edm::ParameterSet const &, const AlCaIsoTracks::Counters *count)
void endStream() override
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
void beginRun(edm::Run const &, edm::EventSetup const &) override
bool accept() const
Has at least one path accepted the event?
const edm::InputTag labelHBHE_
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
void produce(edm::Event &, edm::EventSetup const &) override
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
const edm::InputTag labelHltGT_
const edm::InputTag labelBS_
const edm::InputTag labelTriggerEvent_
static void globalEndJob(const AlCaIsoTracks::Counters *counters)
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double px() const
x coordinate of momentum vector
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hltGT_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Strings const & triggerNames() const
const std::string processName_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const std::string theTrackQuality_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
double eta() const
pseudorapidity of momentum vector
std::vector< HcalIsolatedTrackCandidate > HcalIsolatedTrackCandidateCollection
collectin of HcalIsolatedTrackCandidate objects
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
void SetEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
unsigned int size() const
Get number of paths stored.
double pt() const
track transverse momentum
void setPtEtaPhi(std::vector< edm::Ref< l1extra::L1JetParticleCollection > > &objref, double &ptL1, double &etaL1, double &phiL1)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
int ieta() const
get the cell ieta
void SetEnergyEcal(double a)
void SetEtaPhiHcal(double eta, double phi, int ieta, int iphi)
eta, phi at HCAL surface
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
const MagneticField * bField
const double maxRestrictionP_
static std::string const triggerResults
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
double pz() const
z coordinate of momentum vector
int ietaAbs() const
get the absolute value of the cell ieta
std::atomic< unsigned int > nGood_
const_iterator end() const
void endRun(edm::Run const &, edm::EventSetup const &) override
void setPtEtaPhi(const reco::Candidate &p, float &pt, float &eta, float &phi)
int iphi() const
get the cell iphi
HLTConfigProvider hltConfig_
static TrackQuality qualityByName(const std::string &name)
static std::unique_ptr< AlCaIsoTracks::Counters > initializeGlobalCache(edm::ParameterSet const &)
const double slopeRestrictionP_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T const * product() const
void setL1(double pt, double eta, double phi)
XYZPointD XYZPoint
point in space with cartesian internal representation
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::atomic< unsigned int > nAll_
const std::vector< std::string > trigNames_
spr::trackSelectionParameters selectionParameter_
reco::TrackBase::TrackQuality minQuality
const edm::InputTag labelRecVtx_
void setTrack(const reco::TrackRef &tr)
const Point & position() const
position
reco::HcalIsolatedTrackCandidateCollection * select(edm::Handle< edm::TriggerResults > &triggerResults, const std::vector< std::string > &triggerNames_, edm::Handle< reco::TrackCollection > &trkCollection, math::XYZPoint &leadPV, edm::Handle< EcalRecHitCollection > &barrelRecHitsHandle, edm::Handle< EcalRecHitCollection > &endcapRecHitsHandle, edm::Handle< HBHERecHitCollection > &hbhe, double ptL1, double etaL1, double phiL1)
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
~AlCaIsoTracksProducer() override
const edm::InputTag labelTriggerResults_
T const * product() const
std::atomic< unsigned int > nRange_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
const edm::InputTag labelEB_
const_iterator begin() const
double py() const
y coordinate of momentum vector
const edm::InputTag labelGenTrack_