CMS 3D CMS Logo

SiPixelPhase1Clusters.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelPhase1Clusters
4 // Class: SiPixelPhase1Clusters
5 //
6 
7 // Original Author: Marcel Schneider
8 
13 
21 
22 namespace {
23 
24 class SiPixelPhase1Clusters final : public SiPixelPhase1Base {
25  enum {
26  CHARGE,
27  BIGPIXELCHARGE,
28  NOTBIGPIXELCHARGE,
29  SIZE,
30  SIZEX,
31  SIZEY,
32  NCLUSTERS,
33  NCLUSTERSINCLUSIVE,
34  EVENTRATE,
35  POSITION_B,
36  POSITION_F,
37  POSITION_XZ,
38  POSITION_YZ,
39  SIZE_VS_ETA,
40  READOUT_CHARGE,
41  READOUT_NCLUSTERS,
42  PIXEL_TO_STRIP_RATIO
43  };
44 
45  public:
46  explicit SiPixelPhase1Clusters(const edm::ParameterSet& conf);
47  void analyze(const edm::Event&, const edm::EventSetup&) override;
48 
49  private:
52 };
53 
54 SiPixelPhase1Clusters::SiPixelPhase1Clusters(const edm::ParameterSet& iConfig) :
55  SiPixelPhase1Base(iConfig)
56 {
57  pixelSrcToken_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(iConfig.getParameter<edm::InputTag>("pixelSrc"));
58 
59  stripSrcToken_ = consumes<edmNew::DetSetVector<SiStripCluster>>(iConfig.getParameter<edm::InputTag>("stripSrc"));
60 }
61 
63  if( !checktrigger(iEvent,iSetup,DCS) ) return;
64 
66  iEvent.getByToken(pixelSrcToken_, inputPixel);
67  if (!inputPixel.isValid()) return;
68 
70  iEvent.getByToken(stripSrcToken_, inputStrip);
71  if (inputStrip.isValid())
72  {
73  if (!inputStrip.product()->data().empty())
74  {
75  histo[PIXEL_TO_STRIP_RATIO].fill((double)inputPixel.product()->data().size() / (double) inputStrip.product()->data().size(), DetId(0), &iEvent);
76  }
77  }
78 
79  bool hasClusters=false;
80 
82  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
83  assert(tracker.isValid());
84 
86  for (it = inputPixel->begin(); it != inputPixel->end(); ++it) {
87  auto id = DetId(it->detId());
88 
89  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*> ( tracker->idToDet(id) );
90  const PixelTopology& topol = theGeomDet->specificTopology();
91 
92  for(SiPixelCluster const& cluster : *it) {
93  int row = cluster.x()-0.5, col = cluster.y()-0.5;
94  const std::vector<SiPixelCluster::Pixel> pixelsVec = cluster.pixels();
95 
96  for (unsigned int i = 0; i < pixelsVec.size(); ++i) {
97 
98  float pixx = pixelsVec[i].x; // index as float=iteger, row index
99  float pixy = pixelsVec[i].y; // same, col index
100 
101  bool bigInX = topol.isItBigPixelInX(int(pixx));
102  bool bigInY = topol.isItBigPixelInY(int(pixy));
103  float pixel_charge = pixelsVec[i].adc;
104 
105 
106  if (bigInX==true || bigInY==true) {
107  histo[BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row);
108  }
109 
110  else {
111  histo[NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row);
112  }
113  }
114  histo[READOUT_CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row);
115  histo[CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row);
116  histo[SIZE ].fill(double(cluster.size() ), id, &iEvent, col, row);
117  histo[SIZEX ].fill(double(cluster.sizeX() ), id, &iEvent, col, row);
118  histo[SIZEY ].fill(double(cluster.sizeY() ), id, &iEvent, col, row);
119  histo[NCLUSTERS].fill(id, &iEvent, col, row);
120  histo[NCLUSTERSINCLUSIVE].fill(id, &iEvent);
121  hasClusters=true;
122  if (cluster.size()>1){
123  histo[READOUT_NCLUSTERS].fill(id, &iEvent);
124  }
125 
126  LocalPoint clustlp = topol.localPosition(MeasurementPoint(cluster.x(), cluster.y()));
127  GlobalPoint clustgp = theGeomDet->surface().toGlobal(clustlp);
128  histo[POSITION_B ].fill(clustgp.z(), clustgp.phi(), id, &iEvent);
129  histo[POSITION_F ].fill(clustgp.x(), clustgp.y(), id, &iEvent);
130  histo[POSITION_XZ].fill(clustgp.x(), clustgp.z(), id, &iEvent);
131  histo[POSITION_YZ].fill(clustgp.y(), clustgp.z(), id, &iEvent);
132  histo[SIZE_VS_ETA].fill(clustgp.eta(), cluster.sizeY(), id, &iEvent);
133 
134  }
135  }
136 
137 
138  if (hasClusters) histo[EVENTRATE].fill(DetId(0), &iEvent);
139 
140  histo[NCLUSTERS].executePerEventHarvesting(&iEvent);
141  histo[READOUT_NCLUSTERS].executePerEventHarvesting(&iEvent);
142  histo[NCLUSTERSINCLUSIVE].executePerEventHarvesting(&iEvent);
143 
144 }
145 
146 } // namespace
147 
148 DEFINE_FWK_MODULE(SiPixelPhase1Clusters);
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
virtual bool isItBigPixelInX(int ixbin) const =0
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int iEvent
Definition: GenABIO.cc:230
T z() const
Definition: PV3DBase.h:64
virtual bool isItBigPixelInY(int iybin) const =0
bool isValid() const
Definition: HandleBase.h:74
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override=0
Definition: DetId.h:18
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:59
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
T eta() const
Definition: PV3DBase.h:76
Pixel cluster – collection of neighboring pixels above threshold.
col
Definition: cuy.py:1008
const TrackerGeomDet * idToDet(DetId) const override
bool isValid() const
Definition: ESHandle.h:47
T x() const
Definition: PV3DBase.h:62