33 desc.
add<
string>(
"estimator",
"generic");
35 desc.
add<
bool>(
"UsePixel",
false);
36 desc.
add<
bool>(
"UseStrip",
true);
37 desc.
add<
double>(
"MeVperADCPixel",3.61e-06*265);
38 desc.
add<
double>(
"MeVperADCStrip",3.61e-06);
39 desc.
add<
bool>(
"ShapeTest",
true);
40 desc.
add<
bool>(
"UseCalibration",
false);
41 desc.
add<
string>(
"calibrationPath",
"");
42 desc.
add<
string>(
"Reccord",
"SiStripDeDxMip_3D_Rcd");
43 desc.
add<
string>(
"ProbabilityMode",
"Accumulation");
44 desc.
add<
double>(
"fraction", 0.4);
45 desc.
add<
double>(
"exponent",-2.0);
47 descriptions.
add(
"DeDxEstimatorProducer",desc);
54 produces<ValueMap<DeDxData> >();
56 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
73 meVperADCPixel = iConfig.
getParameter<
double>(
"MeVperADCPixel");
74 meVperADCStrip = iConfig.
getParameter<
double>(
"MeVperADCStrip");
78 m_calibrationPath = iConfig.
getParameter<
string>(
"calibrationPath");
81 edm::LogWarning(
"DeDxHitsProducer") <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
102 m_estimator->beginRun(run, iSetup);
109 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
113 iEvent.
getByToken(m_tracksTag,trackCollectionHandle);
116 std::vector<DeDxData> dedxEstimate( trackCollectionHandle->size() );
118 for(
unsigned int j=0;j<trackCollectionHandle->size();j++){
121 int NClusterSaturating = 0;
124 auto const & trajParams = track->extra()->trajParams();
125 assert(trajParams.size()==track->recHitsSize());
126 auto hb = track->recHitsBegin();
127 dedxHits.reserve(track->recHitsSize()/2);
128 for(
unsigned int h=0;
h<track->recHitsSize();
h++){
130 if(!
recHit->isValid())
continue;
132 auto trackDirection = trajParams[
h].direction();
133 float cosine = trackDirection.z()/trackDirection.mag();
134 processHit(
recHit, track->p(), cosine, dedxHits, NClusterSaturating);
137 sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>());
138 std::pair<float,float> val_and_error = m_estimator->dedx(dedxHits);
142 val_and_error.second = NClusterSaturating;
143 dedxEstimate[j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() );
147 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
157 if(!thit.isValid())
return;
160 if(!clus.isValid())
return;
165 auto& detUnit = *(recHit->
detUnit());
166 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
167 float chargeAbs = clus.pixelCluster().charge();
168 float charge = meVperADCPixel*chargeAbs/pathLen;
169 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
170 }
else if(clus.isStrip() && !thit.isMatched()){
173 auto& detUnit = *(recHit->
detUnit());
175 float pathLen = detUnit.surface().bounds().thickness()/fabs(cosine);
176 float chargeAbs =
DeDxTools::getCharge(&(clus.stripCluster()),NSaturating, detUnit, calibGains, m_off);
177 float charge = meVperADCStrip*chargeAbs/pathLen;
179 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
180 if(NSaturating>0)NClusterSaturating++;
182 }
else if(clus.isStrip() && thit.isMatched()){
185 if(!matchedHit)
return;
188 auto& detUnitM = *(gdet->
monoDet());
192 float charge = meVperADCStrip*chargeAbs/pathLen;
194 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->
monoId()) );
195 if(NSaturating>0)NClusterSaturating++;
200 pathLen = detUnitS.surface().bounds().thickness()/fabs(cosine);
202 charge = meVperADCStrip*chargeAbs/pathLen;
204 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->
stereoId()) );
205 if(NSaturating>0)NClusterSaturating++;
T getParameter(std::string const &) const
DeDxEstimatorProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
SiStripCluster const & monoCluster() const
std::vector< DeDxHit > DeDxHitCollection
const Bounds & bounds() const
const Plane & surface() const
The nominal surface of the GeomDet.
virtual void beginRun(edm::Run const &run, const edm::EventSetup &) override
const GeomDet * det() const
unsigned int offsetDU(SubDetector sid) 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
virtual float thickness() const =0
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
virtual OmniClusterRef const & firstClusterRef() const =0
unsigned int monoId() const
const GeomDetUnit * stereoDet() const