31 desc.add<
string>(
"estimator",
"generic");
33 desc.add<
bool>(
"UsePixel",
false);
34 desc.add<
bool>(
"UseStrip",
true);
35 desc.add<
double>(
"MeVperADCPixel", 3.61e-06);
36 desc.add<
double>(
"MeVperADCStrip", 3.61e-06 * 265);
37 desc.add<
bool>(
"ShapeTest",
true);
38 desc.add<
bool>(
"UseCalibration",
false);
39 desc.add<
string>(
"calibrationPath",
"");
40 desc.add<
string>(
"Reccord",
"SiStripDeDxMip_3D_Rcd");
41 desc.add<
string>(
"ProbabilityMode",
"Accumulation");
42 desc.add<
double>(
"fraction", 0.4);
43 desc.add<
double>(
"exponent", -2.0);
45 descriptions.
add(
"DeDxEstimatorProducer",
desc);
50 produces<ValueMap<DeDxData>>();
52 auto cCollector = consumesCollector();
53 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
54 if (estimatorName ==
"median")
55 m_estimator = std::make_unique<MedianDeDxEstimator>(iConfig);
56 else if (estimatorName ==
"generic")
57 m_estimator = std::make_unique<GenericAverageDeDxEstimator>(iConfig);
58 else if (estimatorName ==
"truncated")
59 m_estimator = std::make_unique<TruncatedAverageDeDxEstimator>(iConfig);
60 else if (estimatorName ==
"genericTruncated")
61 m_estimator = std::make_unique<GenericTruncatedAverageDeDxEstimator>(iConfig);
62 else if (estimatorName ==
"unbinnedFit")
63 m_estimator = std::make_unique<UnbinnedFitDeDxEstimator>(iConfig);
64 else if (estimatorName ==
"productDiscrim")
65 m_estimator = std::make_unique<ProductDeDxDiscriminator>(iConfig, cCollector);
66 else if (estimatorName ==
"btagDiscrim")
67 m_estimator = std::make_unique<BTagLikeDeDxDiscriminator>(iConfig, cCollector);
68 else if (estimatorName ==
"smirnovDiscrim")
69 m_estimator = std::make_unique<SmirnovDeDxDiscriminator>(iConfig, cCollector);
70 else if (estimatorName ==
"asmirnovDiscrim")
71 m_estimator = std::make_unique<ASmirnovDeDxDiscriminator>(iConfig, cCollector);
89 <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
107 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
113 std::vector<DeDxData> dedxEstimate(trackCollectionHandle->size());
115 for (
unsigned int j = 0;
j < trackCollectionHandle->size();
j++) {
118 int NClusterSaturating = 0;
121 auto const& trajParams =
track->extra()->trajParams();
123 auto hb =
track->recHitsBegin();
124 dedxHits.reserve(
track->recHitsSize() / 2);
125 for (
unsigned int h = 0;
h <
track->recHitsSize();
h++) {
130 auto trackDirection = trajParams[
h].direction();
131 float cosine = trackDirection.z() / trackDirection.mag();
135 sort(dedxHits.begin(), dedxHits.end(), less<DeDxHit>());
136 std::pair<float, float> val_and_error =
m_estimator->dedx(dedxHits);
140 val_and_error.second = NClusterSaturating;
141 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size());
145 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
156 int& NClusterSaturating) {
157 auto const& thit = static_cast<BaseTrackerRecHit const&>(*
recHit);
161 auto const& clus = thit.firstClusterRef();
165 if (clus.isPixel()) {
169 const auto* detUnit =
recHit->detUnit();
170 if (detUnit ==
nullptr)
173 float chargeAbs = clus.pixelCluster().charge();
176 }
else if (clus.isStrip() && !thit.isMatched()) {
180 const auto* detUnit =
recHit->detUnit();
181 if (detUnit ==
nullptr)
190 NClusterSaturating++;
192 }
else if (clus.isStrip() && thit.isMatched()) {
198 const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(matchedHit->
det());
200 gdet = static_cast<const GluedGeomDet*>(
tkGeom->
idToDet(thit.geographicalId()));
202 auto& detUnitM = *(gdet->
monoDet());
204 float pathLen = detUnitM.surface().bounds().thickness() / fabs(cosine);
210 NClusterSaturating++;
215 pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
221 NClusterSaturating++;