148 size_t n = TrajToTrackMap.
size();
149 std::vector<DeDxData> dedxEstimate(n);
159 vector<DeDxTools::RawHits> hits;
162 const vector<TrajectoryMeasurement> & measurements = traj->measurements();
163 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
165 if( !trajState.
isValid())
continue;
169 double cosine = trackDirection.
z()/trackDirection.
mag();
182 mono.
detId= matchedHit->monoHit()->geographicalId();
183 stereo.
detId= matchedHit->stereoHit()->geographicalId();
185 hits.push_back(mono);
186 hits.push_back(stereo);
196 hits.push_back(mono);
197 }
else if(
const SiStripRecHit2D* singleHit=dynamic_cast<const SiStripRecHit2D*>(recHit)){
205 hits.push_back(mono);
206 }
else if(
const SiStripRecHit1D* single1DHit=dynamic_cast<const SiStripRecHit1D*>(recHit)){
213 mono.
detId= single1DHit->geographicalId();
214 hits.push_back(mono);
215 }
else if(
const SiPixelRecHit* pixelHit=dynamic_cast<const SiPixelRecHit*>(recHit)){
222 pixel.
charge = pixelHit->cluster()->charge();
224 pixel.
detId= pixelHit->geographicalId();
225 hits.push_back(pixel);
230 int NClusterSaturating = 0;
231 for(
size_t i=0;
i < hits.size();
i++)
233 stModInfo* MOD =
MODsColl[hits[
i].detId];
234 float pathLen = MOD->Thickness/
std::abs(hits[
i].angleCosine);
235 float charge = MOD->Normalization*hits[
i].charge*
std::abs(hits[
i].angleCosine);
236 dedxHits.push_back(
DeDxHit( charge, MOD->Distance, pathLen, hits[
i].detId) );
238 if(hits[i].NSaturating>0)NClusterSaturating++;
241 sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>());
246 val_and_error.second = NClusterSaturating;
248 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() );
250 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
255 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.
int getCharge(const SiStripCluster *Cluster, int &Saturating_Strips)
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
ClusterRef const & cluster() const
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)
DetId geographicalId() const