I had intended that most geometry queries for the ECal would go through this generic interface
detector-model/src/main/java/org/hps/detector/ecal/HPSEcalAPI.java
which you can access like this from the subdetector (sorry it’s a little cryptic to get it)
HPSEcalAPI api = (HPSEcalAPI) subdetector.getDetectorElement();
This interface allows you to get ECal crystals by their index or position e.g.
EcalCrystal getCrystal(int x, int y);
EcalCrystal getCrystal(IIdentifier id);
EcalCrystal getCrystal(Hep3Vector position);
etc.
Once you have the EcalCrystal object, you can then this method to get its global position
Hep3Vector pos = anEcalCrystal.getGeometry().getPosition();
There's also a utility method for getting the position at the middle of the front face
Hep3Vector posFront = anEcalCrystal.getPositionFront();
Let me know if that helps. Any additional utilities we need can be added to HPSEcalAPI (I can add beam gap top and bottom there if needed for instance). Also, double check over the information that is being returned here, as it isn't particularly well tested. Could be some bugs lurking in there.
I'm actually planning to transition some of the utilities on HPSEcal3 to this more generic interface so we don't have references to specific detector model classes in the recon; perhaps it will be done on the new ECal geom dev branch.
-----Original Message-----
From: [log in to unmask] [mailto:[log in to unmask]] On Behalf Of Holly Vance
Sent: Tuesday, December 01, 2015 8:33 AM
To: hps-software
Subject: Another geometry question
Hi,
In addition to my previous e-mail, I would like to access the x,y vales (mm) of certain crystals (I would like to avoid hard-coding coordinates). I 've done this previously in clustering by using a hit (CalorimeterHit) and then getting the geometry:
IGeometryInfo geom = hit.getDetectorElement().getGeometry();
double[] pos = geom.transformLocalToGlobal(VecOp.add(geom.transformGlobalToLocal(geom.getPosition()), (Hep3Vector) new BasicHep3Vector(0, 0, -1 * ((Trd) geom.getLogicalVolume().getSolid()).getZHalfLength()))).v();
Is there a way to do this without using a CalorimeterHit? Perhaps just using a crystal index like ix,iy?
Thanks,
Holly
________________________________
Use REPLY-ALL to reply to list
To unsubscribe from the HPS-SOFTWARE list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=HPS-SOFTWARE&A=1
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the HPS-SOFTWARE list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=HPS-SOFTWARE&A=1
|