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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 30 of file HSCPDeDxInfoProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), QuarkoniaTrackSelector_cfi::MaxTrackEta, dedxEstimators_cff::useCalibration, dedxEstimators_cff::usePixel, dedxEstimators_cff::useStrip, and conversionTrackProducer_cfi::useTrajectory.

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

65 {}

Member Function Documentation

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

Definition at line 68 of file HSCPDeDxInfoProducer.cc.

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

69 {
70  if(useCalibration && calibGains.empty()){
72  iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
73  m_off = tkGeom->offsetDU(GeomDetEnumerators::PixelBarrel); //index start at the first pixel
74 
76  }
77 
78 // DeDxTools::buildDiscrimMap(run, iSetup, Reccord, ProbabilityMode, Prob_ChargePath);
79 }
std::vector< std::vector< float > > calibGains
void makeCalibrationMap(const std::string &m_calibrationPath, const TrackerGeometry &tkGeom, std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
Definition: DeDxTools.cc:196
unsigned int offsetDU(SubDetector sid) const
T get() const
Definition: EventSetup.h:71
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 140 of file HSCPDeDxInfoProducer.cc.

References Surface::bounds(), susybsm::HSCPDeDxInfo::charges, susybsm::HSCPDeDxInfo::clusterIndices, DEFINE_FWK_MODULE, susybsm::HSCPDeDxInfo::detIds, TrackerSingleRecHit::detUnit(), TrackingRecHit::detUnit(), BaseTrackerRecHit::firstClusterRef(), 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().

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

Definition at line 83 of file HSCPDeDxInfoProducer.cc.

References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, TrackingRecHit::detUnit(), edm::helper::Filler< Map >::fill(), objects.autophobj::filler, edm::Event::getByToken(), h, edm::helper::Filler< Map >::insert(), TrajectoryStateOnSurface::isValid(), 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(), HiIsolationCommonParameters_cff::track, conversionTrackProducer_cfi::useTrajectory, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

std::string HSCPDeDxInfoProducer::m_calibrationPath
private

Definition at line 64 of file HSCPDeDxInfoProducer.h.

unsigned int HSCPDeDxInfoProducer::m_off
private

Definition at line 69 of file HSCPDeDxInfoProducer.h.

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

Definition at line 48 of file HSCPDeDxInfoProducer.h.

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

Definition at line 47 of file HSCPDeDxInfoProducer.h.

unsigned int HSCPDeDxInfoProducer::MaxNrStrips
private

Definition at line 56 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MaxTrackChiOverNdf
private

Definition at line 62 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MaxTrackEta
private

Definition at line 61 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MaxTrackMomentum
private

Definition at line 59 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::meVperADCPixel
private

Definition at line 53 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::meVperADCStrip
private

Definition at line 54 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MinTrackEta
private

Definition at line 60 of file HSCPDeDxInfoProducer.h.

unsigned int HSCPDeDxInfoProducer::MinTrackHits
private

Definition at line 57 of file HSCPDeDxInfoProducer.h.

float HSCPDeDxInfoProducer::MinTrackMomentum
private

Definition at line 58 of file HSCPDeDxInfoProducer.h.

TH3F* HSCPDeDxInfoProducer::Prob_ChargePath
private

Definition at line 73 of file HSCPDeDxInfoProducer.h.

std::string HSCPDeDxInfoProducer::ProbabilityMode
private

Definition at line 72 of file HSCPDeDxInfoProducer.h.

std::string HSCPDeDxInfoProducer::Reccord
private

Definition at line 71 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::shapetest
private

Definition at line 66 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::useCalibration
private

Definition at line 65 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::usePixel
private

Definition at line 51 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::useStrip
private

Definition at line 52 of file HSCPDeDxInfoProducer.h.

bool HSCPDeDxInfoProducer::useTrajectory
private

Definition at line 50 of file HSCPDeDxInfoProducer.h.