22 inputCSCSegmentToken_(consumes<
CSCSegmentCollection>(parset.getParameter<
edm::InputTag>(
"inputCSCSegmentCollection"))),
28 produces<reco::TrackCollection>();
29 produces<reco::TrackExtraCollection>();
30 produces<TrackingRecHitCollection>();
58 unsigned int index_dt_segment = 0;
61 LocalPoint segmentLocalPosition = segment->localPosition();
62 LocalVector segmentLocalDirection = segment->localDirection();
63 LocalError segmentLocalPositionError = segment->localPositionError();
64 LocalError segmentLocalDirectionError = segment->localDirectionError();
65 DetId geoid = segment->geographicalId();
69 int sector = dtdetid.
sector();
71 float segmentX = segmentLocalPosition.
x();
72 float segmentY = segmentLocalPosition.
y();
73 float segmentdXdZ = segmentLocalDirection.
x()/segmentLocalDirection.
z();
74 float segmentdYdZ = segmentLocalDirection.
y()/segmentLocalDirection.
z();
75 float segmentXerr =
sqrt(segmentLocalPositionError.
xx());
76 float segmentYerr =
sqrt(segmentLocalPositionError.
yy());
77 float segmentdXdZerr =
sqrt(segmentLocalDirectionError.
xx());
78 float segmentdYdZerr =
sqrt(segmentLocalDirectionError.
yy());
81 <<
"\nDT segment index :"<<index_dt_segment
82 <<
"\nchamber Wh:"<<wheel<<
",St:"<<station<<
",Se:"<<sector
83 <<
"\nLocal Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), " 84 <<
"Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
88 unsigned int index_csc_segment = 0;
91 LocalPoint segmentLocalPosition = segment->localPosition();
92 LocalVector segmentLocalDirection = segment->localDirection();
93 LocalError segmentLocalPositionError = segment->localPositionError();
94 LocalError segmentLocalDirectionError = segment->localDirectionError();
96 DetId geoid = segment->geographicalId();
103 float segmentX = segmentLocalPosition.
x();
104 float segmentY = segmentLocalPosition.
y();
105 float segmentdXdZ = segmentLocalDirection.
x()/segmentLocalDirection.
z();
106 float segmentdYdZ = segmentLocalDirection.
y()/segmentLocalDirection.
z();
107 float segmentXerr =
sqrt(segmentLocalPositionError.
xx());
108 float segmentYerr =
sqrt(segmentLocalPositionError.
yy());
109 float segmentdXdZerr =
sqrt(segmentLocalDirectionError.
xx());
110 float segmentdYdZerr =
sqrt(segmentLocalDirectionError.
yy());
113 <<
"\nCSC segment index :"<<index_csc_segment
114 <<
"\nchamber Endcap:"<<endcap<<
",St:"<<station<<
",Ri:"<<ring<<
",Ch:"<<chamber
115 <<
"\nLocal Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), " 116 <<
"Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
120 unsigned int muon_index = 0;
123 edm::LogVerbatim(
"MuonTrackProducer") <<
"\n******* muon index : "<<muon_index;
125 std::vector<bool> isGood;
127 isGood.push_back(
false);
133 bool isGoodResult=
true;
136 isGoodResult *= isGood[
index];
143 if (
muon->innerTrack().isNonnull()) trackref =
muon->innerTrack();
147 if (
muon->outerTrack().isNonnull()) trackref =
muon->outerTrack();
151 if (
muon->globalTrack().isNonnull()) trackref =
muon->globalTrack();
154 else if (
trackType ==
"innerTrackPlusSegments") {
155 if (
muon->innerTrack().isNonnull()) trackref =
muon->innerTrack();
159 if (
muon->innerTrack().isNonnull() &&
muon->isGEMMuon()){
160 trackref =
muon->innerTrack();
165 if (
muon->innerTrack().isNonnull() &&
muon->isME0Muon()){
166 trackref =
muon->innerTrack();
173 std::unique_ptr<reco::Track> newTrk(
new reco::Track(*trk));
188 unsigned int nHitsToAdd = 0;
191 selectedTrackHits->push_back( hit );
194 newExtra->setHits( rHits, hidx, nHitsToAdd );
196 if (
trackType ==
"innerTrackPlusSegments") {
203 unsigned int index_chamber = 0;
205 for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch =
muon->matches().begin();
206 chamberMatch !=
muon->matches().end(); ++chamberMatch, index_chamber++) {
207 std::stringstream chamberStr;
208 chamberStr <<
"\nchamber index: "<<index_chamber;
210 int subdet = chamberMatch->detector();
211 DetId did = chamberMatch->id;
215 wheel = dtdetid.
wheel();
217 sector = dtdetid.
sector();
218 chamberStr <<
", DT chamber Wh:"<<wheel<<
",St:"<<station<<
",Se:"<<sector;
222 endcap = cscdetid.
endcap();
224 ring = cscdetid.
ring();
226 chamberStr <<
", CSC chamber End:"<<endcap<<
",St:"<<station<<
",Ri:"<<ring<<
",Ch:"<<
chamber;
229 chamberStr <<
", Number of segments: "<<chamberMatch->segmentMatches.size();
232 unsigned int index_segment = 0;
234 for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
235 segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch, index_segment++) {
237 float segmentX = segmentMatch->x;
238 float segmentY = segmentMatch->y ;
239 float segmentdXdZ = segmentMatch->dXdZ;
240 float segmentdYdZ = segmentMatch->dYdZ;
241 float segmentXerr = segmentMatch->xErr;
242 float segmentYerr = segmentMatch->yErr;
243 float segmentdXdZerr = segmentMatch->dXdZErr;
244 float segmentdYdZerr = segmentMatch->dYdZErr;
253 if (segment_arbitrated_Ok) ARBITRATED =
" ***ARBITRATED OK*** ";
257 <<
"\n\t segment index: "<<index_segment << ARBITRATED
258 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), " 259 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
261 if (!segment_arbitrated_Ok)
continue;
263 if (segmentDT.
get() !=
nullptr) {
266 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with DT segment with index = "<<segmentDT.
key();
270 std::vector<const TrackingRecHit*> phiHits = phiSeg->
recHits();
271 unsigned int nHitsAdded = 0;
272 for(std::vector<const TrackingRecHit*>::const_iterator ihit = phiHits.begin();
273 ihit != phiHits.end(); ++ihit) {
275 newTrk->appendHitPattern(*seghit, ttopo);
278 selectedTrackHits->push_back( seghit );
281 newExtra->setHits( rHits, hidx, nHitsAdded );
287 std::vector<const TrackingRecHit*> zedHits = zSeg->
recHits();
288 unsigned int nHitsAdded = 0;
289 for(std::vector<const TrackingRecHit*>::const_iterator ihit = zedHits.begin();
290 ihit != zedHits.end(); ++ihit) {
292 newTrk->appendHitPattern(*seghit, ttopo);
295 selectedTrackHits->push_back( seghit );
298 newExtra->setHits( rHits, hidx, nHitsAdded );
301 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED DT segment ! \n";
306 <<
"\n\t segment index: "<<index_segment << ARBITRATED
307 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), " 308 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
310 if (!segment_arbitrated_Ok)
continue;
312 if (segmentCSC.
get() !=
nullptr) {
315 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with CSC segment with index = "<<segmentCSC.
key();
317 std::vector<const TrackingRecHit*>
hits = segment->
recHits();
318 unsigned int nHitsAdded = 0;
319 for(std::vector<const TrackingRecHit*>::const_iterator ihit = hits.begin();
320 ihit != hits.end(); ++ihit) {
322 newTrk->appendHitPattern(*seghit, ttopo);
325 selectedTrackHits->push_back( seghit );
328 newExtra->setHits( rHits, hidx, nHitsAdded );
330 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED CSC segment ! \n";
340 selectedTracks->push_back( *newTrk );
341 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
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_
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.