File indexing completed on 2024-04-06 12:28:29
0001 #include "RecoTracker/PixelLowPtUtilities/interface/HitInfo.h"
0002
0003 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0004 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0005
0006 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0007 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0008
0009 #include <sstream>
0010 using namespace std;
0011
0012
0013 HitInfo::HitInfo() {}
0014
0015
0016 HitInfo::~HitInfo() {}
0017
0018
0019 string HitInfo::getInfo(const DetId &id, const TrackerTopology *tTopo) {
0020 string info;
0021
0022 if (id.subdetId() == int(PixelSubdetector::PixelBarrel)) {
0023
0024
0025 ostringstream o;
0026 o << " (" << tTopo->pxbLayer(id) << "|" << tTopo->pxbLadder(id) << "|" << tTopo->pxbModule(id) << ")";
0027 info += o.str();
0028 } else {
0029
0030
0031 ostringstream o;
0032 o << " (" << tTopo->pxfSide(id) << "|" << tTopo->pxfDisk(id) << "|" << tTopo->pxfBlade(id) << "|"
0033 << tTopo->pxfPanel(id) << "|" << tTopo->pxfModule(id) << ")";
0034 info += o.str();
0035 }
0036
0037 return info;
0038 }
0039
0040
0041 string HitInfo::getInfo(const TrackingRecHit &recHit, const TrackerTopology *tTopo) {
0042 DetId id(recHit.geographicalId());
0043
0044 return getInfo(id, tTopo);
0045 }
0046
0047
0048 string HitInfo::getInfo(const vector<const TrackingRecHit *> &recHits, const TrackerTopology *tTopo) {
0049 string info;
0050
0051 for (vector<const TrackingRecHit *>::const_iterator recHit = recHits.begin(); recHit != recHits.end(); recHit++)
0052 info += getInfo(**recHit, tTopo);
0053
0054 return info;
0055 }
0056
0057
0058 string HitInfo::getInfo(const PSimHit &simHit, const TrackerTopology *tTopo) {
0059 string info;
0060
0061 DetId id = DetId(simHit.detUnitId());
0062
0063 {
0064 ostringstream o;
0065 o << simHit.particleType();
0066
0067 info += " | pid=" + o.str();
0068 }
0069
0070 {
0071 ostringstream o;
0072 o << id.subdetId();
0073
0074 info += " | " + o.str();
0075 }
0076
0077 return info + getInfo(id, tTopo);
0078 }