CMS 3D CMS Logo

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

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

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

Public Member Functions

 HSCPDeDxInfoProducer (const edm::ParameterSet &)
 
 ~HSCPDeDxInfoProducer () 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
 

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, susybsm::HSCPDeDxInfo &hscpDeDxInfo, LocalPoint HitLocalPos)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< std::vector< float > > calibGains
 
std::string m_calibrationPath
 
unsigned int m_off
 
edm::EDGetTokenT< reco::TrackCollectionm_tracksTag
 
edm::EDGetTokenT< TrajTrackAssociationCollectionm_trajTrackAssociationTag
 
unsigned int MaxNrStrips
 
float MaxTrackChiOverNdf
 
float MaxTrackEta
 
float MaxTrackMomentum
 
float meVperADCPixel
 
float meVperADCStrip
 
float MinTrackEta
 
unsigned int MinTrackHits
 
float MinTrackMomentum
 
TH3F * Prob_ChargePath
 
std::string ProbabilityMode
 
std::string Reccord
 
bool shapetest
 
bool useCalibration
 
bool usePixel
 
bool useStrip
 
bool useTrajectory
 

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 33 of file HSCPDeDxInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file HSCPDeDxInfoProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HLT_2018_cff::MaxTrackEta, HLT_2018_cff::MinTrackHits, SiStripFineDelayHit_cfi::MinTrackMomentum, dedxEstimators_cff::useCalibration, dedxEstimators_cff::usePixel, dedxEstimators_cff::useStrip, and conversionTrackProducer_cfi::useTrajectory.

29  {
30  produces<ValueMap<susybsm::HSCPDeDxInfo> >();
31 
32  MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips", 255);
33  MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits", 4);
34  MinTrackMomentum = iConfig.getUntrackedParameter<double>("minTrackMomentum", 0.0);
35  MaxTrackMomentum = iConfig.getUntrackedParameter<double>("maxTrackMomentum", 99999.0);
36  MinTrackEta = iConfig.getUntrackedParameter<double>("minTrackEta", -5.0);
37  MaxTrackEta = iConfig.getUntrackedParameter<double>("maxTrackEta", 5.0);
38 
39  m_tracksTag = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"));
41  consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("trajectoryTrackAssociation"));
42  useTrajectory = iConfig.getUntrackedParameter<bool>("UseTrajectory", true);
43 
44  usePixel = iConfig.getParameter<bool>("UsePixel");
45  useStrip = iConfig.getParameter<bool>("UseStrip");
46  meVperADCPixel = iConfig.getParameter<double>("MeVperADCPixel");
47  meVperADCStrip = iConfig.getParameter<double>("MeVperADCStrip");
48 
49  shapetest = iConfig.getParameter<bool>("ShapeTest");
50  useCalibration = iConfig.getParameter<bool>("UseCalibration");
51  m_calibrationPath = iConfig.getParameter<string>("calibrationPath");
52 
53  // Reccord = iConfig.getUntrackedParameter<std::string> ("Reccord" , "SiStripDeDxMip_3D_Rcd");
54  // ProbabilityMode = iConfig.getUntrackedParameter<std::string> ("ProbabilityMode" , "Accumulation");
55  // Prob_ChargePath = NULL;
56 
57  if (!usePixel && !useStrip)
58  edm::LogWarning("DeDxHitsProducer")
59  << "Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
60 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
edm::EDGetTokenT< TrajTrackAssociationCollection > m_trajTrackAssociationTag
HSCPDeDxInfoProducer::~HSCPDeDxInfoProducer ( )
override

Definition at line 62 of file HSCPDeDxInfoProducer.cc.

62 {}

Member Function Documentation

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

Definition at line 65 of file HSCPDeDxInfoProducer.cc.

References edm::EventSetup::get(), DeDxTools::makeCalibrationMap(), TrackerGeometry::offsetDU(), GeomDetEnumerators::PixelBarrel, and dedxEstimators_cff::useCalibration.

65  {
66  if (useCalibration && calibGains.empty()) {
68  iSetup.get<TrackerDigiGeometryRecord>().get(tkGeom);
69  m_off = tkGeom->offsetDU(GeomDetEnumerators::PixelBarrel); //index start at the first pixel
70 
72  }
73 
74  // DeDxTools::buildDiscrimMap(run, iSetup, Reccord, ProbabilityMode, Prob_ChargePath);
75 }
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
unsigned int offsetDU(SubDetector sid) const
std::vector< std::vector< float > > calibGains
T get() const
Definition: EventSetup.h:73
void HSCPDeDxInfoProducer::makeCalibrationMap ( const TrackerGeometry tkGeom)
private
void HSCPDeDxInfoProducer::processHit ( const TrackingRecHit recHit,
float  trackMomentum,
float &  cosine,
susybsm::HSCPDeDxInfo hscpDeDxInfo,
LocalPoint  HitLocalPos 
)
private

Definition at line 141 of file HSCPDeDxInfoProducer.cc.

References Surface::bounds(), susybsm::HSCPDeDxInfo::charges, susybsm::HSCPDeDxInfo::clusterIndices, watchdog::const, DEFINE_FWK_MODULE, susybsm::HSCPDeDxInfo::detIds, TrackerSingleRecHit::detUnit(), TrackingRecHit::detUnit(), DeDxTools::getCharge(), OmniClusterRef::key(), susybsm::HSCPDeDxInfo::localPosXs, susybsm::HSCPDeDxInfo::localPosYs, SiStripMatchedRecHit2D::monoClusterRef(), SiStripMatchedRecHit2D::monoHit(), susybsm::HSCPDeDxInfo::pathlengths, rpcPointValidation_cfi::recHit, SiStripMatchedRecHit2D::stereoClusterRef(), SiStripMatchedRecHit2D::stereoHit(), TrackerSingleRecHit::stripCluster(), BaseTrackerRecHit::surface(), Bounds::thickness(), dedxEstimators_cff::usePixel, dedxEstimators_cff::useStrip, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

145  {
146  auto const& thit = static_cast<BaseTrackerRecHit const&>(*recHit);
147  if (!thit.isValid())
148  return;
149 
150  auto const& clus = thit.firstClusterRef();
151  if (!clus.isValid())
152  return;
153 
154  if (clus.isPixel()) {
155  if (!usePixel)
156  return;
157 
158  auto& detUnit = *(recHit->detUnit());
159  float pathLen = detUnit.surface().bounds().thickness() / fabs(cosine);
160  float chargeAbs = clus.pixelCluster().charge();
161  hscpDeDxInfo.charges.push_back(chargeAbs);
162  hscpDeDxInfo.pathlengths.push_back(pathLen);
163  hscpDeDxInfo.detIds.push_back(thit.geographicalId());
164  hscpDeDxInfo.localPosXs.push_back(HitLocalPos.x());
165  hscpDeDxInfo.localPosYs.push_back(HitLocalPos.y());
166  hscpDeDxInfo.clusterIndices.push_back(clus.key());
167  } else if (clus.isStrip() && !thit.isMatched()) {
168  if (!useStrip)
169  return;
170 
171  auto& detUnit = *(recHit->detUnit());
172  int NSaturating = 0;
173  float pathLen = detUnit.surface().bounds().thickness() / fabs(cosine);
174  float chargeAbs = DeDxTools::getCharge(&(clus.stripCluster()), NSaturating, detUnit, calibGains, m_off);
175  hscpDeDxInfo.charges.push_back(chargeAbs);
176  hscpDeDxInfo.pathlengths.push_back(pathLen);
177  hscpDeDxInfo.detIds.push_back(thit.geographicalId());
178  hscpDeDxInfo.localPosXs.push_back(HitLocalPos.x());
179  hscpDeDxInfo.localPosYs.push_back(HitLocalPos.y());
180  hscpDeDxInfo.clusterIndices.push_back(clus.key());
181  } else if (clus.isStrip() && thit.isMatched()) {
182  if (!useStrip)
183  return;
184  const SiStripMatchedRecHit2D* matchedHit = dynamic_cast<const SiStripMatchedRecHit2D*>(recHit);
185  if (!matchedHit)
186  return;
187 
188  auto& detUnitM = *(matchedHit->monoHit().detUnit());
189  int NSaturating = 0;
190  float pathLen = detUnitM.surface().bounds().thickness() / fabs(cosine);
191  float chargeAbs =
192  DeDxTools::getCharge(&(matchedHit->monoHit().stripCluster()), NSaturating, detUnitM, calibGains, m_off);
193  hscpDeDxInfo.charges.push_back(chargeAbs);
194  hscpDeDxInfo.pathlengths.push_back(pathLen);
195  hscpDeDxInfo.detIds.push_back(thit.geographicalId());
196  hscpDeDxInfo.localPosXs.push_back(HitLocalPos.x());
197  hscpDeDxInfo.localPosYs.push_back(HitLocalPos.y());
198  const OmniClusterRef monoClusterRef = matchedHit->monoClusterRef();
199  hscpDeDxInfo.clusterIndices.push_back(monoClusterRef.key());
200 
201  auto& detUnitS = *(matchedHit->stereoHit().detUnit());
202  NSaturating = 0;
203  pathLen = detUnitS.surface().bounds().thickness() / fabs(cosine);
204  chargeAbs =
205  DeDxTools::getCharge(&(matchedHit->stereoHit().stripCluster()), NSaturating, detUnitS, calibGains, m_off);
206  hscpDeDxInfo.charges.push_back(chargeAbs);
207  hscpDeDxInfo.pathlengths.push_back(pathLen);
208  hscpDeDxInfo.detIds.push_back(thit.geographicalId());
209  hscpDeDxInfo.localPosXs.push_back(HitLocalPos.x());
210  hscpDeDxInfo.localPosYs.push_back(HitLocalPos.y());
211  const OmniClusterRef stereoClusterRef = matchedHit->stereoClusterRef();
212  hscpDeDxInfo.clusterIndices.push_back(stereoClusterRef.key());
213  }
214 }
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
OmniClusterRef const & stereoClusterRef() const
T y() const
Definition: PV3DBase.h:60
const Bounds & bounds() const
Definition: Surface.h:89
std::vector< float > localPosYs
Definition: HSCPDeDxInfo.h:19
std::vector< float > pathlengths
Definition: HSCPDeDxInfo.h:16
OmniClusterRef const & monoClusterRef() const
std::vector< uint32_t > detIds
Definition: HSCPDeDxInfo.h:17
std::vector< float > charges
Definition: HSCPDeDxInfo.h:15
SiStripRecHit2D stereoHit() const
virtual float thickness() const =0
std::vector< std::vector< float > > calibGains
SiStripCluster const & stripCluster() const
const GeomDetUnit * detUnit() const override
const Surface * surface() const final
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * detUnit() const
std::vector< uint32_t > clusterIndices
Definition: HSCPDeDxInfo.h:20
std::vector< float > localPosXs
Definition: HSCPDeDxInfo.h:18
T x() const
Definition: PV3DBase.h:59
unsigned int key() const
void HSCPDeDxInfoProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 77 of file HSCPDeDxInfoProducer.cc.

References edm::AssociationMap< Tag >::begin(), watchdog::const, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, TrackingRecHit::detUnit(), edm::helper::Filler< Map >::fill(), trigObjTnPSource_cfi::filler, edm::Event::getByToken(), h, edm::helper::Filler< Map >::insert(), TrajectoryStateOnSurface::isValid(), dqmiolumiharvest::j, edm::Ref< C, T, F >::key(), TrajectoryStateOnSurface::localDirection(), TrajectoryStateOnSurface::localMomentum(), TrajectoryStateOnSurface::localPosition(), PV3DBase< T, PVType, FrameType >::mag(), eostools::move(), Plane::normalVector(), edm::Handle< T >::product(), edm::Event::put(), rpcPointValidation_cfi::recHit, GeomDet::surface(), HLT_2018_cff::track, conversionTrackProducer_cfi::useTrajectory, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

77  {
78  unique_ptr<ValueMap<susybsm::HSCPDeDxInfo> > trackDeDxAssociation(new ValueMap<susybsm::HSCPDeDxInfo>);
79  ValueMap<susybsm::HSCPDeDxInfo>::Filler filler(*trackDeDxAssociation);
80 
81  edm::Handle<reco::TrackCollection> trackCollectionHandle;
82  iEvent.getByToken(m_tracksTag, trackCollectionHandle);
83 
84  Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
85  if (useTrajectory)
86  iEvent.getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle);
87 
88  std::vector<susybsm::HSCPDeDxInfo> dEdxInfos(trackCollectionHandle->size());
89 
91  if (useTrajectory)
92  cit = trajTrackAssociationHandle->begin();
93  for (unsigned int j = 0; j < trackCollectionHandle->size(); j++) {
94  const reco::TrackRef track = reco::TrackRef(trackCollectionHandle.product(), j);
95 
96  susybsm::HSCPDeDxInfo hscpDeDxInfo;
97 
98  if (useTrajectory) { //trajectory allows to take into account the local direction of the particle on the module sensor --> muc much better 'dx' measurement
99  const edm::Ref<std::vector<Trajectory> > traj = cit->key;
100  cit++;
101  const vector<TrajectoryMeasurement>& measurements = traj->measurements();
102  for (vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it != measurements.end(); it++) {
103  TrajectoryStateOnSurface trajState = it->updatedState();
104  if (!trajState.isValid())
105  continue;
106 
107  const TrackingRecHit* recHit = (*it->recHit()).hit();
108  if (!recHit)
109  continue;
110  LocalVector trackDirection = trajState.localDirection();
111  float cosine = trackDirection.z() / trackDirection.mag();
112 
113  processHit(recHit, trajState.localMomentum().mag(), cosine, hscpDeDxInfo, trajState.localPosition());
114  }
115 
116  } else { //assume that the particles trajectory is a straight line originating from the center of the detector (can be improved)
117  for (unsigned int h = 0; h < track->recHitsSize(); h++) {
118  const TrackingRecHit* recHit = &(*(track->recHit(h)));
119  auto const& thit = static_cast<BaseTrackerRecHit const&>(*recHit);
120  if (!thit.isValid())
121  continue; //make sure it's a tracker hit
122 
123  const GlobalVector& ModuleNormal = recHit->detUnit()->surface().normalVector();
124  float cosine =
125  (track->px() * ModuleNormal.x() + track->py() * ModuleNormal.y() + track->pz() * ModuleNormal.z()) /
126  track->p();
127 
128  processHit(recHit, track->p(), cosine, hscpDeDxInfo, LocalPoint(0.0, 0.0));
129  }
130  }
131 
132  dEdxInfos[j] = hscpDeDxInfo;
133  }
135 
136  filler.insert(trackCollectionHandle, dEdxInfos.begin(), dEdxInfos.end());
137  filler.fill();
138  iEvent.put(std::move(trackDeDxAssociation));
139 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
LocalVector localDirection() const
GlobalVector normalVector() const
Definition: Plane.h:41
T y() const
Definition: PV3DBase.h:60
key_type key() const
Accessor for product key.
Definition: Ref.h:250
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
LocalVector localMomentum() const
T mag() const
Definition: PV3DBase.h:64
T z() const
Definition: PV3DBase.h:61
edm::EDGetTokenT< TrajTrackAssociationCollection > m_trajTrackAssociationTag
T const * product() const
Definition: Handle.h:69
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
virtual const GeomDetUnit * detUnit() const
const_iterator begin() const
first iterator over the map (read only)
T x() const
Definition: PV3DBase.h:59
def move(src, dest)
Definition: eostools.py:511
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, susybsm::HSCPDeDxInfo &hscpDeDxInfo, LocalPoint HitLocalPos)

Member Data Documentation

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

Definition at line 72 of file HSCPDeDxInfoProducer.h.

std::string HSCPDeDxInfoProducer::m_calibrationPath
private

Definition at line 68 of file HSCPDeDxInfoProducer.h.

unsigned int HSCPDeDxInfoProducer::m_off
private

Definition at line 73 of file HSCPDeDxInfoProducer.h.

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

Definition at line 52 of file HSCPDeDxInfoProducer.h.

edm::EDGetTokenT<TrajTrackAssociationCollection> HSCPDeDxInfoProducer::m_trajTrackAssociationTag
private

Definition at line 51 of file HSCPDeDxInfoProducer.h.

unsigned int HSCPDeDxInfoProducer::MaxNrStrips
private

Definition at line 60 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MaxTrackChiOverNdf
private

Definition at line 66 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MaxTrackEta
private

Definition at line 65 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MaxTrackMomentum
private

Definition at line 63 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::meVperADCPixel
private

Definition at line 57 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::meVperADCStrip
private

Definition at line 58 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MinTrackEta
private

Definition at line 64 of file HSCPDeDxInfoProducer.h.

unsigned int HSCPDeDxInfoProducer::MinTrackHits
private

Definition at line 61 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MinTrackMomentum
private

Definition at line 62 of file HSCPDeDxInfoProducer.h.

TH3F* HSCPDeDxInfoProducer::Prob_ChargePath
private

Definition at line 77 of file HSCPDeDxInfoProducer.h.

std::string HSCPDeDxInfoProducer::ProbabilityMode
private

Definition at line 76 of file HSCPDeDxInfoProducer.h.

std::string HSCPDeDxInfoProducer::Reccord
private

Definition at line 75 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::shapetest
private

Definition at line 70 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::useCalibration
private

Definition at line 69 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::usePixel
private

Definition at line 55 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::useStrip
private

Definition at line 56 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::useTrajectory
private

Definition at line 54 of file HSCPDeDxInfoProducer.h.