31 minTrackHits(iConfig.getParameter<unsigned>(
"minTrackHits")),
32 minTrackPt(iConfig.getParameter<double>(
"minTrackPt")),
34 maxTrackEta(iConfig.getParameter<double>(
"maxTrackEta")),
35 m_calibrationPath(iConfig.getParameter<
string>(
"calibrationPath")),
37 shapetest(iConfig.getParameter<
bool>(
"shapeTest")),
40 lowPtTracksEstimator(iConfig.getParameter<
edm::
ParameterSet>(
"lowPtTracksEstimatorParameters")),
42 produces<reco::DeDxHitInfoCollection>();
43 produces<reco::DeDxHitInfoAss>();
44 produces<edm::ValueMap<int>>(
"prescale");
49 edm::LogError(
"DeDxHitsProducer") <<
"No Pixel Hits NOR Strip Hits will be saved. Running this module is useless";
70 auto resultdedxHitColl = std::make_unique<reco::DeDxHitInfoCollection>();
79 bool passPt = (track.
pt() >=
minTrackPt), passLowDeDx =
false, passHighDeDx =
false, pass = passPt;
87 pass = passHighDeDx || passLowDeDx;
90 indices.push_back(-1);
95 auto const& trajParams = track.
extra()->trajParams();
102 auto trackDirection = trajParams[
h].direction();
103 float cosine = trackDirection.z() / trackDirection.mag();
109 std::vector<DeDxHit>
hits;
110 hits.reserve(hitDeDxInfo.
size());
111 for (
unsigned int i = 0,
n = hitDeDxInfo.
size();
i <
n; ++
i) {
120 std::sort(hits.begin(), hits.end(), std::less<DeDxHit>());
125 indices.push_back(-1);
132 indices.push_back(-1);
137 prescales.push_back(1);
139 indices.push_back(resultdedxHitColl->size());
140 resultdedxHitColl->push_back(hitDeDxInfo);
147 auto dedxMatch = std::make_unique<reco::DeDxHitInfoAss>(dedxHitCollHandle);
149 filler.insert(trackCollectionHandle, indices.begin(), indices.end());
153 auto dedxPrescale = std::make_unique<edm::ValueMap<int>>();
155 pfiller.insert(dedxHitCollHandle, prescales.begin(), prescales.end());
171 auto const& clus = thit.firstClusterRef();
175 if (clus.isPixel()) {
179 const auto* detUnit = recHit->
detUnit();
180 if (detUnit ==
nullptr)
183 float chargeAbs = clus.pixelCluster().charge();
184 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.pixelCluster());
185 }
else if (clus.isStrip() && !thit.isMatched()) {
189 const auto* detUnit = recHit->
detUnit();
190 if (detUnit ==
nullptr)
195 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.stripCluster());
196 }
else if (clus.isStrip() && thit.isMatched()) {
204 if (detUnitM ==
nullptr)
213 if (detUnitS ==
nullptr)
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
EventNumber_t event() const
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const TrackExtraRef & extra() const
reference to "extra" object
bool isFromDet(TrackingRecHit const &hit)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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
const Bounds & bounds() const
void produce(edm::Event &, const edm::EventSetup &) override
LuminosityBlockNumber_t luminosityBlock() const
const Plane & surface() const
The nominal surface of the GeomDet.
const unsigned int lowPtTracksPrescalePass
const float lowPtTracksDeDxThreshold
#define DEFINE_FWK_MODULE(type)
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
unsigned int offsetDU(SubDetector sid) const
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
virtual float thickness() const =0
SiStripCluster const & stripCluster() const
const GeomDetUnit * detUnit() const override
~DeDxHitInfoProducer() override
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * detUnit() const
float pathlength(size_t i) const
const TrackerGeomDet * idToDet(DetId) const override
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
DetId geographicalId() const
void beginRun(edm::Run const &run, const edm::EventSetup &) override
edm::ESHandle< TrackerGeometry > tkGeom
const SiStripCluster * stripCluster(size_t i) const
DetId detId(size_t i) const
const float minTrackPtPrescale
const float MeVperADCStrip