24 desc.add<
bool>(
"extension",
false);
26 descriptions.
add(
"siStripGainCalibTable",
desc);
45 if ((!dynamic_cast<const StripGeomDetUnit*>(gdu)) && (!dynamic_cast<const PixelGeomDetUnit*>(gdu))) {
47 <<
"DetId " <<
detId <<
" does not seem to belong to the tracker";
50 const auto plane = gdu->surface();
54 static constexpr double distFromBorder = 1.0;
55 double halfLength = 0.;
57 halfLength = trapBounds->parameters()[3];
58 }
else if (rectBounds) {
59 halfLength = .5 * gdu->surface().bounds().length();
78 double detThickness = 1.;
81 const auto isStrip = (
dynamic_cast<const StripGeomDetUnit*
>(gdu) !=
nullptr);
84 <<
"DetId " <<
id.rawId() <<
" doesn't seem to belong to the Tracker";
86 detThickness = gdu->surface().bounds().thickness();
100 std::vector<double> c_localdirx;
101 std::vector<double> c_localdiry;
102 std::vector<double> c_localdirz;
103 std::vector<uint16_t> c_firststrip;
104 std::vector<uint16_t> c_nstrips;
105 std::vector<bool> c_saturation;
106 std::vector<bool> c_overlapping;
107 std::vector<bool> c_farfromedge;
108 std::vector<int> c_charge;
109 std::vector<double> c_path;
112 std::vector<float> c_gainused;
113 std::vector<float> c_gainusedTick;
115 const auto& ampls = clus.cluster->amplitudes();
116 const int firstStrip = clus.cluster->firstStrip();
117 const int nStrips = ampls.size();
118 double prevGain = -1;
119 double prevGainTick = -1;
121 prevGain = stripGains->
getApvGain(firstStrip / 128, stripGains->
getRange(clus.det, 1), 1);
122 prevGainTick = stripGains->
getApvGain(firstStrip / 128, stripGains->
getRange(clus.det, 0), 1);
124 const unsigned int charge = clus.cluster->charge();
125 const bool saturation = std::any_of(ampls.begin(), ampls.end(), [](uint8_t amp) {
return amp >= 254; });
127 const bool overlapping = (((firstStrip % 128) == 0) || ((firstStrip / 128) != ((firstStrip +
nStrips) / 128)) ||
128 (((firstStrip +
nStrips) % 128) == 127));
129 const auto& trajState = clus.measurement.updatedState();
131 const auto cosine = trackDir.
z() / trackDir.mag();
134 c_localdirx.push_back(trackDir.x());
135 c_localdiry.push_back(trackDir.y());
136 c_localdirz.push_back(trackDir.z());
137 c_firststrip.push_back(firstStrip);
140 c_overlapping.push_back(overlapping);
141 c_farfromedge.push_back(farFromEdge);
142 c_charge.push_back(
charge);
143 c_path.push_back(
path);
144 c_gainused.push_back(prevGain);
145 c_gainusedTick.push_back(prevGainTick);
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const LocalTrajectoryError & localError() const
LocalPoint localPosition() const
const SiStripApvGain::Range getRange(uint32_t detID) const
LocalError positionError() const
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
double thickness(DetId id, const TrackerGeometry *tGeom)
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
T const * product() const
void fillTable(const std::vector< OnTrackCluster > &clusters, const edm::View< reco::Track > &tracks, nanoaod::FlatTable *table, const edm::EventSetup &iSetup) final
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
LocalVector localDirection() const
Abs< T >::type abs(const T &t)
std::map< DetId, double > m_thicknessMap
#define DEFINE_FWK_MODULE(type)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void addColumn(nanoaod::FlatTable *table, const std::string &name, VALUES &&values, const std::string &doc)
const edm::ESGetToken< SiStripGain, SiStripGainRcd > m_gainToken
bool isPixel(HitType hitType)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken
Log< level::Warning, false > LogWarning
SiStripGainCalibTableProducer(const edm::ParameterSet ¶ms)