33 produces<ValueMap<susybsm::HSCPDeDxInfo> >();
44 m_trajTrackAssociationTag = consumes<TrajTrackAssociationCollection>(iConfig.
getParameter<
edm::InputTag>(
"trajectoryTrackAssociation"));
49 meVperADCPixel = iConfig.
getParameter<
double>(
"MeVperADCPixel");
50 meVperADCStrip = iConfig.
getParameter<
double>(
"MeVperADCStrip");
54 m_calibrationPath = iConfig.
getParameter<
string>(
"calibrationPath");
60 if(!usePixel && !useStrip)
61 edm::LogWarning(
"DeDxHitsProducer") <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
89 iEvent.
getByToken(m_tracksTag,trackCollectionHandle);
94 std::vector<susybsm::HSCPDeDxInfo> dEdxInfos( trackCollectionHandle->size() );
98 for(
unsigned int j=0;j<trackCollectionHandle->size();j++){
105 const vector<TrajectoryMeasurement> & measurements = traj->measurements();
106 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
108 if( !trajState.
isValid())
continue;
113 float cosine = trackDirection.
z()/trackDirection.
mag();
119 for(
unsigned int h=0;
h<track->recHitsSize();
h++){
122 if(!thit.isValid())
continue;
125 float cosine = (track->px()*ModuleNormal.
x()+track->py()*ModuleNormal.
y()+track->pz()*ModuleNormal.
z())/track->p();
127 processHit(recHit, track->p(), cosine, hscpDeDxInfo,
LocalPoint(0.0,0.0));
131 dEdxInfos[j] = hscpDeDxInfo;
135 filler.
insert(trackCollectionHandle, dEdxInfos.begin(), dEdxInfos.end());
142 if(!thit.isValid())
return;
145 if(!clus.isValid())
return;
150 auto& detUnit = *(recHit->
detUnit());
151 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
152 float chargeAbs = clus.pixelCluster().charge();
153 hscpDeDxInfo.
charges.push_back(chargeAbs);
155 hscpDeDxInfo.
detIds.push_back(thit.geographicalId());
156 hscpDeDxInfo.
localPosXs.push_back(HitLocalPos.
x());
157 hscpDeDxInfo.
localPosYs.push_back(HitLocalPos.
y());
159 }
else if(clus.isStrip() && !thit.isMatched()){
162 auto& detUnit = *(recHit->
detUnit());
164 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
165 float chargeAbs =
DeDxTools::getCharge(&(clus.stripCluster()),NSaturating, detUnit, calibGains, m_off);
166 hscpDeDxInfo.
charges.push_back(chargeAbs);
168 hscpDeDxInfo.
detIds.push_back(thit.geographicalId());
169 hscpDeDxInfo.
localPosXs.push_back(HitLocalPos.
x());
170 hscpDeDxInfo.
localPosYs.push_back(HitLocalPos.
y());
172 }
else if(clus.isStrip() && thit.isMatched()){
175 if(!matchedHit)
return;
181 hscpDeDxInfo.
charges.push_back(chargeAbs);
183 hscpDeDxInfo.
detIds.push_back(thit.geographicalId());
184 hscpDeDxInfo.
localPosXs.push_back(HitLocalPos.
x());
185 hscpDeDxInfo.
localPosYs.push_back(HitLocalPos.
y());
191 pathLen = detUnitS.surface().bounds().thickness()/fabs(cosine);
193 hscpDeDxInfo.
charges.push_back(chargeAbs);
195 hscpDeDxInfo.
detIds.push_back(thit.geographicalId());
196 hscpDeDxInfo.
localPosXs.push_back(HitLocalPos.
x());
197 hscpDeDxInfo.
localPosYs.push_back(HitLocalPos.
y());
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Point3DBase< Scalar, LocalTag > LocalPoint
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
LocalVector localDirection() const
LocalPoint localPosition() const
OmniClusterRef const & stereoClusterRef() const
GlobalVector normalVector() const
void insert(const H &h, I begin, I end)
const Bounds & bounds() const
std::vector< float > localPosYs
key_type key() const
Accessor for product key.
const Plane & surface() const
The nominal surface of the GeomDet.
std::vector< float > pathlengths
LocalVector localMomentum() const
HSCPDeDxInfoProducer(const edm::ParameterSet &)
unsigned int offsetDU(SubDetector sid) const
void produce(edm::Event &, const edm::EventSetup &) override
~HSCPDeDxInfoProducer() override
OmniClusterRef const & monoClusterRef() const
std::vector< uint32_t > detIds
std::vector< float > charges
SiStripRecHit2D stereoHit() const
T const * product() const
virtual float thickness() const =0
SiStripCluster const & stripCluster() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
const GeomDetUnit * detUnit() const override
const Surface * surface() const final
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * detUnit() const
virtual OmniClusterRef const & firstClusterRef() const =0
std::vector< uint32_t > clusterIndices
const_iterator begin() const
first iterator over the map (read only)
std::vector< float > localPosXs
void beginRun(edm::Run const &run, const edm::EventSetup &) override
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, susybsm::HSCPDeDxInfo &hscpDeDxInfo, LocalPoint HitLocalPos)