1
-
2
-
3
- #include " FWCore/Framework/interface/MakerMacros.h"
1
+ #include " CalibFormats/SiStripObjects/interface/SiStripDetInfo.h"
2
+ #include " CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
3
+ #include " CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
4
+ #include " CondFormats/SiStripObjects/interface/SiStripNoises.h"
5
+ #include " DataFormats/BeamSpot/interface/BeamSpot.h"
6
+ #include " DataFormats/Common/interface/DetSetVector.h"
7
+ #include " DataFormats/Common/interface/DetSetVectorNew.h"
8
+ #include " DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
9
+ #include " DataFormats/GeometryVector/interface/GlobalPoint.h"
10
+ #include " DataFormats/GeometryVector/interface/LocalPoint.h"
11
+ #include " DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h"
12
+ #include " DataFormats/SiStripCluster/interface/SiStripCluster.h"
13
+ #include " DataFormats/TrackReco/interface/Track.h"
14
+ #include " DataFormats/TrackReco/interface/TrackBase.h"
15
+ #include " DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h"
4
16
#include " FWCore/Framework/interface/Frameworkfwd.h"
17
+ #include " FWCore/Framework/interface/MakerMacros.h"
5
18
#include " FWCore/Framework/interface/stream/EDProducer.h"
6
- #include " FWCore/ParameterSet/interface/ParameterSet.h"
7
- #include " FWCore/Utilities/interface/InputTag.h"
8
19
#include " FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
20
+ #include " FWCore/ParameterSet/interface/FileInPath.h"
21
+ #include " FWCore/ParameterSet/interface/ParameterSet.h"
9
22
#include " FWCore/ParameterSet/interface/ParameterSetDescription.h"
10
- #include " DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h"
11
- #include " DataFormats/SiStripCluster/interface/SiStripCluster.h"
12
- #include " DataFormats/Common/interface/DetSetVectorNew.h"
13
- #include " DataFormats/Common/interface/DetSetVector.h"
23
+ #include " FWCore/Utilities/interface/ESInputTag.h"
24
+ #include " FWCore/Utilities/interface/InputTag.h"
25
+ #include " Geometry/Records/interface/TrackerDigiGeometryRecord.h"
26
+ #include " Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
27
+ #include " Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
28
+ #include " RecoTracker/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h"
29
+ #include " RecoTracker/PixelLowPtUtilities/interface/SlidingPeakFinder.h"
30
+ #include " RecoTracker/Record/interface/CkfComponentsRecord.h"
14
31
15
32
#include < vector>
16
33
#include < memory>
@@ -27,25 +44,105 @@ class SiStripClusters2ApproxClusters : public edm::stream::EDProducer<> {
27
44
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clusterToken;
28
45
29
46
unsigned int maxNSat;
47
+ static constexpr double subclusterWindow_ = .7 ;
48
+ static constexpr double seedCutMIPs_ = .35 ;
49
+ static constexpr double seedCutSN_ = 7 .;
50
+ static constexpr double subclusterCutMIPs_ = .45 ;
51
+ static constexpr double subclusterCutSN_ = 12 .;
52
+
53
+ edm::InputTag beamSpot_;
54
+ edm::EDGetTokenT<reco::BeamSpot> beamSpotToken_;
55
+
56
+ edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tkGeomToken_;
57
+
58
+ edm::FileInPath fileInPath_;
59
+ SiStripDetInfo detInfo_;
60
+
61
+ std::string csfLabel_;
62
+ edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> csfToken_;
63
+
64
+ edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> stripNoiseToken_;
65
+ edm::ESHandle<SiStripNoises> theNoise_;
30
66
};
31
67
32
68
SiStripClusters2ApproxClusters::SiStripClusters2ApproxClusters (const edm::ParameterSet& conf) {
33
69
inputClusters = conf.getParameter <edm::InputTag>(" inputClusters" );
34
70
maxNSat = conf.getParameter <unsigned int >(" maxSaturatedStrips" );
35
71
36
72
clusterToken = consumes<edmNew::DetSetVector<SiStripCluster> >(inputClusters);
73
+
74
+ beamSpot_ = conf.getParameter <edm::InputTag>(" beamSpot" );
75
+ beamSpotToken_ = consumes<reco::BeamSpot>(beamSpot_);
76
+
77
+ tkGeomToken_ = esConsumes ();
78
+
79
+ fileInPath_ = edm::FileInPath (SiStripDetInfoFileReader::kDefaultFile );
80
+ detInfo_ = SiStripDetInfoFileReader::read (fileInPath_.fullPath ());
81
+
82
+ csfLabel_ = conf.getParameter <std::string>(" clusterShapeHitFilterLabel" );
83
+ csfToken_ = esConsumes (edm::ESInputTag (" " , csfLabel_));
84
+
85
+ stripNoiseToken_ = esConsumes ();
86
+
37
87
produces<edmNew::DetSetVector<SiStripApproximateCluster> >();
38
88
}
39
89
40
- void SiStripClusters2ApproxClusters::produce (edm::Event& event, edm::EventSetup const &) {
90
+ void SiStripClusters2ApproxClusters::produce (edm::Event& event, edm::EventSetup const & iSetup ) {
41
91
auto result = std::make_unique<edmNew::DetSetVector<SiStripApproximateCluster> >();
42
92
const auto & clusterCollection = event.get (clusterToken);
43
93
94
+ auto const beamSpotHandle = event.getHandle (beamSpotToken_);
95
+ auto const & bs = beamSpotHandle.isValid () ? *beamSpotHandle : reco::BeamSpot ();
96
+ if (not beamSpotHandle.isValid ()) {
97
+ edm::LogError (" SiStripClusters2ApproxClusters" )
98
+ << " didn't find a valid beamspot with label \" " << beamSpot_.encode () << " \" -> using (0,0,0)" ;
99
+ }
100
+
101
+ const auto & tkGeom = &iSetup.getData (tkGeomToken_);
102
+ const auto & theFilter = &iSetup.getData (csfToken_);
103
+ const auto & theNoise_ = &iSetup.getData (stripNoiseToken_);
104
+
44
105
for (const auto & detClusters : clusterCollection) {
45
106
edmNew::DetSetVector<SiStripApproximateCluster>::FastFiller ff{*result, detClusters.id ()};
46
107
47
- for (const auto & cluster : detClusters)
48
- ff.push_back (SiStripApproximateCluster (cluster, maxNSat));
108
+ unsigned int detId = detClusters.id ();
109
+ const GeomDet* det = tkGeom->idToDet (detId);
110
+ double nApvs = detInfo_.getNumberOfApvsAndStripLength (detId).first ;
111
+ double stripLength = detInfo_.getNumberOfApvsAndStripLength (detId).second ;
112
+ double barycenter_ypos = 0.5 * stripLength;
113
+
114
+ const StripGeomDetUnit* stripDet = dynamic_cast <const StripGeomDetUnit*>(det);
115
+ float mip = 3.9 / (sistrip::MeVperADCStrip / stripDet->surface ().bounds ().thickness ());
116
+
117
+ for (const auto & cluster : detClusters) {
118
+ const LocalPoint& lp = LocalPoint (((cluster.barycenter () * 10 / (sistrip::STRIPS_PER_APV * nApvs)) -
119
+ ((stripDet->surface ().bounds ().width ()) * 0 .5f )),
120
+ barycenter_ypos - (0 .5f * stripLength),
121
+ 0 .);
122
+ const GlobalPoint& gpos = det->surface ().toGlobal (lp);
123
+ GlobalPoint beamspot (bs.position ().x (), bs.position ().y (), bs.position ().z ());
124
+ const GlobalVector& gdir = gpos - beamspot;
125
+ const LocalVector& ldir = det->toLocal (gdir);
126
+
127
+ int hitStrips;
128
+ float hitPredPos;
129
+ theFilter->getSizes (detId, cluster, lp, ldir, hitStrips, hitPredPos);
130
+
131
+ bool peakFilter = false ;
132
+ SlidingPeakFinder pf (std::max<int >(2 , std::ceil (std::abs (hitPredPos) + subclusterWindow_)));
133
+ float mipnorm = mip / std::abs (ldir.z ());
134
+ PeakFinderTest test (mipnorm,
135
+ detId,
136
+ cluster.firstStrip (),
137
+ theNoise_,
138
+ seedCutMIPs_,
139
+ seedCutSN_,
140
+ subclusterCutMIPs_,
141
+ subclusterCutSN_);
142
+ peakFilter = pf.apply (cluster.amplitudes (), test);
143
+
144
+ ff.push_back (SiStripApproximateCluster (cluster, maxNSat, hitPredPos, peakFilter));
145
+ }
49
146
}
50
147
51
148
event.put (std::move (result));
@@ -55,6 +152,8 @@ void SiStripClusters2ApproxClusters::fillDescriptions(edm::ConfigurationDescript
55
152
edm::ParameterSetDescription desc;
56
153
desc.add <edm::InputTag>(" inputClusters" , edm::InputTag (" siStripClusters" ));
57
154
desc.add <unsigned int >(" maxSaturatedStrips" , 3 );
155
+ desc.add <std::string>(" clusterShapeHitFilterLabel" , " ClusterShapeHitFilter" ); // add CSF label
156
+ desc.add <edm::InputTag>(" beamSpot" , edm::InputTag (" offlineBeamSpot" )); // add BeamSpot tag
58
157
descriptions.add (" SiStripClusters2ApproxClusters" , desc);
59
158
}
60
159
0 commit comments