36 #include "Math/GenVector/VectorUtil.h"
37 #include "Math/GenVector/PxPyPzE4D.h"
46 #include <boost/regex.hpp>
48 double getDistInCM(
double eta1,
double phi1,
double eta2,
double phi2)
51 double theta1=2*atan(
exp(-eta1));
52 double theta2=2*atan(
exp(-eta2));
53 if (fabs(eta1)<1.479) Rec=129;
54 else Rec=
tan(theta1)*317;
60 dR=fabs((Rec/
sin(theta1))*
tan(angle));
66 double getDist(
double eta1,
double phi1,
double eta2,
double phi2)
68 double dphi = fabs(phi1 - phi2);
69 if(dphi>acos(-1)) dphi = 2*acos(-1)-dphi;
87 for (
unsigned l=0;
l<hltFilterTag_.size();
l++)
89 if ((trEv->filterTag(iFilt).label()).substr(0,27)==hltFilterTag_[
l])
91 KEYS=trEv->filterKeys(iFilt);
100 if (dHit<minDDD) minDDD=dHit;
102 if (minDDD>hltMatchingCone_) match=
false;
118 if ((trEv->filterTag(iFilt).label()).substr(0,14)==l1FilterTag_) KEYS=trEv->filterKeys(iFilt);
121 double etaTrig=-10000;
122 double phiTrig=-10000;
134 return std::pair<double,double>(etaTrig,phiTrig);
190 produces<reco::IsolatedPixelTrackCandidateCollection>(
"HcalIsolatedTrackCollection");
192 produces<reco::TrackCollection>(
"IsoTrackTracksCollection");
193 produces<reco::TrackExtraCollection>(
"IsoTrackExtraTracksCollection");
195 produces<EcalRecHitCollection>(
"IsoTrackEcalRecHitCollection");
196 produces<EcalRecHitCollection>(
"IsoTrackPSEcalRecHitCollection");
198 produces<HBHERecHitCollection>(
"IsoTrackHBHERecHitCollection");
199 produces<HORecHitCollection>(
"IsoTrackHORecHitCollection");
230 std::vector<edm::InputTag>::const_iterator
i;
237 tmpEcalRecHitCollection->push_back(*recHit);
264 std::vector<HcalDetId> usedHitsHC;
265 std::vector<int> usedHitsEC;
269 for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++) {
270 bool noChargedTracks =
true;
273 double px = track->px();
274 double py = track->py();
275 double pz = track->pz();
276 double ptrack =
sqrt(px*px+py*py+pz*pz);
278 if (ptrack < m_pCut || track->pt() <
m_ptCut )
continue;
280 if (track->hitPattern().numberOfValidHits() <
nHitsMinCore_)
continue;
296 if (etaecal==0&&phiecal==0)
continue;
302 if (fabs(track->eta())>
etaMax_)
continue;
305 double maxPNearby=-10;
307 for (reco::TrackCollection::const_iterator track1=tC.begin(); track1!=tC.end(); track1++)
310 if (track == track1)
continue;
311 if (track->hitPattern().numberOfValidHits() <
nHitsMinIso_)
continue;
312 double ptrack1 =
sqrt(track1->px()*track1->px()+track1->py()*track1->py()+track1->pz()*track1->pz());
316 GlobalPoint gPointHcal1(info1.trkGlobPosAtHcal.x(),info1.trkGlobPosAtHcal.y(),info1.trkGlobPosAtHcal.z());
318 double etaecal1=info1.trkGlobPosAtEcal.
eta();
319 double phiecal1=info1.trkGlobPosAtEcal.phi();
321 if (etaecal1==0&&phiecal1==0)
continue;
333 if(ptrack<10.)factor+=(10.-ptrack)/20.;
334 if(ptrack1<10.)factor1+=(10.-ptrack1)/20.;
340 if (track1->p()>maxPNearby)
342 maxPNearby=track1->p();
344 sumPNearby+=track1->p();
349 noChargedTracks =
false;
357 bool noNeutrals =
false;
370 int etaIDcenter=-10000;
371 int phiIDcenter=-10000;
373 for (
unsigned int i=0; i<crossedECids.size(); i++)
375 if ((*crossedECids[i]).id().subdetId()==
EcalEndcap)
377 EEDetId did(crossedECids[i]->
id());
378 if (crossedECids[i]->
energy()>enMax)
380 enMax=crossedECids[
i]->energy();
381 etaIDcenter=did.
iy();
382 phiIDcenter=did.
ix();
385 if ((*crossedECids[i]).
id().subdetId()==
EcalBarrel)
387 EBDetId did(crossedECids[i]->
id());
388 if (crossedECids[i]->
energy()>enMax)
390 enMax=crossedECids[
i]->energy();
391 etaIDcenter=did.
ieta();
392 phiIDcenter=did.
iphi();
396 for (std::vector<EcalRecHit>::const_iterator ehit=tmpEcalRecHitCollection->begin(); ehit!=tmpEcalRecHitCollection->end(); ehit++)
401 double phihit = posH.
phi();
402 double etahit = posH.
eta();
404 double dHit=
deltaR(etaecal,phiecal,etahit,phihit);
410 ecClustR+=ehit->energy();
415 ecOutRingR+=ehit->energy();
420 bool hitIsUsed=
false;
421 int hitHashedIndex=-10000;
426 if (fabs(did.ieta()-etaIDcenter)<=
matrixSize_/2&&fabs(did.iphi()-phiIDcenter)<=
matrixSize_/2) ecClustN+=ehit->energy();
433 if (fabs(did.iy()-etaIDcenter)<=
matrixSize_/2&&fabs(did.ix()-phiIDcenter)<=
matrixSize_/2) ecClustN+=ehit->energy();
435 for (uint32_t i=0; i<usedHitsEC.size(); i++)
437 if (usedHitsEC[i]==hitHashedIndex) hitIsUsed=
true;
440 if (hitIsUsed)
continue;
441 usedHitsEC.push_back(hitHashedIndex);
446 outputEColl->push_back(*ehit);
451 if (ecOutRingR<
m_ecalCut) noNeutrals=
true;
452 else noNeutrals=
false;
462 outputTColl->push_back(*track);
466 outputExTColl->push_back(*myextra);
478 outputHcalIsoTrackColl->push_back(newHITCandidate);
481 for (std::vector<HBHERecHit>::const_iterator hhit=hbheRHcol->begin(); hhit!=hbheRHcol->end(); hhit++)
484 bool hitIsUsed=
false;
485 for (uint32_t i=0; i<usedHitsHC.size(); i++)
487 if (usedHitsHC[i]==hhit->id()) hitIsUsed=
true;
489 if (hitIsUsed)
continue;
490 usedHitsHC.push_back(hhit->id());
494 double phihit = posH.
phi();
495 double etahit = posH.
eta();
497 double dHit=
deltaR(etaecal,phiecal,etahit,phihit);
502 outputHColl->push_back(*hhit);
513 if(outputTColl->size() > 0)
532 EcalPreshowerTopology psTopology(geoHandle);
536 iEvent.
getByLabel(
"ecalPreshowerRecHit",
"EcalRecHitsES",pRecHits);
541 for(IT i=psrechits.
begin(); i!=psrechits.
end(); i++)
543 outputESColl->push_back( *i );
547 iEvent.
put( outputHcalIsoTrackColl,
"HcalIsolatedTrackCollection");
548 iEvent.
put( outputTColl,
"IsoTrackTracksCollection");
549 iEvent.
put( outputExTColl,
"IsoTrackExtraTracksCollection");
550 iEvent.
put( outputEColl,
"IsoTrackEcalRecHitCollection");
551 iEvent.
put( outputESColl,
"IsoTrackPSEcalRecHitCollection");
552 iEvent.
put( outputHColl,
"IsoTrackHBHERecHitCollection");
553 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
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 &)
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)
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
std::pair< double, double > getL1triggerDirection(edm::Event &iEvent, edm::InputTag hltEventTag_, std::string l1FilterTag_)
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)
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
int ieta() const
get the crystal ieta
std::vector< LinkConnSpec >::const_iterator IT
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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_
bool checkHLTMatch(edm::Event &iEvent, edm::InputTag hltEventTag_, std::vector< std::string > hltFilterTag_, double eta, double phi, double hltMatchingCone_)
std::vector< size_type > Keys
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
edm::InputTag hltEventTag_
T const * product() const
T const * product() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
GlobalVector trkMomAtHcal
TrackAssociatorParameters parameters_
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
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
Power< A, B >::type pow(const A &a, const B &b)
void loadParameters(const edm::ParameterSet &)
const_iterator begin() const
edm::InputTag m_inputTrackLabel_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)