Commit f93711f7 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

new file: JugReco/src/components/TrackerHitReconstruction.cpp

parent 8fe4c3ea
---
Language: Cpp
BasedOnStyle: Chromium
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
BasedOnStyle: LLVM
BreakConstructorInitializersBeforeComma: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
Standard: Cpp11
#SpaceBeforeParens: ControlStatements
SpaceAfterControlStatementKeyword: true
PointerBindsToType: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...
......@@ -14,6 +14,9 @@
namespace dd4hep {
class Detector;
class DetElement;
namespace rec {
class CellIDPositionConverter;
}
}
namespace Acts {
......@@ -30,6 +33,7 @@ public:
// receive DD4hep Geometry
virtual dd4hep::DetElement getDD4HepGeo() = 0;
virtual dd4hep::Detector* detector() = 0;
virtual std::shared_ptr<const dd4hep::rec::CellIDPositionConverter> cellIDPositionConverter() const = 0;
virtual std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry() const = 0;
// receive Geant4 Geometry
//virtual G4VUserDetectorConstruction* getGeant4Geo() = 0;
......
......@@ -85,9 +85,9 @@ StatusCode GeoSvc::initialize() {
default:
geoMsgLevel = Acts::Logging::VERBOSE;
}
m_trackingGeo = std::move(Acts::convertDD4hepDetector(
m_dd4hepgeo->world(), geoMsgLevel, Acts::equidistant, Acts::equidistant,
Acts::equidistant));
//m_trackingGeo = std::move(Acts::convertDD4hepDetector(
// m_dd4hepgeo->world(), geoMsgLevel, Acts::equidistant, Acts::equidistant,
// Acts::equidistant));
return StatusCode::SUCCESS;
}
......@@ -105,7 +105,7 @@ StatusCode GeoSvc::buildDD4HepGeo() {
}
m_dd4hepgeo->volumeManager();
m_dd4hepgeo->apply("DD4hepVolumeManager", 0, 0);
m_cellid_converter = std::make_shared<const dd4hep::rec::CellIDPositionConverter>(*m_dd4hepgeo);
return StatusCode::SUCCESS;
}
......
......@@ -19,6 +19,9 @@
// DD4Hep
#include "DD4hep/Detector.h"
#include "DDRec/CellIDPositionConverter.h"
#include "DDRec/SurfaceManager.h"
#include "DDRec/Surface.h"
class GeoSvc : public extends<Service, IGeoSvc> {
......@@ -40,7 +43,10 @@ public:
* DD4hep Geometry
*/
virtual dd4hep::DetElement getDD4HepGeo() override;
virtual std::shared_ptr<const dd4hep::rec::CellIDPositionConverter> cellIDPositionConverter() const {
return m_cellid_converter;
}
/** Get the main dd4hep Detector.
* Returns the pointer to the main dd4hep detector class.
......@@ -59,6 +65,10 @@ private:
/// Pointer to the interface to the DD4hep geometry
dd4hep::Detector* m_dd4hepgeo;
std::shared_ptr<const dd4hep::rec::CellIDPositionConverter> m_cellid_converter = nullptr;//(*(m_geoSvc->detector()));
/// XML-files with the detector description
Gaudi::Property<std::vector<std::string>> m_xmlFileNames{this, "detectors", {}, "Detector descriptions XML-files"};
......
......@@ -3,7 +3,7 @@ from Gaudi.Configuration import *
from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
podioevent = EICDataSvc("EventDataSvc", inputs=["derp.root"], OutputLevel=DEBUG)
geo_service = GeoSvc(detectors=["topside/vertex_tracker.xml"])
geo_service = GeoSvc(detectors=["topside/vertex_barrel.xml")
# reads HepMC text file and write the HepMC::GenEvent to the data service
from Configurables import PodioInput, ReadTestConsumer
......
......@@ -104,13 +104,11 @@ namespace Jug {
return StatusCode::SUCCESS;
}
StatusCode execute() override {
// input collection
const dd4pod::CalorimeterHitCollection* simhits = m_inputHitCollection.get();
// Create output collections
auto rawhits = m_outputHitCollection.createAndPut();
eic::RawCalorimeterHitCollection* rawHitCollection = new eic::RawCalorimeterHitCollection();
for(const auto& ahit : *simhits) {
//std::cout << ahit << "\n";
eic::RawCalorimeterHit rawhit((long long)ahit.cellID(), (long long)ahit.cellID(),
......
from Gaudi.Configuration import *
from GaudiKernel.DataObjectHandleBase import DataObjectHandleBase
from Configurables import ApplicationMgr, EICDataSvc, PodioOutput
from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
geo_service = GeoSvc("GeoSvc")#detectors=["topside/vertex_tracker.xml"])
podioevent = EICDataSvc("EventDataSvc", inputs=["derp.root"], OutputLevel=DEBUG)
from Configurables import PodioInput
from Configurables import Jug__Digi__ExampleCaloDigi as ExampleCaloDigi
from Configurables import Jug__Digi__ExampleCaloDigiFunc as ExampleCaloDigiFunc
#from Configurables import Jug__Digi__ExampleCaloDigiFunc as ExampleCaloDigiFunc
from Configurables import Jug__Digi__UFSDTrackerDigi as UFSDTrackerDigi
from Configurables import Jug__Reco__TrackerHitReconstruction as TrackerHitReconstruction
podioinput = PodioInput("PodioReader", collections=["mcparticles","LAEC_PrShHits","LAEC_ShHits","FAEC_PrShHits","FAEC_ShHits","GEMTrackerHits"], OutputLevel=DEBUG)
#caldigi = ExampleCaloDigi(inputHitCollection="FAEC_ShHits",outputHitCollection="RawFAECShowerHits")
caldigi = ExampleCaloDigi(inputHitCollection="FAEC_ShHits",outputHitCollection="RawFAECShowerHits")
ufsd_digi = UFSDTrackerDigi(inputHitCollection="GEMTrackerHits",outputHitCollection="GEMRawHits")
caldigifunc = ExampleCaloDigiFunc(InputData="FAEC_ShHits",OutputData="DERP")
#caldigifunc = ExampleCaloDigiFunc(InputData="FAEC_ShHits",OutputData="DERP")
trackerhit = TrackerHitReconstruction(inputHitCollection="GEMRawHits",outputHitCollection="GEMTrackHits")
types = []
......@@ -22,7 +24,7 @@ print("---------------------------------------\n")
print("---\n# List of input and output types by class")
for configurable in sorted([
PodioInput, EICDataSvc, PodioOutput,
ExampleCaloDigiFunc,ExampleCaloDigi, UFSDTrackerDigi ],
ExampleCaloDigi,ExampleCaloDigi, UFSDTrackerDigi ],
key=lambda c: c.getType()):
print("\"{}\":".format(configurable.getType()))
props = configurable.getDefaultProperties()
......@@ -39,7 +41,7 @@ out.outputCommands = ["keep *"]
ApplicationMgr(
TopAlg = [podioinput, ufsd_digi,caldigifunc, out
TopAlg = [podioinput, caldigi,ufsd_digi,trackerhit, out
],
EvtSel = 'NONE',
EvtMax = 5,
......
......@@ -28,8 +28,9 @@ gaudi_install_python_modules()
# )
gaudi_add_module(JugRecoPlugins
src/components/*.cpp
LINK_LIBRARIES GaudiAlgLib GaudiKernel JugBase ROOT NPDet::DD4podIO EICD::eicd)
src/components/TrackerHitReconstruction.cpp
src/components/TestACTSLogger.cpp
LINK_LIBRARIES GaudiAlgLib GaudiKernel JugBase ROOT NPDet::DD4podIO EICD::eicd DDRec)
#gaudi_add_test(ProduceForReadTest
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
......
#include <algorithm>
// Gaudi
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiAlg/Transformer.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiKernel/RndmGenerators.h"
#include "GaudiKernel/Property.h"
#include "DDRec/CellIDPositionConverter.h"
#include "DDRec/SurfaceManager.h"
#include "DDRec/Surface.h"
#include "JugBase/DataHandle.h"
#include "JugBase/IGeoSvc.h"
// Event Model related classes
//#include "GaudiExamples/MyTrack.h"
#include "eicd/RawTrackerHitCollection.h"
#include "eicd/TrackerHitCollection.h"
namespace Jug {
namespace Reco {
/** Ultra-fast silicon detector digitization.
*
*/
class TrackerHitReconstruction : public GaudiAlgorithm {
public:
Gaudi::Property<double> m_timeResolution{this, "timeResolution", 10};
Rndm::Numbers m_gaussDist;
DataHandle<eic::RawTrackerHitCollection> m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this};
DataHandle<eic::TrackerHitCollection> m_outputHitCollection{"outputHitCollection", Gaudi::DataHandle::Writer, this};
/// Pointer to the geometry service
SmartIF<IGeoSvc> m_geoSvc;
public:
// ill-formed: using GaudiAlgorithm::GaudiAlgorithm;
TrackerHitReconstruction(const std::string& name, ISvcLocator* svcLoc)
: GaudiAlgorithm(name, svcLoc) {
declareProperty("inputHitCollection", m_inputHitCollection,"");
declareProperty("outputHitCollection", m_outputHitCollection, "");
}
StatusCode initialize() override {
if (GaudiAlgorithm::initialize().isFailure())
return StatusCode::FAILURE;
m_geoSvc = service("GeoSvc");
if (!m_geoSvc) {
error() << "Unable to locate Geometry Service. "
<< "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg;
return StatusCode::FAILURE;
}
IRndmGenSvc* randSvc = svc<IRndmGenSvc>("RndmGenSvc", true);
StatusCode sc = m_gaussDist.initialize( randSvc, Rndm::Gauss(0.0, m_timeResolution.value()));
if (!sc.isSuccess()) {
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
StatusCode execute() override {
// input collection
const eic::RawTrackerHitCollection* rawhits = m_inputHitCollection.get();
// Create output collections
//dd4hep::rec::CellIDPositionConverter cellid_converter(*(m_geoSvc->detector()));
auto rec_hits = m_outputHitCollection.createAndPut();
for(const auto& ahit : *rawhits) {
debug() << "cell ID : " << ahit.cellID() << endmsg;
auto pos = m_geoSvc->cellIDPositionConverter()->position(ahit.cellID());
auto dim = m_geoSvc->cellIDPositionConverter()->cellDimensions(ahit.cellID());
debug() << " dim size : " << std::size(dim) << endmsg;
for(const auto& s : dim ) {
debug() << "a size : " << s << endmsg;
}
//std::array<double,3> posarr; pos.GetCoordinates(posarr);
//std::array<double,3> dimarr; dim.GetCoordinates(posarr);
//eic::TrackerHit hit;
eic::TrackerHit hit((long long)ahit.cellID(), (long long)ahit.cellID(), (long long)ahit.time(),
(float)ahit.charge() / 10000.0, (float)0.0, {{pos.x(), pos.y(),pos.z()}},{{dim[0],dim[1],0.0}});
rec_hits->push_back(hit);
}
return StatusCode::SUCCESS;
}
};
DECLARE_COMPONENT(TrackerHitReconstruction)
} // namespace Examples
} // namespace Gaudi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment