24 using std::stringstream;
25 using namespace DD4hep;
26 using namespace DD4hep::Alignments;
60 string new_prefix = prefix;
61 new_prefix.assign(prefix.length(),
' ');
63 new_prefix.c_str(), cond.
name(), a.
ptr(),
70 printf(
"WorldTrafo: "); data.
worldTrafo.Print();
77 string tag = prefix+
"Cont";
79 for(
const auto& k : container.
keys() ) {
83 prefix.c_str(), k.first, k.second.first, k.second.second.c_str());
88 prefix.c_str(),
"FAILED Alignment:", k.first, k.second.first);
93 except(tag,
"Cannot dump alignments container without valid user-pool.");
98 string tag = prefix+
"Element";
103 printout(
INFO,tag,
"++ Alignments of DE %s [%d entries]",
104 de.path().c_str(), int(c.
keys().size()));
108 except(tag,
"Cannot process DetElement alignments from '%s' without valid user-pool",de.name());
110 except(tag,
"Cannot process alignments of an invalid detector element");
116 static string replace_all(
const string& in,
const string& from,
const string& to) {
119 while( string::npos != (idx=res.find(from)) )
120 res.replace(idx,from.length(),to);
126 ::snprintf(text,
sizeof(text),
"Local: (%7.3f , %7.3f , %7.3f ) -- > World: (%7.3f , %7.3f , %7.3f )",
127 local.x(), local.y(), local.z(), world.x(), world.y(), world.z());
134 ::snprintf(text,
sizeof(text),
"Local: (%7.3f , %7.3f , %7.3f ) -- > Parent: (%7.3f , %7.3f , %7.3f )",
135 local.x(), local.y(), local.z(), world.x(), world.y(), world.z());
142 const string& tag = prefix;
159 printout(
INFO,tag,
"++ %s DATA: (%11s-%8s-%5s) %p IOV:%s", opt.c_str(),
162 align_delta.
hasPivot() ?
"Pivot" :
"",
164 align_cond.
iov().
str().c_str());
167 printout(
INFO,tag,
"++ %s DATA: (%11s-%8s-%5s) %p", opt.c_str(),
170 align_delta.
hasPivot() ?
"Pivot" :
"",
183 printout(
INFO,tag,
"++ %s DELTA Pivot: %s", opt.c_str(), res.c_str());
190 printf(
"%s %s WorldTrafo (to %s): ",opt.c_str(), tag.c_str(), de.
world().
path().c_str());
192 printf(
"%s %s DetTrafo (to %s): ",opt.c_str(), tag.c_str(), par.c_str());
220 string tag = prefix+
"Element";
221 if ( de.isValid() ) {
227 Box bbox = de.placement().volume().solid();
228 ::memset(text,
'=',
sizeof(text));
229 text[
sizeof(text)-1] = 0;
231 printout(
INFO,tag,
"++ Alignments of DE %s [%d entries]",
232 de.path().c_str(), int(container.
keys().size()));
233 printout(
INFO,tag,
"++ Volume: %s BBox: x=%7.3f y=%7.3f z=%7.3f",bbox.
type(),bbox.
x(),bbox.
y(),bbox.
z());
236 for(
const auto& k : container.
keys() ) {
241 if ( k.first != k.second.first ) {
242 printout(
INFO,tag,
"++ Alignment %p [%08X] -> [%08X] %s (SYNONYM) ignored.",
243 a.
ptr(), k.first, k.second.first, k.second.second.c_str());
246 printout(
INFO,tag,
"++ Alignment %p [%08X] -> [%08X] %s",
247 a.
ptr(), k.first, k.second.first, k.second.second.c_str());
248 if ( k.second.second != align_cond.
name() ) {
255 prefix.c_str(),
"FAILED Alignment:", k.first, k.second.first);
260 except(tag,
"Cannot process DetElement alignments from '%s' without valid user-pool",de.name());
262 except(tag,
"Cannot process alignments of an invalid detector element");
bool hasRotation() const
Access flags: Check if the delta operation contains a rotation.
static string _transformPoint2World(const Alignment::Data &data, const Position &local)
void printContainer(const std::string &prefix, Container container, UserPool *pool)
Default printout of a container entry.
AlignmentsPrinter(const std::string &prefix="", int flags=0)
Initializing constructor.
Handle class holding a placed volume (also called physical volume)
Solid solid() const
Access to Solid (Shape)
Volume volume() const
Logical volume of this placement.
TGeoHMatrix detectorTrafo
Intermediate buffer to store the transformation to the parent detector element.
DetElement world() const
Access to the world object. Only possible once the geometry is closed.
double z() const
Access half "depth" of the box.
Ref_t condition
Reference to the original condition object (May not be present!)
const char * name() const
Access the object name (or "" if not supported by the object)
bool isValid() const
Check the validity of the object held by the handle.
pool_type * m_pool
Reference to the user pool.
bool hasPivot() const
Access flags: Check if the delta operation contains a pivot.
static string _transformPoint2Detector(const Alignment::Data &data, const Position &local)
std::string typeName(const std::type_info &type)
ABI information about type names.
Main handle class to hold an alignment object.
Main condition object handle.
std::string name
Printer name. Want to know who is printing what.
Class describing a box shape.
Generic Alignments processor.
int except(const std::string &src, const std::string &fmt,...)
Calls the display action with ERROR and throws an std::runtime_error exception.
T * ptr() const
Access to the held object.
DD4hep::Geometry::DetElement DetElement
Handle class holding a placed volume (also called physical volume)
static string replace_all(const string &in, const string &from, const string &to)
const Keys & keys() const
Known keys of conditions in this container.
Delta delta
Alignment changes.
virtual int operator()(Alignment cond)
Callback to output alignments information.
const Transform3D & localToWorld() const
Access the currently applied alignment/placement matrix.
void printElement(const std::string &prefix, DetElement element, UserPool *pool)
Default printout of a detector element entry.
void printAlignment(const std::string &prefix, Alignment alignment)
Default printout of an alignment entry.
Class describing an condition to re-adjust an alignment.
ROOT::Math::XYZVector Position
Data & data()
Data accessor for the use of decorators.
const std::string & path() const
Path of the detector element (not necessarily identical to placement path!)
PlacedVolume placement() const
Access to the physical volume of this detector element.
Solid_type< TGeoShape > Solid
static void printAlignmentEx(const string &prefix, const string &opt, DetElement de, Alignment alignment)
const iov_type & iov() const
Access the IOV block.
Container alignments() const
Access to the alignments information.
DetElement parent() const
Access to the detector elements's parent.
double x() const
Access half "length" of the box.
std::ostream & toStream(const Property &result, std::ostream &os)
Handle class describing a detector element.
Handle class describing the access to DetElement dependent alignments.
Container class for alignment handles aggregated by a detector element.
void printElementPlacement(const std::string &prefix, DetElement detector, UserPool *pool)
PrintElement placement with/without alignment applied.
virtual int processElement(DetElement de)
Callback to output alignments information of an entire DetElement.
double y() const
Access half "width" of the box.
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
bool hasTranslation() const
Access flags: Check if the delta operation contains a translation.
Derived condition data-object definition.
void localToDetector(const Position &local, Position &detector) const
Transformation from local coordinates of the placed volume to the detector system.
Alignment get(const std::string &alignment_key, const iov_type &iov)
Access to alignment objects by key and IOV.
const char * type() const
Access to shape type (The TClass name of the ROOT implementation)
TGeoHMatrix worldTrafo
Intermediate buffer to store the transformation to the world coordination system. ...
std::string str() const
Create string representation of the IOV.