Skip to content

Commit

Permalink
Also working for CLD (change uncommented lines), but only using depre…
Browse files Browse the repository at this point in the history
…ciated readoutNames usage
  • Loading branch information
armin-ilg committed Sep 28, 2023
1 parent aa306b2 commit a406bb2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
12 changes: 7 additions & 5 deletions VTXdigi/src/VTXdigitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ StatusCode VTXdigitizer::initialize() {
}

// check if readout exists
if (m_geoSvc->lcdd()->readouts().find(m_readoutName) == m_geoSvc->lcdd()->readouts().end()) {
if (m_geoSvc->getDetector()->readouts().find(m_readoutName) == m_geoSvc->getDetector()->readouts().end()) {
error() << "Readout <<" << m_readoutName << ">> does not exist." << endmsg;
return StatusCode::FAILURE;
}

// set the cellID decoder
m_decoder = m_geoSvc->lcdd()->readout(m_readoutName).idSpec().decoder();
m_decoder = m_geoSvc->getDetector()->readout(m_readoutName).idSpec().decoder();

// retrieve the volume manager
m_volman = m_geoSvc->lcdd()->volumeManager();
m_volman = m_geoSvc->getDetector()->volumeManager();

return StatusCode::SUCCESS;
}
Expand Down Expand Up @@ -130,11 +130,13 @@ StatusCode VTXdigitizer::execute() {
// Smear the hit in the local sensor coordinates
double digiHitLocalPosition[3];
if (m_readoutName == "VTXIBCollection" ||
m_readoutName == "VTXOBCollection") { // In barrel, the sensor box is along y-z
m_readoutName == "VTXOBCollection" ||
m_readoutName == "VertexBarrelCollection") { // In barrel, the sensor box is along y-z
digiHitLocalPosition[0] = simHitLocalPositionVector.x();
digiHitLocalPosition[1] = simHitLocalPositionVector.y() + m_gauss_x.shoot() * dd4hep::mm;
digiHitLocalPosition[2] = simHitLocalPositionVector.z() + m_gauss_y.shoot() * dd4hep::mm;
} else if (m_readoutName == "VTXDCollection") { // In the disks, the sensor box is already in x-y
} else if (m_readoutName == "VTXDCollection" ||
m_readoutName == "VertexEndcapCollection") { // In the disks, the sensor box is already in x-y
digiHitLocalPosition[0] = simHitLocalPositionVector.x() + m_gauss_x.shoot() * dd4hep::mm;
digiHitLocalPosition[1] = simHitLocalPositionVector.y() + m_gauss_y.shoot() * dd4hep::mm;
digiHitLocalPosition[2] = simHitLocalPositionVector.z();
Expand Down
49 changes: 26 additions & 23 deletions VTXdigi/test/runVTXdigitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
# ]
# prefix all xmls with path_to_detector
# geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use]
# geoservice.detectors = ["../lcgeo/FCCee/CLD/compact/CLD_o2_v05/CLD_o2_v05.xml"] # CLD
geoservice.detectors = ["../lcgeo/FCCee/IDEA/compact/IDEA_o1_v01/IDEA_o1_v01.xml"] # IDEA
geoservice.OutputLevel = INFO

Expand Down Expand Up @@ -96,58 +97,59 @@
from Configurables import SimG4SaveTrackerHits

### CLD
# savetrackertool = SimG4SaveTrackerHits("SimG4SaveTrackerHits", readoutName="VertexBarrelCollection")
# savetrackertool.SimTrackHits.Path = "VTXB_simTrackerHits"
# SimG4SaveTrackerHitsB = SimG4SaveTrackerHits("SimG4SaveTrackerHitsB", readoutNames=["VertexBarrelCollection"])
# SimG4SaveTrackerHitsB.SimTrackHits.Path = "VTXB_simTrackerHits"

# savetrackertool = SimG4SaveTrackerHits("SimG4SaveTrackerHits", readoutName="VertexEndcapCollection")
# savetrackertool.SimTrackHits.Path = "VTXE_simTrackerHits"
# SimG4SaveTrackerHitsE = SimG4SaveTrackerHits("SimG4SaveTrackerHitsE", readoutNames=["VertexEndcapCollection"])
# SimG4SaveTrackerHitsE.SimTrackHits.Path = "VTXE_simTrackerHits"


### IDEA
SimG4SaveTrackerHitsIB = SimG4SaveTrackerHits("SimG4SaveTrackerHitsIB", readoutName="VTXIBCollection")
SimG4SaveTrackerHitsIB = SimG4SaveTrackerHits("SimG4SaveTrackerHitsIB", readoutNames=["VTXIBCollection"])
SimG4SaveTrackerHitsIB.SimTrackHits.Path = "VTXIB_simTrackerHits"

SimG4SaveTrackerHitsOB = SimG4SaveTrackerHits("SimG4SaveTrackerHitsOB", readoutName="VTXOBCollection")
SimG4SaveTrackerHitsOB = SimG4SaveTrackerHits("SimG4SaveTrackerHitsOB", readoutNames=["VTXOBCollection"])
SimG4SaveTrackerHitsOB.SimTrackHits.Path = "VTXOB_simTrackerHits"

SimG4SaveTrackerHitsD = SimG4SaveTrackerHits("SimG4SaveTrackerHitsD", readoutName="VTXDCollection")
SimG4SaveTrackerHitsD = SimG4SaveTrackerHits("SimG4SaveTrackerHitsD", readoutNames=["VTXDCollection"])
SimG4SaveTrackerHitsD.SimTrackHits.Path = "VTXD_simTrackerHits"


from Configurables import SimG4Alg
geantsim = SimG4Alg("SimG4Alg",
outputs= [SimG4SaveTrackerHitsIB, SimG4SaveTrackerHitsOB, SimG4SaveTrackerHitsD
outputs= [SimG4SaveTrackerHitsIB, SimG4SaveTrackerHitsOB, SimG4SaveTrackerHitsD ## IDEA
#SimG4SaveTrackerHitsB, SimG4SaveTrackerHitsE ## CLD
#saveHistTool
],
eventProvider=particle_converter,
OutputLevel=INFO)
# Digitize tracker hits
from Configurables import VTXdigitizer

### For CLD
# vtx_digitizer = VTXdigitizer("VTXdigitizer",
# inputSimHits = savetrackertool.SimTrackHits.Path,
# outputDigiHits = savetrackertool.SimTrackHits.Path.replace("sim", "digi"),
### For CLD. Not working yet, SimG4 doesn't produce hits in CLD vertex yet
# vtxb_digitizer = VTXdigitizer("VTXBdigitizer",
# inputSimHits = SimG4SaveTrackerHitsB.SimTrackHits.Path,
# outputDigiHits = SimG4SaveTrackerHitsB.SimTrackHits.Path.replace("sim", "digi"),
# readoutName = "VertexBarrelCollection",
# xResolution = 0.005, # mm
# yResolution = 0.005, # mm
# tResolution = 1000, # ns
# OutputLevel = INFO
# OutputLevel = DEBUG
# )

# vtx_digitizer = VTXdigitizer("VTXdigitizer",
# inputSimHits = savetrackertool.SimTrackHits.Path,
# outputDigiHits = savetrackertool.SimTrackHits.Path.replace("sim", "digi"),
# vtxe_digitizer = VTXdigitizer("VTXEdigitizer",
# inputSimHits = SimG4SaveTrackerHitsE.SimTrackHits.Path,
# outputDigiHits = SimG4SaveTrackerHitsE.SimTrackHits.Path.replace("sim", "digi"),
# readoutName = "VertexEndcapCollection",
# xResolution = 0.005, # mm
# yResolution = 0.005, # mm
# tResolution = 1000, # ns
# OutputLevel = INFO
# OutputLevel = DEBUG
# )


### For IDEA
vtxib_digitizer = VTXdigitizer("VTXdigitizer",
vtxib_digitizer = VTXdigitizer("VTXIBdigitizer",
inputSimHits = SimG4SaveTrackerHitsIB.SimTrackHits.Path,
outputDigiHits = SimG4SaveTrackerHitsIB.SimTrackHits.Path.replace("sim", "digi"),
readoutName = "VTXIBCollection",
Expand All @@ -157,7 +159,7 @@
OutputLevel = INFO
)

vtxob_digitizer = VTXdigitizer("VTXdigitizer",
vtxob_digitizer = VTXdigitizer("VTXOBdigitizer",
inputSimHits = SimG4SaveTrackerHitsOB.SimTrackHits.Path,
outputDigiHits = SimG4SaveTrackerHitsOB.SimTrackHits.Path.replace("sim", "digi"),
readoutName = "VTXOBCollection",
Expand All @@ -167,7 +169,7 @@
OutputLevel = INFO
)

vtxd_digitizer = VTXdigitizer("VTXdigitizer",
vtxd_digitizer = VTXdigitizer("VTXDdigitizer",
inputSimHits = SimG4SaveTrackerHitsD.SimTrackHits.Path,
outputDigiHits = SimG4SaveTrackerHitsD.SimTrackHits.Path.replace("sim", "digi"),
readoutName = "VTXDCollection",
Expand Down Expand Up @@ -211,10 +213,11 @@
genAlg,
hepmc_converter,
geantsim,
# vtx_digitizer,
# vtxb_digitizer,
# vtxe_digitizer,
vtxib_digitizer,
# vtxob_digitizer,
# vtxd_digitizer,
vtxob_digitizer,
vtxd_digitizer,
out
],
EvtSel = 'NONE',
Expand Down

0 comments on commit a406bb2

Please sign in to comment.