CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiStripGainCalibTableProducer Class Reference
Inheritance diagram for SiStripGainCalibTableProducer:
SiStripOnTrackClusterTableProducerBase edm::stream::EDProducer<>

Public Member Functions

void fillTable (const std::vector< OnTrackCluster > &clusters, const edm::View< reco::Track > &tracks, nanoaod::FlatTable *table, const edm::EventSetup &iSetup) final
 
 SiStripGainCalibTableProducer (const edm::ParameterSet &params)
 
- Public Member Functions inherited from SiStripOnTrackClusterTableProducerBase
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) final
 
 SiStripOnTrackClusterTableProducerBase (const edm::ParameterSet &params)
 
 ~SiStripOnTrackClusterTableProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from SiStripOnTrackClusterTableProducerBase
template<typename VALUES >
static void addColumn (nanoaod::FlatTable *table, const std::string &name, VALUES &&values, const std::string &doc)
 

Private Member Functions

double thickness (DetId id, const TrackerGeometry *tGeom)
 

Private Attributes

const edm::ESGetToken< SiStripGain, SiStripGainRcdm_gainToken
 
std::map< DetId, double > m_thicknessMap
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordm_tkGeomToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 15 of file SiStripGainCalibTableProducer.cc.

Constructor & Destructor Documentation

◆ SiStripGainCalibTableProducer()

SiStripGainCalibTableProducer::SiStripGainCalibTableProducer ( const edm::ParameterSet params)
inlineexplicit

Definition at line 17 of file SiStripGainCalibTableProducer.cc.

18  : SiStripOnTrackClusterTableProducerBase(params), m_tkGeomToken{esConsumes<>()}, m_gainToken{esConsumes<>()} {}
SiStripOnTrackClusterTableProducerBase(const edm::ParameterSet &params)
const edm::ESGetToken< SiStripGain, SiStripGainRcd > m_gainToken
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken

Member Function Documentation

◆ fillDescriptions()

static void SiStripGainCalibTableProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 20 of file SiStripGainCalibTableProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

20  {
22  desc.add<std::string>("name", "cluster");
23  desc.add<std::string>("doc", "");
24  desc.add<bool>("extension", false);
25  desc.add<edm::InputTag>("Tracks", edm::InputTag{"generalTracks"});
26  descriptions.add("siStripGainCalibTable", desc);
27  }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillTable()

void SiStripGainCalibTableProducer::fillTable ( const std::vector< OnTrackCluster > &  clusters,
const edm::View< reco::Track > &  tracks,
nanoaod::FlatTable table,
const edm::EventSetup iSetup 
)
finalvirtual

Implements SiStripOnTrackClusterTableProducerBase.

Definition at line 93 of file SiStripGainCalibTableProducer.cc.

References funct::abs(), SiStripOnTrackClusterTableProducerBase::addColumn(), ALCARECOTkAlJpsiMuMu_cff::charge, bsc_activity_cfg::clusters, SiStripGain::getApvGain(), edm::EventSetup::getHandle(), SiStripGain::getRange(), deDxTools::isFarFromBorder(), edm::ESHandleBase::isValid(), TrajectoryStateOnSurface::localDirection(), m_gainToken, m_tkGeomToken, me0TriggerPseudoDigis_cff::nStrips, castor_dqm_sourceclient_file_cfg::path, edm::ESHandle< T >::product(), EcalSCDynamicDPhiParametersESProducer_cfi::saturation, TableParser::table, thickness(), and PV3DBase< T, PVType, FrameType >::z().

96  {
99 
100  std::vector<double> c_localdirx;
101  std::vector<double> c_localdiry;
102  std::vector<double> c_localdirz;
103  std::vector<uint16_t> c_firststrip;
104  std::vector<uint16_t> c_nstrips;
105  std::vector<bool> c_saturation;
106  std::vector<bool> c_overlapping;
107  std::vector<bool> c_farfromedge;
108  std::vector<int> c_charge;
109  std::vector<double> c_path;
110  // NOTE only very few types are supported by NanoAOD, but more could be added (to discuss with XPOG / core software)
111  // NOTE removed amplitude vector, I don't think it was used anywhere
112  std::vector<float> c_gainused; // NOTE was double
113  std::vector<float> c_gainusedTick; // NOTE was double
114  for (const auto clus : clusters) {
115  const auto& ampls = clus.cluster->amplitudes();
116  const int firstStrip = clus.cluster->firstStrip();
117  const int nStrips = ampls.size();
118  double prevGain = -1;
119  double prevGainTick = -1;
120  if (stripGains.isValid()) {
121  prevGain = stripGains->getApvGain(firstStrip / 128, stripGains->getRange(clus.det, 1), 1);
122  prevGainTick = stripGains->getApvGain(firstStrip / 128, stripGains->getRange(clus.det, 0), 1);
123  }
124  const unsigned int charge = clus.cluster->charge();
125  const bool saturation = std::any_of(ampls.begin(), ampls.end(), [](uint8_t amp) { return amp >= 254; });
126 
127  const bool overlapping = (((firstStrip % 128) == 0) || ((firstStrip / 128) != ((firstStrip + nStrips) / 128)) ||
128  (((firstStrip + nStrips) % 128) == 127));
129  const auto& trajState = clus.measurement.updatedState();
130  const auto trackDir = trajState.localDirection();
131  const auto cosine = trackDir.z() / trackDir.mag();
132  const auto path = (10. * thickness(clus.det, tGeom.product())) / std::abs(cosine);
133  const auto farFromEdge = isFarFromBorder(trajState, clus.det, tGeom.product());
134  c_localdirx.push_back(trackDir.x());
135  c_localdiry.push_back(trackDir.y());
136  c_localdirz.push_back(trackDir.z());
137  c_firststrip.push_back(firstStrip);
138  c_nstrips.push_back(nStrips);
139  c_saturation.push_back(saturation);
140  c_overlapping.push_back(overlapping);
141  c_farfromedge.push_back(farFromEdge);
142  c_charge.push_back(charge);
143  c_path.push_back(path);
144  c_gainused.push_back(prevGain);
145  c_gainusedTick.push_back(prevGainTick);
146  }
147  // addColumn(table, "localdirx", c_localdirx, "<doc>");
148  // addColumn(table, "localdiry", c_localdiry, "<doc>");
149  // addColumn(table, "localdirz", c_localdirz, "<doc>");
150  // addColumn(table, "firststrip", c_firststrip, "<doc>");
151  // addColumn(table, "nstrips", c_nstrips, "<doc>");
152  addColumn(table, "saturation", c_saturation, "<doc>");
153  addColumn(table, "overlapping", c_overlapping, "<doc>");
154  addColumn(table, "farfromedge", c_farfromedge, "<doc>");
155  addColumn(table, "charge", c_charge, "<doc>");
156  // addColumn(table, "path", c_path, "<doc>");
157  // ExtendedCalibTree: also charge/path
158  addColumn(table, "gainused", c_gainused, "<doc>");
159  addColumn(table, "gainusedTick", c_gainusedTick, "<doc>");
160 }
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:75
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
double thickness(DetId id, const TrackerGeometry *tGeom)
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:80
T const * product() const
Definition: ESHandle.h:86
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isFarFromBorder(const TrajectoryStateOnSurface &trajState, const GeomDetUnit *it)
Definition: DeDxTools.cc:426
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
bool isValid() const
Definition: ESHandle.h:44
static void addColumn(nanoaod::FlatTable *table, const std::string &name, VALUES &&values, const std::string &doc)
const edm::ESGetToken< SiStripGain, SiStripGainRcd > m_gainToken
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken

◆ thickness()

double SiStripGainCalibTableProducer::thickness ( DetId  id,
const TrackerGeometry tGeom 
)
private

Definition at line 73 of file SiStripGainCalibTableProducer.cc.

References l1ctLayer2EG_cff::id, TrackerGeometry::idToDetUnit(), fastTrackerRecHitType::isPixel(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and m_thicknessMap.

Referenced by fillTable().

73  {
74  const auto it = m_thicknessMap.find(id);
75  if (m_thicknessMap.end() != it) {
76  return it->second;
77  } else {
78  double detThickness = 1.;
79  const auto gdu = tGeom->idToDetUnit(id);
80  const auto isPixel = (dynamic_cast<const PixelGeomDetUnit*>(gdu) != nullptr);
81  const auto isStrip = (dynamic_cast<const StripGeomDetUnit*>(gdu) != nullptr);
82  if (!isPixel && !isStrip) {
83  edm::LogWarning("SiStripGainCalibTableProducer")
84  << "DetId " << id.rawId() << " doesn't seem to belong to the Tracker";
85  } else {
86  detThickness = gdu->surface().bounds().thickness();
87  }
88  m_thicknessMap[id] = detThickness;
89  return detThickness;
90  }
91 }
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
bool isPixel(HitType hitType)
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ m_gainToken

const edm::ESGetToken<SiStripGain, SiStripGainRcd> SiStripGainCalibTableProducer::m_gainToken
private

Definition at line 36 of file SiStripGainCalibTableProducer.cc.

Referenced by fillTable().

◆ m_thicknessMap

std::map<DetId, double> SiStripGainCalibTableProducer::m_thicknessMap
private

Definition at line 38 of file SiStripGainCalibTableProducer.cc.

Referenced by thickness().

◆ m_tkGeomToken

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripGainCalibTableProducer::m_tkGeomToken
private

Definition at line 35 of file SiStripGainCalibTableProducer.cc.

Referenced by fillTable().