CMS 3D CMS Logo

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

#include <SegmentToTrackAssociator.h>

Public Types

typedef std::vector< std::vector< int > > intDVector
 

Public Member Functions

MuonTransientTrackingRecHit::MuonRecHitContainer associate (const edm::Event &, const edm::EventSetup &, const reco::Track &, std::string)
 
void clear ()
 
 SegmentToTrackAssociator (const edm::ParameterSet &)
 
virtual ~SegmentToTrackAssociator ()
 

Private Attributes

intDVector indexCollectionCSC
 
intDVector indexCollectionDT
 
edm::InputTag theCSCSegmentLabel
 
edm::InputTag theDTSegmentLabel
 

Detailed Description

Definition at line 29 of file SegmentToTrackAssociator.h.

Member Typedef Documentation

◆ intDVector

typedef std::vector<std::vector<int> > SegmentToTrackAssociator::intDVector

Definition at line 31 of file SegmentToTrackAssociator.h.

Constructor & Destructor Documentation

◆ SegmentToTrackAssociator()

SegmentToTrackAssociator::SegmentToTrackAssociator ( const edm::ParameterSet iConfig)

Definition at line 35 of file SegmentToTrackAssociator.cc.

35  {
36  theDTSegmentLabel = iConfig.getParameter<edm::InputTag>("segmentsDT");
37  theCSCSegmentLabel = iConfig.getParameter<edm::InputTag>("segmentsCSC");
38 }

References edm::ParameterSet::getParameter(), theCSCSegmentLabel, and theDTSegmentLabel.

◆ ~SegmentToTrackAssociator()

SegmentToTrackAssociator::~SegmentToTrackAssociator ( )
virtual

Definition at line 40 of file SegmentToTrackAssociator.cc.

40 {}

Member Function Documentation

◆ associate()

MuonTransientTrackingRecHit::MuonRecHitContainer SegmentToTrackAssociator::associate ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const reco::Track track,
std::string  TrackRefitterType 
)

Definition at line 47 of file SegmentToTrackAssociator.cc.

50  {
51  // The segment collections
53  iEvent.getByLabel(theDTSegmentLabel, DTSegments);
54 
56  iEvent.getByLabel(theCSCSegmentLabel, CSCSegments);
57 
58  edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
59  iSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
60 
62 
65 
66  std::vector<int> positionDT;
67  std::vector<int> positionCSC;
68  std::vector<TrackingRecHit*> my4DTrack;
69 
70  //Loop over the hits of the track
71  for (unsigned int counter = 0; counter != track.recHitsSize() - 1; counter++) {
72  TrackingRecHitRef myRef = track.recHit(counter);
73 
74  const TrackingRecHit* rechit = myRef.get();
75  const GeomDet* geomDet = theTrackingGeometry->idToDet(rechit->geographicalId());
76 
77  //It's a DT Hit
78  if (geomDet->subDetector() == GeomDetEnumerators::DT) {
79  //Take the layer associated to this hit
80  DTLayerId myLayer(rechit->geographicalId().rawId());
81 
82  int NumberOfDTSegment = 0;
83  //Loop over segments
84  for (segmentDT = DTSegments->begin(); segmentDT != DTSegments->end(); ++segmentDT) {
85  //By default the chamber associated to this Segment is new
86  bool isNewChamber = true;
87 
88  //Loop over segments already included in the vector of segments in the actual track
89  for (std::vector<int>::iterator positionIt = positionDT.begin(); positionIt != positionDT.end(); positionIt++) {
90  //If this segment has been used before isNewChamber = false
91  if (NumberOfDTSegment == *positionIt)
92  isNewChamber = false;
93  }
94 
95  //Loop over vectors of segments associated to previous tracks
96  for (std::vector<std::vector<int> >::iterator collect = indexCollectionDT.begin();
97  collect != indexCollectionDT.end();
98  ++collect) {
99  //Loop over segments associated to a track
100  for (std::vector<int>::iterator positionIt = (*collect).begin(); positionIt != (*collect).end();
101  positionIt++) {
102  //If this segment was used in a previos track then isNewChamber = false
103  if (NumberOfDTSegment == *positionIt)
104  isNewChamber = false;
105  }
106  }
107 
108  //If the chamber is new
109  if (isNewChamber) {
110  DTChamberId myChamber((*segmentDT).geographicalId().rawId());
111  //If the layer of the hit belongs to the chamber of the 4D Segment
112  if (myLayer.wheel() == myChamber.wheel() && myLayer.station() == myChamber.station() &&
113  myLayer.sector() == myChamber.sector()) {
114  //push position of the segment and tracking rechit
115  positionDT.push_back(NumberOfDTSegment);
116  const GeomDet* DTgeomDet = theTrackingGeometry->idToDet(myChamber);
117  SelectedSegments.push_back(
119 
120  //edm::LogWarning("Alignment") << "TagSeg: " << "NumberOfDTSegment " << NumberOfDTSegment << " Wheel " << myChamber.wheel() << " Sector " << myChamber.sector() << " Chamber " << myChamber.station() << std::endl;
121  }
122  }
123  NumberOfDTSegment++;
124  }
125  //In case is a CSC
126  } else if (geomDet->subDetector() == GeomDetEnumerators::CSC) {
127  //Take the layer associated to this hit
128  CSCDetId myLayer(rechit->geographicalId().rawId());
129 
130  int NumberOfCSCSegment = 0;
131  //Loop over 4Dsegments
132  for (segmentCSC = CSCSegments->begin(); segmentCSC != CSCSegments->end(); segmentCSC++) {
133  //By default the chamber associated to the segment is new
134  bool isNewChamber = true;
135  //Loop over segments in the current track
136  for (std::vector<int>::iterator positionIt = positionCSC.begin(); positionIt != positionCSC.end();
137  positionIt++) {
138  //If this segment has been used then newchamber = false
139  if (NumberOfCSCSegment == *positionIt)
140  isNewChamber = false;
141  }
142  //Loop over vectors of segments in previous tracks
143  for (std::vector<std::vector<int> >::iterator collect = indexCollectionCSC.begin();
144  collect != indexCollectionCSC.end();
145  ++collect) {
146  //Loop over segments in a track
147  for (std::vector<int>::iterator positionIt = (*collect).begin(); positionIt != (*collect).end();
148  positionIt++) {
149  //If the segment was used in a previous track isNewChamber = false
150  if (NumberOfCSCSegment == *positionIt)
151  isNewChamber = false;
152  }
153  }
154  //If the chamber is new
155  if (isNewChamber) {
156  CSCDetId myChamber((*segmentCSC).geographicalId().rawId());
157  //If the chambers are the same
158  if (myLayer.chamberId() == myChamber.chamberId()) {
159  //push
160  positionCSC.push_back(NumberOfCSCSegment);
161  const GeomDet* CSCgeomDet = theTrackingGeometry->idToDet(myChamber);
162  SelectedSegments.push_back(
163  MuonTransientTrackingRecHit::specificBuild(CSCgeomDet, (TrackingRecHit*)&*segmentCSC));
164  }
165  }
166  NumberOfCSCSegment++;
167  }
168  }
169  }
170 
171  indexCollectionDT.push_back(positionDT);
172  indexCollectionCSC.push_back(positionCSC);
173 
174  if (TrackRefitterType == "CosmicLike") {
176  }
177 
178  return SelectedSegments;
179 }

References GeomDetEnumerators::CSC, GeomDetEnumerators::DT, TrackingRecHit::geographicalId(), edm::EventSetup::get(), get, edm::Ref< C, T, F >::get(), GlobalTrackingGeometry::idToDet(), iEvent, indexCollectionCSC, indexCollectionDT, DetId::rawId(), groupFilesInBlocks::reverse, segmentTrackAnalyzer_cfi::SelectedSegments, MuonTransientTrackingRecHit::specificBuild(), GeomDet::subDetector(), theCSCSegmentLabel, theDTSegmentLabel, HLT_FULL_cff::track, and trackerHitRTTI::vector.

Referenced by SequenceTypes._ModuleSequenceType::remove(), and SequenceTypes._ModuleSequenceType::replace().

◆ clear()

void SegmentToTrackAssociator::clear ( )

Definition at line 42 of file SegmentToTrackAssociator.cc.

42  {
43  indexCollectionDT.clear();
44  indexCollectionCSC.clear();
45 }

References indexCollectionCSC, and indexCollectionDT.

Referenced by BeautifulSoup.Tag::setString().

Member Data Documentation

◆ indexCollectionCSC

intDVector SegmentToTrackAssociator::indexCollectionCSC
private

Definition at line 50 of file SegmentToTrackAssociator.h.

Referenced by associate(), and clear().

◆ indexCollectionDT

intDVector SegmentToTrackAssociator::indexCollectionDT
private

Definition at line 49 of file SegmentToTrackAssociator.h.

Referenced by associate(), and clear().

◆ theCSCSegmentLabel

edm::InputTag SegmentToTrackAssociator::theCSCSegmentLabel
private

Definition at line 53 of file SegmentToTrackAssociator.h.

Referenced by associate(), and SegmentToTrackAssociator().

◆ theDTSegmentLabel

edm::InputTag SegmentToTrackAssociator::theDTSegmentLabel
private

Definition at line 52 of file SegmentToTrackAssociator.h.

Referenced by associate(), and SegmentToTrackAssociator().

counter
Definition: counter.py:1
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
MuonTransientTrackingRecHit::specificBuild
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
Definition: MuonTransientTrackingRecHit.h:75
GeomDet
Definition: GeomDet.h:27
SegmentToTrackAssociator::indexCollectionCSC
intDVector indexCollectionCSC
Definition: SegmentToTrackAssociator.h:50
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
MuonTransientTrackingRecHit::MuonRecHitContainer
std::vector< MuonRecHitPointer > MuonRecHitContainer
Definition: MuonTransientTrackingRecHit.h:26
edm::Handle< DTRecSegment4DCollection >
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
groupFilesInBlocks.reverse
reverse
Definition: groupFilesInBlocks.py:131
edm::Ref
Definition: AssociativeIterator.h:58
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
edm::ESHandle< GlobalTrackingGeometry >
DTLayerId
Definition: DTLayerId.h:12
GeomDetEnumerators::CSC
Definition: GeomDetEnumerators.h:17
segmentTrackAnalyzer_cfi.SelectedSegments
SelectedSegments
Definition: segmentTrackAnalyzer_cfi.py:13
GeomDetEnumerators::DT
Definition: GeomDetEnumerators.h:18
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
CSCDetId
Definition: CSCDetId.h:26
iEvent
int iEvent
Definition: GenABIO.cc:224
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
get
#define get
TrackingRecHit
Definition: TrackingRecHit.h:21
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SegmentToTrackAssociator::indexCollectionDT
intDVector indexCollectionDT
Definition: SegmentToTrackAssociator.h:49
DTChamberId
Definition: DTChamberId.h:14
SegmentToTrackAssociator::theCSCSegmentLabel
edm::InputTag theCSCSegmentLabel
Definition: SegmentToTrackAssociator.h:53
edm::InputTag
Definition: InputTag.h:15
GeomDet::subDetector
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:38
SegmentToTrackAssociator::theDTSegmentLabel
edm::InputTag theDTSegmentLabel
Definition: SegmentToTrackAssociator.h:52