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 dedxHits.reserve(measurements.size()/2);
136 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
138 if( !trajState.
isValid())
continue;
141 if(!recHit || !recHit->
isValid())
continue;
143 float cosine = trackDirection.
z()/trackDirection.
mag();
145 processHit(recHit, trajState.
localMomentum().
mag(), cosine, dedxHits, NClusterSaturating);
148 dedxHits.reserve(track->recHitsSize()/2);
149 for(
unsigned int h=0;
h<track->recHitsSize();
h++){
151 if(!recHit || !recHit->
isValid())
continue;
153 if(!thit.isValid())
continue;
156 float cosine = (track->px()*ModuleNormal.
x()+track->py()*ModuleNormal.
y()+track->pz()*ModuleNormal.
z())/track->p();
158 processHit(recHit, track->p(), cosine, dedxHits, NClusterSaturating);
162 sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>());
163 std::pair<float,float> val_and_error = m_estimator->dedx(dedxHits);
167 val_and_error.second = NClusterSaturating;
168 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() );
172 filler.
insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
176 iEvent.
put(trackDeDxEstimateAssociation);
182 if(!thit.isValid())
return;
184 auto const & clus = thit.firstClusterRef();
185 if(!clus.isValid())
return;
188 if(!usePixel)
return;
190 auto& detUnit = *(recHit->
detUnit());
191 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
192 float chargeAbs = clus.pixelCluster().charge();
193 float charge = meVperADCPixel*chargeAbs/pathLen;
194 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
195 }
else if(clus.isStrip() && !thit.isMatched()){
196 if(!useStrip)
return;
198 auto& detUnit = *(recHit->
detUnit());
200 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
201 float chargeAbs =
DeDxTools::getCharge(&(clus.stripCluster()),NSaturating, detUnit, calibGains, m_off);
202 float charge = meVperADCStrip*chargeAbs/pathLen;
204 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
205 if(NSaturating>0)NClusterSaturating++;
207 }
else if(clus.isStrip() && thit.isMatched()){
208 if(!useStrip)
return;
210 if(!matchedHit)
return;
213 auto& detUnitM = *(gdet->
monoDet());
217 float charge = meVperADCStrip*chargeAbs/pathLen;
219 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->
monoId()) );
220 if(NSaturating>0)NClusterSaturating++;
225 pathLen = detUnitS.surface().bounds().thickness()/fabs(cosine);
227 charge = meVperADCStrip*chargeAbs/pathLen;
229 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->
stereoId()) );
230 if(NSaturating>0)NClusterSaturating++;
T getParameter(std::string const &) const
DeDxEstimatorProducer(const edm::ParameterSet &)
unsigned int stereoId() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const GeomDetUnit * monoDet() 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)
SiStripCluster const & monoCluster() 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.
const GeomDet * det() const
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const * product() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
SiStripCluster const & stereoCluster() const
virtual const GeomDetUnit * detUnit() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
unsigned int monoId() const
const GeomDetUnit * stereoDet() const