diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterFormation/TrkDetStripClusterFormation/StripClusterization.h b/Tracker/TrkDetAlgs/TrkDetStripClusterFormation/TrkDetStripClusterFormation/StripClusterization.h deleted file mode 100644 index 103737a0f836b5f0413544ac4a4d3ef0f29ebf79..0000000000000000000000000000000000000000 --- a/Tracker/TrkDetAlgs/TrkDetStripClusterFormation/TrkDetStripClusterFormation/StripClusterization.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef TRKDETSTRIPCLUSTERFORMATION_STRIPCLUSTERIZATION_H -#define TRKDETSTRIPCLUSTERFORMATION_STRIPCLUSTERIZATION_H -//STL -#include <string> -#include <map> -#include <set> - -//Gaudi -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -// Base class -#include "AthenaBaseComps/AthAlgorithm.h" - -//InDet includes -//Stored by value, cannot be fwd declared -#include "Identifier/IdentifierHash.h" -//template parameter, so should not be possible to just fwd declare -#include "Identifier/Identifier.h" -//Next contains a typedef so cannot be fwd declared -#include "InDetPrepRawData/SCT_ClusterContainer.h" -#include "InDetRawData/SCT_RDO_Container.h" -//tool/service handle template parameters - - -class SCT_ID; -class SCT_ChannelStatusAlg; -class SiDetectorManager; -class ISvcLocator; -class StatusCode; -class ISCT_FlaggedConditionSvc; - -class IInDetConditionsSvc; -namespace InDetDD{ - class SiDetectorManager; -} - - -namespace InDet { - class ISCT_ClusteringTool; -/** - * @class SCT_Clusterization - * @brief Form clusters from SCT Raw Data Objects - * The class loops over an RDO grouping strips and creating collections of clusters, subsequently recorded in StoreGate - * Uses SCT_ConditionsServices to determine which strips to include. - */ -class SCT_Clusterization : public AthAlgorithm { -public: - /// Constructor with parameters: - SCT_Clusterization(const std::string &name,ISvcLocator *pSvcLocator); - - /** @name Usual algorithm methods */ - //@{ - ///Retrieve the tools used and initialize variables - virtual StatusCode initialize(); - ///Form clusters and record them in StoreGate (detector store) - virtual StatusCode execute(); - ///Clean up and release the collection containers - virtual StatusCode finalize(); - //@} - - -private: - /** @name Disallow default instantiation, copy, assignment */ - //@{ - SCT_Clusterization() = delete; - SCT_Clusterization(const SCT_Clusterization&) = delete; - SCT_Clusterization &operator=(const SCT_Clusterization&) = delete; - //@} - - ToolHandle< ISCT_ClusteringTool > m_clusteringTool; //!< Clustering algorithm -// std::string m_dataObjectName; //!< RDO container name in StoreGate - std::string m_managerName; //REMOVE LATER //!< Detector manager name in StoreGate -// std::string m_clustersName; //REMOVE LATER -// int m_page; //REMOVE LATER //!< Page number for hash function - const SCT_ID* m_idHelper; -// typedef std::map<Identifier, int> IdMap_t;//REMOVE LATER -// IdMap_t m_status;//REMOVE LATER -// IdentifierHash m_maxKey;//REMOVE LATER - - - SG::ReadHandle<SCT_RDO_Container> m_rdoContainer; //(m_dataObjectName); - SG::WriteHandle<SCT_ClusterContainer> m_clusterContainer; - const InDetDD::SiDetectorManager* m_manager; - unsigned int m_maxRDOs; - ServiceHandle<IInDetConditionsSvc> m_pSummarySvc; - ServiceHandle<ISCT_FlaggedConditionSvc> m_flaggedConditionSvc; - bool m_checkBadModules; - std::set<IdentifierHash> m_flaggedModules; - unsigned int m_maxTotalOccupancyPercent; -}; - -} - -#endif // TRKDETSTRIPCLUSTERFORMATION_STRIPCLUSTERIZATION_H \ No newline at end of file diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterFormation/src/StripClusterization.cxx b/Tracker/TrkDetAlgs/TrkDetStripClusterFormation/src/StripClusterization.cxx deleted file mode 100644 index 93aef8adfc315cd3c7df0640d9fa2b06265ac469..0000000000000000000000000000000000000000 --- a/Tracker/TrkDetAlgs/TrkDetStripClusterFormation/src/StripClusterization.cxx +++ /dev/null @@ -1,218 +0,0 @@ -#include "InDetPrepRawDataFormation/SCT_Clusterization.h" -#include "InDetPrepRawData/SiClusterContainer.h" -#include "InDetPrepRawData/SCT_ClusterCollection.h" -#include "InDetConditionsSummaryService/IInDetConditionsSvc.h" -#include "InDetRawData/SCT_RDORawData.h" -#include "InDetRawData/SCT_RDO_Container.h" -#include "InDetReadoutGeometry/SiDetectorManager.h" -#include "AtlasDetDescr/AtlasDetectorID.h" -#include "InDetIdentifier/SCT_ID.h" -#include "SCT_ConditionsServices/ISCT_FlaggedConditionSvc.h" -#include "SiClusterizationTool/ISCT_ClusteringTool.h" - -#include "StoreGate/StoreClearedIncident.h" - -#include "GaudiKernel/PropertyMgr.h" -#include "GaudiKernel/IIncidentSvc.h" -#include "StoreGate/DataHandle.h" -#include "CxxUtils/make_unique.h" - -namespace InDet{ - using namespace InDet; - static const std::string moduleFailureReason("SCT_Clusterization: Exceeds max RDOs"); - -// Constructor with parameters: - SCT_Clusterization::SCT_Clusterization(const std::string &name, ISvcLocator *pSvcLocator) : - AthAlgorithm(name,pSvcLocator), - m_clusteringTool("InDet::SCT_ClusteringTool", this), //Changed to private // public - does this need to be changed for athenaMT -// m_dataObjectName("SCT_RDOs"), // RDO container - m_managerName("SCT"), -// m_clustersName("NOTTHISNOTHIS"), -// m_page(0), - m_idHelper(nullptr), -// m_maxKey(0), - m_rdoContainer(), - m_clusterContainer(), - m_manager(nullptr), - m_maxRDOs(384), //(77), - m_pSummarySvc("SCT_ConditionsSummarySvc", name), - m_flaggedConditionSvc("SCT_FlaggedConditionSvc",name), - m_checkBadModules(true), - m_flaggedModules(), - m_maxTotalOccupancyPercent(10) - { - // Get parameter values from jobOptions file - declareProperty("DataObjectName", m_rdoContainer = SG::ReadHandle<SCT_RDO_Container> ("SCT_RDOs"), "SCT RDOs" ); - declareProperty("DetectorManagerName",m_managerName); - declareProperty("clusteringTool",m_clusteringTool); //inconsistent nomenclature! -// declareProperty("ClustersName",m_clustersName); -// declareProperty("PageNumber",m_page); - declareProperty("conditionsService" , m_pSummarySvc); - declareProperty("maxRDOs", m_maxRDOs); - declareProperty("checkBadModules",m_checkBadModules); - declareProperty("FlaggedConditionService", m_flaggedConditionSvc); - declareProperty("maxTotalOccupancyInPercent",m_maxTotalOccupancyPercent); - declareProperty("ClustersName", - m_clusterContainer = SG::WriteHandle<SCT_ClusterContainer>("SCT_Clusters"), - "SCT cluster container"); - - } - - -// Initialize method: - StatusCode SCT_Clusterization::initialize(){ - ATH_MSG_INFO( "SCT_Clusterization::initialize()!"); - - // Get the conditions summary service (continue anyway, just check the pointer - // later and declare everything to be 'good' if it is NULL) - if (m_checkBadModules){ - ATH_MSG_INFO( "Clusterization has been asked to look at bad module info" ); - ATH_CHECK(m_pSummarySvc.retrieve()); - } - - // Get the flagged conditions service - ATH_CHECK(m_flaggedConditionSvc.retrieve()); - - // Get the clustering tool - ATH_CHECK (m_clusteringTool.retrieve()); - - // Get the SCT manager - ATH_CHECK (detStore()->retrieve(m_manager,"SCT")); - - // Get the SCT ID helper - ATH_CHECK (detStore()->retrieve(m_idHelper,"SCT_ID")); - - ATH_MSG_INFO( "Container m_clusterContainer '" << m_clusterContainer.name() << "' set"); - - return StatusCode::SUCCESS; - } - - -// Execute method: - StatusCode SCT_Clusterization::execute(){ - // Register the IdentifiableContainer into StoreGate -// ATH_MSG_INFO( "Container m_clusterContainer '" << m_clusterContainer.name() << "' set"); - m_clusterContainer = CxxUtils::make_unique<SCT_ClusterContainer>(m_idHelper->wafer_hash_max()); - // declare the container: -// m_clusterContainer->addRef(); - - SiClusterContainer* symSiContainer = nullptr; - StatusCode sc = evtStore()->symLink(m_clusterContainer.cptr(), symSiContainer); - if (sc.isFailure()) { - ATH_MSG_FATAL("Pixel clusters could not be symlinked in StoreGate !"); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG( "Pixel clusters '" << m_clusterContainer.name() << "' symlinked in StoreGate"); - } - if (! m_clusterContainer.isValid() ){ - msg(MSG:: FATAL) << "Container of type SCT_ClusterContainer could not be initialised !"<< endreq; - return StatusCode::FAILURE; - }else{ - ATH_MSG_DEBUG( "Container '" << m_clusterContainer.name() << "' initialised" ); - } - - - // First, we have to retrieve and access the container, not because we want to - // use it, but in order to generate the proxies for the collections, if they - // are being provided by a container converter. -// const SG::ReadHandle<SCT_RDO_Container> p_rdoContainer(m_dataObjectName); - if (!m_rdoContainer.isValid()){ - msg(MSG:: FATAL) << "Could not find the data object "<< m_rdoContainer.name() << " !" << endreq; - return StatusCode::FAILURE; - } - // Anything to dereference the DataHandle will trigger the converter - m_rdoContainer->clID(); - SCT_RDO_Container::const_iterator rdoCollections = m_rdoContainer->begin(); - SCT_RDO_Container::const_iterator rdoCollectionsEnd = m_rdoContainer->end(); - bool dontDoClusterization(false); - //new code to remove large numbers of hits (what is large?) - if (m_maxTotalOccupancyPercent != 100){ - constexpr int totalNumberOfChannels(6279168); - const int maxAllowableHits(totalNumberOfChannels*m_maxTotalOccupancyPercent/100);//integer arithmetic, should be ok - int totalHits(0); - for(; rdoCollections != rdoCollectionsEnd; ++rdoCollections){ - const InDetRawDataCollection<SCT_RDORawData>* rd(*rdoCollections); - totalHits+=rd->size(); - }//iterator is now at the end - //reset the iterator - rdoCollections = m_rdoContainer->begin(); - if (totalHits > maxAllowableHits) { - ATH_MSG_INFO("This event has too many hits in the SCT"); - dontDoClusterization=true; - } - } - - - //detType doesn't seem to do anything, does it need to be here? -// AtlasDetectorID detType; - if (not dontDoClusterization){ - for(; rdoCollections != rdoCollectionsEnd; ++rdoCollections){ - const InDetRawDataCollection<SCT_RDORawData>* rd(*rdoCollections); - #ifndef NDEBUG - ATH_MSG_DEBUG("RDO collection size=" << rd->size() << ", Hash=" << rd->identifyHash()); - #endif - bool goodModule = (m_checkBadModules and m_pSummarySvc) ? m_pSummarySvc->isGood(rd->identifyHash()) : true; - // Check the RDO is not empty and that the wafer is good according to the conditions - if ((not rd->empty()) and goodModule){ - // If more than a certain number of RDOs set module to bad - if (m_maxRDOs and (rd->size() > m_maxRDOs)) { - m_flaggedConditionSvc->flagAsBad(rd->identifyHash(), moduleFailureReason); - m_flaggedModules.insert(rd->identifyHash()); - continue; - } - // Use one of the specific clustering AlgTools to make clusters - std::unique_ptr<SCT_ClusterCollection> clusterCollection ( m_clusteringTool->clusterize(*rd,*m_manager,*m_idHelper)); - if (clusterCollection) { -// ATH_MSG_DEBUG("SCT_ClusterCollection" << clusterCollection->size() << "\n"); - if (not clusterCollection->empty()) { - //Using get because I'm unsure of move semantec status - if (m_clusterContainer->addCollection(clusterCollection.get(), clusterCollection->identifyHash()).isFailure()){ - msg(MSG:: FATAL) << "Clusters could not be added to container !"<< endreq; -// delete clusterCollection; // Graceful exit? - return StatusCode::FAILURE; - } else { - #ifndef NDEBUG - ATH_MSG_DEBUG("Clusters with key '" << clusterCollection->identifyHash() << "' added to Container\n"); - #endif - clusterCollection.release();//Release ownership if sucessfully added to collection - } - } else { - #ifndef NDEBUG - ATH_MSG_DEBUG("Don't write empty collections\n"); - #endif -// delete clusterCollection; - } - } else { - ATH_MSG_DEBUG("Clustering algorithm found no clusters\n"); - } - } - } - } - // Set container to const - if (m_clusterContainer.setConst().isFailure()){ - ATH_MSG_FATAL("FAILED TO SET CONST"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - -// Finalize method: - StatusCode SCT_Clusterization::finalize() - { - msg(MSG::INFO) << "SCT_Clusterization::finalize() " << PACKAGE_VERSION << endreq; - if (m_maxRDOs) { - msg(MSG::INFO) - << "Number of noisy modules killed by maximum RDO limit of " - << m_maxRDOs << " = " << m_flaggedModules.size() << endreq; - msg(MSG::INFO) << "Printing info on up to 10 modules:" << endreq; - std::set<IdentifierHash>::const_iterator itr(m_flaggedModules.begin()); - std::set<IdentifierHash>::const_iterator end(m_flaggedModules.end()); - for (int num(0); (itr != end) && (num < 10) ; ++itr, ++num) { - msg(MSG::INFO) << "Noisy: " << m_idHelper->print_to_string(m_idHelper->wafer_id(*itr)) << endreq; - } - } - - return StatusCode::SUCCESS; - } - -} \ No newline at end of file diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/CMakeLists.txt b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5629706cf9fbc5e1ea72ed092de93fb493f1e2e5 --- /dev/null +++ b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/CMakeLists.txt @@ -0,0 +1,34 @@ +################################################################################ +# Package: TrkDetStripClusterImporter +################################################################################ + + +# Declare the package name: +atlas_subdir( TrkDetStripClusterImporter ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps + xAOD/xAODFaserTracking + GaudiKernel + PRIVATE + Control/AthenaKernel + ) + + +# External dependencies: +find_package( Eigen ) +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread EG ) +find_package( XercesC ) +find_package( Boost ) + +# Component(s) in the package: +atlas_add_component( TrkDetStripClusterImporter + src/*.cxx + src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} + AthenaBaseComps xAODFaserTracking GaudiKernel AthenaKernel +) +# Install files from the package: +atlas_install_headers( TrkDetStripClusterImporter ) \ No newline at end of file diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/TrkDetStripClusterImporter/StripClusterImporter.h b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/TrkDetStripClusterImporter/StripClusterImporter.h new file mode 100644 index 0000000000000000000000000000000000000000..fac9b4b8a00bf31784e16e2c42ea16abc0b58a09 --- /dev/null +++ b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/TrkDetStripClusterImporter/StripClusterImporter.h @@ -0,0 +1,33 @@ +#ifndef TRKDETSTRIPCLUSTERIMPORTER_H +#define TRKDETSTRIPCLUSTERIMPORTER_H +//STL +#include <string> + +// Base class +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "xAODFaserTracking/StripClusterContainer.h" + +namespace TrkDet{ +class StripClusterImporter : public AthAlgorithm { +public: + /// Constructor with parameters: + StripClusterImporter(const std::string &name,ISvcLocator *pSvcLocator); + + ~StripClusterImporter(); + + StatusCode initialize(); + StatusCode execute(); + StatusCode finalize(); + +private: + + std::string m_clusCollectionName; + StatusCode retrieveFatrasCluster() const; + +}; + + +} + +#endif // TRKDETSTRIPCLUSTERIMPORTER_H \ No newline at end of file diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/share/JO_standalone.py b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/share/JO_standalone.py new file mode 100644 index 0000000000000000000000000000000000000000..8b928343e20bad46b454f5cf77c6f3f009113e46 --- /dev/null +++ b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/share/JO_standalone.py @@ -0,0 +1,21 @@ +from AthenaCommon import CfgMgr +import AthenaRootComps.ReadAthenaRoot +svcMgr.EventSelector.InputCollections = ["/afs/cern.ch/work/r/rjansky/FASER/clusters.root"] +svcMgr.EventSelector.TupleName = "clusters" + + +# Access the algorithm sequence: +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + +from StripClusterImporter.StripClusterImporterConf import TrkDet__StripClusterImporter +# Add the algorithm. +importalg = TrkDet__StripClusterImporter("StripClusterImporter") +importalg.OutputLevel = VERBOSE +topSequence += importalg +print importalg + +from OutputStreamAthenaPool.MultipleStreamManager import MSMgr +xaodStream = MSMgr.NewPoolRootStream( "StreamAOD", "XAOD_"+"clusters"+".pool.root" ) +xaodStream.AddItem("xAOD::StripClusterContainer#*") +xaodStream.AddItem("xAOD::StripClusterAuxContainer#*") \ No newline at end of file diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/share/flatTreeConv.C b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/share/flatTreeConv.C new file mode 100644 index 0000000000000000000000000000000000000000..5d1dec09b94fe59f2a1660c7b660825fb657f720 --- /dev/null +++ b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/share/flatTreeConv.C @@ -0,0 +1,69 @@ + +#include <vector> + +#include "TFile.h" +#include "TTree.h" +#include "TSystem.h" + +#include "TInterpreter.h" + +void read() +{ + gInterpreter->GenerateDictionary("vector<vector<float> >","vector"); + TFile *f = TFile::Open("/afs/cern.ch/work/r/rjansky/FASER/clusters.root","READ"); + + if (!f) { return; } + TTree *t = (TTree*)f->Get("clusters"); + Int_t event_nr; + Float_t g_x,g_y,g_z,l_x,l_y; + + t->SetBranchAddress("event_nr",&event_nr); + t->SetBranchAddress("g_x",&g_x); + t->SetBranchAddress("g_y",&g_y); + t->SetBranchAddress("g_z",&g_z); + t->SetBranchAddress("l_x",&l_x); + t->SetBranchAddress("l_y",&l_y); + + TFile *fNew = TFile::Open("clustersVec.root","RECREATE"); + + std::vector<float> g_xV,g_yV,g_zV,l_xV,l_yV; + + // Create a TTree + TTree *tNew = new TTree("clusters","Tree with clusters"); + tNew->Branch("g_x",&g_xV); + tNew->Branch("g_y",&g_yV); + tNew->Branch("g_z",&g_zV); + tNew->Branch("l_x",&l_xV); + tNew->Branch("l_y",&l_yV); + + + int prevEvent=0; + for (Long64_t i = 0; i < t->GetEntries(); i++) { + + t->GetEntry(i); + + if(prevEvent!=event_nr&&i!=0){ + tNew->Fill(); + g_xV.clear(); + g_yV.clear(); + g_zV.clear(); + l_xV.clear(); + l_yV.clear(); + std::cout << "clearing: " << i <<std::endl; + } + prevEvent=event_nr; + g_xV.push_back(g_x); + g_yV.push_back(g_y); + g_zV.push_back(g_z); + l_xV.push_back(l_x); + l_yV.push_back(l_y); + } + fNew->Write(); + delete fNew; +} + + +void flatTreeConv() +{ + read(); +} \ No newline at end of file diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/src/StripClusterImporter.cxx b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/src/StripClusterImporter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..566aec9fd4e5dad0b50d9e6b2e553829f310302a --- /dev/null +++ b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/src/StripClusterImporter.cxx @@ -0,0 +1,71 @@ +#include "TrkDetStripClusterImporter/StripClusterImporter.h" +#include "xAODFaserTracking/StripClusterAuxContainer.h" + +namespace TrkDet { + + StripClusterImporter::StripClusterImporter (const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm( name, pSvcLocator ), + m_clusCollectionName("StripClusters") + { + declareProperty("OutputClustersName" , m_clusCollectionName); + } + + StripClusterImporter::~StripClusterImporter() + {} + + StatusCode StripClusterImporter::initialize() { + + return StatusCode::SUCCESS; + } + + StatusCode StripClusterImporter::finalize() + { + return StatusCode::SUCCESS; + } + + StatusCode StripClusterImporter::retrieveFatrasCluster() const + { + const std::vector<float> *g_x,*g_y,*g_z,*l_x,*l_y; + CHECK( evtStore()->retrieve( g_x, "g_x" ) ); + CHECK( evtStore()->retrieve( g_y, "g_y" ) ); + CHECK( evtStore()->retrieve( g_z, "g_z" ) ); + CHECK( evtStore()->retrieve( l_x, "l_x" ) ); + CHECK( evtStore()->retrieve( l_y, "l_y" ) ); + // Add one strip cluster to the container: + + // Create the cluster containers: + xAOD::StripClusterContainer* clusterC = new xAOD::StripClusterContainer(); + ATH_CHECK( evtStore()->record( clusterC, m_clusCollectionName ) ); + xAOD::StripClusterAuxContainer* aux = new xAOD::StripClusterAuxContainer(); + ATH_CHECK( evtStore()->record( aux, m_clusCollectionName + "Aux." ) ); + clusterC->setStore( aux ); + //p.setLocalPosition( 1.0, 2.0); + //p.setLocalPositionError( 0.2, 0.2, 0.05 ); + + for(unsigned int i = 0; i<g_x->size();i++){ + xAOD::StripCluster* p = new xAOD::StripCluster(); + clusterC->push_back( p ); + p->setId(i); + float x(g_x->at(i)),y(g_y->at(i)),z(g_z->at(i)); + float lx(l_x->at(i)),ly(l_y->at(i)); + p->setGlobalPosition( z, y, x ); + p->setLocalPosition(lx, ly); + //implement hack for covariance here! + //p->setLocalPositionError(covX, covY, covXY); + ATH_MSG_DEBUG( "global x = " << p->globalX() << ", global y = " << p->globalY() << ", global z = " << p->globalZ() ); + } + + + return StatusCode::SUCCESS; + } + + + StatusCode StripClusterImporter::execute() { + + if(!retrieveFatrasCluster()){ + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; + } + +} \ No newline at end of file diff --git a/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/src/components/StripClusterImporter_entries.cxx b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/src/components/StripClusterImporter_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d23b21f9025b5f4845811f7d05fe7195f6a7f134 --- /dev/null +++ b/Tracker/TrkDetAlgs/TrkDetStripClusterImporter/src/components/StripClusterImporter_entries.cxx @@ -0,0 +1,3 @@ +#include "TrkDetStripClusterImporter/StripClusterImporter.h" + +DECLARE_COMPONENT( TrkDet::StripClusterImporter ) diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterAuxContainer.h b/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterAuxContainer.h index ff1eaec8a84fb2a3aac1200d149a620abd09efd4..9468186dec59765b15debb10673a00a3e6d2c2f8 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterAuxContainer.h +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterAuxContainer.h @@ -43,6 +43,6 @@ namespace xAOD { // Set up a CLID for the container: #include "xAODCore/CLASS_DEF.h" -CLASS_DEF( xAOD::StripClusterAuxContainer , 1311112289 , 1 ) +CLASS_DEF( xAOD::StripClusterAuxContainer , 1314387539 , 1 ) #endif // XAODFASERTRACKING_STRIPCLUSTERAUXCONTAINER_H \ No newline at end of file diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterContainer.h b/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterContainer.h index bcf2b8f46abd6d10bdff4a42652d169ffd7b4edb..8932824ffce34ed9a2d889fa0fb00d8c9ef15cda 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterContainer.h +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/StripClusterContainer.h @@ -13,6 +13,6 @@ namespace xAOD { // Set up a CLID for the container: #include "xAODCore/CLASS_DEF.h" -CLASS_DEF( xAOD::StripClusterContainer , 1123888166 , 1 ) +CLASS_DEF( xAOD::StripClusterContainer , 1123887426 , 1 ) #endif // XAODFASERTRACKING_STRIPCLUSTERCONTAINER_H \ No newline at end of file diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataAuxContainer.h b/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataAuxContainer.h index ceab955bc29eaf5e5497d3122ed04ae32e4c1ada..6c4ad12d9243a733b78164c3c03e4a84a6ed1a72 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataAuxContainer.h +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataAuxContainer.h @@ -22,6 +22,6 @@ namespace xAOD { // Set up a CLID for the container: #include "xAODCore/CLASS_DEF.h" -CLASS_DEF( xAOD::StripRawDataAuxContainer , 1171743595 , 1 ) +CLASS_DEF( xAOD::StripRawDataAuxContainer , 1173573595 , 1 ) #endif // XAODFASERTRACKING_STRIPRAWDATAAUXCONTAINER_H \ No newline at end of file diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataContainer.h b/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataContainer.h index 20569b61f2c9841a207c6d9584b925ff6edf38d4..287eb4db36ab46c2d44059f6ca684e654b40c47c 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataContainer.h +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/StripRawDataContainer.h @@ -14,6 +14,6 @@ namespace xAOD { // Set up a CLID for the container: #include "xAODCore/CLASS_DEF.h" -CLASS_DEF(xAOD::StripRawDataContainer, 1314367244, 1) +CLASS_DEF(xAOD::StripRawDataContainer, 1312857244, 1) #endif // XAODFASERTRACKING_STRIPRAWDATACONTAINER_H \ No newline at end of file diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/Track.h b/xAOD/xAODFaserTracking/xAODFaserTracking/Track.h index 0a5dd3bd2a944a47421ef8124e2f9a19bc6e6ad4..000b03ae7f4b65673f48844a06a98ac7aa934f49 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/Track.h +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/Track.h @@ -229,6 +229,6 @@ namespace xAOD { // Set up a CLID for the class: #include "xAODCore/CLASS_DEF.h" -CLASS_DEF( xAOD::Track, 159016719, 1 ) +CLASS_DEF( xAOD::Track, 159248719, 1 ) #endif // XAODFASERTRACKING_TRACK_H \ No newline at end of file diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/TrackAuxContainer.h b/xAOD/xAODFaserTracking/xAODFaserTracking/TrackAuxContainer.h index 9418d53aa763bb14c14cf5b700310d0ba4c56b60..da04c7a1afdbdab7693c27aac8d1bf410aad262f 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/TrackAuxContainer.h +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/TrackAuxContainer.h @@ -91,7 +91,7 @@ namespace xAOD { // Set up a CLID and StoreGate inheritance for the class: #include "xAODCore/CLASS_DEF.h" -CLASS_DEF( xAOD::TrackAuxContainer, 1209269198, 1 ) +CLASS_DEF( xAOD::TrackAuxContainer, 1209585198, 1 ) #endif // XAODFASERTRACKING_TRACKAUXCONTAINER_H \ No newline at end of file diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/TrackContainer.h b/xAOD/xAODFaserTracking/xAODFaserTracking/TrackContainer.h index 9ea2dc1db2f4cb952da4075af81e82643e59587d..b6a502d59c22881049cfe5cb7ff24aced4820a7f 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/TrackContainer.h +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/TrackContainer.h @@ -16,6 +16,6 @@ namespace xAOD { // Set up a CLID for the container: #include "xAODCore/CLASS_DEF.h" -CLASS_DEF( xAOD::TrackContainer, 1287425431, 1 ) +CLASS_DEF( xAOD::TrackContainer, 1287447991, 1 ) #endif // XAODFASERTRACKING_TRACKCONTAINER_H \ No newline at end of file diff --git a/xAOD/xAODFaserTracking/xAODFaserTracking/selection.xml b/xAOD/xAODFaserTracking/xAODFaserTracking/selection.xml index e84b24622af33c98839c0b9c0417da7e840c0624..ee5c82a19e259a945155a00e80ca73460cf7a393 100644 --- a/xAOD/xAODFaserTracking/xAODFaserTracking/selection.xml +++ b/xAOD/xAODFaserTracking/xAODFaserTracking/selection.xml @@ -36,9 +36,9 @@ <!-- StripCluster dictionaries: --> <class name="xAOD::StripCluster"/> <class name="xAOD::StripClusterAuxContainer" - id="61B62A1A-4C51-43A2-9623-1B9E910A81E8"/> + id="61B62A1A-4C51-43A2-8364-1B9E910A81E8"/> <class name="xAOD::StripClusterContainer" - id="868F1FD8-AFE7-4B40-B12E-73716C37A6B0"/> + id="868F1FD8-A5E7-4B40-B84E-73716C37A6B0"/> <!-- Smart pointers to objects: --> <class name="DataLink<xAOD::StripClusterContainer>" /> diff --git a/xAOD/xAODFaserTrackingAthenaPool/CMakeLists.txt b/xAOD/xAODFaserTrackingAthenaPool/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8add0695839c4a39dda01cf5246c5640d0b30e09 --- /dev/null +++ b/xAOD/xAODFaserTrackingAthenaPool/CMakeLists.txt @@ -0,0 +1,29 @@ +################################################################################ +# Package: xAODFaserTrackingAthenaPool +################################################################################ + +# Declare the package name: +atlas_subdir( xAODFaserTrackingAthenaPool ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( + PRIVATE + Control/AthContainers + Control/AthenaKernel + Database/AthenaPOOL/AthenaPoolCnvSvc + Database/AthenaPOOL/AthenaPoolUtilities + xAOD/xAODFaserTracking ) + +# External dependencies: +find_package( ROOT COMPONENTS Core ) + +# Component(s) in the package: +atlas_add_poolcnv_library( xAODFaserTrackingAthenaPoolPoolCnv + src/*.h src/*.cxx + FILES xAODFaserTracking/StripClusterContainer.h + xAODFaserTracking/StripClusterAuxContainer.h + TYPES_WITH_NAMESPACE xAOD::StripClusterContainer xAOD::StripClusterAuxContainer + CNV_PFX xAOD + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaKernel + AthenaPoolCnvSvcLib AthenaPoolUtilities xAODFaserTracking xAODTrackingCnvLib ) \ No newline at end of file diff --git a/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterAuxContainerCnv.cxx b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterAuxContainerCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..df675231f8e6bc6fa0ca38e008185581757540be --- /dev/null +++ b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterAuxContainerCnv.cxx @@ -0,0 +1,39 @@ +// System include(s): +#include <exception> + +// Local include(s): +#include "xAODStripClusterAuxContainerCnv.h" +#include "AthContainers/tools/copyThinned.h" +#include "AthenaKernel/IThinningSvc.h" + +xAODStripClusterAuxContainerCnv:: +xAODStripClusterAuxContainerCnv( ISvcLocator* svcLoc ) + : xAODStripClusterAuxContainerCnvBase( svcLoc ) { + +} + +xAOD::StripClusterAuxContainer* +xAODStripClusterAuxContainerCnv:: +createPersistent( xAOD::StripClusterAuxContainer* trans ) { + + // Create a copy of the container: + return SG::copyThinned (*trans, IThinningSvc::instance()); +} + +xAOD::StripClusterAuxContainer* +xAODStripClusterAuxContainerCnv::createTransient() { + + // The known ID(s) for this container: + static const pool::Guid v1_guid( "61B62A1A-4C51-43A2-8364-1B9E910A81E8" ); + + // Check which version of the container we're reading: + if( compareClassGuid( v1_guid ) ) { + // It's the latest version, read it directly: + return poolReadObject< xAOD::StripClusterAuxContainer >(); + } + + // If we didn't recognise the ID: + throw std::runtime_error( "Unsupported version of " + "xAOD::StripClusterAuxContainer found" ); + return 0; +} \ No newline at end of file diff --git a/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterAuxContainerCnv.h b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterAuxContainerCnv.h new file mode 100644 index 0000000000000000000000000000000000000000..5e2b1e1efc98d94d0f40be9c06b830dca025b203 --- /dev/null +++ b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterAuxContainerCnv.h @@ -0,0 +1,36 @@ +#ifndef XAODFASERTRACKINGATHENAPOOL_XAODSTRIPCLUSTERAUXCONTAINERCNV_H +#define XAODFASERTRACKINGATHENAPOOL_XAODSTRIPCLUSTERAUXCONTAINERCNV_H + +// Gaudi/Athena include(s): +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" + +// EDM include(s): +#include "xAODFaserTracking/StripClusterAuxContainer.h" + +/// Base class for the converter +typedef T_AthenaPoolCustomCnv< xAOD::StripClusterAuxContainer, + xAOD::StripClusterAuxContainer > + xAODStripClusterAuxContainerCnvBase; + +/** + * @short POOL converter for the xAOD::StripClusterAuxContainer class + * + */ +class xAODStripClusterAuxContainerCnv : + public xAODStripClusterAuxContainerCnvBase { + +public: + /// Converter constructor + xAODStripClusterAuxContainerCnv( ISvcLocator* svcLoc ); + +protected: + /// Function preparing the container to be written out + virtual xAOD::StripClusterAuxContainer* + createPersistent( xAOD::StripClusterAuxContainer* trans ); + /// Function reading in the object from the input file + virtual xAOD::StripClusterAuxContainer* createTransient(); + +}; // class xAODStripClusterAuxContainerCnv + +#endif + diff --git a/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterContainerCnv.cxx b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterContainerCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fdd23c76344d426d296eb7d369215aa1b9b12e83 --- /dev/null +++ b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterContainerCnv.cxx @@ -0,0 +1,72 @@ +// System include(s): +#include <exception> + +// Local include(s): +#include "xAODStripClusterContainerCnv.h" + +namespace { + + /// Helper function setting up the container's link to its auxiliary store + void setStoreLink( SG::AuxVectorBase* cont, const std::string& key ) { + + // The link to set up: + DataLink< SG::IConstAuxStore > link( key + "Aux." ); + + // Give it to the container: + cont->setStore( link ); + + return; + } + +} // private namespace + +xAODStripClusterContainerCnv::xAODStripClusterContainerCnv( ISvcLocator* svcLoc ) + : xAODStripClusterContainerCnvBase( svcLoc ) { +} + +xAOD::StripClusterContainer* +xAODStripClusterContainerCnv:: +createPersistent( xAOD::StripClusterContainer* trans ) { + + // Create a view copy of the container: + xAOD::StripClusterContainer* result = + new xAOD::StripClusterContainer( trans->begin(), trans->end(), + SG::VIEW_ELEMENTS ); + + // Return the new container: + return result; +} + +/** + * This function needs to be re-implemented in order to figure out the StoreGate + * key of the container that's being created. After that's done, it lets the + * base class do its normal task. + */ +StatusCode xAODStripClusterContainerCnv::createObj( IOpaqueAddress* pAddr, + DataObject*& pObj ) { + + // Get the key of the container that we'll be creating: + m_key = *( pAddr->par() + 1 ); + ATH_MSG_VERBOSE( "Key of xAOD::StripClusterContainer: " << m_key ); + + // Let the base class do its thing now: + return AthenaPoolConverter::createObj( pAddr, pObj ); +} + +xAOD::StripClusterContainer* xAODStripClusterContainerCnv::createTransient() { + + // The known ID(s) for this container: + static pool::Guid v1_guid( "868F1FD8-A5E7-4B40-B84E-73716C37A6B0" ); + + // Check if we're reading the most up to date type: + if( compareClassGuid( v1_guid ) ) { + xAOD::StripClusterContainer* c = poolReadObject< xAOD::StripClusterContainer >(); + setStoreLink( c, m_key ); + return c; + } + + // If we didn't recognise the ID, let's complain: + throw std::runtime_error( "Unsupported version of " + "xAOD::StripClusterContainer found" ); + return 0; +} \ No newline at end of file diff --git a/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterContainerCnv.h b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterContainerCnv.h new file mode 100644 index 0000000000000000000000000000000000000000..a6e4c92595f3c019a7813d6829c0df27ff17a234 --- /dev/null +++ b/xAOD/xAODFaserTrackingAthenaPool/src/xAODStripClusterContainerCnv.h @@ -0,0 +1,50 @@ +#ifndef XAODFASERTRACKINGATHENAPOOL_XAODSTRIPCLUSTERCONTAINERCNV_H +#define XAODFASERTRACKINGATHENAPOOL_XAODSTRIPCLUSTERCONTAINERCNV_H + +// Gaudi/Athena include(s): +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" + +// EDM include(s): +#include "xAODFaserTracking/StripClusterContainer.h" + +/// Type definition for the converter's base +typedef T_AthenaPoolCustomCnv< xAOD::StripClusterContainer, + xAOD::StripClusterContainer > + xAODStripClusterContainerCnvBase; + +/** + * @short POOL converter for the xAOD::StripClusterContainer class + * + * Simple converter class making the xAOD::StripClusterContainer + * class known to POOL. + + * + */ +class xAODStripClusterContainerCnv : public xAODStripClusterContainerCnvBase { + + // Declare the factory as our friend: + friend class CnvFactory< xAODStripClusterContainerCnv >; + +public: + /// Converter constructor + xAODStripClusterContainerCnv( ISvcLocator* svcLoc ); + + /// Re-implemented function in order to get access to the SG key + virtual StatusCode createObj( IOpaqueAddress* pAddr, DataObject*& pObj ); + + /// Function preparing the container to be written out + virtual xAOD::StripClusterContainer* createPersistent( xAOD::StripClusterContainer* trans ); + + /// Function reading in the persistent object + virtual xAOD::StripClusterContainer* createTransient(); + +private: + /// Function preparing a vertex object for persistence + void toPersistent( xAOD::StripCluster* np ) const; + + /// StoreGate key of the container just being created + std::string m_key; + +}; // class xAODStripClusterContainerCnv + +#endif \ No newline at end of file