81 int& NClusterSaturating);
111 using namespace reco;
117 desc.
add<
string>(
"estimator",
"generic");
119 desc.
add<
bool>(
"UsePixel",
false);
120 desc.
add<
bool>(
"UseStrip",
true);
121 desc.
add<
double>(
"MeVperADCStrip", 3.61e-06 * 265);
122 desc.
add<
double>(
"MeVperADCPixel", 3.61e-06);
123 desc.
add<
bool>(
"ShapeTest",
true);
124 desc.
add<
bool>(
"UseCalibration",
false);
125 desc.
add<
string>(
"calibrationPath",
"");
126 desc.
add<
string>(
"Reccord",
"SiStripDeDxMip_3D_Rcd");
127 desc.
add<
string>(
"ProbabilityMode",
"Accumulation");
128 desc.
add<
double>(
"fraction", 0.4);
129 desc.
add<
double>(
"exponent", -2.0);
130 desc.
add<
bool>(
"convertFromGeV2MeV",
true);
131 desc.
add<
bool>(
"nothick",
false);
134 descriptions.
add(
"FastTrackDeDxProducer", desc);
141 produces<ValueMap<DeDxData>>();
143 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
144 if (estimatorName ==
"median")
146 else if (estimatorName ==
"generic")
148 else if (estimatorName ==
"truncated")
151 else if (estimatorName ==
"productDiscrim")
153 else if (estimatorName ==
"btagDiscrim")
155 else if (estimatorName ==
"smirnovDiscrim")
157 else if (estimatorName ==
"asmirnovDiscrim")
160 throw cms::Exception(
"fastsim::SimplifiedGeometry::FastTrackDeDxProducer.cc") <<
" estimator name does not exist";
180 throw cms::Exception(
"fastsim::SimplifiedGeometry::FastTrackDeDxProducer.cc")
181 <<
" neither pixel hits nor strips hits will be used to compute de/dx";
198 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
209 int NClusterSaturating = 0;
212 auto const& trajParams = track->extra()->trajParams();
213 assert(trajParams.size() == track->recHitsSize());
215 auto hb = track->recHitsBegin();
216 dedxHits.reserve(track->recHitsSize() / 2);
218 for (
unsigned int h = 0;
h < track->recHitsSize();
h++) {
222 auto trackDirection = trajParams[
h].direction();
223 float cosine = trackDirection.z() / trackDirection.mag();
224 processHit(recHit, track->p(), cosine, dedxHits, NClusterSaturating);
227 sort(dedxHits.begin(), dedxHits.end(), less<DeDxHit>());
228 std::pair<float, float> val_and_error =
m_estimator->dedx(dedxHits);
231 val_and_error.second = NClusterSaturating;
232 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size());
235 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
245 int& NClusterSaturating) {
252 if (!thit.hasPositionAndError())
259 auto& detUnit = *(recHit.
detUnit());
260 float pathLen = detUnit.surface().bounds().thickness() / fabs(cosine);
267 }
else if (!recHit.
isPixel()) {
270 auto& detUnit = *(recHit.
detUnit());
271 float pathLen = detUnit.surface().bounds().thickness() / fabs(cosine);
274 float dedxOfRecHit = recHit.
energyLoss() / pathLen;
276 dedxOfRecHit *= 1000;
T getParameter(std::string const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
std::vector< DeDxHit > DeDxHitCollection
std::vector< std::vector< float > > calibGains
#define DEFINE_FWK_MODULE(type)
~FastTrackDeDxProducer() override=default
unsigned int offsetDU(SubDetector sid) const
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::PSimHitContainer > simHitsToken
void beginRun(edm::Run const &run, const edm::EventSetup &) override
T const * product() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool isPixel() const override
pixel or strip?
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