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")
56 else if (estimatorName ==
"generic")
58 else if (estimatorName ==
"truncated")
60 else if (estimatorName ==
"genericTruncated")
62 else if (estimatorName ==
"unbinnedFit")
64 else if (estimatorName ==
"productDiscrim")
66 else if (estimatorName ==
"btagDiscrim")
68 else if (estimatorName ==
"smirnovDiscrim")
70 else if (estimatorName ==
"asmirnovDiscrim")
78 usePixel = iConfig.getParameter<
bool>(
"UsePixel");
79 useStrip = iConfig.getParameter<
bool>(
"UseStrip");
83 shapetest = iConfig.getParameter<
bool>(
"ShapeTest");
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();
122 assert(trajParams.size() == track->recHitsSize());
123 auto hb = track->recHitsBegin();
124 dedxHits.reserve(track->recHitsSize() / 2);
125 for (
unsigned int h = 0;
h < track->recHitsSize();
h++) {
126 auto recHit = *(hb +
h);
130 auto trackDirection = trajParams[
h].direction();
131 float cosine = trackDirection.z() / trackDirection.mag();
132 processHit(recHit, track->p(), cosine, dedxHits, NClusterSaturating);
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) {
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();
175 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, thit.geographicalId()));
176 }
else if (clus.isStrip() && !thit.isMatched()) {
180 const auto* detUnit = recHit->
detUnit();
181 if (detUnit ==
nullptr)
188 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, thit.geographicalId()));
190 NClusterSaturating++;
192 }
else if (clus.isStrip() && thit.isMatched()) {
202 auto& detUnitM = *(gdet->
monoDet());
208 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, matchedHit->
monoId()));
210 NClusterSaturating++;
215 pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
219 dedxHits.push_back(
DeDxHit(charge, trackMomentum, pathLen, matchedHit->
stereoId()));
221 NClusterSaturating++;
DeDxEstimatorProducer(const edm::ParameterSet &)
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)
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
SiStripCluster const & monoCluster() const
std::vector< DeDxHit > DeDxHitCollection
const Bounds & bounds() const
const Plane & surface() const
The nominal surface of the GeomDet.
std::unique_ptr< BaseDeDxEstimator > m_estimator
virtual float thickness() const =0
bool getData(T &iHolder) const
void beginRun(edm::Run const &run, const edm::EventSetup &) override
const GeomDet * det() const
unsigned int offsetDU(SubDetector sid) const
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const TrackerGeomDet * idToDet(DetId) const override
T const * product() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const TrackerGeometry * tkGeom
SiStripCluster const & stereoCluster() const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken
virtual const GeomDetUnit * detUnit() const
void produce(edm::Event &, const edm::EventSetup &) override
unsigned int monoId() const
~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.
const GeomDetUnit * stereoDet() const
std::vector< std::vector< float > > calibGains