Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DCH v2 digitizer, which smears the position and adds cluster information #27

Merged
merged 56 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
28a570f
DCH v2 digitizer, which smears the position and adds cluster information
atolosadelgado Aug 5, 2024
505090a
remove gaudi transformer linking/header
atolosadelgado Aug 8, 2024
8b8ab07
filter out the new digitizer if DCH data extension is not found
atolosadelgado Aug 8, 2024
703a26e
update test of idea vx
atolosadelgado Aug 9, 2024
33a72aa
fix vx test
atolosadelgado Aug 9, 2024
5be4335
remove position_L/R member of data extension
atolosadelgado Aug 9, 2024
d54728a
add test for DCHdigi
atolosadelgado Aug 9, 2024
bd8a656
add protection in case the file for CLS is not available
atolosadelgado Aug 9, 2024
eff7cbb
add ctest
atolosadelgado Aug 9, 2024
7ea07c2
cast variables to void to get rid of spurious compiler warning
atolosadelgado Aug 9, 2024
af01cbe
add edm4hep link in yaml
atolosadelgado Aug 12, 2024
715534d
use to mutable digi hit
atolosadelgado Aug 12, 2024
5b33de0
add association as second collection in the output
atolosadelgado Aug 12, 2024
44485a1
fix path to compact file of DCH stand alone
atolosadelgado Aug 12, 2024
98ccbad
array index in C start at 0...
atolosadelgado Aug 12, 2024
7c5ad81
use ref to mutable object, to be checked if association is correct
atolosadelgado Aug 12, 2024
cc5dc9c
write association in the output
atolosadelgado Aug 23, 2024
eaf0525
default z resolution 1 mm
atolosadelgado Aug 23, 2024
119fc63
default xy resolution 0.1 mm
atolosadelgado Aug 23, 2024
1d488d4
expanded comment about the uid service
atolosadelgado Aug 23, 2024
b472424
comment added
atolosadelgado Aug 23, 2024
af864ff
add comment about advancing the random engines
atolosadelgado Aug 23, 2024
a3780d9
change value in test
atolosadelgado Aug 23, 2024
f289d0b
output file with histograms for debugging is now configurable from st…
atolosadelgado Aug 23, 2024
520d206
remove unused function
atolosadelgado Aug 23, 2024
a9ff689
add shebang
atolosadelgado Aug 23, 2024
f245c15
remove alias for edm4hep classes
atolosadelgado Aug 23, 2024
58445a2
rename namespace of edm4hep extension to edm4hep, add interface
atolosadelgado Aug 23, 2024
a47b0b0
implement Thomas suggestion, exit code removed
atolosadelgado Aug 29, 2024
d6c1c9e
moving back new edm4hep classes to extension namespace
atolosadelgado Aug 30, 2024
034afab
add interface back again...
atolosadelgado Sep 2, 2024
fc131e5
add extension::Track
atolosadelgado Sep 21, 2024
70cd63a
rename of cluster variables
atolosadelgado Sep 21, 2024
7ab5570
indentantion is compliant with local .clang-format file
atolosadelgado Sep 21, 2024
b91123d
indentation corrected
atolosadelgado Oct 15, 2024
183ddeb
avoid downloading several times the cluster input file
atolosadelgado Oct 15, 2024
30d782e
initialize variables, fix compilation in ubuntu
atolosadelgado Oct 15, 2024
1aa738b
major refactorization of cluster counting function
atolosadelgado Oct 18, 2024
c48d274
data extension modified,
atolosadelgado Oct 18, 2024
c5d0388
clang format of source code
atolosadelgado Oct 18, 2024
be57d8c
include vector of cluster sizes in the data extension
atolosadelgado Nov 11, 2024
904e654
add few comments
atolosadelgado Nov 13, 2024
ddde328
move initialization of distributions to the main scope of the Calcula…
atolosadelgado Nov 13, 2024
6ef9e94
add protection against zero energy hit
atolosadelgado Nov 13, 2024
560bcef
change direction and random seed for DDSim steering file
atolosadelgado Nov 13, 2024
2d269e0
add version v01 suffix to digitizer class name
atolosadelgado Nov 14, 2024
018f172
add protection against negative values
atolosadelgado Nov 14, 2024
6ca9321
add readme
atolosadelgado Nov 14, 2024
f8bc735
ancillary functions to calculate wire positions moved to data extension
atolosadelgado Nov 22, 2024
2564163
use new geometry functions from data extension, safer way of saving o…
atolosadelgado Nov 22, 2024
d02cf89
update comments
atolosadelgado Nov 24, 2024
45d6c63
update README
atolosadelgado Nov 27, 2024
b3886ce
update README
atolosadelgado Nov 27, 2024
13ea3eb
additional flag to make dNdx calculation optional, plus extra comments
atolosadelgado Nov 27, 2024
2fbfc2b
update README and header doxygen
atolosadelgado Nov 27, 2024
7e20301
enable dNdx calculation in the test
atolosadelgado Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ find_package(ROOT COMPONENTS RIO Tree MathCore)
find_package(EDM4HEP)
find_package(k4FWCore)
find_package(Gaudi)
find_package(GSL)
#---------------------------------------------------------------

include(cmake/Key4hepConfig.cmake)
Expand Down
27 changes: 23 additions & 4 deletions DCHdigi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ install(FILES

install(FILES
dataFormatExtension/driftChamberHit.yaml
DESTINATION "${CMAKE_INSTALL_DATADIR}/extension" COMPONENT dev)
DESTINATION "${CMAKE_INSTALL_PREFIX}/extension" COMPONENT dev)

install(FILES
"${PROJECT_BINARY_DIR}/libextensionDict_rdict.pcm"
Expand All @@ -42,15 +42,29 @@ file(GLOB headers
${PROJECT_SOURCE_DIR}/include/*.h
)

include(CheckIncludeFileCXX)
set(CMAKE_REQUIRED_LIBRARIES DD4hep::DDRec)
CHECK_INCLUDE_FILE_CXX(DDRec/DCH_info.h DCH_INFO_H_EXIST)
set(CMAKE_REQUIRED_LIBRARIES)
set(FILES_DEPENDINGON_DCH_INFO_H "DCHdigi.cpp" )
if(NOT DCH_INFO_H_EXIST)
list(FILTER sources EXCLUDE REGEX "${FILES_DEPENDINGON_DCH_INFO_H}")
message(WARNING "Gaudi algorithm defined in ${FILES_DEPENDINGON_DCH_INFO_H} will not be built because header file DDRec/DCH_info.h was not found")
endif()

gaudi_add_module(${PackageName}
SOURCES ${sources}
LINK
k4FWCore::k4FWCore
k4FWCore::k4Interface
Gaudi::GaudiKernel
EDM4HEP::edm4hep
extensionDict
k4FWCore::k4FWCore
k4FWCore::k4Interface
DD4hep::DDRec
DD4hep::DDCore
ROOT::MathCore
ROOT::MathMore
GSL::gsl
)

target_include_directories(${PackageName} PUBLIC
Expand All @@ -71,7 +85,7 @@ install(TARGETS ${PackageName}
EXPORT ${CMAKE_PROJECT_NAME}Targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/@{CMAKE_PROJECT_NAME}" COMPONENT dev
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}" COMPONENT dev
)

install(FILES ${scripts} DESTINATION test)
Expand All @@ -83,3 +97,8 @@ set_test_env(${test_name})
SET(test_name "test_DCHsimpleDigitizerExtendedEdm")
ADD_TEST(NAME ${test_name} COMMAND k4run test/runDCHsimpleDigitizerExtendedEdm.py)
set_test_env(${test_name})

SET(test_name "test_runDCHdigiV2")
ADD_TEST(NAME ${test_name} COMMAND sh +x test_DCHdigi.sh )
set_test_env(${test_name})
set_tests_properties(${test_name} PROPERTIES WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/DCHdigi/test/test_DCHdigi")
20 changes: 20 additions & 0 deletions DCHdigi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Drift chamber (DCH) digitizers

## DCHdigi_v01

* Each simulated hit is transformed into a digitized hit. The digitized hit position is the projection of the simulated hit position onto the sense wire (at the center of the cell)
* Smearing of the digitized hit position along the wire and radially is done according to the input parameter values (`zResolution_mm` and `xyResolution_mm`, respectively)
* The digitized hit adds dNdx information if flag `calculate_dndx` is enabled (default not). This information consist on number of clusters and their size, which are derived from precalculated distributions contained in an input file specified by the parameter `fileDataAlg`. The method and distributions corresponds to the option 3 described in F. Cuna et al, arXiv:2105.07064
* It requires that the cellID contain the layer and number of cell within the layer (nphi). It does not matter if the segmentation comes from geometrical segmentation by using twisted tubes and hyperboloids (and the cellID is created out of volume IDs), or the segmentation is virtual DD4hep segmentation
* New digitized hit class is used as an EDM4hep data extension, to be integrated into EDM4hep
* Debug histograms are created if `create_debug_histograms` option is enabled (output file name can be given)
* Stand alone test run simulation of the drift chamber based on twisted tubes, and then apply the digitizer. Dedicated directory with all the files needed is given in `DCHdigi/test/test_DCHdigi/`
* Random number generator uses the seeds calculated on an event basis by the UID service, from the podio header information (run/event number)
* This digitizer is meant to be used with `DriftChamber_o1_v02` from k4geo and is expected to work for the upcoming `DriftChamber_o1_v03`

## DCHsimpleDigitizerExtendedEdm

* Algorithm for creating digitized drift chamber hits (based on edm4hep::TrackerHit3D) from edm4hep::SimTrackerHit. Resolution along z and xy (distance to the wire) has to be specified. The smearing is applied in the wire reference frame, by means of the placement matrix of the wires
* No cluster counting information is added into the digitized output
* It relies on a dedicated data extension, similar to DCHdigi_v01
* This digitizer is meant to be used with `DriftChamber_o1_v01` from k4geo. Deprecated.
118 changes: 118 additions & 0 deletions DCHdigi/dataFormatExtension/driftChamberHit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ schema_version: 1
options:
# should getters / setters be prefixed with get / set?
getSyntax: True
setSyntax: True
# should POD members be exposed with getters/setters in classes that have them as members?
exposePODMembers: False
includeSubfolder: True
Expand Down Expand Up @@ -41,3 +42,120 @@ datatypes:
OneToOneRelations:
- extension::DriftChamberDigi digi // reference to the digitized hit
- edm4hep::SimTrackerHit sim // reference to the simulated hit

extension::DriftChamberDigiV2:
Description: "Digitized hit (before tracking) for Drift Chamber v2 (requires data extension)."
Author: "A. Tolosa-Delgado, B. Francois, CERN"
Members:
- uint64_t cellID // ID of the sensor that created this hit
- int32_t type // type of the raw data hit
- int32_t quality // quality bit flag of the hit
- float time // time of the hit [ns]
- float eDep // energy deposited on the hit [GeV]
- float eDepError // error measured on eDep [GeV]
- edm4hep::Vector3d position // point on the sensitive wire (SW) which is closest to the simhit [mm]
- edm4hep::Vector3d directionSW // direction of SW
- float distanceToWire // distance hit-wire [mm]
- uint32_t nCluster // number of clusters associated to this hit
VectorMembers:
- uint16_t nElectrons // number of electrons for each cluster

extension::MCRecoDriftChamberDigiV2Association:
Description: "Association between a DriftChamberDigi and the corresponding simulated hit"
Author: "B. Francois, CERN"
Members:
- float weight // weight of this association
OneToOneRelations:
- extension::DriftChamberDigiV2 digi // reference to the digitized hit
- edm4hep::SimTrackerHit sim // reference to the simulated hit

extension::Track:
Description: "Reconstructed track"
Author: "EDM4hep authors"
Members:
- int32_t type // flagword that defines the type of track.Bits 16-31 are used internally
- float chi2 // Chi^2 of the track fit
- int32_t ndf // number of degrees of freedom of the track fit
- float dEdx // dEdx of the track
- float dEdxError // error of dEdx
- float radiusOfInnermostHit // radius of the innermost hit that has been used in the track fit
VectorMembers:
- int32_t subdetectorHitNumbers // number of hits in particular subdetectors
- edm4hep::TrackState trackStates // track states
- edm4hep::Quantity dxQuantities // different measurements of dx quantities
OneToManyRelations:
- extension::TrackerHit trackerHits // hits that have been used to create this track
- extension::Track tracks // tracks (segments) that have been combined to create this track

# the following is just because interface looks for e.g. extension/TrackerHit3DCollection.h
extension::TrackerHit3D:
Description: "Tracker hit"
Author: "EDM4hep authors"
Members:
- uint64_t cellID // ID of the sensor that created this hit
- int32_t type // type of raw data hit
- int32_t quality // quality bit flag of the hit
- float time [ns] // time of the hit
- float eDep [GeV] // energy deposited on the hit
- float eDepError [GeV] // error measured on EDep
- edm4hep::Vector3d position [mm] // hit position
- edm4hep::CovMatrix3f covMatrix // covariance matrix of the position (x,y,z)
ExtraCode:
includes: "#include <edm4hep/Constants.h>"
declaration: "
/// Get the position covariance matrix value for the two passed dimensions\n
float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const { return getCovMatrix().getValue(dimI, dimJ); }\n
"
MutableExtraCode:
includes: "#include <edm4hep/Constants.h>"
declaration: "
/// Set the position covariance matrix value for the two passed dimensions\n
void setCovMatrix(float value, edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) { getCovMatrix().setValue(value, dimI, dimJ); }\n
"
extension::TrackerHitPlane:
Description: "Tracker hit plane"
Author: "EDM4hep authors"
Members:
- uint64_t cellID // ID of the sensor that created this hit
- int32_t type // type of raw data hit
- int32_t quality // quality bit flag of the hit
- float time [ns] // time of the hit
- float eDep [GeV] // energy deposited on the hit
- float eDepError [GeV] // error measured on EDep
- edm4hep::Vector2f u // measurement direction vector, u lies in the x-y plane
- edm4hep::Vector2f v // measurement direction vector, v is along z
- float du // measurement error along the direction
- float dv // measurement error along the direction
- edm4hep::Vector3d position [mm] // hit position
- edm4hep::CovMatrix3f covMatrix // covariance of the position (x,y,z)
ExtraCode:
includes: "#include <edm4hep/Constants.h>"
declaration: "
/// Get the position covariance matrix value for the two passed dimensions\n
float getCovMatrix(edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) const { return getCovMatrix().getValue(dimI, dimJ); }\n
"
MutableExtraCode:
includes: "#include <edm4hep/Constants.h>"
declaration: "
/// Set the position covariance matrix value for the two passed dimensions\n
void setCovMatrix(float value, edm4hep::Cartesian dimI, edm4hep::Cartesian dimJ) { getCovMatrix().setValue(value, dimI, dimJ); }\n
"

# end of "the following is just because interface looks for e.g. extension/TrackerHit3DCollection.h"

interfaces:
extension::TrackerHit:
Description: "Tracker hit interface class"
Author: "Thomas Madlener, DESY"
Members:
- uint64_t cellID // ID of the sensor that created this hit
- int32_t type // type of the raw data hit
- int32_t quality // quality bit flag of the hit
- float time [ns] // time of the hit
- float eDep [GeV] // energy deposited on the hit
- float eDepError [GeV] // error measured on eDep
- edm4hep::Vector3d position [mm] // hit position
Types:
- extension::TrackerHitPlane
- extension::TrackerHit3D
- extension::DriftChamberDigiV2
Loading
Loading