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>(
"Record",
"SiStripDeDxMip_3D_Rcd");
41 desc.add<
string>(
"ProbabilityMode",
"Accumulation");
42 desc.add<
double>(
"fraction", 0.4);
43 desc.add<
double>(
"exponent", -2.0);
44 desc.add<
bool>(
"truncate",
true);
46 descriptions.
add(
"DeDxEstimatorProducer",
desc);
51 produces<ValueMap<DeDxData>>();
53 auto cCollector = consumesCollector();
54 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
55 if (estimatorName ==
"median")
56 m_estimator = std::make_unique<MedianDeDxEstimator>(iConfig);
57 else if (estimatorName ==
"generic")
58 m_estimator = std::make_unique<GenericAverageDeDxEstimator>(iConfig);
59 else if (estimatorName ==
"truncated")
60 m_estimator = std::make_unique<TruncatedAverageDeDxEstimator>(iConfig);
61 else if (estimatorName ==
"genericTruncated")
62 m_estimator = std::make_unique<GenericTruncatedAverageDeDxEstimator>(iConfig);
63 else if (estimatorName ==
"unbinnedFit")
64 m_estimator = std::make_unique<UnbinnedFitDeDxEstimator>(iConfig);
65 else if (estimatorName ==
"productDiscrim")
66 m_estimator = std::make_unique<ProductDeDxDiscriminator>(iConfig, cCollector);
67 else if (estimatorName ==
"btagDiscrim")
68 m_estimator = std::make_unique<BTagLikeDeDxDiscriminator>(iConfig, cCollector);
69 else if (estimatorName ==
"smirnovDiscrim")
70 m_estimator = std::make_unique<SmirnovDeDxDiscriminator>(iConfig, cCollector);
71 else if (estimatorName ==
"asmirnovDiscrim")
72 m_estimator = std::make_unique<ASmirnovDeDxDiscriminator>(iConfig, cCollector);
79 usePixel = iConfig.getParameter<
bool>(
"UsePixel");
80 useStrip = iConfig.getParameter<
bool>(
"UseStrip");
84 shapetest = iConfig.getParameter<
bool>(
"ShapeTest");
90 <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
108 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
114 std::vector<DeDxData> dedxEstimate(trackCollectionHandle->size());
116 for (
unsigned int j = 0;
j < trackCollectionHandle->size();
j++) {
119 int NClusterSaturating = 0;
122 auto const& trajParams =
track->extra()->trajParams();
124 auto hb =
track->recHitsBegin();
125 dedxHits.reserve(
track->recHitsSize() / 2);
126 for (
unsigned int h = 0;
h <
track->recHitsSize();
h++) {
131 auto trackDirection = trajParams[
h].direction();
132 float cosine = trackDirection.z() / trackDirection.mag();
136 sort(dedxHits.begin(), dedxHits.end(), less<DeDxHit>());
137 std::pair<float, float> val_and_error =
m_estimator->dedx(dedxHits);
141 val_and_error.second = NClusterSaturating;
142 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size());
146 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
157 int& NClusterSaturating) {
162 auto const& clus = thit.firstClusterRef();
166 if (clus.isPixel()) {
170 const auto* detUnit =
recHit->detUnit();
171 if (detUnit ==
nullptr)
174 float chargeAbs = clus.pixelCluster().charge();
177 }
else if (clus.isStrip() && !thit.isMatched()) {
181 const auto* detUnit =
recHit->detUnit();
182 if (detUnit ==
nullptr)
191 NClusterSaturating++;
193 }
else if (clus.isStrip() && thit.isMatched()) {
203 auto& detUnitM = *(gdet->
monoDet());
211 NClusterSaturating++;
216 pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
222 NClusterSaturating++;
DeDxEstimatorProducer(const edm::ParameterSet &)
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isFromDet(TrackingRecHit const &hit)
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
#define DEFINE_FWK_MODULE(type)
unsigned int offsetDU(SubDetector sid) const
T const * product() const
std::vector< DeDxHit > DeDxHitCollection
unsigned int stereoId() const
std::unique_ptr< BaseDeDxEstimator > m_estimator
const GeomDet * det() const
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)
bool getData(T &iHolder) const
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