Skip to content
Snippets Groups Projects
Commit feea778c authored by Tobias Bockh's avatar Tobias Bockh
Browse files

cosmics

parent 4524392d
No related branches found
No related tags found
No related merge requests found
Showing
with 397 additions and 7 deletions
......@@ -33,11 +33,11 @@ if __name__ == "__main__":
ConfigFlags.Input.isMC = False # Needed to bypass autoconfig
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" # Needed to bypass autoconfig, only the "OFLCOND" matters at the moment
ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now
ConfigFlags.GeoModel.FaserVersion = "FASER-CR" # FASER cosmic ray geometry (station 2 only)
ConfigFlags.GeoModel.FaserVersion = "FASER-01" # FASER geometry
ConfigFlags.Input.ProjectName = "data20" # Needed to bypass autoconfig
ConfigFlags.GeoModel.Align.Dynamic = False
ConfigFlags.Input.Files = ["cosmics.raw"]
ConfigFlags.Output.RDOFileName = "tracker.RDO.pool.root"
ConfigFlags.Output.RDOFileName = "my.RDO.pool.root"
ConfigFlags.lock()
# Configure components
......
......@@ -50,10 +50,11 @@ def MagneticFieldSvcCfg(flags, **kwargs):
# This handles addFolderSplitMC https://gitlab.cern.ch/atlas/athena/blob/master/Database/IOVDbSvc/python/CondDB.py#L240
# i.e. replaces conddb.addFolderSplitMC('GLOBAL','/GLOBAL/BField/Maps <noover/>','/GLOBAL/BField/Maps <noover/>')
# def addFolders(configFlags,folderstrings,detDb=None,className=None):
if flags.Input.isMC:
db='GLOBAL_OFL'
else:
db='GLOBAL'
db='GLOBAL_OFL'
# if flags.Input.isMC:
# db='GLOBAL_OFL'
# else:
# db='GLOBAL'
result.merge(addFolders(flags,['/GLOBAL/BField/Maps <noover/>'],detDb=db, className="CondAttrListCollection") )
result.merge(addFolders(flags,['/GLOBAL/BField/Scales <noover/>'],detDb=db, className="CondAttrListCollection") )
......
......@@ -114,7 +114,7 @@ TrackerDataDecoderTool::convert(const DAQFormats::EventFull* re,
ATH_MSG_DEBUG("Fragment:\n" << *frag);
uint32_t trb = frag->source_id() & 0x0000FFFF;
// FIXME: will need to be updated for interface detector
int station = 2 + trb / TrackerDataFragment::PLANES_PER_STATION;
int station = 1 + trb / TrackerDataFragment::PLANES_PER_STATION;
int plane = trb % TrackerDataFragment::PLANES_PER_STATION;
// Exceptions are a no-no in Athena/Calypso, so catch any thrown by faser-common
......
################################################################################
# Package: FaserSpacePoints
################################################################################
# Declare the package name:
atlas_subdir( FaserSpacePoints )
atlas_add_component( FaserSpacePoints
src/components/*.cxx src/*.cxx src/*.h
LINK_LIBRARIES AthenaBaseComps TrackerSpacePoint TrackerPrepRawData)
atlas_install_python_modules( python/*.py )
\ No newline at end of file
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
import sys
from AthenaCommon.Logging import log, logging
from AthenaCommon.Constants import DEBUG, VERBOSE, INFO
from AthenaCommon.Configurable import Configurable
from CalypsoConfiguration.AllConfigFlags import ConfigFlags
from CalypsoConfiguration.MainServicesConfig import MainServicesCfg
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
# from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
# from Digitization.DigitizationParametersConfig import writeDigitizationMetadata
from TrackerPrepRawDataFormation.TrackerPrepRawDataFormationConfig import FaserSCT_ClusterizationCfg
from TrackerSpacePointFormation.TrackerSpacePointFormationConfig import TrackerSpacePointFinderCfg
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
Tracker__TruthSeededTrackFinder, THistSvc=CompFactory.getComps("Tracker::FaserSpacePoints", "THistSvc")
def TruthSeededTrackFinderBasicCfg(flags, **kwargs):
"""Return ComponentAccumulator for TruthSeededTrackFinder"""
acc = ComponentAccumulator()
kwargs.setdefault("SpacePointsSCTName", "SCT_SpacePointContainer")
acc.addEventAlgo(Tracker__TruthSeededTrackFinder(**kwargs))
# attach ToolHandles
return acc
def TruthSeededTrackFinder_OutputCfg(flags):
"""Return ComponentAccumulator with Output for SCT. Not standalone."""
acc = ComponentAccumulator()
acc.merge(OutputStreamCfg(flags, "ESD"))
ostream = acc.getEventAlgo("OutputStreamESD")
ostream.TakeItemsFromInput = True
return acc
def FaserSpacePointsCfg(flags, **kwargs):
acc=TruthSeededTrackFinderBasicCfg(flags, **kwargs)
histSvc= THistSvc()
histSvc.Output += [ "TruthTrackSeeds DATAFILE='truthtrackseeds.root' OPT='RECREATE'" ]
acc.addService(histSvc)
acc.merge(TruthSeededTrackFinder_OutputCfg(flags))
return acc
if __name__ == "__main__":
log.setLevel(DEBUG)
Configurable.configurableRun3Behavior = True
# Configure
ConfigFlags.Input.Files = ['my.RDO.pool.root']
ConfigFlags.Output.ESDFileName = "mySeeds.ESD.pool.root"
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX"
ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now
ConfigFlags.Input.ProjectName = "data20" # Needed to bypass autoconfig
ConfigFlags.Input.isMC = False # Needed to bypass autoconfig
ConfigFlags.GeoModel.FaserVersion = "FASER-01" # FASER cosmic ray geometry (station 2 only)
ConfigFlags.Common.isOnline = False
ConfigFlags.GeoModel.Align.Dynamic = False
ConfigFlags.Beam.NumberOfCollisions = 0.
ConfigFlags.lock()
# Core components
acc = MainServicesCfg(ConfigFlags)
acc.merge(PoolReadCfg(ConfigFlags))
#acc.merge(writeDigitizationMetadata(ConfigFlags))
# Inner Detector
acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags))
acc.merge(TrackerSpacePointFinderCfg(ConfigFlags))
acc.merge(FaserSpacePointsCfg(ConfigFlags))
# Timing
#acc.merge(MergeRecoTimingObjCfg(ConfigFlags))
# Dump config
logging.getLogger('forcomps').setLevel(VERBOSE)
acc.foreach_component("*").OutputLevel = VERBOSE
acc.foreach_component("*ClassID*").OutputLevel = INFO
# acc.getCondAlgo("FaserSCT_AlignCondAlg").OutputLevel = VERBOSE
# acc.getCondAlgo("FaserSCT_DetectorElementCondAlg").OutputLevel = VERBOSE
acc.getService("StoreGateSvc").Dump = True
acc.getService("ConditionStore").Dump = True
acc.printConfig(withDetails=True)
ConfigFlags.dump()
# Execute and finish
sc = acc.run(maxEvents=-1)
# Success should be 0
sys.exit(not sc.isSuccess())
#include "FaserSpacePoints.h"
#include "Identifier/Identifier.h"
#include "TrkSpacePoint/SpacePoint.h"
#include "TrackerPrepRawData/TrackerClusterCollection.h"
namespace Tracker {
FaserSpacePoints::FaserSpacePoints(const std::string& name, ISvcLocator* pSvcLocator)
: AthReentrantAlgorithm(name, pSvcLocator) { }
StatusCode FaserSpacePoints::initialize() {
ATH_MSG_INFO(name() << "::" << __FUNCTION__);
if ( m_sct_spcontainer.key().empty()) {
ATH_MSG_FATAL( "SCTs selected and no name set for SCT clusters");
return StatusCode::FAILURE;
}
ATH_CHECK( m_sct_spcontainer.initialize() );
ATH_CHECK(detStore()->retrieve(m_idHelper, "FaserSCT_ID"));
std::string filePath = m_filePath;
m_outputFile = TFile::Open(filePath.c_str(), "RECREATE");
if (m_outputFile == nullptr) {
ATH_MSG_ERROR("Unable to open output file at " << m_filePath);
return StatusCode::FAILURE;
}
m_outputFile->cd();
std::string treeName = m_treeName;
m_outputTree = new TTree(treeName.c_str(), "tree");
if (m_outputTree == nullptr) {
ATH_MSG_ERROR("Unable to create TTree");
return StatusCode::FAILURE;
}
FaserSpacePoints::initializeTree();
return StatusCode::SUCCESS;
}
StatusCode FaserSpacePoints::finalize() {
ATH_MSG_INFO(name() << "::" << __FUNCTION__);
m_outputFile->cd();
m_outputTree->Write();
return StatusCode::SUCCESS;
}
StatusCode FaserSpacePoints::execute(const EventContext& ctx) const {
ATH_MSG_INFO(name() << "::" << __FUNCTION__);
m_run = ctx.eventID().run_number();
m_event = ctx.eventID().event_number();
ATH_MSG_DEBUG("run = " << m_run);
ATH_MSG_DEBUG("event = " << m_event);
SG::ReadHandle<SpacePointContainer> sct_spcontainer( m_sct_spcontainer, ctx );
if (!sct_spcontainer.isValid()){
ATH_MSG_FATAL("Could not find the data object " << sct_spcontainer.name());
return StatusCode::RECOVERABLE;
}
m_nCollections = sct_spcontainer->size();
ATH_MSG_DEBUG("nCollections = " << m_nCollections);
SpacePointContainer::const_iterator it = sct_spcontainer->begin();
SpacePointContainer::const_iterator it_end = sct_spcontainer->end();
for(; it != it_end; ++it) {
const SpacePointCollection* col = *it;
m_nSpacepoints = col->size();
ATH_MSG_DEBUG("nSpacepoints = " << m_nSpacepoints);
SpacePointCollection::const_iterator it_sp = col->begin();
SpacePointCollection::const_iterator it_sp_end = col->end();
for (; it_sp != it_sp_end; ++it_sp) {
const Trk::SpacePoint* sp = *it_sp;
const Identifier id = sp->clusterList().first->identify();
int station = m_idHelper->station(id);
int plane = m_idHelper->layer(id);
m_layer = (station - 1) * 3 + plane;
Amg::Vector3D position = sp->globalPosition();
m_x = position.x();
m_y = position.y();
m_z = position.z();
m_outputTree->Fill();
}
}
return StatusCode::SUCCESS;
}
void FaserSpacePoints::initializeTree() {
m_outputTree->Branch("run", &m_run);
m_outputTree->Branch("event", &m_event);
m_outputTree->Branch("layer", &m_layer);
m_outputTree->Branch("n_collections", &m_nCollections);
m_outputTree->Branch("n_spacepoints", &m_nSpacepoints);
m_outputTree->Branch("x", &m_x);
m_outputTree->Branch("y", &m_y);
m_outputTree->Branch("z", &m_z);
}
}
\ No newline at end of file
#ifndef FASERSPACEPOINTS_H
#define FASERSPACEPOINTS_H
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "TrackerIdentifier/FaserSCT_ID.h"
#include "TrkSpacePoint/SpacePointContainer.h"
#include <string>
#include <atomic>
#include "TTree.h"
#include "TFile.h"
namespace Tracker {
class FaserSpacePoints : public AthReentrantAlgorithm {
public:
FaserSpacePoints(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~FaserSpacePoints() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override;
private:
void initializeTree();
mutable int m_run{0};
mutable int m_event{0};
mutable int m_layer{0};
mutable int m_nCollections{0};
mutable int m_nSpacepoints{0};
mutable float m_x{0};
mutable float m_y{0};
mutable float m_z{0};
const FaserSCT_ID* m_idHelper{nullptr};
SG::ReadHandleKey<SpacePointContainer> m_sct_spcontainer{this, "SpacePointsSCTName", "SCT spacepoint container"};
Gaudi::Property<std::string> m_filePath{this, "FilePath", "spacepoints.root", "Output root file for spacepoints"};
Gaudi::Property<std::string> m_treeName{this, "TreeName", "tree", ""};
TFile* m_outputFile;
TTree* m_outputTree;
};
}
#endif // FASERSPACEPOINTS_H
\ No newline at end of file
#include "../FaserSpacePoints.h"
DECLARE_COMPONENT( Tracker::FaserSpacePoints )
\ No newline at end of file
#!/usr/bin/env python
"""Test various ComponentAccumulator Digitization configuration modules
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
import sys
from AthenaCommon.Logging import log, logging
from AthenaCommon.Constants import DEBUG, VERBOSE, INFO
from AthenaCommon.Configurable import Configurable
from CalypsoConfiguration.AllConfigFlags import ConfigFlags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from CalypsoConfiguration.MainServicesConfig import MainServicesCfg
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
#from Digitization.DigitizationParametersConfig import writeDigitizationMetadata
from TrackerPrepRawDataFormation.TrackerPrepRawDataFormationConfig import FaserSCT_ClusterizationCfg
#from MCTruthSimAlgs.RecoTimingConfig import MergeRecoTimingObjCfg
# Set up logging and new style config
log.setLevel(DEBUG)
Configurable.configurableRun3Behavior = True
# Configure
ConfigFlags.Input.Files = ['my.RDO.pool.root']
ConfigFlags.Output.ESDFileName = "myClusters.ESD.pool.root"
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" # Needed to bypass autoconfig, only the "OFLCOND" matters at the moment
ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now
ConfigFlags.Input.ProjectName = "data20" # Needed to bypass autoconfig
ConfigFlags.Input.isMC = False # Needed to bypass autoconfig
ConfigFlags.GeoModel.FaserVersion = "FASER-01" # FASER cosmic ray geometry (station 2 only)
ConfigFlags.Common.isOnline = False
ConfigFlags.GeoModel.Align.Dynamic = False
ConfigFlags.Beam.NumberOfCollisions = 0.
ConfigFlags.lock()
# Core components
acc = MainServicesCfg(ConfigFlags)
acc.merge(PoolReadCfg(ConfigFlags))
acc.merge(PoolWriteCfg(ConfigFlags))
#acc.merge(writeDigitizationMetadata(ConfigFlags))
# Inner Detector
acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags))
# Timing
#acc.merge(MergeRecoTimingObjCfg(ConfigFlags))
# Dump config
# logging.getLogger('forcomps').setLevel(VERBOSE)
# acc.foreach_component("*").OutputLevel = VERBOSE
# acc.foreach_component("*ClassID*").OutputLevel = INFO
# acc.getCondAlgo("FaserSCT_AlignCondAlg").OutputLevel = VERBOSE
# acc.getCondAlgo("FaserSCT_DetectorElementCondAlg").OutputLevel = VERBOSE
# acc.getService("StoreGateSvc").Dump = True
# acc.getService("ConditionStore").Dump = True
# acc.printConfig(withDetails=True)
# ConfigFlags.dump()
# Execute and finish
sc = acc.run(maxEvents=-1)
# Success should be 0
sys.exit(not sc.isSuccess())
\ No newline at end of file
#!/usr/bin/env python
"""Test various ComponentAccumulator Digitization configuration modules
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
import sys
from AthenaCommon.Logging import log, logging
from AthenaCommon.Constants import DEBUG, VERBOSE, INFO
from AthenaCommon.Configurable import Configurable
from CalypsoConfiguration.AllConfigFlags import ConfigFlags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from CalypsoConfiguration.MainServicesConfig import MainServicesCfg
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
#from Digitization.DigitizationParametersConfig import writeDigitizationMetadata
from TrackerSpacePointFormation.TrackerSpacePointFormationConfig import TrackerSpacePointFinderCfg
from TrackerPrepRawDataFormation.TrackerPrepRawDataFormationConfig import FaserSCT_ClusterizationCfg
#from MCTruthSimAlgs.RecoTimingConfig import MergeRecoTimingObjCfg
# Set up logging and new style config
log.setLevel(DEBUG)
Configurable.configurableRun3Behavior = True
# Configure
ConfigFlags.Input.Files = ['my.RDO.pool.root']
ConfigFlags.Output.ESDFileName = "mySpacePoints.ESD.pool.root"
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX"
ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now
ConfigFlags.Input.ProjectName = "data20" # Needed to bypass autoconfig
ConfigFlags.Input.isMC = False # Needed to bypass autoconfig
ConfigFlags.Common.isOnline = False
ConfigFlags.GeoModel.FaserVersion = "FASER-01" # FASER cosmic ray geometry (station 2 only)
ConfigFlags.GeoModel.Align.Dynamic = False
ConfigFlags.Beam.NumberOfCollisions = 0.
ConfigFlags.lock()
# Core components
acc = MainServicesCfg(ConfigFlags)
acc.merge(PoolReadCfg(ConfigFlags))
acc.merge(PoolWriteCfg(ConfigFlags))
#acc.merge(writeDigitizationMetadata(ConfigFlags))
# Inner Detector
acc.merge(FaserSCT_ClusterizationCfg(ConfigFlags))
acc.merge(TrackerSpacePointFinderCfg(ConfigFlags))
# Timing
#acc.merge(MergeRecoTimingObjCfg(ConfigFlags))
# Dump config
# logging.getLogger('forcomps').setLevel(VERBOSE)
# acc.foreach_component("*").OutputLevel = VERBOSE
# acc.foreach_component("*ClassID*").OutputLevel = INFO
# acc.getCondAlgo("FaserSCT_AlignCondAlg").OutputLevel = VERBOSE
# acc.getCondAlgo("FaserSCT_DetectorElementCondAlg").OutputLevel = VERBOSE
# acc.getService("StoreGateSvc").Dump = True
# acc.getService("ConditionStore").Dump = True
# acc.printConfig(withDetails=True)
# ConfigFlags.dump()
# Execute and finish
sc = acc.run(maxEvents=-1)
# Success should be 0
sys.exit(not sc.isSuccess())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment