40 ON_TRACK_BIGPIXELCHARGE,
41 ON_TRACK_NOTBIGPIXELCHARGE,
47 DIGIS_HITMAP_ON_TRACK,
53 SIZE_VS_ETA_ON_TRACK_OUTER,
54 SIZE_VS_ETA_ON_TRACK_INNER,
55 ON_TRACK_CHARGE_OUTER,
56 ON_TRACK_CHARGE_INNER,
61 ON_TRACK_SIZE_X_OUTER,
62 ON_TRACK_SIZE_X_INNER,
64 ON_TRACK_SIZE_Y_OUTER,
65 ON_TRACK_SIZE_Y_INNER,
68 ON_TRACK_SIZE_XY_OUTER,
69 ON_TRACK_SIZE_XY_INNER,
71 CHARGE_VS_SIZE_ON_TRACK,
81 const bool applyVertexCut_;
88 SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(
const edm::ParameterSet& iConfig) :
90 applyVertexCut_(iConfig.getUntrackedParameter<
bool>(
"VertexCut",
true))
94 offlinePrimaryVerticesToken_ = applyVertexCut_ ?
95 consumes<reco::VertexCollection>(iConfig.getParameter<
edm::InputTag>(
"vertices")) :
98 pixelClusterShapeCacheToken_ = consumes<SiPixelClusterShapeCache>(iConfig.getParameter<
edm::InputTag>(
"clusterShapeCache"));
102 if( !checktrigger(iEvent, iSetup, DCS) )
return;
104 if (
histo.size() != ENUM_SIZE) {
105 edm::LogError(
"SiPixelPhase1TrackClusters") <<
"incompatible configuration " <<
histo.size()
106 <<
"!=" << ENUM_SIZE << std::endl;
117 auto const & tkTpl = *tTopoHandle;
121 auto const & shapeFilter = *shapeFilterH;
124 if(applyVertexCut_) {
125 iEvent.
getByToken(offlinePrimaryVerticesToken_, vertices);
126 if (!vertices.
isValid() || vertices->empty())
return;
134 edm::LogWarning(
"SiPixelPhase1TrackClusters") <<
"track collection is not valid";
139 iEvent.
getByToken(pixelClusterShapeCacheToken_, pixelClusterShapeCacheH);
140 if ( !pixelClusterShapeCacheH.
isValid() ) {
141 edm::LogWarning(
"SiPixelPhase1TrackClusters") <<
"PixelClusterShapeCache collection is not valid";
144 auto const & pixelClusterShapeCache = *pixelClusterShapeCacheH;
146 for (
auto const &
track : *tracks) {
148 if (applyVertexCut_ &&
151 bool isBpixtrack =
false, isFpixtrack =
false, crossesPixVol =
false;
157 auto etatk =
track.eta();
159 auto const & trajParams =
track.extra()->trajParams();
160 assert(trajParams.size()==
track.recHitsSize());
161 auto hb =
track.recHitsBegin();
163 for (
unsigned int h = 0;
h <
track.recHitsSize();
h++){
165 auto hit = *(hb +
h);
166 if (!
hit->isValid())
continue;
167 auto id =
hit->geographicalId();
170 auto subdetid = (
id.subdetId());
178 bool iAmOuter = ((tkTpl.pxbLadder(
id) % 2 == 1) && tkTpl.pxbLayer(
id) != 4) ||
179 ((tkTpl.pxbLadder(
id) % 2 != 1) && tkTpl.pxbLayer(
id) == 4);
182 if (!pixhit)
continue;
184 auto geomdetunit =
dynamic_cast<const PixelGeomDetUnit*
>(pixhit->detUnit());
188 auto clustp = pixhit->cluster();
189 if (clustp.isNull())
continue;
190 auto const & cluster = *clustp;
191 const std::vector<SiPixelCluster::Pixel> pixelsVec = cluster.pixels();
192 for (
unsigned int i = 0;
i < pixelsVec.size(); ++
i) {
194 float pixx = pixelsVec[
i].x;
195 float pixy = pixelsVec[
i].y;
198 bool bigInY = topol.isItBigPixelInY(
int(pixy));
199 float pixel_charge = pixelsVec[
i].adc;
201 if (bigInX==
true || bigInY==
true) {
202 histo[ON_TRACK_BIGPIXELCHARGE].fill(pixel_charge,
id, &iEvent);
205 histo[ON_TRACK_NOTBIGPIXELCHARGE].fill(pixel_charge,
id, &iEvent);
209 auto const & ltp = trajParams[
h];
211 auto localDir = ltp.momentum() / ltp.momentum().mag();
214 auto charge = cluster.charge() * ltp.absdz();
216 auto clustgp = pixhit->globalPosition();
220 std::pair<float, float> pred;
221 if(shapeFilter.getSizes(*pixhit, localDir, pixelClusterShapeCache, part, meas, pred)) {
222 auto shape = shapeFilter.isCompatible(*pixhit, localDir, pixelClusterShapeCache);
223 unsigned shapeVal = (shape ? 1 : 0);
227 histo[ON_TRACK_SIZE_X_OUTER].fill(pred.first, cluster.sizeX(),
id, &
iEvent);
228 histo[ON_TRACK_SIZE_Y_OUTER].fill(pred.second, cluster.sizeY(),
id, &
iEvent);
229 histo[ON_TRACK_SIZE_XY_OUTER].fill(cluster.sizeY(), cluster.sizeX(),
id, &
iEvent);
231 histo[ON_TRACK_SHAPE_OUTER].fill(shapeVal,
id, &iEvent);
233 histo[ON_TRACK_SIZE_X_INNER].fill(pred.first, cluster.sizeX(),
id, &
iEvent);
234 histo[ON_TRACK_SIZE_Y_INNER].fill(pred.second, cluster.sizeY(),
id, &
iEvent);
235 histo[ON_TRACK_SIZE_XY_INNER].fill(cluster.sizeY(), cluster.sizeX(),
id, &
iEvent);
237 histo[ON_TRACK_SHAPE_INNER].fill(shapeVal,
id, &iEvent);
240 histo[ON_TRACK_SIZE_X_F].fill(pred.first, cluster.sizeX(),
id, &
iEvent);
241 histo[ON_TRACK_SIZE_Y_F].fill(pred.second, cluster.sizeY(),
id, &
iEvent);
242 histo[ON_TRACK_SIZE_XY_F].fill(cluster.sizeY(), cluster.sizeX(),
id, &
iEvent);
244 histo[ON_TRACK_SHAPE].fill(shapeVal,
id, &iEvent);
247 for (
int i = 0;
i < cluster.size();
i++){
249 histo[DIGIS_HITMAP_ON_TRACK].fill(
id, &iEvent, vecipxl.
y, vecipxl.
x);
250 histo[ON_TRACK_NDIGIS].fill(
id, &iEvent);
253 histo[ON_TRACK_NCLUSTERS].fill(
id, &iEvent);
257 histo[ON_TRACK_POSITIONB].fill(clustgp.z(), clustgp.phi(),
id, &
iEvent);
258 histo[ON_TRACK_POSITIONF].fill(clustgp.x(), clustgp.y(),
id, &
iEvent);
265 histo[SIZE_VS_ETA_ON_TRACK_OUTER].fill(etatk, cluster.sizeY(),
id, &
iEvent);
266 histo[ON_TRACK_CHARGE_OUTER].fill(
charge,
id, &iEvent);
268 histo[SIZE_VS_ETA_ON_TRACK_INNER].fill(etatk, cluster.sizeY(),
id, &
iEvent);
269 histo[ON_TRACK_CHARGE_INNER].fill(
charge,
id, &iEvent);
276 if (isBpixtrack || isFpixtrack)
284 if (isBpixtrack || isFpixtrack)
285 histo[NTRACKS_INVOLUME].fill(1,
DetId(0), &iEvent);
287 histo[NTRACKS_INVOLUME].fill(0,
DetId(0), &iEvent);
291 histo[ON_TRACK_NCLUSTERS].executePerEventHarvesting(&iEvent);
292 histo[ON_TRACK_NDIGIS].executePerEventHarvesting(&iEvent);
T getParameter(std::string const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< Vertex > VertexCollection
collection of Vertex objects
virtual bool isItBigPixelInX(int ixbin) const =0
Abs< T >::type abs(const T &t)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override=0
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.