19 selectionTags(parset.getParameter< std::vector<std::
string> >(
"selectionTags")),
20 trackType(parset.getParameter< std::
string >(
"trackType")),
24 produces<reco::TrackCollection>();
25 produces<reco::TrackExtraCollection>();
26 produces<TrackingRecHitCollection>();
50 unsigned int index_dt_segment = 0;
53 LocalPoint segmentLocalPosition = segment->localPosition();
54 LocalVector segmentLocalDirection = segment->localDirection();
55 LocalError segmentLocalPositionError = segment->localPositionError();
56 LocalError segmentLocalDirectionError = segment->localDirectionError();
57 DetId geoid = segment->geographicalId();
59 int wheel = dtdetid.
wheel();
61 int sector = dtdetid.
sector();
63 float segmentX = segmentLocalPosition.
x();
64 float segmentY = segmentLocalPosition.
y();
65 float segmentdXdZ = segmentLocalDirection.
x()/segmentLocalDirection.
z();
66 float segmentdYdZ = segmentLocalDirection.
y()/segmentLocalDirection.
z();
67 float segmentXerr =
sqrt(segmentLocalPositionError.
xx());
68 float segmentYerr =
sqrt(segmentLocalPositionError.
yy());
69 float segmentdXdZerr =
sqrt(segmentLocalDirectionError.
xx());
70 float segmentdYdZerr =
sqrt(segmentLocalDirectionError.
yy());
73 <<
"\nDT segment index :"<<index_dt_segment
74 <<
"\nchamber Wh:"<<wheel<<
",St:"<<station<<
",Se:"<<sector
75 <<
"\nLocal Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
76 <<
"Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
80 unsigned int index_csc_segment = 0;
83 LocalPoint segmentLocalPosition = segment->localPosition();
84 LocalVector segmentLocalDirection = segment->localDirection();
85 LocalError segmentLocalPositionError = segment->localPositionError();
86 LocalError segmentLocalDirectionError = segment->localDirectionError();
88 DetId geoid = segment->geographicalId();
93 int chamber = cscdetid.
chamber();
95 float segmentX = segmentLocalPosition.
x();
96 float segmentY = segmentLocalPosition.
y();
97 float segmentdXdZ = segmentLocalDirection.
x()/segmentLocalDirection.
z();
98 float segmentdYdZ = segmentLocalDirection.
y()/segmentLocalDirection.
z();
99 float segmentXerr =
sqrt(segmentLocalPositionError.
xx());
100 float segmentYerr =
sqrt(segmentLocalPositionError.
yy());
101 float segmentdXdZerr =
sqrt(segmentLocalDirectionError.
xx());
102 float segmentdYdZerr =
sqrt(segmentLocalDirectionError.
yy());
105 <<
"\nCSC segment index :"<<index_csc_segment
106 <<
"\nchamber Endcap:"<<endcap<<
",St:"<<station<<
",Ri:"<<ring<<
",Ch:"<<chamber
107 <<
"\nLocal Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
108 <<
"Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
112 unsigned int muon_index = 0;
115 edm::LogVerbatim(
"MuonTrackProducer") <<
"\n******* muon index : "<<muon_index;
117 std::vector<bool> isGood;
119 isGood.push_back(
false);
125 bool isGoodResult=
true;
128 isGoodResult *= isGood[
index];
135 if (
muon->innerTrack().isNonnull()) trackref =
muon->innerTrack();
139 if (
muon->outerTrack().isNonnull()) trackref =
muon->outerTrack();
143 if (
muon->globalTrack().isNonnull()) trackref =
muon->globalTrack();
146 else if (
trackType ==
"innerTrackPlusSegments") {
147 if (
muon->innerTrack().isNonnull()) trackref =
muon->innerTrack();
168 unsigned int nHitsToAdd = 0;
171 selectedTrackHits->push_back( hit );
174 newExtra->
setHits( rHits, hidx, nHitsToAdd );
176 if (
trackType ==
"innerTrackPlusSegments") {
183 unsigned int index_chamber = 0;
185 for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch =
muon->matches().begin();
186 chamberMatch !=
muon->matches().end(); ++chamberMatch, index_chamber++) {
187 std::stringstream chamberStr;
188 chamberStr <<
"\nchamber index: "<<index_chamber;
190 int subdet = chamberMatch->detector();
191 DetId did = chamberMatch->id;
195 wheel = dtdetid.
wheel();
197 sector = dtdetid.
sector();
198 chamberStr <<
", DT chamber Wh:"<<wheel<<
",St:"<<station<<
",Se:"<<sector;
202 endcap = cscdetid.
endcap();
204 ring = cscdetid.
ring();
206 chamberStr <<
", CSC chamber End:"<<endcap<<
",St:"<<station<<
",Ri:"<<ring<<
",Ch:"<<chamber;
209 chamberStr <<
", Number of segments: "<<chamberMatch->segmentMatches.size();
212 unsigned int index_segment = 0;
214 for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
215 segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch, index_segment++) {
217 float segmentX = segmentMatch->x;
218 float segmentY = segmentMatch->y ;
219 float segmentdXdZ = segmentMatch->dXdZ;
220 float segmentdYdZ = segmentMatch->dYdZ;
221 float segmentXerr = segmentMatch->xErr;
222 float segmentYerr = segmentMatch->yErr;
223 float segmentdXdZerr = segmentMatch->dXdZErr;
224 float segmentdYdZerr = segmentMatch->dYdZErr;
233 if (segment_arbitrated_Ok) ARBITRATED =
" ***ARBITRATED OK*** ";
237 <<
"\n\t segment index: "<<index_segment << ARBITRATED
238 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
239 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
241 if (!segment_arbitrated_Ok)
continue;
243 if (segmentDT.
get() != 0) {
246 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with DT segment with index = "<<segmentDT.
key();
250 std::vector<const TrackingRecHit*> phiHits = phiSeg->
recHits();
251 unsigned int nHitsAdded = 0;
252 for(std::vector<const TrackingRecHit*>::const_iterator ihit = phiHits.begin();
253 ihit != phiHits.end(); ++ihit) {
258 selectedTrackHits->push_back( seghit );
261 newExtra->
setHits( rHits, hidx, nHitsAdded );
267 std::vector<const TrackingRecHit*> zedHits = zSeg->
recHits();
268 unsigned int nHitsAdded = 0;
269 for(std::vector<const TrackingRecHit*>::const_iterator ihit = zedHits.begin();
270 ihit != zedHits.end(); ++ihit) {
275 selectedTrackHits->push_back( seghit );
278 newExtra->
setHits( rHits, hidx, nHitsAdded );
281 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED DT segment ! \n";
286 <<
"\n\t segment index: "<<index_segment << ARBITRATED
287 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
288 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
290 if (!segment_arbitrated_Ok)
continue;
292 if (segmentCSC.
get() != 0) {
295 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with CSC segment with index = "<<segmentCSC.
key();
297 std::vector<const TrackingRecHit*> hits = segment->
recHits();
298 unsigned int nHitsAdded = 0;
299 for(std::vector<const TrackingRecHit*>::const_iterator ihit = hits.begin();
300 ihit != hits.end(); ++ihit) {
305 selectedTrackHits->push_back( seghit );
308 newExtra->
setHits( rHits, hidx, nHitsAdded );
310 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED CSC segment ! \n";
320 selectedTracks->push_back( *newTrk );
321 selectedTrackExtras->push_back( *newExtra );
326 iEvent.
put(selectedTracks);
327 iEvent.
put(selectedTrackExtras);
328 iEvent.
put(selectedTrackHits);
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
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_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
edm::Handle< DTRecSegment4DCollection > dtSegmentCollectionH_
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
bool appendHitPattern(const TrackingRecHit &hit)
append a single hit to the HitPattern
static const unsigned int BestInChamberByDR
T const * get() const
Returns C++ pointer to the item.
bool hasPhi() const
Does it have the Phi projection?
virtual void produce(edm::Event &, const edm::EventSetup &)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
RefProd< PROD > getRefBeforePut()
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
virtual TrackingRecHit * clone() const =0
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
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
SelectionType selectionTypeFromString(const std::string &label)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
edm::Handle< reco::MuonCollection > muonCollectionH
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
static const unsigned int BelongsToTrackByDR
const edm::ParameterSet parset_
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
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_
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
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.