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");
53 useCalibration = iConfig.
getParameter<
bool>(
"UseCalibration");
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";
70 if(useCalibration && calibGains.size()==0){
89 iEvent.
getByToken(m_tracksTag,trackCollectionHandle);
92 if(useTrajectory)iEvent.
getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle);
94 std::vector<susybsm::HSCPDeDxInfo> dEdxInfos( trackCollectionHandle->size() );
97 if(useTrajectory)cit = trajTrackAssociationHandle->begin();
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());
137 iEvent.
put(trackDeDxAssociation);
142 if(!thit.isValid())
return;
144 auto const & clus = thit.firstClusterRef();
145 if(!clus.isValid())
return;
148 if(!usePixel)
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()){
160 if(!useStrip)
return;
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()){
173 if(!useStrip)
return;
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
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)
LocalVector localDirection() const
LocalPoint localPosition() const
OmniClusterRef const & stereoClusterRef() const
GlobalVector normalVector() const
void insert(const H &h, I begin, I end)
virtual const Surface * surface() const final
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 &)
virtual float thickness() const =0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void produce(edm::Event &, const edm::EventSetup &) override
OmniClusterRef const & monoClusterRef() const
std::vector< uint32_t > detIds
std::vector< float > charges
const GeomDetUnit * detUnit() const
SiStripRecHit2D stereoHit() const
T const * product() const
SiStripCluster const & stripCluster() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * detUnit() const
std::vector< uint32_t > clusterIndices
std::vector< float > localPosXs
virtual void beginRun(edm::Run const &run, const edm::EventSetup &) override
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, susybsm::HSCPDeDxInfo &hscpDeDxInfo, LocalPoint HitLocalPos)