147 size_t n = TrajToTrackMap.
size();
148 std::vector<DeDxData> dedxEstimate(n);
158 vector<DeDxTools::RawHits> hits;
161 const vector<TrajectoryMeasurement> & measurements = traj->measurements();
162 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
164 if( !trajState.
isValid())
continue;
168 double cosine = trackDirection.
z()/trackDirection.
mag();
170 if(
const SiStripMatchedRecHit2D* matchedHit=dynamic_cast<const SiStripMatchedRecHit2D*>(recHit)){
181 mono.
detId= matchedHit->monoId();
182 stereo.
detId= matchedHit->stereoId();
188 const SiStripRecHit2D* singleHit=&(projectedHit->originalHit());
194 mono.
detId= singleHit->geographicalId();
196 hits.push_back(mono);
197 }
else if(
const SiStripRecHit2D* singleHit=dynamic_cast<const SiStripRecHit2D*>(recHit)){
204 mono.
detId= singleHit->geographicalId();
206 hits.push_back(mono);
207 }
else if(
const SiStripRecHit1D* single1DHit=dynamic_cast<const SiStripRecHit1D*>(recHit)){
214 mono.
detId= single1DHit->geographicalId();
216 hits.push_back(mono);
217 }
else if(
const SiPixelRecHit* pixelHit=dynamic_cast<const SiPixelRecHit*>(recHit)){
224 pixel.
charge = pixelHit->cluster()->charge();
226 pixel.
detId= pixelHit->geographicalId();
227 hits.push_back(pixel);
232 int NClusterSaturating = 0;
233 for(
size_t i=0;
i < hits.size();
i++)
235 stModInfo* MOD =
MODsColl[hits[
i].detId];
236 float pathLen = MOD->Thickness/
std::abs(hits[
i].angleCosine);
237 float charge = MOD->Normalization*hits[
i].charge*
std::abs(hits[
i].angleCosine);
238 dedxHits.push_back(
DeDxHit( charge, MOD->Distance, pathLen, hits[
i].detId) );
240 if(hits[i].NSaturating>0)NClusterSaturating++;
243 sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>());
248 val_and_error.second = NClusterSaturating;
250 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() );
252 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
257 iEvent.
put(trackDeDxEstimateAssociation);
edm::InputTag m_trajTrackAssociationTag
const_iterator end() const
last iterator over the map (read only)
LocalVector localDirection() const
std::vector< DeDxHit > DeDxHitCollection
edm::InputTag m_tracksTag
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
BaseDeDxEstimator * m_estimator
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits)=0
size_type size() const
map size
key_type key() const
Accessor for product key.
T const * product() const
__gnu_cxx::hash_map< unsigned int, stModInfo *, __gnu_cxx::hash< unsigned int >, isEqual > MODsColl
const_iterator begin() const
first iterator over the map (read only)
int getCharge(const SiStripCluster *Cluster, int &Saturating_Strips, const uint32_t &)