22 inputDTRecSegment4DToken_(
24 inputCSCSegmentToken_(
30 produces<reco::TrackCollection>();
31 produces<reco::TrackExtraCollection>();
32 produces<TrackingRecHitCollection>();
58 unsigned int index_dt_segment = 0;
61 ++segment, index_dt_segment++) {
62 LocalPoint segmentLocalPosition = segment->localPosition();
63 LocalVector segmentLocalDirection = segment->localDirection();
64 LocalError segmentLocalPositionError = segment->localPositionError();
65 LocalError segmentLocalDirectionError = segment->localDirectionError();
66 DetId geoid = segment->geographicalId();
70 int sector = dtdetid.
sector();
72 float segmentX = segmentLocalPosition.
x();
73 float segmentY = segmentLocalPosition.
y();
74 float segmentdXdZ = segmentLocalDirection.
x() / segmentLocalDirection.
z();
75 float segmentdYdZ = segmentLocalDirection.
y() / segmentLocalDirection.
z();
76 float segmentXerr =
sqrt(segmentLocalPositionError.
xx());
77 float segmentYerr =
sqrt(segmentLocalPositionError.
yy());
78 float segmentdXdZerr =
sqrt(segmentLocalDirectionError.
xx());
79 float segmentdYdZerr =
sqrt(segmentLocalDirectionError.
yy());
82 <<
"\nDT segment index :" << index_dt_segment <<
"\nchamber Wh:" << wheel <<
",St:" << station
83 <<
",Se:" << sector <<
"\nLocal Position (X,Y)=(" << segmentX <<
"," << segmentY <<
") +/- (" << segmentXerr
84 <<
"," << segmentYerr <<
"), " 85 <<
"Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ <<
"," << segmentdYdZ <<
") +/- (" << segmentdXdZerr <<
"," 86 << segmentdYdZerr <<
")";
90 unsigned int index_csc_segment = 0;
93 ++segment, index_csc_segment++) {
94 LocalPoint segmentLocalPosition = segment->localPosition();
95 LocalVector segmentLocalDirection = segment->localDirection();
96 LocalError segmentLocalPositionError = segment->localPositionError();
97 LocalError segmentLocalDirectionError = segment->localDirectionError();
99 DetId geoid = segment->geographicalId();
106 float segmentX = segmentLocalPosition.
x();
107 float segmentY = segmentLocalPosition.
y();
108 float segmentdXdZ = segmentLocalDirection.
x() / segmentLocalDirection.
z();
109 float segmentdYdZ = segmentLocalDirection.
y() / segmentLocalDirection.
z();
110 float segmentXerr =
sqrt(segmentLocalPositionError.
xx());
111 float segmentYerr =
sqrt(segmentLocalPositionError.
yy());
112 float segmentdXdZerr =
sqrt(segmentLocalDirectionError.
xx());
113 float segmentdYdZerr =
sqrt(segmentLocalDirectionError.
yy());
116 <<
"\nCSC segment index :" << index_csc_segment <<
"\nchamber Endcap:" << endcap <<
",St:" << station
117 <<
",Ri:" << ring <<
",Ch:" << chamber <<
"\nLocal Position (X,Y)=(" << segmentX <<
"," << segmentY <<
") +/- (" 118 << segmentXerr <<
"," << segmentYerr <<
"), " 119 <<
"Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ <<
"," << segmentdYdZ <<
") +/- (" << segmentdXdZerr <<
"," 120 << segmentdYdZerr <<
")";
124 unsigned int muon_index = 0;
126 ++
muon, muon_index++) {
127 edm::LogVerbatim(
"MuonTrackProducer") <<
"\n******* muon index : " << muon_index;
129 std::vector<bool> isGood;
131 isGood.push_back(
false);
137 bool isGoodResult =
true;
141 isGoodResult *= isGood[
index];
148 if (
muon->innerTrack().isNonnull())
149 trackref =
muon->innerTrack();
153 if (
muon->outerTrack().isNonnull())
154 trackref =
muon->outerTrack();
158 if (
muon->globalTrack().isNonnull())
159 trackref =
muon->globalTrack();
162 }
else if (
trackType ==
"innerTrackPlusSegments") {
163 if (
muon->innerTrack().isNonnull())
164 trackref =
muon->innerTrack();
167 }
else if (
trackType ==
"gemMuonTrack") {
168 if (
muon->innerTrack().isNonnull() &&
muon->isGEMMuon()) {
169 trackref =
muon->innerTrack();
172 }
else if (
trackType ==
"me0MuonTrack") {
173 if (
muon->innerTrack().isNonnull() &&
muon->isME0Muon()) {
174 trackref =
muon->innerTrack();
181 std::unique_ptr<reco::Track> newTrk(
new reco::Track(*trk));
203 unsigned int nHitsToAdd = 0;
206 selectedTrackHits->push_back(hit);
209 newExtra->setHits(rHits, hidx, nHitsToAdd);
211 if (
trackType ==
"innerTrackPlusSegments") {
216 <<
"Number of chambers: " <<
muon->matches().size()
218 unsigned int index_chamber = 0;
220 for (std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch =
muon->matches().begin();
221 chamberMatch !=
muon->matches().end();
222 ++chamberMatch, index_chamber++) {
223 std::stringstream chamberStr;
224 chamberStr <<
"\nchamber index: " << index_chamber;
226 int subdet = chamberMatch->detector();
227 DetId did = chamberMatch->id;
231 wheel = dtdetid.
wheel();
233 sector = dtdetid.
sector();
234 chamberStr <<
", DT chamber Wh:" << wheel <<
",St:" << station <<
",Se:" << sector;
237 endcap = cscdetid.
endcap();
239 ring = cscdetid.
ring();
241 chamberStr <<
", CSC chamber End:" << endcap <<
",St:" << station <<
",Ri:" << ring <<
",Ch:" <<
chamber;
244 chamberStr <<
", Number of segments: " << chamberMatch->segmentMatches.size();
247 unsigned int index_segment = 0;
249 for (std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
250 segmentMatch != chamberMatch->segmentMatches.end();
251 ++segmentMatch, index_segment++) {
252 float segmentX = segmentMatch->x;
253 float segmentY = segmentMatch->y;
254 float segmentdXdZ = segmentMatch->dXdZ;
255 float segmentdYdZ = segmentMatch->dYdZ;
256 float segmentXerr = segmentMatch->xErr;
257 float segmentYerr = segmentMatch->yErr;
258 float segmentdXdZerr = segmentMatch->dXdZErr;
259 float segmentdYdZerr = segmentMatch->dYdZErr;
268 if (segment_arbitrated_Ok)
269 ARBITRATED =
" ***ARBITRATED OK*** ";
273 <<
"\n\t segment index: " << index_segment << ARBITRATED <<
"\n\t Local Position (X,Y)=(" << segmentX
274 <<
"," << segmentY <<
") +/- (" << segmentXerr <<
"," << segmentYerr <<
"), " 275 <<
"\n\t Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ <<
"," << segmentdYdZ <<
") +/- (" 276 << segmentdXdZerr <<
"," << segmentdYdZerr <<
")";
278 if (!segment_arbitrated_Ok)
281 if (segmentDT.
get() !=
nullptr) {
285 <<
"\t ===> MATCHING with DT segment with index = " << segmentDT.
key();
289 std::vector<const TrackingRecHit *> phiHits = phiSeg->
recHits();
290 unsigned int nHitsAdded = 0;
291 for (std::vector<const TrackingRecHit *>::const_iterator ihit = phiHits.begin();
292 ihit != phiHits.end();
295 newTrk->appendHitPattern(*seghit, ttopo);
300 selectedTrackHits->push_back(seghit);
303 newExtra->setHits(rHits, hidx, nHitsAdded);
309 std::vector<const TrackingRecHit *> zedHits = zSeg->
recHits();
310 unsigned int nHitsAdded = 0;
311 for (std::vector<const TrackingRecHit *>::const_iterator ihit = zedHits.begin();
312 ihit != zedHits.end();
315 newTrk->appendHitPattern(*seghit, ttopo);
320 selectedTrackHits->push_back(seghit);
323 newExtra->setHits(rHits, hidx, nHitsAdded);
327 edm::LogWarning(
"MuonTrackProducer") <<
"\n***WARNING: UNMATCHED DT segment ! \n";
332 <<
"\n\t segment index: " << index_segment << ARBITRATED <<
"\n\t Local Position (X,Y)=(" << segmentX
333 <<
"," << segmentY <<
") +/- (" << segmentXerr <<
"," << segmentYerr <<
"), " 334 <<
"\n\t Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ <<
"," << segmentdYdZ <<
") +/- (" 335 << segmentdXdZerr <<
"," << segmentdYdZerr <<
")";
337 if (!segment_arbitrated_Ok)
340 if (segmentCSC.
get() !=
nullptr) {
344 <<
"\t ===> MATCHING with CSC segment with index = " << segmentCSC.
key();
346 std::vector<const TrackingRecHit *>
hits = segment->
recHits();
347 unsigned int nHitsAdded = 0;
348 for (std::vector<const TrackingRecHit *>::const_iterator ihit = hits.begin(); ihit != hits.end();
351 newTrk->appendHitPattern(*seghit, ttopo);
356 selectedTrackHits->push_back(seghit);
359 newExtra->setHits(rHits, hidx, nHitsAdded);
362 edm::LogWarning(
"MuonTrackProducer") <<
"\n***WARNING: UNMATCHED CSC segment ! \n";
372 selectedTracks->push_back(*newTrk);
373 selectedTrackExtras->push_back(*newExtra);
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< DTRecSegment4DCollection > inputDTRecSegment4DToken_
std::vector< std::string > selectionTags
std::string dump(unsigned int indent=0) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~MuonTrackProducer() override
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
edm::EDGetTokenT< reco::MuonCollection > muonsToken
std::vector< Track > TrackCollection
collection of Tracks
bool innerOk() const
return true if the innermost hit is valid
key_type key() const
Accessor for product key.
const math::XYZPoint & outerPosition() const
position of the outermost hit
std::vector< Muon > MuonCollection
collection of Muon objects
SelectionType
Selector type.
const math::XYZPoint & innerPosition() const
position of the innermost hit
C::const_iterator const_iterator
constant access iterator type
edm::Handle< CSCSegmentCollection > cscSegmentCollectionH_
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
virtual TrackingRecHit * clone() const =0
edm::Handle< DTRecSegment4DCollection > dtSegmentCollectionH_
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
static const unsigned int BestInChamberByDR
T const * get() const
Returns C++ pointer to the item.
bool hasPhi() const
Does it have the Phi projection?
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
RefProd< PROD > getRefBeforePut()
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
MuonTrackProducer(const edm::ParameterSet &)
bool hasZed() const
Does it have the Z projection?
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
bool outerOk() const
return true if the outermost hit is valid
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
SelectionType selectionTypeFromString(const std::string &label)
edm::Handle< reco::MuonCollection > muonCollectionH
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
void produce(edm::Event &, const edm::EventSetup &) override
static const unsigned int BelongsToTrackByDR
const edm::ParameterSet parset_
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
int station() const
Return the station number.
int wheel() const
Return the wheel number.
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
edm::EDGetTokenT< CSCSegmentCollection > inputCSCSegmentToken_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.