ATLAS Offline Software
Loading...
Searching...
No Matches
TrigL2MuonSA::CscDataPreparator Class Reference

#include <CscDataPreparator.h>

Inheritance diagram for TrigL2MuonSA::CscDataPreparator:
Collaboration diagram for TrigL2MuonSA::CscDataPreparator:

Public Member Functions

 CscDataPreparator (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
StatusCode prepareData (const EventContext &ctx, TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::CscHits &cscHits) const
void setRoIBasedDataAccess (bool use_RoIBasedDataAccess)
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 sysInitialize () override
 Perform system initialization for an algorithm.
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

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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

double calc_residual (double aw, double bw, double x, double y) const
double calc_residual_phi (double aw, double bw, double phiw, double hitphi, double hitz) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::ReadHandleKey< Muon::CscPrepDataContainerm_cscPrepContainerKey { this, "CSCPrepDataContainer", "CSC_Clusters", "Name of the CSCContainer to read in"}
bool m_use_RoIBasedDataAccess = false
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

Definition at line 22 of file CscDataPreparator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CscDataPreparator()

TrigL2MuonSA::CscDataPreparator::CscDataPreparator ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 18 of file CscDataPreparator.cxx.

20 :
21 AthAlgTool(type,name,parent)
22{
23}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ calc_residual()

double TrigL2MuonSA::CscDataPreparator::calc_residual ( double aw,
double bw,
double x,
double y ) const
private

Definition at line 141 of file CscDataPreparator.cxx.

142{
143 const double ZERO_LIMIT = 1e-4;
144 if( std::abs(aw) < ZERO_LIMIT ) return y-bw;
145 double ia = 1/aw;
146 double iaq = ia*ia;
147 double dz = x - (y-bw)*ia;
148 return dz/std::sqrt(1.+iaq);
149
150}
#define y
#define x
const float ZERO_LIMIT

◆ calc_residual_phi()

double TrigL2MuonSA::CscDataPreparator::calc_residual_phi ( double aw,
double bw,
double phiw,
double hitphi,
double hitz ) const
private

Definition at line 153 of file CscDataPreparator.cxx.

154{
155
156 double roadr = hitz*aw + bw;
157
158 return roadr*( std::cos(phiw)*std::sin(hitphi)-std::sin(phiw)*std::cos(hitphi) );
159
160}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::detStore ( ) const
inlineinherited

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

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ initialize()

StatusCode TrigL2MuonSA::CscDataPreparator::initialize ( )
overridevirtual

Definition at line 28 of file CscDataPreparator.cxx.

29{
30
31 ATH_CHECK(m_idHelperSvc.retrieve());
32
34
35 return StatusCode::SUCCESS;
36}
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadHandleKey< Muon::CscPrepDataContainer > m_cscPrepContainerKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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.

◆ prepareData()

StatusCode TrigL2MuonSA::CscDataPreparator::prepareData ( const EventContext & ctx,
TrigL2MuonSA::MuonRoad & muonRoad,
TrigL2MuonSA::CscHits & cscHits ) const

Definition at line 41 of file CscDataPreparator.cxx.

44{
45
46 // Clear the output
47 cscHits.clear();
48
49 // Get CSC container
50 if(!m_cscPrepContainerKey.empty()){
51 auto cscPrepContainerHandle = SG::makeHandle(m_cscPrepContainerKey, ctx);
52 const Muon::CscPrepDataContainer* cscPrepContainer = cscPrepContainerHandle.cptr();
53 if (!cscPrepContainerHandle.isValid()) {
54 ATH_MSG_ERROR("Cannot retrieve CSC PRD Container key: " << m_cscPrepContainerKey.key());
55 return StatusCode::FAILURE;
56 }
57
58 // Loop over collections
59 for( const Muon::CscPrepDataCollection* cscCol : *cscPrepContainer ){
60 if( cscCol==nullptr ) continue;
61 cscHits.reserve( cscHits.size() + cscCol->size() );
62 // Loop over data in the collection
63 for( const Muon::CscPrepData* prepData : *cscCol ) {
64 if( prepData==nullptr ) continue;
65
66 // Road info
68 double aw = muonRoad.aw[chamber][0];
69 double bw = muonRoad.bw[chamber][0];
70 //double rWidth = muonRoad.rWidth[chamber][0];
71 double phiw = muonRoad.phi[4][0];//roi_descriptor->phi(); //muonRoad.phi[chamber][0];
72
73 //cluster status
74 bool isunspoiled = IsUnspoiled (prepData->status());
75
76
77 // Create new digit
78 TrigL2MuonSA::CscHitData cscHit{};
79 cscHit.StationName = m_idHelperSvc->cscIdHelper().stationName( prepData->identify() );
80 cscHit.StationEta = m_idHelperSvc->cscIdHelper().stationEta( prepData->identify() );
81 cscHit.StationPhi = m_idHelperSvc->cscIdHelper().stationPhi( prepData->identify() );
82 cscHit.ChamberLayer = (true==isunspoiled) ? 1 : 0;
83 cscHit.WireLayer = m_idHelperSvc->cscIdHelper().wireLayer( prepData->identify() );
84 cscHit.MeasuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi( prepData->identify() );
85 cscHit.Strip = m_idHelperSvc->cscIdHelper().strip( prepData->identify() );
86 cscHit.Chamber = chamber;
87 cscHit.StripId = (cscHit.StationName << 18)
88 | ((cscHit.StationEta + 2) << 16) | (cscHit.StationPhi << 12)
89 | (cscHit.WireLayer << 9) | (cscHit.MeasuresPhi << 8) | (cscHit.Strip);
90 cscHit.eta = prepData->globalPosition().eta();
91 cscHit.phi = prepData->globalPosition().phi();
92 cscHit.r = prepData->globalPosition().perp();
93 cscHit.z = prepData->globalPosition().z();
94 cscHit.charge = prepData->charge();
95 cscHit.time = prepData->time();
96 cscHit.resolution = std::sqrt( prepData->localCovariance()(0,0) );
97 cscHit.Residual = ( cscHit.MeasuresPhi==0 ) ? calc_residual( aw, bw, cscHit.z, cscHit.r ) : calc_residual_phi( aw,bw,phiw, cscHit.phi, cscHit.z);
98 cscHit.isOutlier = 0;
99 /*if( std::abs(cscHit.Residual) > rWidth ) {
100 cscHit.isOutlier = 2;
101 }*/
102 double width = (cscHit.MeasuresPhi) ? 250. : 100.;
103 if( std::abs(cscHit.Residual)>width ){
104 cscHit.isOutlier=1;
105 if( std::abs(cscHit.Residual)>3.*width ){
106 cscHit.isOutlier=2;
107 }
108 }
109
110 cscHits.push_back( cscHit );
111
112 // Debug print
113 ATH_MSG_DEBUG("CSC Hits: "
114 << "SN=" << cscHit.StationName << ","
115 << "SE=" << cscHit.StationEta << ","
116 << "SP=" << cscHit.StationPhi << ","
117 << "CL=" << cscHit.ChamberLayer << ","
118 << "WL=" << cscHit.WireLayer << ","
119 << "MP=" << cscHit.MeasuresPhi << ","
120 << "St=" << cscHit.Strip << ","
121 << "ID=" << cscHit.StripId << ","
122 << "eta=" << cscHit.eta << ","
123 << "phi=" << cscHit.phi << ","
124 << "r=" << cscHit.r << ","
125 << "z=" << cscHit.z << ","
126 << "q=" << cscHit.charge << ","
127 << "t=" << cscHit.time << ","
128 << "Rs=" << cscHit.Residual << ","
129 << "OL=" << cscHit.isOutlier);
130 }
131 }
132 }
133
134 //
135 return StatusCode::SUCCESS;
136}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
bool IsUnspoiled(Muon::CscClusterStatus status)
const double width
double calc_residual_phi(double aw, double bw, double phiw, double hitphi, double hitz) const
double calc_residual(double aw, double bw, double x, double y) const
double aw[N_STATION][N_SECTOR]
Definition MuonRoad.h:83
double bw[N_STATION][N_SECTOR]
Definition MuonRoad.h:84
double phi[N_STATION][N_SECTOR]
Definition MuonRoad.h:85
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
MuonPrepDataContainerT< CscPrepData > CscPrepDataContainer
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ CSC
CSC measurement point.
unsigned int StationName
Definition CscData.h:15

◆ 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< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setRoIBasedDataAccess()

void TrigL2MuonSA::CscDataPreparator::setRoIBasedDataAccess ( bool use_RoIBasedDataAccess)
inline

Definition at line 38 of file CscDataPreparator.h.

38{m_use_RoIBasedDataAccess = use_RoIBasedDataAccess;};

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_cscPrepContainerKey

SG::ReadHandleKey<Muon::CscPrepDataContainer> TrigL2MuonSA::CscDataPreparator::m_cscPrepContainerKey { this, "CSCPrepDataContainer", "CSC_Clusters", "Name of the CSCContainer to read in"}
private

Definition at line 54 of file CscDataPreparator.h.

54{ this, "CSCPrepDataContainer", "CSC_Clusters", "Name of the CSCContainer to read in"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> TrigL2MuonSA::CscDataPreparator::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 51 of file CscDataPreparator.h.

51{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_use_RoIBasedDataAccess

bool TrigL2MuonSA::CscDataPreparator::m_use_RoIBasedDataAccess = false
private

Definition at line 56 of file CscDataPreparator.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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