ATLAS Offline Software
TRT_TrackSegmentsMaker_BarrelCosmics.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 //
7 // TRT_TrackSegmentsMaker_BarrelCosmics.h, (c) ATLAS Detector software
8 //
9 // TRT standalone segment finder for TRT barrel
10 // specialized for cosmics and L2 trigger, plan to make it working in a magnetic field
11 //
13 
14 #ifndef TRT_TrackSegmentsMaker_BarrelCosmics_H
15 #define TRT_TrackSegmentsMaker_BarrelCosmics_H
16 
17 
22 
24 #include <vector>
25 #include <string>
26 #include <memory>
27 #include <iosfwd>
28 
29 class MsgStream;
30 class TRT_ID;
31 
32 namespace InDet{
33 
43 
44  public:
45 
46  TRT_TrackSegmentsMaker_BarrelCosmics(const std::string &, const std::string &, const IInterface*);
48 
50  // methods inherited from ITRT_TrackSegmentsMaker
51  // in each event, methods are called in this order:
52  // - newEvent() in the offline, newRegion(...) for L2 (directed search)
53  // - find() finds all segments
54  // - next() many times (returns next segment), untill next() returns 0 pointer
56 
57  virtual StatusCode initialize() override;
58  virtual StatusCode finalize () override;
59 
60  virtual std::unique_ptr<InDet::ITRT_TrackSegmentsMaker::IEventData> newEvent(const EventContext& ctx) const override;
61  virtual std::unique_ptr<InDet::ITRT_TrackSegmentsMaker::IEventData> newRegion(const EventContext& ctx, const std::vector<IdentifierHash>&) const override;
62  void endEvent(InDet::ITRT_TrackSegmentsMaker::IEventData &event_data) const override;
63 
64  virtual void find(const EventContext &ctx,
68  &event_data) const override;
69 
70  virtual MsgStream& dump (MsgStream & out) const override
71  { return out; };
72  virtual std::ostream& dump (std::ostream& out) const override
73  { return out; };
74 
75 
76  protected:
77  class EventData;
78  class EventData : public Trk::EventDataBase<EventData,InDet::ITRT_TrackSegmentsMaker::IEventData>
79  {
81  public:
82  EventData(const TRT_DriftCircleContainer *trtcontainer) :m_trtcontainer(trtcontainer) {}
84 
85  void clear() {
86  m_listHits.clear();
87  m_listHitCenter.clear();
88  m_segmentDriftCircles.clear();
89  m_segments.clear();
91  }
92 
93  protected:
95  unsigned int m_segmentDriftCirclesCount = 0;
96  std::vector< const InDet::TRT_DriftCircle * > m_listHits;
97  std::vector< Amg::Vector3D > m_listHitCenter;
98 
99  std::vector< std::vector<const InDet::TRT_DriftCircle *> > m_segmentDriftCircles; // vector of DriftCircles associated to the segments
100  std::vector< Trk::TrackSegment * > m_segments;
101  };
102 
104  // Protected data and methods
106 
107 
108 
109  SG::ReadHandleKey<InDet::TRT_DriftCircleContainer> m_driftCirclesName{this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve Drift Circles"} ;
110  StringProperty m_TRTManagerName{this, "TrtManagerLocation", "TRT",
111  "Name of TRT det. manager"};
112 
113  const TRT_ID* m_trtid{nullptr};
114 
115  private:
116 
117  // other methods specific for this algorithm
118 
119  int findSeed(double xmin,
120  double xmax,
121  double phimin,
122  double phimax,
123  double *bestParameters,
125 
127 
128  // follow
129  // convert lists of TRT circles (std::vector<const InDet::TRT_DriftCircle *>) to track segments (Trk::TrackSegment * -> fill m_segments):
130  void convert(std::vector<const InDet::TRT_DriftCircle *> &hits,
131  double *trackpar,
133 
134  void findOld(TRT_TrackSegmentsMaker_BarrelCosmics::EventData &event_data) const; // old function - need to debug an increased cpu consumption
135 
136 
137  static void linearRegressionParabolaFit(double *mean, double *a); // input: elsewhere calculated mean, output: result a
140  static bool sortHits( const InDet::TRT_DriftCircle *, const InDet::TRT_DriftCircle * );
141 
142  static void segFit(double *measx, double *measy, int nhits, double *residuals = 0, double *result = 0);
143 
144  // protect against high occupancy events
145  // 21k corresponds to 20% occupancy
146  // if set to 0, this requirement is not used. total number of TRT barrel straws is 105088
147  IntegerProperty m_maxTotalHits{this, "MaxTotalNumberOfBarrelHits", 21000};
148 
149  IntegerProperty m_minHitsForSeed{this, "MinNumberOfHitsForSeed", -1};
150  IntegerProperty m_minHitsForSegment{this, "MinimalNumberOfTRTHits", 20};
151  IntegerProperty m_minHitsAboveTOT{this, "MinNumberOfHitsAboveTOT", -1};
152  IntegerProperty m_nBinsInX{this, "NbinsInX", 100};
153  IntegerProperty m_nBinsInPhi{this, "NbinsInPhi", 10};
154 
155  DoubleProperty m_minSeedTOT{this, "MinimalTOTForSeedSearch", 10.,
156  "minimal time over threshold for seed search - default ~ 10 ns"};
157  BooleanProperty m_magneticField{this, "IsMagneticFieldOn", true,
158  "search for lines (if False) or circles (if True)"};
159  BooleanProperty m_mergeSegments{this, "MergeSegments", false}; // default: False, should not be turned on yet
160 
161  };
162 
163 } // end namespace InDet
164 
165 #endif // TRT_TrackSegmentsMaker_BarrelCosmics_H
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::dump
virtual MsgStream & dump(MsgStream &out) const override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:70
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
used
Trk::EventDataBase
Base for a helper class to pass mutable storage to tools.
Definition: EventDataBase.h:17
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::m_listHitCenter
std::vector< Amg::Vector3D > m_listHitCenter
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:97
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
get_generator_info.result
result
Definition: get_generator_info.py:21
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:79
EventDataBase.h
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::m_trtcontainer
const TRT_DriftCircleContainer * m_trtcontainer
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:94
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::m_listHits
std::vector< const InDet::TRT_DriftCircle * > m_listHits
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:96
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::convert
void convert(std::vector< const InDet::TRT_DriftCircle * > &hits, double *trackpar, TRT_TrackSegmentsMaker_BarrelCosmics::EventData &event_data) const
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:531
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::sortHits
static bool sortHits(const InDet::TRT_DriftCircle *, const InDet::TRT_DriftCircle *)
sort hits on segment such that they are ordered from larger y to smaller (from top down)
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:524
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_driftCirclesName
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_driftCirclesName
Container with TRT clusters.
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:109
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::newRegion
virtual std::unique_ptr< InDet::ITRT_TrackSegmentsMaker::IEventData > newRegion(const EventContext &ctx, const std::vector< IdentifierHash > &) const override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:122
Trk::TrackSegment
Definition: TrackSegment.h:56
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_nBinsInX
IntegerProperty m_nBinsInX
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:152
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_minHitsAboveTOT
IntegerProperty m_minHitsAboveTOT
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:151
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer >
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_maxTotalHits
IntegerProperty m_maxTotalHits
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:147
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::linearRegressionParabolaFit
static void linearRegressionParabolaFit(double *mean, double *a)
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:503
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
InDet::TRT_TrackSegmentsMaker_BarrelCosmics
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:42
InDet::ITRT_TrackSegmentsMaker
Definition: ITRT_TrackSegmentsMaker.h:47
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::segFit
static void segFit(double *measx, double *measy, int nhits, double *residuals=0, double *result=0)
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:738
xmin
double xmin
Definition: listroot.cxx:60
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::findSeed
int findSeed(double xmin, double xmax, double phimin, double phimax, double *bestParameters, TRT_TrackSegmentsMaker_BarrelCosmics::EventData &event_data) const
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:380
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_TRTManagerName
StringProperty m_TRTManagerName
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:110
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::dump
virtual std::ostream & dump(std::ostream &out) const override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_mergeSegments
BooleanProperty m_mergeSegments
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:159
ITRT_TrackSegmentsMaker.h
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_magneticField
BooleanProperty m_magneticField
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:157
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::m_segments
std::vector< Trk::TrackSegment * > m_segments
List of found segments.
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:100
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_trtid
const TRT_ID * m_trtid
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:113
EventData
Definition: Trigger/TrigAccel/TrigCudaFitter/src/EventData.h:11
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::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_BarrelCosmics.cxx:186
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::m_segmentDriftCirclesCount
unsigned int m_segmentDriftCirclesCount
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:95
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::clear
void clear()
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:85
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::initialize
virtual StatusCode initialize() override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:30
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::TRT_TrackSegmentsMaker_BarrelCosmics
TRT_TrackSegmentsMaker_BarrelCosmics(const std::string &, const std::string &, const IInterface *)
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:24
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::findSeedInverseR
void findSeedInverseR(double *par, TRT_TrackSegmentsMaker_BarrelCosmics::EventData &event_data) const
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:423
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::~EventData
~EventData()
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:83
InDet::TRT_DriftCircleContainer
Trk::PrepRawDataContainer< TRT_DriftCircleCollection > TRT_DriftCircleContainer
Definition: TRT_DriftCircleContainer.h:27
TRT_DriftCircleContainer.h
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::finalize
virtual StatusCode finalize() override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:63
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::newEvent
virtual std::unique_ptr< InDet::ITRT_TrackSegmentsMaker::IEventData > newEvent(const EventContext &ctx) const override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:71
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::findOld
void findOld(TRT_TrackSegmentsMaker_BarrelCosmics::EventData &event_data) const
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:813
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_minSeedTOT
DoubleProperty m_minSeedTOT
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:155
TRT_ID
Definition: TRT_ID.h:84
a
TList * a
Definition: liststreamerinfos.cxx:10
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_nBinsInPhi
IntegerProperty m_nBinsInPhi
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:153
xmax
double xmax
Definition: listroot.cxx:61
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::endEvent
void endEvent(InDet::ITRT_TrackSegmentsMaker::IEventData &event_data) const override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:167
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::~TRT_TrackSegmentsMaker_BarrelCosmics
virtual ~TRT_TrackSegmentsMaker_BarrelCosmics()
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:47
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::next
virtual Trk::TrackSegment * next(InDet::ITRT_TrackSegmentsMaker::IEventData &event_data) const override
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.cxx:360
AthAlgTool
Definition: AthAlgTool.h:26
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::m_segmentDriftCircles
std::vector< std::vector< const InDet::TRT_DriftCircle * > > m_segmentDriftCircles
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:99
InDet::ITRT_TrackSegmentsMaker::IEventData
Definition: ITRT_TrackSegmentsMaker.h:53
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_minHitsForSegment
IntegerProperty m_minHitsForSegment
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:150
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::m_minHitsForSeed
IntegerProperty m_minHitsForSeed
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:149
InDet::TRT_TrackSegmentsMaker_BarrelCosmics::EventData::EventData
EventData(const TRT_DriftCircleContainer *trtcontainer)
Definition: TRT_TrackSegmentsMaker_BarrelCosmics.h:82