34 SiPixelPhase1TrackClustersOnTrackCharge,
35 SiPixelPhase1TrackClustersOnTrackSize,
36 SiPixelPhase1TrackClustersOnTrackShape,
37 SiPixelPhase1TrackClustersOnTrackNClusters,
38 SiPixelPhase1TrackClustersOnTrackPositionB,
39 SiPixelPhase1TrackClustersOnTrackPositionF,
41 SiPixelPhase1TrackClustersNTracks,
42 SiPixelPhase1TrackClustersNTracksInVolume,
44 SiPixelPhase1ClustersSizeVsEtaOnTrackOuter,
45 SiPixelPhase1ClustersSizeVsEtaOnTrackInner,
46 SiPixelPhase1TrackClustersOnTrackChargeOuter,
47 SiPixelPhase1TrackClustersOnTrackChargeInner,
49 SiPixelPhase1TrackClustersOnTrackShapeOuter,
50 SiPixelPhase1TrackClustersOnTrackShapeInner,
52 SiPixelPhase1TrackClustersOnTrackSizeXOuter,
53 SiPixelPhase1TrackClustersOnTrackSizeXInner,
54 SiPixelPhase1TrackClustersOnTrackSizeYOuter,
55 SiPixelPhase1TrackClustersOnTrackSizeYInner,
57 SiPixelPhase1TrackClustersOnTrackSizeXYOuter,
58 SiPixelPhase1TrackClustersOnTrackSizeXYInner,
60 SiPixelPhase1ClustersSizeVsEtaOnTrack,
63 SiPixelPhase1TrackClustersEnumSize
71 const bool applyVertexCut_;
80 SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(
const edm::ParameterSet& iConfig) :
82 applyVertexCut_(iConfig.getUntrackedParameter<bool>(
"VertexCut",
true)),
84 offlinePrimaryVerticesToken_(applyVertexCut_ ?
85 consumes<
reco::
VertexCollection>(iConfig.getUntrackedParameter<
edm::InputTag>(
"vertices",
edm::InputTag(
"offlinePrimaryVertices"))) :
92 if (
histo.size() != SiPixelPhase1TrackClustersEnumSize) {
93 edm::LogError(
"SiPixelPhase1TrackClusters") <<
"incompatible configuration " <<
histo.size()
94 <<
"!=" << SiPixelPhase1TrackClustersEnumSize << std::endl;
105 auto const & tkTpl = *tTopoHandle;
109 auto const & shapeFilter = *shapeFilterH;
113 if(applyVertexCut_) {
114 iEvent.
getByToken(offlinePrimaryVerticesToken_, vertices);
115 if (!vertices.
isValid() || vertices->empty())
return;
123 edm::LogWarning(
"SiPixelPhase1TrackClusters") <<
"track collection is not valid";
129 iEvent.
getByToken(pixelClusterShapeCacheToken_, pixelClusterShapeCacheH);
130 auto const & pixelClusterShapeCache = *pixelClusterShapeCacheH;
132 for (
auto const &
track : *tracks) {
134 if (applyVertexCut_ && (
track.pt() < 0.75 ||
std::abs(
track.dxy((*vertices)[0].position()) ) > 5*
track.dxyError()))
continue;
136 bool isBpixtrack =
false, isFpixtrack =
false, crossesPixVol=
false;
142 auto etatk =
track.eta();
144 auto const & trajParams =
track.extra()->trajParams();
145 assert(trajParams.size()==
track.recHitsSize());
146 auto hb =
track.recHitsBegin();
147 for(
unsigned int h=0;
h<
track.recHitsSize();
h++){
149 if (!
hit->isValid())
continue;
150 auto id =
hit->geographicalId();
153 auto subdetid = (
id.subdetId());
158 if (!pixhit)
continue;
164 auto clustp = pixhit->
cluster();
165 if (clustp.isNull())
continue;
166 auto const & cluster = *clustp;
168 auto const & ltp = trajParams[
h];
170 auto localDir = ltp.momentum()/ltp.momentum().mag();
174 auto charge = cluster.charge()*ltp.absdz();
176 auto clustgp = pixhit->globalPosition();
181 std::pair<float,float> pred;
182 if(shapeFilter.getSizes(*pixhit,localDir,pixelClusterShapeCache, part,meas, pred)) {
183 auto shape = shapeFilter.isCompatible(*pixhit,localDir,pixelClusterShapeCache);
184 if(tkTpl.pxbLadder(
id)%2==1) {
185 histo[SiPixelPhase1TrackClustersOnTrackSizeXOuter].fill(pred.first, cluster.sizeX(),
id, &
iEvent);
186 histo[SiPixelPhase1TrackClustersOnTrackSizeYOuter].fill(pred.second,cluster.sizeY(),
id, &
iEvent);
187 histo[SiPixelPhase1TrackClustersOnTrackSizeXYOuter].fill(pred.second-cluster.sizeY(),pred.first-cluster.sizeX(),
id, &
iEvent);
189 histo[SiPixelPhase1TrackClustersOnTrackShapeOuter].fill(shape?1:0,
id, &iEvent);
191 histo[SiPixelPhase1TrackClustersOnTrackSizeXInner].fill(pred.first, cluster.sizeX(),
id, &
iEvent);
192 histo[SiPixelPhase1TrackClustersOnTrackSizeYInner].fill(pred.second,cluster.sizeY(),
id, &
iEvent);
193 histo[SiPixelPhase1TrackClustersOnTrackSizeXYInner].fill(pred.second-cluster.sizeY(),pred.first-cluster.sizeX(),
id, &
iEvent);
195 histo[SiPixelPhase1TrackClustersOnTrackShapeInner].fill(shape?1:0,
id, &iEvent);
197 histo[SiPixelPhase1TrackClustersOnTrackShape].fill(shape?1:0,
id, &iEvent);
200 histo[SiPixelPhase1TrackClustersOnTrackNClusters].fill(
id, &iEvent);
201 histo[SiPixelPhase1TrackClustersOnTrackCharge].fill(
charge,
id, &iEvent);
202 histo[SiPixelPhase1TrackClustersOnTrackSize].fill(cluster.size(),
id, &
iEvent);
204 histo[SiPixelPhase1TrackClustersOnTrackPositionB].fill(clustgp.z(), clustgp.phi(),
id, &
iEvent);
205 histo[SiPixelPhase1TrackClustersOnTrackPositionF].fill(clustgp.x(), clustgp.y(),
id, &
iEvent);
207 histo[SiPixelPhase1ClustersSizeVsEtaOnTrack].fill(etatk, cluster.sizeY(),
id, &
iEvent);
209 if(tkTpl.pxbLadder(
id)%2==1) {
210 histo[SiPixelPhase1ClustersSizeVsEtaOnTrackOuter].fill(etatk, cluster.sizeY(),
id, &
iEvent);
211 histo[SiPixelPhase1TrackClustersOnTrackChargeOuter].fill(
charge,
id, &iEvent);
213 histo[SiPixelPhase1ClustersSizeVsEtaOnTrackInner].fill(etatk, cluster.sizeY(),
id, &
iEvent);
214 histo[SiPixelPhase1TrackClustersOnTrackChargeInner].fill(
charge,
id, &iEvent);
220 histo[SiPixelPhase1TrackClustersNTracks].fill(1,
DetId(0), &iEvent);
221 if (isBpixtrack || isFpixtrack)
222 histo[SiPixelPhase1TrackClustersNTracks].fill(2,
DetId(0), &iEvent);
224 histo[SiPixelPhase1TrackClustersNTracks].fill(3,
DetId(0), &iEvent);
226 histo[SiPixelPhase1TrackClustersNTracks].fill(4,
DetId(0), &iEvent);
229 if (isBpixtrack || isFpixtrack)
230 histo[SiPixelPhase1TrackClustersNTracksInVolume].fill(1,
DetId(0), &iEvent);
232 histo[SiPixelPhase1TrackClustersNTracksInVolume].fill(0,
DetId(0), &iEvent);
236 histo[SiPixelPhase1TrackClustersOnTrackNClusters].executePerEventHarvesting(&iEvent);
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
def analyze(function, filename, filter=None)
#define DEFINE_FWK_MODULE(type)
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
Abs< T >::type abs(const T &t)
ClusterRef cluster() const
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)=0