Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:22

0001 #include "PrintRecoObjects.h"
0002 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
0003 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0004 
0005 void PrintRecoObjects::print(std::stringstream& ss, const SiStripCluster& clus) {
0006   ss << "\n\t"
0007      << " firstStrip " << clus.firstStrip() << " size " << clus.amplitudes().size();
0008   float charge = 0;
0009   size_t idx = 0;
0010   for (auto adc : clus.amplitudes()) {
0011     charge += adc;
0012     ss << "\n\t\t strip " << ++idx << " adc " << (size_t)adc;
0013   }
0014   ss << "\n\t\t charge " << charge << " barycenter " << clus.barycenter() << std::endl;
0015 }
0016 
0017 void PrintRecoObjects::print(std::stringstream& ss, const TrajectorySeed& tjS) {
0018   ss << "\n\t nHits " << tjS.nHits() << "\n\t PTrajectoryStateOnDet: detid " << tjS.startingState().detId()
0019      << " tsos momentum" << tjS.startingState().parameters().momentum() << " pt "
0020      << sqrt(tjS.startingState().parameters().momentum().mag2() -
0021              tjS.startingState().parameters().momentum().y() * tjS.startingState().parameters().momentum().y())
0022      << " charge " << tjS.startingState().parameters().charge() << "\n\t error ";
0023   for (size_t ie = 0; ie < 15; ++ie)
0024     ss << "\t " << tjS.startingState().error(ie);
0025   for (auto const& recHit : tjS.recHits()) {
0026     ss << "\n\t TrackingRecHit on detid " << recHit.geographicalId().rawId() << " \t localPos "
0027        << recHit.localPosition();
0028   }
0029 }
0030 
0031 void PrintRecoObjects::print(std::stringstream& ss, const uint32_t& detid, const TrackerTopology* tTopo) const {
0032   ss << getString(detid, tTopo);
0033 }
0034 
0035 std::string PrintRecoObjects::getString(uint32_t detid, const TrackerTopology* tTopo) const {
0036   std::string append = " ";
0037   char cindex[128];
0038   SiStripDetId a(detid);
0039   if (a.subdetId() == 3) {
0040     append += "_TIB_L";
0041     sprintf(cindex, "%d", tTopo->tibLayer(detid));
0042   } else if (a.subdetId() == 4) {
0043     if (tTopo->tidSide(detid) == 1) {
0044       append += "_M_D";
0045     } else {
0046       append += "_M_P";
0047     }
0048     sprintf(cindex, "%d", tTopo->tidWheel(detid));
0049   } else if (a.subdetId() == 5) {
0050     append += "_TOB_L";
0051     sprintf(cindex, "%d", tTopo->tobLayer(detid));
0052   } else if (a.subdetId() == 6) {
0053     if (tTopo->tecSide(detid) == 1) {
0054       append += "_TEC_M";
0055     } else {
0056       append += "_TEC_P";
0057     }
0058     sprintf(cindex, "%d", tTopo->tecWheel(detid));
0059   }
0060 
0061   append += std::string(cindex);
0062   return append;
0063 }
0064 
0065 void PrintRecoObjects::print(std::stringstream& ss, const reco::Track* track, const math::XYZPoint& vx) {
0066   ss << "[PrintObject] "
0067      << "\n\tcharge \t" << track->charge() << "\talgo \t" << track->algo() << "\n\treferencePoint \t"
0068      << track->referencePoint() << " \t r: " << track->referencePoint().rho() << "\n\tinnerpos \t"
0069      << track->innerPosition() << " \t r: " << track->innerPosition().rho();
0070 
0071   ss << "\n\tmomentum \t" << track->momentum() << " pt " << track->momentum().rho() << "\n\tinnerMom \t"
0072      << track->innerMomentum() << " pt " << track->innerMomentum().rho();
0073 
0074   ss << "\n\tinnerok \t" << track->innerOk() << "\n\tinnerdetid \t" << track->innerDetId() << "\n\tdxy    \t"
0075      << track->dxy() << "\n\tdxy(vx) \t" << track->dxy(vx) << "\t where vx \t" << vx << std::endl;
0076 }