ATLAS Offline Software
TRT_TrackSegmentsMaker_ECcosmics.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TRT_TrackSegments.h
7 // Header file for class TRT_TrackSegmentsMaker_ECcosmics
9 // (c) ATLAS Detector software
10 //
11 // Based on TRT_TrackSegmentsMaker_CTBxk from I.Gavrilenko
13 // Christian.Schmitt@cern.ch
15 
16 
17 #ifndef TRT_TrackSegmentsMaker_ECcosmics_H
18 #define TRT_TrackSegmentsMaker_ECcosmics_H
19 
20 
21 #include "GaudiKernel/ToolHandle.h"
23 
26 
30 
31 #include <iosfwd>
32 #include <list>
33 
34 class MsgStream;
35 
36 class TF1;
37 
38 class TRT_ID;
39 namespace InDet{
40  class TRT_DriftCircle;
41 }
42 
43 namespace InDetDD{
44  class TRT_DetectorManager;
45 }
46 
47 namespace Trk{
48  class TrackSegment;
49  class Segment;
50 }
51 
53 
54 
55 namespace InDet{
56 
64  class TRT_TrackSegmentsMaker_ECcosmics : // This class read and write gErrorIgnoreLevel without a global lock for ROOT.
65  virtual public ITRT_TrackSegmentsMaker, public AthAlgTool
66  {
68  // Public methods:
70 
71  public:
72 
74  // Standard tool methods
76 
79  (const std::string&,const std::string&,const IInterface*);
81  virtual StatusCode initialize() override;
82  virtual StatusCode finalize () override;
83 
85  // Methods to initialize tool for new event or region
87 
88  virtual std::unique_ptr<InDet::ITRT_TrackSegmentsMaker::IEventData> newEvent(const EventContext& ctx) const override;
89  virtual std::unique_ptr<InDet::ITRT_TrackSegmentsMaker::IEventData> newRegion(const EventContext& ctx, const std::vector<IdentifierHash>&) const override;
90  void endEvent(InDet::ITRT_TrackSegmentsMaker::IEventData &event_data) const override;
91 
93  // Methods of seeds production without vertex constraint
95 
96  virtual void find(const EventContext &ctx,
99 
101  // Iterator through seeds pseudo collection produced accordingly
102  // methods find
104 
105  virtual Trk::TrackSegment* next(InDet::ITRT_TrackSegmentsMaker::IEventData &event_data) const override;
106 
108  // Print internal tool parameters and status
110 
111  virtual MsgStream& dump (MsgStream & out) const override;
112  virtual std::ostream& dump (std::ostream& out) const override;
113 
114  protected:
115  class EventData;
116  class EventData : public Trk::EventDataBase<EventData,InDet::ITRT_TrackSegmentsMaker::IEventData>
117  {
119  public:
121  m_segiterator = m_segments.begin();
122  }
123 
125  std::vector<std::vector<const InDet::TRT_DriftCircle*> *>::iterator sit,sitE;
126  sit= m_seeds.begin();
127  sitE= m_seeds.end();
128  for(;sit!=sitE;++sit){
129  (*sit)->clear();
130  delete(*sit);
131  }
132  }
133 
134  protected:
135  std::list<const InDet::TRT_DriftCircle*> m_noiseHits;
136  std::list<const InDet::TRT_DriftCircle*> m_goodHits;
137 
138 
139  std::list<const InDet::TRT_DriftCircle*> m_sectors[2][20][16];
140 
141  std::vector<std::vector<const InDet::TRT_DriftCircle*> *> m_seeds;
142  std::list<Trk::TrackSegment*> m_segments ;
144 
145  double m_a_z[1000];
146  double m_a_phi[1000];
147  double m_a_phi_err[1000];
148  double m_a_tan[1000];
149  double m_a_tan_err[1000];
150  double m_a_z_err[1000];
151  double m_a_steigung[1000];
152 
153  // Fitting functions
154  TF1 *m_fitf_ztanphi=nullptr;
155  TF1 *m_fitf_zphi=nullptr;
156 
157  TF1 *m_fitf_ztanphi_approx=nullptr;
158  TF1 *m_fitf_zphi_approx=nullptr;
159 
160  };
161 
163  // Protected data and methods
165 
166  BooleanProperty m_phaseMode{this, "Phase", false,
167  "Switch to destinguish between phase calculation and full reco"};
168  const TRT_ID* m_trtid{} ;
169 
170  SG::ReadHandleKey<InDet::TRT_DriftCircleContainer> m_trtname{this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve TRT_DriftCircles"};
172  {this,"PRDtoTrackMap",""};
173 
174  ToolHandle<Trk::IRIO_OnTrackCreator> m_riomakerD
175  {this, "RIOonTrackToolYesDr",
176  "InDet::TRT_DriftCircleOnTrackTool/TRT_DriftCircleOnTrackTool",
177  "RI0_onTrack creator with drift information"};
178  ToolHandle<Trk::IRIO_OnTrackCreator> m_riomakerN
179  {this, "RIOonTrackToolNoDr",
180  "InDet::TRT_DriftCircleOnTrackNoDriftTimeTool/TRT_DriftCircleOnTrackNoDriftTimeTool",
181  "RI0_onTrack creator without drift information"};
182 
183  BooleanProperty m_useDriftTime{this, "UseDriftTime", false,
184  "Shall the drifttime be used or only tube hits?"};
185  DoubleProperty m_scaleTube{this, "ScaleFactorTube", 2.,
186  "Scalefactor for uncertainty of tube hits"};
187  DoubleProperty m_scaleFactorDrift{this, "ScaleFactorDrift", 1.,
188  "Scalefactor for uncertainty of drifttime hits"};
189  DoubleProperty m_scaleTubeNoise{this, "ScaleFactorTubeNoise", 1.,
190  "Scalefactor for uncertainty of tube hits flagged as noise"};
191  DoubleProperty m_cutToTLoose{this, "ToTCutLoose", 7.,
192  "Loose cut on ToT (preselection)"};
193  DoubleProperty m_cutToTTight{this, "ToTCutTight", 18.,
194  "Hard cut on ToT (preselection)"};
195  DoubleProperty m_cutToTUpper{this, "ToTCutUpper", 32.,
196  "Upper cut on ToT (preselection)"};
197  IntegerProperty m_minDCSeed{this, "MinDCperSeed", 7,
198  "Minimum number of driftcircles to form a seed"};
199  IntegerProperty m_hitLimit{this, "HitLimit", 2000,
200  "Maximum number of good hits (i.e. after noise cut) in endcap"};
201 
202  static std::mutex s_fitMutex; // @TODO not sufficient need a global root lock
203 
205  // Protected methods
207 
211 
214  bool find_seed(int endcap, int zslice, int sector,TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const;
215 
218  int evaluate_seed(int endcap,int zslice,int sector,const double *p, TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const;
219 
222  void create_segment(std::vector<const InDet::TRT_DriftCircle*> *seed,
224 
226 
230 
233  bool is_suspicious(const InDet::TRT_DriftCircle* dc, std::vector<const InDet::TRT_DriftCircle*> *seed) const;
234 
237  static double phidiff(double a,double b);
238 
242  std::list<const InDet::TRT_DriftCircle*> & container,
243  double phiLimit, double dzLimit) const;
244 
245  };
246 
247 } // end of name space
248 
249 
251 {
252  double c=a-b;
253 
254  if(std::abs(c)>100)
255  c/=int(c/(2*M_PI));
256  while(c>=M_PI) c-=2*M_PI;
257  while(c<-M_PI) c+=2*M_PI;
258  return c;
259 }
260 
261 #endif // TRT_TrackSegmentsMaker_ECcosmics_H
262 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
used
PRDtoTrackMap.h
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_fitf_ztanphi_approx
TF1 * m_fitf_ztanphi_approx
approx function to fit tan(phi) vs.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:157
Trk::EventDataBase
Base for a helper class to pass mutable storage to tools.
Definition: EventDataBase.h:17
InDet::TRT_TrackSegmentsMaker_ECcosmics::setFitFunctions
void setFitFunctions(TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:115
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_goodHits
std::list< const InDet::TRT_DriftCircle * > m_goodHits
List containing potenitally good hits.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:136
InDet::TRT_TrackSegmentsMaker_ECcosmics::perform_fit
TF1 * perform_fit(int count, TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const
Perform the fit and return a function that provides the fitted phi information.
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:1734
InDet::TRT_TrackSegmentsMaker_ECcosmics::find_seed
bool find_seed(int endcap, int zslice, int sector, TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const
Find seed in the given sector/zslice/endcap.
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:386
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_cutToTTight
DoubleProperty m_cutToTTight
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:193
InDet::TRT_TrackSegmentsMaker_ECcosmics::accepted
bool accepted(const std::list< const InDet::TRT_DriftCircle * >::iterator compareIt, std::list< const InDet::TRT_DriftCircle * > &container, double phiLimit, double dzLimit) const
is the hit accepted?
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:1693
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Trk::TrackState::Segment
@ Segment
Definition: TrackStateDefs.h:37
EventDataBase.h
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_minDCSeed
IntegerProperty m_minDCSeed
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:197
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
PRD_MultiTruthCollection
A PRD is mapped onto all contributing particles.
Definition: PRD_MultiTruthCollection.h:24
IRIO_OnTrackCreator.h
InDet::TRT_TrackSegmentsMaker_ECcosmics::is_suspicious
bool is_suspicious(const InDet::TRT_DriftCircle *dc, std::vector< const InDet::TRT_DriftCircle * > *seed) const
checks if a hit that matches the segment looks suspicious (i.e.
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:1820
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_cutToTLoose
DoubleProperty m_cutToTLoose
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:191
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
M_PI
#define M_PI
Definition: ActiveFraction.h:11
InDet::TRT_TrackSegmentsMaker_ECcosmics::next
virtual Trk::TrackSegment * next(InDet::ITRT_TrackSegmentsMaker::IEventData &event_data) const override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:1515
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_segiterator
std::list< Trk::TrackSegment * >::iterator m_segiterator
Iterator over found segments.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:143
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_riomakerD
ToolHandle< Trk::IRIO_OnTrackCreator > m_riomakerD
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:175
Trk::TrackSegment
Definition: TrackSegment.h:56
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer >
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_scaleFactorDrift
DoubleProperty m_scaleFactorDrift
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:187
InDet::TRT_TrackSegmentsMaker_ECcosmics::find
virtual void find(const EventContext &ctx, InDet::ITRT_TrackSegmentsMaker::IEventData &event_data, InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap &used) const override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:302
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_fitf_zphi
TF1 * m_fitf_zphi
analytic function to fit phi vs.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:155
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_sectors
std::list< const InDet::TRT_DriftCircle * > m_sectors[2][20][16]
Divide into two endcaps and each endcap into 16 sectors in phi and 20 in z.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:139
InDet::TRT_TrackSegmentsMaker_ECcosmics::phidiff
static double phidiff(double a, double b)
provide the proper subtraction of two phi values
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:250
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_phaseMode
BooleanProperty m_phaseMode
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:166
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
InDet::TRT_TrackSegmentsMaker_ECcosmics::newEvent
virtual std::unique_ptr< InDet::ITRT_TrackSegmentsMaker::IEventData > newEvent(const EventContext &ctx) const override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:156
InDet::ITRT_TrackSegmentsMaker
Definition: ITRT_TrackSegmentsMaker.h:47
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::TRT_TrackSegmentsMaker_ECcosmics::finalize
virtual StatusCode finalize() override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:145
InDet::TRT_TrackSegmentsMaker_ECcosmics::endEvent
void endEvent(InDet::ITRT_TrackSegmentsMaker::IEventData &event_data) const override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:248
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::~EventData
~EventData()
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:124
AthAlgTool.h
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_riomakerN
ToolHandle< Trk::IRIO_OnTrackCreator > m_riomakerN
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:179
ITRT_TrackSegmentsMaker.h
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_a_z_err
double m_a_z_err[1000]
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:150
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_seeds
std::vector< std::vector< const InDet::TRT_DriftCircle * > * > m_seeds
Vector of seeds.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:141
InDet::TRT_TrackSegmentsMaker_ECcosmics::create_segment
void create_segment(std::vector< const InDet::TRT_DriftCircle * > *seed, TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const
Create segment out of a seed.
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:799
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_a_phi_err
double m_a_phi_err[1000]
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:147
InDet::TRT_TrackSegmentsMaker_ECcosmics::~TRT_TrackSegmentsMaker_ECcosmics
virtual ~TRT_TrackSegmentsMaker_ECcosmics()
InDet::TRT_TrackSegmentsMaker_ECcosmics::evaluate_seed
int evaluate_seed(int endcap, int zslice, int sector, const double *p, TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const
Evaluate how many dc match this seed.
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:744
InDet::TRT_TrackSegmentsMaker_ECcosmics
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:66
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:117
InDet::TRT_TrackSegmentsMaker_ECcosmics::newRegion
virtual std::unique_ptr< InDet::ITRT_TrackSegmentsMaker::IEventData > newRegion(const EventContext &ctx, const std::vector< IdentifierHash > &) const override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:203
Trk::RIO_OnTrackType::TRT_DriftCircle
@ TRT_DriftCircle
Definition: RIO_OnTrack.h:59
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_cutToTUpper
DoubleProperty m_cutToTUpper
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:195
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_noiseHits
std::list< const InDet::TRT_DriftCircle * > m_noiseHits
List containing potentially noise hits.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:135
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_fitf_ztanphi
TF1 * m_fitf_ztanphi
analytic function to fit tan(phi) vs.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:154
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_hitLimit
IntegerProperty m_hitLimit
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:199
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_prdToTrackMap
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_prdToTrackMap
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:172
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_a_tan
double m_a_tan[1000]
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:148
TRT_ID
Definition: TRT_ID.h:84
a
TList * a
Definition: liststreamerinfos.cxx:10
InDet::TRT_TrackSegmentsMaker_ECcosmics::TRT_TrackSegmentsMaker_ECcosmics
TRT_TrackSegmentsMaker_ECcosmics(const std::string &, const std::string &, const IInterface *)
Constructor with parameters.
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:36
InDet::TRT_TrackSegmentsMaker_ECcosmics::initialize
virtual StatusCode initialize() override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:76
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_a_tan_err
double m_a_tan_err[1000]
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:149
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_trtid
const TRT_ID * m_trtid
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:168
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_a_z
double m_a_z[1000]
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:145
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_fitf_zphi_approx
TF1 * m_fitf_zphi_approx
anpprox function to fit phi vs.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:158
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_a_steigung
double m_a_steigung[1000]
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:151
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_useDriftTime
BooleanProperty m_useDriftTime
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:183
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_scaleTubeNoise
DoubleProperty m_scaleTubeNoise
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:189
AthAlgTool
Definition: AthAlgTool.h:26
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_segments
std::list< Trk::TrackSegment * > m_segments
List of found segments.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:142
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::m_a_phi
double m_a_phi[1000]
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:146
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_scaleTube
DoubleProperty m_scaleTube
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:185
InDet::ITRT_TrackSegmentsMaker::IEventData
Definition: ITRT_TrackSegmentsMaker.h:53
InDet::TRT_TrackSegmentsMaker_ECcosmics::dump
virtual MsgStream & dump(MsgStream &out) const override
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:1528
python.compressB64.c
def c
Definition: compressB64.py:93
InDet::TRT_TrackSegmentsMaker_ECcosmics::m_trtname
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_trtname
TRTs container.
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:170
InDet::TRT_TrackSegmentsMaker_ECcosmics::s_fitMutex
static std::mutex s_fitMutex
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:202
InDet::TRT_TrackSegmentsMaker_ECcosmics::EventData::EventData
EventData()
Definition: TRT_TrackSegmentsMaker_ECcosmics.h:120
InDet::TRT_TrackSegmentsMaker_ECcosmics::retrieveHits
void retrieveHits(TRT_TrackSegmentsMaker_ECcosmics::EventData &event_data) const
sort hits into good/noise lists
Definition: TRT_TrackSegmentsMaker_ECcosmics.cxx:1548