28 useTrajectory ( iConfig.getParameter<bool> (
"useTrajectory") ),
29 usePixel ( iConfig.getParameter<bool> (
"usePixel") ),
30 useStrip ( iConfig.getParameter<bool> (
"useStrip") ),
31 MeVperADCPixel ( iConfig.getParameter<double> (
"MeVperADCPixel") ),
32 MeVperADCStrip ( iConfig.getParameter<double> (
"MeVperADCStrip") ),
33 minTrackHits ( iConfig.getParameter<unsigned>(
"minTrackHits") ),
34 minTrackPt ( iConfig.getParameter<double> (
"minTrackPt" ) ),
35 maxTrackEta ( iConfig.getParameter<double> (
"maxTrackEta" ) ),
36 m_calibrationPath ( iConfig.getParameter<
string> (
"calibrationPath")),
37 useCalibration ( iConfig.getParameter<bool> (
"useCalibration") ),
38 shapetest ( iConfig.getParameter<bool> (
"shapeTest") )
40 produces<reco::DeDxHitInfoCollection >();
41 produces<reco::DeDxHitInfoAss >();
47 edm::LogError(
"DeDxHitsProducer") <<
"No Pixel Hits NOR Strip Hits will be saved. Running this module is useless";
79 std::vector<int> indices;
89 indices.push_back(-1);
97 const vector<TrajectoryMeasurement> & measurements = traj->measurements();
98 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
100 if( !trajState.
isValid())
continue;
105 float cosine = trackDirection.
z()/trackDirection.
mag();
114 if(!thit.isValid())
continue;
117 float cosine = (track.
px()*ModuleNormal.
x()+track.
py()*ModuleNormal.
y()+track.
pz()*ModuleNormal.
z())/track.
p();
123 indices.push_back(resultdedxHitColl->size());
124 resultdedxHitColl->push_back(hitDeDxInfo);
134 filler.
insert(trackCollectionHandle, indices.begin(), indices.end());
136 iEvent.
put(dedxMatch);
141 if(!thit.isValid())
return;
145 auto const & clus = thit.firstClusterRef();
146 if(!clus.isValid())
return;
151 auto& detUnit = *(recHit->
detUnit());
152 float pathLen = detUnit.surface().bounds().thickness()/cosineAbs;
153 float chargeAbs = clus.pixelCluster().charge();
154 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.pixelCluster() );
155 }
else if(clus.isStrip() && !thit.isMatched()){
158 auto& detUnit = *(recHit->
detUnit());
160 float pathLen = detUnit.surface().bounds().thickness()/cosineAbs;
162 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.stripCluster() );
163 }
else if(clus.isStrip() && thit.isMatched()){
166 if(!matchedHit)
return;
176 pathLen = detUnitS.surface().bounds().thickness()/cosineAbs;
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
friend struct const_iterator
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)...
LocalVector localDirection() const
LocalPoint localPosition() const
std::vector< std::vector< float > > calibGains
GlobalVector normalVector() const
void insert(const H &h, I begin, I end)
std::vector< Track > TrackCollection
collection of Tracks
virtual const Surface * surface() const final
const Bounds & bounds() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
key_type key() const
Accessor for product key.
double px() const
x coordinate of momentum vector
const Plane & surface() const
The nominal surface of the GeomDet.
LocalVector localMomentum() const
virtual float thickness() const =0
double eta() const
pseudorapidity of momentum vector
DeDxHitInfoProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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 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
double pz() const
z coordinate of momentum vector
edm::EDGetTokenT< TrajTrackAssociationCollection > m_trajTrackAssociationTag
const GeomDetUnit * detUnit() const
std::vector< DeDxHitInfo > DeDxHitInfoCollection
SiStripRecHit2D stereoHit() const
T const * product() const
SiStripCluster const & stripCluster() const
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * detUnit() const
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
virtual void beginRun(edm::Run const &run, const edm::EventSetup &) override
double py() const
y coordinate of momentum vector