16 muonsToken(consumes<
reco::
MuonCollection>(parset.getParameter< edm::InputTag >(
"muonsTag"))),
17 inputDTRecSegment4DToken_(consumes<
DTRecSegment4DCollection>(parset.getParameter<edm::InputTag>(
"inputDTRecSegment4DCollection"))),
18 inputCSCSegmentToken_(consumes<
CSCSegmentCollection>(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();
171 selectedTrackHits->push_back( hit );
175 if (
trackType ==
"innerTrackPlusSegments") {
182 unsigned int index_chamber = 0;
184 for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch =
muon->matches().begin();
185 chamberMatch !=
muon->matches().end(); ++chamberMatch, index_chamber++) {
186 std::stringstream chamberStr;
187 chamberStr <<
"\nchamber index: "<<index_chamber;
189 int subdet = chamberMatch->detector();
190 DetId did = chamberMatch->id;
194 wheel = dtdetid.
wheel();
196 sector = dtdetid.
sector();
197 chamberStr <<
", DT chamber Wh:"<<wheel<<
",St:"<<station<<
",Se:"<<sector;
201 endcap = cscdetid.
endcap();
203 ring = cscdetid.
ring();
205 chamberStr <<
", CSC chamber End:"<<endcap<<
",St:"<<station<<
",Ri:"<<ring<<
",Ch:"<<chamber;
208 chamberStr <<
", Number of segments: "<<chamberMatch->segmentMatches.size();
211 unsigned int index_segment = 0;
213 for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
214 segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch, index_segment++) {
216 float segmentX = segmentMatch->x;
217 float segmentY = segmentMatch->y ;
218 float segmentdXdZ = segmentMatch->dXdZ;
219 float segmentdYdZ = segmentMatch->dYdZ;
220 float segmentXerr = segmentMatch->xErr;
221 float segmentYerr = segmentMatch->yErr;
222 float segmentdXdZerr = segmentMatch->dXdZErr;
223 float segmentdYdZerr = segmentMatch->dYdZErr;
232 if (segment_arbitrated_Ok) ARBITRATED =
" ***ARBITRATED OK*** ";
236 <<
"\n\t segment index: "<<index_segment << ARBITRATED
237 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
238 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
240 if (!segment_arbitrated_Ok)
continue;
242 if (segmentDT.
get() != 0) {
245 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with DT segment with index = "<<segmentDT.
key();
249 std::vector<const TrackingRecHit*> phiHits = phiSeg->
recHits();
250 for(std::vector<const TrackingRecHit*>::const_iterator ihit = phiHits.begin();
251 ihit != phiHits.end(); ++ihit) {
256 selectedTrackHits->push_back( seghit );
263 std::vector<const TrackingRecHit*> zedHits = zSeg->
recHits();
264 for(std::vector<const TrackingRecHit*>::const_iterator ihit = zedHits.begin();
265 ihit != zedHits.end(); ++ihit) {
270 selectedTrackHits->push_back( seghit );
274 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED DT segment ! \n";
279 <<
"\n\t segment index: "<<index_segment << ARBITRATED
280 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
281 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
283 if (!segment_arbitrated_Ok)
continue;
285 if (segmentCSC.
get() != 0) {
288 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with CSC segment with index = "<<segmentCSC.
key();
290 std::vector<const TrackingRecHit*> hits = segment->recHits();
291 for(std::vector<const TrackingRecHit*>::const_iterator ihit = hits.begin();
292 ihit != hits.end(); ++ihit) {
297 selectedTrackHits->push_back( seghit );
300 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED CSC segment ! \n";
310 selectedTracks->push_back( *newTrk );
311 selectedTrackExtras->push_back( *newExtra );
316 iEvent.
put(selectedTracks);
317 iEvent.
put(selectedTrackExtras);
318 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)
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.
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.
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
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.