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++ )
193 produces<reco::IsolatedPixelTrackCandidateCollection>(
"HcalIsolatedTrackCollection");
195 produces<reco::TrackCollection>(
"IsoTrackTracksCollection");
196 produces<reco::TrackExtraCollection>(
"IsoTrackExtraTracksCollection");
198 produces<EcalRecHitCollection>(
"IsoTrackEcalRecHitCollection");
199 produces<EcalRecHitCollection>(
"IsoTrackPSEcalRecHitCollection");
201 produces<HBHERecHitCollection>(
"IsoTrackHBHERecHitCollection");
202 produces<HORecHitCollection>(
"IsoTrackHORecHitCollection");
233 std::vector<edm::EDGetTokenT<EcalRecHitCollection> >::const_iterator
i;
240 tmpEcalRecHitCollection->push_back(*recHit);
267 std::vector<HcalDetId> usedHitsHC;
268 std::vector<int> usedHitsEC;
272 for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++) {
273 bool noChargedTracks =
true;
276 double px = track->px();
277 double py = track->py();
278 double pz = track->pz();
279 double ptrack =
sqrt(px*px+py*py+pz*pz);
281 if (ptrack < m_pCut || track->
pt() <
m_ptCut )
continue;
283 if (track->hitPattern().numberOfValidHits() <
nHitsMinCore_)
continue;
299 if (etaecal==0&&phiecal==0)
continue;
305 if (fabs(track->eta())>
etaMax_)
continue;
308 double maxPNearby=-10;
310 for (reco::TrackCollection::const_iterator track1=tC.begin(); track1!=tC.end(); track1++)
313 if (track == track1)
continue;
314 if (track->hitPattern().numberOfValidHits() <
nHitsMinIso_)
continue;
315 double ptrack1 =
sqrt(track1->px()*track1->px()+track1->py()*track1->py()+track1->pz()*track1->pz());
319 GlobalPoint gPointHcal1(info1.trkGlobPosAtHcal.x(),info1.trkGlobPosAtHcal.y(),info1.trkGlobPosAtHcal.z());
321 double etaecal1=info1.trkGlobPosAtEcal.
eta();
322 double phiecal1=info1.trkGlobPosAtEcal.phi();
324 if (etaecal1==0&&phiecal1==0)
continue;
336 if(ptrack<10.)factor+=(10.-ptrack)/20.;
337 if(ptrack1<10.)factor1+=(10.-ptrack1)/20.;
343 if (track1->p()>maxPNearby)
345 maxPNearby=track1->p();
347 sumPNearby+=track1->p();
352 noChargedTracks =
false;
360 bool noNeutrals =
false;
373 int etaIDcenter=-10000;
374 int phiIDcenter=-10000;
376 for (
unsigned int i=0; i<crossedECids.size(); i++)
378 if ((*crossedECids[i]).id().subdetId()==
EcalEndcap)
380 EEDetId did(crossedECids[i]->
id());
381 if (crossedECids[i]->
energy()>enMax)
383 enMax=crossedECids[
i]->energy();
384 etaIDcenter=did.
iy();
385 phiIDcenter=did.
ix();
388 if ((*crossedECids[i]).
id().subdetId()==
EcalBarrel)
390 EBDetId did(crossedECids[i]->
id());
391 if (crossedECids[i]->
energy()>enMax)
393 enMax=crossedECids[
i]->energy();
394 etaIDcenter=did.
ieta();
395 phiIDcenter=did.
iphi();
399 for (std::vector<EcalRecHit>::const_iterator ehit=tmpEcalRecHitCollection->begin(); ehit!=tmpEcalRecHitCollection->end(); ehit++)
404 double phihit = posH.
phi();
405 double etahit = posH.
eta();
407 double dHit=
deltaR(etaecal,phiecal,etahit,phihit);
413 ecClustR+=ehit->energy();
418 ecOutRingR+=ehit->energy();
423 bool hitIsUsed=
false;
424 int hitHashedIndex=-10000;
429 if (fabs(did.ieta()-etaIDcenter)<=
matrixSize_/2&&fabs(did.iphi()-phiIDcenter)<=
matrixSize_/2) ecClustN+=ehit->energy();
436 if (fabs(did.iy()-etaIDcenter)<=
matrixSize_/2&&fabs(did.ix()-phiIDcenter)<=
matrixSize_/2) ecClustN+=ehit->energy();
438 for (uint32_t i=0; i<usedHitsEC.size(); i++)
440 if (usedHitsEC[i]==hitHashedIndex) hitIsUsed=
true;
443 if (hitIsUsed)
continue;
444 usedHitsEC.push_back(hitHashedIndex);
449 outputEColl->push_back(*ehit);
454 if (ecOutRingR<
m_ecalCut) noNeutrals=
true;
455 else noNeutrals=
false;
465 outputTColl->push_back(*track);
469 outputExTColl->push_back(*myextra);
481 outputHcalIsoTrackColl->push_back(newHITCandidate);
484 for (std::vector<HBHERecHit>::const_iterator hhit=hbheRHcol->begin(); hhit!=hbheRHcol->end(); hhit++)
487 bool hitIsUsed=
false;
488 for (uint32_t i=0; i<usedHitsHC.size(); i++)
490 if (usedHitsHC[i]==hhit->id()) hitIsUsed=
true;
492 if (hitIsUsed)
continue;
493 usedHitsHC.push_back(hhit->id());
497 double phihit = posH.
phi();
498 double etahit = posH.
eta();
500 double dHit=
deltaR(etaecal,phiecal,etahit,phihit);
505 outputHColl->push_back(*hhit);
516 if(outputTColl->size() > 0)
535 EcalPreshowerTopology psTopology(geoHandle);
544 for(IT i=psrechits.
begin(); i!=psrechits.
end(); i++)
546 outputESColl->push_back( *i );
550 iEvent.
put( outputHcalIsoTrackColl,
"HcalIsolatedTrackCollection");
551 iEvent.
put( outputTColl,
"IsoTrackTracksCollection");
552 iEvent.
put( outputExTColl,
"IsoTrackExtraTracksCollection");
553 iEvent.
put( outputEColl,
"IsoTrackEcalRecHitCollection");
554 iEvent.
put( outputESColl,
"IsoTrackPSEcalRecHitCollection");
555 iEvent.
put( outputHColl,
"IsoTrackHBHERecHitCollection");
556 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 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.
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_
std::vector< size_type > Keys
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
T const * product() const
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.
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
edm::EDGetTokenT< HORecHitCollection > tok_ho_
Power< A, B >::type pow(const A &a, const B &b)
void loadParameters(const edm::ParameterSet &)
const_iterator begin() const
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)