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();
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) {
154 auto const& thit = static_cast<BaseTrackerRecHit const&>(*
recHit);
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());
169 float pathLen = detUnit->surface().bounds().thickness() / fabs(cosine);
170 float chargeAbs = clus.pixelCluster().charge();
171 float charge = meVperADCPixel * chargeAbs / pathLen;
173 }
else if (clus.isStrip() && !thit.isMatched()) {
177 const auto* detUnit =
recHit->detUnit();
178 if (detUnit ==
nullptr)
179 detUnit = tkGeom->idToDet(thit.geographicalId());
181 float pathLen = detUnit->surface().bounds().thickness() / fabs(cosine);
182 float chargeAbs =
DeDxTools::getCharge(&(clus.stripCluster()), NSaturating, *detUnit, calibGains, m_off);
183 float charge = meVperADCStrip * chargeAbs / pathLen;
187 NClusterSaturating++;
189 }
else if (clus.isStrip() && thit.isMatched()) {
195 const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(matchedHit->
det());
197 gdet = static_cast<const GluedGeomDet*>(tkGeom->idToDet(thit.geographicalId()));
199 auto& detUnitM = *(gdet->
monoDet());
201 float pathLen = detUnitM.surface().bounds().thickness() / fabs(cosine);
203 float charge = meVperADCStrip * chargeAbs / pathLen;
207 NClusterSaturating++;
212 pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
214 charge = meVperADCStrip * chargeAbs / pathLen;
218 NClusterSaturating++;