34 #include "Math/GenVector/VectorUtil.h"
35 #include "Math/GenVector/PxPyPzE4D.h"
44 #include <boost/regex.hpp>
46 double getDistInCM(
double eta1,
double phi1,
double eta2,
double phi2)
49 double theta1=2*atan(
exp(-eta1));
50 double theta2=2*atan(
exp(-eta2));
51 if (fabs(eta1)<1.479) Rec=129;
52 else Rec=
tan(theta1)*317;
58 dR=fabs((Rec/
sin(theta1))*
tan(angle));
64 double getDist(
double eta1,
double phi1,
double eta2,
double phi2)
66 double dphi = fabs(phi1 - phi2);
67 if(dphi>acos(-1)) dphi = 2*acos(-1)-dphi;
85 for (
unsigned l=0;
l<hltFilterTag_.size();
l++)
87 if ((trEv->filterTag(iFilt).label()).substr(0,27)==hltFilterTag_[
l])
89 KEYS=trEv->filterKeys(iFilt);
98 if (dHit<minDDD) minDDD=dHit;
100 if (minDDD>hltMatchingCone_) match=
false;
116 if ((trEv->filterTag(iFilt).label()).substr(0,14)==l1FilterTag_) KEYS=trEv->filterKeys(iFilt);
119 double etaTrig=-10000;
120 double phiTrig=-10000;
132 return std::pair<double,double>(etaTrig,phiTrig);
145 for (
unsigned i=0;
i != nLabels;
i++ )
194 produces<reco::IsolatedPixelTrackCandidateCollection>(
"HcalIsolatedTrackCollection");
196 produces<reco::TrackCollection>(
"IsoTrackTracksCollection");
197 produces<reco::TrackExtraCollection>(
"IsoTrackExtraTracksCollection");
199 produces<EcalRecHitCollection>(
"IsoTrackEcalRecHitCollection");
200 produces<EcalRecHitCollection>(
"IsoTrackPSEcalRecHitCollection");
202 produces<HBHERecHitCollection>(
"IsoTrackHBHERecHitCollection");
203 produces<HORecHitCollection>(
"IsoTrackHORecHitCollection");
234 std::vector<edm::EDGetTokenT<EcalRecHitCollection> >::const_iterator
i;
241 tmpEcalRecHitCollection->push_back(*recHit);
268 std::vector<HcalDetId> usedHitsHC;
269 std::vector<int> usedHitsEC;
273 for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++) {
274 bool noChargedTracks =
true;
277 double px = track->px();
278 double py = track->py();
279 double pz = track->pz();
280 double ptrack =
sqrt(px*px+py*py+pz*pz);
282 if (ptrack < m_pCut || track->
pt() <
m_ptCut )
continue;
284 if (track->hitPattern().numberOfValidHits() <
nHitsMinCore_)
continue;
300 if (etaecal==0&&phiecal==0)
continue;
306 if (fabs(track->eta())>
etaMax_)
continue;
309 double maxPNearby=-10;
311 for (reco::TrackCollection::const_iterator track1=tC.begin(); track1!=tC.end(); track1++)
314 if (track == track1)
continue;
315 if (track->hitPattern().numberOfValidHits() <
nHitsMinIso_)
continue;
316 double ptrack1 =
sqrt(track1->px()*track1->px()+track1->py()*track1->py()+track1->pz()*track1->pz());
320 GlobalPoint gPointHcal1(info1.trkGlobPosAtHcal.x(),info1.trkGlobPosAtHcal.y(),info1.trkGlobPosAtHcal.z());
322 double etaecal1=info1.trkGlobPosAtEcal.
eta();
323 double phiecal1=info1.trkGlobPosAtEcal.phi();
325 if (etaecal1==0&&phiecal1==0)
continue;
337 if(ptrack<10.)factor+=(10.-ptrack)/20.;
338 if(ptrack1<10.)factor1+=(10.-ptrack1)/20.;
344 if (track1->p()>maxPNearby)
346 maxPNearby=track1->p();
348 sumPNearby+=track1->p();
353 noChargedTracks =
false;
361 bool noNeutrals =
false;
374 int etaIDcenter=-10000;
375 int phiIDcenter=-10000;
377 for (
unsigned int i=0; i<crossedECids.size(); i++)
379 if ((*crossedECids[i]).id().subdetId()==
EcalEndcap)
381 EEDetId did(crossedECids[i]->
id());
382 if (crossedECids[i]->
energy()>enMax)
384 enMax=crossedECids[
i]->energy();
385 etaIDcenter=did.
iy();
386 phiIDcenter=did.
ix();
389 if ((*crossedECids[i]).
id().subdetId()==
EcalBarrel)
391 EBDetId did(crossedECids[i]->
id());
392 if (crossedECids[i]->
energy()>enMax)
394 enMax=crossedECids[
i]->energy();
395 etaIDcenter=did.
ieta();
396 phiIDcenter=did.
iphi();
400 for (std::vector<EcalRecHit>::const_iterator ehit=tmpEcalRecHitCollection->begin(); ehit!=tmpEcalRecHitCollection->end(); ehit++)
405 double phihit = posH.
phi();
406 double etahit = posH.
eta();
408 double dHit=
deltaR(etaecal,phiecal,etahit,phihit);
414 ecClustR+=ehit->energy();
419 ecOutRingR+=ehit->energy();
424 bool hitIsUsed=
false;
425 int hitHashedIndex=-10000;
430 if (fabs(did.ieta()-etaIDcenter)<=
matrixSize_/2&&fabs(did.iphi()-phiIDcenter)<=
matrixSize_/2) ecClustN+=ehit->energy();
437 if (fabs(did.iy()-etaIDcenter)<=
matrixSize_/2&&fabs(did.ix()-phiIDcenter)<=
matrixSize_/2) ecClustN+=ehit->energy();
439 for (uint32_t i=0; i<usedHitsEC.size(); i++)
441 if (usedHitsEC[i]==hitHashedIndex) hitIsUsed=
true;
444 if (hitIsUsed)
continue;
445 usedHitsEC.push_back(hitHashedIndex);
450 outputEColl->push_back(*ehit);
455 if (ecOutRingR<
m_ecalCut) noNeutrals=
true;
456 else noNeutrals=
false;
466 outputTColl->push_back(*track);
470 outputExTColl->push_back(*myextra);
482 outputHcalIsoTrackColl->push_back(newHITCandidate);
485 for (std::vector<HBHERecHit>::const_iterator hhit=hbheRHcol->begin(); hhit!=hbheRHcol->end(); hhit++)
488 bool hitIsUsed=
false;
489 for (uint32_t i=0; i<usedHitsHC.size(); i++)
491 if (usedHitsHC[i]==hhit->id()) hitIsUsed=
true;
493 if (hitIsUsed)
continue;
494 usedHitsHC.push_back(hhit->id());
498 double phihit = posH.
phi();
499 double etahit = posH.
eta();
501 double dHit=
deltaR(etaecal,phiecal,etahit,phihit);
506 outputHColl->push_back(*hhit);
517 if(outputTColl->size() > 0)
536 EcalPreshowerTopology psTopology(geoHandle);
545 for(IT i=psrechits.
begin(); i!=psrechits.
end(); i++)
547 outputESColl->push_back( *i );
551 iEvent.
put( outputHcalIsoTrackColl,
"HcalIsolatedTrackCollection");
552 iEvent.
put( outputTColl,
"IsoTrackTracksCollection");
553 iEvent.
put( outputExTColl,
"IsoTrackExtraTracksCollection");
554 iEvent.
put( outputEColl,
"IsoTrackEcalRecHitCollection");
555 iEvent.
put( outputESColl,
"IsoTrackPSEcalRecHitCollection");
556 iEvent.
put( outputHColl,
"IsoTrackHBHERecHitCollection");
557 iEvent.
put( outputHOColl,
"IsoTrackHORecHitCollection");
T getParameter(std::string const &) const
std::vector< std::string > hltFiltTag_
T getUntrackedParameter(std::string const &, T const &) const
int hashedIndex() const
get a compact index for arrays
bool checkHLTMatch(edm::Event &iEvent, edm::EDGetTokenT< trigger::TriggerEvent > &hltToken, std::vector< std::string > hltFilterTag_, double eta, double phi, double hltMatchingCone_)
AlCaIsoTracksProducer(const edm::ParameterSet &)
double getDist(double eta1, double phi1, double eta2, double phi2)
void SetSumPtPxl(double sumptpxl)
TrackDetectorAssociator trackAssociator_
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
double getDistInPlaneTrackDir(const GlobalPoint caloPoint, const GlobalVector caloVector, const GlobalPoint rechitPoint)
Sin< T >::type sin(const T &t)
edm::EDGetTokenT< reco::TrackCollection > tok_track_
void useDefaultPropagator()
use the default propagator
Geom::Phi< T > phi() const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< EcalRecHit >::const_iterator const_iterator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
void push_back(T const &t)
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
void SetEnergyOut(double a)
std::vector< const EcalRecHit * > crossedEcalRecHits
hits in detector elements crossed by a track
void SetEnergyIn(double a)
math::XYZPoint trkGlobPosAtHcal
int iphi() const
get the crystal iphi
Single trigger physics object (e.g., an isolated muon)
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
Tan< T >::type tan(const T &t)
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
std::pair< double, double > getL1triggerDirection(edm::Event &iEvent, edm::EDGetTokenT< trigger::TriggerEvent > &hltToken, std::string l1FilterTag_)
int ieta() const
get the crystal ieta
std::vector< LinkConnSpec >::const_iterator IT
RefProd< PROD > getRefBeforePut()
void SetMaxPtPxl(double mptpxl)
const_iterator end() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
std::vector< edm::InputTag > ecalLabels_
T const * product() const
std::vector< size_type > Keys
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
T const * product() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
GlobalVector trkMomAtHcal
TrackAssociatorParameters parameters_
edm::EDGetTokenT< trigger::TriggerEvent > tok_hlt_
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::EDGetTokenT< EcalRecHitCollection > tok_ps_
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::EDGetTokenT< HORecHitCollection > tok_ho_
Power< A, B >::type pow(const A &a, const B &b)
const_iterator begin() const
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)