38 declareInterface<MuonEDMPrinterTool>(
this);
53 return StatusCode::SUCCESS;
60 std::ostringstream sout;
64 sout <<
"Hits: eta " <<
summary.netaHits() <<
" phi " <<
summary.nphiHits() <<
" holes " <<
summary.nholes()
65 <<
" outliers " <<
summary.noutliers() <<
" pseudo " <<
summary.npseudoMeasurements() <<
" scatterers "
66 <<
summary.nscatterers() <<
" close Hits " <<
summary.ncloseHits() << std::endl;
69 const std::vector<ChamberHitSummary>& chamberHitSummary =
summary.chamberHitSummary();
70 sout.setf(std::ios::left);
71 std::vector<ChamberHitSummary>::const_iterator chit = chamberHitSummary.begin();
72 std::vector<ChamberHitSummary>::const_iterator chit_end = chamberHitSummary.end();
73 std::vector<ChamberHitSummary>::const_iterator chit_last = chit_end - 1;
74 for (; chit != chit_end; ++chit) {
78 sout <<
" " << std::setw(35) <<
m_idHelperSvc->toStringChamber(chId);
80 const ChamberHitSummary::Projection&
first = isMdt ? chit->mdtMl1() : chit->etaProjection();
81 const ChamberHitSummary::Projection&
second = isMdt ? chit->mdtMl2() : chit->phiProjection();
84 std::string firstString = isMdt ?
"ml1 " :
"eta ";
85 std::string secondString = isMdt ?
"ml2 " :
"phi ";
87 sout <<
" Hits: " << firstString << std::setw(3) <<
first.nhits <<
" " << secondString << std::setw(3)
92 if (
first.nholes != 0) sout << firstString << std::setw(3) <<
first.nholes;
94 if (
first.nholes != 0) sout <<
" ";
95 sout << secondString << std::setw(3) <<
second.nholes;
99 sout <<
" Outliers: ";
100 if (
first.noutliers != 0) sout << firstString << std::setw(3) <<
first.noutliers <<
" ";
101 if (
second.noutliers != 0) {
102 if (
first.noutliers != 0) sout <<
" ";
103 sout << secondString << std::setw(3) <<
second.noutliers;
109 if (
first.ndeltas != 0) sout << firstString << std::setw(3) <<
first.ndeltas <<
" ";
110 if (
second.ndeltas != 0) {
111 if (
first.ndeltas != 0) sout <<
" ";
112 sout << secondString << std::setw(3) <<
second.ndeltas;
117 sout <<
" Close Hits: ";
118 if (
first.ncloseHits != 0) sout << firstString << std::setw(3) <<
first.ncloseHits <<
" ";
119 if (
second.ncloseHits != 0) {
120 if (
first.ncloseHits != 0) sout <<
" ";
121 sout << secondString << std::setw(3) <<
second.ncloseHits;
125 if (chit != chit_last) sout << std::endl;
146 return print(*muonSummary);
153 std::ostringstream sout;
161 std::multimap<const Trk::MeasurementBase*, const Trk::AlignmentEffectsOnTrack*> measAndTheirAlignmentEffects;
164 for (;
it != it_end; ++
it) {
165 aeot = (*it)->alignmentEffectsOnTrack();
171 for (; it2 != it2_end; ++it2) {
172 m = (*it2)->measurementOnTrack();
180 measAndTheirAlignmentEffects.insert(
181 std::pair<const Trk::MeasurementBase*, const Trk::AlignmentEffectsOnTrack*>(
m, aeot));
193 std::vector<std::string> idStrings;
194 std::vector<std::string> dataStrings;
195 unsigned int idWidth = 0;
196 for (;
it != it_end; ++
it) {
197 m = (*it)->measurementOnTrack();
201 idStrings.push_back(idStr);
202 if (idStr.length() > idWidth) idWidth = idStr.length();
206 if (trackParameters) {
208 measAndTheirAlignmentEffects.begin();
209 itMap = measAndTheirAlignmentEffects.find(
m);
210 if (itMap != measAndTheirAlignmentEffects.end()) {
211 std::vector<const Trk::AlignmentEffectsOnTrack*> aeotos;
212 aeotos.push_back(itMap->second);
214 if (itMap != measAndTheirAlignmentEffects.end() && itMap->first ==
m)
215 aeotos.push_back(itMap->second);
218 if (resPull) dataStr +=
print(*resPull);
219 if (resPull) dataStr +=
" (AEOT)";
221 std::optional<Trk::ResidualPull> resPull{
223 if (resPull) dataStr +=
print(*resPull);
227 dataStr +=
" (Outlier)";
229 dataStr +=
" (Hole)";
231 dataStrings.push_back(dataStr);
233 aeot = (*it)->alignmentEffectsOnTrack();
235 std::string idStr =
" AEOT ";
236 idStrings.push_back(idStr);
237 std::ostringstream souta;
238 souta << std::setprecision(3) <<
" deltaTranslation (mm) " << aeot->
deltaTranslation() <<
" error "
241 dataStrings.push_back(souta.str());
246 unsigned int n = idStrings.size();
247 for (
unsigned int i = 0;
i <
n; ++
i) {
248 sout << std::left << std::setw(idWidth) << idStrings[
i] << std::right <<
" " << dataStrings[
i];
249 if (
i !=
n - 1) sout << std::endl;
265 return "MuidCombined";
279 std::ostringstream sout;
285 sout << std::setprecision(4) <<
" : chi2 " << fq->
chiSquared() <<
" ndof " << fq->
numberDoF();
287 sout <<
" no fit Quality ";
291 sout <<
" " <<
print(*pp);
293 sout <<
" no perigee ";
296 sout<<
"----- Track states -------"<<std::endl;
299 if (tsos->measurementOnTrack()) sout<<
" **** "<<std::setw(3)<<
n<<
" Measurement: "<<
print(*tsos->measurementOnTrack())<<std::endl;
300 if (tsos->materialEffectsOnTrack()) sout<<
" **** "<<std::setw(3)<<
n<<
" Material: "<<
print(*tsos->materialEffectsOnTrack())<<std::endl;
301 if (tsos->alignmentEffectsOnTrack()) sout<<
" **** "<<std::setw(3)<<
n<<
" AEOT: "<<
print(*tsos->alignmentEffectsOnTrack())<<std::endl;
302 if (tsos->trackParameters()) sout<<
" **** "<<std::setw(3)<<
n<<
" Parameters: "<<
print(*tsos->trackParameters())<<std::endl;
305 sout<<
"-----------------------------"<<std::endl;
315 std::ostringstream sout;
325 double shortestTubeLen = 1e9;
327 std::vector<const Trk::MeasurementBase*>::const_iterator hit =
segment.containedMeasurements().begin();
328 std::vector<const Trk::MeasurementBase*>::const_iterator hit_end =
segment.containedMeasurements().end();
329 for (; hit != hit_end; ++hit) {
338 if (!
id.is_valid())
continue;
350 if (tubelen < shortestTubeLen) {
352 shortestTubeLen = tubelen;
357 if (!measuresPhi) ++ntrigEta;
365 sout << std::setprecision(2) <<
" chi2 " << std::setw(7) << fq->
chiSquared();
367 sout <<
" no fit Quality ";
370 sout <<
" neta " << std::setw(2) << neta <<
" nphi " << std::setw(2) << nphi <<
" nTrigEta " << std::setw(2)
374 if (
q) sout << std::setw(2) <<
" nholes " <<
q->numberOfHoles();
377 sout <<
" theta " << std::fixed << std::setprecision(5) << std::setw(7) <<
segment.globalDirection().theta()
378 <<
" phi " << std::fixed << std::setprecision(3) << std::setw(6) <<
segment.globalDirection().phi();
381 sout <<
" T0 " << std::fixed << std::setprecision(2) << std::setw(5) <<
segment.time() <<
" err "
382 << std::setw(5) <<
segment.errorTime();
386 double distFromEdge = posAlongTube - shortestTubeLen;
387 if (distFromEdge < -100.)
388 sout <<
" inside chamber";
389 else if (distFromEdge < -1.)
390 sout <<
" close to edge";
391 else if (distFromEdge < 0.0001)
394 sout <<
" outside chamber";
403 std::ostringstream sout;
411 pos = &
cl->globalPosition();
418 if (strip)
pos = &strip->globalPosition();
422 sout <<
" unknown type of muon prepdata " << std::endl;
424 double h_r =
pos->perp();
425 double h_z =
pos->z();
426 double h_phi =
pos->phi();
427 double h_theta =
pos->theta();
435 sout <<
"r " << std::fixed << std::setprecision(0) << std::setw(5) << h_r <<
" z " << std::fixed
436 << std::setprecision(0) << std::setw(5) << h_z <<
" theta " << std::fixed << std::setprecision(3)
437 << std::setw(4) << h_theta <<
" phi " << std::fixed << std::setprecision(3) << std::setw(4) << h_phi
438 <<
" error " << std::fixed << std::setprecision(2) << std::setw(5) <<
error;
439 if (rpc) sout <<
" time " << std::fixed << std::setprecision(2) << std::setw(5) <<
rpcTime;
455 std::ostringstream sout;
458 std::vector<std::string> idStrings;
459 std::vector<std::string> dataStrings;
460 unsigned int idWidth = 0;
462 std::vector<const Trk::MeasurementBase*>::const_iterator hit = measurements.begin();
463 std::vector<const Trk::MeasurementBase*>::const_iterator hit_end = measurements.end();
465 for (; hit != hit_end; ++hit) {
467 sout <<
" WARNING, zero pointer detected in MeasurementBase vector!!! " << std::endl;
471 std::string idStr =
printId(**hit);
472 idStrings.push_back(idStr);
473 if (idStr.length() > idWidth) idWidth = idStr.length();
476 dataStrings.push_back(dataStr);
481 unsigned int n = idStrings.size();
482 for (
unsigned int i = 0;
i <
n; ++
i) {
483 sout << std::left << std::setw(idWidth) << idStrings[
i] << std::right <<
" " << dataStrings[
i];
484 if (
i !=
n - 1) sout << std::endl;
494 std::ostringstream sout;
496 std::vector<const MuonSegment*>::const_iterator
it = segs.begin();
497 std::vector<const MuonSegment*>::const_iterator it_end = segs.end();
498 std::vector<const MuonSegment*>::const_iterator it_last = it_end;
500 for (;
it != it_end; ++
it) {
502 sout <<
" WARNING, zero pointer detected in MuonSegment vector!!! " << std::endl;
506 if (
it != it_last) sout << std::endl;
516 std::ostringstream sout;
518 std::vector<std::unique_ptr<MuonSegment> >
::iterator it = segs.begin();
519 std::vector<std::unique_ptr<MuonSegment> >
::iterator it_end = segs.end();
520 std::vector<std::unique_ptr<MuonSegment> >
::iterator it_last = it_end;
522 for (;
it != it_end; ++
it) {
524 sout <<
" WARNING, zero pointer detected in MuonSegment vector!!! " << std::endl;
528 if (
it != it_last) sout << std::endl;
537 std::ostringstream sout;
539 sout <<
"MuonSegmentCombinationCollection with combis " << combiCol.
size() << std::endl;
544 for (;
it != it_end; ++
it) {
546 sout <<
" WARNING, zero pointer detected in MuonSegmentCombinationCollection!!! " << std::endl;
550 if (
it != it_last) sout << std::endl;
558 std::ostringstream sout;
561 sout <<
"SegmentCombination with stations " << nstations << std::endl;
564 for (
unsigned int i = 0;
i < nstations; ++
i) {
570 if (!stationSegs || stationSegs->empty())
continue;
574 sout <<
print(*stationSegs);
575 if (
i != nstations - 1) sout << std::endl;
584 std::ostringstream sout;
586 unsigned int nhits =
pattern.numberOfContainedPrds();
587 sout <<
"MuonPattern with " << nhits <<
" hits" << std::setprecision(5) <<
" theta "
588 <<
pattern.globalDirection().theta() <<
" phi " <<
pattern.globalDirection().phi() << std::setprecision(1)
589 <<
" r " << std::setw(5) << (
int)
pattern.globalPosition().perp() <<
" z " << std::setw(5)
590 << (
int)
pattern.globalPosition().z() << std::endl;
591 for (
unsigned int i = 0;
i < nhits; ++
i) {
594 sout <<
" ERROR found zero pointer on MuonPattern " << std::endl;
597 sout <<
" " <<
print(*prd);
598 if (
i < nhits - 1) sout << std::endl;
606 std::ostringstream sout;
608 sout <<
"MuonPatternCollection with " << patCol.
size() <<
" patterns " << std::endl;
613 for (;
it != it_end; ++
it) {
615 sout <<
" WARNING, zero pointer detected in MuonPatternCollection!!! " << std::endl;
619 if (
it != it_last) sout << std::endl;
627 std::ostringstream sout;
629 sout <<
"MuonPrdPatternCollection with " << patCol.
size() <<
" patterns " << std::endl;
634 for (;
it != it_end; ++
it) {
636 sout <<
" WARNING, zero pointer detected in MuonPatternCollection!!! " << std::endl;
640 if (
it != it_last) sout << std::endl;
648 std::ostringstream sout;
650 sout <<
"MuonPatternCombinationCollection with combis " << combiCol.
size() << std::endl;
655 for (;
it != it_end; ++
it) {
657 sout <<
" WARNING, zero pointer detected in MuonPatternCombinationCollection!!! " << std::endl;
661 if (
it != it_last) sout << std::endl;
669 std::ostringstream sout;
671 unsigned int nchambers = combi.
chamberData().size();
672 sout <<
"MuonPatternCombination with " << nchambers <<
" chambers ";
677 sout <<
" -> combi has no parameters ";
679 if (!combi.
chamberData().empty()) sout << std::endl;
680 std::vector<MuonPatternChamberIntersect>::const_iterator chit = combi.
chamberData().begin();
681 std::vector<MuonPatternChamberIntersect>::const_iterator chit_end = combi.
chamberData().end();
682 std::vector<MuonPatternChamberIntersect>::const_iterator chit_last = chit_end;
684 for (; chit != chit_end; ++chit) {
686 sout <<
print(chamberIntersect);
687 if (chit != chit_last) sout << std::endl;
695 std::ostringstream sout;
697 std::string chIdString(
"Unknown id");
698 double chTheta(-99.);
703 firstPrd =
intersect.prepRawDataVec().front();
715 unsigned int nchannelsEta = 0;
716 unsigned int nchannelsPhi = 0;
717 std::set<const Trk::TrkDetElementBase*> detEls;
718 std::vector<const Trk::PrepRawData*>::const_iterator hit =
intersect.prepRawDataVec().begin();
719 std::vector<const Trk::PrepRawData*>::const_iterator hit_end =
intersect.prepRawDataVec().end();
720 for (; hit != hit_end; ++hit) {
723 sout <<
" ERROR found zero pointer on MuonPatternChamberIntersect " << std::endl;
736 if (isMdt && detEls.empty()) {
740 if (MuonDetMgr ==
nullptr) {
748 if (
m_idHelperSvc->mdtIdHelper().numberOfMultilayers(
id) == 2) {
749 detEl2 = MuonDetMgr->getMdtReadoutElement(idml2);
754 detEls.insert(detEl1);
760 detEls.insert(detEl2);
784 unsigned int nchHitsEta = 0;
785 unsigned int nchHitsPhi = 0;
794 mdtPrdContainer = rh_mdt.
cptr();
797 const auto *coll = mdtPrdContainer->
indexFindPtr(hash_id);
799 nchHitsEta = coll->size();
809 rpcPrdContainer = rh_rpc.
cptr();
812 const auto *coll = rpcPrdContainer->
indexFindPtr(hash_id);
813 if (coll !=
nullptr) {
816 for (; rpcIt != rpcIt_end; ++rpcIt) {
831 tgcPrdContainer = rh_tgc.
cptr();
834 const auto *coll = tgcPrdContainer->
indexFindPtr(hash_id);
835 if (coll !=
nullptr) {
838 for (; tgcIt != tgcIt_end; ++tgcIt) {
849 sout.setf(std::ios::left);
850 sout << std::setw(33) << chIdString <<
" neta " << std::setw(3) << neta;
852 sout <<
" nphi " << std::setw(3) << nphi;
856 double scaleEta = nchannelsEta != 0 ? 1. / nchannelsEta : 0.;
857 double scalePhi = nchannelsPhi != 0 ? 1. / nchannelsPhi : 0.;
858 sout <<
" occupancy eta " << std::fixed << std::setprecision(2) << std::setw(5) << scaleEta * nchHitsEta;
860 sout <<
" phi " << std::fixed << std::setw(5) << scalePhi * nchHitsPhi;
864 sout << std::setprecision(2) <<
" pat theta " << std::setw(5) <<
intersect.intersectDirection().theta()
865 <<
" ch theta " << std::setw(5) << chTheta <<
" ch phi " << std::setw(6) << chPhi << std::setprecision(1)
866 <<
" r " << std::setw(5) << (
int)
intersect.intersectPosition().perp() <<
" z " << std::setw(5)
875 std::ostringstream sout;
876 sout <<
"r " << std::fixed << std::setprecision(0) << std::setw(5)
877 <<
pars.position().perp()
878 <<
" z " << std::fixed << std::setprecision(0) << std::setw(6) <<
pars.position().z() <<
" theta "
879 << std::fixed << std::setprecision(5) << std::setw(7) <<
pars.momentum().theta()<<
" eta "
880 << std::fixed << std::setprecision(5) << std::setw(7) <<
pars.momentum().eta() <<
" phi " << std::fixed
881 << std::setprecision(3) << std::setw(6) <<
pars.momentum().phi() <<
" q*p(GeV) " << std::scientific
882 << std::setprecision(3) << std::setw(10) <<
pars.momentum().mag() *
pars.charge() * 1
e-3 <<
" pT(GeV) "
883 << std::scientific << std::setprecision(3) << std::setw(9) <<
pars.momentum().perp() * 1
e-3;
891 std::ostringstream sout;
894 const std::vector<double>&
pull = resPull.
pull();
895 for (
unsigned int i = 0;
i <
residual.size(); ++
i) {
897 sout <<
" residual " << std::setprecision(3) << std::setw(8) <<
residual[
i] <<
" ";
900 for (
unsigned int i = 0;
i <
pull.size(); ++
i) sout << std::setprecision(3) << std::setw(8) <<
pull[
i] <<
" ";
908 std::ostringstream sout;
918 sout <<
"r " << std::fixed << std::setprecision(0) << std::setw(5) << h_r <<
" z " << std::fixed
919 << std::setprecision(0) << std::setw(5) << h_z <<
" phi " << std::fixed << std::setprecision(3) << std::setw(4)
920 << h_phi <<
" theta " << std::fixed << std::setprecision(3) << std::setw(4) << h_theta
921 <<
" lPos " << std::fixed << std::setprecision(2) << std::setw(5) << local_pos
922 <<
" error " << std::fixed << std::setprecision(2) << std::setw(5) <<
error;
931 sout <<
" r_drift " << std::fixed << std::setprecision(2) << std::setw(5) << mdt->
driftRadius();
939 sout <<
" time " << std::fixed << std::setprecision(2) << std::setw(5) << rpcPRD->
time();
947 unsigned int nlayers = 0;
948 unsigned int nhits = 0;
949 std::set<Identifier>
layers;
950 std::vector<double> rpcTimes;
951 const std::vector<const MuonClusterOnTrack*>& rots = crot->
containedROTs();
953 rpcTimes.reserve(nhits);
954 std::vector<const MuonClusterOnTrack*>::const_iterator itR = rots.begin(), itR_end = rots.end();
955 for (; itR != itR_end; ++itR) {
960 if (rpcPRD) rpcTimes.push_back(rpcPRD->
time());
963 sout <<
" CompRot: hits " << nhits <<
" layers " << nlayers;
965 if (!rpcTimes.empty()) {
966 sout << (rpcTimes.size() == 1 ?
" time" :
" times") << std::fixed << std::setprecision(2);
968 for (; itD != itD_end; ++itD) sout <<
" " << std::setw(5) << *itD;
982 if (!
id.is_valid()) {
985 idStr =
"pseudo measurement";
987 idStr =
"no Identifier";
998 std::stringstream mat_string{};
1008 mat_string<<
" deltaE: "<<eloss->
deltaE();
1016 mat_string<<
" Length "<<eloss->
length();
1021 return mat_string.str();
1024 std::stringstream aeot_string;
1027 return aeot_string.str();
1031 std::stringstream tsos_str{};
1036 return tsos_str.str();