Skip to content

Changes for pandora PFA #419

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

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9259e7c
add detector type, calodata, muon tagger with phi-theta segmentation …
giovannimarchiori Jan 15, 2025
a9c89b8
move to phi-theta grid for muon tagger and use volume compatible with…
giovannimarchiori Jan 15, 2025
7a4153d
add extent info to ecal endcap turbine class
giovannimarchiori Jan 20, 2025
60a2e95
fix typo
giovannimarchiori Jan 23, 2025
f7294b1
fix bug with endcap building
giovannimarchiori Jan 27, 2025
bc87e12
Merge branch 'key4hep:main' into gmarchio-main-pandora-20250114
giovannimarchiori Jan 27, 2025
922e4ce
introduce separate readouts for muon barrel and endcap
giovannimarchiori Jan 27, 2025
e8b4d82
remove commented code
giovannimarchiori Jan 27, 2025
1cef8c7
fix xml
giovannimarchiori Jan 27, 2025
a8b9b09
use same muon detector for ALLEGRO v03 and v04
giovannimarchiori Jan 28, 2025
689a685
try to add segmentation to simple cylinder
giovannimarchiori Jan 29, 2025
1b4ef34
Merge branch 'key4hep:main' into gmarchio-main-pandora-20250114
giovannimarchiori Jan 30, 2025
55da3a9
improve simple cylinder code
giovannimarchiori Jan 31, 2025
3aa5b60
add possibility of having layers in simple cylinder volume
giovannimarchiori Jan 31, 2025
2651b42
set inner and outer radiation and interaction lenghts otherwise pando…
giovannimarchiori Feb 3, 2025
8d93453
Merge branch 'key4hep:main' into gmarchio-main-pandora-20250114
giovannimarchiori Feb 5, 2025
0cf332b
indentation and add one comment
giovannimarchiori Feb 10, 2025
2050a2a
modify type of sensitive detector for muon tagger for pandora
giovannimarchiori Feb 10, 2025
8682e71
Merge branch 'key4hep:main' into gmarchio-main-pandora-20250114
giovannimarchiori Feb 10, 2025
f68a0d2
implement comments by Alvaro
giovannimarchiori Feb 11, 2025
6300299
fix calculation of radiation and interaction lenghts (missing scale f…
giovannimarchiori Feb 11, 2025
b56cc5b
comment the code
giovannimarchiori Feb 11, 2025
c6aec39
fix comment
giovannimarchiori Feb 11, 2025
8c5bc80
fix comment
giovannimarchiori Feb 11, 2025
31c0393
merge simple cylinder v02 and v03
giovannimarchiori Feb 11, 2025
58e9f9a
update readme
giovannimarchiori Feb 11, 2025
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
2 changes: 1 addition & 1 deletion FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<include ref="HCalBarrel_TileCal_v03.xml"/>
<include ref="ECalEndcaps_Turbine.xml"/>
<include ref="HCalEndcaps_ThreeParts_TileCal_v03.xml"/>
<include ref="MuonTagger.xml"/>
<include ref="MuonTaggerPhiTheta.xml"/>

<fields>
<!-- FIXME this is a place holder to get a reasonable magnetic field, it should be a real MAP obtained from FEM tools taking into account HCAL return yoke -->
Expand Down
67 changes: 67 additions & 0 deletions FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/MuonTaggerPhiTheta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">

<info name="FCCeeMuonTagger"
title="Muon Tagger for ALLEGRO, with phi-theta segmentation"
author="Created by A. Duglishvili from MuonTagger.xml, moving from eta to theta segmentation"
url="no"
status="development"
version="1.0">
<comment>
Simple muon tagger with phi-theta segmentation - barrel and endcaps
</comment>
</info>

<define>
<constant name="MuonTaggerBarrelLayers" value="2"/>
<constant name="MuonTaggerEndcapLayers" value="2"/>
</define>

<display>
<vis name="muon_vis" r="1.0" g="0.1" b="0.1" showDaughters="true" visible="true" />
</display>

<readouts>
<readout name="MuonTaggerBarrelPhiTheta">
<segmentation type="FCCSWGridPhiTheta_k4geo" phi_bins="704" offset_phi="-pi+(pi/704.)" grid_size_theta="0.010013373" offset_theta="0.10884388"/>
<id>system:4,subsystem:1,layer:5,theta:10,phi:10</id>
</readout>
<readout name="MuonTaggerEndcapPhiTheta">
<segmentation type="FCCSWGridPhiTheta_k4geo" phi_bins="704" offset_phi="-pi+(pi/704.)" grid_size_theta="0.010013373" offset_theta="0.10884388"/>
<id>system:4,subsystem:1,layer:5,theta:10,phi:10</id>
</readout>
</readouts>

<detectors>
<!-- barrel -->
<detector id="DetID_Muon_Barrel" name="MuonTaggerBarrel" type="SimpleCylinder_o1_v03" sensitive="true" vis="muon_vis" readout="MuonTaggerBarrelPhiTheta">
<!-- added for Pandora -->
<type_flags type="DetType_CALORIMETER + DetType_MUON + DetType_BARREL"/>
<!-- end -->
<!-- sensitive type="SimpleTrackerSD"/ -->
<sensitive type="BirksLawCalorimeterSD"/>
<dimensions rmin="MuonTagger_inner_radius" rmax="MuonTagger_outer_radius"
dz="MuonTagger_half_length" z_offset = "0" material="Polystyrene" phi0="0" deltaphi="360*deg" vis="muon_vis"/>
<layers>
<layer thickness="(MuonTagger_outer_radius - MuonTagger_inner_radius)/MuonTaggerBarrelLayers" repeat="MuonTaggerBarrelLayers"/>
</layers>
</detector>

<!-- endcaps -->
<detector id="DetID_Muon_Endcap_1" name="MuonTaggerEndcap" type="SimpleCylinder_o1_v03" sensitive="true" vis="muon_vis" readout="MuonTaggerEndcapPhiTheta">
<!-- added for Pandora -->
<type_flags type="DetType_CALORIMETER + DetType_MUON + DetType_ENDCAP"/>
<!-- end -->
<sensitive type="SimpleTrackerSD"/>
<dimensions rmin="MuonTaggerEndcap_inner_radius" rmax="MuonTaggerEndcap_outer_radius"
dz="(MuonTaggerEndcap_max_z - MuonTaggerEndcap_min_z)*0.5" z_offset = "MuonTaggerEndcap_min_z + (MuonTaggerEndcap_max_z - MuonTaggerEndcap_min_z)*0.5" material="Polystyrene" phi0="0" deltaphi="360*deg" vis="muon_vis"/>
<layers>
<layer thickness="(MuonTaggerEndcap_max_z - MuonTaggerEndcap_min_z)/MuonTaggerEndcapLayers" repeat="MuonTaggerEndcapLayers"/>
</layers>
</detector>

</detectors>

</lccdd>
2 changes: 1 addition & 1 deletion FCCee/ALLEGRO/compact/ALLEGRO_o1_v04/ALLEGRO_o1_v04.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<include ref="HCalBarrel_TileCal_v03.xml"/>
<include ref="ECalEndcaps_Turbine.xml"/>
<include ref="HCalEndcaps_ThreeParts_TileCal_v03.xml"/>
<include ref="MuonTagger.xml"/>
<include ref="MuonTaggerPhiTheta.xml"/>

<fields>
<!-- FIXME this is a place holder to get a reasonable magnetic field, it should be a real MAP obtained from FEM tools taking into account HCAL return yoke -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,15 @@ static dd4hep::detail::Ref_t createECalBarrelInclined(dd4hep::Detector& aLcdd,
envelopePhysVol.addPhysVolID("system", xmlDetElem.id());
caloDetElem.setPlacement(envelopePhysVol);

// Create caloData object
// Create caloData object for the reconstruction
auto caloData = new dd4hep::rec::LayeredCalorimeterData;
caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::BarrelLayout;
caloDetElem.addExtension<dd4hep::rec::LayeredCalorimeterData>(caloData);

// Extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in mm
// (for barrel detectors zmin is 0)
caloData->extent[0] = Rmin;
caloData->extent[1] = Rmax; // or r_max ?
caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
caloData->extent[1] = Rmax;
caloData->extent[2] = 0.;
caloData->extent[3] = caloDim.dz();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,21 +753,36 @@ static dd4hep::detail::Ref_t createECalBarrelInclined(dd4hep::Detector& aLcdd,
envelopePhysVol.addPhysVolID("system", xmlDetElem.id());
caloDetElem.setPlacement(envelopePhysVol);

// Create caloData object
// Create caloData object for the reconstruction
auto caloData = new dd4hep::rec::LayeredCalorimeterData;
caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::BarrelLayout;
caloDetElem.addExtension<dd4hep::rec::LayeredCalorimeterData>(caloData);
dd4hep::xml::setDetectorTypeFlag(xmlDetElem, caloDetElem);

// Fill caloData information

// Extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in mm
// (for barrel detectors zmin is 0)
caloData->extent[0] = Rmin;
caloData->extent[1] = Rmax; // or r_max ?
caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
caloData->extent[1] = Rmax;
caloData->extent[2] = 0.;
caloData->extent[3] = caloDim.dz();

// Set type flags
dd4hep::xml::setDetectorTypeFlag(xmlDetElem, caloDetElem);
// Information about each layer
// double distance : distance from Origin (or the z-axis) to the inner-most face of the layer
// double phi0 : phi0 of layer: potential rotation around normal to absorber plane, e.g. if layers are 'staggered' in phi in fwd. calos
// double absorberThickness : thickness of the absorber part of the layer. Consider using inner/outer_nRadiationLengths and inner/outer_nInteractionLengths
// double inner_nRadiationLengths : Absorber material in front of sensitive element in the layer, units of radiation lengths
// double inner_nInteractionLengths : Absorber material in front of sensitive element in the layer, units of radiation lengths
// double outer_nRadiationLengths : Absorber material in behind of sensitive element in the layer, units of radiation lengths
// double outer_nInteractionLengths : Absorber material in behind of sensitive element in the layer, units of radiation lengths
// double inner_thickness : Distance between the innermost face of the layer (closest to IP) and the center of the sensitive element
// double outer_thickness : Distance between the center of the sensitive element and the outermost face of the layer
// double sensitive_thickness : Thickness of the sensitive element (e.g. scintillator)
// double cellSize0 : cell size along the first axis where first is either along the beam (BarrelLayout) or up (EndcapLayout) or the direction closest to that
// double cellSize1 : second cell size, perpendicular to the first direction cellSize0 and the depth of the layers
dd4hep::rec::MaterialManager matMgr(envelopeVol);
dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;

double rad_first = Rmin;
double rad_last = 0;
double scale_fact = dR / (-Rmin * cos(angle) + sqrt(pow(Rmax, 2) - pow(Rmin * sin(angle), 2)));
Expand All @@ -786,19 +801,19 @@ static dd4hep::detail::Ref_t createECalBarrelInclined(dd4hep::Detector& aLcdd,
auto mat = matMgr.createAveragedMaterial(materials); // creating average of all the material between two points to calculate X0 and lambda of averaged material
const double nRadiationLengths = mat.radiationLength();
const double nInteractionLengths = mat.interactionLength();
const double difference_bet_r1r2 = (ivr1 - ivr2).r();
const double value_of_x0 = layerHeight[il] / nRadiationLengths;
const double value_of_lambda = layerHeight[il] / nInteractionLengths;
const double difference_bet_r1r2 = (ivr1 - ivr2).r(); // should be identical to layerHeight[il] * scale_fact
const double value_of_x0 = layerHeight[il] / nRadiationLengths; // GM : shouldn't this be multiplied by scale_fact?
const double value_of_lambda = layerHeight[il] / nInteractionLengths; // GM : shouldn't this be multiplied by scale_fact?
std::string str1("LAr");

for (size_t imat = 0; imat < materials.size(); imat++) {

std::string str2(materials.at(imat).first.name());
if (str1.compare(str2) == 0){
thickness_sen += materials.at(imat).second;
thickness_sen += materials.at(imat).second;
}
else {
absorberThickness += materials.at(imat).second;
absorberThickness += materials.at(imat).second;
}
}
rad_first = rad_last;
Expand All @@ -807,7 +822,9 @@ static dd4hep::detail::Ref_t createECalBarrelInclined(dd4hep::Detector& aLcdd,
std::cout << "The radiation length is " << value_of_x0 << " and the interaction length is " << value_of_lambda << std::endl;

caloLayer.distance = rad_first;
caloLayer.absorberThickness = absorberThickness;
caloLayer.sensitive_thickness = thickness_sen;

caloLayer.inner_nRadiationLengths = value_of_x0 / 2.0;
caloLayer.inner_nInteractionLengths = value_of_lambda / 2.0;
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
Expand All @@ -816,9 +833,9 @@ static dd4hep::detail::Ref_t createECalBarrelInclined(dd4hep::Detector& aLcdd,
caloLayer.outer_nInteractionLengths = value_of_lambda / 2.0;
caloLayer.outer_thickness = difference_bet_r1r2 / 2;

caloLayer.absorberThickness = absorberThickness;
caloLayer.cellSize0 = 20 * dd4hep::mm;
caloLayer.cellSize1 = 20 * dd4hep::mm;
// GM: rather retrieve cellDimensions vector from segmentation class
caloLayer.cellSize0 = 20 * dd4hep::mm; // GM: rather put delta_eta here and use pandora::POINTING cell type (should actually modify pandora to accept theta grid)
caloLayer.cellSize1 = 20 * dd4hep::mm; // GM: rather delta_phi here + pandora::POINTING cell type

caloData->layers.push_back(caloLayer);
}
Expand Down
Loading