30 MeVperADCPixel ( iConfig.getParameter<double> (
"MeVperADCPixel") ),
31 MeVperADCStrip ( iConfig.getParameter<double> (
"MeVperADCStrip") ),
32 minTrackHits ( iConfig.getParameter<unsigned>(
"minTrackHits") ),
33 minTrackPt ( iConfig.getParameter<double> (
"minTrackPt" ) ),
35 maxTrackEta ( iConfig.getParameter<double> (
"maxTrackEta" ) ),
36 m_calibrationPath ( iConfig.getParameter<
string> (
"calibrationPath")),
38 shapetest ( iConfig.getParameter<
bool> (
"shapeTest") ),
41 lowPtTracksEstimator(iConfig.getParameter<
edm::
ParameterSet>(
"lowPtTracksEstimatorParameters")),
44 produces<reco::DeDxHitInfoCollection >();
45 produces<reco::DeDxHitInfoAss >();
46 produces<edm::ValueMap<int> >(
"prescale");
51 edm::LogError(
"DeDxHitsProducer") <<
"No Pixel Hits NOR Strip Hits will be saved. Running this module is useless";
77 auto resultdedxHitColl = std::make_unique<reco::DeDxHitInfoCollection>();
79 std::vector<int> indices; std::vector<int> prescales;
85 bool passPt = (track.
pt() >=
minTrackPt), passLowDeDx =
false, passHighDeDx =
false, pass = passPt;
93 pass = passHighDeDx || passLowDeDx;
96 indices.push_back(-1);
101 auto const & trajParams = track.
extra()->trajParams();
105 if(!
recHit->isValid())
continue;
107 auto trackDirection = trajParams[
h].direction();
108 float cosine = trackDirection.z()/trackDirection.mag();
114 std::vector<DeDxHit>
hits; hits.reserve(hitDeDxInfo.
size());
115 for (
unsigned int i = 0,
n = hitDeDxInfo.
size();
i <
n; ++
i) {
123 std::sort(hits.begin(), hits.end(), std::less<DeDxHit>());
128 indices.push_back(-1);
135 indices.push_back(-1);
141 prescales.push_back(1);
143 indices.push_back(resultdedxHitColl->size());
144 resultdedxHitColl->push_back(hitDeDxInfo);
152 auto dedxMatch = std::make_unique<reco::DeDxHitInfoAss>(dedxHitCollHandle);
154 filler.insert(trackCollectionHandle, indices.begin(), indices.end());
158 auto dedxPrescale = std::make_unique<edm::ValueMap<int>>();
160 pfiller.insert(dedxHitCollHandle, prescales.begin(), prescales.end());
167 if(!thit.isValid())
return;
171 auto const & clus = thit.firstClusterRef();
172 if(!clus.isValid())
return;
178 const auto * detUnit = recHit->
detUnit();
179 if (detUnit ==
nullptr) detUnit =
tkGeom->
idToDet(thit.geographicalId());
181 float chargeAbs = clus.pixelCluster().charge();
182 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.pixelCluster() );
183 }
else if(clus.isStrip() && !thit.isMatched()){
186 const auto * detUnit = recHit->
detUnit();
187 if (detUnit ==
nullptr) detUnit =
tkGeom->
idToDet(thit.geographicalId());
191 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.stripCluster() );
192 }
else if(clus.isStrip() && thit.isMatched()){
195 if(!matchedHit)
return;
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
EventNumber_t event() const
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const TrackExtraRef & extra() const
reference to "extra" object
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)...
std::vector< std::vector< float > > calibGains
float charge(size_t i) const
GenericTruncatedAverageDeDxEstimator lowPtTracksEstimator
std::vector< Track > TrackCollection
collection of Tracks
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
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
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
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
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
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
virtual const GeomDetUnit * detUnit() const
float pathlength(size_t i) const
const TrackerGeomDet * idToDet(DetId) const 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