13 #include <boost/regex.hpp> 92 return std::make_unique<alCaIsoTracksProducer::Counters>();
104 const std::vector<std::string>& triggerNames_,
157 theTrackQuality_(iConfig.getParameter<
std::
string>(
"trackQuality")),
158 processName_(iConfig.getParameter<
std::
string>(
"processName")),
159 a_coneR_(iConfig.getParameter<double>(
"coneRadius")),
160 a_mipR_(iConfig.getParameter<double>(
"coneRadiusMIP")),
161 maxRestrictionP_(iConfig.getParameter<double>(
"maxTrackP")),
162 slopeRestrictionP_(iConfig.getParameter<double>(
"slopeTrackP")),
163 pTrackMin_(iConfig.getParameter<double>(
"minimumTrackP")),
164 eEcalMax_(iConfig.getParameter<double>(
"maximumEcalEnergy")),
165 eIsolate_(iConfig.getParameter<double>(
"isolationEnergy")),
166 pTrackLow_(iConfig.getParameter<double>(
"momentumRangeLow")),
167 pTrackHigh_(iConfig.getParameter<double>(
"momentumRangeHigh")),
168 preScale_(iConfig.getParameter<
int>(
"preScaleFactor")),
169 labelGenTrack_(iConfig.getParameter<
edm::
InputTag>(
"TrackLabel")),
170 labelRecVtx_(iConfig.getParameter<
edm::
InputTag>(
"VertexLabel")),
171 labelBS_(iConfig.getParameter<
edm::
InputTag>(
"BeamSpotLabel")),
172 labelEB_(iConfig.getParameter<
edm::
InputTag>(
"EBRecHitLabel")),
173 labelEE_(iConfig.getParameter<
edm::
InputTag>(
"EERecHitLabel")),
174 labelHBHE_(iConfig.getParameter<
edm::
InputTag>(
"HBHERecHitLabel")),
175 labelHltGT_(iConfig.getParameter<
edm::
InputTag>(
"L1GTSeedLabel")),
176 labelTriggerEvent_(iConfig.getParameter<
edm::
InputTag>(
"TriggerEventLabel")),
177 labelTriggerResults_(iConfig.getParameter<
edm::
InputTag>(
"TriggerResultLabel")),
178 labelIsoTk_(iConfig.getParameter<
std::
string>(
"IsoTrackLabel")) {
185 const double isolationRadius(28.9);
210 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
211 tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>();
234 produces<reco::HcalIsolatedTrackCandidateCollection>(
labelIsoTk_);
240 edm::LogVerbatim(
"HcalIsoTrack") <<
" Expected to produce the collections:\n" 241 <<
"reco::HcalIsolatedTrackCandidateCollection " 242 <<
" with label HcalIsolatedTrackCollection\n" 244 <<
"EcalRecHitCollection with label EcalRecHitsEB\n" 245 <<
"EcalRecHitCollection with label EcalRecHitsEE\n" 262 std::vector<std::string>
triggers = {
"HLT_IsoTrackHB",
"HLT_IsoTrackHE"};
263 desc.add<std::vector<std::string> >(
"triggers",
triggers);
267 desc.add<
double>(
"minTrackPt", 1.0);
268 desc.add<
double>(
"maxDxyPV", 10.0);
269 desc.add<
double>(
"maxDzPV", 100.0);
270 desc.add<
double>(
"maxChi2", 5.0);
271 desc.add<
double>(
"maxDpOverP", 0.1);
272 desc.add<
int>(
"minOuterHit", 4);
273 desc.add<
int>(
"minLayerCrossed", 8);
274 desc.add<
int>(
"maxInMiss", 2);
275 desc.add<
int>(
"maxOutMiss", 2);
277 desc.add<
double>(
"coneRadius", 34.98);
278 desc.add<
double>(
"minimumTrackP", 20.0);
280 desc.add<
double>(
"coneRadiusMIP", 14.0);
281 desc.add<
double>(
"maximumEcalEnergy", 10.0);
283 desc.add<
double>(
"maxTrackP", 8.0);
284 desc.add<
double>(
"slopeTrackP", 0.05090504066);
285 desc.add<
double>(
"isolationEnergy", 10.0);
287 desc.add<
double>(
"momentumRangeLow", 20.0);
288 desc.add<
double>(
"momentumRangeHigh", 40.0);
289 desc.add<
int>(
"preScaleFactor", 10);
290 descriptions.
add(
"alcaisotrk",
desc);
297 <<
iEvent.luminosityBlock() <<
" Bunch " <<
iEvent.bunchCrossing();
303 if (!triggerEventHandle.isValid()) {
314 if (!trkCollection.isValid()) {
320 if (!recVtxs.isValid()) {
328 if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
329 leadPV =
math::XYZPoint((*recVtxs)[0].
x(), (*recVtxs)[0].
y(), (*recVtxs)[0].
z());
330 }
else if (beamSpotH.isValid()) {
331 leadPV = beamSpotH->position();
339 if (!barrelRecHitsHandle.isValid()) {
344 if (!endcapRecHitsHandle.isValid()) {
349 if (!
hbhe.isValid()) {
355 double ptL1(0), etaL1(0), phiL1(0);
358 if (l1trigobj.isValid()) {
359 std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
363 std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
367 std::vector<edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
374 auto outputHcalIsoTrackColl = std::make_unique<reco::HcalIsolatedTrackCandidateCollection>();
375 auto outputVColl = std::make_unique<reco::VertexCollection>();
376 auto outputEBColl = std::make_unique<EBRecHitCollection>();
377 auto outputEEColl = std::make_unique<EERecHitCollection>();
378 auto outputHBHEColl = std::make_unique<HBHERecHitCollection>();
382 edm::LogWarning(
"HcalIsoTrack") <<
"Error! Can't get some of the products";
387 const std::vector<std::string>& triggerNames_ =
triggerNames.triggerNames();
399 edm::LogVerbatim(
"HcalIsoTrack") <<
"AlCaIsoTracksProducer::select returns " << isotk->size()
400 <<
" isolated tracks";
403 if (!isotk->empty()) {
404 int ntrin(0), ntrout(0);
405 for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr = isotk->begin(); itr != isotk->end();
412 bool selectEvent = ntrout > 0;
413 if (!selectEvent && ntrin > 0) {
421 for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr = isotk->begin(); itr != isotk->end();
423 outputHcalIsoTrackColl->push_back(*itr);
425 for (reco::VertexCollection::const_iterator
vtx = recVtxs->begin();
vtx != recVtxs->end(); ++
vtx)
426 outputVColl->push_back(*
vtx);
429 ehit != barrelRecHitsHandle->end();
431 outputEBColl->push_back(*ehit);
434 ehit != endcapRecHitsHandle->end();
436 outputEEColl->push_back(*ehit);
438 for (std::vector<HBHERecHit>::const_iterator hhit =
hbhe->begin(); hhit !=
hbhe->end(); ++hhit)
439 outputHBHEColl->push_back(*hhit);
453 globalCache()->nAll_ +=
nAll_;
454 globalCache()->nGood_ +=
nGood_;
455 globalCache()->nRange_ +=
nRange_;
460 <<
count->nRange_ <<
" events in the momentum raange";
479 const std::vector<std::string>& triggerNames_,
492 for (
unsigned int iHLT = 0; iHLT <
triggerResults->size(); iHLT++) {
499 edm::LogVerbatim(
"HcalIsoTrack") <<
"The trigger we are looking for " << triggerNames_[iHLT] <<
" Flag " <<
hlt 506 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
509 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
511 for (trkDetItr = trkCaloDirections.begin(),
nTracks = 0; trkDetItr != trkCaloDirections.end();
513 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
517 << pTrack->
eta() <<
"|" << pTrack->
phi() <<
"|" << pTrack->
p();
522 edm::LogVerbatim(
"HcalIsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" << trkDetItr->okECAL <<
"|" 523 << trkDetItr->okHCAL;
525 if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) {
526 double t_p = pTrack->
p();
527 int nRH_eMipDR(0), nNearTRKs(0);
531 trkDetItr->pointHCAL,
532 trkDetItr->pointECAL,
534 trkDetItr->directionECAL,
544 << pTrack->
eta() <<
"|" << pTrack->
phi() <<
"|" << t_p <<
" e_MIP " << eMipDR
545 <<
" Chg Isolation " << hmaxNearP <<
":" << eIsolation;
549 newCandidate.
SetMaxP(hmaxNearP);
551 newCandidate.
setL1(ptL1, etaL1, phiL1);
552 newCandidate.
SetEtaPhiEcal((trkDetItr->pointECAL).eta(), (trkDetItr->pointECAL).
phi());
555 (trkDetItr->pointHCAL).eta(), (trkDetItr->pointHCAL).
phi(),
detId.ieta(),
detId.iphi());
557 for (reco::TrackCollection::const_iterator trkItr1 = trkCollection->begin(); trkItr1 != trkCollection->end();
560 if (pTrack1 == pTrack) {
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();
Log< level::Info, true > LogVerbatim
reco::HcalIsolatedTrackCandidateCollection * select(edm::Handle< edm::TriggerResults > const &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)
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)
T getParameter(std::string const &) const
std::atomic< unsigned int > nAll_
const edm::InputTag labelEE_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
The single EDProduct to be saved for each event (AOD case)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void endStream() override
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
double px() const
x coordinate of momentum vector
double p() const
momentum vector magnitude
void beginRun(edm::Run const &, edm::EventSetup const &) override
const edm::InputTag labelHBHE_
std::vector< T >::const_iterator const_iterator
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
void produce(edm::Event &, edm::EventSetup const &) override
double py() const
y coordinate of momentum vector
const edm::InputTag labelHltGT_
const edm::InputTag labelBS_
const edm::InputTag labelTriggerEvent_
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hltGT_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const std::string processName_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const std::string theTrackQuality_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
double pt() const
track transverse momentum
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ CellNeighborsVector< TrackerTraits > const CellTracksVector< TrackerTraits > const OuterHitOfCell< TrackerTraits > const int32_t uint32_t Counters * counters
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
std::atomic< unsigned int > nGood_
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
void setPtEtaPhi(std::vector< edm::Ref< l1extra::L1JetParticleCollection > > &objref, double &ptL1, double &etaL1, double &phiL1)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
~AlCaIsoTracksProducer() override=default
void SetEnergyEcal(double a)
void SetEtaPhiHcal(double eta, double phi, int ieta, int iphi)
eta, phi at HCAL surface
double phi() const
azimuthal angle of momentum vector
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
#define DEFINE_FWK_MODULE(type)
const double maxRestrictionP_
std::atomic< unsigned int > nRange_
static std::string const triggerResults
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
void endRun(edm::Run const &, edm::EventSetup const &) override
HLTConfigProvider hltConfig_
double eta() const
pseudorapidity of momentum vector
static std::unique_ptr< alCaIsoTracksProducer::Counters > initializeGlobalCache(edm::ParameterSet const &)
static TrackQuality qualityByName(const std::string &name)
const double slopeRestrictionP_
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
double pz() const
z coordinate of momentum vector
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void globalEndJob(const alCaIsoTracksProducer::Counters *counters)
const std::vector< std::string > trigNames_
spr::trackSelectionParameters selectionParameter_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
reco::TrackBase::TrackQuality minQuality
const edm::InputTag labelRecVtx_
void setTrack(const reco::TrackRef &tr)
AlCaIsoTracksProducer(edm::ParameterSet const &, const alCaIsoTracksProducer::Counters *count)
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
const edm::InputTag labelTriggerResults_
const edm::InputTag labelEB_
const edm::InputTag labelGenTrack_