16 muonsTag(parset.getParameter< edm::InputTag >(
"muonsTag")),
17 inputDTRecSegment4DCollection_(parset.getParameter<edm::InputTag>(
"inputDTRecSegment4DCollection")),
18 inputCSCSegmentCollection_(parset.getParameter<edm::InputTag>(
"inputCSCSegmentCollection")),
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();
165 unsigned int index_hit = 0;
173 selectedTrackHits->push_back( hit );
177 if (
trackType ==
"innerTrackPlusSegments") {
184 unsigned int index_chamber = 0;
186 for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch =
muon->matches().begin();
187 chamberMatch !=
muon->matches().end(); ++chamberMatch, index_chamber++) {
188 std::stringstream chamberStr;
189 chamberStr <<
"\nchamber index: "<<index_chamber;
191 int subdet = chamberMatch->detector();
192 DetId did = chamberMatch->id;
196 wheel = dtdetid.
wheel();
198 sector = dtdetid.
sector();
199 chamberStr <<
", DT chamber Wh:"<<wheel<<
",St:"<<station<<
",Se:"<<sector;
203 endcap = cscdetid.
endcap();
205 ring = cscdetid.
ring();
207 chamberStr <<
", CSC chamber End:"<<endcap<<
",St:"<<station<<
",Ri:"<<ring<<
",Ch:"<<chamber;
210 chamberStr <<
", Number of segments: "<<chamberMatch->segmentMatches.size();
213 unsigned int index_segment = 0;
215 for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
216 segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch, index_segment++) {
218 float segmentX = segmentMatch->x;
219 float segmentY = segmentMatch->y ;
220 float segmentdXdZ = segmentMatch->dXdZ;
221 float segmentdYdZ = segmentMatch->dYdZ;
222 float segmentXerr = segmentMatch->xErr;
223 float segmentYerr = segmentMatch->yErr;
224 float segmentdXdZerr = segmentMatch->dXdZErr;
225 float segmentdYdZerr = segmentMatch->dYdZErr;
234 if (segment_arbitrated_Ok) ARBITRATED =
" ***ARBITRATED OK*** ";
238 <<
"\n\t segment index: "<<index_segment << ARBITRATED
239 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
240 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
242 if (!segment_arbitrated_Ok)
continue;
244 if (segmentDT.
get() != 0) {
247 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with DT segment with index = "<<segmentDT.
key();
251 std::vector<const TrackingRecHit*> phiHits = phiSeg->
recHits();
252 for(std::vector<const TrackingRecHit*>::const_iterator ihit = phiHits.begin();
253 ihit != phiHits.end(); ++ihit) {
259 selectedTrackHits->push_back( seghit );
266 std::vector<const TrackingRecHit*> zedHits = zSeg->
recHits();
267 for(std::vector<const TrackingRecHit*>::const_iterator ihit = zedHits.begin();
268 ihit != zedHits.end(); ++ihit) {
274 selectedTrackHits->push_back( seghit );
278 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED DT segment ! \n";
283 <<
"\n\t segment index: "<<index_segment << ARBITRATED
284 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
285 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
287 if (!segment_arbitrated_Ok)
continue;
289 if (segmentCSC.
get() != 0) {
292 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with CSC segment with index = "<<segmentCSC.
key();
294 std::vector<const TrackingRecHit*> hits = segment->recHits();
295 for(std::vector<const TrackingRecHit*>::const_iterator ihit = hits.begin();
296 ihit != hits.end(); ++ihit) {
302 selectedTrackHits->push_back( seghit );
305 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED CSC segment ! \n";
315 selectedTracks->push_back( *newTrk );
316 selectedTrackExtras->push_back( *newExtra );
321 iEvent.
put(selectedTracks);
322 iEvent.
put(selectedTrackExtras);
323 iEvent.
put(selectedTrackHits);
edm::InputTag inputCSCSegmentCollection_
std::vector< std::string > selectionTags
std::string dump(unsigned int indent=0) const
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
std::vector< Track > TrackCollection
collection of Tracks
bool innerOk() const
return true if the innermost hit is valid
const math::XYZPoint & outerPosition() const
position of the outermost hit
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_
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)
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
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.
static const unsigned int BestInChamberByDR
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.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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?
void setHitPattern(const C &c)
set hit patterns from vector of hit references
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
edm::InputTag inputDTRecSegment4DCollection_
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
key_type key() const
Accessor for product key.
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
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
int station() const
Return the station number.
T const * get() const
Returns C++ pointer to the item.
int wheel() const
Return the wheel number.
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.