ATLAS Offline Software
Loading...
Searching...
No Matches
VP1TrackSummary.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class VP1TrackSummary //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: November 2009 //
12// //
14
16#include "VP1Utils/VP1DetInfo.h"
18
19#include "TrkTrack/Track.h"
21#include "TrkSurfaces/Surface.h"
26#include "TrkSegment/Segment.h"
27
28#include <iostream>
29//____________________________________________________________________
31 unsigned& nPixelHits,
32 unsigned& nSCTHits,
33 unsigned& nTRTHits,
34 unsigned& nhits_muon_phi,
35 unsigned& nhits_rpc,
36 unsigned& nhits_mdt,
37 unsigned& nhits_tgc,
38 unsigned& nhits_csc,
39 unsigned& nhits_mm,
40 unsigned& nhits_stgc
41 )
42{
43 nPixelHits = nSCTHits = nTRTHits = nhits_muon_phi = nhits_rpc = nhits_mdt = nhits_tgc = nhits_csc = nhits_mm = nhits_stgc = 0;
44 if (!trk)
45 return false;
46
47 const AtlasDetectorID * idhelper = VP1DetInfo::atlasIDHelper();
48 if (!idhelper)
49 return false;
50
51 std::set<const Trk::TrkDetElementBase*> detelems;// Need several to handle #$$%ing cROTs. EJWM
54 for (; tsos_iter != tsos_end; ++tsos_iter) {
55 const Trk::MeasurementBase* meas = *tsos_iter ? (*tsos_iter)->measurementOnTrack() : nullptr;
56 VP1TrackSummary::addCounts(detelems, meas, idhelper, nPixelHits , nSCTHits , nTRTHits , nhits_muon_phi , nhits_rpc , nhits_mdt , nhits_tgc , nhits_csc, nhits_mm, nhits_stgc);
57 }
58 return true;
59}
60
61//____________________________________________________________________
63 unsigned& nPixelHits,
64 unsigned& nSCTHits,
65 unsigned& nTRTHits,
66 unsigned& nhits_muon_phi,
67 unsigned& nhits_rpc,
68 unsigned& nhits_mdt,
69 unsigned& nhits_tgc,
70 unsigned& nhits_csc,
71 unsigned& nhits_mm,
72 unsigned& nhits_stgc
73 )
74{
75 nPixelHits = nSCTHits = nTRTHits = nhits_muon_phi = nhits_rpc = nhits_mdt = nhits_tgc = nhits_csc = nhits_mm = nhits_stgc = 0;
76 if (!seg)
77 return false;
78
79 const AtlasDetectorID * idhelper = VP1DetInfo::atlasIDHelper();
80 if (!idhelper)
81 return false;
82
83 std::set<const Trk::TrkDetElementBase*> detelems;// Need several to handle #$$%ing cROTs. EJWM
84 std::vector< const Trk::MeasurementBase * >::const_iterator tsos_iter = seg->containedMeasurements().begin(), tsos_end = seg->containedMeasurements().end();
85 for (; tsos_iter != tsos_end; ++tsos_iter) {
86 const Trk::MeasurementBase* meas = *tsos_iter;
87 addCounts(detelems, meas, idhelper, nPixelHits , nSCTHits , nTRTHits , nhits_muon_phi , nhits_rpc , nhits_mdt , nhits_tgc , nhits_csc, nhits_mm, nhits_stgc);
88 }
89 return true;
90}
91
92void VP1TrackSummary::addCounts( std::set<const Trk::TrkDetElementBase*>& detelems, const Trk::MeasurementBase* meas,
93 const AtlasDetectorID * idhelper,
94 unsigned& nPixelHits,
95 unsigned& nSCTHits,
96 unsigned& nTRTHits,
97 unsigned& nhits_muon_phi,
98 unsigned& nhits_rpc,
99 unsigned& nhits_mdt,
100 unsigned& nhits_tgc,
101 unsigned& nhits_csc,
102 unsigned& nhits_mm,
103 unsigned& nhits_stgc
104 )
105{
106 const Trk::CompetingRIOsOnTrack* crot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(meas);
107
108 if (crot){
109 unsigned int i = 0;
110 for (;i<crot->numberOfContainedROTs();++i){
111 detelems.insert(crot->rioOnTrack(i).detectorElement());
112 }
113 }else if (meas) {
114 const Trk::Surface * surf = &(meas->associatedSurface());
115 detelems.insert( surf ? surf->associatedDetectorElement() : nullptr);
116 }
117
118 std::set<const Trk::TrkDetElementBase*>::const_iterator it = detelems.begin(), itEnd=detelems.end();
119 for (;it!=itEnd;++it){
120 const Trk::TrkDetElementBase* detelem=*it;
121 if (!detelem) continue;
122 Identifier id = detelem->identify();
123 if (!id.is_valid())
124 continue;
125 if (idhelper->is_pixel(id)) ++nPixelHits;
126 else if (idhelper->is_sct(id)) ++nSCTHits;
127 else if (idhelper->is_trt(id)) ++nTRTHits;
128 else if (idhelper->is_mdt(id)) ++nhits_mdt;
129 else if (idhelper->is_rpc(id)) ++nhits_rpc;
130 else if (idhelper->is_tgc(id)) ++nhits_tgc;
131 else if (idhelper->is_csc(id)) ++nhits_csc;
132 else if (idhelper->is_mm(id)) ++nhits_mm;
133 else if (idhelper->is_stgc(id)) ++nhits_stgc;
134 }// FIXME! Implement Muon phi hits
135 nhits_muon_phi=0;
136 detelems.clear();
137}
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
bool is_mdt(Identifier id) const
bool is_stgc(Identifier id) const
bool is_rpc(Identifier id) const
bool is_sct(Identifier id) const
bool is_tgc(Identifier id) const
bool is_pixel(Identifier id) const
bool is_csc(Identifier id) const
bool is_mm(Identifier id) const
bool is_trt(Identifier id) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
virtual unsigned int numberOfContainedROTs() const =0
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
This class is the pure abstract base class for all fittable tracking measurements.
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
Base class for all TrackSegment implementations, extends the common MeasurementBase.
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
Abstract Base Class for tracking surfaces.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
This is the base class for all tracking detector elements with read-out relevant information.
virtual Identifier identify() const =0
Identifier.
static const AtlasDetectorID * atlasIDHelper()
static bool countHits(const Trk::Track *, unsigned &nPixelHits, unsigned &nSCTHits, unsigned &nTRTHits, unsigned &nhits_muon_phi, unsigned &nhits_rpc, unsigned &nhits_mdt, unsigned &nhits_tgc, unsigned &nhits_csc, unsigned &nhits_mm, unsigned &nhits_stgc)
static void addCounts(std::set< const Trk::TrkDetElementBase * > &detelems, const Trk::MeasurementBase *meas, const AtlasDetectorID *idhelper, unsigned &nPixelHits, unsigned &nSCTHits, unsigned &nTRTHits, unsigned &nhits_muon_phi, unsigned &nhits_rpc, unsigned &nhits_mdt, unsigned &nhits_tgc, unsigned &nhits_csc, unsigned &nhits_mm, unsigned &nhits_stgc)