27 : usePixel(iConfig.getParameter<bool>(
"usePixel")),
28 useStrip(iConfig.getParameter<bool>(
"useStrip")),
31 minTrackHits(iConfig.getParameter<unsigned>(
"minTrackHits")),
32 minTrackPt(iConfig.getParameter<double>(
"minTrackPt")),
33 minTrackPtPrescale(iConfig.getParameter<double>(
"minTrackPtPrescale")),
34 maxTrackEta(iConfig.getParameter<double>(
"maxTrackEta")),
35 m_calibrationPath(iConfig.getParameter<
string>(
"calibrationPath")),
36 useCalibration(iConfig.getParameter<bool>(
"useCalibration")),
37 shapetest(iConfig.getParameter<bool>(
"shapeTest")),
38 lowPtTracksPrescalePass(iConfig.getParameter<uint32_t>(
"lowPtTracksPrescalePass")),
39 lowPtTracksPrescaleFail(iConfig.getParameter<uint32_t>(
"lowPtTracksPrescaleFail")),
40 lowPtTracksEstimator(iConfig.getParameter<edm::
ParameterSet>(
"lowPtTracksEstimatorParameters")),
41 lowPtTracksDeDxThreshold(iConfig.getParameter<double>(
"lowPtTracksDeDxThreshold")) {
42 produces<reco::DeDxHitInfoCollection>();
43 produces<reco::DeDxHitInfoAss>();
44 produces<edm::ValueMap<int>>(
"prescale");
47 m_tkGeomToken = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>();
50 edm::LogError(
"DeDxHitsProducer") <<
"No Pixel Hits NOR Strip Hits will be saved. Running this module is useless";
71 auto resultdedxHitColl = std::make_unique<reco::DeDxHitInfoCollection>();
80 bool passPt = (track.
pt() >=
minTrackPt), passLowDeDx =
false, passHighDeDx =
false, pass = passPt;
88 pass = passHighDeDx || passLowDeDx;
91 indices.push_back(-1);
96 auto const& trajParams = track.
extra()->trajParams();
99 auto recHit = *(
hb +
h);
103 auto trackDirection = trajParams[
h].direction();
104 float cosine = trackDirection.z() / trackDirection.mag();
106 processHit(recHit, track.
p(), cosine, hitDeDxInfo, trajParams[
h].position());
110 std::vector<DeDxHit> hits;
111 hits.reserve(hitDeDxInfo.
size());
112 for (
unsigned int i = 0,
n = hitDeDxInfo.
size();
i <
n; ++
i) {
121 std::sort(hits.begin(), hits.end(), std::less<DeDxHit>());
126 indices.push_back(-1);
133 indices.push_back(-1);
138 prescales.push_back(1);
140 indices.push_back(resultdedxHitColl->size());
141 resultdedxHitColl->push_back(hitDeDxInfo);
148 auto dedxMatch = std::make_unique<reco::DeDxHitInfoAss>(dedxHitCollHandle);
150 filler.insert(trackCollectionHandle, indices.begin(), indices.end());
154 auto dedxPrescale = std::make_unique<edm::ValueMap<int>>();
156 pfiller.insert(dedxHitCollHandle, prescales.begin(), prescales.end());
172 auto const& clus = thit.firstClusterRef();
176 if (clus.isPixel()) {
180 const auto* detUnit = recHit->
detUnit();
181 if (detUnit ==
nullptr)
182 detUnit =
tkGeom->idToDet(thit.geographicalId());
183 float pathLen = detUnit->surface().bounds().thickness() / cosineAbs;
184 float chargeAbs = clus.pixelCluster().charge();
185 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.pixelCluster());
186 }
else if (clus.isStrip() && !thit.isMatched()) {
190 const auto* detUnit = recHit->
detUnit();
191 if (detUnit ==
nullptr)
192 detUnit =
tkGeom->idToDet(thit.geographicalId());
194 float pathLen = detUnit->surface().bounds().thickness() / cosineAbs;
196 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.stripCluster());
197 }
else if (clus.isStrip() && thit.isMatched()) {
205 if (detUnitM ==
nullptr)
208 float pathLen = detUnitM->surface().bounds().thickness() / cosineAbs;
214 if (detUnitS ==
nullptr)
217 pathLen = detUnitS->surface().bounds().thickness() / cosineAbs;
double p() const
momentum vector magnitude
EventNumber_t event() const
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const GeomDetUnit * detUnit() const override
const TrackExtraRef & extra() const
reference to "extra" object
bool isFromDet(TrackingRecHit const &hit)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
float charge(size_t i) const
GenericTruncatedAverageDeDxEstimator lowPtTracksEstimator
std::vector< Track > TrackCollection
collection of Tracks
std::vector< std::vector< float > > calibGains
void produce(edm::Event &, const edm::EventSetup &) override
Log< level::Error, false > LogError
LuminosityBlockNumber_t luminosityBlock() const
const unsigned int lowPtTracksPrescalePass
const float lowPtTracksDeDxThreshold
double eta() const
pseudorapidity of momentum vector
DeDxHitInfoProducer(const edm::ParameterSet &)
void processHit(const TrackingRecHit *recHit, const float trackMomentum, const float cosine, reco::DeDxHitInfo &hitDeDxInfo, const LocalPoint &hitLocalPos)
const std::string m_calibrationPath
double pt() const
track transverse momentum
const float MeVperADCPixel
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const bool useCalibration
Abs< T >::type abs(const T &t)
void addHit(const float charge, const float pathlength, const DetId &detId, const LocalPoint &pos, const SiStripCluster &stripCluster)
unsigned short numberOfValidHits() const
number of valid hits found
const unsigned int minTrackHits
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
const unsigned int lowPtTracksPrescaleFail
uint64_t xorshift128p(uint64_t state[2])
SiStripRecHit2D stereoHit() const
T const * product() const
unsigned long long uint64_t
SiStripCluster const & stripCluster() const
T getParameter(std::string const &) const
~DeDxHitInfoProducer() override
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * detUnit() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken
float pathlength(size_t i) const
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
DetId geographicalId() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
void beginRun(edm::Run const &run, const edm::EventSetup &) override
edm::ESHandle< TrackerGeometry > tkGeom
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const SiStripCluster * stripCluster(size_t i) const
DetId detId(size_t i) const
const float minTrackPtPrescale
const float MeVperADCStrip