|
|
Definition at line 77 of file CosmicTrackSplitter.cc.
◆ CosmicTrackSplitter()
reco::modules::CosmicTrackSplitter::CosmicTrackSplitter |
( |
const edm::ParameterSet & |
iConfig | ) |
|
Definition at line 110 of file CosmicTrackSplitter.cc.
122 throw cms::Exception(
"Configuration") <<
"Inconsistent Configuration: you can't set both 'stripAllInvalidHits' "
123 "and 'replaceWithInactiveHits' to true\n";
128 tokenGeometry = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
129 tokenMagField = esConsumes<MagneticField, IdealMagneticFieldRecord>();
131 LogDebug(
"CosmicTrackSplitter") <<
"sanity check";
139 produces<TrackCandidateCollection>();
References detsToIgnore_, Exception, edm::ParameterSet::getParameter(), LogDebug, replaceWithInactiveHits_, jetUpdater_cfi::sort, stripAllInvalidHits_, tokenGeometry, tokenMagField, tokenTracks, tokenTrajTrack, and totalTracks_.
◆ makeCandidate()
Definition at line 385 of file CosmicTrackSplitter.cc.
388 LogDebug(
"CosmicTrackSplitter") <<
"Making a candidate!";
393 throw cms::Exception(
"UnimplementedFeature") <<
"Cannot work with tracks that have 'anyDirecton' \n";
410 ownHits.
reserve(hitsEnd - hitsBegin);
411 for (; hitsBegin != hitsEnd; ++hitsBegin) {
418 LogDebug(
"CosmicTrackSplitter") <<
" dumping the hits now: ";
419 for (
auto const &
hit :
cand.recHits()) {
420 LogTrace(
"CosmicTrackSplitter") <<
" hit detid = " <<
hit.geographicalId().rawId()
421 <<
", type = " <<
typeid(
hit).
name();
References alongMomentum, anyDirection, Exception, reco::Track::innerDetId(), reco::Track::innerPosition(), trajectoryStateTransform::innerStateOnSurface(), LogDebug, LogTrace, reco::TrackBase::momentum(), Skims_PA_cff::name, reco::Track::outerDetId(), reco::Track::outerPosition(), trajectoryStateTransform::outerStateOnSurface(), trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), edm::OwnVector< T, P >::reserve(), fileCollector::seed, reco::Track::seedDirection(), reco::Track::seedRef(), theGeometry, and theMagField.
Referenced by produce().
◆ produce()
Definition at line 142 of file CosmicTrackSplitter.cc.
143 LogDebug(
"CosmicTrackSplitter") <<
"IN THE SPLITTER!!!!!";
160 auto output = std::make_unique<TrackCandidateCollection>();
164 std::vector<TrackingRecHit *>
hits;
168 LogDebug(
"CosmicTrackSplitter") <<
"size of map: " << m_TrajTracksMap->
size();
169 int HITTOSPLITFROM = 0;
171 iPair != m_TrajTracksMap->
end();
173 const Trajectory *trajFromMap = &(*(*iPair).key);
174 const reco::Track *trackFromMap = &(*(*iPair).val);
177 std::vector<TrajectoryMeasurement> measurements = trajFromMap->
measurements();
178 int totalNumberOfHits = measurements.size();
179 int numberOfHits = 0;
180 double previousDotProduct = 0;
183 GlobalVector stateMomentum = measurements[numberOfHits].forwardPredictedState().globalMomentum();
184 GlobalPoint statePosition = measurements[numberOfHits].forwardPredictedState().globalPosition();
185 double dotProduct = stateMomentum.
x() * statePosition.
x() + stateMomentum.
y() * statePosition.
y();
186 if (dotProduct * previousDotProduct < 0) {
188 HITTOSPLITFROM = numberOfHits;
191 previousDotProduct = dotProduct;
194 LogDebug(
"CosmicTrackSplitter") <<
"number of rechits: " << numberOfHits;
228 GlobalPoint bPosState = measurements[0].updatedState().globalPosition();
229 GlobalPoint fPosState = measurements[measurements.size() - 1].updatedState().globalPosition();
230 bool trajReversedFlag =
false;
240 if (((bPosHit - bPosState).
mag() > (bPosHit - fPosState).
mag()) &&
241 ((fPosHit - fPosState).
mag() > (fPosHit - bPosState).
mag())) {
242 trajReversedFlag =
true;
244 if (trajReversedFlag) {
245 int temp = HITTOSPLITFROM;
246 HITTOSPLITFROM = totalNumberOfHits -
temp;
252 for (std::vector<reco::Track>::const_iterator itt =
tracks->begin(), edt =
tracks->end(); itt != edt; ++itt) {
261 bool continueWithTrack =
true;
263 continueWithTrack =
false;
265 continueWithTrack =
false;
266 if (continueWithTrack ==
false)
270 for (
int i = 0;
i < 2; ++
i) {
272 LogDebug(
"CosmicTrackSplitter") <<
" loop on hits of track #" << (itt -
tracks->begin());
278 LogDebug(
"CosmicTrackSplitter") <<
" hit number " << (ith - itt->recHitsBegin());
280 if (
hit->isValid()) {
281 LogDebug(
"CosmicTrackSplitter") <<
" valid, detid = " <<
hit->geographicalId().rawId();
282 DetId detid =
hit->geographicalId();
285 LogDebug(
"CosmicTrackSplitter") <<
" valid, tracker ";
286 bool verdict =
false;
292 LogDebug(
"CosmicTrackSplitter") <<
"hit pos: " <<
pos <<
", dca pos: " <<
v;
295 if ((
i == 0) && (hitCtr < HITTOSPLITFROM)) {
297 LogDebug(
"CosmicTrackSplitter") <<
"tophalf";
300 if ((
i == 1) && (hitCtr >= HITTOSPLITFROM)) {
302 LogDebug(
"CosmicTrackSplitter") <<
"bottomhalf";
319 <<
" verdict after module list: " << (verdict ?
"ok" :
"no");
320 if (verdict ==
true) {
338 LogDebug(
"CosmicTrackSplitter") <<
" end of hit " << (ith - itt->recHitsBegin());
341 LogDebug(
"CosmicTrackSplitter") <<
" end of loop on hits of track #" << (itt -
tracks->begin());
343 std::vector<TrackingRecHit *>::iterator begin =
hits.begin(),
end =
hits.end();
345 LogDebug(
"CosmicTrackSplitter") <<
" selected " <<
hits.size() <<
" hits ";
349 while ((begin !=
end) && ((*begin)->isValid() ==
false))
353 LogDebug(
"CosmicTrackSplitter") <<
" after front stripping we have " << (
end - begin) <<
" hits ";
358 while ((begin !=
end) && ((*end)->isValid() ==
false))
363 LogDebug(
"CosmicTrackSplitter") <<
" after back stripping we have " << (
end - begin) <<
" hits ";
369 LogDebug(
"CosmicTrackSplitter") <<
"we made a candidate of " <<
hits.size() <<
" hits!";
372 for (begin =
hits.begin(),
end =
hits.end(); begin !=
end; ++begin) {
377 <<
"loop: " <<
i <<
" has " << usedHitCtr <<
" active hits and " <<
hits.size() <<
" total hits...";
References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, DetId::det(), detsToIgnore_, dXYcut_, dZcut_, edm::AssociationMap< Tag >::end(), mps_fire::end, excludePixelHits_, TrackingRecHit::geographicalId(), edm::EventSetup::getHandle(), hfClusterShapes_cfi::hits, mps_fire::i, TrackerGeometry::idToDetUnit(), iEvent, TrackingRecHit::inactive, TrackingRecHit::isValid(), TrackingRecHit::localPosition(), LogDebug, mag(), makeCandidate(), Trajectory::measurements(), minimumHits_, eostools::move(), convertSQLitetoXML_cfg::output, DetId::rawId(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), replaceWithInactiveHits_, edm::AssociationMap< Tag >::size(), stripAllInvalidHits_, stripBackInvalidHits_, stripFrontInvalidHits_, DetId::subdetId(), GeomDet::surface(), groupFilesInBlocks::temp, theGeometry, theMagField, Surface::toGlobal(), tokenGeometry, tokenMagField, tokenTracks, tokenTrajTrack, totalTracks_, DetId::Tracker, tracks, TrackingRecHit::type(), and findQualityFiles::v.
◆ detsToIgnore_
std::vector<uint32_t> reco::modules::CosmicTrackSplitter::detsToIgnore_ |
|
private |
◆ dXYcut_
double reco::modules::CosmicTrackSplitter::dXYcut_ |
|
private |
◆ dZcut_
double reco::modules::CosmicTrackSplitter::dZcut_ |
|
private |
◆ excludePixelHits_
bool reco::modules::CosmicTrackSplitter::excludePixelHits_ |
|
private |
◆ minimumHits_
size_t reco::modules::CosmicTrackSplitter::minimumHits_ |
|
private |
◆ replaceWithInactiveHits_
bool reco::modules::CosmicTrackSplitter::replaceWithInactiveHits_ |
|
private |
◆ stripAllInvalidHits_
bool reco::modules::CosmicTrackSplitter::stripAllInvalidHits_ |
|
private |
◆ stripBackInvalidHits_
bool reco::modules::CosmicTrackSplitter::stripBackInvalidHits_ |
|
private |
◆ stripFrontInvalidHits_
bool reco::modules::CosmicTrackSplitter::stripFrontInvalidHits_ |
|
private |
◆ theGeometry
◆ theMagField
◆ tokenGeometry
◆ tokenMagField
◆ tokenTracks
◆ tokenTrajTrack
◆ totalTracks_
int reco::modules::CosmicTrackSplitter::totalTracks_ |
|
private |
const math::XYZPoint & outerPosition() const
position of the outermost hit
edm::ESHandle< TrackerGeometry > theGeometry
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
edm::EDGetTokenT< reco::TrackCollection > tokenTracks
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
constexpr Detector det() const
get the detector field from this detid
bool stripBackInvalidHits_
virtual LocalPoint localPosition() const =0
DetId geographicalId() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tokenGeometry
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const_iterator end() const
last iterator over the map (read only)
const Plane & surface() const
The nominal surface of the GeomDet.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tokenMagField
edm::EDGetTokenT< TrajTrackAssociationCollection > tokenTrajTrack
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
edm::ESHandle< MagneticField > theMagField
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
bool stripAllInvalidHits_
friend struct const_iterator
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
size_type size() const
map size
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
const math::XYZPoint & innerPosition() const
position of the innermost hit
bool replaceWithInactiveHits_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
DataContainer const & measurements() const
bool stripFrontInvalidHits_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
constexpr uint32_t rawId() const
get the raw id
const edm::RefToBase< TrajectorySeed > & seedRef() const
const_iterator begin() const
first iterator over the map (read only)
T getParameter(std::string const &) const
const Vector & momentum() const
track momentum vector
std::vector< uint32_t > detsToIgnore_
TrackCandidate makeCandidate(const reco::Track &tk, std::vector< TrackingRecHit * >::iterator hitsBegin, std::vector< TrackingRecHit * >::iterator hitsEnd)