25#include "GaudiKernel/SmartDataPtr.h"
26#include "GaudiKernel/ITHistSvc.h"
107 SmartIF<ITHistSvc> tHistSvc{Gaudi::svcLocator()->service(
"THistSvc")};
115 StatusCode
sc = tHistSvc->regTree(fullNtupleName,
m_nt);
116 if (
sc.isFailure()) {
117 ATH_MSG_ERROR(
"Unable to register TTree : " << fullNtupleName );
129 m_nt->Branch(
"SCT_nRIOs", &
m_nRIOs,
"Number_of_RIOs/I");
163 m_sp_x =
new std::vector<float>();
164 m_sp_y =
new std::vector<float>();
165 m_sp_z =
new std::vector<float>();
191 m_nt->Branch(
"SP_SCT_nSpacePoints", &
m_nSP);
311 if (not h_riocontainer.
isValid()) {
322 if (not h_spContainer.
isValid()) {
325 p_spContainer = &*h_spContainer;
332 std::vector<Identifier> RDOsOnTracks;
335 if (not h_rdocontainer.
isValid()) {
338 p_rdocontainer = &*h_rdocontainer;
347 for (
int i=0; i<(int)tracks->size(); i++) {
349 if (track ==
nullptr) {
355 if (trackStates ==
nullptr) {
356 ATH_MSG_WARNING(
"for current track is TrackStateOnSurfaces == Null, no data will be written for this track");
367 if (RawDataClus==
nullptr) {
374 const std::vector<Identifier>& rdoList = RawDataClus->
rdoList();
375 RDOsOnTracks.insert(RDOsOnTracks.end(),rdoList.begin(),rdoList.end());
393 InDet::SCT_ClusterContainer::const_iterator containerIterator =
m_riocontainer->begin();
394 for( ; containerIterator !=
m_riocontainer->end(); ++containerIterator) {
395 ATH_MSG_DEBUG(
"There are " << (*containerIterator)->size() <<
" entries in the PrepRawDataCollection" );
400 InDet::SCT_ClusterCollection::const_iterator rioIterator = (*containerIterator)->begin();
401 for (; rioIterator != (*containerIterator)->end(); ++rioIterator) {
403 if (!(*rioIterator)) {
407 if (!((*rioIterator)->detectorElement())) {
415 return StatusCode::SUCCESS;
418 const Amg::Vector3D surfaceGlobPos = (*rioIterator)->detectorElement()->center( (*rioIterator)->identify() ) ;
424 const Amg::Vector2D locPos = (*rioIterator)->localPosition();
464 std::pair<IdentifierHash, IdentifierHash> sp_clusInfo;
468 if (!colNext)
continue;
471 for(p_sp=colNext->
begin(); p_sp!=colNext->
end(); ++p_sp) {
475 sp_clusInfo =
sp.elementIdList();
485 m_sp_x->push_back(point.x());
486 m_sp_y->push_back(point.y());
487 m_sp_z->push_back(point.z());
492 if (
m_fillRDO.value() && p_rdocontainer !=
nullptr) {
496 for( ; col_it!= lastCol ; ++col_it) {
499 if (!SCT_Collection)
continue;
501 unsigned int theHashOfTheRDOCollection=
m_sctid->wafer_hash(theWaferIdOfTheRDOCollection);
503 uint32_t onlineID =
m_cabling->getOnlineIdFromHash(theHashOfTheRDOCollection);
505 uint32_t rod = online.rod();
506 uint32_t fibre = online.fibre();
510 int totalNumberOfStrips=0;
511 int thisBec =
m_sctid->barrel_ec(theWaferIdOfTheRDOCollection);
512 int thisLayerDisk =
m_sctid->layer_disk(theWaferIdOfTheRDOCollection);
513 int thisPhi =
m_sctid->phi_module(theWaferIdOfTheRDOCollection);
514 int thisEta =
m_sctid->eta_module(theWaferIdOfTheRDOCollection);
515 int thisSide =
m_sctid->side(theWaferIdOfTheRDOCollection);
518 for(; p_rdo!=end_rdo; ++p_rdo) {
522 totalNumberOfStrips=totalNumberOfStrips+((*p_rdo)->getGroupSize());
549 if (
find(RDOsOnTracks.begin(),RDOsOnTracks.end(),
SCT_Identifier) != RDOsOnTracks.end())
563 for (
int type=0;
type < SCT_ByteStreamErrors::NUM_ERROR_TYPES; ++
type) {
566 int eta=0,
phi=0,bec=0,layer=0,side=0;
568 for(
const auto& idHash : errorSet) {
570 layer =
m_sctid->layer_disk(itId);
574 bec =
m_sctid->barrel_ec(itId);
583 uint32_t onlineID =
m_cabling->getOnlineIdFromHash(idHash);
585 uint32_t rod = online.rod();
586 uint32_t fibre = online.fibre();
594 return StatusCode::SUCCESS;
599 ATH_MSG_INFO(
"SCT_ClusterValidationNtupleWriter finalize()" );
680 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
An STL vector of pointers that by default owns its pointed-to elements.
This is an Identifier helper class for the SCT subdetector.
Header file for a utility class to hold the online id.
InDetRawDataContainer< InDetRawDataCollection< SCT_RDORawData > > SCT_RDO_Container
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
This is a "hash" representation of an Identifier.
virtual Identifier identify() const override final
std::vector< int > * m_scterr_phi
phi of the SCT wafer
SG::ReadHandleKey< SCT_ClusterContainer > m_jo_riocontainername
std::vector< int > * m_SctSide
from IdHelper: side index (0/1)
std::vector< int > * m_sct_phi
phi of the SCT wafer
std::vector< int > * m_sp_layer
index of the SCT-layer in which the SCT wafer is positioned for SpacePoint
std::vector< float > * m_SctHitErr
please provide description!
std::vector< int > * m_sp_eta
eta index of the SCT-layer in which the SCT wafer is positioned for SpacePoint
std::vector< int > * m_sct_eta
eta of the SCT wafer
int m_lumiBlock
event lumi block information
std::vector< int > * m_sp_bec
Barrel or endcap index (barrel: 0, endcap: +/-2) for SpacePoint.
int m_eventNumber
event number for current PRD vector
std::vector< int > * m_sct_numHitsInWafer
number of hits in the SCT wafer
std::vector< float > * m_rioLoc1
local x coordinate of strip UNIT:mm
std::vector< int > * m_scterr_bec
barrel/endcap index (barrel: 0, endcap: +/-2)
std::vector< int > * m_sct_channel
channel within ROD of the RDO
std::vector< int > * m_scterr_rodid
online ID of ROD containing link
std::vector< int > * m_scterr_side
side of the SCT wafer (0 or 1) within the module
int m_totalNumErrors
total number of BS errors.
std::vector< int > * m_sct_rodid
ROD ID of the RDO.
const SCT_ID * m_sctid
SCT ID helper.
int m_nRDOs
Number of RDOs.
std::vector< float > * m_rioSurfaceY
global x coordinate of SCT wafer center UNIT:mm
StringProperty m_ntupleTreeName
jobOption: Ntuple tree name
BooleanProperty m_doHitsOnTracks
flag to book, access and fill RDO isOnTrack or not
BooleanProperty m_fillBSErrs
flag to book, access and fill ByteStream errors or not
std::vector< int > * m_scterr_layer
layer (barrel) or disk (endcap) of wafer with the error
std::vector< int > * m_sct_barrelec
barrel/endcap index (barrel: 0, endcap: +/-2)
std::vector< int > * m_sct_tbin
timebin of the RDO
std::vector< int > * m_sct_firstStrip
index (could be from 0 to 767) of the fired strip within the SCT wafer
int m_runNumber
run number
int m_nRIOs
number of RIOs, i.e.
std::vector< int > * m_SctEtaModule
from IdHelper: module index in eta
virtual StatusCode finalize() override
standard Athena-Algorithm method
std::vector< int > * m_sct_layer
index of the SCT-layer in which the SCT wafer is positioned
virtual StatusCode execute() override
standard Athena-Algorithm method
virtual StatusCode initialize() override
standard Athena-Algorithm method
std::vector< int > * m_sp_phi
phi index of the SCT-layer in which the SCT wafer is positioned for SpacePoint
SG::ReadHandleKey< TrackCollection > m_inputTrackCollection
std::vector< float > * m_rioSurfaceZ
global x coordinate of SCT wafer center UNIT:mm
BooleanProperty m_fillCluster
flag to book, access and fill Cluster or not
std::vector< int > * m_sct_rdoIsOnTrack
RDO on track.
std::vector< float > * m_sp_z
z position of SpacePoint in ATLAS coordinate system (mm)
std::vector< int > * m_scterr_eta
eta of the SCT wafer
StringProperty m_ntupleDirName
jobOption: Ntuple directory name
std::vector< int > * m_sct_waferHash
index (could be from 0 to 8175) of the fired SCT wafer
std::vector< int > * m_scterr_channel
online channel no.
int m_bunchCrossing
event bunch crossing ID
std::vector< float > * m_SctDeltaPhi
please provide description!
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
std::vector< float > * m_rioSurfaceX
global x coordinate of SCT wafer center UNIT:mm
BooleanProperty m_fillRDO
flag to book, access and fill RDO or not
std::vector< int > * m_SctLayerDisk
from IdHelper: layer/disk index
ToolHandle< ISCT_CablingTool > m_cabling
ToolHandle< ISCT_ByteStreamErrorsTool > m_byteStreamErrTool
std::vector< int > * m_SctBarrelEndcap
from IdHelper: pos/neg barrel (+/-1) and pos/neg endcap (+/-2) UNIT:1:bar, 2:ec
BooleanProperty m_fillSpacePoint
flag to book, access and fill SpacePoints or not
std::vector< int > * m_sct_side
side of the SCT wafer (0 or 1) within the SCT module
SCT_ClusterValidationNtupleWriter(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
SG::ReadHandleKey< SCT_RDO_Container > m_dataObjectName
std::vector< int > * m_sct_rdoGroupSize
RDO group size.
StringProperty m_ntupleFileName
jobOption: Ntuple file name
TTree * m_nt
pointer to the ntuple tree.
std::vector< float > * m_sp_x
x position of SpacePoint in ATLAS coordinate system (mm)
std::vector< int > * m_scterr_type
type of BS error (as defined in SCT_ByteStreamErrs enum in ISCT_ByteStreamErrorsSvc....
const InDet::SCT_ClusterContainer * m_riocontainer
container of RIOs
SG::ReadHandleKey< SpacePointContainer > m_spacePointContainerName
int m_timeStamp
event time stamp
std::vector< int > * m_SctPhiModule
from IdHelper: module index in phi
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
std::vector< float > * m_sp_y
y position of SpacePoint in ATLAS coordinate system (mm)
RIO_OnTrack base class for Silicon detector in the InnerDetector.
const InDet::SiWidth & width() const
return width class reference
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
SCT_OnlineId is a class to hold an online id number and provide check on validity,...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
std::string find(const std::string &s)
return a remapped string
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
DataVector< const Trk::TrackStateOnSurface > TrackStates