38 declareInterface<MuonEDMPrinterTool>(
this);
42 if (
parent() != toolSvc()) {
44 return StatusCode::FAILURE;
56 return StatusCode::SUCCESS;
63 std::ostringstream sout;
67 sout <<
"Hits: eta " <<
summary.netaHits() <<
" phi " <<
summary.nphiHits() <<
" holes " <<
summary.nholes()
68 <<
" outliers " <<
summary.noutliers() <<
" pseudo " <<
summary.npseudoMeasurements() <<
" scatterers "
69 <<
summary.nscatterers() <<
" close Hits " <<
summary.ncloseHits() << std::endl;
72 const std::vector<ChamberHitSummary>& chamberHitSummary =
summary.chamberHitSummary();
73 sout.setf(std::ios::left);
74 std::vector<ChamberHitSummary>::const_iterator chit = chamberHitSummary.begin();
75 std::vector<ChamberHitSummary>::const_iterator chit_end = chamberHitSummary.end();
76 std::vector<ChamberHitSummary>::const_iterator chit_last = chit_end - 1;
77 for (; chit != chit_end; ++chit) {
81 sout <<
" " << std::setw(35) <<
m_idHelperSvc->toStringChamber(chId);
83 const ChamberHitSummary::Projection&
first = isMdt ? chit->mdtMl1() : chit->etaProjection();
84 const ChamberHitSummary::Projection&
second = isMdt ? chit->mdtMl2() : chit->phiProjection();
87 std::string firstString = isMdt ?
"ml1 " :
"eta ";
88 std::string secondString = isMdt ?
"ml2 " :
"phi ";
90 sout <<
" Hits: " << firstString << std::setw(3) <<
first.nhits <<
" " << secondString << std::setw(3)
95 if (
first.nholes != 0) sout << firstString << std::setw(3) <<
first.nholes;
97 if (
first.nholes != 0) sout <<
" ";
98 sout << secondString << std::setw(3) <<
second.nholes;
102 sout <<
" Outliers: ";
103 if (
first.noutliers != 0) sout << firstString << std::setw(3) <<
first.noutliers <<
" ";
104 if (
second.noutliers != 0) {
105 if (
first.noutliers != 0) sout <<
" ";
106 sout << secondString << std::setw(3) <<
second.noutliers;
112 if (
first.ndeltas != 0) sout << firstString << std::setw(3) <<
first.ndeltas <<
" ";
113 if (
second.ndeltas != 0) {
114 if (
first.ndeltas != 0) sout <<
" ";
115 sout << secondString << std::setw(3) <<
second.ndeltas;
120 sout <<
" Close Hits: ";
121 if (
first.ncloseHits != 0) sout << firstString << std::setw(3) <<
first.ncloseHits <<
" ";
122 if (
second.ncloseHits != 0) {
123 if (
first.ncloseHits != 0) sout <<
" ";
124 sout << secondString << std::setw(3) <<
second.ncloseHits;
128 if (chit != chit_last) sout << std::endl;
149 return print(*muonSummary);
156 std::ostringstream sout;
164 std::multimap<const Trk::MeasurementBase*, const Trk::AlignmentEffectsOnTrack*> measAndTheirAlignmentEffects;
167 for (;
it != it_end; ++
it) {
168 aeot = (*it)->alignmentEffectsOnTrack();
174 for (; it2 != it2_end; ++it2) {
175 m = (*it2)->measurementOnTrack();
183 measAndTheirAlignmentEffects.insert(
184 std::pair<const Trk::MeasurementBase*, const Trk::AlignmentEffectsOnTrack*>(
m, aeot));
196 std::vector<std::string> idStrings;
197 std::vector<std::string> dataStrings;
198 unsigned int idWidth = 0;
199 for (;
it != it_end; ++
it) {
200 m = (*it)->measurementOnTrack();
204 idStrings.push_back(idStr);
205 if (idStr.length() > idWidth) idWidth = idStr.length();
209 if (trackParameters) {
211 measAndTheirAlignmentEffects.begin();
212 itMap = measAndTheirAlignmentEffects.find(
m);
213 if (itMap != measAndTheirAlignmentEffects.end()) {
214 std::vector<const Trk::AlignmentEffectsOnTrack*> aeotos;
215 aeotos.push_back(itMap->second);
217 if (itMap != measAndTheirAlignmentEffects.end() && itMap->first ==
m)
218 aeotos.push_back(itMap->second);
221 if (resPull) dataStr +=
print(*resPull);
222 if (resPull) dataStr +=
" (AEOT)";
224 std::optional<Trk::ResidualPull> resPull{
226 if (resPull) dataStr +=
print(*resPull);
230 dataStr +=
" (Outlier)";
232 dataStr +=
" (Hole)";
234 dataStrings.push_back(dataStr);
236 aeot = (*it)->alignmentEffectsOnTrack();
238 std::string idStr =
" AEOT ";
239 idStrings.push_back(idStr);
240 std::ostringstream souta;
241 souta << std::setprecision(3) <<
" deltaTranslation (mm) " << aeot->
deltaTranslation() <<
" error "
244 dataStrings.push_back(souta.str());
249 unsigned int n = idStrings.size();
250 for (
unsigned int i = 0;
i <
n; ++
i) {
251 sout << std::left << std::setw(idWidth) << idStrings[
i] << std::right <<
" " << dataStrings[
i];
252 if (
i !=
n - 1) sout << std::endl;
268 return "MuidCombined";
282 std::ostringstream sout;
288 sout << std::setprecision(4) <<
" : chi2 " << fq->
chiSquared() <<
" ndof " << fq->
numberDoF();
290 sout <<
" no fit Quality ";
294 sout <<
" " <<
print(*pp);
296 sout <<
" no perigee ";
299 sout<<
"----- Track states -------"<<std::endl;
302 if (tsos->measurementOnTrack()) sout<<
" **** "<<std::setw(3)<<
n<<
" Measurement: "<<
print(*tsos->measurementOnTrack())<<std::endl;
303 if (tsos->materialEffectsOnTrack()) sout<<
" **** "<<std::setw(3)<<
n<<
" Material: "<<
print(*tsos->materialEffectsOnTrack())<<std::endl;
304 if (tsos->alignmentEffectsOnTrack()) sout<<
" **** "<<std::setw(3)<<
n<<
" AEOT: "<<
print(*tsos->alignmentEffectsOnTrack())<<std::endl;
305 if (tsos->trackParameters()) sout<<
" **** "<<std::setw(3)<<
n<<
" Parameters: "<<
print(*tsos->trackParameters())<<std::endl;
308 sout<<
"-----------------------------"<<std::endl;
318 std::ostringstream sout;
328 double shortestTubeLen = 1e9;
330 std::vector<const Trk::MeasurementBase*>::const_iterator hit =
segment.containedMeasurements().begin();
331 std::vector<const Trk::MeasurementBase*>::const_iterator hit_end =
segment.containedMeasurements().end();
332 for (; hit != hit_end; ++hit) {
341 if (!
id.is_valid())
continue;
353 if (tubelen < shortestTubeLen) {
355 shortestTubeLen = tubelen;
360 if (!measuresPhi) ++ntrigEta;
368 sout << std::setprecision(2) <<
" chi2 " << std::setw(7) << fq->
chiSquared();
370 sout <<
" no fit Quality ";
373 sout <<
" neta " << std::setw(2) << neta <<
" nphi " << std::setw(2) << nphi <<
" nTrigEta " << std::setw(2)
377 if (
q) sout << std::setw(2) <<
" nholes " <<
q->numberOfHoles();
380 sout <<
" theta " << std::fixed << std::setprecision(5) << std::setw(7) <<
segment.globalDirection().theta()
381 <<
" phi " << std::fixed << std::setprecision(3) << std::setw(6) <<
segment.globalDirection().phi();
384 sout <<
" T0 " << std::fixed << std::setprecision(2) << std::setw(5) <<
segment.time() <<
" err "
385 << std::setw(5) <<
segment.errorTime();
389 double distFromEdge = posAlongTube - shortestTubeLen;
390 if (distFromEdge < -100.)
391 sout <<
" inside chamber";
392 else if (distFromEdge < -1.)
393 sout <<
" close to edge";
394 else if (distFromEdge < 0.0001)
397 sout <<
" outside chamber";
406 std::ostringstream sout;
414 pos = &
cl->globalPosition();
421 if (strip)
pos = &strip->globalPosition();
425 sout <<
" unknown type of muon prepdata " << std::endl;
427 double h_r =
pos->perp();
428 double h_z =
pos->z();
429 double h_phi =
pos->phi();
430 double h_theta =
pos->theta();
438 sout <<
"r " << std::fixed << std::setprecision(0) << std::setw(5) << h_r <<
" z " << std::fixed
439 << std::setprecision(0) << std::setw(5) << h_z <<
" theta " << std::fixed << std::setprecision(3)
440 << std::setw(4) << h_theta <<
" phi " << std::fixed << std::setprecision(3) << std::setw(4) << h_phi
441 <<
" error " << std::fixed << std::setprecision(2) << std::setw(5) <<
error;
442 if (rpc) sout <<
" time " << std::fixed << std::setprecision(2) << std::setw(5) <<
rpcTime;
458 std::ostringstream sout;
461 std::vector<std::string> idStrings;
462 std::vector<std::string> dataStrings;
463 unsigned int idWidth = 0;
465 std::vector<const Trk::MeasurementBase*>::const_iterator hit = measurements.begin();
466 std::vector<const Trk::MeasurementBase*>::const_iterator hit_end = measurements.end();
468 for (; hit != hit_end; ++hit) {
470 sout <<
" WARNING, zero pointer detected in MeasurementBase vector!!! " << std::endl;
474 std::string idStr =
printId(**hit);
475 idStrings.push_back(idStr);
476 if (idStr.length() > idWidth) idWidth = idStr.length();
479 dataStrings.push_back(dataStr);
484 unsigned int n = idStrings.size();
485 for (
unsigned int i = 0;
i <
n; ++
i) {
486 sout << std::left << std::setw(idWidth) << idStrings[
i] << std::right <<
" " << dataStrings[
i];
487 if (
i !=
n - 1) sout << std::endl;
497 std::ostringstream sout;
499 std::vector<const MuonSegment*>::const_iterator
it = segs.begin();
500 std::vector<const MuonSegment*>::const_iterator it_end = segs.end();
501 std::vector<const MuonSegment*>::const_iterator it_last = it_end;
503 for (;
it != it_end; ++
it) {
505 sout <<
" WARNING, zero pointer detected in MuonSegment vector!!! " << std::endl;
509 if (
it != it_last) sout << std::endl;
519 std::ostringstream sout;
521 std::vector<std::unique_ptr<MuonSegment> >
::iterator it = segs.begin();
522 std::vector<std::unique_ptr<MuonSegment> >
::iterator it_end = segs.end();
523 std::vector<std::unique_ptr<MuonSegment> >
::iterator it_last = it_end;
525 for (;
it != it_end; ++
it) {
527 sout <<
" WARNING, zero pointer detected in MuonSegment vector!!! " << std::endl;
531 if (
it != it_last) sout << std::endl;
540 std::ostringstream sout;
542 sout <<
"MuonSegmentCombinationCollection with combis " << combiCol.
size() << std::endl;
547 for (;
it != it_end; ++
it) {
549 sout <<
" WARNING, zero pointer detected in MuonSegmentCombinationCollection!!! " << std::endl;
553 if (
it != it_last) sout << std::endl;
561 std::ostringstream sout;
564 sout <<
"SegmentCombination with stations " << nstations << std::endl;
567 for (
unsigned int i = 0;
i < nstations; ++
i) {
573 if (!stationSegs || stationSegs->empty())
continue;
577 sout <<
print(*stationSegs);
578 if (
i != nstations - 1) sout << std::endl;
587 std::ostringstream sout;
589 unsigned int nhits =
pattern.numberOfContainedPrds();
590 sout <<
"MuonPattern with " << nhits <<
" hits" << std::setprecision(5) <<
" theta "
591 <<
pattern.globalDirection().theta() <<
" phi " <<
pattern.globalDirection().phi() << std::setprecision(1)
592 <<
" r " << std::setw(5) << (
int)
pattern.globalPosition().perp() <<
" z " << std::setw(5)
593 << (
int)
pattern.globalPosition().z() << std::endl;
594 for (
unsigned int i = 0;
i < nhits; ++
i) {
597 sout <<
" ERROR found zero pointer on MuonPattern " << std::endl;
600 sout <<
" " <<
print(*prd);
601 if (
i < nhits - 1) sout << std::endl;
609 std::ostringstream sout;
611 sout <<
"MuonPatternCollection with " << patCol.
size() <<
" patterns " << std::endl;
616 for (;
it != it_end; ++
it) {
618 sout <<
" WARNING, zero pointer detected in MuonPatternCollection!!! " << std::endl;
622 if (
it != it_last) sout << std::endl;
630 std::ostringstream sout;
632 sout <<
"MuonPrdPatternCollection with " << patCol.
size() <<
" patterns " << std::endl;
637 for (;
it != it_end; ++
it) {
639 sout <<
" WARNING, zero pointer detected in MuonPatternCollection!!! " << std::endl;
643 if (
it != it_last) sout << std::endl;
651 std::ostringstream sout;
653 sout <<
"MuonPatternCombinationCollection with combis " << combiCol.
size() << std::endl;
658 for (;
it != it_end; ++
it) {
660 sout <<
" WARNING, zero pointer detected in MuonPatternCombinationCollection!!! " << std::endl;
664 if (
it != it_last) sout << std::endl;
672 std::ostringstream sout;
674 unsigned int nchambers = combi.
chamberData().size();
675 sout <<
"MuonPatternCombination with " << nchambers <<
" chambers ";
680 sout <<
" -> combi has no parameters ";
682 if (!combi.
chamberData().empty()) sout << std::endl;
683 std::vector<MuonPatternChamberIntersect>::const_iterator chit = combi.
chamberData().begin();
684 std::vector<MuonPatternChamberIntersect>::const_iterator chit_end = combi.
chamberData().end();
685 std::vector<MuonPatternChamberIntersect>::const_iterator chit_last = chit_end;
687 for (; chit != chit_end; ++chit) {
689 sout <<
print(chamberIntersect);
690 if (chit != chit_last) sout << std::endl;
698 std::ostringstream sout;
700 std::string chIdString(
"Unknown id");
701 double chTheta(-99.);
706 firstPrd =
intersect.prepRawDataVec().front();
718 unsigned int nchannelsEta = 0;
719 unsigned int nchannelsPhi = 0;
720 std::set<const Trk::TrkDetElementBase*> detEls;
721 std::vector<const Trk::PrepRawData*>::const_iterator hit =
intersect.prepRawDataVec().begin();
722 std::vector<const Trk::PrepRawData*>::const_iterator hit_end =
intersect.prepRawDataVec().end();
723 for (; hit != hit_end; ++hit) {
726 sout <<
" ERROR found zero pointer on MuonPatternChamberIntersect " << std::endl;
739 if (isMdt && detEls.empty()) {
743 if (MuonDetMgr ==
nullptr) {
751 if (
m_idHelperSvc->mdtIdHelper().numberOfMultilayers(
id) == 2) {
752 detEl2 = MuonDetMgr->getMdtReadoutElement(idml2);
757 detEls.insert(detEl1);
763 detEls.insert(detEl2);
787 unsigned int nchHitsEta = 0;
788 unsigned int nchHitsPhi = 0;
794 if (coll !=
nullptr) {
795 nchHitsEta = coll->
size();
800 if (coll !=
nullptr) {
811 if (coll !=
nullptr) {
821 sout.setf(std::ios::left);
822 sout << std::setw(33) << chIdString <<
" neta " << std::setw(3) << neta;
824 sout <<
" nphi " << std::setw(3) << nphi;
828 double scaleEta = nchannelsEta != 0 ? 1. / nchannelsEta : 0.;
829 double scalePhi = nchannelsPhi != 0 ? 1. / nchannelsPhi : 0.;
830 sout <<
" occupancy eta " << std::fixed << std::setprecision(2) << std::setw(5) << scaleEta * nchHitsEta;
832 sout <<
" phi " << std::fixed << std::setw(5) << scalePhi * nchHitsPhi;
836 sout << std::setprecision(2) <<
" pat theta " << std::setw(5) <<
intersect.intersectDirection().theta()
837 <<
" ch theta " << std::setw(5) << chTheta <<
" ch phi " << std::setw(6) << chPhi << std::setprecision(1)
838 <<
" r " << std::setw(5) << (
int)
intersect.intersectPosition().perp() <<
" z " << std::setw(5)
847 std::ostringstream sout;
848 sout <<
"r " << std::fixed << std::setprecision(0) << std::setw(5)
849 <<
pars.position().perp()
850 <<
" z " << std::fixed << std::setprecision(0) << std::setw(6) <<
pars.position().z() <<
" theta "
851 << std::fixed << std::setprecision(5) << std::setw(7) <<
pars.momentum().theta()<<
" eta "
852 << std::fixed << std::setprecision(5) << std::setw(7) <<
pars.momentum().eta() <<
" phi " << std::fixed
853 << std::setprecision(3) << std::setw(6) <<
pars.momentum().phi() <<
" q*p(GeV) " << std::scientific
854 << std::setprecision(3) << std::setw(10) <<
pars.momentum().mag() *
pars.charge() * 1
e-3 <<
" pT(GeV) "
855 << std::scientific << std::setprecision(3) << std::setw(9) <<
pars.momentum().perp() * 1
e-3;
863 std::ostringstream sout;
866 const std::vector<double>&
pull = resPull.
pull();
867 for (
unsigned int i = 0;
i <
residual.size(); ++
i) {
869 sout <<
" residual " << std::setprecision(3) << std::setw(8) <<
residual[
i] <<
" ";
872 for (
unsigned int i = 0;
i <
pull.size(); ++
i) sout << std::setprecision(3) << std::setw(8) <<
pull[
i] <<
" ";
880 std::ostringstream sout;
890 sout <<
"r " << std::fixed << std::setprecision(0) << std::setw(5) << h_r <<
" z " << std::fixed
891 << std::setprecision(0) << std::setw(5) << h_z <<
" phi " << std::fixed << std::setprecision(3) << std::setw(4)
892 << h_phi <<
" theta " << std::fixed << std::setprecision(3) << std::setw(4) << h_theta
893 <<
" lPos " << std::fixed << std::setprecision(2) << std::setw(5) << local_pos
894 <<
" error " << std::fixed << std::setprecision(2) << std::setw(5) <<
error;
903 sout <<
" r_drift " << std::fixed << std::setprecision(2) << std::setw(5) << mdt->
driftRadius();
911 sout <<
" time " << std::fixed << std::setprecision(2) << std::setw(5) << rpcPRD->
time();
919 unsigned int nlayers = 0;
920 unsigned int nhits = 0;
921 std::set<Identifier>
layers;
922 std::vector<double> rpcTimes;
923 const std::vector<const MuonClusterOnTrack*>& rots = crot->
containedROTs();
925 rpcTimes.reserve(nhits);
926 std::vector<const MuonClusterOnTrack*>::const_iterator itR = rots.begin(), itR_end = rots.end();
927 for (; itR != itR_end; ++itR) {
932 if (rpcPRD) rpcTimes.push_back(rpcPRD->
time());
935 sout <<
" CompRot: hits " << nhits <<
" layers " << nlayers;
937 if (!rpcTimes.empty()) {
938 sout << (rpcTimes.size() == 1 ?
" time" :
" times") << std::fixed << std::setprecision(2);
940 for (; itD != itD_end; ++itD) sout <<
" " << std::setw(5) << *itD;
954 if (!
id.is_valid()) {
957 idStr =
"pseudo measurement";
959 idStr =
"no Identifier";
970 std::stringstream mat_string{};
980 mat_string<<
" deltaE: "<<eloss->
deltaE();
988 mat_string<<
" Length "<<eloss->
length();
993 return mat_string.str();
996 std::stringstream aeot_string;
999 return aeot_string.str();
1003 std::stringstream tsos_str{};
1008 return tsos_str.str();