|
ATLAS Offline Software
|
#include <EventHandler.h>
|
void | createExtendedTracks () |
| create extended tracks for event More...
|
|
void | createExtendedTruthTracks () |
| create extended tracks for event More...
|
|
void | createExtendedSegments () |
| create extended segments for event More...
|
|
void | createExtendedRawHits () |
| create extend raw hits More...
|
|
void | associateSegmentsWithTracks (SegmentVec &segments, TrackVec &tracks) |
| create association between tracks and segments More...
|
|
int | associateSegmentWithTrack (const MuonCalibExtendedSegment &segment, const MuonCalibExtendedTrack &track) |
| check whether segment and track share the same hits More...
|
|
int | segmentOverlap (const MuonCalibExtendedSegment &segment1, const MuonCalibExtendedSegment &segment2) |
| check whether segments share the same hits More...
|
|
void | linkTracks (int referenceIndex) |
| link tracks to the reference track using the hits on the track More...
|
|
void | match (const MuonCalibExtendedTrack &reference, TrackVec &tracks) |
| find best match of tracks with reference More...
|
|
template<typename T > |
void | split_along_barcode (const std::vector< T > &container, std::map< int, std::set< T >> &barcode_map) |
| Spltis the truth hit container into a map having the barcode of the particle as key. More...
|
|
std::shared_ptr< MuonCalibTrack_E > | transform_to_trk (const TruthPtr &truth_part, const std::map< int, std::set< TruthMdtPtr >> &mdt_hits, const std::map< int, std::set< TruthCscPtr >> &csc_hits, const std::map< int, std::set< TruthRpcPtr >> &rpc_hits, const std::map< int, std::set< TruthTgcPtr >> &tgc_hits) |
|
Definition at line 23 of file EventHandler.h.
◆ AuthorSegmentVecCit
◆ AuthorSegmentVecIt
◆ AuthorSegmentVecMap
◆ AuthorTrackVecMap
◆ ExtendedSegmentPtr
◆ ExtendedTrackPtr
◆ SegmentVec
◆ TrackVec
◆ TruthCscPtr
◆ TruthMdtPtr
◆ TruthPtr
◆ TruthRpcPtr
◆ TruthTgcPtr
◆ EventHandler()
MuonCalib::EventHandler::EventHandler |
( |
| ) |
|
◆ ~EventHandler()
MuonCalib::EventHandler::~EventHandler |
( |
| ) |
|
◆ associateSegmentsWithTracks()
void MuonCalib::EventHandler::associateSegmentsWithTracks |
( |
SegmentVec & |
segments, |
|
|
TrackVec & |
tracks |
|
) |
| |
|
private |
create association between tracks and segments
helper struct to evaluate the segment match quality
Definition at line 405 of file EventHandler.cxx.
407 struct segmentMatchQual {
409 int assoc_quality{0};
412 if (assoc_quality !=
other.assoc_quality)
return assoc_quality >
other.assoc_quality;
413 return seg->chi2() <
other.seg->chi2();
419 std::vector<segmentMatchQual> segmentTrackMatch;
422 if (
match > 200) { segmentTrackMatch.emplace_back(seg,
match); }
427 for (; mit != mit_end; ++mit) {
429 for (; mit2 != mit_end; ++mit2) {
430 if (
segmentOverlap(*mit->seg, *mit2->seg) > 1) { mit2->vetoed =
true; }
433 std::cout <<
"We need to refine the track to segment association " << __FILE__ <<
" " << __LINE__ << std::endl;
◆ associateSegmentWithTrack()
check whether segment and track share the same hits
Definition at line 487 of file EventHandler.cxx.
488 double minRadius = 1.;
489 unsigned int noppositeSign{0}, nsameSign{0}, nnotOnTrack{0};
491 const MuonFixedId&
id = mdt_hit->identify();
494 log << MSG::WARNING <<
"associateSegmentWithTrack(), invalid MDT id! " <<
endmsg;
498 IdHitMap::const_iterator trkHit =
track.idHitMap().find(
id);
499 if (trkHit !=
track.idHitMap().end()) {
501 double signSeg = mdt_hit->driftRadius() < -minRadius ? -1. : 1.;
502 double signTrk = trkHit->second->driftRadius() < -minRadius ? -1. : 1.;
503 if (signSeg == signTrk)
513 MuonFixedId
id = csc_hit->identify();
516 log << MSG::WARNING <<
"associateSegmentWithTrack(), invalid CSC id! " <<
endmsg;
520 IdHitMap::const_iterator trkHit =
track.idHitMap().find(
id);
521 if (trkHit !=
track.idHitMap().end()) {
529 return nnotOnTrack + 10 * noppositeSign + 100 * nsameSign;
◆ clear()
void MuonCalib::EventHandler::clear |
( |
| ) |
|
◆ createExtendedRawHits()
void MuonCalib::EventHandler::createExtendedRawHits |
( |
| ) |
|
|
private |
◆ createExtendedSegments()
void MuonCalib::EventHandler::createExtendedSegments |
( |
| ) |
|
|
private |
create extended segments for event
Definition at line 388 of file EventHandler.cxx.
395 int author = seg_ptr->author();
399 MuonCalibExtendedSegment* extendedSegment =
new MuonCalibExtendedSegment(*seg_ptr);
400 segVec.emplace_back(extendedSegment);
◆ createExtendedTracks()
void MuonCalib::EventHandler::createExtendedTracks |
( |
| ) |
|
|
private |
create extended tracks for event
Definition at line 181 of file EventHandler.cxx.
190 int author = track_ptr->author();
194 ExtendedTrackPtr extendedTrack = std::make_shared<MuonCalibExtendedTrack>(*track_ptr, 0, 0);
199 previousMooreTrack = extendedTrack;
200 }
else if ((
author == 1 ||
author == 2) && previousMooreTrack) {
201 std::cout <<
"Perform proper track association " << __FILE__ <<
" " << __LINE__ << std::endl;
204 }
else if (
author == 10 && track_ptr->nrHits() == 0) {
207 double dotprodmax = -1.;
208 if (trackVec0.size() > 0) {
209 int trackcount10 = trackVec.size();
213 const MuonCalibExtendedTrack* associatedMooreTrack = 0;
214 for (; it0 != it0_end; ++it0) {
216 if (trackcount10 > trackcount0)
continue;
217 double dotprod = extendedTrack->direction().dot((*it0)->direction());
218 if (extendedTrack->isAssociated(*it0))
continue;
219 if ((*it0)->isAssociated(extendedTrack))
continue;
220 if (dotprod > dotprodmax) {
221 dotprodmax = dotprod;
222 associatedMooreTrack = *it0;
223 if (dotprodmax > 0.8)
break;
226 if (dotprodmax > 0.8 && associatedMooreTrack) {
227 extendedTrack->addAssociatedTrack(associatedMooreTrack);
228 associatedMooreTrack->addAssociatedTrack(extendedTrack);
233 trackVec.push_back(extendedTrack);
◆ createExtendedTruthTracks()
void MuonCalib::EventHandler::createExtendedTruthTracks |
( |
| ) |
|
|
private |
create extended tracks for event
Definition at line 245 of file EventHandler.cxx.
252 const MuonCalibTruthCollection* truth =
m_event->calibTruthCollection();
255 if (truth->TruthContainer().empty())
return;
257 std::map<int, TruthPtr> truthTrkME, truthTrkIP, truthTrkRest;
259 std::map<int, std::set<TruthMdtPtr>> truthTrkMdtHitMap;
260 std::map<int, std::set<TruthCscPtr>> truthTrkCscHitMap;
261 std::map<int, std::set<TruthRpcPtr>> truthTrkRpcHitMap;
262 std::map<int, std::set<TruthTgcPtr>> truthTrkTgcHitMap;
265 for (
const TruthPtr& truth_part : truth->TruthContainer()) {
266 int barcode = truth_part->barCode();
270 if (truth_part->position().perp() < 4000 && std::abs(truth_part->position().z()) < 6000.) {
271 if (truth_part->position().perp() < 100 && std::abs(truth_part->position().z()) < 500.) {
273 truthTrkIP[
barcode] = truth_part;
275 truthTrkRest[
barcode] = truth_part;
279 truthTrkME[
barcode] = truth_part;
288 if (truthTrkMdtHitMap.empty())
return;
305 for (
const auto& it_IP : truthTrkIP) {
306 std::shared_ptr<MuonCalibTrack_E> truth_trk =
307 transform_to_trk(it_IP.second, truthTrkMdtHitMap, truthTrkCscHitMap, truthTrkRpcHitMap, truthTrkTgcHitMap);
309 int pdgcode = it_IP.second->PDGCode();
311 if (std::abs(pdgcode) != 13)
author = -113;
313 std::shared_ptr<MuonCalibExtendedTrack> extendedTrack = std::make_shared<MuonCalibExtendedTrack>(*truth_trk, pdgcode,
barcode);
314 trackVec.push_back(extendedTrack);
316 if (
m_debug) extendedTrack->dump();
319 for (
const auto& it_ME : truthTrkME) {
320 std::shared_ptr<MuonCalibTrack_E> truth_trk =
321 transform_to_trk(it_ME.second, truthTrkMdtHitMap, truthTrkCscHitMap, truthTrkRpcHitMap, truthTrkTgcHitMap);
324 int pdgcode = it_ME.second->PDGCode();
326 if (std::abs(pdgcode) != 13)
author = -1113;
328 std::shared_ptr<MuonCalibExtendedTrack> extendedTrack = std::make_shared<MuonCalibExtendedTrack>(*truth_trk, pdgcode,
barcode);
329 trackVec.push_back(extendedTrack);
331 if (
m_debug) extendedTrack->dump();
◆ dumpEvent()
std::string MuonCalib::EventHandler::dumpEvent |
( |
| ) |
const |
◆ dumpRawHits()
std::string MuonCalib::EventHandler::dumpRawHits |
( |
| ) |
const |
◆ dumpSegments() [1/2]
std::string MuonCalib::EventHandler::dumpSegments |
( |
| ) |
const |
◆ dumpSegments() [2/2]
std::string MuonCalib::EventHandler::dumpSegments |
( |
const SegmentVec & |
segments | ) |
const |
Definition at line 121 of file EventHandler.cxx.
122 std::ostringstream sout;
123 SegmentVec::const_iterator seg = segments.begin();
124 SegmentVec::const_iterator seg_end = segments.end();
125 SegmentVec::const_iterator seg_last = seg_end - 1;
126 for (; seg != seg_end; ++seg) {
127 sout << (*seg)->dump();
128 if (seg != seg_last) sout << std::endl;
◆ dumpTracks() [1/2]
std::string MuonCalib::EventHandler::dumpTracks |
( |
| ) |
const |
Definition at line 153 of file EventHandler.cxx.
154 std::ostringstream sout;
157 if (
it.first == 1 ||
it.first == 2)
continue;
159 sout <<
" Track Author " <<
it.first <<
" number of tracks " <<
it.second.size();
◆ dumpTracks() [2/2]
std::string MuonCalib::EventHandler::dumpTracks |
( |
const TrackVec & |
tracks | ) |
const |
Definition at line 109 of file EventHandler.cxx.
110 std::ostringstream sout;
111 TrackVec::const_iterator trk = tracks.begin();
112 TrackVec::const_iterator trk_end = tracks.end();
113 TrackVec::const_iterator trk_last = trk_end - 1;
114 for (; trk != trk_end; ++trk) {
115 sout << (*trk)->dump();
116 if (trk != trk_last) sout << std::endl;
◆ event()
◆ extendedRawHits()
◆ extendedSegments()
◆ extendedTracks()
◆ linkTracks()
void MuonCalib::EventHandler::linkTracks |
( |
int |
referenceIndex | ) |
|
|
private |
link tracks to the reference track using the hits on the track
Definition at line 532 of file EventHandler.cxx.
542 for (; rit != rit_end; ++rit) {
546 for (; ait != ait_end; ++ait) {
548 if (ait->first == referenceIndex)
continue;
552 match(**rit, tracks);
◆ match()
find best match of tracks with reference
Definition at line 557 of file EventHandler.cxx.
558 const MuonCalibExtendedTrack* bestMatch =
nullptr;
559 MuonCalibExtendedTrackOverlap bestOverlap;
563 for (;
it != it_end; ++
it) {
568 MuonCalibExtendedTrackOverlap overlap =
reference.calculateHitOverlap(**
it);
569 if (overlap.sharedPrecisionHits() > 0) {
570 if (overlap.sharedPrecisionHits() > bestOverlap.sharedPrecisionHits()) {
571 bestMatch =
it->get();
572 bestOverlap = overlap;
577 std::cout <<
" Still need to be done a proper association " << __FILE__ <<
" " << __LINE__ << std::endl;
◆ mooreIndices()
◆ muonboyIndices()
◆ segmentOverlap()
check whether segments share the same hits
Definition at line 441 of file EventHandler.cxx.
443 if (segment1.mdtHitsOnTrack() > 0 && segment2.mdtHitsOnTrack() > 0) {
444 std::set<MuonFixedId> segmentIds;
446 const MuonFixedId&
id = mdt_hit->identify();
449 log << MSG::WARNING <<
"segmentOverlap(), invalid MDT id! " <<
endmsg;
452 segmentIds.insert(
id);
455 const MuonFixedId&
id = mdt_hit->identify();
458 log << MSG::WARNING <<
"segmentOverlap(), invalid MDT id! " <<
endmsg;
461 overlap += (segmentIds.count(
id) > 0);
464 }
else if (segment1.cscHitsOnTrack() > 0 && segment2.cscHitsOnTrack() > 0) {
465 std::set<MuonFixedId> segmentIds;
467 const MuonFixedId&
id = csc_hit->identify();
470 log << MSG::WARNING <<
"segmentOverlap(), invalid CSC id! " <<
endmsg;
473 segmentIds.insert(
id);
476 MuonFixedId
id = csc_hit->identify();
479 log << MSG::WARNING <<
"segmentOverlap(), invalid CSC id! " <<
endmsg;
482 overlap += (segmentIds.count(
id) > 0);
◆ setdbg()
void MuonCalib::EventHandler::setdbg |
( |
const bool |
dbg_on | ) |
|
◆ setEvent()
set a new event (will call clear on the previous)
Definition at line 73 of file EventHandler.cxx.
92 for (; mit != mit_end; ++mit) {
◆ split_along_barcode()
template<typename T >
void MuonCalib::EventHandler::split_along_barcode |
( |
const std::vector< T > & |
container, |
|
|
std::map< int, std::set< T >> & |
barcode_map |
|
) |
| |
|
private |
Spltis the truth hit container into a map having the barcode of the particle as key.
Definition at line 237 of file EventHandler.cxx.
238 for (
const auto& hit_ptr : container) {
239 int barcode = hit_ptr->barCode();
241 barcode_map[
barcode].insert(hit_ptr);
◆ transform_to_trk()
Definition at line 334 of file EventHandler.cxx.
339 const int barcode = truth_part->barCode();
340 MuonCalibTrack_E::defineParams build_pars{};
341 build_pars.x0 = truth_part->position().x();
342 build_pars.y0 = truth_part->position().y();
343 build_pars.z0 = truth_part->position().z();
344 build_pars.phi = truth_part->momentum().phi();
345 build_pars.theta = truth_part->momentum().theta();
346 build_pars.author = std::abs(truth_part->PDGCode());
347 build_pars.qOverP = (1. - 2. * (truth_part->PDGCode() < 0)) / (truth_part->momentum().mag());
348 build_pars.cov.setZero();
349 std::shared_ptr<MuonCalibTrack_E> track_ptr = std::make_shared<MuonCalibTrack_E>(build_pars);
351 std::map<int, std::set<TruthMdtPtr>>::const_iterator mdt_itr = mdt_hits.find(
barcode);
352 if (mdt_itr != mdt_hits.end()) {
353 for (
const TruthMdtPtr& mdt_hit : mdt_itr->second) {
354 MuonCalibHit_E::definePars hit_pars{};
355 hit_pars.driftRadius = mdt_hit->driftRadius();
356 hit_pars.pos =
Amg::Vector3D(0., mdt_hit->positionAlongTube(), 0.);
357 track_ptr->addHit(std::make_shared<MuonCalibHit_E>(mdt_hit->identify(), hit_pars));
360 std::map<int, std::set<TruthCscPtr>>::const_iterator csc_itr = csc_hits.find(
barcode);
361 if (csc_itr != csc_hits.end()) {
362 for (
const TruthCscPtr& csc_hit : csc_itr->second) {
363 MuonCalibHit_E::definePars hit_pars{};
364 hit_pars.driftRadius = csc_hit->time();
365 track_ptr->addHit(std::make_shared<MuonCalibHit_E>(csc_hit->identify(), hit_pars));
369 std::map<int, std::set<TruthRpcPtr>>::const_iterator rpc_itr = rpc_hits.find(
barcode);
370 if (rpc_itr != rpc_hits.end()) {
371 for (
const TruthRpcPtr& rpc_hit : rpc_itr->second) {
372 MuonCalibHit_E::definePars hit_pars{};
373 hit_pars.driftRadius = rpc_hit->time();
374 track_ptr->addHit(std::make_shared<MuonCalibHit_E>(rpc_hit->identify(), hit_pars));
377 std::map<int, std::set<TruthTgcPtr>>::const_iterator tgc_itr = tgc_hits.find(
barcode);
378 if (tgc_itr != tgc_hits.end()) {
379 for (
const TruthTgcPtr& tgc_hit : tgc_itr->second) {
380 MuonCalibHit_E::definePars hit_pars{};
381 hit_pars.driftRadius = tgc_hit->time();
382 track_ptr->addHit(std::make_shared<MuonCalibHit_E>(tgc_hit->identify(), hit_pars));
◆ m_debug
bool MuonCalib::EventHandler::m_debug |
|
private |
◆ m_event
◆ m_extendedRawHits
◆ m_extendedSegments
◆ m_extendedTracks
◆ m_mooreIndices
◆ m_muonboyIndices
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
bool operator<(const DataVector< T > &a, const DataVector< T > &b)
Vector ordering relation.
std::shared_ptr< const MuonCalibTrack_E > MuonCalibTrkPtr
AuthorIndices m_mooreIndices
void match(const MuonCalibExtendedTrack &reference, TrackVec &tracks)
find best match of tracks with reference
void createExtendedTruthTracks()
create extended tracks for event
std::vector< ExtendedSegmentPtr > SegmentVec
const SegmentVec & extendedSegments(int author) const
get extended tracks
const MuonCalibEvent_E & event() const
get event
AuthorSegmentVecMap m_extendedSegments
void createExtendedTracks()
create extended tracks for event
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
MuonCalibTruthCollection::TruthTgcPtr TruthTgcPtr
void createExtendedRawHits()
create extend raw hits
IMessageSvc * getMessageSvc(bool quiet=false)
MuonCalibExtendedRawHits::ExtendedTrkPtr ExtendedTrackPtr
void clear()
clear all buffers
AuthorTrackVecMap m_extendedTracks
MuonCalibTruthCollection::TruthCscPtr TruthCscPtr
int segmentOverlap(const MuonCalibExtendedSegment &segment1, const MuonCalibExtendedSegment &segment2)
check whether segments share the same hits
int associateSegmentWithTrack(const MuonCalibExtendedSegment &segment, const MuonCalibExtendedTrack &track)
check whether segment and track share the same hits
std::shared_ptr< MuonCalibTrack_E > transform_to_trk(const TruthPtr &truth_part, const std::map< int, std::set< TruthMdtPtr >> &mdt_hits, const std::map< int, std::set< TruthCscPtr >> &csc_hits, const std::map< int, std::set< TruthRpcPtr >> &rpc_hits, const std::map< int, std::set< TruthTgcPtr >> &tgc_hits)
void linkTracks(int referenceIndex)
link tracks to the reference track using the hits on the track
std::shared_ptr< const CscCalibHitBase > CscHitPtr
typedef for a collection of CscCalibHitBase s
AuthorIndices m_muonboyIndices
std::string dumpTracks() const
MuonCalibExtendedRawHits m_extendedRawHits
std::shared_ptr< MuonCalibSegment > MuonCalibSegPtr
typedef for a set of (pointers to) MuonCalibSegments
void split_along_barcode(const std::vector< T > &container, std::map< int, std::set< T >> &barcode_map)
Spltis the truth hit container into a map having the barcode of the particle as key.
Eigen::Matrix< double, 3, 1 > Vector3D
std::shared_ptr< const MuonCalibEvent_E > m_event
void associateSegmentsWithTracks(SegmentVec &segments, TrackVec &tracks)
create association between tracks and segments
std::vector< ExtendedTrackPtr > TrackVec
MuonCalibTruthCollection::TruthPtr TruthPtr
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
std::string dumpMdtHits() const
void createExtendedSegments()
create extended segments for event
std::string dumpSegments() const
std::string dumpRawHits() const
dump routines
MuonCalibTruthCollection::TruthMdtPtr TruthMdtPtr
MuonCalibTruthCollection::TruthRpcPtr TruthRpcPtr
std::shared_ptr< MuonCalibPattern > PatternPtr
std::shared_ptr< MdtCalibHitBase > MdtHitPtr
typedef for a collection of MdtCalibHitBase s
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
MuonCalibExtendedRawHits::ExtendedSegPtr ExtendedSegmentPtr