31 desc.add<
string>(
"estimator",
"generic");
33 desc.add<
bool>(
"UseDeDxHits",
false);
36 desc.add<
bool>(
"UsePixel",
false);
37 desc.add<
bool>(
"UseStrip",
true);
38 desc.add<
double>(
"MeVperADCPixel", 3.61e-06);
39 desc.add<
double>(
"MeVperADCStrip", 3.61e-06 * 265);
40 desc.add<
bool>(
"ShapeTest",
true);
41 desc.add<
bool>(
"UseCalibration",
false);
42 desc.add<
string>(
"calibrationPath",
"");
43 desc.add<
string>(
"Record",
"SiStripDeDxMip_3D_Rcd");
44 desc.add<
string>(
"ProbabilityMode",
"Accumulation");
45 desc.add<
double>(
"fraction", 0.4);
46 desc.add<
double>(
"exponent", -2.0);
47 desc.add<
bool>(
"truncate",
true);
49 descriptions.
add(
"DeDxEstimatorProducer",
desc);
54 produces<ValueMap<DeDxData>>();
56 auto cCollector = consumesCollector();
57 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
58 if (estimatorName ==
"median")
59 m_estimator = std::make_unique<MedianDeDxEstimator>(iConfig);
60 else if (estimatorName ==
"generic")
61 m_estimator = std::make_unique<GenericAverageDeDxEstimator>(iConfig);
62 else if (estimatorName ==
"truncated")
63 m_estimator = std::make_unique<TruncatedAverageDeDxEstimator>(iConfig);
64 else if (estimatorName ==
"genericTruncated")
65 m_estimator = std::make_unique<GenericTruncatedAverageDeDxEstimator>(iConfig);
66 else if (estimatorName ==
"unbinnedFit")
67 m_estimator = std::make_unique<UnbinnedFitDeDxEstimator>(iConfig);
68 else if (estimatorName ==
"likelihoodFit")
69 m_estimator = std::make_unique<LikelihoodFitDeDxEstimator>(iConfig);
70 else if (estimatorName ==
"productDiscrim")
71 m_estimator = std::make_unique<ProductDeDxDiscriminator>(iConfig, cCollector);
72 else if (estimatorName ==
"btagDiscrim")
73 m_estimator = std::make_unique<BTagLikeDeDxDiscriminator>(iConfig, cCollector);
74 else if (estimatorName ==
"smirnovDiscrim")
75 m_estimator = std::make_unique<SmirnovDeDxDiscriminator>(iConfig, cCollector);
76 else if (estimatorName ==
"asmirnovDiscrim")
77 m_estimator = std::make_unique<ASmirnovDeDxDiscriminator>(iConfig, cCollector);
84 useDeDxHits = iConfig.getParameter<
bool>(
"UseDeDxHits");
88 usePixel = iConfig.getParameter<
bool>(
"UsePixel");
89 useStrip = iConfig.getParameter<
bool>(
"UseStrip");
93 shapetest = iConfig.getParameter<
bool>(
"ShapeTest");
99 <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
117 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
125 std::vector<DeDxData> dedxEstimate(trackCollectionHandle->size());
127 for (
unsigned int j = 0;
j < trackCollectionHandle->size();
j++) {
130 int NClusterSaturating = 0;
135 dedxHits = (*pixelDeDxHits)[
track];
137 const auto&
hits = (*stripDeDxHits)[
track];
138 dedxHits.insert(dedxHits.end(),
hits.begin(),
hits.end());
141 auto const& trajParams =
track->extra()->trajParams();
143 auto hb =
track->recHitsBegin();
144 dedxHits.reserve(
track->recHitsSize() / 2);
145 for (
unsigned int h = 0;
h <
track->recHitsSize();
h++) {
150 auto trackDirection = trajParams[
h].direction();
151 float cosine = trackDirection.z() / trackDirection.mag();
156 sort(dedxHits.begin(), dedxHits.end(), less<DeDxHit>());
157 std::pair<float, float> val_and_error =
m_estimator->dedx(dedxHits);
161 val_and_error.second = NClusterSaturating;
162 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size());
166 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
177 int& NClusterSaturating) {
182 auto const& clus = thit.firstClusterRef();
186 if (clus.isPixel()) {
190 const auto* detUnit =
recHit->detUnit();
191 if (detUnit ==
nullptr)
194 float chargeAbs = clus.pixelCluster().charge();
197 }
else if (clus.isStrip() && !thit.isMatched()) {
201 const auto* detUnit =
recHit->detUnit();
202 if (detUnit ==
nullptr)
211 NClusterSaturating++;
213 }
else if (clus.isStrip() && thit.isMatched()) {
223 auto& detUnitM = *(gdet->
monoDet());
231 NClusterSaturating++;
236 pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
242 NClusterSaturating++;
DeDxEstimatorProducer(const edm::ParameterSet &)
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isFromDet(TrackingRecHit const &hit)
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
unsigned int offsetDU(SubDetector sid) const
std::vector< DeDxHit > DeDxHitCollection
edm::EDGetTokenT< reco::TrackDeDxHitsCollection > m_stripDeDxHitsTag
unsigned int stereoId() const
std::unique_ptr< BaseDeDxEstimator > m_estimator
const GeomDet * det() const
edm::EDGetTokenT< reco::TrackDeDxHitsCollection > m_pixelDeDxHitsTag
virtual float thickness() const =0
void beginRun(edm::Run const &run, const edm::EventSetup &) override
SiStripCluster const & monoCluster() const
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
#define DEFINE_FWK_MODULE(type)
const TrackerGeomDet * idToDet(DetId) const override
const GeomDetUnit * monoDet() const
unsigned int monoId() const
const Plane & surface() const
The nominal surface of the GeomDet.
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
const GeomDetUnit * stereoDet() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const TrackerGeometry * tkGeom
SiStripCluster const & stereoCluster() const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken
void produce(edm::Event &, const edm::EventSetup &) override
~DeDxEstimatorProducer() override
Log< level::Warning, false > LogWarning
std::string m_calibrationPath
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::vector< std::vector< float > > calibGains
const Bounds & bounds() const