ATLAS Offline Software
Loading...
Searching...
No Matches
TileMuonFitter Class Reference

Fits straight cosmic muon track to TileCal event. More...

#include <TileMuonFitter.h>

Inheritance diagram for TileMuonFitter:

Public Member Functions

 TileMuonFitter (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor.
virtual ~TileMuonFitter ()
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) override
 Execute method.
virtual StatusCode finalize () override
virtual bool isClonable () const override final
 Specify if the algorithm is clonable.
void buildCells ()
 Creates an internal cell container (just vectors) from the input CaloCellContainer.
void setEventDefaults ()
 Reset variables.
bool eventSelection ()
 Checks if there are good cells on the top and bottom modules.
int fitTrack ()
 Fits a straight track to the cell centers, using the auxiliary class TileMuonTrackDistance.
int houghTrack ()
 Fits a straight track to the cells centers, using a Hough Transform algorithm.
void calculateTime ()
 Calculates time in reference plane.
void calculateTimeAtYequal0 ()
 Extrapolates cell time to y=0.
void calculateTimeAtZequal0 ()
 Extrapolates cell time to z=0.
void buildTileCosmicMuon (int fitok)
 Selects between the two next methods.
void buildTileCosmicMuonAtYequal0 (int fitok)
 Creates output TileCosmicMuon object in StoreGate.
void buildTileCosmicMuonAtZequal0 (int fitok)
 Creates output TileCosmicMuon object in StoreGate.
void buildComTime (int fitok)
 Selects between the two next methods.
void buildComTimeAtYequal0 (int fitok)
 Creates output ComTime object in StoreGate.
void buildComTimeAtZequal0 (int fitok)
 Creates output ComTime object in StoreGate.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

const TileID * m_tileID {nullptr}
const TileHWID * m_tileHWID {nullptr}
const TileDetDescrManager * m_tileMgr {nullptr}
const CaloCellContainer * m_caloCells {nullptr}
ROOT::Minuit2::TileMuonTrackDistance * m_theTrack {nullptr}
 Auxiliary class representing the function to be minimized - weighted sum of squares of orthogonal distances from track to cells).
Gaudi::Property< double > m_eThreshold {this, "EThreshold", 250.}
 Cell energy threshold.
Gaudi::Property< double > m_deltaTimeCut {this, "DeltaTimeCut", 6.}
 Cell Delta Time cut.
Gaudi::Property< bool > m_doWeighted {this, "DoWeighted", true}
 Flag to weigh or not the chi-square with an energy parameter.
Gaudi::Property< bool > m_doDensity {this, "DoDensityWeighting", true}
 Flag defining the energy weighting parameter: energy density or plain energy.
Gaudi::Property< std::string > m_beamType {this, "BeamType", "cosmics"}
 Flag to indicate: cosmics, singlebeam or collisions.
Gaudi::Property< bool > m_doHoughTransform {this, "DoHoughTransform", true}
 Flag to use Hough Transform instead of Fit.
std::vector< double > m_tileDD_radiusLB
 Radial bounds of the 3 samplings in LB, loaded from Detector Description.
std::vector< double > m_tileDD_radiusEB
 Radial bounds of the 3 samplings in EB, loaded from Detector Description.
std::vector< double > m_tileDD_zEBA
 Z bounds of EBA, loaded from Detector Description.
std::vector< double > m_tileDD_zEBC
 Z bounds of EBC, loaded from Detector Description.
std::vector< double > m_tileDD_zLB
 Z bounds of LB, loaded from Detector Description.
int m_nCells {0}
 Number of cells selected for fit.
Gaudi::Property< int > m_minimumCells {this, "MinimumCells", 2}
 Minimum number of cells needed for fit.
std::vector< CLHEP::Hep3Vector > m_cellPosition
 Position of selected cell's center.
std::vector< double > m_cellEnergy
 Selected cell's energy.
std::vector< double > m_cellWeight
 Selected cell's weight for fit.
std::vector< double > m_cellTime
 Selected cell's time.
std::vector< double > m_cellDeltaTime
 Selected cell's time difference between two PMTs.
std::vector< IdentifierHash > m_cellHash
 Selected cell's identifier hash.
std::vector< std::vector< double > > m_linePar
 Vector with the fitted four track parameters.
std::vector< double > m_fitMinimum
 Chi-square minumum.
std::vector< double > m_zeroCrossingTime
 Time at y=0.
double m_meanX {0.0}
double m_meanY {0.0}
double m_meanZ {0.0}
double m_weightedMeanX {0.0}
double m_weightedMeanY {0.0}
double m_weightedMeanZ {0.0}
int m_maxBottomIndex {0}
int m_maxTopIndex {0}
bool m_reg1to2 {false}
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
SG::WriteHandleKey< TileCosmicMuonContainer > m_cosmicMuonContainerKey
SG::WriteHandleKey< ComTime > m_comTimeKey {this, "ComTimeKey", "ComTimeTileMuon", "Output ComTime name"}

Static Protected Attributes

static const CaloCell_ID::SUBCALO m_caloIndex = CaloCell_ID::TILE

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

void trackIntersection (std::vector< double > &ltop, std::vector< double > &lbot, int index)
 Calculates length of track intersection with TileCal (by sampling).
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).
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).
bool checkLBz (double x1)
 Checks if x1 is within LB z coordinate bounds.
bool checkEBz (double x1)
 Checks if x1 is within EB z coordinate bounds.
bool checkEBAz (double x1)
 Checks if x1 is within EBA z coordinate bounds.
bool checkEBCz (double x1)
 Checks if x1 is within EBC z coordinate bounds.
bool checkLBr (double x1, uint8_t s1)
 Checks if x1 is within LB r coordinate bounds for sampling s1.
bool checkEBr (double x1, uint8_t s1)
 Checks if x1 is within EB r coordinate bounds for sampling s1.
bool checkLBr (double x1)
 Checks if x1 is within LB r coordinate bounds for any sampling.
bool checkEBr (double x1)
 Checks if x1 is within EB r coordinate bounds for any sampling.
int whichEBr (double x1)
 Returns sampling index if x1 is within EB r coordinate bounds.
int whichLBr (double x1)
 Returns sampling index if x1 is within LB r coordinate bounds.
int whichModule (CLHEP::Hep3Vector tempvec)
 Returns module index for TVector3 input.
void cart2hough (float x1, float y1, float x2, float y2, double &raio, double &angu)
void hough2cart (double r, double a, double offset, double &aa, double &bb)
float dist2line (CellInfo &ci, float *pos, float *w)
void points2dir (CellInfo &ci1, CellInfo &ci2, float *w)
unsigned int CntCells (unsigned int index1, unsigned int index2, double &skew)
bool guessTrack (unsigned int &index1, unsigned int &index2)
unsigned int buildCellInfoVector ()
float selectCells (float *p, float *w)
bool isHaloMuon (double azy)
void doHough (double &rxy, double &axy, double &rzy, double &azy)
void addTrack (double aa, double bb, double cc, double dd)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::vector< CellInfo > m_cellInfo
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Fits straight cosmic muon track to TileCal event.

This class implements a cosmic muon track reconstruction from TileCal information only. The algorithm is described in the ATL-TILECAL-INT-2007-003 note. It uses CaloCells as input, fits a straight line to the cells, weighted with energy or energy density and outputs single track parameters. Cell timing is also used to provide the time at which the muon crossed the horizontal (y=0) plane.

Definition at line 89 of file TileMuonFitter.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileMuonFitter()

TileMuonFitter::TileMuonFitter ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructor.

Definition at line 95 of file TileMuonFitter.cxx.

96 : AthAlgorithm(name, pSvcLocator)
97{
98}
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.

◆ ~TileMuonFitter()

TileMuonFitter::~TileMuonFitter ( )
virtual

Definition at line 103 of file TileMuonFitter.cxx.

103 {
104}

Member Function Documentation

◆ addTrack()

void TileMuonFitter::addTrack ( double aa,
double bb,
double cc,
double dd )
private

Definition at line 1863 of file TileMuonFitter.cxx.

1863 {
1864 std::vector<double> par;
1865 par.resize(4);
1866
1867 par[0] = aa;
1868 par[1] = bb;
1869 par[2] = cc;
1870 par[3] = dd;
1871
1872 m_linePar.push_back(par);
1873}
std::vector< std::vector< double > > m_linePar
Vector with the fitted four track parameters.

◆ buildCellInfoVector()

unsigned int TileMuonFitter::buildCellInfoVector ( )
private

Definition at line 1676 of file TileMuonFitter.cxx.

1676 {
1677 const float distance_cut[2][3] = { { 300.0, 820.0, 470.0 }, { 350.0, 540.0, 740.0 } };
1678
1679 m_cellInfo.clear();
1680 m_linePar.clear();
1681
1682 for (int i = 0; i < m_nCells; i++) {
1683 CellInfo cell;
1684
1685 cell.x = m_cellPosition[i].getX() + SHIFT_X;
1686 cell.y = m_cellPosition[i].getY();
1687 cell.z = m_cellPosition[i].getZ() + SHIFT_Z;
1688
1689 cell.e = m_cellEnergy[i];
1690 cell.ev = m_cellWeight[i];
1691
1692 cell.use = true;
1693 cell.is_out = true;
1694 cell.track_index = -1;
1695
1696 int sample = m_tileID->sample(m_tileID->cell_id(m_cellHash[i]));
1697 int section = m_tileID->section(m_tileID->cell_id(m_cellHash[i]));
1698 if (section < 1 || section > 2 || sample < 0 || sample >= 3)
1699 cell.dist = 500.0;
1700 else
1701 cell.dist = distance_cut[section - 1][sample];
1702
1703 m_cellInfo.push_back(cell);
1704 }
1705
1706 return m_cellInfo.size();
1707}
void section(const std::string &sec)
#define SHIFT_Z
#define SHIFT_X
std::vector< IdentifierHash > m_cellHash
Selected cell's identifier hash.
int m_nCells
Number of cells selected for fit.
std::vector< CellInfo > m_cellInfo
std::vector< double > m_cellEnergy
Selected cell's energy.
std::vector< CLHEP::Hep3Vector > m_cellPosition
Position of selected cell's center.
std::vector< double > m_cellWeight
Selected cell's weight for fit.
const TileID * m_tileID

◆ buildCells()

void TileMuonFitter::buildCells ( )

Creates an internal cell container (just vectors) from the input CaloCellContainer.

Throws away cells below threshold or flagged from jobOptions.

Definition at line 297 of file TileMuonFitter.cxx.

297 {
298
299 // CaloCellContainer::const_iterator collItr = celcoll->begin();
300 // CaloCellContainer::const_iterator lastColl = celcoll->end();
301
302 size_t collItr = m_caloCells->indexFirstCellCalo(m_caloIndex);
303 size_t lastColl = m_caloCells->indexLastCellCalo(m_caloIndex);
304
305 for (; collItr != lastColl; ++collItr) {
306
307 const CaloCell* cell = (*m_caloCells)[collItr];
308
309 const TileCell* tilecell = dynamic_cast<const TileCell*>(cell);
310 if (tilecell == 0) continue;
311
312 Identifier cell_id = cell->ID();
313 IdentifierHash cell_idhash = m_tileID->cell_hash(cell_id);
314 CaloDetDescrElement *caloDDE = m_tileMgr->get_cell_element(cell_id);
315
316 double ener = cell->energy();
317 double time = cell->time();
318 double deltatime = tilecell->timeDiff();
319
320 if (ener < m_eThreshold) continue; // below threshold removal
321 if (fabs(caloDDE->eta()) < 0.05 && caloDDE->r() > 3500) {
322 ATH_MSG_DEBUG( "Cell eta: " << caloDDE->eta()
323 << " Cell r: " << caloDDE->r()
324 << " Tile diff: " << tilecell->timeDiff() );
325
326 deltatime = 0;
327 }
328 if (fabs(deltatime) > m_deltaTimeCut) continue; // cut high time imbalance cells
329
330 double volume = caloDDE->volume();
331 if (volume == 0.0) {
332 ATH_MSG_DEBUG( "Warning: Skipping cell with zero volume!" );
333 continue;
334 }
335
336 if (m_doDensity)
337 m_cellWeight[m_nCells] = ener / volume;
338 else
339 m_cellWeight[m_nCells] = ener;
340 m_cellEnergy[m_nCells] = ener;
342 m_cellDeltaTime[m_nCells] = deltatime;
343 m_cellHash[m_nCells] = cell_idhash;
344 m_cellPosition[m_nCells].setX(caloDDE->x());
345 m_cellPosition[m_nCells].setY(caloDDE->y());
346 m_cellPosition[m_nCells].setZ(caloDDE->z());
347 m_nCells++;
348
349 } //end of CaloCellContainer cycle
350}
#define ATH_MSG_DEBUG(x,...)
float timeDiff(void) const
get time diff for two PMTs (data member)
Definition TileCell.h:184
Gaudi::Property< double > m_deltaTimeCut
Cell Delta Time cut.
const CaloCellContainer * m_caloCells
const TileDetDescrManager * m_tileMgr
Gaudi::Property< double > m_eThreshold
Cell energy threshold.
std::vector< double > m_cellTime
Selected cell's time.
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
time(flags, cells_name, *args, **kw)

◆ buildComTime()

void TileMuonFitter::buildComTime ( int fitok)

Selects between the two next methods.

Definition at line 1413 of file TileMuonFitter.cxx.

1413 {
1414
1415 if (!m_beamType.value().compare("singlebeam") || !m_beamType.value().compare("collisions"))
1416 buildComTimeAtZequal0(fitok);
1417 else
1418 buildComTimeAtYequal0(fitok);
1419
1420}
void buildComTimeAtYequal0(int fitok)
Creates output ComTime object in StoreGate.
void buildComTimeAtZequal0(int fitok)
Creates output ComTime object in StoreGate.
Gaudi::Property< std::string > m_beamType
Flag to indicate: cosmics, singlebeam or collisions.

◆ buildComTimeAtYequal0()

void TileMuonFitter::buildComTimeAtYequal0 ( int fitok)

Creates output ComTime object in StoreGate.

Definition at line 1425 of file TileMuonFitter.cxx.

1425 {
1426
1427 // Uses the track parameters to calculate:
1428 // position and direction at horizontal at horizontal plane
1429 // Since y = a + b*x and z = c + d*x
1430 // y == 0 => x = -a/b && z = c - d*a/b
1431 // Direction is (1,b,d)/sqrt(1 + b*b + d*d)
1432 //
1433 // Then put the result in a ComTime object
1434
1435
1436 double p0, p1, p2, p3;
1437 double ztime;
1438
1439 if (m_linePar.size() == 0) {
1440 p0 = 0.0;
1441 p1 = 0.0;
1442 p2 = 0.0;
1443 p3 = 0.0;
1444 ztime = 0.0;
1445 } else {
1446 p0 = m_linePar[0][0];
1447 p1 = m_linePar[0][1];
1448 p2 = m_linePar[0][2];
1449 p3 = m_linePar[0][3];
1450 ztime = m_zeroCrossingTime[0];
1451 }
1452
1453 ATH_MSG_DEBUG( "Starting BuildComTime at y=0 m_linePar: "
1454 << p0 << " " << p1 << " " << p2 << " " << p3 );
1455
1456 SG::WriteHandle<ComTime> theComTime (m_comTimeKey);
1457 StatusCode sc;
1458 if (!(fitok == 1) || p1 == 0.0) {
1459 sc = theComTime.record(std::make_unique<ComTime>());
1460 } else {
1461 Hep3Vector theZeroCrossingPosition(-1.0 * p0 / p1, 0.0, p2 - 1.0 * p3 * p0 / p1);
1462 Hep3Vector theDirection(1.0, p1, p3);
1463 theDirection = theDirection.unit();
1464 if ((m_reg1to2 && p1 > 0.0) || (!m_reg1to2 && p1 < 0.0)) theDirection *= -1.0;
1465
1466 sc = theComTime.record(std::make_unique<ComTime>(0.0, ztime, theZeroCrossingPosition, theDirection));
1467
1468 if (msgLvl(MSG::DEBUG)) {
1469
1470 msg(MSG::DEBUG) << "Time: " << ztime
1471 << " Position X: " << theZeroCrossingPosition.getX()
1472 << " Position Y: " << theZeroCrossingPosition.getY()
1473 << " Position Z: " << theZeroCrossingPosition.getZ() << endmsg;
1474
1475 msg(MSG::DEBUG) << "Direction u: " << theDirection.getX()
1476 << " Direction v: " << theDirection.getY()
1477 << " Direction w: " << theDirection.getZ() << endmsg;
1478 }
1479 }
1480
1481 if (sc.isFailure()) {
1482 ATH_MSG_FATAL( "Cannot record ComTime" );
1483 }
1484}
#define endmsg
#define ATH_MSG_FATAL(x,...)
static Double_t sc
bool msgLvl(const MSG::Level lvl) const
std::vector< double > m_zeroCrossingTime
Time at y=0.
SG::WriteHandleKey< ComTime > m_comTimeKey
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ buildComTimeAtZequal0()

void TileMuonFitter::buildComTimeAtZequal0 ( int fitok)

Creates output ComTime object in StoreGate.

Definition at line 1490 of file TileMuonFitter.cxx.

1490 {
1491
1492 // Uses the track parameters to calculate:
1493 // position and direction at vertical plane
1494 // Since y = a + b*x and z = c + d*x
1495 // z == 0 => x = -c/d && y = a - b*c/d
1496 // Direction is (1,b,d)/sqrt(1 + b*b + d*d)
1497 //
1498 // Then put the result in a ComTime object
1499
1500 double p0, p1, p2, p3;
1501 double ztime;
1502
1503 if (m_linePar.size() == 0) {
1504 p0 = 0.0;
1505 p1 = 0.0;
1506 p2 = 0.0;
1507 p3 = 0.0;
1508 ztime = 0.0;
1509 } else {
1510 p0 = m_linePar[0][0];
1511 p1 = m_linePar[0][1];
1512 p2 = m_linePar[0][2];
1513 p3 = m_linePar[0][3];
1514 ztime = m_zeroCrossingTime[0];
1515 }
1516
1517 ATH_MSG_DEBUG( "Starting BuildComTime at z=0 m_linePar: "
1518 << p0 << " " << p1 << " " << p2 << " " << p3 );
1519
1520 SG::WriteHandle<ComTime> theComTime (m_comTimeKey);
1521 StatusCode sc;
1522 if (!(fitok == 1) || p3 == 0.0) {
1523 sc = theComTime.record(std::make_unique<ComTime>());
1524 } else {
1525 Hep3Vector theZeroCrossingPosition(-1.0 * p2 / p3, p0 - 1.0 * p1 * p2 / p3, 0.0);
1526 Hep3Vector theDirection(1.0, p1, p3);
1527 theDirection = theDirection.unit();
1528 if ((m_reg1to2 && p3 > 0.0) || (!m_reg1to2 && p3 < 0.0)) theDirection *= -1.0;
1529
1530 sc = theComTime.record(std::make_unique<ComTime>(0.0, ztime, theZeroCrossingPosition, theDirection));
1531
1532 if (msgLvl(MSG::DEBUG)) {
1533
1534 msg(MSG::DEBUG) << "Time: " << ztime
1535 << " Position X: " << theZeroCrossingPosition.getX()
1536 << " Position Y: " << theZeroCrossingPosition.getY()
1537 << " Position Z: " << theZeroCrossingPosition.getZ() << endmsg;
1538
1539 msg(MSG::DEBUG) << "Direction u: " << theDirection.getX()
1540 << " Direction v: " << theDirection.getY()
1541 << " Direction w: " << theDirection.getZ() << endmsg;
1542 }
1543 }
1544
1545 if (sc.isFailure()) {
1546 ATH_MSG_FATAL( "Cannot record ComTime" );
1547 }
1548}

◆ buildTileCosmicMuon()

void TileMuonFitter::buildTileCosmicMuon ( int fitok)

Selects between the two next methods.

Definition at line 646 of file TileMuonFitter.cxx.

646 {
647
648 if (!m_beamType.value().compare("singlebeam") || !m_beamType.value().compare("collisions"))
650 else
652
653}
void buildTileCosmicMuonAtYequal0(int fitok)
Creates output TileCosmicMuon object in StoreGate.
void buildTileCosmicMuonAtZequal0(int fitok)
Creates output TileCosmicMuon object in StoreGate.

◆ buildTileCosmicMuonAtYequal0()

void TileMuonFitter::buildTileCosmicMuonAtYequal0 ( int fitok)

Creates output TileCosmicMuon object in StoreGate.

Definition at line 659 of file TileMuonFitter.cxx.

659 {
660
661 // Uses the track parameters to calculate:
662 // position and direction at horizontal at horizontal plane
663 // Since y = a + b*x and z = c + d*x
664 // y == 0 => x = -a/b && z = c - d*a/b
665 // Direction is (1,b,d)/sqrt(1 + b*b + d*d)
666 //
667 // Then put the result in a ComTime object
668
669 SG::WriteHandle<TileCosmicMuonContainer> cosmicMuonContainer (m_cosmicMuonContainerKey);
670 StatusCode sc = cosmicMuonContainer.record(std::make_unique<TileCosmicMuonContainer>());
671 if (sc.isFailure()) {
672 ATH_MSG_FATAL( "Cannot record TileCosmicMuonContainer" << cosmicMuonContainer.key() );
673 }
674
675 for (unsigned int n = 0; n < m_linePar.size(); n++) {
676 double p0 = m_linePar[n][0];
677 double p1 = m_linePar[n][1];
678 double p2 = m_linePar[n][2];
679 double p3 = m_linePar[n][3];
680
681 ATH_MSG_DEBUG( "Starting BuildTileCosmicMuon at y=0 m_linePar: "
682 << p0 << " " << p1 << " " << p2 << " " << p3 );
683
684 TileCosmicMuon *theTileCosmicMuon = new TileCosmicMuon();
685
686 if (!(fitok == 1) || p1 == 0.0) {
687 cosmicMuonContainer->push_back(theTileCosmicMuon);
688 } else {
689 Hep3Vector theDirection(1.0, p1, p3);
690 theDirection = theDirection.unit();
691 if ((m_reg1to2 && p1 > 0.0) || (!m_reg1to2 && p1 < 0.0)) theDirection *= -1.0;
692
693 std::vector<double> ltop, lbot, etop, ebot;
694 std::vector<IdentifierHash> cells;
695 std::vector<double> segPath;
696 std::vector<int> segPartition, segModule, segSampling;
697
698 if (m_linePar.size() > 0) trackIntersection(ltop, lbot, n);
699 if (m_linePar.size() > 0)
700 trackSegmentIntersection(segPath, segPartition, segModule, segSampling, n);
701 if (m_linePar.size() > 0) energyInTrack(etop, ebot, cells, n);
702
703 theTileCosmicMuon->SetTime(m_zeroCrossingTime[n]);
704 theTileCosmicMuon->SetPositionX(-1.0 * p0 / p1);
705 theTileCosmicMuon->SetPositionY(0.);
706 theTileCosmicMuon->SetPositionZ(p2 - 1.0 * p3 * p0 / p1);
707 theTileCosmicMuon->SetDirectionPhi(theDirection.phi());
708 theTileCosmicMuon->SetDirectionTheta(theDirection.theta());
709 theTileCosmicMuon->SetFitQuality(m_fitMinimum[n]);
710 theTileCosmicMuon->SetFitNCells(m_nCells);
711 theTileCosmicMuon->SetPathTop(ltop);
712 theTileCosmicMuon->SetPathBottom(lbot);
713 theTileCosmicMuon->SetSegmentPath(segPath);
714 theTileCosmicMuon->SetSegmentPartition(segPartition);
715 theTileCosmicMuon->SetSegmentModule(segModule);
716 theTileCosmicMuon->SetSegmentSampling(segSampling);
717 theTileCosmicMuon->SetEnergyTop(etop);
718 theTileCosmicMuon->SetEnergyBottom(ebot);
719 theTileCosmicMuon->SetTrackCellHash(cells);
720
721 cosmicMuonContainer->push_back(theTileCosmicMuon);
722 }
723
724 }
725
726 if (fitok != 2) delete m_theTrack;
727}
void SetSegmentModule(const std::vector< int > &module)
void SetPathBottom(const std::vector< double > &path)
void SetEnergyBottom(const std::vector< double > &energy)
void SetPositionZ(double posz)
void SetPositionY(double posy)
void SetTime(double time)
Setters.
void SetDirectionTheta(double theta)
void SetSegmentPath(const std::vector< double > &path)
void SetSegmentSampling(const std::vector< int > &sampling)
void SetSegmentPartition(const std::vector< int > &partition)
void SetEnergyTop(const std::vector< double > &energy)
void SetFitNCells(int ncells)
void SetTrackCellHash(const std::vector< IdentifierHash > &cells)
void SetPositionX(double posx)
void SetPathTop(const std::vector< double > &path)
void SetFitQuality(double quality)
void SetDirectionPhi(double phi)
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).
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
std::vector< double > m_fitMinimum
Chi-square minumum.
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...

◆ buildTileCosmicMuonAtZequal0()

void TileMuonFitter::buildTileCosmicMuonAtZequal0 ( int fitok)

Creates output TileCosmicMuon object in StoreGate.

Definition at line 732 of file TileMuonFitter.cxx.

732 {
733
734 // Uses the track parameters to calculate:
735 // position and direction at horizontal at horizontal plane
736 // Since y = a + b*x and z = c + d*x
737 // z == 0 => x = -c/d && y = a - b*c/d
738 // Direction is (1,b,d)/sqrt(1 + b*b + d*d)
739 //
740 // Then put the result in a ComTime object
741
742 SG::WriteHandle<TileCosmicMuonContainer> cosmicMuonContainer (m_cosmicMuonContainerKey);
743 StatusCode sc = cosmicMuonContainer.record(std::make_unique<TileCosmicMuonContainer>());
744 if (sc.isFailure()) {
745 ATH_MSG_FATAL( "Cannot record TileCosmicMuonContainer" << cosmicMuonContainer.key() );
746 }
747
748 for (unsigned int n = 0; n < m_linePar.size(); n++) {
749 double p0 = m_linePar[n][0];
750 double p1 = m_linePar[n][1];
751 double p2 = m_linePar[n][2];
752 double p3 = m_linePar[n][3];
753
754 ATH_MSG_DEBUG( "Starting BuildTileCosmicMuon at z=0 m_linePar: "
755 << p0 << " " << p1 << " " << p2 << " " << p3 );
756
757 TileCosmicMuon *theTileCosmicMuon = new TileCosmicMuon();
758
759 if (!(fitok == 1) || p3 == 0.0) {
760 cosmicMuonContainer->push_back(theTileCosmicMuon);
761 } else {
762 Hep3Vector theDirection(1.0, p1, p3);
763 theDirection = theDirection.unit();
764 if ((m_reg1to2 && p3 > 0.0) || (!m_reg1to2 && p3 < 0.0)) theDirection *= -1.0;
765
766 std::vector<double> ltop, lbot, etop, ebot;
767 std::vector<IdentifierHash> cells;
768 std::vector<double> segPath;
769 std::vector<int> segPartition, segModule, segSampling;
770
771 if (m_linePar.size() > 0) trackIntersection(ltop, lbot, n);
772 if (m_linePar.size() > 0)
773 trackSegmentIntersection(segPath, segPartition, segModule, segSampling, n);
774 if (m_linePar.size() > 0) energyInTrack(etop, ebot, cells, n);
775
776 theTileCosmicMuon->SetTime(m_zeroCrossingTime[n]);
777 theTileCosmicMuon->SetPositionX(-1.0 * p2 / p3);
778 theTileCosmicMuon->SetPositionY(p0 - 1.0 * p1 * p2 / p3);
779 theTileCosmicMuon->SetPositionZ(0.);
780 theTileCosmicMuon->SetDirectionPhi(theDirection.phi());
781 theTileCosmicMuon->SetDirectionTheta(theDirection.theta());
782 theTileCosmicMuon->SetFitQuality(m_fitMinimum[n]);
783 theTileCosmicMuon->SetFitNCells(m_nCells);
784 theTileCosmicMuon->SetPathTop(ltop);
785 theTileCosmicMuon->SetPathBottom(lbot);
786 theTileCosmicMuon->SetSegmentPath(segPath);
787 theTileCosmicMuon->SetSegmentPartition(segPartition);
788 theTileCosmicMuon->SetSegmentModule(segModule);
789 theTileCosmicMuon->SetSegmentSampling(segSampling);
790 theTileCosmicMuon->SetEnergyTop(etop);
791 theTileCosmicMuon->SetEnergyBottom(ebot);
792 theTileCosmicMuon->SetTrackCellHash(cells);
793
794 cosmicMuonContainer->push_back(theTileCosmicMuon);
795 }
796
797 }
798
799 if (fitok != 2) delete m_theTrack;
800}

◆ calculateTime()

void TileMuonFitter::calculateTime ( )

Calculates time in reference plane.

Definition at line 508 of file TileMuonFitter.cxx.

508 {
509
510 if (!m_beamType.value().compare("singlebeam") || !m_beamType.value().compare("collisions"))
512 else
514
515}
void calculateTimeAtZequal0()
Extrapolates cell time to z=0.
void calculateTimeAtYequal0()
Extrapolates cell time to y=0.

◆ calculateTimeAtYequal0()

void TileMuonFitter::calculateTimeAtYequal0 ( )

Extrapolates cell time to y=0.

Definition at line 520 of file TileMuonFitter.cxx.

520 {
521
522 // Uses the track parameters to calculate:
523 // time, position at horizontal plane
524 // Since y = a + b*x and z = c + d*x
525 // y == 0 => x = -a/b && z = c - d*a/b
526 // Time is average from each corrected with tof along track
527
528
529 for (unsigned int n = 0; n < m_linePar.size(); n++) {
530 double p0 = m_linePar[n][0];
531 double p1 = m_linePar[n][1];
532 double p2 = m_linePar[n][2];
533 double p3 = m_linePar[n][3];
534
535 ATH_MSG_DEBUG( "Starting CalculateTime at Y=0 m_linePar: "
536 << p0 << " " << p1 << " " << p2 << " " << p3 );
537
538 double correction = 0, weight = 1.0, weightsum = 0, time = 0;
539
540 if (p1 == 0) {
541 m_zeroCrossingTime.push_back(0.0);
542 } else {
543 Hep3Vector theZeroCrossingPosition(-1.0 * p0 / p1, 0.0, p2 - 1.0 * p3 * p0 / p1);
544
545 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Using cells to calculate time at Y=0: ";
546
547 for (int i = 0; i < m_nCells; i++) {
548 if (m_doHoughTransform && m_cellInfo[i].track_index != (int) n) continue; // use only cells that belong to the current track
549
550 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << i << "/ ";
551 Hep3Vector dataP(m_cellPosition[i].getX(), m_cellPosition[i].getY(),
552 m_cellPosition[i].getZ());
553 Hep3Vector lineP(m_theTrack->ClosestPoint(&dataP, m_linePar[n]));
554 correction = (theZeroCrossingPosition - lineP).mag() / c_light;
555
557 if ((m_reg1to2 && (m_cellPosition[i].getY() > 0))
558 || (!m_reg1to2 && (m_cellPosition[i].getY() < 0))) {
559 correction = 1.0 * correction;
560 } else {
561 correction = -1.0 * correction;
562 }
563
565 weightsum += weight;
566 }
567
568 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << endmsg;
569
570 if (weightsum > 0)
571 m_zeroCrossingTime.push_back(time / weightsum);
572 else
573 m_zeroCrossingTime.push_back(0.0);
574
575 ATH_MSG_DEBUG( "Time at Y=0: " << m_zeroCrossingTime[n] );
576 }
577 }
578}
Scalar mag() const
mag method
Gaudi::Property< bool > m_doHoughTransform
Flag to use Hough Transform instead of Fit.
Gaudi::Property< bool > m_doWeighted
Flag to weigh or not the chi-square with an energy parameter.
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ calculateTimeAtZequal0()

void TileMuonFitter::calculateTimeAtZequal0 ( )

Extrapolates cell time to z=0.

Definition at line 583 of file TileMuonFitter.cxx.

583 {
584
585 // Uses the track parameters to calculate:
586 // time, position at vertical plane
587 // Since y = a + b*x and z = c + d*x
588 // z == 0 => x = -c/d && y = a - b*c/d
589 // Time is average from each corrected with tof along track
590
591
592 for (unsigned int n = 0; n < m_linePar.size(); n++) {
593 double p0 = m_linePar[n][0];
594 double p1 = m_linePar[n][1];
595 double p2 = m_linePar[n][2];
596 double p3 = m_linePar[n][3];
597
598 ATH_MSG_DEBUG( "Starting CalculateTime at Z=0 m_linePar: "
599 << p0 << " " << p1 << " " << p2 << " " << p3 );
600
601 double correction = 0, weight = 1.0, weightsum = 0, time = 0;
602
603 if (p3 == 0) {
604 m_zeroCrossingTime.push_back(0.0);
605 } else {
606 Hep3Vector theZeroCrossingPosition(-1.0 * p2 / p3, p0 - 1.0 * p1 * p2 / p3, 0.0);
607
608 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Using cells to calculate time at Z=0: ";
609
610 for (int i = 0; i < m_nCells; i++) {
611 if (m_doHoughTransform && m_cellInfo[i].track_index != (int) n) continue; // use only cells that belong to the current track
612
613 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << i << "/ ";
614 Hep3Vector dataP(m_cellPosition[i].getX(), m_cellPosition[i].getY(),
615 m_cellPosition[i].getZ());
616 Hep3Vector lineP(m_theTrack->ClosestPoint(&dataP, m_linePar[n]));
617 correction = (theZeroCrossingPosition - lineP).mag() / c_light;
618
620 if ((m_reg1to2 && (m_cellPosition[i].getZ() > 0))
621 || (!m_reg1to2 && (m_cellPosition[i].getZ() < 0)))
622 correction = 1.0 * correction;
623 else
624 correction = -1.0 * correction;
625
627 weightsum += weight;
628 }
629
630 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << endmsg;
631
632 if (weightsum > 0)
633 m_zeroCrossingTime.push_back(time / weightsum);
634 else
635 m_zeroCrossingTime.push_back(0.0);
636
637 ATH_MSG_DEBUG( "Time: " << m_zeroCrossingTime[n] );
638 }
639 }
640}

◆ cart2hough()

void TileMuonFitter::cart2hough ( float x1,
float y1,
float x2,
float y2,
double & raio,
double & angu )
private

Definition at line 1555 of file TileMuonFitter.cxx.

1556 {
1557
1558 // track should have at least a very small angle
1559 if (x1 == x2) x1 += 0.001F;
1560 if (y1 == y2) y1 += 0.001F;
1561
1562 double a = (y1 - y2) / (x1 - x2);
1563 double b = y1 - a * x1;
1564
1565 raio = fabs(b) / sqrt(a * a + 1.0);
1566
1567 if (a < 0.0 && b > 0.0)
1568 angu = atan(a) + pi / 2.0;
1569 else if (a > 0.0 && b < 0.0)
1570 angu = atan(a) - pi / 2.0;
1571 else if (a < 0.0 && b < 0.0)
1572 angu = atan(a) - pi / 2.0;
1573 else
1574 angu = atan(a) + pi / 2.0;
1575
1576 angu = angu - pi;
1577 if (angu < 0.0) angu = 2.0 * pi + angu;
1578}
static Double_t a
#define pi

◆ checkEBAz()

bool TileMuonFitter::checkEBAz ( double x1)
private

Checks if x1 is within EBA z coordinate bounds.

Definition at line 1267 of file TileMuonFitter.cxx.

1267 {
1268 if (x1 > m_tileDD_zEBA[0] && x1 < m_tileDD_zEBA[1])
1269 return true;
1270 else
1271 return false;
1272}
std::vector< double > m_tileDD_zEBA
Z bounds of EBA, loaded from Detector Description.

◆ checkEBCz()

bool TileMuonFitter::checkEBCz ( double x1)
private

Checks if x1 is within EBC z coordinate bounds.

Definition at line 1276 of file TileMuonFitter.cxx.

1276 {
1277 if (x1 > m_tileDD_zEBC[0] && x1 < m_tileDD_zEBC[1])
1278 return true;
1279 else
1280 return false;
1281}
std::vector< double > m_tileDD_zEBC
Z bounds of EBC, loaded from Detector Description.

◆ checkEBr() [1/2]

bool TileMuonFitter::checkEBr ( double x1)
private

Checks if x1 is within EB r coordinate bounds for any sampling.

Definition at line 1295 of file TileMuonFitter.cxx.

1295 {
1296 if (x1 < 0.0) x1 = -1.0 * x1;
1297 if (x1 > m_tileDD_radiusEB[0] && x1 < m_tileDD_radiusEB[3])
1298 return true;
1299 else
1300 return false;
1301}
std::vector< double > m_tileDD_radiusEB
Radial bounds of the 3 samplings in EB, loaded from Detector Description.

◆ checkEBr() [2/2]

bool TileMuonFitter::checkEBr ( double x1,
uint8_t s1 )
private

Checks if x1 is within EB r coordinate bounds for sampling s1.

Definition at line 1316 of file TileMuonFitter.cxx.

1316 {
1317 if (s1 > 3U) return false;
1318 if (x1 < 0.0) x1 = -1.0 * x1;
1319 if (x1 > m_tileDD_radiusEB[s1] && x1 < m_tileDD_radiusEB[s1 + 1])
1320 return true;
1321 else
1322 return false;
1323}

◆ checkEBz()

bool TileMuonFitter::checkEBz ( double x1)
private

Checks if x1 is within EB z coordinate bounds.

Definition at line 1261 of file TileMuonFitter.cxx.

1261 {
1262 return (checkEBAz(x1) || checkEBCz(x1));
1263}
bool checkEBCz(double x1)
Checks if x1 is within EBC z coordinate bounds.
bool checkEBAz(double x1)
Checks if x1 is within EBA z coordinate bounds.

◆ checkLBr() [1/2]

bool TileMuonFitter::checkLBr ( double x1)
private

Checks if x1 is within LB r coordinate bounds for any sampling.

Definition at line 1285 of file TileMuonFitter.cxx.

1285 {
1286 if (x1 < 0) x1 = -1.0 * x1;
1287 if (x1 > m_tileDD_radiusLB[0] && x1 < m_tileDD_radiusLB[3])
1288 return true;
1289 else
1290 return false;
1291}
std::vector< double > m_tileDD_radiusLB
Radial bounds of the 3 samplings in LB, loaded from Detector Description.

◆ checkLBr() [2/2]

bool TileMuonFitter::checkLBr ( double x1,
uint8_t s1 )
private

Checks if x1 is within LB r coordinate bounds for sampling s1.

Definition at line 1305 of file TileMuonFitter.cxx.

1305 {
1306 if (s1 > 3U) return false;
1307 if (x1 < 0.0) x1 = -1.0 * x1;
1308 if (x1 > m_tileDD_radiusLB[s1] && x1 < m_tileDD_radiusLB[s1 + 1])
1309 return true;
1310 else
1311 return false;
1312}

◆ checkLBz()

bool TileMuonFitter::checkLBz ( double x1)
private

Checks if x1 is within LB z coordinate bounds.

Definition at line 1252 of file TileMuonFitter.cxx.

1252 {
1253 if (x1 > m_tileDD_zLB[0] && x1 < m_tileDD_zLB[1])
1254 return true;
1255 else
1256 return false;
1257}
std::vector< double > m_tileDD_zLB
Z bounds of LB, loaded from Detector Description.

◆ CntCells()

unsigned int TileMuonFitter::CntCells ( unsigned int index1,
unsigned int index2,
double & skew )
private

Definition at line 1621 of file TileMuonFitter.cxx.

1621 {
1622
1623 unsigned int size = m_cellInfo.size();
1624 double dist;
1625
1626 // compute direction -------------------------------------------------------
1627
1628 float p[3] = { m_cellInfo[index1].x, m_cellInfo[index1].y, m_cellInfo[index1].z };
1629 float w[3];
1630 points2dir(m_cellInfo[index1], m_cellInfo[index2], w);
1631
1632 // find number of cells inside RoI -----------------------------------------
1633
1634 unsigned int cnt = 0U;
1635 skew = 0.0;
1636 for (unsigned int i = 0U; i < size; i++) {
1637 if (!m_cellInfo[i].use || i == index1 || i == index2) continue;
1638
1639 dist = dist2line(m_cellInfo[i], p, w);
1640 if (dist < m_cellInfo[i].dist * 0.5F) {
1641 cnt++;
1642 skew += dist;
1643 }
1644 }
1645 if (cnt > 0U) skew /= (int) cnt;
1646
1647 return cnt;
1648}
size_t size() const
Number of registered mappings.
void points2dir(CellInfo &ci1, CellInfo &ci2, float *w)
float dist2line(CellInfo &ci, float *pos, float *w)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ dist2line()

float TileMuonFitter::dist2line ( CellInfo & ci,
float * pos,
float * w )
private

Definition at line 1595 of file TileMuonFitter.cxx.

1595 {
1596 float v0, v1, v2, d0, d1, d2;
1597
1598 v0 = ci.x - pos[0];
1599 v1 = ci.y - pos[1];
1600 v2 = ci.z - pos[2];
1601
1602 d0 = v1 * w[2] - w[1] * v2;
1603 d1 = w[0] * v2 - v0 * w[2];
1604 d2 = v0 * w[1] - w[0] * v1;
1605
1606 return sqrt(d0 * d0 + d1 * d1 + d2 * d2);
1607}

◆ doHough()

void TileMuonFitter::doHough ( double & rxy,
double & axy,
double & rzy,
double & azy )
private

Definition at line 1737 of file TileMuonFitter.cxx.

1737 {
1738 unsigned int i, j;
1739
1740 // dont need to compute other iteration for Halo events
1741 if (isHaloMuon(azy)) return;
1742
1743 float nminrxy = rxy - 4.0 * BIN_RES_RXY;
1744 float nmaxrxy = rxy + 4.0 * BIN_RES_RXY;
1745 float nminaxy = axy - 4.0 * BIN_RES_AXY;
1746 float nmaxaxy = axy + 4.0 * BIN_RES_AXY;
1747 float nminrzy = rzy - 5.0 * BIN_RES_RZY;
1748 float nmaxrzy = rzy + 5.0 * BIN_RES_RZY;
1749 float nminazy = azy - 5.0 * BIN_RES_AZY;
1750 float nmaxazy = azy + 5.0 * BIN_RES_AZY;
1751
1752 float weight;
1753 float aw = 0.0F;
1754 float arxy = 0.0F;
1755 float aaxy = 0.0F;
1756 float arzy = 0.0F;
1757 float aazy = 0.0F;
1758
1759 unsigned int NPoints = m_cellInfo.size();
1760 for (i = 1; i < NPoints; i++) {
1761 for (j = 0; j < i; j++) {
1762 cart2hough(m_cellInfo[i].x, m_cellInfo[i].y, m_cellInfo[j].x, m_cellInfo[j].y, rxy, axy);
1763 cart2hough(m_cellInfo[i].z, m_cellInfo[i].y, m_cellInfo[j].z, m_cellInfo[j].y, rzy, azy);
1764
1765 if (rxy < nminrxy || rxy > nmaxrxy || axy < nminaxy || axy > nmaxaxy || rzy < nminrzy
1766 || rzy > nmaxrzy || azy < nminazy || azy > nmaxazy) continue;
1767
1768 weight = m_cellInfo[i].ev * m_cellInfo[j].ev;
1769
1770 arxy += rxy * weight;
1771 aaxy += axy * weight;
1772 arzy += rzy * weight;
1773 aazy += azy * weight;
1774 aw += weight;
1775 }
1776 }
1777
1778 const double inv_aw = 1. / aw;
1779 rxy = arxy * inv_aw;
1780 axy = aaxy * inv_aw;
1781 rzy = arzy * inv_aw;
1782 azy = aazy * inv_aw;
1783}
#define BIN_RES_RXY
#define BIN_RES_AZY
#define BIN_RES_RZY
#define BIN_RES_AXY
#define y
#define x
#define z
bool isHaloMuon(double azy)
void cart2hough(float x1, float y1, float x2, float y2, double &raio, double &angu)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ energyInTrack()

void TileMuonFitter::energyInTrack ( std::vector< double > & etop,
std::vector< double > & ebot,
std::vector< IdentifierHash > & cells,
int index )
private

Sums up energy in TileCal cells close to the track (by sampling).

Definition at line 1360 of file TileMuonFitter.cxx.

1361 {
1362
1363 int is;
1364 double distance_cut[2][3] = { { 300., 375., 860. }, { 750., 750., 1700. } };
1365 etop.resize(3);
1366 ebot.resize(3);
1367 for (is = 0; is < 3; is++) {
1368 etop[is] = 0.;
1369 ebot[is] = 0.;
1370 }
1371 Hep3Vector dataP;
1372 Hep3Vector lineP;
1373
1374 size_t collItr = m_caloCells->indexFirstCellCalo(m_caloIndex);
1375 size_t lastColl = m_caloCells->indexLastCellCalo(m_caloIndex);
1376
1377 for (; collItr != lastColl; ++collItr) {
1378
1379 const CaloCell* cell = (*m_caloCells)[collItr];
1380 const TileCell* tilecell = dynamic_cast<const TileCell*>(cell);
1381 if (tilecell == 0) continue;
1382
1383 Identifier cell_id = cell->ID();
1384 IdentifierHash cell_idhash = m_tileID->cell_hash(cell_id);
1385 CaloDetDescrElement *caloDDE = m_tileMgr->get_cell_element(cell_id);
1386
1387 double volume = caloDDE->volume();
1388 if (volume == 0.0) {
1389 ATH_MSG_DEBUG( "Warning: Skipping cell with zero volume!" );
1390 continue;
1391 }
1392
1393 int sample = m_tileID->sample(cell_id);
1394 int section = m_tileID->section(cell_id);
1395 if (section < 1 || section > 2 || sample < 0 || sample >= 3) break;
1396 dataP.set(caloDDE->x(), caloDDE->y(), caloDDE->z());
1397 lineP = m_theTrack->ClosestPoint(&dataP, m_linePar[index]);
1398 double distance = (dataP - lineP).mag();
1399 if (distance < distance_cut[section - 1][sample]) {
1400 cells.push_back(cell_idhash);
1401 if (caloDDE->y() > 0.0) etop[sample] += cell->energy();
1402 else ebot[sample] += cell->energy();
1403 }
1404
1405 } //end of CaloCellContainer cycle
1406
1407}
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space

◆ eventSelection()

bool TileMuonFitter::eventSelection ( )

Checks if there are good cells on the top and bottom modules.

If not, skips event.

Definition at line 356 of file TileMuonFitter.cxx.

356 {
357 // simple check if there are cells on top and bottom halfs
358 // returns 1 if both top and bottom have energy,
359 // JM, Aug08: Change to allow for single beam halo muon
360 // looks for A/C side instead of top/bottom
361
362 if (m_nCells < m_minimumCells) return false;
363
364 double maxReg1Energy;
365 double maxReg2Energy;
366 double cellPosition;
367 int maxReg1Index;
368 int maxReg2Index;
369 bool selection = false;
370 maxReg1Energy = maxReg2Energy = 0.;
371 maxReg1Index = maxReg2Index = -1;
372
373 for (int i = 0; i < m_nCells; i++) {
374 if (!m_beamType.value().compare("singlebeam")) {
375 cellPosition = m_cellPosition[i].getZ();
376 } else if (!m_beamType.value().compare("collisions")) {
377 cellPosition = 1.;
378 } else {
379 cellPosition = m_cellPosition[i].getY();
380 }
381
382 if (cellPosition > 0) {
383 if (m_cellEnergy[i] > maxReg1Energy) {
384 maxReg1Energy = m_cellEnergy[i];
385 maxReg1Index = i;
386 }
387 } else {
388 if (m_cellEnergy[i] > maxReg2Energy) {
389 maxReg2Energy = m_cellEnergy[i];
390 maxReg2Index = i;
391 }
392 }
393 }
394
395 m_reg1to2 = 1;
396 if (maxReg1Index >= 0 && maxReg2Index >= 0) {
397 if (m_cellTime[maxReg2Index] < m_cellTime[maxReg1Index]) m_reg1to2 = 0;
398 }
399
400 if (!m_beamType.value().compare("collisions")) {
401 selection = (maxReg1Energy > m_eThreshold);
402 } else {
403 selection = (maxReg2Energy > m_eThreshold && maxReg1Energy > m_eThreshold);
404 }
405
406 return selection;
407}
Gaudi::Property< int > m_minimumCells
Minimum number of cells needed for fit.
const std::string selection

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TileMuonFitter::execute ( const EventContext & ctx)
overridevirtual

Execute method.

Implements AthAlgorithm.

Definition at line 231 of file TileMuonFitter.cxx.

231 {
232
233 ATH_MSG_DEBUG( " start execute " );
234
235 int fitStatus = 2; //not even try
237
238 SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerKey, ctx);
239 if (!cellContainer.isValid()) {
240 ATH_MSG_WARNING( " Could not find container " << m_cellContainerKey.key() );
241 } else {
242 ATH_MSG_DEBUG( "Container " << m_cellContainerKey.key() << " with CaloCells found " );
243
244 m_caloCells = cellContainer.cptr();
245
246 // check on number of tile cells
247 if (m_caloCells->nCellsCalo(m_caloIndex) == 0) {
248 ATH_MSG_DEBUG( "no TileCells in CellContainer " << m_cellContainerKey.key() << "> for this event!" );
249 } else {
250 buildCells();
251 }
252
253 if (eventSelection()) {
255 fitStatus = fitTrack();
256 else
257 fitStatus = houghTrack();
258 if (fitStatus) calculateTime();
259 }
260
261 buildTileCosmicMuon(fitStatus);
262 buildComTime(fitStatus);
263 }
264
265 // Execution completed.
266 ATH_MSG_DEBUG( "TileMuonFitter execution completed." );
267
268 return StatusCode::SUCCESS;
269}
#define ATH_MSG_WARNING(x,...)
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
void buildCells()
Creates an internal cell container (just vectors) from the input CaloCellContainer.
void buildComTime(int fitok)
Selects between the two next methods.
int fitTrack()
Fits a straight track to the cell centers, using the auxiliary class TileMuonTrackDistance.
void calculateTime()
Calculates time in reference plane.
void buildTileCosmicMuon(int fitok)
Selects between the two next methods.
int houghTrack()
Fits a straight track to the cells centers, using a Hough Transform algorithm.
bool eventSelection()
Checks if there are good cells on the top and bottom modules.
void setEventDefaults()
Reset variables.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode TileMuonFitter::finalize ( )
overridevirtual

Definition at line 221 of file TileMuonFitter.cxx.

221 {
222
223 ATH_MSG_INFO( "Finalizing" );
224
225 return StatusCode::SUCCESS;
226}
#define ATH_MSG_INFO(x,...)

◆ fitTrack()

int TileMuonFitter::fitTrack ( )

Fits a straight track to the cell centers, using the auxiliary class TileMuonTrackDistance.

Definition at line 413 of file TileMuonFitter.cxx.

413 {
414
415 ATH_MSG_DEBUG( "Fitting with Std method" << m_nCells << " cells." );
416
417 std::vector<double> X;
418 std::vector<double> Y;
419 std::vector<double> Z;
420 X.resize(m_nCells);
421 Y.resize(m_nCells);
422 Z.resize(m_nCells);
423 for (int i = 0; i < m_nCells; i++) {
424
425 X[i] = m_cellPosition[i].getX();
426 Y[i] = m_cellPosition[i].getY();
427 Z[i] = m_cellPosition[i].getZ();
428 double rr = sqrt(X[i] * X[i] + Y[i] * Y[i]);
429
430 ATH_MSG_DEBUG( "Cell " << i
431 << " Energy " << m_cellEnergy[i]
432 << " Weight " << m_cellWeight[i]
433 << " Time " << m_cellTime[i]
434 << " r " << rr
435 << " X " << X[i]
436 << " Y " << Y[i]
437 << " Z " << Z[i] );
438
439 }
440
441 // Minuit Method ------------------------------------------------------------
442
443 m_theTrack = new TileMuonTrackDistance(X, Y, Z, m_cellWeight);
444 m_theTrack->SetWeighted(m_doWeighted);
445 m_theTrack->Means();
446
447 double aa, bb, cc, dd;
448 double erraa, errbb, errcc, errdd;
449 aa = bb = cc = dd = erraa = errbb = errcc = errdd = 0.0;
451 bb = 0.;
452 dd = 0.;
453 } else {
458 }
459
460 MnUserParameters upar;
461 upar.Add("bb", bb, 0.1);
462 upar.Add("dd", dd, 0.1);
463
464 MnMigrad migrad(*m_theTrack, upar);
465 FunctionMinimum min = migrad();
466
467 bool myIsValid = min.IsValid();
468
469 m_fitMinimum.push_back(0);
470
471 if (myIsValid) {
472 bb = min.UserState().Value("bb");
473 dd = min.UserState().Value("dd");
474 aa = m_theTrack->GetMeanY() - bb * m_theTrack->GetMeanX();
475 cc = m_theTrack->GetMeanZ() - dd * m_theTrack->GetMeanX();
476 errbb = min.UserState().Error("bb");
477 errdd = min.UserState().Error("dd");
478 erraa = fabs(errbb * m_theTrack->GetMeanX());
479 errcc = fabs(errdd * m_theTrack->GetMeanX());
480
481 addTrack(aa, bb, cc, dd);
482
483 m_fitMinimum[m_fitMinimum.size() - 1] = min.UserState().Fval();
484 }
485
486 if (myIsValid) {
487 if (msgLvl(MSG::DEBUG)) {
488 msg(MSG::DEBUG) << "Minimum Value aa: " << aa
489 << " bb: " << bb
490 << " cc: " << cc
491 << " dd " << dd << endmsg;
492 msg(MSG::DEBUG) << "Minimum Error aa: " << erraa
493 << " bb: " << errbb
494 << " cc: " << errcc
495 << " dd " << errdd << endmsg;
496 }
497 return 1;
498 } else {
499 ATH_MSG_DEBUG( "Could not minimize" );
500 return 0;
501 }
502
503}
const std::regex rr(r_r)
#define X(x)
Definition SiHitPlots.h:102
#define min(a, b)
Definition cfImp.cxx:40
void addTrack(double aa, double bb, double cc, double dd)

◆ guessTrack()

bool TileMuonFitter::guessTrack ( unsigned int & index1,
unsigned int & index2 )
private

Definition at line 1651 of file TileMuonFitter.cxx.

1651 {
1652 unsigned int i, j;
1653 unsigned int NPoints = m_cellInfo.size();
1654
1655 double skew, skew_min = 999999999.9;
1656 unsigned int cnt, cnt_max = 0U;
1657
1658 for (i = 1; i < NPoints; i++) {
1659 for (j = 0; j < i; j++) {
1660 if (m_cellInfo[i].use && m_cellInfo[j].use) {
1661 cnt = CntCells(i, j, skew);
1662 if (cnt > cnt_max || (cnt == cnt_max && skew < skew_min)) {
1663 cnt_max = cnt;
1664 skew_min = skew;
1665 index1 = i;
1666 index2 = j;
1667 }
1668 }
1669 }
1670 }
1671
1672 return (cnt_max >= MIN_NCELLS);
1673}
#define MIN_NCELLS
unsigned int CntCells(unsigned int index1, unsigned int index2, double &skew)

◆ hough2cart()

void TileMuonFitter::hough2cart ( double r,
double a,
double offset,
double & aa,
double & bb )
private

Definition at line 1581 of file TileMuonFitter.cxx.

1581 {
1582 double x1, y1;
1583 double x2, y2;
1584
1585 x1 = (r - sin(a + pi)) / cos(a + pi) - offset; // to translate back
1586 y1 = 1.0;
1587
1588 x2 = (r + sin(a + pi)) / cos(a + pi) - offset;
1589 y2 = -1.0;
1590
1591 aa = (y2 - y1) / (x2 - x1);
1592 bb = y1 - aa * x1;
1593}
int r
Definition globals.cxx:22

◆ houghTrack()

int TileMuonFitter::houghTrack ( )

Fits a straight track to the cells centers, using a Hough Transform algorithm.

Definition at line 1785 of file TileMuonFitter.cxx.

1785 {
1786
1787 ATH_MSG_DEBUG( "Fitting with Hough method" << m_nCells << " cells." );
1788
1789 // Build vector with cell Infos --------------------------------------------
1790 bool compute = true;
1791
1792 unsigned int NPoints = buildCellInfoVector();
1793 if (NPoints > MAX_NCELLS) compute = false;
1794
1795 // loop to find tracks -----------------------------------------------------
1796
1797 while (compute) {
1798
1799 // Get direction with maximum number of cells --------------------------
1800
1801 unsigned int index1, index2;
1802 if (!guessTrack(index1, index2)) break;
1803
1804 // select cells which belong to the track ------------------------------
1805
1806 float p[3] = { m_cellInfo[index1].x, m_cellInfo[index1].y, m_cellInfo[index1].z };
1807 float w[3];
1808 points2dir(m_cellInfo[index1], m_cellInfo[index2], w);
1809
1810 float en = selectCells(p, w);
1811 if (en < MIN_ENERGY_MEV) continue;
1812
1813 // compute reference direction -----------------------------------------
1814
1815 double rxy, axy, rzy, azy;
1816 cart2hough(m_cellInfo[index1].x, m_cellInfo[index1].y, m_cellInfo[index2].x, m_cellInfo[index2].y, rxy, axy);
1817 cart2hough(m_cellInfo[index1].z, m_cellInfo[index1].y, m_cellInfo[index2].z, m_cellInfo[index2].y, rzy, azy);
1818
1819 // compute Hough Transform ---------------------------------------------
1820
1821 doHough(rxy, axy, rzy, azy);
1822
1823 // compute track parameters --------------------------------------------
1824
1825 double aa, bb, cc, dd;
1826
1827 hough2cart(rxy, axy, SHIFT_X, bb, aa);
1828 hough2cart(rzy, azy, SHIFT_Z, dd, cc);
1829
1830 addTrack(aa, bb, (aa - cc) / dd, bb / dd);
1831
1832 ATH_MSG_DEBUG( "Minimum Value aa: " << aa
1833 << " bb: " << bb
1834 << " cc: " << (aa - cc) / dd
1835 << " dd " << bb / dd );
1836
1837 m_fitMinimum.push_back(1.0);
1838 }
1839
1840 // prepare comtime ---------------------------------------------------------
1841
1842 std::vector<double> X;
1843 std::vector<double> Y;
1844 std::vector<double> Z;
1845
1846 X.resize(m_nCells);
1847 Y.resize(m_nCells);
1848 Z.resize(m_nCells);
1849
1850 for (int i = 0; i < m_nCells; i++) {
1851 X[i] = m_cellPosition[i].getX();
1852 Y[i] = m_cellPosition[i].getY();
1853 Z[i] = m_cellPosition[i].getZ();
1854 }
1855
1856 m_theTrack = new TileMuonTrackDistance(X, Y, Z, m_cellWeight);
1857 m_theTrack->SetWeighted(m_doWeighted);
1858
1859 if (m_linePar.size() > 0) return 1;
1860 else return 0;
1861}
#define MIN_ENERGY_MEV
#define MAX_NCELLS
void doHough(double &rxy, double &axy, double &rzy, double &azy)
void hough2cart(double r, double a, double offset, double &aa, double &bb)
bool guessTrack(unsigned int &index1, unsigned int &index2)
unsigned int buildCellInfoVector()
float selectCells(float *p, float *w)

◆ initialize()

StatusCode TileMuonFitter::initialize ( )
overridevirtual

Definition at line 109 of file TileMuonFitter.cxx.

109 {
110
111 CHECK( detStore()->retrieve(m_tileMgr) );
112 CHECK( detStore()->retrieve(m_tileID) );
113 CHECK( detStore()->retrieve(m_tileHWID) );
114
115 if (m_doHoughTransform) {
116 m_cosmicMuonContainerKey = "TileCosmicMuonHT";
117 }
118
119 ATH_CHECK( m_cellContainerKey.initialize() );
120 ATH_CHECK( m_cosmicMuonContainerKey.initialize() );
121 ATH_CHECK( m_comTimeKey.initialize() );
122
123 m_cellEnergy.resize(m_tileID->cell_hash_max());
124 m_cellWeight.resize(m_tileID->cell_hash_max());
125 m_cellTime.resize(m_tileID->cell_hash_max());
126 m_cellDeltaTime.resize(m_tileID->cell_hash_max());
127 m_cellHash.resize(m_tileID->cell_hash_max());
128 m_cellPosition.resize(m_tileID->cell_hash_max());
129
130 if (m_minimumCells < 2) m_minimumCells = 2;
131
132 ATH_MSG_INFO( "Loading: " << m_cellContainerKey.key() );
133 ATH_MSG_INFO( "Recording: " << m_cosmicMuonContainerKey.key() << " and " << m_comTimeKey.key() );
134 ATH_MSG_INFO( "Cell Energy Threshold: " << m_eThreshold.value() << " (MeV)" );
135 ATH_MSG_INFO( "Delta Time Cell Cut: " << m_deltaTimeCut.value() << " (ns)" );
136 ATH_MSG_INFO( "Minimum Number of cells for fit: " << m_minimumCells.value() );
137
139 ATH_MSG_INFO( "Weighting cell position and time with energy density." );
140
142 ATH_MSG_INFO( "Weighting cell position and time with energy." );
143
144 if (!m_doWeighted)
145 ATH_MSG_INFO( "Not weighting cell position and time." );
146
147 if (!m_beamType.value().compare("collisions")
148 || !m_beamType.value().compare("singlebeam")
149 || !m_beamType.value().compare("cosmics")) {
150
151 ATH_MSG_INFO( "Setting up TMF for beam type = " << m_beamType.value() );
152 } else {
153 ATH_MSG_WARNING( "BeamType " << m_beamType.value()
154 << " from jobproperties not recognized. Setting to cosmics for TMF only." );
155
156 m_beamType = "cosmics";
157 }
158
159 m_tileDD_radiusLB.resize(4);
160 m_tileDD_radiusEB.resize(4);
161 m_tileDD_zEBA.resize(2);
162 m_tileDD_zEBC.resize(3);
163 m_tileDD_zLB.resize(2);
164 bool hack = false;
165
166 std::vector<TileDetDescriptor*>::const_iterator first = m_tileMgr->tile_descriptors_begin();
167 std::vector<TileDetDescriptor*>::const_iterator last = m_tileMgr->tile_descriptors_end();
168 for (; first != last; ++first) {
169 const TileDetDescriptor * tileDD = (*first);
170 //tileDD->print();
171 if (tileDD->n_samp() != 3) break;
172 if (tileDD->n_eta(0) == 10 && tileDD->sign_eta() == 1) { //LBA
173 hack = (tileDD->dr(0) > 300);
174 m_tileDD_zLB[1] = tileDD->zcenter(0) + tileDD->dz(0) / 2.;
175 for (int is = 0; is < 3; is++)
176 m_tileDD_radiusLB[is] = tileDD->rcenter(is) - tileDD->dr(is) / 2.;
177 m_tileDD_radiusLB[3] = tileDD->rcenter(2) + tileDD->dr(2) / 2.;
178 } else if (tileDD->n_eta(0) == 10 && tileDD->sign_eta() == -1) { //LBC
179 m_tileDD_zLB[0] = tileDD->zcenter(0) - tileDD->dz(0) / 2.;
180 } else if (tileDD->n_eta(0) == 5 && tileDD->sign_eta() == 1) { //EBA
181 m_tileDD_zEBA[0] = tileDD->zcenter(0) - tileDD->dz(0) / 2.;
182 m_tileDD_zEBA[1] = tileDD->zcenter(0) + tileDD->dz(0) / 2.;
183 for (int is = 0; is < 3; is++)
184 m_tileDD_radiusEB[is] = tileDD->rcenter(is) - tileDD->dr(is) / 2.;
185 m_tileDD_radiusEB[3] = tileDD->rcenter(2) + tileDD->dr(2) / 2.;
186 } else if (tileDD->n_eta(0) == 5 && tileDD->sign_eta() == -1) { //EBC
187 m_tileDD_zEBC[0] = tileDD->zcenter(0) - tileDD->dz(0) / 2.;
188 m_tileDD_zEBC[1] = tileDD->zcenter(0) + tileDD->dz(0) / 2.;
189 }
190
191 }
192// WARNING: ugly hack! Remove when Geo-Model is updated
193// this is needed to remove from the cell lengths the spacer
194// plate after tilerow 11 and the front plate before tilerow 1
195// see http://indico.cern.ch/conferenceDisplay.py?confId=59722
196 if (hack) {
197 ATH_MSG_INFO( "Old geometry detected: moving inner/outer radius by +10/-40 mm " );
198 m_tileDD_radiusLB[3] -= 40; // reduce outer radius by 40 mm
199 m_tileDD_radiusEB[3] -= 40; // reduce outer radius by 40 mm
200 m_tileDD_radiusLB[0] += 10; // increase inner radius by 10 mm
201 m_tileDD_radiusEB[0] += 10; // increase inner radius by 10 mm
202 }
203// end of hack
204 ATH_MSG_INFO( "Geometry read from TileDetDescr for track length calculation:" );
205 for (int is = 0; is < 4; is++)
206 ATH_MSG_INFO( "Radius sampling " << is
207 << " LB: " << m_tileDD_radiusLB[is]
208 << " EB: " << m_tileDD_radiusEB[is] );
209
210 ATH_MSG_INFO( "LB z between " << m_tileDD_zLB[0] << " and " << m_tileDD_zLB[1] );
211 ATH_MSG_INFO( "EBA z between " << m_tileDD_zEBA[0] << " and " << m_tileDD_zEBA[1] );
212 ATH_MSG_INFO( "EBC z between " << m_tileDD_zEBC[0] << " and " << m_tileDD_zEBC[1] );
213 ATH_MSG_INFO( "TileMuonFitter initialization completed" );
214
215 return StatusCode::SUCCESS;
216}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
float zcenter(unsigned int samp) const
float rcenter(unsigned int samp) const
int n_eta(unsigned int samp) const
float dz(unsigned int samp) const
float dr(unsigned int samp) const
const TileHWID * m_tileHWID
bool first
Definition DeMoScan.py:534

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool TileMuonFitter::isClonable ( ) const
inlinefinaloverridevirtual

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented from AthCommonAlgorithm< Gaudi::Algorithm >.

Definition at line 99 of file TileMuonFitter.h.

99{ return true; }

◆ isHaloMuon()

bool TileMuonFitter::isHaloMuon ( double azy)
private

Definition at line 1731 of file TileMuonFitter.cxx.

1731 {
1732 if ((azy > 1.0 * pi / 2.0 - 6.0 * BIN_RES_AZY && azy < 1.0 * pi / 2.0 + 6.0 * BIN_RES_AZY)||
1733 (azy > 3.0*pi/2.0 - 6.0*BIN_RES_AZY && azy < 3.0*pi/2.0 + 6.0*BIN_RES_AZY))return true;
1734 else return false;
1735}

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ points2dir()

void TileMuonFitter::points2dir ( CellInfo & ci1,
CellInfo & ci2,
float * w )
private

Definition at line 1609 of file TileMuonFitter.cxx.

1609 {
1610 w[0] = ci1.x - ci2.x;
1611 w[1] = ci1.y - ci2.y;
1612 w[2] = ci1.z - ci2.z;
1613
1614 float invmod = 1.0F / sqrt(w[0] * w[0] + w[1] * w[1] + w[2] * w[2]);
1615 w[0] *= invmod;
1616 w[1] *= invmod;
1617 w[2] *= invmod;
1618}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ selectCells()

float TileMuonFitter::selectCells ( float * p,
float * w )
private

Definition at line 1710 of file TileMuonFitter.cxx.

1710 {
1711 unsigned int NPoints = m_cellInfo.size();
1712 float toten = 0.0;
1713 unsigned int ntrack = m_linePar.size();
1714
1715 for (unsigned int i = 0; i < NPoints; i++) {
1716 if (m_cellInfo[i].use == false || dist2line(m_cellInfo[i], p, w) > m_cellInfo[i].dist) {
1717 m_cellInfo[i].is_out = true;
1718 } else {
1719 m_cellInfo[i].is_out = false;
1720 m_cellInfo[i].use = false;
1721 m_cellInfo[i].track_index = ntrack;
1722
1723 toten += m_cellInfo[i].e;
1724 }
1725 }
1726
1727 return toten;
1728}

◆ setEventDefaults()

void TileMuonFitter::setEventDefaults ( )

Reset variables.

Definition at line 275 of file TileMuonFitter.cxx.

275 {
276 m_nCells = 0;
277 for (unsigned int i = 0; i < m_tileID->cell_hash_max(); i++) {
278 m_cellEnergy[i] = 0.0;
279 m_cellWeight[i] = 0.0;
280 m_cellTime[i] = 0.0;
281 m_cellDeltaTime[i] = 999.;
282 m_cellHash[i] = 0;
283 m_cellPosition[i].setX(0.0);
284 m_cellPosition[i].setY(0.0);
285 m_cellPosition[i].setZ(0.0);
286 }
287
288 m_linePar.clear();
289 m_zeroCrossingTime.clear();
290 m_fitMinimum.clear();
291}

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_ERROR(x,...)
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ trackIntersection()

void TileMuonFitter::trackIntersection ( std::vector< double > & ltop,
std::vector< double > & lbot,
int index )
private

Calculates length of track intersection with TileCal (by sampling).

check intersection with cylinder

Make the list of valid LB intersection points

Now let's make the list of valid EB intersection points

check intersection with vertical planes

We need to check if we need to add the horizontal point. The criterion is: is the horizontal plane crossing point within TileCal or not?

check intersection with horizontal plane

Order points according to the y coordinate, and create two different vectors, one for bottom, one for top

Now create ordered vector, adding in the horizontal plane point if needed. This must go at the top of the bottom list and at the bottom of the top list, since they are ordered according to y.

Now let's turn points into segment lengths. We take two successive points from the top or bottom stack. The segment is simply the difference between them. The region indices are checked with the midpoint. We discard this segment if its midpoint is in the LB/EB gap.

Definition at line 805 of file TileMuonFitter.cxx.

806 {
807
808 const double p0 = m_linePar[index][0];
809 const double p1 = m_linePar[index][1];
810 const double p2 = m_linePar[index][2];
811 const double p3 = m_linePar[index][3];
812
813 ATH_MSG_DEBUG( "Starting TrackIntersection: " );
814 int is, ip;
815 std::vector<Hep3Vector> intPoint; //intersection points
816 std::vector<Hep3Vector> topIPO; //intersection points on top hemisphere, order according to y
817 std::vector<Hep3Vector> bottomIPO; //intersection points on bottom hemisphere, order according to y
818 std::vector<Hep3Vector> temp3v;
819 std::vector<Hep3Vector> plane;
820 Hep3Vector horizontalPlane;
821
822 plane.resize(6);
823 lbot.resize(3);
824 ltop.resize(3);
825 temp3v.resize(2);
826 for (is = 0; is < 3; is++) {
827 ltop[is] = 0.0;
828 lbot[is] = 0.0;
829 }
831 for (is = 0; is < 4; is++) {
832
834 double aux_squared = m_tileDD_radiusLB[is] * m_tileDD_radiusLB[is] * (1 + p1 * p1) - p0 * p0;
835 if (aux_squared > 0) {
836 double x[2] = { (-1.0 * p0 * p1 + sqrt(aux_squared)) / (1 + p1 * p1), (-1.0 * p0 * p1
837 - sqrt(aux_squared)) / (1 + p1 * p1) };
838 for (uint8_t i = 0; i < 2; i++) {
839 temp3v[i].set(x[i], p0 + p1 * x[i], p2 + p3 * x[i]);
840 if (checkLBz(temp3v[i].z())) intPoint.push_back(temp3v[i]);
841 }
842 }
843
845 aux_squared = m_tileDD_radiusEB[is] * m_tileDD_radiusEB[is] * (1 + p1 * p1) - p0 * p0;
846 if (aux_squared > 0) {
847 double x[2] = { (-1.0 * p0 * p1 + sqrt(aux_squared)) / (1 + p1 * p1), (-1.0 * p0 * p1
848 - sqrt(aux_squared)) / (1 + p1 * p1) };
849 for (uint8_t i = 0; i < 2; i++) {
850 temp3v[i].set(x[i], p0 + p1 * x[i], p2 + p3 * x[i]);
851 if (checkEBz(temp3v[i].z())) intPoint.push_back(temp3v[i]);
852 }
853 }
854
855 }
856 uint8_t ncylint = intPoint.size();
857
859 for (ip = 0; ip < 6; ip++)
860 plane[ip].set(0, 0, 0);
861 if (p3 != 0) {
862 const double inv_p3 = 1. / p3;
863 for (ip = 0; ip < 2; ip++) {
864 plane[ip].set((m_tileDD_zLB[ip] - p2) * inv_p3, p0 + p1 * (m_tileDD_zLB[ip] - p2) * inv_p3,
865 m_tileDD_zLB[ip]);
866
867 plane[ip + 2].set((m_tileDD_zEBA[ip] - p2) * inv_p3, p0 + p1 * (m_tileDD_zEBA[ip] - p2) * inv_p3,
868 m_tileDD_zEBA[ip]);
869
870 plane[ip + 4].set((m_tileDD_zEBC[ip] - p2) * inv_p3, p0 + p1 * (m_tileDD_zEBC[ip] - p2) * inv_p3,
871 m_tileDD_zEBC[ip]);
872
873 for (is = 0; is < 3; is++) {
874 if (checkLBr(plane[ip].perp(), is)) intPoint.push_back(plane[ip]);
875 if (checkEBr(plane[ip + 2].perp(), is)) intPoint.push_back(plane[ip + 2]);
876 if (checkEBr(plane[ip + 4].perp(), is)) intPoint.push_back(plane[ip + 4]);
877 }
878 }
879 }
880
881 ATH_MSG_DEBUG( "Intersection with cylinders: " << ncylint
882 << " with planes: " << intPoint.size() - ncylint );
883
887 horizontalPlane.set(0, 0, 0);
888 uint16_t idx_hor = 99;
889 uint16_t i, j, k, jmax;
890 if (p1 != 0) {
891 const double inv_p1 = 1. / p1;
893 horizontalPlane.set(-1.0 * p0 * inv_p1, 0, p2 - p3 * p0 * inv_p1);
894 if (checkLBz(horizontalPlane.z()) && checkLBr(horizontalPlane.x())) {
895 for (i = 0; i < 3; i++)
896 if (checkLBr(horizontalPlane.x(), i)) idx_hor = i;
897 }
898 if (checkEBz(horizontalPlane.z()) && checkEBr(horizontalPlane.x())) {
899 for (i = 0; i < 3; i++)
900 if (checkEBr(horizontalPlane.x(), i)) idx_hor = i;
901 }
902 }
903
904 ATH_MSG_DEBUG( "Horizontal Plane idx: " << idx_hor
905 << " X: " << horizontalPlane.x()
906 << " Z: " << horizontalPlane.z() );
907
910 uint16_t npoints = intPoint.size();
911 float ymax;
912 bool filled;
913 std::vector<uint8_t> neworder;
914 neworder.resize(0);
915 for (i = 0; i < npoints; i++) {
916 ymax = -99999999.0;
917 jmax = 9999;
918 for (j = 0; j < npoints; j++) {
919 filled = false;
920 for (k = 0; k < neworder.size(); k++) {
921 if (j == neworder[k]) filled = true;
922 }
923 if (filled) continue;
924 if (intPoint[j].y() > ymax) {
925 ymax = intPoint[j].y();
926 jmax = j;
927 }
928 }
929 if (jmax < 9999) neworder.push_back(jmax);
930 }
931
932 if (neworder.size() != npoints)
933 ATH_MSG_ERROR( " Npoints " << npoints
934 << " New order: " << neworder.size() );
935
939
940 if (idx_hor < 99) bottomIPO.push_back(horizontalPlane);
941
942 for (i = 0; i < npoints; i++) {
943 if (intPoint[neworder[i]].y() > 0)
944 topIPO.push_back(intPoint[neworder[i]]);
945 else
946 bottomIPO.push_back(intPoint[neworder[i]]);
947 }
948 if (idx_hor < 99) topIPO.push_back(horizontalPlane);
949
950 ATH_MSG_DEBUG( "Number of points on top: " << topIPO.size()
951 << " and on bottom: " << bottomIPO.size() );
952
953 if (topIPO.size() > 1 && bottomIPO.size()) {
954
960
961 Hep3Vector temp_midpoint;
962 int temp_idx;
963 for (i = 0; i < topIPO.size() - 1; i++) {
964 ATH_MSG_DEBUG( "Top points : " << i
965 << " X: " << topIPO[i].x()
966 << " Y: " << topIPO[i].y()
967 << " Z: " << topIPO[i].z() );
968
969 temp_midpoint = (topIPO[i] + topIPO[i + 1]) / 2.;
970 ATH_MSG_DEBUG( "Temp_midz top: " << temp_midpoint.z() );
971
972 if (checkLBz(temp_midpoint.z()))
973 temp_idx = whichLBr(temp_midpoint.perp());
974 else if (checkEBz(temp_midpoint.z()))
975 temp_idx = whichEBr(temp_midpoint.perp());
976 else
977 continue;
978
979 ATH_MSG_DEBUG( "Temp_idx : " << temp_idx );
980
981 if (temp_idx < 0 || temp_idx > 2) continue;
982 ltop[temp_idx] += (topIPO[i] - topIPO[i + 1]).mag();
983
984 ATH_MSG_DEBUG( "ltop : " << ltop[temp_idx] );
985
986 }
987
988 ATH_MSG_DEBUG( "Top points : " << topIPO.size() - 1
989 << " X: " << topIPO[topIPO.size() - 1].x()
990 << " Y: " << topIPO[topIPO.size() - 1].y()
991 << " Z: " << topIPO[topIPO.size() - 1].z() );
992
993
994 for (i = 0; i < bottomIPO.size() - 1; i++) {
995 ATH_MSG_DEBUG( "Bot points : " << i
996 << " X: " << bottomIPO[i].x()
997 << " Y: " << bottomIPO[i].y()
998 << " Z: " << bottomIPO[i].z() );
999
1000
1001 temp_midpoint = (bottomIPO[i] + bottomIPO[i + 1]) / 2.;
1002 ATH_MSG_DEBUG( "Temp_midz bottom: " << temp_midpoint.z() );
1003
1004 if (checkLBz(temp_midpoint.z()))
1005 temp_idx = whichLBr(temp_midpoint.perp());
1006 else if (checkEBz(temp_midpoint.z()))
1007 temp_idx = whichEBr(temp_midpoint.perp());
1008 else
1009 continue;
1010
1011 ATH_MSG_DEBUG( "Temp_idx : " << temp_idx );
1012
1013 if (temp_idx < 0 || temp_idx > 2) continue;
1014 lbot[temp_idx] += (bottomIPO[i] - bottomIPO[i + 1]).mag();
1015
1016 ATH_MSG_DEBUG( "lbot : " << lbot[temp_idx] );
1017 }
1018
1019 ATH_MSG_DEBUG( "Bot points : " << bottomIPO.size() - 1
1020 << " X: " << bottomIPO[bottomIPO.size() - 1].x()
1021 << " Y: " << bottomIPO[bottomIPO.size() - 1].y()
1022 << " Z: " << bottomIPO[bottomIPO.size() - 1].z() );
1023
1024 }
1025 ATH_MSG_DEBUG( "Leaving TrackIntersection" );
1026}
Scalar perp() const
perp method - perpendicular length
int whichEBr(double x1)
Returns sampling index if x1 is within EB r coordinate bounds.
bool checkLBr(double x1, uint8_t s1)
Checks if x1 is within LB r coordinate bounds for sampling s1.
bool checkEBz(double x1)
Checks if x1 is within EB z coordinate bounds.
int whichLBr(double x1)
Returns sampling index if x1 is within LB r coordinate bounds.
bool checkLBz(double x1)
Checks if x1 is within LB z coordinate bounds.
bool checkEBr(double x1, uint8_t s1)
Checks if x1 is within EB r coordinate bounds for sampling s1.
double ymax
Definition listroot.cxx:64
str index
Definition DeMoScan.py:362
void set(const ELT &e, const element_type &x) const
Set the variable for one element.
setWord1 uint16_t

◆ trackSegmentIntersection()

void TileMuonFitter::trackSegmentIntersection ( std::vector< double > & segPath,
std::vector< int > & segPartition,
std::vector< int > & segModule,
std::vector< int > & segSampling,
int index )
private

Calculates length of track intersection with TileCal (by sampling and module).

check intersection with cylinder

Make the list of valid LB intersection points

Now let's make the list of valid EB intersection points

check intersection with vertical planes

check intersection with module planes

Order points according to the y coordinate.

Now let's turn points into segment lengths. We take two successive points from the stack. The segment is simply the difference between them. The region indices are checked with the midpoint. We discard this segment if its midpoint is in the LB/EB gap.

Definition at line 1031 of file TileMuonFitter.cxx.

1033 {
1034
1035 double p0 = m_linePar[index][0];
1036 double p1 = m_linePar[index][1];
1037 double p2 = m_linePar[index][2];
1038 double p3 = m_linePar[index][3];
1039
1040 ATH_MSG_DEBUG( "Starting TrackIntersection: " );
1041
1042 std::vector<Hep3Vector> intPoint; //intersection points
1043 std::vector<Hep3Vector> ordPoint; //ordered intersection points (according to y)
1044
1045 std::vector<Hep3Vector> temp3v;
1046 std::vector<Hep3Vector> plane;
1047 std::vector<Hep3Vector> modPlane;
1048
1049 plane.resize(6);
1050 modPlane.clear();
1051 modPlane.resize(32);
1052 temp3v.resize(2);
1053 segPath.clear();
1054 segPartition.clear();
1055 segModule.clear();
1056 segSampling.clear();
1057
1059 int is, ip;
1060 uint16_t i, j, k, jmax;
1061 for (is = 0; is < 4; is++) {
1062
1064 double aux_squared = m_tileDD_radiusLB[is] * m_tileDD_radiusLB[is] * (1 + p1 * p1) - p0 * p0;
1065 if (aux_squared > 0) {
1066 double x[2] = { (-1.0 * p0 * p1 + sqrt(aux_squared)) / (1 + p1 * p1), (-1.0 * p0 * p1
1067 - sqrt(aux_squared)) / (1 + p1 * p1) };
1068 for (i = 0; i < 2; i++) {
1069 temp3v[i].set(x[i], p0 + p1 * x[i], p2 + p3 * x[i]);
1070 if (checkLBz(temp3v[i].z())) intPoint.push_back(temp3v[i]);
1071 }
1072 }
1073
1075 aux_squared = m_tileDD_radiusEB[is] * m_tileDD_radiusEB[is] * (1 + p1 * p1) - p0 * p0;
1076 if (aux_squared > 0) {
1077 double x[2] = { (-1.0 * p0 * p1 + sqrt(aux_squared)) / (1 + p1 * p1), (-1.0 * p0 * p1
1078 - sqrt(aux_squared)) / (1 + p1 * p1) };
1079 for (i = 0; i < 2; i++) {
1080 temp3v[i].set(x[i], p0 + p1 * x[i], p2 + p3 * x[i]);
1081 if (checkEBz(temp3v[i].z())) intPoint.push_back(temp3v[i]);
1082 }
1083 }
1084
1085 }
1086 uint16_t ncylint = intPoint.size();
1087
1089 for (ip = 0; ip < 6; ip++)
1090 plane[ip].set(0, 0, 0);
1091 if (p3 != 0) {
1092 for (ip = 0; ip < 2; ip++) {
1093 plane[ip].set((m_tileDD_zLB[ip] - p2) / p3, p0 + p1 * (m_tileDD_zLB[ip] - p2) / p3,
1094 m_tileDD_zLB[ip]);
1095
1096 plane[ip + 2].set((m_tileDD_zEBA[ip] - p2) / p3, p0 + p1 * (m_tileDD_zEBA[ip] - p2) / p3,
1097 m_tileDD_zEBA[ip]);
1098
1099 plane[ip + 4].set((m_tileDD_zEBC[ip] - p2) / p3, p0 + p1 * (m_tileDD_zEBC[ip] - p2) / p3,
1100 m_tileDD_zEBC[ip]);
1101
1102 for (is = 0; is < 3; is++) {
1103 if (checkLBr(plane[ip].perp(), is)) intPoint.push_back(plane[ip]);
1104 if (checkEBr(plane[ip + 2].perp(), is)) intPoint.push_back(plane[ip + 2]);
1105 if (checkEBr(plane[ip + 4].perp(), is)) intPoint.push_back(plane[ip + 4]);
1106 }
1107 }
1108 }
1109 uint16_t nvpint = intPoint.size() - ncylint;
1110
1112 double tanTheta, tempX;
1113 for (ip = 0; ip < 32; ip++) {
1114 tanTheta = tan(pi / 32. * double(ip));
1115 if ((tanTheta - p1) != 0) {
1116 tempX = p0 / (tanTheta - p1);
1117 modPlane[ip].set(tempX, p0 + p1 * tempX, p2 + p3 * tempX);
1118
1119 if (checkLBz(modPlane[ip].z()) && checkLBr(modPlane[ip].perp())) {
1120 intPoint.push_back(modPlane[ip]);
1121 }
1122
1123 if (checkEBz(modPlane[ip].z()) && checkEBr(modPlane[ip].perp())) {
1124 intPoint.push_back(modPlane[ip]);
1125 }
1126 }
1127 }
1128 uint16_t nmpint = intPoint.size() - ncylint - nvpint;
1129 uint16_t npoints = intPoint.size();
1130
1131 ATH_MSG_DEBUG( "Intersections: " << npoints
1132 << " cylinders: " << ncylint
1133 << " vertical planes: " << nvpint
1134 << " module planes: " << nmpint );
1135
1137 double ymax;
1138 bool filled;
1139 std::vector<int> neworder;
1140 neworder.resize(0);
1141 for (i = 0; i < npoints; i++) {
1142 ymax = -999999.0;
1143 jmax = 9999;
1144 for (j = 0; j < npoints; j++) {
1145 filled = false;
1146 for (k = 0; k < neworder.size(); k++) {
1147 if (j == neworder[k]) filled = true;
1148 }
1149 if (filled) continue;
1150 if (intPoint[j].y() > ymax) {
1151 ymax = intPoint[j].y();
1152 jmax = j;
1153 }
1154 }
1155 if (jmax < 9999) neworder.push_back(jmax);
1156 }
1157
1158 if (neworder.size() != npoints)
1159 ATH_MSG_DEBUG( " Npoints " << npoints << " New order: " << neworder.size() );
1160
1161 for (i = 0; i < npoints; i++)
1162 ordPoint.push_back(intPoint[neworder[i]]);
1163
1164 ATH_MSG_DEBUG( "Number of points: " << ordPoint.size() );
1165
1171
1172 if (ordPoint.size() > 1) {
1173 Hep3Vector temp_midpoint;
1174 int temp_idr, temp_idp, temp_idm;
1175 bool extra_debug = false;
1176 for (i = 0; i < ordPoint.size(); i++) {
1177 ATH_MSG_DEBUG( "Ordered points : " << i
1178 << " X: " << ordPoint[i].x()
1179 << " Y: " << ordPoint[i].y()
1180 << " Z: " << ordPoint[i].z() );
1181
1182 if (i == ordPoint.size() - 1) break;
1183
1184 temp_midpoint = (ordPoint[i] + ordPoint[i + 1]) / 2.;
1185
1186 if (checkLBz(temp_midpoint.z())) {
1187 temp_idr = whichLBr(temp_midpoint.perp());
1188 temp_idp = (temp_midpoint.z() > 0) ? 1 : 2;
1189 } else if (checkEBz(temp_midpoint.z())) {
1190 temp_idr = whichEBr(temp_midpoint.perp());
1191 temp_idp = (temp_midpoint.z() > 0) ? 3 : 4;
1192 } else
1193 continue;
1194
1195 temp_idm = whichModule(temp_midpoint);
1196 if (temp_idr < 0 || temp_idr > 2) continue;
1197 if (temp_idm < 0 || temp_idm > 63) continue;
1198
1199 segPath.push_back((ordPoint[i] - ordPoint[i + 1]).mag());
1200 segPartition.push_back(temp_idp);
1201 segModule.push_back(temp_idm);
1202 segSampling.push_back(temp_idr);
1203
1204 }
1205
1206 ATH_MSG_DEBUG( "Number of segments : " << segPath.size() );
1207
1208 for (i = 0; i < segPath.size(); i++) {
1209 if (segPath[i] > 1100) extra_debug = true;
1210 ATH_MSG_DEBUG( "Segment " << i
1211 << " Path : " << segPath[i]
1212 << " Partition : " << segPartition[i]
1213 << " Module : " << segModule[i]
1214 << " Sampling : " << segSampling[i] );
1215
1216 }
1217
1218 if (msgLvl(MSG::DEBUG) && extra_debug) {
1219 msg(MSG::DEBUG) << "Large segment p0: " << p0
1220 << " p1 " << p1
1221 << " p2 " << p2
1222 << " p3 " << p3 << endmsg;
1223
1224 msg(MSG::DEBUG) << "Intersections: " << npoints
1225 << " cylinders: " << ncylint
1226 << " vertical planes: " << nvpint
1227 << " module planes: " << nmpint << endmsg;
1228
1229 for (i = 0; i < ordPoint.size(); i++) {
1230 msg(MSG::DEBUG) << "Ordered points : " << i
1231 << " X: " << ordPoint[i].x()
1232 << " Y: " << ordPoint[i].y()
1233 << " Z: " << ordPoint[i].z() << endmsg;
1234 }
1235
1236 for (i = 0; i < segPath.size(); i++) {
1237 msg(MSG::DEBUG) << "Segment " << i
1238 << " Path : " << segPath[i]
1239 << " Partition : " << segPartition[i]
1240 << " Module : " << segModule[i]
1241 << " Sampling : " << segSampling[i] << endmsg;
1242 }
1243 }
1244
1245 }
1246
1247 ATH_MSG_DEBUG( "Leaving TrackSegmentIntersection" );
1248}
int whichModule(CLHEP::Hep3Vector tempvec)
Returns module index for TVector3 input.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

◆ whichEBr()

int TileMuonFitter::whichEBr ( double x1)
private

Returns sampling index if x1 is within EB r coordinate bounds.

Definition at line 1327 of file TileMuonFitter.cxx.

1327 {
1328 int radidx = -1;
1329 for (int i = 0; i < 3; i++) {
1330 if (checkEBr(x1, i)) radidx = i;
1331 }
1332 return radidx;
1333}

◆ whichLBr()

int TileMuonFitter::whichLBr ( double x1)
private

Returns sampling index if x1 is within LB r coordinate bounds.

Definition at line 1337 of file TileMuonFitter.cxx.

1337 {
1338 int radidx = -1;
1339 for (int i = 0; i < 3; i++) {
1340 if (checkLBr(x1, i)) radidx = i;
1341 }
1342 return radidx;
1343}

◆ whichModule()

int TileMuonFitter::whichModule ( CLHEP::Hep3Vector tempvec)
private

Returns module index for TVector3 input.

Definition at line 1347 of file TileMuonFitter.cxx.

1347 {
1348 double phi = tempvec.phi();
1349 int mod;
1350 if (phi < 0.0) phi += 2.0 * pi;
1351 if (phi > 2.0 * pi)
1352 mod = -1;
1353 else
1354 mod = int(phi * (64.0 / (2.0 * pi)));
1355 return mod;
1356}
Scalar phi() const
phi method

Member Data Documentation

◆ m_beamType

Gaudi::Property<std::string> TileMuonFitter::m_beamType {this, "BeamType", "cosmics"}
protected

Flag to indicate: cosmics, singlebeam or collisions.

Definition at line 215 of file TileMuonFitter.h.

215{this, "BeamType", "cosmics"};

◆ m_caloCells

const CaloCellContainer* TileMuonFitter::m_caloCells {nullptr}
protected

Definition at line 199 of file TileMuonFitter.h.

199{nullptr};

◆ m_caloIndex

const CaloCell_ID::SUBCALO TileMuonFitter::m_caloIndex = CaloCell_ID::TILE
staticprotected

Definition at line 264 of file TileMuonFitter.h.

◆ m_cellContainerKey

SG::ReadHandleKey<CaloCellContainer> TileMuonFitter::m_cellContainerKey
protected
Initial value:
{this, "CaloCellContainer", "AllCalo",
"Input CaloCellContainer name" }

Definition at line 266 of file TileMuonFitter.h.

266 {this, "CaloCellContainer", "AllCalo",
267 "Input CaloCellContainer name" };

◆ m_cellDeltaTime

std::vector<double> TileMuonFitter::m_cellDeltaTime
protected

Selected cell's time difference between two PMTs.

Definition at line 242 of file TileMuonFitter.h.

◆ m_cellEnergy

std::vector<double> TileMuonFitter::m_cellEnergy
protected

Selected cell's energy.

Definition at line 236 of file TileMuonFitter.h.

◆ m_cellHash

std::vector<IdentifierHash> TileMuonFitter::m_cellHash
protected

Selected cell's identifier hash.

Definition at line 244 of file TileMuonFitter.h.

◆ m_cellInfo

std::vector<CellInfo> TileMuonFitter::m_cellInfo
private

Definition at line 179 of file TileMuonFitter.h.

◆ m_cellPosition

std::vector<CLHEP::Hep3Vector> TileMuonFitter::m_cellPosition
protected

Position of selected cell's center.

Definition at line 234 of file TileMuonFitter.h.

◆ m_cellTime

std::vector<double> TileMuonFitter::m_cellTime
protected

Selected cell's time.

Definition at line 240 of file TileMuonFitter.h.

◆ m_cellWeight

std::vector<double> TileMuonFitter::m_cellWeight
protected

Selected cell's weight for fit.

Definition at line 238 of file TileMuonFitter.h.

◆ m_comTimeKey

SG::WriteHandleKey<ComTime> TileMuonFitter::m_comTimeKey {this, "ComTimeKey", "ComTimeTileMuon", "Output ComTime name"}
protected

Definition at line 274 of file TileMuonFitter.h.

274{this, "ComTimeKey", "ComTimeTileMuon", "Output ComTime name"};

◆ m_cosmicMuonContainerKey

SG::WriteHandleKey<TileCosmicMuonContainer> TileMuonFitter::m_cosmicMuonContainerKey
protected
Initial value:
{this,
"TileCosmicMuonKey",
"TileCosmicMuonMF",
"Output TileCosmicMuonContainer name"}

Definition at line 269 of file TileMuonFitter.h.

269 {this,
270 "TileCosmicMuonKey",
271 "TileCosmicMuonMF",
272 "Output TileCosmicMuonContainer name"};

◆ m_deltaTimeCut

Gaudi::Property<double> TileMuonFitter::m_deltaTimeCut {this, "DeltaTimeCut", 6.}
protected

Cell Delta Time cut.

Definition at line 208 of file TileMuonFitter.h.

208{this, "DeltaTimeCut", 6.};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_doDensity

Gaudi::Property<bool> TileMuonFitter::m_doDensity {this, "DoDensityWeighting", true}
protected

Flag defining the energy weighting parameter: energy density or plain energy.

Definition at line 213 of file TileMuonFitter.h.

213{this, "DoDensityWeighting", true};

◆ m_doHoughTransform

Gaudi::Property<bool> TileMuonFitter::m_doHoughTransform {this, "DoHoughTransform", true}
protected

Flag to use Hough Transform instead of Fit.

Definition at line 217 of file TileMuonFitter.h.

217{this, "DoHoughTransform", true};

◆ m_doWeighted

Gaudi::Property<bool> TileMuonFitter::m_doWeighted {this, "DoWeighted", true}
protected

Flag to weigh or not the chi-square with an energy parameter.

Definition at line 210 of file TileMuonFitter.h.

210{this, "DoWeighted", true};

◆ m_eThreshold

Gaudi::Property<double> TileMuonFitter::m_eThreshold {this, "EThreshold", 250.}
protected

Cell energy threshold.

Definition at line 206 of file TileMuonFitter.h.

206{this, "EThreshold", 250.};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_fitMinimum

std::vector<double> TileMuonFitter::m_fitMinimum
protected

Chi-square minumum.

Definition at line 249 of file TileMuonFitter.h.

◆ m_linePar

std::vector<std::vector<double> > TileMuonFitter::m_linePar
protected

Vector with the fitted four track parameters.

Definition at line 247 of file TileMuonFitter.h.

◆ m_maxBottomIndex

int TileMuonFitter::m_maxBottomIndex {0}
protected

Definition at line 260 of file TileMuonFitter.h.

260{0};

◆ m_maxTopIndex

int TileMuonFitter::m_maxTopIndex {0}
protected

Definition at line 261 of file TileMuonFitter.h.

261{0};

◆ m_meanX

double TileMuonFitter::m_meanX {0.0}
protected

Definition at line 253 of file TileMuonFitter.h.

253{0.0};

◆ m_meanY

double TileMuonFitter::m_meanY {0.0}
protected

Definition at line 254 of file TileMuonFitter.h.

254{0.0};

◆ m_meanZ

double TileMuonFitter::m_meanZ {0.0}
protected

Definition at line 255 of file TileMuonFitter.h.

255{0.0};

◆ m_minimumCells

Gaudi::Property<int> TileMuonFitter::m_minimumCells {this, "MinimumCells", 2}
protected

Minimum number of cells needed for fit.

Definition at line 232 of file TileMuonFitter.h.

232{this, "MinimumCells", 2};

◆ m_nCells

int TileMuonFitter::m_nCells {0}
protected

Number of cells selected for fit.

Definition at line 230 of file TileMuonFitter.h.

230{0};

◆ m_reg1to2

bool TileMuonFitter::m_reg1to2 {false}
protected

Definition at line 262 of file TileMuonFitter.h.

262{false};

◆ m_theTrack

ROOT::Minuit2::TileMuonTrackDistance* TileMuonFitter::m_theTrack {nullptr}
protected

Auxiliary class representing the function to be minimized - weighted sum of squares of orthogonal distances from track to cells).

Definition at line 203 of file TileMuonFitter.h.

203{nullptr};

◆ m_tileDD_radiusEB

std::vector<double> TileMuonFitter::m_tileDD_radiusEB
protected

Radial bounds of the 3 samplings in EB, loaded from Detector Description.

Definition at line 221 of file TileMuonFitter.h.

◆ m_tileDD_radiusLB

std::vector<double> TileMuonFitter::m_tileDD_radiusLB
protected

Radial bounds of the 3 samplings in LB, loaded from Detector Description.

Definition at line 219 of file TileMuonFitter.h.

◆ m_tileDD_zEBA

std::vector<double> TileMuonFitter::m_tileDD_zEBA
protected

Z bounds of EBA, loaded from Detector Description.

Definition at line 223 of file TileMuonFitter.h.

◆ m_tileDD_zEBC

std::vector<double> TileMuonFitter::m_tileDD_zEBC
protected

Z bounds of EBC, loaded from Detector Description.

Definition at line 225 of file TileMuonFitter.h.

◆ m_tileDD_zLB

std::vector<double> TileMuonFitter::m_tileDD_zLB
protected

Z bounds of LB, loaded from Detector Description.

Definition at line 227 of file TileMuonFitter.h.

◆ m_tileHWID

const TileHWID* TileMuonFitter::m_tileHWID {nullptr}
protected

Definition at line 197 of file TileMuonFitter.h.

197{nullptr};

◆ m_tileID

const TileID* TileMuonFitter::m_tileID {nullptr}
protected

Definition at line 196 of file TileMuonFitter.h.

196{nullptr};

◆ m_tileMgr

const TileDetDescrManager* TileMuonFitter::m_tileMgr {nullptr}
protected

Definition at line 198 of file TileMuonFitter.h.

198{nullptr};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.

◆ m_weightedMeanX

double TileMuonFitter::m_weightedMeanX {0.0}
protected

Definition at line 256 of file TileMuonFitter.h.

256{0.0};

◆ m_weightedMeanY

double TileMuonFitter::m_weightedMeanY {0.0}
protected

Definition at line 257 of file TileMuonFitter.h.

257{0.0};

◆ m_weightedMeanZ

double TileMuonFitter::m_weightedMeanZ {0.0}
protected

Definition at line 258 of file TileMuonFitter.h.

258{0.0};

◆ m_zeroCrossingTime

std::vector<double> TileMuonFitter::m_zeroCrossingTime
protected

Time at y=0.

Definition at line 251 of file TileMuonFitter.h.


The documentation for this class was generated from the following files: