82 int& NClusterSaturating);
112 using namespace reco;
118 desc.
add<
string>(
"estimator",
"generic");
120 desc.
add<
bool>(
"UsePixel",
false);
121 desc.
add<
bool>(
"UseStrip",
true);
122 desc.
add<
double>(
"MeVperADCStrip", 3.61e-06 * 265);
123 desc.
add<
double>(
"MeVperADCPixel", 3.61e-06);
124 desc.
add<
bool>(
"ShapeTest",
true);
125 desc.
add<
bool>(
"UseCalibration",
false);
126 desc.
add<
string>(
"calibrationPath",
"");
127 desc.
add<
string>(
"Reccord",
"SiStripDeDxMip_3D_Rcd");
128 desc.
add<
string>(
"ProbabilityMode",
"Accumulation");
129 desc.
add<
double>(
"fraction", 0.4);
130 desc.
add<
double>(
"exponent", -2.0);
131 desc.
add<
bool>(
"convertFromGeV2MeV",
true);
132 desc.
add<
bool>(
"nothick",
false);
135 descriptions.
add(
"FastTrackDeDxProducer", desc);
140 simHit2RecHitMapToken(
142 produces<ValueMap<DeDxData>>();
144 auto cCollector = consumesCollector();
145 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
146 if (estimatorName ==
"median")
148 else if (estimatorName ==
"generic")
150 else if (estimatorName ==
"truncated")
153 else if (estimatorName ==
"productDiscrim")
155 else if (estimatorName ==
"btagDiscrim")
157 else if (estimatorName ==
"smirnovDiscrim")
159 else if (estimatorName ==
"asmirnovDiscrim")
162 throw cms::Exception(
"fastsim::SimplifiedGeometry::FastTrackDeDxProducer.cc") <<
" estimator name does not exist";
182 throw cms::Exception(
"fastsim::SimplifiedGeometry::FastTrackDeDxProducer.cc")
183 <<
" neither pixel hits nor strips hits will be used to compute de/dx";
185 if (useCalibration) {
186 tkGeomToken = esConsumes<edm::Transition::BeginRun>();
203 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
214 int NClusterSaturating = 0;
217 auto const& trajParams = track->extra()->trajParams();
218 assert(trajParams.size() == track->recHitsSize());
220 auto hb = track->recHitsBegin();
221 dedxHits.reserve(track->recHitsSize() / 2);
223 for (
unsigned int h = 0;
h < track->recHitsSize();
h++) {
227 auto trackDirection = trajParams[
h].direction();
228 float cosine = trackDirection.z() / trackDirection.mag();
229 processHit(recHit, track->p(), cosine, dedxHits, NClusterSaturating);
232 sort(dedxHits.begin(), dedxHits.end(), less<DeDxHit>());
233 std::pair<float, float> val_and_error =
m_estimator->dedx(dedxHits);
236 val_and_error.second = NClusterSaturating;
237 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size());
240 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
250 int& NClusterSaturating) {
257 if (!thit.hasPositionAndError())
264 auto& detUnit = *(recHit.
detUnit());
265 float pathLen = detUnit.surface().bounds().thickness() / fabs(cosine);
272 }
else if (!recHit.
isPixel()) {
275 auto& detUnit = *(recHit.
detUnit());
276 float pathLen = detUnit.surface().bounds().thickness() / fabs(cosine);
279 float dedxOfRecHit = recHit.
energyLoss() / pathLen;
281 dedxOfRecHit *= 1000;
void makeCalibrationMap(const TrackerGeometry &tkGeom)
FastTrackDeDxProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void processHit(const FastTrackerRecHit &recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
std::vector< DeDxHit > DeDxHitCollection
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken
bool getData(T &iHolder) const
std::vector< std::vector< float > > calibGains
~FastTrackDeDxProducer() override=default
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void beginRun(edm::Run const &, const edm::EventSetup &) override
edm::EDGetTokenT< edm::PSimHitContainer > simHitsToken
T const * product() const
bool isPixel() const override
pixel or strip?
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< FastTrackerRecHitRef > FastTrackerRecHitRefCollection
virtual const GeomDetUnit * detUnit() const
std::string m_calibrationPath
std::unique_ptr< BaseDeDxEstimator > m_estimator
std::vector< PSimHit > PSimHitContainer
DetId geographicalId() const
void produce(edm::Event &, const edm::EventSetup &) override
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.