30 desc.
add<
string>(
"estimator",
"generic");
32 desc.
add<
bool>(
"UsePixel",
false);
33 desc.
add<
bool>(
"UseStrip",
true);
34 desc.
add<
double>(
"MeVperADCPixel", 3.61e-06);
35 desc.
add<
double>(
"MeVperADCStrip", 3.61e-06 * 265);
36 desc.
add<
bool>(
"ShapeTest",
true);
37 desc.
add<
bool>(
"UseCalibration",
false);
38 desc.
add<
string>(
"calibrationPath",
"");
39 desc.
add<
string>(
"Reccord",
"SiStripDeDxMip_3D_Rcd");
40 desc.
add<
string>(
"ProbabilityMode",
"Accumulation");
41 desc.
add<
double>(
"fraction", 0.4);
42 desc.
add<
double>(
"exponent", -2.0);
44 descriptions.
add(
"DeDxEstimatorProducer", desc);
48 produces<ValueMap<DeDxData>>();
50 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
51 if (estimatorName ==
"median")
53 else if (estimatorName ==
"generic")
55 else if (estimatorName ==
"truncated")
57 else if (estimatorName ==
"genericTruncated")
59 else if (estimatorName ==
"unbinnedFit")
61 else if (estimatorName ==
"productDiscrim")
63 else if (estimatorName ==
"btagDiscrim")
65 else if (estimatorName ==
"smirnovDiscrim")
67 else if (estimatorName ==
"asmirnovDiscrim")
77 meVperADCPixel = iConfig.
getParameter<
double>(
"MeVperADCPixel");
78 meVperADCStrip = iConfig.
getParameter<
double>(
"MeVperADCStrip");
82 m_calibrationPath = iConfig.
getParameter<
string>(
"calibrationPath");
86 <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
100 m_estimator->beginRun(run, iSetup);
104 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
108 iEvent.
getByToken(m_tracksTag, trackCollectionHandle);
110 std::vector<DeDxData> dedxEstimate(trackCollectionHandle->size());
112 for (
unsigned int j = 0;
j < trackCollectionHandle->size();
j++) {
115 int NClusterSaturating = 0;
118 auto const& trajParams = track->extra()->trajParams();
119 assert(trajParams.size() == track->recHitsSize());
120 auto hb = track->recHitsBegin();
121 dedxHits.reserve(track->recHitsSize() / 2);
122 for (
unsigned int h = 0;
h < track->recHitsSize();
h++) {
127 auto trackDirection = trajParams[
h].direction();
128 float cosine = trackDirection.z() / trackDirection.mag();
129 processHit(
recHit, track->p(), cosine, dedxHits, NClusterSaturating);
132 sort(dedxHits.begin(), dedxHits.end(), less<DeDxHit>());
133 std::pair<float, float> val_and_error = m_estimator->dedx(dedxHits);
137 val_and_error.second = NClusterSaturating;
138 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size());
142 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
153 int& NClusterSaturating) {
158 auto const& clus = thit.firstClusterRef();
162 if (clus.isPixel()) {
166 const auto* detUnit = recHit->
detUnit();
167 if (detUnit ==
nullptr)
168 detUnit = tkGeom->idToDet(thit.geographicalId());
170 float chargeAbs = clus.pixelCluster().charge();
171 float charge = meVperADCPixel * chargeAbs / pathLen;
172 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, thit.geographicalId()));
173 }
else if (clus.isStrip() && !thit.isMatched()) {
177 const auto* detUnit = recHit->
detUnit();
178 if (detUnit ==
nullptr)
179 detUnit = tkGeom->idToDet(thit.geographicalId());
182 float chargeAbs =
DeDxTools::getCharge(&(clus.stripCluster()), NSaturating, *detUnit, calibGains, m_off);
183 float charge = meVperADCStrip * chargeAbs / pathLen;
185 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, thit.geographicalId()));
187 NClusterSaturating++;
189 }
else if (clus.isStrip() && thit.isMatched()) {
197 gdet =
static_cast<const GluedGeomDet*
>(tkGeom->idToDet(thit.geographicalId()));
199 auto& detUnitM = *(gdet->
monoDet());
203 float charge = meVperADCStrip * chargeAbs / pathLen;
205 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, matchedHit->
monoId()));
207 NClusterSaturating++;
212 pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
214 charge = meVperADCStrip * chargeAbs / pathLen;
216 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, matchedHit->
stereoId()));
218 NClusterSaturating++;
T getParameter(std::string const &) const
DeDxEstimatorProducer(const edm::ParameterSet &)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
bool isFromDet(TrackingRecHit const &hit)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
SiStripCluster const & monoCluster() const
std::vector< DeDxHit > DeDxHitCollection
const Bounds & bounds() const
const Plane & surface() const
The nominal surface of the GeomDet.
void beginRun(edm::Run const &run, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
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
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
void produce(edm::Event &, const edm::EventSetup &) override
unsigned int monoId() const
~DeDxEstimatorProducer() override
const GeomDetUnit * stereoDet() const