14 #include <boost/regex.hpp> 94 return std::make_unique<AlCaIsoTracks::Counters>();
98 virtual void endStream()
override;
141 const double isolationRadius(28.9);
193 edm::LogInfo(
"HcalIsoTrack") <<
"Parameters read from config file \n" 195 <<
"\t theTrackQuality " << theTrackQuality_
205 <<
"\t a_coneR " << a_coneR_
206 <<
"\t a_charIsoR " << a_charIsoR_
208 <<
"\t pTrackMin " << pTrackMin_
209 <<
"\t eEcalMax " << eEcalMax_
210 <<
"\t maxRestrictionP_ "<< maxRestrictionP_
211 <<
"\t slopeRestrictionP_ " << slopeRestrictionP_
212 <<
"\t eIsolate_ " << eIsolate_
213 <<
"\t Process " << processName_ <<
"\n" 214 <<
"\t Precale factor " << preScale_
215 <<
"\t in momentum range " << pTrackLow_
221 produces<reco::HcalIsolatedTrackCandidateCollection>(
labelIsoTk_);
222 produces<reco::VertexCollection>(labelRecVtx_.
label());
223 produces<EcalRecHitCollection>(labelEB_.
instance());
224 produces<EcalRecHitCollection>(labelEE_.
instance());
225 produces<HBHERecHitCollection>(labelHBHE_.
label());
227 edm::LogInfo(
"HcalIsoTrack") <<
" Expected to produce the collections:\n" 228 <<
"reco::HcalIsolatedTrackCandidateCollection " 229 <<
" with label HcalIsolatedTrackCollection\n" 230 <<
"reco::VertexCollection with label " << labelRecVtx_.
label() <<
"\n" 231 <<
"EcalRecHitCollection with label EcalRecHitsEB\n" 232 <<
"EcalRecHitCollection with label EcalRecHitsEE\n" 233 <<
"HBHERecHitCollection with label " << labelHBHE_.
label();
245 << iEvent.
id().
event() <<
" Luminosity " 254 if (!triggerEventHandle.
isValid()) {
260 if (!triggerResults.
isValid()) {
267 if (!trkCollection.
isValid()) {
271 reco::TrackCollection::const_iterator trkItr;
284 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
287 }
else if (beamSpotH.
isValid()) {
292 edm::LogInfo(
"HcalIsoTrack") <<
"Primary Vertex " << leadPV;
297 if (!barrelRecHitsHandle.
isValid()) {
303 if (!endcapRecHitsHandle.
isValid()) {
315 double ptL1(0), etaL1(0), phiL1(0);
320 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
324 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
328 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
335 auto outputHcalIsoTrackColl = std::make_unique<reco::HcalIsolatedTrackCandidateCollection>();
336 auto outputVColl = std::make_unique<reco::VertexCollection>();
337 auto outputEBColl = std::make_unique<EBRecHitCollection>();
338 auto outputEEColl = std::make_unique<EERecHitCollection>();
339 auto outputHBHEColl = std::make_unique<HBHERecHitCollection>();
343 edm::LogWarning(
"HcalIsoTrack") <<
"Error! Can't get some of the products";
346 if (triggerResults.
isValid()) {
348 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
351 edm::LogInfo(
"HcalIsoTrack") <<
"AlCaIsoTracksProducer::select returns " 352 << isotk->size() <<
" isolated tracks";
355 if (isotk->size() > 0) {
356 int ntrin(0), ntrout(0);
357 for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr=isotk->begin(); itr!=isotk->end(); ++itr) {
361 bool selectEvent = ntrout > 0;
362 if (!selectEvent && ntrin > 0) {
368 for (reco::HcalIsolatedTrackCandidateCollection::const_iterator itr=isotk->begin(); itr!=isotk->end(); ++itr)
369 outputHcalIsoTrackColl->push_back(*itr);
371 for (reco::VertexCollection::const_iterator
vtx=recVtxs->begin();
vtx!=recVtxs->end(); ++
vtx)
372 outputVColl->push_back(*
vtx);
375 outputEBColl->push_back(*ehit);
378 outputEEColl->push_back(*ehit);
380 for (std::vector<HBHERecHit>::const_iterator hhit=hbhe->
begin(); hhit!=hbhe->
end(); ++hhit)
381 outputHBHEColl->push_back(*hhit);
395 globalCache()->nAll_ +=
nAll_;
396 globalCache()->nGood_ +=
nGood_;
397 globalCache()->nRange_ +=
nRange_;
403 <<
" events in the momentum raange";
426 const std::vector<std::string> & triggerNames_,
431 double ptL1,
double etaL1,
double phiL1) {
437 for (
unsigned int iHLT=0; iHLT<triggerResults->
size(); iHLT++) {
440 if (triggerNames_[iHLT].
find(
trigNames_[
i].c_str())!=std::string::npos) {
444 edm::LogInfo(
"HcalIsoTrack") <<
"The trigger we are looking for " 445 << triggerNames_[iHLT] <<
" Flag " 452 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
454 trkCaloDirections,
false);
456 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
457 unsigned int nTracks(0), nselTracks(0);
458 for (trkDetItr = trkCaloDirections.begin(),
nTracks=0;
459 trkDetItr != trkCaloDirections.end(); trkDetItr++,
nTracks++) {
460 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
462 pTrack->
pz(), pTrack->
p());
465 <<
" (pt|eta|phi|p) :" << pTrack->
pt()
466 <<
"|" << pTrack->
eta() <<
"|" 467 << pTrack->
phi() <<
"|" << pTrack->
p();
472 edm::LogInfo(
"HcalIsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag
473 <<
"|" << trkDetItr->okECAL <<
"|" 474 << trkDetItr->okHCAL;
476 if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) {
477 double t_p = pTrack->
p();
479 int nRH_eMipDR(0), nNearTRKs(0);
482 trkDetItr->pointHCAL,
484 trkDetItr->directionECAL,
496 <<
" (pt|eta|phi|p) :" << pTrack->
pt()
497 <<
"|" << pTrack->
eta() <<
"|" 498 << pTrack->
phi() <<
"|" << t_p
499 <<
" e_MIP " << eMipDR
500 <<
" Chg Isolation " << hmaxNearP
501 <<
":" << eIsolation;
505 newCandidate.
SetMaxP(hmaxNearP);
507 newCandidate.
setL1(ptL1,etaL1,phiL1);
509 (trkDetItr->pointECAL).
phi());
512 (trkDetItr->pointHCAL).
phi(),
515 reco::TrackCollection::const_iterator trkItr1;
516 for (trkItr1=trkCollection->begin(); trkItr1 != trkCollection->end(); ++trkItr1,++indx) {
518 if (pTrack1 == pTrack) {
524 trackCollection->push_back(newCandidate);
533 for (
unsigned int p=0;
p<objref.size();
p++) {
534 if (objref[
p]->
pt()>ptL1) {
535 ptL1 = objref[
p]->pt();
536 phiL1 = objref[
p]->phi();
537 etaL1 = objref[
p]->eta();
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
EventNumber_t event() const
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:
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
The single EDProduct to be saved for each event (AOD case)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
AlCaIsoTracksProducer(edm::ParameterSet const &, const AlCaIsoTracks::Counters *count)
virtual void endStream() override
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
bool accept() const
Has at least one path accepted the event?
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
virtual void produce(edm::Event &, edm::EventSetup const &) override
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
static void globalEndJob(const AlCaIsoTracks::Counters *counters)
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
std::string theTrackQuality_
double px() const
x coordinate of momentum vector
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hltGT_
double slopeRestrictionP_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Strings const & triggerNames() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
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)
edm::InputTag labelHltGT_
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
static std::string const triggerResults
edm::InputTag labelTriggerEvent_
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
virtual 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_
edm::InputTag labelTriggerResults_
static TrackQuality qualityByName(const std::string &name)
static std::unique_ptr< AlCaIsoTracks::Counters > initializeGlobalCache(edm::ParameterSet const &)
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
std::atomic< unsigned int > nAll_
spr::trackSelectionParameters selectionParameter_
std::vector< std::string > trigNames_
reco::TrackBase::TrackQuality minQuality
edm::InputTag labelRecVtx_
void setTrack(const reco::TrackRef &tr)
const Point & position() const
position
edm::InputTag labelGenTrack_
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_
T const * product() const
std::atomic< unsigned int > nRange_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
const_iterator begin() const
double py() const
y coordinate of momentum vector