CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonTrackProducer Class Reference

#include <MuonTrackProducer.h>

Inheritance diagram for MuonTrackProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuonTrackProducer (const edm::ParameterSet &)
 
virtual ~MuonTrackProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::Handle< CSCSegmentCollectioncscSegmentCollectionH_
 
edm::Handle< DTRecSegment4DCollectiondtSegmentCollectionH_
 
edm::EDGetTokenT< CSCSegmentCollectioninputCSCSegmentToken_
 
edm::EDGetTokenT< DTRecSegment4DCollectioninputDTRecSegment4DToken_
 
edm::Handle< reco::MuonCollectionmuonCollectionH
 
edm::EDGetTokenT< reco::MuonCollectionmuonsToken
 
const edm::ParameterSet parset_
 
std::vector< std::string > selectionTags
 
std::string trackType
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file MuonTrackProducer.h.

Constructor & Destructor Documentation

MuonTrackProducer::MuonTrackProducer ( const edm::ParameterSet parset)
explicit

Definition at line 19 of file MuonTrackProducer.cc.

References edm::ParameterSet::dump(), and parset_.

19  :
20  muonsToken(consumes<reco::MuonCollection>(parset.getParameter< edm::InputTag >("muonsTag"))),
21  inputDTRecSegment4DToken_(consumes<DTRecSegment4DCollection>(parset.getParameter<edm::InputTag>("inputDTRecSegment4DCollection"))),
22  inputCSCSegmentToken_(consumes<CSCSegmentCollection>(parset.getParameter<edm::InputTag>("inputCSCSegmentCollection"))),
23  selectionTags(parset.getParameter< std::vector<std::string> >("selectionTags")),
24  trackType(parset.getParameter< std::string >("trackType")),
25  parset_(parset)
26 {
27  edm::LogVerbatim("MuonTrackProducer") << "constructing MuonTrackProducer" << parset_.dump();
28  produces<reco::TrackCollection>();
29  produces<reco::TrackExtraCollection>();
30  produces<TrackingRecHitCollection>();
31 }
T getParameter(std::string const &) const
edm::EDGetTokenT< DTRecSegment4DCollection > inputDTRecSegment4DToken_
std::vector< std::string > selectionTags
std::string dump(unsigned int indent=0) const
edm::EDGetTokenT< reco::MuonCollection > muonsToken
const edm::ParameterSet parset_
edm::EDGetTokenT< CSCSegmentCollection > inputCSCSegmentToken_
MuonTrackProducer::~MuonTrackProducer ( )
virtual

Definition at line 33 of file MuonTrackProducer.cc.

33  {
34 }

Member Function Documentation

void MuonTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 36 of file MuonTrackProducer.cc.

References reco::TrackBase::appendHitPattern(), reco::MuonSegmentMatch::BelongsToTrackByDR, reco::MuonSegmentMatch::BestInChamberByDR, relativeConstraints::chamber, CSCDetId::chamber(), TrackingRecHit::clone(), MuonSubdetId::CSC, cscSegmentCollectionH_, MuonSubdetId::DT, dtSegmentCollectionH_, CSCDetId::endcap(), makeMuonMisalignmentScenario::endcap, edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), DTRecSegment4D::hasPhi(), DTRecSegment4D::hasZed(), hfClusterShapes_cfi::hits, training_settings::idx, diffTreeTool::index, reco::Track::innerDetId(), reco::Track::innerMomentum(), reco::Track::innerOk(), reco::Track::innerPosition(), reco::Track::innerStateCovariance(), inputCSCSegmentToken_, inputDTRecSegment4DToken_, muon::isGoodMuon(), edm::Ref< C, T, F >::key(), eostools::move(), metsig::muon, muonCollectionH, muonsToken, reco::Track::outerDetId(), reco::Track::outerMomentum(), reco::Track::outerOk(), reco::Track::outerPosition(), reco::Track::outerStateCovariance(), DTRecSegment4D::phiSegment(), edm::Event::put(), CSCSegment::recHits(), DTRecSegment2D::recHits(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), relativeConstraints::ring, CSCDetId::ring(), DTChamberId::sector(), reco::Track::seedDirection(), reco::Muon::SegmentAndTrackArbitration, trackingPlots::selectedTracks, selectionTags, muon::selectionTypeFromString(), reco::Track::setExtra(), reco::TrackExtraBase::setHits(), mathSSE::sqrt(), DTChamberId::station(), relativeConstraints::station, CSCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, trackType, DTChamberId::wheel(), makeMuonMisalignmentScenario::wheel, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

37 {
41 
43  iSetup.get<TrackerTopologyRcd>().get(httopo);
44  const TrackerTopology& ttopo = *httopo;
45 
46  std::unique_ptr<reco::TrackCollection> selectedTracks(new reco::TrackCollection);
47  std::unique_ptr<reco::TrackExtraCollection> selectedTrackExtras( new reco::TrackExtraCollection() );
48  std::unique_ptr<TrackingRecHitCollection> selectedTrackHits( new TrackingRecHitCollection() );
49 
53 
56 
57  edm::LogVerbatim("MuonTrackProducer") <<"\nThere are "<< dtSegmentCollectionH_->size()<<" DT segments.";
58  unsigned int index_dt_segment = 0;
60  segment != dtSegmentCollectionH_->end(); ++segment , index_dt_segment++) {
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();
66  DTChamberId dtdetid = DTChamberId(geoid);
67  int wheel = dtdetid.wheel();
68  int station = dtdetid.station();
69  int sector = dtdetid.sector();
70 
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());
79 
80  edm::LogVerbatim("MuonTrackProducer")
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<<")";
85  }
86 
87  edm::LogVerbatim("MuonTrackProducer") <<"\nThere are "<< cscSegmentCollectionH_->size()<<" CSC segments.";
88  unsigned int index_csc_segment = 0;
90  segment != cscSegmentCollectionH_->end(); ++segment , index_csc_segment++) {
91  LocalPoint segmentLocalPosition = segment->localPosition();
92  LocalVector segmentLocalDirection = segment->localDirection();
93  LocalError segmentLocalPositionError = segment->localPositionError();
94  LocalError segmentLocalDirectionError = segment->localDirectionError();
95 
96  DetId geoid = segment->geographicalId();
97  CSCDetId cscdetid = CSCDetId(geoid);
98  int endcap = cscdetid.endcap();
99  int station = cscdetid.station();
100  int ring = cscdetid.ring();
101  int chamber = cscdetid.chamber();
102 
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());
111 
112  edm::LogVerbatim("MuonTrackProducer")
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<<")";
117  }
118 
119  edm::LogVerbatim("MuonTrackProducer") <<"\nThere are "<< muonCollectionH->size() <<" reco::Muons.";
120  unsigned int muon_index = 0;
121  for(reco::MuonCollection::const_iterator muon = muonCollectionH->begin();
122  muon != muonCollectionH->end(); ++muon, muon_index++) {
123  edm::LogVerbatim("MuonTrackProducer") <<"\n******* muon index : "<<muon_index;
124 
125  std::vector<bool> isGood;
126  for(unsigned int index=0; index<selectionTags.size(); ++index) {
127  isGood.push_back(false);
128 
130  isGood[index] = muon::isGoodMuon(*muon, muonType);
131  }
132 
133  bool isGoodResult=true;
134  for(unsigned int index=0; index<isGood.size(); ++index) {
135  edm::LogVerbatim("MuonTrackProducer") << "selectionTag = "<<selectionTags[index]<< ": "<<isGood[index]<<"\n";
136  isGoodResult *= isGood[index];
137  }
138 
139  if (isGoodResult) {
140  // new copy of Track
141  reco::TrackRef trackref;
142  if (trackType == "innerTrack") {
143  if (muon->innerTrack().isNonnull()) trackref = muon->innerTrack();
144  else continue;
145  }
146  else if (trackType == "outerTrack") {
147  if (muon->outerTrack().isNonnull()) trackref = muon->outerTrack();
148  else continue;
149  }
150  else if (trackType == "globalTrack") {
151  if (muon->globalTrack().isNonnull()) trackref = muon->globalTrack();
152  else continue;
153  }
154  else if (trackType == "innerTrackPlusSegments") {
155  if (muon->innerTrack().isNonnull()) trackref = muon->innerTrack();
156  else continue;
157  }
158  else if (trackType == "gemMuonTrack") {
159  if (muon->innerTrack().isNonnull() && muon->isGEMMuon()){
160  trackref = muon->innerTrack();
161  }
162  else continue;
163  }
164  else if (trackType == "me0MuonTrack") {
165  if (muon->innerTrack().isNonnull() && muon->isME0Muon()){
166  trackref = muon->innerTrack();
167  }
168  else continue;
169  }
170 
171  const reco::Track* trk = &(*trackref);
172  // pointer to old track:
173  reco::Track* newTrk = new reco::Track(*trk);
174 
175  newTrk->setExtra( reco::TrackExtraRef( rTrackExtras, idx++ ) );
176  PropagationDirection seedDir = trk->seedDirection();
177  // new copy of track Extras
178  reco::TrackExtra * newExtra = new reco::TrackExtra( trk->outerPosition(), trk->outerMomentum(),
179  trk->outerOk(), trk->innerPosition(),
180  trk->innerMomentum(), trk->innerOk(),
181  trk->outerStateCovariance(), trk->outerDetId(),
182  trk->innerStateCovariance(), trk->innerDetId() , seedDir ) ;
183 
184  // new copy of the silicon hits; add hit refs to Extra and hits to hit collection
185 
186  // edm::LogVerbatim("MuonTrackProducer")<<"\n printing initial hit_pattern";
187  // trk->hitPattern().print();
188  unsigned int nHitsToAdd = 0;
189  for (trackingRecHit_iterator iHit = trk->recHitsBegin(); iHit != trk->recHitsEnd(); iHit++) {
190  TrackingRecHit* hit = (*iHit)->clone();
191  selectedTrackHits->push_back( hit );
192  ++nHitsToAdd;
193  }
194  newExtra->setHits( rHits, hidx, nHitsToAdd );
195  hidx += nHitsToAdd;
196  if (trackType == "innerTrackPlusSegments") {
197 
198  int wheel, station, sector;
199  int endcap, /*station, */ ring, chamber;
200 
201  edm::LogVerbatim("MuonTrackProducer") <<"Number of chambers: "<<muon->matches().size()
202  <<", arbitrated: "<<muon->numberOfMatches(reco::Muon::SegmentAndTrackArbitration);
203  unsigned int index_chamber = 0;
204 
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;
209 
210  int subdet = chamberMatch->detector();
211  DetId did = chamberMatch->id;
212 
213  if (subdet == MuonSubdetId::DT) {
214  DTChamberId dtdetid = DTChamberId(did);
215  wheel = dtdetid.wheel();
216  station = dtdetid.station();
217  sector = dtdetid.sector();
218  chamberStr << ", DT chamber Wh:"<<wheel<<",St:"<<station<<",Se:"<<sector;
219  }
220  else if (subdet == MuonSubdetId::CSC) {
221  CSCDetId cscdetid = CSCDetId(did);
222  endcap = cscdetid.endcap();
223  station = cscdetid.station();
224  ring = cscdetid.ring();
225  chamber = cscdetid.chamber();
226  chamberStr << ", CSC chamber End:"<<endcap<<",St:"<<station<<",Ri:"<<ring<<",Ch:"<<chamber;
227  }
228 
229  chamberStr << ", Number of segments: "<<chamberMatch->segmentMatches.size();
230  edm::LogVerbatim("MuonTrackProducer") << chamberStr.str();
231 
232  unsigned int index_segment = 0;
233 
234  for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
235  segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch, index_segment++) {
236 
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;
245 
246  CSCSegmentRef segmentCSC = segmentMatch->cscSegmentRef;
247  DTRecSegment4DRef segmentDT = segmentMatch->dtSegmentRef;
248 
249  bool segment_arbitrated_Ok = (segmentMatch->isMask(reco::MuonSegmentMatch::BestInChamberByDR) &&
250  segmentMatch->isMask(reco::MuonSegmentMatch::BelongsToTrackByDR));
251 
252  std::string ARBITRATED(" ***Arbitrated Off*** ");
253  if (segment_arbitrated_Ok) ARBITRATED = " ***ARBITRATED OK*** ";
254 
255  if (subdet == MuonSubdetId::DT) {
256  edm::LogVerbatim("MuonTrackProducer")
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<<")";
260 
261  if (!segment_arbitrated_Ok) continue;
262 
263  if (segmentDT.get() != 0) {
264  const DTRecSegment4D* segment = segmentDT.get();
265 
266  edm::LogVerbatim("MuonTrackProducer")<<"\t ===> MATCHING with DT segment with index = "<<segmentDT.key();
267 
268  if(segment->hasPhi()) {
269  const DTChamberRecSegment2D* phiSeg = segment->phiSegment();
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) {
274  TrackingRecHit* seghit = (*ihit)->clone();
275  newTrk->appendHitPattern(*seghit, ttopo);
276  // edm::LogVerbatim("MuonTrackProducer")<<"hit pattern for position "<<index_hit<<" set to:";
277  // newTrk->hitPattern().printHitPattern(index_hit, std::cout);
278  selectedTrackHits->push_back( seghit );
279  ++nHitsAdded;
280  }
281  newExtra->setHits( rHits, hidx, nHitsAdded );
282  hidx += nHitsAdded;
283  }
284 
285  if(segment->hasZed()) {
286  const DTSLRecSegment2D* zSeg = (*segment).zSegment();
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) {
291  TrackingRecHit* seghit = (*ihit)->clone();
292  newTrk->appendHitPattern(*seghit, ttopo);
293  // edm::LogVerbatim("MuonTrackProducer")<<"hit pattern for position "<<index_hit<<" set to:";
294  // newTrk->hitPattern().printHitPattern(index_hit, std::cout);
295  selectedTrackHits->push_back( seghit );
296  ++nHitsAdded;
297  }
298  newExtra->setHits( rHits, hidx, nHitsAdded );
299  hidx += nHitsAdded;
300  }
301  } else edm::LogWarning("MuonTrackProducer")<<"\n***WARNING: UNMATCHED DT segment ! \n";
302  } // if (subdet == MuonSubdetId::DT)
303 
304  else if (subdet == MuonSubdetId::CSC) {
305  edm::LogVerbatim("MuonTrackProducer")
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<<")";
309 
310  if (!segment_arbitrated_Ok) continue;
311 
312  if (segmentCSC.get() != 0) {
313  const CSCSegment* segment = segmentCSC.get();
314 
315  edm::LogVerbatim("MuonTrackProducer")<<"\t ===> MATCHING with CSC segment with index = "<<segmentCSC.key();
316 
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) {
321  TrackingRecHit* seghit = (*ihit)->clone();
322  newTrk->appendHitPattern(*seghit, ttopo);
323  // edm::LogVerbatim("MuonTrackProducer")<<"hit pattern for position "<<index_hit<<" set to:";
324  // newTrk->hitPattern().printHitPattern(index_hit, std::cout);
325  selectedTrackHits->push_back( seghit );
326  ++nHitsAdded;
327  }
328  newExtra->setHits( rHits, hidx, nHitsAdded );
329  hidx += nHitsAdded;
330  } else edm::LogWarning("MuonTrackProducer")<<"\n***WARNING: UNMATCHED CSC segment ! \n";
331  } // else if (subdet == MuonSubdetId::CSC)
332 
333  } // loop on vector<MuonSegmentMatch>
334  } // loop on vector<MuonChamberMatch>
335  } // if (trackType == "innerTrackPlusSegments")
336 
337  // edm::LogVerbatim("MuonTrackProducer")<<"\n printing final hit_pattern";
338  // newTrk->hitPattern().print();
339 
340  selectedTracks->push_back( *newTrk );
341  selectedTrackExtras->push_back( *newExtra );
342 
343  } // if (isGoodResult)
344  } // loop on reco::MuonCollection
345 
346  iEvent.put(std::move(selectedTracks));
347  iEvent.put(std::move(selectedTrackExtras));
348  iEvent.put(std::move(selectedTrackHits));
349 }
int chamber() const
Definition: CSCDetId.h:68
float xx() const
Definition: LocalError.h:24
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
edm::EDGetTokenT< DTRecSegment4DCollection > inputDTRecSegment4DToken_
std::vector< std::string > selectionTags
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
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
Definition: TrackFwd.h:14
T y() const
Definition: PV3DBase.h:63
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:50
PropagationDirection
key_type key() const
Accessor for product key.
Definition: Ref.h:264
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
SelectionType
Selector type.
Definition: MuonSelectors.h:17
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
int endcap() const
Definition: CSCDetId.h:93
static const int CSC
Definition: MuonSubdetId.h:13
edm::Handle< CSCSegmentCollection > cscSegmentCollectionH_
float yy() const
Definition: LocalError.h:26
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
T sqrt(T t)
Definition: SSEVec.h:18
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:75
T z() const
Definition: PV3DBase.h:64
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.
Definition: Track.h:94
static const unsigned int BestInChamberByDR
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
bool hasPhi() const
Does it have the Phi projection?
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
Definition: CSCSegment.cc:30
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
int ring() const
Definition: CSCDetId.h:75
bool hasZed() const
Does it have the Z projection?
Definition: DetId.h:18
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
Definition: Track.h:184
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:45
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:204
SelectionType selectionTypeFromString(const std::string &label)
Definition: MuonSelectors.cc:9
edm::Handle< reco::MuonCollection > muonCollectionH
const T & get() const
Definition: EventSetup.h:56
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:80
bool appendHitPattern(const TrackingRecHit &hit, const TrackerTopology &ttopo)
append a single hit to the HitPattern
Definition: TrackBase.h:455
static const unsigned int BelongsToTrackByDR
int sector() const
Definition: DTChamberId.h:61
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
int station() const
Definition: CSCDetId.h:86
static const int DT
Definition: MuonSubdetId.h:12
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
T x() const
Definition: PV3DBase.h:62
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:99
edm::EDGetTokenT< CSCSegmentCollection > inputCSCSegmentToken_
def move(src, dest)
Definition: eostools.py:510
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:168
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.
Definition: Track.h:109

Member Data Documentation

edm::Handle<CSCSegmentCollection> MuonTrackProducer::cscSegmentCollectionH_
private

Definition at line 27 of file MuonTrackProducer.h.

Referenced by produce().

edm::Handle<DTRecSegment4DCollection> MuonTrackProducer::dtSegmentCollectionH_
private

Definition at line 26 of file MuonTrackProducer.h.

Referenced by produce().

edm::EDGetTokenT<CSCSegmentCollection> MuonTrackProducer::inputCSCSegmentToken_
private

Definition at line 31 of file MuonTrackProducer.h.

Referenced by produce().

edm::EDGetTokenT<DTRecSegment4DCollection> MuonTrackProducer::inputDTRecSegment4DToken_
private

Definition at line 30 of file MuonTrackProducer.h.

Referenced by produce().

edm::Handle<reco::MuonCollection> MuonTrackProducer::muonCollectionH
private

Definition at line 25 of file MuonTrackProducer.h.

Referenced by produce().

edm::EDGetTokenT<reco::MuonCollection> MuonTrackProducer::muonsToken
private

Definition at line 29 of file MuonTrackProducer.h.

Referenced by produce().

const edm::ParameterSet MuonTrackProducer::parset_
private

Definition at line 35 of file MuonTrackProducer.h.

Referenced by MuonTrackProducer().

std::vector<std::string> MuonTrackProducer::selectionTags
private

Definition at line 33 of file MuonTrackProducer.h.

Referenced by produce().

std::string MuonTrackProducer::trackType
private

Definition at line 34 of file MuonTrackProducer.h.

Referenced by produce().