CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DeDxEstimatorProducer Class Reference

#include <RecoTracker/DeDxEstimatorProducer/src/DeDxEstimatorProducer.cc>

Inheritance diagram for DeDxEstimatorProducer:
edm::stream::EDProducer<>

Public Member Functions

 DeDxEstimatorProducer (const edm::ParameterSet &)
 
 ~DeDxEstimatorProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginRun (edm::Run const &run, const edm::EventSetup &) override
 
void makeCalibrationMap (const TrackerGeometry &tkGeom)
 
void processHit (const TrackingRecHit *recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< std::vector< float > > calibGains
 
std::string m_calibrationPath
 
BaseDeDxEstimatorm_estimator
 
unsigned int m_off
 
edm::EDGetTokenT< reco::TrackCollectionm_tracksTag
 
unsigned int MaxNrStrips
 
float meVperADCPixel
 
float meVperADCStrip
 
bool shapetest
 
edm::ESHandle< TrackerGeometrytkGeom
 
bool useCalibration
 
bool usePixel
 
bool useStrip
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 45 of file DeDxEstimatorProducer.h.

Constructor & Destructor Documentation

◆ DeDxEstimatorProducer()

DeDxEstimatorProducer::DeDxEstimatorProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 47 of file DeDxEstimatorProducer.cc.

47  {
48  produces<ValueMap<DeDxData>>();
49 
50  string estimatorName = iConfig.getParameter<string>("estimator");
51  if (estimatorName == "median")
52  m_estimator = new MedianDeDxEstimator(iConfig);
53  else if (estimatorName == "generic")
55  else if (estimatorName == "truncated")
57  else if (estimatorName == "genericTruncated")
59  else if (estimatorName == "unbinnedFit")
61  else if (estimatorName == "productDiscrim")
63  else if (estimatorName == "btagDiscrim")
65  else if (estimatorName == "smirnovDiscrim")
67  else if (estimatorName == "asmirnovDiscrim")
69 
70  //Commented for now, might be used in the future
71  // MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips" , 255);
72 
73  m_tracksTag = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"));
74 
75  usePixel = iConfig.getParameter<bool>("UsePixel");
76  useStrip = iConfig.getParameter<bool>("UseStrip");
77  meVperADCPixel = iConfig.getParameter<double>("MeVperADCPixel");
78  meVperADCStrip = iConfig.getParameter<double>("MeVperADCStrip");
79 
80  shapetest = iConfig.getParameter<bool>("ShapeTest");
81  useCalibration = iConfig.getParameter<bool>("UseCalibration");
82  m_calibrationPath = iConfig.getParameter<string>("calibrationPath");
83 
84  if (!usePixel && !useStrip)
85  edm::LogWarning("DeDxHitsProducer")
86  << "Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
87 }

References edm::ParameterSet::getParameter(), dedxEstimators_cff::useCalibration, dedxEstimators_cff::usePixel, and dedxEstimators_cff::useStrip.

◆ ~DeDxEstimatorProducer()

DeDxEstimatorProducer::~DeDxEstimatorProducer ( )
override

Definition at line 89 of file DeDxEstimatorProducer.cc.

89 { delete m_estimator; }

Member Function Documentation

◆ beginRun()

void DeDxEstimatorProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
overrideprivate

◆ fillDescriptions()

void DeDxEstimatorProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 28 of file DeDxEstimatorProducer.cc.

28  {
30  desc.add<string>("estimator", "generic");
31  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
32  desc.add<bool>("UsePixel", false);
33  desc.add<bool>("UseStrip", true);
34  desc.add<double>("MeVperADCPixel", 3.61e-06);
35  desc.add<double>("MeVperADCStrip", 3.61e-06 * 265);
36  desc.add<bool>("ShapeTest", true);
37  desc.add<bool>("UseCalibration", false);
38  desc.add<string>("calibrationPath", "");
39  desc.add<string>("Reccord", "SiStripDeDxMip_3D_Rcd");
40  desc.add<string>("ProbabilityMode", "Accumulation");
41  desc.add<double>("fraction", 0.4);
42  desc.add<double>("exponent", -2.0);
43 
44  descriptions.add("DeDxEstimatorProducer", desc);
45 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

◆ makeCalibrationMap()

void DeDxEstimatorProducer::makeCalibrationMap ( const TrackerGeometry tkGeom)
private

◆ processHit()

void DeDxEstimatorProducer::processHit ( const TrackingRecHit recHit,
float  trackMomentum,
float &  cosine,
reco::DeDxHitCollection dedxHits,
int &  NClusterSaturating 
)
private

Definition at line 149 of file DeDxEstimatorProducer.cc.

153  {
154  auto const& thit = static_cast<BaseTrackerRecHit const&>(*recHit);
155  if (!thit.isValid())
156  return;
157 
158  auto const& clus = thit.firstClusterRef();
159  if (!clus.isValid())
160  return;
161 
162  if (clus.isPixel()) {
163  if (!usePixel)
164  return;
165 
166  const auto* detUnit = recHit->detUnit();
167  if (detUnit == nullptr)
168  detUnit = tkGeom->idToDet(thit.geographicalId());
169  float pathLen = detUnit->surface().bounds().thickness() / fabs(cosine);
170  float chargeAbs = clus.pixelCluster().charge();
171  float charge = meVperADCPixel * chargeAbs / pathLen;
172  dedxHits.push_back(DeDxHit(charge, trackMomentum, pathLen, thit.geographicalId()));
173  } else if (clus.isStrip() && !thit.isMatched()) {
174  if (!useStrip)
175  return;
176 
177  const auto* detUnit = recHit->detUnit();
178  if (detUnit == nullptr)
179  detUnit = tkGeom->idToDet(thit.geographicalId());
180  int NSaturating = 0;
181  float pathLen = detUnit->surface().bounds().thickness() / fabs(cosine);
182  float chargeAbs = DeDxTools::getCharge(&(clus.stripCluster()), NSaturating, *detUnit, calibGains, m_off);
183  float charge = meVperADCStrip * chargeAbs / pathLen;
184  if (!shapetest || (shapetest && DeDxTools::shapeSelection(clus.stripCluster()))) {
185  dedxHits.push_back(DeDxHit(charge, trackMomentum, pathLen, thit.geographicalId()));
186  if (NSaturating > 0)
187  NClusterSaturating++;
188  }
189  } else if (clus.isStrip() && thit.isMatched()) {
190  if (!useStrip)
191  return;
192  const SiStripMatchedRecHit2D* matchedHit = dynamic_cast<const SiStripMatchedRecHit2D*>(recHit);
193  if (!matchedHit)
194  return;
195  const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(matchedHit->det());
196  if (gdet == nullptr)
197  gdet = static_cast<const GluedGeomDet*>(tkGeom->idToDet(thit.geographicalId()));
198 
199  auto& detUnitM = *(gdet->monoDet());
200  int NSaturating = 0;
201  float pathLen = detUnitM.surface().bounds().thickness() / fabs(cosine);
202  float chargeAbs = DeDxTools::getCharge(&(matchedHit->monoCluster()), NSaturating, detUnitM, calibGains, m_off);
203  float charge = meVperADCStrip * chargeAbs / pathLen;
204  if (!shapetest || (shapetest && DeDxTools::shapeSelection(matchedHit->monoCluster()))) {
205  dedxHits.push_back(DeDxHit(charge, trackMomentum, pathLen, matchedHit->monoId()));
206  if (NSaturating > 0)
207  NClusterSaturating++;
208  }
209 
210  auto& detUnitS = *(gdet->stereoDet());
211  NSaturating = 0;
212  pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
213  chargeAbs = DeDxTools::getCharge(&(matchedHit->stereoCluster()), NSaturating, detUnitS, calibGains, m_off);
214  charge = meVperADCStrip * chargeAbs / pathLen;
215  if (!shapetest || (shapetest && DeDxTools::shapeSelection(matchedHit->stereoCluster()))) {
216  dedxHits.push_back(DeDxHit(charge, trackMomentum, pathLen, matchedHit->stereoId()));
217  if (NSaturating > 0)
218  NClusterSaturating++;
219  }
220  }
221 }

References ALCARECOTkAlJpsiMuMu_cff::charge, TrackingRecHit::det(), DeDxTools::getCharge(), SiStripMatchedRecHit2D::monoCluster(), GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoId(), rpcPointValidation_cfi::recHit, DeDxTools::shapeSelection(), SiStripMatchedRecHit2D::stereoCluster(), GluedGeomDet::stereoDet(), SiStripMatchedRecHit2D::stereoId(), reco::btau::trackMomentum, dedxEstimators_cff::usePixel, and dedxEstimators_cff::useStrip.

◆ produce()

void DeDxEstimatorProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 103 of file DeDxEstimatorProducer.cc.

103  {
104  auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
105  ValueMap<DeDxData>::Filler filler(*trackDeDxEstimateAssociation);
106 
107  edm::Handle<reco::TrackCollection> trackCollectionHandle;
108  iEvent.getByToken(m_tracksTag, trackCollectionHandle);
109 
110  std::vector<DeDxData> dedxEstimate(trackCollectionHandle->size());
111 
112  for (unsigned int j = 0; j < trackCollectionHandle->size(); j++) {
113  const reco::TrackRef track = reco::TrackRef(trackCollectionHandle.product(), j);
114 
115  int NClusterSaturating = 0;
116  DeDxHitCollection dedxHits;
117 
118  auto const& trajParams = track->extra()->trajParams();
119  assert(trajParams.size() == track->recHitsSize());
120  auto hb = track->recHitsBegin();
121  dedxHits.reserve(track->recHitsSize() / 2);
122  for (unsigned int h = 0; h < track->recHitsSize(); h++) {
123  auto recHit = *(hb + h);
125  continue;
126 
127  auto trackDirection = trajParams[h].direction();
128  float cosine = trackDirection.z() / trackDirection.mag();
129  processHit(recHit, track->p(), cosine, dedxHits, NClusterSaturating);
130  }
131 
132  sort(dedxHits.begin(), dedxHits.end(), less<DeDxHit>());
133  std::pair<float, float> val_and_error = m_estimator->dedx(dedxHits);
134 
135  //WARNING: Since the dEdX Error is not properly computed for the moment
136  //It was decided to store the number of saturating cluster in that dataformat
137  val_and_error.second = NClusterSaturating;
138  dedxEstimate[j] = DeDxData(val_and_error.first, val_and_error.second, dedxHits.size());
139  }
141 
142  filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
143 
144  // fill the association map and put it into the event
145  filler.fill();
146  iEvent.put(std::move(trackDeDxEstimateAssociation));
147 }

References cms::cuda::assert(), trigObjTnPSource_cfi::filler, h, hcalSimParameters_cfi::hb, iEvent, trackerHitRTTI::isFromDet(), dqmiolumiharvest::j, eostools::move(), edm::Handle< T >::product(), rpcPointValidation_cfi::recHit, and HLT_2018_cff::track.

Member Data Documentation

◆ calibGains

std::vector<std::vector<float> > DeDxEstimatorProducer::calibGains
private

Definition at line 78 of file DeDxEstimatorProducer.h.

◆ m_calibrationPath

std::string DeDxEstimatorProducer::m_calibrationPath
private

Definition at line 74 of file DeDxEstimatorProducer.h.

◆ m_estimator

BaseDeDxEstimator* DeDxEstimatorProducer::m_estimator
private

Definition at line 63 of file DeDxEstimatorProducer.h.

◆ m_off

unsigned int DeDxEstimatorProducer::m_off
private

Definition at line 79 of file DeDxEstimatorProducer.h.

◆ m_tracksTag

edm::EDGetTokenT<reco::TrackCollection> DeDxEstimatorProducer::m_tracksTag
private

Definition at line 65 of file DeDxEstimatorProducer.h.

◆ MaxNrStrips

unsigned int DeDxEstimatorProducer::MaxNrStrips
private

Definition at line 72 of file DeDxEstimatorProducer.h.

◆ meVperADCPixel

float DeDxEstimatorProducer::meVperADCPixel
private

Definition at line 69 of file DeDxEstimatorProducer.h.

◆ meVperADCStrip

float DeDxEstimatorProducer::meVperADCStrip
private

Definition at line 70 of file DeDxEstimatorProducer.h.

◆ shapetest

bool DeDxEstimatorProducer::shapetest
private

Definition at line 76 of file DeDxEstimatorProducer.h.

◆ tkGeom

edm::ESHandle<TrackerGeometry> DeDxEstimatorProducer::tkGeom
private

Definition at line 81 of file DeDxEstimatorProducer.h.

◆ useCalibration

bool DeDxEstimatorProducer::useCalibration
private

Definition at line 75 of file DeDxEstimatorProducer.h.

◆ usePixel

bool DeDxEstimatorProducer::usePixel
private

Definition at line 67 of file DeDxEstimatorProducer.h.

◆ useStrip

bool DeDxEstimatorProducer::useStrip
private

Definition at line 68 of file DeDxEstimatorProducer.h.

TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
SiStripMatchedRecHit2D::monoId
unsigned int monoId() const
Definition: SiStripMatchedRecHit2D.h:29
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::Handle::product
T const * product() const
Definition: Handle.h:70
BaseDeDxEstimator::dedx
virtual std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits)=0
SiStripMatchedRecHit2D::stereoCluster
SiStripCluster const & stereoCluster() const
Definition: SiStripMatchedRecHit2D.h:40
DeDxTools::makeCalibrationMap
void makeCalibrationMap(const std::string &m_calibrationPath, const TrackerGeometry &tkGeom, std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
Definition: DeDxTools.cc:252
DeDxEstimatorProducer::calibGains
std::vector< std::vector< float > > calibGains
Definition: DeDxEstimatorProducer.h:78
DeDxEstimatorProducer::meVperADCPixel
float meVperADCPixel
Definition: DeDxEstimatorProducer.h:69
DeDxEstimatorProducer::m_calibrationPath
std::string m_calibrationPath
Definition: DeDxEstimatorProducer.h:74
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
TrackingRecHit::det
const GeomDet * det() const
Definition: TrackingRecHit.h:122
DeDxEstimatorProducer::usePixel
bool usePixel
Definition: DeDxEstimatorProducer.h:67
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
DeDxEstimatorProducer::useStrip
bool useStrip
Definition: DeDxEstimatorProducer.h:68
reco::DeDxHitCollection
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:41
cms::cuda::assert
assert(be >=bs)
GluedGeomDet::monoDet
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
GenericAverageDeDxEstimator
Definition: GenericAverageDeDxEstimator.h:8
MedianDeDxEstimator
Definition: MedianDeDxEstimator.h:8
edm::Handle< reco::TrackCollection >
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
edm::Ref< TrackCollection >
DeDxTools::getCharge
int getCharge(const SiStripCluster *cluster, int &nSatStrip, const GeomDetUnit &detUnit, const std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
Definition: DeDxTools.cc:214
DeDxEstimatorProducer::shapetest
bool shapetest
Definition: DeDxEstimatorProducer.h:76
DeDxEstimatorProducer::m_tracksTag
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
Definition: DeDxEstimatorProducer.h:65
GeomDetEnumerators::PixelBarrel
Definition: GeomDetEnumerators.h:11
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
DeDxEstimatorProducer::useCalibration
bool useCalibration
Definition: DeDxEstimatorProducer.h:75
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
reco::btau::trackMomentum
Definition: TaggingVariable.h:41
DeDxEstimatorProducer::m_off
unsigned int m_off
Definition: DeDxEstimatorProducer.h:79
DeDxEstimatorProducer::tkGeom
edm::ESHandle< TrackerGeometry > tkGeom
Definition: DeDxEstimatorProducer.h:81
GluedGeomDet
Definition: GluedGeomDet.h:7
DeDxTools::shapeSelection
bool shapeSelection(const SiStripCluster &ampls)
Definition: DeDxTools.cc:9
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
edm::LogWarning
Definition: MessageLogger.h:141
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
Bounds::thickness
virtual float thickness() const =0
SiStripMatchedRecHit2D::stereoId
unsigned int stereoId() const
Definition: SiStripMatchedRecHit2D.h:28
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
reco::DeDxHit
Definition: DeDxHit.h:11
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
trackerHitRTTI::isFromDet
bool isFromDet(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:35
GenericTruncatedAverageDeDxEstimator
Definition: GenericTruncatedAverageDeDxEstimator.h:9
BTagLikeDeDxDiscriminator
Definition: BTagLikeDeDxDiscriminator.h:8
get
#define get
hcalSimParameters_cfi.hb
hb
Definition: hcalSimParameters_cfi.py:57
GluedGeomDet::stereoDet
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
TruncatedAverageDeDxEstimator
Definition: TruncatedAverageDeDxEstimator.h:9
writedatasetfile.run
run
Definition: writedatasetfile.py:27
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
SiStripMatchedRecHit2D::monoCluster
SiStripCluster const & monoCluster() const
Definition: SiStripMatchedRecHit2D.h:41
ASmirnovDeDxDiscriminator
Definition: ASmirnovDeDxDiscriminator.h:8
DeDxEstimatorProducer::meVperADCStrip
float meVperADCStrip
Definition: DeDxEstimatorProducer.h:70
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
edm::helper::Filler
Definition: ValueMap.h:22
reco::DeDxData
Definition: DeDxData.h:8
UnbinnedFitDeDxEstimator
Definition: UnbinnedFitDeDxEstimator.h:14
DeDxEstimatorProducer::m_estimator
BaseDeDxEstimator * m_estimator
Definition: DeDxEstimatorProducer.h:63
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
DeDxEstimatorProducer::processHit
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
Definition: DeDxEstimatorProducer.cc:149
BaseDeDxEstimator::beginRun
virtual void beginRun(edm::Run const &run, const edm::EventSetup &iSetup)
Definition: BaseDeDxEstimator.h:11
SmirnovDeDxDiscriminator
Definition: SmirnovDeDxDiscriminator.h:8
TrackerGeometry::offsetDU
unsigned int offsetDU(SubDetector sid) const
Definition: TrackerGeometry.h:72
edm::InputTag
Definition: InputTag.h:15
ProductDeDxDiscriminator
Definition: ProductDeDxDiscriminator.h:8