23 selectionTags(parset.getParameter< std::vector<std::
string> >(
"selectionTags")),
24 trackType(parset.getParameter< std::
string >(
"trackType")),
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();
67 int wheel = dtdetid.
wheel();
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();
101 int chamber = cscdetid.
chamber();
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();
176 unsigned int nHitsToAdd = 0;
179 selectedTrackHits->push_back( hit );
182 newExtra->
setHits( rHits, hidx, nHitsToAdd );
184 if (
trackType ==
"innerTrackPlusSegments") {
191 unsigned int index_chamber = 0;
193 for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch =
muon->matches().begin();
194 chamberMatch !=
muon->matches().end(); ++chamberMatch, index_chamber++) {
195 std::stringstream chamberStr;
196 chamberStr <<
"\nchamber index: "<<index_chamber;
198 int subdet = chamberMatch->detector();
199 DetId did = chamberMatch->id;
203 wheel = dtdetid.
wheel();
205 sector = dtdetid.
sector();
206 chamberStr <<
", DT chamber Wh:"<<wheel<<
",St:"<<station<<
",Se:"<<sector;
210 endcap = cscdetid.
endcap();
212 ring = cscdetid.
ring();
214 chamberStr <<
", CSC chamber End:"<<endcap<<
",St:"<<station<<
",Ri:"<<ring<<
",Ch:"<<chamber;
217 chamberStr <<
", Number of segments: "<<chamberMatch->segmentMatches.size();
220 unsigned int index_segment = 0;
222 for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
223 segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch, index_segment++) {
225 float segmentX = segmentMatch->x;
226 float segmentY = segmentMatch->y ;
227 float segmentdXdZ = segmentMatch->dXdZ;
228 float segmentdYdZ = segmentMatch->dYdZ;
229 float segmentXerr = segmentMatch->xErr;
230 float segmentYerr = segmentMatch->yErr;
231 float segmentdXdZerr = segmentMatch->dXdZErr;
232 float segmentdYdZerr = segmentMatch->dYdZErr;
241 if (segment_arbitrated_Ok) ARBITRATED =
" ***ARBITRATED OK*** ";
245 <<
"\n\t segment index: "<<index_segment << ARBITRATED
246 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
247 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
249 if (!segment_arbitrated_Ok)
continue;
251 if (segmentDT.
get() != 0) {
254 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with DT segment with index = "<<segmentDT.
key();
258 std::vector<const TrackingRecHit*> phiHits = phiSeg->
recHits();
259 unsigned int nHitsAdded = 0;
260 for(std::vector<const TrackingRecHit*>::const_iterator ihit = phiHits.begin();
261 ihit != phiHits.end(); ++ihit) {
266 selectedTrackHits->push_back( seghit );
269 newExtra->
setHits( rHits, hidx, nHitsAdded );
275 std::vector<const TrackingRecHit*> zedHits = zSeg->
recHits();
276 unsigned int nHitsAdded = 0;
277 for(std::vector<const TrackingRecHit*>::const_iterator ihit = zedHits.begin();
278 ihit != zedHits.end(); ++ihit) {
283 selectedTrackHits->push_back( seghit );
286 newExtra->
setHits( rHits, hidx, nHitsAdded );
289 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED DT segment ! \n";
294 <<
"\n\t segment index: "<<index_segment << ARBITRATED
295 <<
"\n\t Local Position (X,Y)=("<<segmentX<<
","<<segmentY<<
") +/- ("<<segmentXerr<<
","<<segmentYerr<<
"), "
296 <<
"\n\t Local Direction (dXdZ,dYdZ)=("<<segmentdXdZ<<
","<<segmentdYdZ<<
") +/- ("<<segmentdXdZerr<<
","<<segmentdYdZerr<<
")";
298 if (!segment_arbitrated_Ok)
continue;
300 if (segmentCSC.
get() != 0) {
303 edm::LogVerbatim(
"MuonTrackProducer")<<
"\t ===> MATCHING with CSC segment with index = "<<segmentCSC.
key();
305 std::vector<const TrackingRecHit*> hits = segment->
recHits();
306 unsigned int nHitsAdded = 0;
307 for(std::vector<const TrackingRecHit*>::const_iterator ihit = hits.begin();
308 ihit != hits.end(); ++ihit) {
313 selectedTrackHits->push_back( seghit );
316 newExtra->
setHits( rHits, hidx, nHitsAdded );
318 }
else edm::LogWarning(
"MuonTrackProducer")<<
"\n***WARNING: UNMATCHED CSC segment ! \n";
328 selectedTracks->push_back( *newTrk );
329 selectedTrackExtras->push_back( *newExtra );
334 iEvent.
put(selectedTracks);
335 iEvent.
put(selectedTrackExtras);
336 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.
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
bool appendHitPattern(const TrackingRecHit &hit, const TrackerTopology &ttopo)
append a single hit to the HitPattern
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.