15 #include <Parsers/Parsers.h>
30 :
mapping(cond_map), name(
"Alignment"), prefix(pref), printLevel(INFO), m_flag(flg)
43 std::vector<Alignment> alignments;
46 prefix.c_str(), alignments.size(), de.
path().c_str());
47 for(
auto alignment : alignments )
49 return int(alignments.size());
51 except(
name,
"Failed to dump conditions for DetElement:%s [No slice availible]",
75 std::string new_prefix = prefix;
76 new_prefix.assign(prefix.length(),
' ');
77 printout(lvl,prefix,
"++ %s \t [%p] Typ:%s",
78 new_prefix.c_str(), a.
ptr(),
79 typeName(
typeid(*ptr)).c_str());
80 printout(lvl,prefix,
"++ %s \tData:(%11s-%8s-%5s)",
85 if ( isActivePrintLevel(lvl) ) {
86 printf(
"WorldTrafo: "); data.
worldTrafo.Print();
92 static std::string replace_all(
const std::string& in,
const std::string& from,
const std::string& to) {
95 while( std::string::npos != (idx=res.find(from)) )
96 res.replace(idx,from.length(),to);
102 ::snprintf(text,
sizeof(text),
"Local: (%7.3f , %7.3f , %7.3f ) -- > World: (%7.3f , %7.3f , %7.3f )",
103 local.x(), local.y(), local.z(), world.x(), world.y(), world.z());
110 ::snprintf(text,
sizeof(text),
"Local: (%7.3f , %7.3f , %7.3f ) -- > Parent: (%7.3f , %7.3f , %7.3f )",
111 local.x(), local.y(), local.z(), world.x(), world.y(), world.z());
118 const std::string& tag = prefix;
135 printout(lvl,tag,
"++ %s DATA: (%11s-%8s-%5s) %p IOV:%s", opt.c_str(),
138 align_delta.
hasPivot() ?
"Pivot" :
"",
140 align_cond.
iov().
str().c_str());
143 printout(lvl,tag,
"++ %s DATA: (%11s-%8s-%5s) %p", opt.c_str(),
146 align_delta.
hasPivot() ?
"Pivot" :
"",
150 std::stringstream str;
153 printout(lvl,tag,
"++ %s DELTA Translation: %s [cm]",
154 opt.c_str(), replace_all(str.str(),
"\n",
"").c_str());
157 std::stringstream str;
160 std::string res = replace_all(str.str(),
"\n",
"");
161 res =
"( "+replace_all(res,
" ",
" , ")+
" )";
162 printout(lvl,tag,
"++ %s DELTA Pivot: %s [cm]", opt.c_str(), res.c_str());
165 std::stringstream str;
167 printout(lvl,tag,
"++ %s DELTA Rotation: %s [rad]", opt.c_str(), replace_all(str.str(),
"\n",
"").c_str());
169 if ( isActivePrintLevel(lvl) ) {
170 printf(
"%s %s WorldTrafo (to %s): ",opt.c_str(), tag.c_str(), de.
world().
path().c_str());
172 printf(
"%s %s DetTrafo (to %s): ",opt.c_str(), tag.c_str(), par.c_str());
175 printout(PrintLevel(lvl-1),tag,
"++ %s: P1(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p1).c_str());
176 printout(PrintLevel(lvl-1),tag,
"++ %s: P2(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p2).c_str());
177 printout(PrintLevel(lvl-1),tag,
"++ %s: P3(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p3).c_str());
178 printout(PrintLevel(lvl-1),tag,
"++ %s: P4(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p4).c_str());
179 printout(PrintLevel(lvl-1),tag,
"++ %s: P5(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p5).c_str());
180 printout(PrintLevel(lvl-1),tag,
"++ %s: P6(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p6).c_str());
181 printout(PrintLevel(lvl-1),tag,
"++ %s: P7(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p7).c_str());
182 printout(PrintLevel(lvl-1),tag,
"++ %s: P8(x,y,z) %s", opt.c_str(), _transformPoint2World(align_data, p8).c_str());
184 printout(PrintLevel(lvl-1),tag,
"++ %s: P1(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p1).c_str());
185 printout(PrintLevel(lvl-1),tag,
"++ %s: P2(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p2).c_str());
186 printout(PrintLevel(lvl-1),tag,
"++ %s: P3(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p3).c_str());
187 printout(PrintLevel(lvl-1),tag,
"++ %s: P4(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p4).c_str());
188 printout(PrintLevel(lvl-1),tag,
"++ %s: P5(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p5).c_str());
189 printout(PrintLevel(lvl-1),tag,
"++ %s: P6(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p6).c_str());
190 printout(PrintLevel(lvl-1),tag,
"++ %s: P7(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p7).c_str());
191 printout(PrintLevel(lvl-1),tag,
"++ %s: P8(x,y,z) %s", opt.c_str(), _transformPoint2Detector(align_data, p8).c_str());
196 std::string tag = prefix+
"Element";
198 std::vector<Alignment> alignments;
200 printout(prt_level,tag,
"++ Alignments of DE %s [%d entries]",
201 de.
path().c_str(),
int(alignments.size()));
202 for(
const auto& align : alignments )
206 except(tag,
"Cannot process alignments of an invalid detector element");
211 std::string tag = prefix+
"Element";
216 std::vector<Alignment> alignments;
219 ::memset(text,
'=',
sizeof(text));
220 text[
sizeof(text)-1] = 0;
221 printout(lvl, tag, text);
222 printout(lvl, tag,
"++ Alignments of DE %s [%d entries]",
223 de.
path().c_str(),
int(alignments.size()));
224 printout(lvl, tag,
"++ Volume: %s BBox: x=%7.3f y=%7.3f z=%7.3f",
225 bbox.
type(), bbox.
x(), bbox.
y(), bbox.
z());
228 for(
const auto& align : alignments ) {
231 printout(lvl, tag,
"++ Alignment %p [%16llX]", align.ptr(),
cond.key());
232 printout(lvl, prefix,
"++ \tPath:%s [%p]",
cond.name(), align.ptr());
236 printout(ERROR, tag,
"++ %s %s [%16llX]",
237 prefix.c_str(),
"FAILED Alignment:",
cond.key());
242 except(tag,
"Cannot process alignments of an invalid detector element");