ATLAS Offline Software
Loading...
Searching...
No Matches
TileMuonFitter.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TILECOSMICALGS_TILEMUONFITTER_H
6#define TILECOSMICALGS_TILEMUONFITTER_H
7
8/********************************************************************
9 *
10 * NAME: TileMuonFitter
11 * PACKAGE: offline/TileCalorimeter/TileCosmicAlgs
12 *
13 * AUTHOR : J. Maneira
14 * CREATED: 10-Jul-2006
15 * REVISED: February-2008 (w/ L. Andrade)
16 * REVISED: November-2008 (w/ L. Andrade)
17 * REVISED: February-2009 (w/ M. Soares)
18 *
19 * PURPOSE: Create Cell vectors from CaloCellContainer, fit a straight muon
20 * track through a selected subset, calculate horizontal
21 * plane crossing time.
22 * (see .cxx and mainpage.h for more details)
23 *
24 * Input: TileCell (one by one or from CaloCellContainer)
25 * Output: ComissioningEvent/ComTime object
26 * Output: TileEvent/TileCosmicMuon object
27 *
28 ********************************************************************/
29
30// Tile includes
33
34// Calo includes
37
38// Athena includes
43
44// Gaudi includes
45#include "GaudiKernel/ToolHandle.h"
46#include "Gaudi/Property.h"
47
48
49// forward declarations
50class HWIdentifier;
51class IdentifierHash;
52class TileID;
53class TileHWID;
55
56// C++ STL includes
57#include <string>
58#include <algorithm>
59
60//using namespace ROOT::Minuit2;
61
62// Auxiliar class to save info about each cell
63// used in Hough Transform computation
64class CellInfo {
65 public:
66
67 float x, y, z; // position
68 float dist; // RoI
69 float e, ev; // energy and energy density
70 bool use; // cell is enabled
71 bool is_out; // cell is not in current track
72 int track_index; // each cell can belong to only one track
73};
74
88
90 public:
91
93 TileMuonFitter(const std::string& name, ISvcLocator* pSvcLocator);
94 virtual ~TileMuonFitter();
95
96 virtual StatusCode initialize() override;
97 virtual StatusCode execute(const EventContext& ctx) override;
98 virtual StatusCode finalize() override;
99 virtual bool isClonable() const override final { return true; }
100
104 void buildCells();
105
107 void setEventDefaults();
108
111 bool eventSelection();
112
115 int fitTrack();
116
119 int houghTrack();
120
122 void calculateTime();
127
129 void buildTileCosmicMuon(int fitok);
131 void buildTileCosmicMuonAtYequal0(int fitok);
133 void buildTileCosmicMuonAtZequal0(int fitok);
134
136 void buildComTime(int fitok);
138 void buildComTimeAtYequal0(int fitok);
140 void buildComTimeAtZequal0(int fitok);
141
142 private:
143
145 void trackIntersection(std::vector<double> & ltop, std::vector<double> & lbot, int index);
147 void trackSegmentIntersection(std::vector<double> & segPath, std::vector<int> & segPartition
148 , std::vector<int> & segModule, std::vector<int> & segSampling, int index);
149
151 void energyInTrack(std::vector<double> & etop, std::vector<double> & ebot
152 , std::vector<IdentifierHash> & cells, int index);
153
155 bool checkLBz(double x1);
157 bool checkEBz(double x1);
159 bool checkEBAz(double x1);
161 bool checkEBCz(double x1);
163 bool checkLBr(double x1, uint8_t s1);
165 bool checkEBr(double x1, uint8_t s1);
167 bool checkLBr(double x1);
169 bool checkEBr(double x1);
171 int whichEBr(double x1);
173 int whichLBr(double x1);
175 int whichModule(CLHEP::Hep3Vector tempvec);
176
177 // Hough Transform auxiliar routines ---------------------------------------
178
179 std::vector<CellInfo> m_cellInfo;
180
181 void cart2hough(float x1, float y1, float x2, float y2, double &raio, double &angu);
182 void hough2cart(double r, double a, double offset, double &aa, double &bb);
183 float dist2line(CellInfo &ci, float *pos, float *w);
184 void points2dir(CellInfo &ci1, CellInfo &ci2, float *w);
185 unsigned int CntCells(unsigned int index1, unsigned int index2, double &skew);
186 bool guessTrack(unsigned int &index1, unsigned int &index2);
187 unsigned int buildCellInfoVector();
188 float selectCells(float *p, float *w);
189 bool isHaloMuon(double azy);
190 void doHough(double &rxy, double &axy, double &rzy, double &azy);
191 void addTrack(double aa, double bb, double cc, double dd);
192
193 protected:
194
195 // Tile objects
196 const TileID* m_tileID{nullptr};
197 const TileHWID* m_tileHWID{nullptr};
200
204
206 Gaudi::Property<double> m_eThreshold{this, "EThreshold", 250.};
208 Gaudi::Property<double> m_deltaTimeCut{this, "DeltaTimeCut", 6.};
210 Gaudi::Property<bool> m_doWeighted{this, "DoWeighted", true};
213 Gaudi::Property<bool> m_doDensity{this, "DoDensityWeighting", true};
215 Gaudi::Property<std::string> m_beamType{this, "BeamType", "cosmics"};
217 Gaudi::Property<bool> m_doHoughTransform{this, "DoHoughTransform", true};
219 std::vector<double> m_tileDD_radiusLB;
221 std::vector<double> m_tileDD_radiusEB;
223 std::vector<double> m_tileDD_zEBA;
225 std::vector<double> m_tileDD_zEBC;
227 std::vector<double> m_tileDD_zLB;
228
230 int m_nCells{0};
232 Gaudi::Property<int> m_minimumCells{this, "MinimumCells", 2};
234 std::vector<CLHEP::Hep3Vector> m_cellPosition;
236 std::vector<double> m_cellEnergy;
238 std::vector<double> m_cellWeight;
240 std::vector<double> m_cellTime;
242 std::vector<double> m_cellDeltaTime;
244 std::vector<IdentifierHash> m_cellHash;
245
247 std::vector<std::vector<double> > m_linePar;
249 std::vector<double> m_fitMinimum;
251 std::vector<double> m_zeroCrossingTime;
252
253 double m_meanX{0.0};
254 double m_meanY{0.0};
255 double m_meanZ{0.0};
256 double m_weightedMeanX{0.0};
257 double m_weightedMeanY{0.0};
258 double m_weightedMeanZ{0.0};
259
262 bool m_reg1to2{false};
263
265
266 SG::ReadHandleKey<CaloCellContainer> m_cellContainerKey{this, "CaloCellContainer", "AllCalo",
267 "Input CaloCellContainer name" };
268
270 "TileCosmicMuonKey",
271 "TileCosmicMuonMF",
272 "Output TileCosmicMuonContainer name"};
273
274 SG::WriteHandleKey<ComTime> m_comTimeKey{this, "ComTimeKey", "ComTimeTileMuon", "Output ComTime name"};
275
276};
277
278#endif
static Double_t a
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Container class for CaloCell.
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
This is a "hash" representation of an Identifier.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
Helper class for TileCal offline identifiers.
Definition TileID.h:67
bool isHaloMuon(double azy)
void addTrack(double aa, double bb, double cc, double dd)
void doHough(double &rxy, double &axy, double &rzy, double &azy)
int whichEBr(double x1)
Returns sampling index if x1 is within EB r coordinate bounds.
unsigned int CntCells(unsigned int index1, unsigned int index2, double &skew)
std::vector< double > m_tileDD_zEBC
Z bounds of EBC, loaded from Detector Description.
TileMuonFitter(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
void trackSegmentIntersection(std::vector< double > &segPath, std::vector< int > &segPartition, std::vector< int > &segModule, std::vector< int > &segSampling, int index)
Calculates length of track intersection with TileCal (by sampling and module).
std::vector< double > m_tileDD_zLB
Z bounds of LB, loaded from Detector Description.
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
std::vector< IdentifierHash > m_cellHash
Selected cell's identifier hash.
void hough2cart(double r, double a, double offset, double &aa, double &bb)
void buildComTimeAtYequal0(int fitok)
Creates output ComTime object in StoreGate.
Gaudi::Property< int > m_minimumCells
Minimum number of cells needed for fit.
Gaudi::Property< double > m_deltaTimeCut
Cell Delta Time cut.
void buildTileCosmicMuonAtYequal0(int fitok)
Creates output TileCosmicMuon object in StoreGate.
void buildCells()
Creates an internal cell container (just vectors) from the input CaloCellContainer.
const CaloCellContainer * m_caloCells
bool guessTrack(unsigned int &index1, unsigned int &index2)
void buildComTime(int fitok)
Selects between the two next methods.
virtual bool isClonable() const override final
Specify if the algorithm is clonable.
int m_nCells
Number of cells selected for fit.
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
void buildTileCosmicMuonAtZequal0(int fitok)
Creates output TileCosmicMuon object in StoreGate.
bool checkLBr(double x1, uint8_t s1)
Checks if x1 is within LB r coordinate bounds for sampling s1.
unsigned int buildCellInfoVector()
std::vector< CellInfo > m_cellInfo
int whichModule(CLHEP::Hep3Vector tempvec)
Returns module index for TVector3 input.
void points2dir(CellInfo &ci1, CellInfo &ci2, float *w)
std::vector< double > m_cellEnergy
Selected cell's energy.
int fitTrack()
Fits a straight track to the cell centers, using the auxiliary class TileMuonTrackDistance.
void calculateTime()
Calculates time in reference plane.
std::vector< CLHEP::Hep3Vector > m_cellPosition
Position of selected cell's center.
virtual StatusCode initialize() override
void buildComTimeAtZequal0(int fitok)
Creates output ComTime object in StoreGate.
std::vector< std::vector< double > > m_linePar
Vector with the fitted four track parameters.
void calculateTimeAtZequal0()
Extrapolates cell time to z=0.
const TileDetDescrManager * m_tileMgr
std::vector< double > m_cellWeight
Selected cell's weight for fit.
bool checkEBz(double x1)
Checks if x1 is within EB z coordinate bounds.
void trackIntersection(std::vector< double > &ltop, std::vector< double > &lbot, int index)
Calculates length of track intersection with TileCal (by sampling).
SG::WriteHandleKey< TileCosmicMuonContainer > m_cosmicMuonContainerKey
Gaudi::Property< bool > m_doHoughTransform
Flag to use Hough Transform instead of Fit.
float dist2line(CellInfo &ci, float *pos, float *w)
virtual ~TileMuonFitter()
virtual StatusCode finalize() override
Gaudi::Property< bool > m_doWeighted
Flag to weigh or not the chi-square with an energy parameter.
Gaudi::Property< std::string > m_beamType
Flag to indicate: cosmics, singlebeam or collisions.
bool checkEBCz(double x1)
Checks if x1 is within EBC z coordinate bounds.
Gaudi::Property< double > m_eThreshold
Cell energy threshold.
std::vector< double > m_fitMinimum
Chi-square minumum.
void cart2hough(float x1, float y1, float x2, float y2, double &raio, double &angu)
std::vector< double > m_tileDD_zEBA
Z bounds of EBA, loaded from Detector Description.
bool checkEBAz(double x1)
Checks if x1 is within EBA z coordinate bounds.
void buildTileCosmicMuon(int fitok)
Selects between the two next methods.
void calculateTimeAtYequal0()
Extrapolates cell time to y=0.
std::vector< double > m_zeroCrossingTime
Time at y=0.
int whichLBr(double x1)
Returns sampling index if x1 is within LB r coordinate bounds.
int houghTrack()
Fits a straight track to the cells centers, using a Hough Transform algorithm.
const TileHWID * m_tileHWID
float selectCells(float *p, float *w)
std::vector< double > m_cellTime
Selected cell's time.
bool checkLBz(double x1)
Checks if x1 is within LB z coordinate bounds.
std::vector< double > m_tileDD_radiusEB
Radial bounds of the 3 samplings in EB, loaded from Detector Description.
Gaudi::Property< bool > m_doDensity
Flag defining the energy weighting parameter: energy density or plain energy.
std::vector< double > m_cellDeltaTime
Selected cell's time difference between two PMTs.
static const CaloCell_ID::SUBCALO m_caloIndex
std::vector< double > m_tileDD_radiusLB
Radial bounds of the 3 samplings in LB, loaded from Detector Description.
const TileID * m_tileID
bool checkEBr(double x1, uint8_t s1)
Checks if x1 is within EB r coordinate bounds for sampling s1.
void energyInTrack(std::vector< double > &etop, std::vector< double > &ebot, std::vector< IdentifierHash > &cells, int index)
Sums up energy in TileCal cells close to the track (by sampling).
ROOT::Minuit2::TileMuonTrackDistance * m_theTrack
Auxiliary class representing the function to be minimized - weighted sum of squares of orthogonal dis...
SG::WriteHandleKey< ComTime > m_comTimeKey
bool eventSelection()
Checks if there are good cells on the top and bottom modules.
void setEventDefaults()
Reset variables.
int r
Definition globals.cxx:22
Definition index.py:1