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;
88 indices.push_back(-1);
96 const vector<TrajectoryMeasurement> & measurements = traj->measurements();
97 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
99 if( !trajState.
isValid())
continue;
104 float cosine = trackDirection.
z()/trackDirection.
mag();
113 if(!thit.isValid())
continue;
116 float cosine = (track.
px()*ModuleNormal.
x()+track.
py()*ModuleNormal.
y()+track.
pz()*ModuleNormal.
z())/track.
p();
122 indices.push_back(resultdedxHitColl->size());
123 resultdedxHitColl->push_back(hitDeDxInfo);
133 filler.
insert(trackCollectionHandle, indices.begin(), indices.end());
135 iEvent.
put(dedxMatch);
140 if(!thit.isValid())
return;
144 auto const & clus = thit.firstClusterRef();
145 if(!clus.isValid())
return;
150 auto& detUnit = *(recHit->
detUnit());
151 float pathLen = detUnit.surface().bounds().thickness()/cosineAbs;
152 float chargeAbs = clus.pixelCluster().charge();
153 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.pixelCluster() );
154 }
else if(clus.isStrip() && !thit.isMatched()){
157 auto& detUnit = *(recHit->
detUnit());
159 float pathLen = detUnit.surface().bounds().thickness()/cosineAbs;
161 hitDeDxInfo.
addHit(chargeAbs, pathLen, thit.geographicalId(), hitLocalPos, clus.stripCluster() );
162 }
else if(clus.isStrip() && thit.isMatched()){
165 if(!matchedHit)
return;
175 pathLen = detUnitS.surface().bounds().thickness()/cosineAbs;
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
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
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)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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
virtual const Surface * surface() const
double py() const
y coordinate of momentum vector