12 Suffix(iConfig.getParameter<
std::
string>(
"Suffix")),
14 produces<std::vector<int>>(
Prefix +
"trackindex" +
Suffix);
15 produces<std::vector<unsigned int>>(
Prefix +
"rawid" +
Suffix);
16 produces<std::vector<double>>(
Prefix +
"localdirx" +
Suffix);
17 produces<std::vector<double>>(
Prefix +
"localdiry" +
Suffix);
18 produces<std::vector<double>>(
Prefix +
"localdirz" +
Suffix);
19 produces<std::vector<unsigned short>>(
Prefix +
"firststrip" +
Suffix);
20 produces<std::vector<unsigned short>>(
Prefix +
"nstrips" +
Suffix);
21 produces<std::vector<bool>>(
Prefix +
"saturation" +
Suffix);
22 produces<std::vector<bool>>(
Prefix +
"overlapping" +
Suffix);
23 produces<std::vector<bool>>(
Prefix +
"farfromedge" +
Suffix);
24 produces<std::vector<unsigned int>>(
Prefix +
"charge" +
Suffix);
26 #ifdef ExtendedCALIBTree 27 produces<std::vector<double>>(
Prefix +
"chargeoverpath" +
Suffix);
29 produces<std::vector<unsigned char>>(
Prefix +
"amplitude" +
Suffix);
30 produces<std::vector<double>>(
Prefix +
"gainused" +
Suffix);
31 produces<std::vector<double>>(
Prefix +
"gainusedTick" +
Suffix);
35 auto trackindex = std::make_unique<std::vector<int>>();
36 auto rawid = std::make_unique<std::vector<unsigned int>>();
37 auto localdirx = std::make_unique<std::vector<double>>();
38 auto localdiry = std::make_unique<std::vector<double>>();
39 auto localdirz = std::make_unique<std::vector<double>>();
40 auto firststrip = std::make_unique<std::vector<unsigned short>>();
41 auto nstrips = std::make_unique<std::vector<unsigned short>>();
42 auto saturation = std::make_unique<std::vector<bool>>();
43 auto overlapping = std::make_unique<std::vector<bool>>();
44 auto farfromedge = std::make_unique<std::vector<bool>>();
45 auto charge = std::make_unique<std::vector<unsigned int>>();
46 auto path = std::make_unique<std::vector<double>>();
47 #ifdef ExtendedCALIBTree 48 auto chargeoverpath = std::make_unique<std::vector<double>>();
50 auto amplitude = std::make_unique<std::vector<unsigned char>>();
51 auto gainused = std::make_unique<std::vector<double>>();
52 auto gainusedTick = std::make_unique<std::vector<double>>();
70 vector<TrajectoryMeasurement> measurements = traj->
measurements();
71 for (vector<TrajectoryMeasurement>::const_iterator measurement_it = measurements.begin();
72 measurement_it != measurements.end();
88 for (
unsigned int h = 0;
h < 2;
h++) {
89 if (!sistripmatchedhit &&
h == 1) {
91 }
else if (sistripmatchedhit &&
h == 0) {
93 DetId = sistripmatchedhit->
monoId();
94 }
else if (sistripmatchedhit &&
h == 1) {
97 DetId = sistripmatchedhit->
stereoId();
98 }
else if (sistripsimplehit) {
99 StripCluster = (sistripsimplehit->
cluster()).
get();
101 }
else if (sistripsimple1dhit) {
102 StripCluster = (sistripsimple1dhit->
cluster()).
get();
104 }
else if (sipixelhit) {
105 PixelCluster = (sipixelhit->
cluster()).
get();
112 double cosine = trackDirection.
z() / trackDirection.
mag();
113 bool Saturation =
false;
115 unsigned int Charge = 0;
117 double PrevGain = -1;
118 double PrevGainTick = -1;
123 const auto& Ampls = StripCluster->
amplitudes();
125 NStrips = Ampls.size();
126 int APVId = FirstStrip / 128;
133 for (
unsigned int a = 0;
a < Ampls.size();
a++) {
137 amplitude->push_back(Ampls[
a]);
142 if (FirstStrip == 128)
144 if (FirstStrip == 256)
146 if (FirstStrip == 384)
148 if (FirstStrip == 512)
150 if (FirstStrip == 640)
153 if (FirstStrip <= 127 && FirstStrip + Ampls.size() > 127)
155 if (FirstStrip <= 255 && FirstStrip + Ampls.size() > 255)
157 if (FirstStrip <= 383 && FirstStrip + Ampls.size() > 383)
159 if (FirstStrip <= 511 && FirstStrip + Ampls.size() > 511)
161 if (FirstStrip <= 639 && FirstStrip + Ampls.size() > 639)
164 if (FirstStrip + Ampls.size() == 127)
166 if (FirstStrip + Ampls.size() == 255)
168 if (FirstStrip + Ampls.size() == 383)
170 if (FirstStrip + Ampls.size() == 511)
172 if (FirstStrip + Ampls.size() == 639)
174 if (FirstStrip + Ampls.size() == 767)
176 }
else if (PixelCluster) {
177 const auto& Ampls = PixelCluster->
pixelADC();
180 FirstStrip = ((FirstRow / 80) << 3 | (FirstCol / 52)) * 128;
185 for (
unsigned int a = 0;
a < Ampls.size();
a++) {
191 #ifdef ExtendedCALIBTree 192 double ChargeOverPath = (double)Charge / Path;
196 rawid->push_back(DetId);
197 localdirx->push_back(trackDirection.
x());
198 localdiry->push_back(trackDirection.
y());
199 localdirz->push_back(trackDirection.
z());
200 firststrip->push_back(FirstStrip);
201 nstrips->push_back(NStrips);
202 saturation->push_back(Saturation);
203 overlapping->push_back(Overlapping);
204 farfromedge->push_back(StripCluster ?
IsFarFromBorder(&trajState, DetId, &iSetup) :
true);
205 charge->push_back(Charge);
206 path->push_back(Path);
207 #ifdef ExtendedCALIBTree 208 chargeoverpath->push_back(ChargeOverPath);
210 gainused->push_back(PrevGain);
211 gainusedTick->push_back(PrevGainTick);
228 #ifdef ExtendedCALIBTree 292 const uint32_t detid,
301 if (dynamic_cast<const StripGeomDetUnit*>(it) ==
nullptr && dynamic_cast<const PixelGeomDetUnit*>(it) ==
nullptr) {
302 std::cout <<
"this detID doesn't seem to belong to the Tracker" << std::endl;
307 const TrapezoidalPlaneBounds* trapezoidalBounds(dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
308 const RectangularPlaneBounds* rectangularBounds(dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
310 double DistFromBorder = 1.0;
313 if (trapezoidalBounds) {
314 std::array<const float, 4>
const&
parameters = (*trapezoidalBounds).parameters();
315 HalfLength = parameters[3];
316 }
else if (rectangularBounds) {
322 if (fabs(HitLocalPos.
y()) + HitLocalError.
yy() >= (HalfLength - DistFromBorder))
333 double detThickness = 1.;
338 if (!isPixel && !isStrip) {
340 edm::LogWarning(
"DeDxHitsProducer") <<
"\t\t this detID doesn't seem to belong to the Tracker";
343 detThickness = it->surface().bounds().thickness();
ClusterRef cluster() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual float length() const =0
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
unsigned int stereoId() const
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_token_
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int findTrackIndex(const edm::Handle< edm::View< reco::Track > > &h, const reco::Track *t)
SiStripCluster const & monoCluster() const
LocalVector localDirection() const
LocalPoint localPosition() const
double thickness(DetId id)
constexpr uint32_t rawId() const
get the raw id
std::map< DetId, double > m_thicknessMap
const Bounds & bounds() const
uint16_t firstStrip() const
ShallowGainCalibration(const edm::ParameterSet &)
const Plane & surface() const
The nominal surface of the GeomDet.
LocalError positionError() const
bool IsFarFromBorder(TrajectoryStateOnSurface *trajState, const uint32_t detid, const edm::EventSetup *iSetup)
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
DataContainer const & measurements() const
ClusterRef cluster() const
const LocalTrajectoryError & localError() const
const edm::EDGetTokenT< TrajTrackAssociationCollection > association_token_
const std::vector< uint16_t > & pixelADC() const
const TrackerGeometry * m_tracker
ClusterRef cluster() const
SiStripCluster const & stereoCluster() const
Pixel cluster – collection of neighboring pixels above threshold.
bool isPixel(HitType hitType)
unsigned int monoId() const
const_iterator begin() const
first iterator over the map (read only)
DetId geographicalId() const
void produce(edm::Event &, const edm::EventSetup &) override
const std::vector< uint8_t > & amplitudes() const
const SiStripApvGain::Range getRange(uint32_t detID) const