52 produces<edm::ValueMap<reco::MuonMETCorrectionData> > (
"muCorrData");
66 std::vector<std::string> algos = iConfig.
getParameter<std::vector<std::string> >(
"trackAlgos");
79 algos = iConfig.
getParameter<std::vector<std::string> >(
"track_algos");
107 else if( rfType_ == 2 )
144 std::vector<reco::MuonMETCorrectionData> v_muCorrData;
146 unsigned int nMuons =
muons_->size();
148 for (
unsigned int iMu = 0; iMu < nMuons; iMu++) {
160 v_muCorrData.push_back( muMETCorrData );
167 if( mu_track->pt() <
minpt_ )
176 deltax = response * mu_track->p() *
sin( outerTrkPosition.Theta() ) *
cos( outerTrkPosition.Phi() );
177 deltay = response * mu_track->p() *
sin( outerTrkPosition.Theta() ) *
sin( outerTrkPosition.Phi() );
190 else v_muCorrData.push_back( muMETCorrData );
195 dataFiller.
insert(
muons_, v_muCorrData.begin(), v_muCorrData.end());
198 iEvent.
put(vm_muCorrData,
"muCorrData");
209 bool haveBeamSpot =
true;
219 if( siTrack.
isNonnull() ) nhits = siTrack->numberOfValidHits();
222 d0 = -1 * globalTrack->dxy( bspot );
223 chi2 = globalTrack->normalizedChi2();
226 if( fabs( d0 ) >
muond0_ )
return false;
235 if( siTrack->ptError() / siTrack->pt() >
muon_dptrel_ )
return false;
244 if( muon->
pt() < 10 )
return false;
249 if( !inputSiliconTrack.
isNonnull() )
return false;
252 unsigned int nMuons =
muons_->size();
253 for (
unsigned int iMu = 0; iMu < nMuons; iMu++)
256 if( iMu == index )
continue;
261 if( !testSiliconTrack.
isNonnull() )
continue;
263 double deltaEta = inputSiliconTrack.
get()->eta() - testSiliconTrack.
get()->eta();
264 double deltaPhi = acos(
cos( inputSiliconTrack.
get()->phi() - testSiliconTrack.
get()->phi() ) );
265 double deltaR = TMath::Sqrt( deltaEta * deltaEta + deltaPhi * deltaPhi );
290 d0 = -1 * siTrack->dxy( pvtx );
292 double dz = siTrack->dz( pvtx );
297 d0 = -1 * siTrack->dxy( pvtx );
302 bool haveBeamSpot =
true;
306 d0 = -1 * siTrack->dxy( bspot );
314 bool haveBeamSpot =
true;
318 d0 = -1 * siTrack->dxy( bspot );
328 if( fabs( d0 ) > d0cut )
return false;
337 if( (siTrack->ptError() / siTrack->pt()) >
maxPtErr_tight_ )
return false;
341 if( siTrack->numberOfValidHits() <
minhits_ )
return false;
342 if( siTrack->normalizedChi2() >
maxchi2_ )
return false;
343 if( fabs( siTrack->eta() ) >
maxeta_ )
return false;
344 if( siTrack->pt() >
maxpt_ )
return false;
345 if( (siTrack->ptError() / siTrack->pt()) >
maxPtErr_ )
return false;
346 if( fabs( siTrack->eta() ) > 2.5 && siTrack->pt() >
maxpt_eta25_ )
return false;
347 if( fabs( siTrack->eta() ) > 2.0 && siTrack->pt() >
maxpt_eta20_ )
return false;
355 if( !( (siTrack->qualityMask() &
cut) == cut ) )
return false;
357 bool isGoodAlgo =
false;
358 if(
trkAlgos_.size() == 0 ) isGoodAlgo =
true;
361 if( siTrack->algo() ==
trkAlgos_.at(
i) ) isGoodAlgo =
true;
364 if( !isGoodAlgo )
return false;
373 TVector3 outerTrkPosition;
375 outerTrkPosition.SetPtEtaPhi( 999., -10., 2 *
TMath::Pi() );
381 return outerTrkPosition;
384 GlobalPoint tpVertex ( track->vx(), track->vy(), track->vz() );
386 int tpCharge ( track->charge() );
390 const double zdist = 314.;
392 const double radius = 130.;
394 const double corner = 1.479;
405 if( track.
get()->eta() < -corner )
409 else if( fabs(track.
get()->eta()) < corner )
413 else if( track.
get()->eta() > corner )
422 outerTrkPosition.SetPtEtaPhi( 999., -10., 2 *
TMath::Pi() );
424 return outerTrkPosition;
438 if(
vertices_->begin()->isFake() )
return false;
class TVector3 propagateTrack(const reco::Muon *)
T getParameter(std::string const &) const
edm::Handle< reco::VertexCollection > vertexHandle_
MuonTCMETValueMapProducer(const edm::ParameterSet &)
bool isNonnull() const
Checks for non-null.
std::vector< reco::TrackBase::TrackAlgorithm > trackAlgos_
virtual TrackRef innerTrack() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool isTrackerMuon() const
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
class TH2D * response_function
Sin< T >::type sin(const T &t)
const reco::VertexCollection * vertices_
void insert(const H &h, I begin, I end)
bool isGlobalMuon() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
GlobalPoint globalPosition() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool isGoodMuon(const reco::Muon *)
bool isGoodCaloMuon(const reco::Muon *, const unsigned int)
int nLayers(const reco::TrackRef)
int trackerLayersWithMeasurement() const
static const double deltaEta
~MuonTCMETValueMapProducer()
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
std::vector< reco::TrackBase::TrackAlgorithm > trkAlgos_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
static PlanePointer build(Args &&...args)
Cos< T >::type cos(const T &t)
edm::Handle< reco::MuonCollection > muons_
T const * get() const
Returns C++ pointer to the item.
class MagneticField * bField
double deltaR(double eta1, double eta2, double phi1, double phi2)
T const * product() const
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
edm::Handle< reco::BeamSpot > beamSpot_
std::vector< int > trkQuality_
static TrackAlgorithm algoByName(const std::string &name)
virtual double eta() const final
momentum pseudorapidity
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Power< A, B >::type pow(const A &a, const B &b)
bool isGoodTrack(const reco::Muon *)
virtual double pt() const final
transverse momentum
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector