|
ATLAS Offline Software
|
Go to the documentation of this file.
19 #include "CLHEP/Units/SystemOfUnits.h"
35 declareInterface<IDataRetriever>(
this);
45 namespace SiSpacePointRetrieverHelpers {
58 using PRDTruthIter = PRD_MultiTruthCollection::const_iterator;
68 std::set<int> barcodesFirst;
69 std::set<int> barcodesSecond;
70 std::set<int> barcodesCommon;
73 std::pair<PRDTruthIter,PRDTruthIter> equalRangeFirst = truthColl->equal_range(idFirst);
74 for(PRDTruthIter TruthCollItr=equalRangeFirst.first; TruthCollItr!= equalRangeFirst.second; ++TruthCollItr)
75 barcodesFirst.insert(TruthCollItr->second.barcode());
81 barcodesCommon.swap(barcodesFirst);
87 std::pair<PRDTruthIter,PRDTruthIter> equalRangeSecond = truthColl->equal_range(idSecond);
88 for(PRDTruthIter TruthCollItr=equalRangeSecond.first; TruthCollItr!= equalRangeSecond.second; ++TruthCollItr)
89 barcodesSecond.insert(TruthCollItr->second.barcode());
92 std::set_intersection(barcodesFirst.begin(), barcodesFirst.end(), barcodesSecond.begin(), barcodesSecond.end(),
93 std::insert_iterator< std::set<int> >(barcodesCommon,barcodesCommon.begin()) );
97 for (
const auto barcodeCommon : barcodesCommon)
barcodes.push_back(
DataType(barcodeCommon));
100 return barcodesCommon.size();
119 if ( not PixelSPContainer.
isValid() )
125 if ( not PixelPRDTruthColl.
isValid() )
130 if ( not SCTSPContainer.
isValid() )
136 if ( not SCTPRDTruthColl.
isValid() )
143 using SpacePointTruthPair = std::pair<const SpacePointContainer *, const PRD_MultiTruthCollection *>;
144 std::vector<SpacePointTruthPair> SpacePointTruthPairList;
147 if (PixelSPContainer.
isValid())
157 int NSpacePoints = 0;
159 for (
const auto &SPTruthPair : SpacePointTruthPairList) {
162 for (
const auto SpacePoint : *(SPTruthPair.first))
176 DataVect etaModule; etaModule.reserve(NSpacePoints);
177 DataVect numBarcodes; numBarcodes.reserve(NSpacePoints);
185 for (
const auto &SPTruthPair : SpacePointTruthPairList) {
188 for (
const auto SpacePointColl : *(SPTruthPair.first)){
191 for (
const auto SpacePoint : *SpacePointColl) {
202 const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*> clusterList =
SpacePoint->clusterList();
205 Identifier idFirst = clusterList.first->identify();
206 Identifier idSecond = (clusterList.second != NULL) ? clusterList.second->identify() :
Identifier();
211 etaModule.push_back(
DataType(
m_geo->SCTIDHelper()->eta_module(idFirst)));
215 etaModule.push_back(
DataType(
m_geo->PixelIDHelper()->eta_module(idFirst)));
224 if ( PRDTruthColl ==
nullptr ) continue ;
229 ATH_MSG_VERBOSE(
"Found " << numBarcodes.back() <<
" common barcodes, now "
230 <<
barcodes.size() <<
" in total" );
243 dataMap[
"etaModule"] = etaModule;
246 if ( numBarcodes.size() > 0 ){
248 dataMap[
"numBarcodes"] = numBarcodes;
250 std::string bctag =
"barcodes multiple=\""+
DataType(
barcodes.size()/
double(numBarcodes.size())).toString()+
"\"";
269 return m_geo.retrieve();
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
SG::ReadHandleKey< PRD_MultiTruthCollection > m_SCTPRDTruthName
virtual StatusCode initialize()
Only retrieve geo tool in initialize.
const_pointer_type cptr()
Dereference the pointer.
SiSpacePointRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
A PRD is mapped onto all contributing particles.
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
std::map< std::string, DataVect > DataMap
bool is_valid() const
Check if id is in a valid state.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
unsigned int getTruthBarcodes(const Identifier idFirst, const Identifier idSecond, const PRD_MultiTruthCollection *truthColl, DataVect &barcodes)
Get the barcodes of associated truth particles for a SpacePoint ( we require both clusters,...
def barcodes(beg, end, sz)
Templated class to convert any object that is streamable in a ostringstream in a string.
::StatusCode StatusCode
StatusCode definition for legacy code.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
bool m_useSCTTruthMap
StoreGate key for SCT PRD_MultiTruth.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
virtual std::string dataTypeName() const
Return the name of the data type.
const ToolHandle< IInDetGeoModelTool > m_geo
A tool handle to the geo model tool.
Eigen::Matrix< double, 3, 1 > Vector3D
SG::ReadHandleKey< SpacePointContainer > m_PixelSPContainerName
StoreGate key for Pixel space points.
An STL vector of pointers that by default owns its pointed-to elements.
value_type get_compact(void) const
Get the compact id.
#define ATH_MSG_WARNING(x)
SG::ReadHandleKey< PRD_MultiTruthCollection > m_PixelPRDTruthName
Handle class for reading from StoreGate.
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
SG::ReadHandleKey< SpacePointContainer > m_SCTSPContainerName
StoreGate key for SCT space points.
bool m_usePixelTruthMap
StoreGate key for pixel PRD_MultiTruth.