28 usePixel ( iConfig.getParameter<bool> (
"usePixel") ),
29 useStrip ( iConfig.getParameter<bool> (
"useStrip") ),
30 MeVperADCPixel ( iConfig.getParameter<double> (
"MeVperADCPixel") ),
31 MeVperADCStrip ( iConfig.getParameter<double> (
"MeVperADCStrip") ),
32 minTrackHits ( iConfig.getParameter<unsigned>(
"minTrackHits") ),
33 minTrackPt ( iConfig.getParameter<double> (
"minTrackPt" ) ),
34 maxTrackEta ( iConfig.getParameter<double> (
"maxTrackEta" ) ),
35 m_calibrationPath ( iConfig.getParameter<
string> (
"calibrationPath")),
37 shapetest ( iConfig.getParameter<bool> (
"shapeTest") )
39 produces<reco::DeDxHitInfoCollection >();
40 produces<reco::DeDxHitInfoAss >();
45 edm::LogError(
"DeDxHitsProducer") <<
"No Pixel Hits NOR Strip Hits will be saved. Running this module is useless";
72 auto resultdedxHitColl = std::make_unique<reco::DeDxHitInfoCollection>();
74 std::vector<int> indices;
81 indices.push_back(-1);
86 auto const & trajParams = track.
extra()->trajParams();
90 if(!
recHit->isValid())
continue;
92 auto trackDirection = trajParams[
h].direction();
93 float cosine = trackDirection.z()/trackDirection.mag();
98 indices.push_back(resultdedxHitColl->size());
99 resultdedxHitColl->push_back(hitDeDxInfo);
107 auto dedxMatch = std::make_unique<reco::DeDxHitInfoAss>(dedxHitCollHandle);
109 filler.insert(trackCollectionHandle, indices.begin(), indices.end());
116 if(!thit.isValid())
return;
120 auto const & clus = thit.firstClusterRef();
121 if(!clus.isValid())
return;
126 auto& detUnit = *(recHit->
detUnit());
127 float pathLen = detUnit.surface().bounds().thickness()/cosineAbs;
128 float chargeAbs = clus.pixelCluster().charge();
129 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.pixelCluster() );
130 }
else if(clus.isStrip() && !thit.isMatched()){
133 auto& detUnit = *(recHit->
detUnit());
135 float pathLen = detUnit.surface().bounds().thickness()/cosineAbs;
137 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.stripCluster() );
138 }
else if(clus.isStrip() && thit.isMatched()){
141 if(!matchedHit)
return;
151 pathLen = detUnitS.surface().bounds().thickness()/cosineAbs;
double p() const
momentum vector magnitude
T getParameter(std::string const &) 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
std::vector< Track > TrackCollection
collection of Tracks
const Bounds & bounds() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
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 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 GeomDetUnit * detUnit() const
SiStripRecHit2D stereoHit() const
T const * product() const
virtual float thickness() const =0
SiStripCluster const & stripCluster() const
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * detUnit() const
virtual void beginRun(edm::Run const &run, const edm::EventSetup &) override
virtual const Surface * surface() const final