-
Notifications
You must be signed in to change notification settings - Fork 61
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
HCal readout segmentation update #409
Conversation
FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v03.xml
Outdated
Show resolved
Hide resolved
FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal_v03.xml
Outdated
Show resolved
Hide resolved
fixing typo Co-authored-by: Andre Sailer <andre.philippe.sailer@cern.ch>
Hi @Archil-AD Thank you for this PR! I check that it runs in version 3 and 4 of ALLEGRO. Also I noticed that the corresponding test for ALLEGRO version 04 is missing, could you add these lines in the file
I have specified a random direction Thank you for your time. Best, |
Hi @atolosadelgado , |
Hi Archil, the test crash because there is a check that two files with the same name can not have different content. In this particular case, I actually don't see why they should have different contents ( |
Hi Brieuc, I found that the difference between ALLEGRO v03 vs ALLEGRO v04 was "PhiRow" vs "RowPhi" in the readout name. Now I have created the symlinks of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Archil-AD
thanks a lot for this extremely useful contribution!
I added some suggestions to the phi-row segmentation but similar ones apply to the phi-theta class.
I would suggest:
- in the top of the .h files to add a bit more of general documentation on the segmentation (maybe pointing also to your presentation on that, but as much as possible self-contained)
- in the .h files, expand a bit the comments
- replace hardcoded "row" or "layer" with m_rowID, m_layerID
- to make the code a bit more generic so that it could work also with a 2-part endcap for instance, or even a 1-part endcap, introducing one more parameter that acts as a switch between barrel and endcap, rather than relying on the number of parts to decide if a system is barrel or endcap
Thanks again, cheers,
Giovanni
*/ | ||
inline double offsetPhi() const { return m_offsetPhi; } | ||
|
||
/** Get the vector of theta bins (cells) in a give layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
give -> given
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
std::vector<uint64_t> neighbours(const CellID& cID, bool aDiagonal) const; | ||
|
||
/** Calculate layer radii and edges in z-axis, then define cell edges in each layer using defineCellEdges(). | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might help to state which member variables are calculated/updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
* Logic: | ||
* 1) Find theta bin centers that fit within the given layer; | ||
* 2) Define a cell edge in z-axis as the middle of each pair of theta bin centers | ||
* @param[in] layer index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might help to state which member variables are calculated/updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
inline int phiBins() const { return m_phiBins; } | ||
|
||
/** Get the coordinate offset in azimuthal angle. | ||
* return The offset in phi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that the phi coordinate of the center or edge of the cell with phiID = 0? might help to clarify here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a center. Now this is mentioned.
} | ||
|
||
/** Get the coordinate offset in z-axis. | ||
* return The offset in z. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please write why this is a vector (what is being indexed? layer?) and how is the offset defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the following:
* Offset is the middle position of the Barrel or each section of the Endcap.
* For the Barrel, the vector size is 1, while for the Endcap - number of section.
// get the row number from volumeID (starts from 0!) | ||
int nrow = _decoder->get(vID, "row"); | ||
// get the layer number from volumeID | ||
uint layer = _decoder->get(vID,"layer"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"layer"->m_layerID (if you add it)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
_decoder->set(cID, m_rowID, idx); | ||
_decoder->set(cID, m_phiID, positionToBin(dd4hep::DDSegmentation::Util::phiFromXYZ(globalPosition), 2 * M_PI / (double)m_phiBins, m_offsetPhi)); | ||
|
||
// For endcap, the volume ID comes with "type" field information which would screw up the topo-clustering, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't HCAL barrel and endcap already differentiated by system ID? Is type set to something different from 0 elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, they are already differentiated by systemID.
The "type" is set different from zero in the geo builder:
https://github.com/key4hep/k4geo/blob/main/detector/calorimeter/HCalThreePartsEndcap_o1_v02_geo.cpp#L242
I am not sure if it is used elsewhere, it was already like that and I did not touched it.
I guess this field is set to differentiate different parts of the endcap.
std::vector<int> maxLayerIdEndcap = {-1, 0, 0}; | ||
if(m_offsetZ.size() > 1) | ||
{ | ||
uint Nl = m_numLayers.size()/3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, hardcoded 3 ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed. the code is generalized for N-parts endcap
if(m_radii.empty()) return minMaxLayerId; | ||
|
||
|
||
std::vector<int> minLayerIdEndcap = {0, 0, 0}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the vectors have size=3 because you assume at most 3 parts, right? this could be generalised
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed. the code is generalized for N-parts endcap
int minLayerId = -1; | ||
int maxLayerId = -1; | ||
|
||
int currentLayerId = _decoder->get(cID,"layer"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_layerID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Hello @giovannimarchiori , many thanks for your comments. I have tried to implement them in the last commit. Best regards, |
|
||
auto pos = positionFromRThetaPhi(radius, theta(cID), phi(cID)); | ||
|
||
// retrun the position with corrected z corrdinate to match to the geometric center |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coordinate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Hello @Archil-AD |
Hi @giovannimarchiori , |
|
||
if(m_detLayout==0) dd4hep::printout(dd4hep::INFO, "FCCSWHCalPhiRow_k4geo","Barrel configuration found!"); | ||
else dd4hep::printout(dd4hep::INFO, "FCCSWHCalPhiRow_k4geo","EndCap configuration found!"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense here to add some sanity checks of the xml:
- m_offsetZ.size()==m_offsetR.size()
- m_dRlayer.size()==m_offsetR.size()
- m_widthZ.size()==m_offsetR.size()
- m_offsetZ.size()==1 if barrel
- m_numLayers.size() % m_offsetZ.size() == 0
- m_gridSizeRow.size() == sum of contents of m_numLayers
?
And similarly for the FCCSWCHCalPhiRow_k4geo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, that would help to debug if someone will try to update the xml files.
I have added it.
Excellent! The description is very useful. |
// check if all necessary variables are available | ||
if(m_detLayout==-1 || m_offsetZ.empty() || m_widthZ.empty() || m_offsetR.empty() || m_numLayers.empty() || m_dRlayer.empty()) | ||
{ | ||
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be PhiTheta... also in following if (..) blocks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for spotting that, I have fixed it
OK for me, thanks again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved from my side
BEGINRELEASENOTES
ENDRELEASENOTES