File indexing completed on 2024-04-06 12:08:26
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "DQM/SiPixelPhase1Common/interface/SiPixelPhase1Base.h"
0010 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0011 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013 #include "FWCore/Utilities/interface/ESGetToken.h"
0014
0015 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0016 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0017 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0018 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0019 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0020 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0021
0022 namespace {
0023
0024 class SiPixelPhase1Clusters final : public SiPixelPhase1Base {
0025 enum {
0026 CHARGE,
0027 BIGPIXELCHARGE,
0028 NOTBIGPIXELCHARGE,
0029 SIZE,
0030 SIZEX,
0031 SIZEY,
0032 NCLUSTERS,
0033 NCLUSTERSINCLUSIVE,
0034 EVENTRATE,
0035 POSITION_B,
0036 POSITION_F,
0037 POSITION_XZ,
0038 POSITION_YZ,
0039 SIZE_VS_ETA,
0040 READOUT_CHARGE,
0041 READOUT_NCLUSTERS,
0042 PIXEL_TO_STRIP_RATIO
0043 };
0044
0045 public:
0046 explicit SiPixelPhase1Clusters(const edm::ParameterSet& conf);
0047 void analyze(const edm::Event&, const edm::EventSetup&) override;
0048
0049 private:
0050 edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster>> pixelSrcToken_;
0051 edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster>> stripSrcToken_;
0052 edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeometryToken_;
0053 };
0054
0055 SiPixelPhase1Clusters::SiPixelPhase1Clusters(const edm::ParameterSet& iConfig)
0056 : SiPixelPhase1Base(iConfig), trackerGeometryToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()) {
0057 pixelSrcToken_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(iConfig.getParameter<edm::InputTag>("pixelSrc"));
0058
0059 stripSrcToken_ = consumes<edmNew::DetSetVector<SiStripCluster>>(iConfig.getParameter<edm::InputTag>("stripSrc"));
0060 }
0061
0062 void SiPixelPhase1Clusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0063 if (!checktrigger(iEvent, iSetup, DCS))
0064 return;
0065
0066 edm::Handle<edmNew::DetSetVector<SiPixelCluster>> inputPixel;
0067 iEvent.getByToken(pixelSrcToken_, inputPixel);
0068 if (!inputPixel.isValid())
0069 return;
0070
0071 edm::Handle<edmNew::DetSetVector<SiStripCluster>> inputStrip;
0072 iEvent.getByToken(stripSrcToken_, inputStrip);
0073 if (inputStrip.isValid()) {
0074 if (!inputStrip.product()->data().empty()) {
0075 histo[PIXEL_TO_STRIP_RATIO].fill(
0076 (double)inputPixel.product()->data().size() / (double)inputStrip.product()->data().size(),
0077 DetId(0),
0078 &iEvent);
0079 }
0080 }
0081
0082 bool hasClusters = false;
0083
0084 const TrackerGeometry& tracker = iSetup.getData(trackerGeometryToken_);
0085
0086 edmNew::DetSetVector<SiPixelCluster>::const_iterator it;
0087 for (it = inputPixel->begin(); it != inputPixel->end(); ++it) {
0088 auto id = DetId(it->detId());
0089
0090 const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(tracker.idToDet(id));
0091 const PixelTopology& topol = theGeomDet->specificTopology();
0092
0093 for (SiPixelCluster const& cluster : *it) {
0094 int row = cluster.x() - 0.5, col = cluster.y() - 0.5;
0095 const std::vector<SiPixelCluster::Pixel> pixelsVec = cluster.pixels();
0096
0097 for (unsigned int i = 0; i < pixelsVec.size(); ++i) {
0098 float pixx = pixelsVec[i].x;
0099 float pixy = pixelsVec[i].y;
0100
0101 bool bigInX = topol.isItBigPixelInX(int(pixx));
0102 bool bigInY = topol.isItBigPixelInY(int(pixy));
0103 float pixel_charge = pixelsVec[i].adc;
0104
0105 if (bigInX == true || bigInY == true) {
0106 histo[BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row);
0107 }
0108
0109 else {
0110 histo[NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row);
0111 }
0112 }
0113 histo[READOUT_CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row);
0114 histo[CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row);
0115 histo[SIZE].fill(double(cluster.size()), id, &iEvent, col, row);
0116 histo[SIZEX].fill(double(cluster.sizeX()), id, &iEvent, col, row);
0117 histo[SIZEY].fill(double(cluster.sizeY()), id, &iEvent, col, row);
0118 histo[NCLUSTERS].fill(id, &iEvent, col, row);
0119 histo[NCLUSTERSINCLUSIVE].fill(id, &iEvent);
0120 hasClusters = true;
0121 if (cluster.size() > 1) {
0122 histo[READOUT_NCLUSTERS].fill(id, &iEvent);
0123 }
0124
0125 LocalPoint clustlp = topol.localPosition(MeasurementPoint(cluster.x(), cluster.y()));
0126 GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
0127 histo[POSITION_B].fill(clustgp.z(), clustgp.phi(), id, &iEvent);
0128 histo[POSITION_F].fill(clustgp.x(), clustgp.y(), id, &iEvent);
0129 histo[POSITION_XZ].fill(clustgp.x(), clustgp.z(), id, &iEvent);
0130 histo[POSITION_YZ].fill(clustgp.y(), clustgp.z(), id, &iEvent);
0131 histo[SIZE_VS_ETA].fill(clustgp.eta(), cluster.sizeY(), id, &iEvent);
0132 }
0133 }
0134
0135 if (hasClusters)
0136 histo[EVENTRATE].fill(DetId(0), &iEvent);
0137
0138 histo[NCLUSTERS].executePerEventHarvesting(&iEvent);
0139 histo[READOUT_NCLUSTERS].executePerEventHarvesting(&iEvent);
0140 histo[NCLUSTERSINCLUSIVE].executePerEventHarvesting(&iEvent);
0141 }
0142
0143 }
0144
0145 DEFINE_FWK_MODULE(SiPixelPhase1Clusters);