33 desc.
add<
string>(
"estimator",
"generic");
36 desc.
add<
bool>(
"UseTrajectory",
true);
37 desc.
add<
bool>(
"UsePixel",
false);
38 desc.
add<
bool>(
"UseStrip",
true);
39 desc.
add<
double>(
"MeVperADCPixel",3.61e-06*265);
40 desc.
add<
double>(
"MeVperADCStrip",3.61e-06);
41 desc.
add<
bool>(
"ShapeTest",
true);
42 desc.
add<
bool>(
"UseCalibration",
false);
43 desc.
add<
string>(
"calibrationPath",
"");
44 desc.
add<
string>(
"Reccord",
"SiStripDeDxMip_3D_Rcd");
45 desc.
add<
string>(
"ProbabilityMode",
"Accumulation");
46 desc.
add<
double>(
"fraction", 0.4);
47 desc.
add<
double>(
"exponent",-2.0);
49 descriptions.
add(
"DeDxEstimatorProducer",desc);
56 produces<ValueMap<DeDxData> >();
58 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
72 m_trajTrackAssociationTag = consumes<TrajTrackAssociationCollection>(iConfig.
getParameter<
edm::InputTag>(
"trajectoryTrackAssociation"));
73 useTrajectory = iConfig.
getParameter<
bool>(
"UseTrajectory");
77 meVperADCPixel = iConfig.
getParameter<
double>(
"MeVperADCPixel");
78 meVperADCStrip = iConfig.
getParameter<
double>(
"MeVperADCStrip");
81 useCalibration = iConfig.
getParameter<
bool>(
"UseCalibration");
82 m_calibrationPath = iConfig.
getParameter<
string>(
"calibrationPath");
84 if(!usePixel && !useStrip)
85 edm::LogWarning(
"DeDxHitsProducer") <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
98 if(useCalibration && calibGains.size()==0){
106 m_estimator->beginRun(run, iSetup);
117 iEvent.
getByToken(m_tracksTag,trackCollectionHandle);
120 if(useTrajectory)iEvent.
getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle);
122 std::vector<DeDxData> dedxEstimate( trackCollectionHandle->size() );
125 if(useTrajectory)cit = trajTrackAssociationHandle->begin();
126 for(
unsigned int j=0;
j<trackCollectionHandle->size();
j++){
129 int NClusterSaturating = 0;
134 const vector<TrajectoryMeasurement> & measurements = traj->measurements();
135 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
137 if( !trajState.
isValid())
continue;
140 if(!recHit || !recHit->
isValid())
continue;
142 float cosine = trackDirection.
z()/trackDirection.
mag();
144 processHit(recHit, trajState.
localMomentum().
mag(), cosine, dedxHits, NClusterSaturating);
148 for(
unsigned int h=0;
h<track->recHitsSize();
h++){
150 if(!recHit || !recHit->
isValid())
continue;
152 if(!thit.isValid())
continue;
155 float cosine = (track->px()*ModuleNormal.
x()+track->py()*ModuleNormal.
y()+track->pz()*ModuleNormal.
z())/track->p();
157 processHit(recHit, track->p(), cosine, dedxHits, NClusterSaturating);
161 sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>());
162 std::pair<float,float> val_and_error = m_estimator->dedx(dedxHits);
166 val_and_error.second = NClusterSaturating;
167 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() );
171 filler.
insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
175 iEvent.
put(trackDeDxEstimateAssociation);
181 if(!thit.isValid())
return;
183 auto const & clus = thit.firstClusterRef();
184 if(!clus.isValid())
return;
187 if(!usePixel)
return;
189 auto& detUnit = *(recHit->
detUnit());
190 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
191 float chargeAbs = clus.pixelCluster().charge();
192 float charge = meVperADCPixel*chargeAbs/pathLen;
193 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
194 }
else if(clus.isStrip() && !thit.isMatched()){
195 if(!useStrip)
return;
197 auto& detUnit = *(recHit->
detUnit());
199 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
200 float chargeAbs =
DeDxTools::getCharge(&(clus.stripCluster()),NSaturating, detUnit, calibGains, m_off);
201 float charge = meVperADCStrip*chargeAbs/pathLen;
203 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
204 if(NSaturating>0)NClusterSaturating++;
206 }
else if(clus.isStrip() && thit.isMatched()){
207 if(!useStrip)
return;
208 const SiStripMatchedRecHit2D* matchedHit=
dynamic_cast<const SiStripMatchedRecHit2D*
>(recHit);
209 if(!matchedHit)
return;
212 auto& detUnitM = *(gdet->
monoDet());
215 float chargeAbs =
DeDxTools::getCharge(&(matchedHit->monoCluster()),NSaturating, detUnitM, calibGains, m_off);
216 float charge = meVperADCStrip*chargeAbs/pathLen;
218 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->monoId()) );
219 if(NSaturating>0)NClusterSaturating++;
224 pathLen = detUnitS.surface().bounds().thickness()/fabs(cosine);
225 chargeAbs =
DeDxTools::getCharge(&(matchedHit->stereoCluster()),NSaturating, detUnitS, calibGains, m_off);
226 charge = meVperADCStrip*chargeAbs/pathLen;
228 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->stereoId()) );
229 if(NSaturating>0)NClusterSaturating++;
T getParameter(std::string const &) const
DeDxEstimatorProducer(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const GeomDetUnit * monoDet() const
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
LocalVector localDirection() const
GlobalVector normalVector() const
void insert(const H &h, I begin, I end)
std::vector< DeDxHit > DeDxHitCollection
const Bounds & bounds() const
key_type key() const
Accessor for product key.
const Plane & surface() const
The nominal surface of the GeomDet.
LocalVector localMomentum() const
virtual float thickness() const =0
virtual void beginRun(edm::Run const &run, const edm::EventSetup &) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
DEFINE_FWK_MODULE(CosmicTrackingParticleSelector)
T const * product() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual const GeomDetUnit * detUnit() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
const GeomDetUnit * stereoDet() const