CMS 3D CMS Logo

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

#include <DD4hep_TrackingMaterialAnalyser.h>

Inheritance diagram for DD4hep_TrackingMaterialAnalyser:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DD4hep_TrackingMaterialAnalyser (const edm::ParameterSet &)
 
 ~DD4hep_TrackingMaterialAnalyser () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

enum  SplitMode { NEAREST_LAYER, INNER_LAYER, OUTER_LAYER, UNDEFINED }
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
int findLayer (const MaterialAccountingDetector &detector)
 
void saveLayerPlots ()
 
void saveParameters (const char *name)
 
void saveXml (const char *name)
 
void split (MaterialAccountingTrack &track)
 

Private Attributes

std::vector< std::string > m_groupNames
 
std::vector< DD4hep_MaterialAccountingGroup * > m_groups
 
bool m_isHFNose
 
bool m_isHGCal
 
edm::EDGetTokenT< std::vector< MaterialAccountingTrack > > m_materialToken
 
std::unique_ptr< DD4hep_TrackingMaterialPlotterm_plotter
 
bool m_saveDetailedPlots
 
bool m_saveParameters
 
bool m_saveSummaryPlot
 
bool m_saveXml
 
bool m_skipAfterLastDetector
 
bool m_skipBeforeFirstDetector
 
SplitMode m_splitMode
 
edm::ESInputTag m_tag
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file DD4hep_TrackingMaterialAnalyser.h.

Member Enumeration Documentation

◆ SplitMode

Enumerator
NEAREST_LAYER 
INNER_LAYER 
OUTER_LAYER 
UNDEFINED 

Definition at line 22 of file DD4hep_TrackingMaterialAnalyser.h.

Constructor & Destructor Documentation

◆ DD4hep_TrackingMaterialAnalyser()

DD4hep_TrackingMaterialAnalyser::DD4hep_TrackingMaterialAnalyser ( const edm::ParameterSet iPSet)
explicit

Definition at line 27 of file DD4hep_TrackingMaterialAnalyser.cc.

27  {
29  consumes<std::vector<MaterialAccountingTrack> >(iPSet.getParameter<edm::InputTag>("MaterialAccounting"));
30  m_groupNames = iPSet.getParameter<std::vector<std::string> >("Groups");
31  const std::string& splitmode = iPSet.getParameter<std::string>("SplitMode");
32  if (strcasecmp(splitmode.c_str(), "NearestLayer") == 0) {
34  } else if (strcasecmp(splitmode.c_str(), "InnerLayer") == 0) {
36  } else if (strcasecmp(splitmode.c_str(), "OuterLayer") == 0) {
38  } else {
41  << "Invalid SplitMode \"" << splitmode
42  << "\". Acceptable values are \"NearestLayer\", \"InnerLayer\", \"OuterLayer\".";
43  }
44  m_tag = iPSet.getParameter<edm::ESInputTag>("DDDetector");
45  m_skipAfterLastDetector = iPSet.getParameter<bool>("SkipAfterLastDetector");
46  m_skipBeforeFirstDetector = iPSet.getParameter<bool>("SkipBeforeFirstDetector");
47  m_saveSummaryPlot = iPSet.getParameter<bool>("SaveSummaryPlot");
48  m_saveDetailedPlots = iPSet.getParameter<bool>("SaveDetailedPlots");
49  m_saveParameters = iPSet.getParameter<bool>("SaveParameters");
50  m_saveXml = iPSet.getParameter<bool>("SaveXML");
51  m_isHGCal = iPSet.getParameter<bool>("isHGCal");
52  m_isHFNose = iPSet.getParameter<bool>("isHFNose");
53  if (m_saveSummaryPlot) {
54  if (m_isHGCal) {
55  m_plotter = std::make_unique<DD4hep_TrackingMaterialPlotter>(550., 300., 10);
56  } else if (m_isHFNose) {
57  m_plotter = std::make_unique<DD4hep_TrackingMaterialPlotter>(1200., 350., 10);
58  } else {
59  m_plotter = std::make_unique<DD4hep_TrackingMaterialPlotter>(300., 120., 10);
60  } // 10x10 points per cm2
61  } else {
62  m_plotter = nullptr;
63  }
64 }

References Exception, edm::ParameterSet::getParameter(), INNER_LAYER, edm::errors::LogicError, m_groupNames, m_isHFNose, m_isHGCal, m_materialToken, m_plotter, m_saveDetailedPlots, m_saveParameters, m_saveSummaryPlot, m_saveXml, m_skipAfterLastDetector, m_skipBeforeFirstDetector, m_splitMode, m_tag, NEAREST_LAYER, OUTER_LAYER, AlCaHLTBitMon_QueryRunRegistry::string, and UNDEFINED.

◆ ~DD4hep_TrackingMaterialAnalyser()

DD4hep_TrackingMaterialAnalyser::~DD4hep_TrackingMaterialAnalyser ( void  )
override

Definition at line 67 of file DD4hep_TrackingMaterialAnalyser.cc.

67 {}

Member Function Documentation

◆ analyze()

void DD4hep_TrackingMaterialAnalyser::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 154 of file DD4hep_TrackingMaterialAnalyser.cc.

154  {
155  using namespace edm;
157  setup.get<IdealGeometryRecord>().get(m_tag, hDDD);
158 
159  m_groups.reserve(m_groupNames.size());
160  // Initialize m_groups iff it has size equal to zero, so that we are
161  // sure it will never be repopulated with the same entries over and
162  // over again in the eventloop, at each call of the analyze method.
163  if (m_groups.empty()) {
164  for (unsigned int i = 0; i < m_groupNames.size(); ++i)
165  m_groups.emplace_back(new DD4hep_MaterialAccountingGroup(m_groupNames[i], *hDDD));
166 
167  edm::LogVerbatim("TrackerMaterialAnalysis")
168  << "TrackingMaterialAnalyser: List of the tracker groups: " << std::endl;
169  for (unsigned int i = 0; i < m_groups.size(); ++i)
170  edm::LogVerbatim("TrackerMaterialAnalysis")
171  << i << " TrackingMaterialAnalyser:\t" << m_groups[i]->info() << std::endl;
172  }
174  event.getByToken(m_materialToken, h_tracks);
175 
176  for (std::vector<MaterialAccountingTrack>::const_iterator t = h_tracks->begin(), end = h_tracks->end(); t != end;
177  ++t) {
179  split(track);
180  }
181 }

References mps_fire::end, get, mps_fire::i, m_groupNames, m_groups, m_materialToken, m_tag, singleTopDQM_cfi::setup, split(), submitPVValidationJobs::t, and HLT_FULL_cff::track.

◆ beginJob()

void DD4hep_TrackingMaterialAnalyser::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 25 of file DD4hep_TrackingMaterialAnalyser.h.

25 {}

◆ endJob()

void DD4hep_TrackingMaterialAnalyser::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 135 of file DD4hep_TrackingMaterialAnalyser.cc.

135  {
136  if (m_saveParameters)
137  saveParameters("parameters");
138 
139  if (m_saveXml)
140  saveXml("parameters.xml");
141 
143  saveLayerPlots();
144 
145  if (m_saveSummaryPlot and m_plotter) {
146  m_plotter->normalize();
147  m_plotter->draw();
148  }
149 }

References m_plotter, m_saveDetailedPlots, m_saveParameters, m_saveSummaryPlot, m_saveXml, saveLayerPlots(), saveParameters(), and saveXml().

◆ findLayer()

int DD4hep_TrackingMaterialAnalyser::findLayer ( const MaterialAccountingDetector detector)
private

Definition at line 352 of file DD4hep_TrackingMaterialAnalyser.cc.

352  {
353  int index = 0;
354  size_t inside = 0;
355  for (size_t i = 0; i < m_groups.size(); ++i)
356  if (m_groups[i]->isInside(detector)) {
357  ++inside;
358  index = i + 1;
359  }
360  if (inside == 0) {
361  index = 0;
362  edm::LogError("TrackerMaterialAnalysis")
363  << "TrackingMaterialAnalyser::findLayer(...): ERROR: detector does not belong to any DetLayer" << std::endl;
364  edm::LogError("TrackerMaterialAnalysis")
365  << "TrackingMaterialAnalyser::findLayer(...): detector position: " << std::fixed
366  << " (r: " << std::setprecision(1) << std::setw(5) << detector.position().perp()
367  << ", z: " << std::setprecision(1) << std::setw(6) << detector.position().z()
368  << ", phi: " << std::setprecision(3) << std::setw(6) << detector.position().phi() << ")" << std::endl;
369  }
370  if (inside > 1) {
371  index = 0;
372  edm::LogError("TrackerMaterialAnalysis") << "TrackingMaterialAnalyser::findLayer(...): ERROR: detector belongs to "
373  << inside << " DetLayers" << std::endl;
374  edm::LogError("TrackerMaterialAnalysis")
375  << "TrackingMaterialAnalyser::findLayer(...): detector position: " << std::fixed
376  << " (r: " << std::setprecision(1) << std::setw(5) << detector.position().perp()
377  << ", z: " << std::setprecision(1) << std::setw(6) << detector.position().z()
378  << ", phi: " << std::setprecision(3) << std::setw(6) << detector.position().phi() << ")" << std::endl;
379  }
380 
381  return index;
382 }

References hgcalTestNeighbor_cfi::detector, alignBH_cfg::fixed, mps_fire::i, and m_groups.

Referenced by split().

◆ saveLayerPlots()

void DD4hep_TrackingMaterialAnalyser::saveLayerPlots ( )
private

Definition at line 127 of file DD4hep_TrackingMaterialAnalyser.cc.

127  {
128  for (unsigned int i = 0; i < m_groups.size(); ++i) {
130  layer.savePlots();
131  }
132 }

References mps_fire::i, m_groups, and DD4hep_MaterialAccountingGroup::savePlots().

Referenced by endJob().

◆ saveParameters()

void DD4hep_TrackingMaterialAnalyser::saveParameters ( const char *  name)
private

Definition at line 70 of file DD4hep_TrackingMaterialAnalyser.cc.

70  {
71  std::ofstream parameters(name);
72  edm::LogVerbatim("TrackerMaterialAnalysis") << "TrackingMaterialAnalyser" << std::endl;
73  for (unsigned int i = 0; i < m_groups.size(); ++i) {
75  edm::LogVerbatim("TrackerMaterialAnalysis") << "TrackingMaterialAnalyser" << layer.name() << std::endl;
76  edm::LogVerbatim("TrackerMaterialAnalysis")
77  << "TrackingMaterialAnalyser" << fmt::sprintf("\tnumber of hits: %9d", layer.tracks())
78  << std::endl;
79  edm::LogVerbatim("TrackerMaterialAnalysis")
80  << "TrackingMaterialAnalyser"
81  << fmt::sprintf("\tnormalized segment length: %9.1f ± %9.1f cm", layer.averageLength(), layer.sigmaLength())
82  << std::endl;
83  edm::LogVerbatim("TrackerMaterialAnalysis") << "TrackingMaterialAnalyser"
84  << fmt::sprintf("\tnormalized radiation lengths: %9.3f ± %9.3f",
86  layer.sigmaRadiationLengths())
87  << std::endl;
88  edm::LogVerbatim("TrackerMaterialAnalysis")
89  << "TrackingMaterialAnalyser"
90  << fmt::sprintf("\tnormalized energy loss: %6.5fe-03 ± %6.5fe-03 GeV",
91  layer.averageEnergyLoss(),
92  layer.sigmaEnergyLoss())
93  << std::endl;
94  parameters << fmt::sprintf("%-20s\t%7d\t%5.1f ± %5.1f cm\t%6.4f ± %6.4f \t%6.4fe-03 ± %6.4fe-03 GeV",
95  layer.name(),
96  layer.tracks(),
97  layer.averageLength(),
98  layer.sigmaLength(),
100  layer.sigmaRadiationLengths(),
101  layer.averageEnergyLoss(),
102  layer.sigmaEnergyLoss())
103  << std::endl;
104  }
105  edm::LogVerbatim("TrackerMaterialAnalysis") << "TrackingMaterialAnalyser" << std::endl;
106 
107  parameters.close();
108 }

References DD4hep_MaterialAccountingGroup::averageEnergyLoss(), DD4hep_MaterialAccountingGroup::averageLength(), DD4hep_MaterialAccountingGroup::averageRadiationLengths(), mps_fire::i, m_groups, Skims_PA_cff::name, DD4hep_MaterialAccountingGroup::name(), DD4hep_MaterialAccountingGroup::sigmaEnergyLoss(), DD4hep_MaterialAccountingGroup::sigmaLength(), DD4hep_MaterialAccountingGroup::sigmaRadiationLengths(), and DD4hep_MaterialAccountingGroup::tracks().

Referenced by endJob().

◆ saveXml()

void DD4hep_TrackingMaterialAnalyser::saveXml ( const char *  name)
private

Definition at line 111 of file DD4hep_TrackingMaterialAnalyser.cc.

111  {
112  std::ofstream xml(name);
113  xml << "<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl;
114  xml << "<Groups>" << std::endl;
115  for (unsigned int i = 0; i < m_groups.size(); ++i) {
117  xml << " <Group name=\"" << layer.name() << "\">\n"
118  << " <Parameter name=\"TrackerRadLength\" value=\"" << layer.averageRadiationLengths() << "\"/>\n"
119  << " <Parameter name=\"TrackerXi\" value=\"" << layer.averageEnergyLoss() << "\"/>\n"
120  << " </Group>\n"
121  << std::endl;
122  }
123  xml << "</Groups>" << std::endl;
124 }

References DD4hep_MaterialAccountingGroup::averageEnergyLoss(), DD4hep_MaterialAccountingGroup::averageRadiationLengths(), mps_fire::i, m_groups, Skims_PA_cff::name, and DD4hep_MaterialAccountingGroup::name().

Referenced by endJob().

◆ split()

void DD4hep_TrackingMaterialAnalyser::split ( MaterialAccountingTrack track)
private

Definition at line 192 of file DD4hep_TrackingMaterialAnalyser.cc.

192  {
193  using namespace edm;
194  // group sensitive detectors by their DetLayer
195  std::vector<int> group(track.detectors().size());
196  for (unsigned int i = 0; i < track.detectors().size(); ++i)
197  group[i] = findLayer(track.detectors()[i]);
198 
199  for (unsigned int i = 0; i < group.size(); ++i)
200  if (group[i] > 0)
201  edm::LogVerbatim("TrackerMaterialAnalysis") << "TrackingMaterialAnalyser:\n"
202  << "For detector i: " << i << " index: " << group[i]
203  << " R-ranges: " << m_groups[group[i] - 1]->getBoundingR().first
204  << ", " << m_groups[group[i] - 1]->getBoundingR().second << group[i]
205  << " Z-ranges: " << m_groups[group[i] - 1]->getBoundingZ().first
206  << ", " << m_groups[group[i] - 1]->getBoundingZ().second << std::endl;
207 
208  unsigned int detectors = track.detectors().size();
209  if (detectors == 0) {
210  // the track doesn't cross any active detector:
211  // keep al material as unassigned
212  if (m_plotter)
213  for (unsigned int i = 1; i < track.steps().size(); ++i)
214  m_plotter->plotSegmentUnassigned(track.steps()[i]);
215  } else {
216  const double TOLERANCE = 0.0001; // 1 um tolerance
217  std::vector<double> limits(detectors + 2);
218 
219  // define the trivial limits
221  limits[0] = track.detectors()[0].m_curvilinearIn - TOLERANCE;
222  else
223  limits[0] = -TOLERANCE;
225  limits[detectors] = track.detectors()[detectors - 1].m_curvilinearOut + TOLERANCE;
226  else
227  limits[detectors] = track.summary().length() + TOLERANCE;
228  limits[detectors + 1] = INFINITY; // this is probably no more needed, but doesn't harm...
229 
230  // pick the algorithm to define the non-trivial limits
231  switch (m_splitMode) {
232  // assign each segment to the the nearest layer
233  // e.g. the material between pixel barrel 3 and TIB 1 will be split among the two
234  case NEAREST_LAYER:
235  for (unsigned int i = 1; i < detectors; ++i) {
236  limits[i] = (track.detectors()[i - 1].m_curvilinearOut + track.detectors()[i].m_curvilinearIn) / 2.;
237  }
238  break;
239 
240  // assign each segment to the the inner layer
241  // e.g. all material between pixel barrel 3 and TIB 1 will go into the pixel barrel
242  case INNER_LAYER:
243  for (unsigned int i = 1; i < detectors; ++i)
244  limits[i] = track.detectors()[i].m_curvilinearIn - TOLERANCE;
245  break;
246 
247  // assign each segment to the the outer layer
248  // e.g. all material between pixel barrel 3 and TIB 1 will go into the TIB
249  case OUTER_LAYER:
250  for (unsigned int i = 1; i < detectors; ++i)
251  limits[i] = track.detectors()[i - 1].m_curvilinearOut + TOLERANCE;
252  break;
253 
254  case UNDEFINED:
255  [[fallthrough]];
256 
257  default:
258  // throw something
259  throw edm::Exception(edm::errors::LogicError) << "Invalid SplitMode";
260  }
261 
262  double begin = 0.; // beginning of step, along the track
263  double end = 0.; // end of step, along the track
264  unsigned int i = 1; // step conter
265 
266  // skip the material before the first layer
267  while (end < limits[0]) {
268  const MaterialAccountingStep& step = track.steps()[i++];
269  end = begin + step.length();
270 
271  // do not account material before the first layer
272  if (m_plotter)
273  m_plotter->plotSegmentUnassigned(step);
274 
275  begin = end;
276  }
277 
278  unsigned int index = 0; // which detector
279  while (i < track.steps().size()) {
280  const MaterialAccountingStep& step = track.steps()[i++];
281 
282  end = begin + step.length();
283 
284  if (begin > limits[detectors]) {
285  // segment after last layer and skipping requested in configuation
286  if (m_plotter)
287  m_plotter->plotSegmentUnassigned(step);
288  begin = end;
289  continue;
290  }
291 
292  // from here onwards we should be in the accountable region, either completely in a single layer:
293  // limits[index] <= begin < end <= limits[index+1]
294  // or possibly split between 2 layers
295  // limits[index] < begin < limits[index+1] < end < limits[index+2]
296  if (begin < limits[index] or end > limits[index + 2]) {
297  // sanity check
298  edm::LogError("TrackerMaterialAnalysis")
299  << "TrackingMaterialAnalyser::split(): ERROR: internal logic error, expected " << limits[index] << " < "
300  << begin << " < " << limits[index + 1] << std::endl;
301  break;
302  }
303 
304  if (limits[index] <= begin and end <= limits[index + 1]) {
305  // step completely inside current detector range
306  track.detectors()[index].account(step, begin, end);
307  if (m_plotter)
308  m_plotter->plotSegmentInLayer(step, group[index]);
309  } else {
310  // step shared beteewn two detectors, transition at limits[index+1]
311  double fraction = (limits[index + 1] - begin) / (end - begin);
312  assert(fraction < 1.);
313  std::pair<MaterialAccountingStep, MaterialAccountingStep> parts = step.split(fraction);
314 
315  if (m_plotter) {
316  if (index > 0)
317  m_plotter->plotSegmentInLayer(parts.first, group[index]);
318  else
319  // track outside acceptance, keep as unassocated
320  m_plotter->plotSegmentUnassigned(parts.first);
321 
322  if (index + 1 < detectors)
323  m_plotter->plotSegmentInLayer(parts.second, group[index + 1]);
324  else
325  // track outside acceptance, keep as unassocated
326  m_plotter->plotSegmentUnassigned(parts.second);
327  }
328 
329  track.detectors()[index].account(parts.first, begin, limits[index + 1]);
330  ++index; // next layer
331  if (index < detectors)
332  track.detectors()[index].account(parts.second, limits[index + 1], end);
333  }
334  begin = end;
335  }
336  }
337 
338  // add the material from each detector to its layer (if there is one and only one)
339  for (unsigned int i = 0; i < track.detectors().size(); ++i)
340  if (group[i] != 0)
341  m_groups[group[i] - 1]->addDetector(track.detectors()[i]);
342 
343  // end of track: commit internal buffers and reset the m_groups internal state for a new track
344  for (unsigned int i = 0; i < m_groups.size(); ++i)
345  m_groups[i]->endOfTrack();
346 }

References cms::cuda::assert(), MuonGeometrySanityCheck_cfi::detectors(), mps_fire::end, Exception, findLayer(), HLT_FULL_cff::fraction, watchdog::group, mps_fire::i, INNER_LAYER, TH2PolyOfflineMaps::limits, edm::errors::LogicError, m_groups, m_plotter, m_skipAfterLastDetector, m_skipBeforeFirstDetector, m_splitMode, NEAREST_LAYER, or, OUTER_LAYER, contentValuesFiles::parts, HLT_FULL_cff::track, and UNDEFINED.

Referenced by analyze().

Member Data Documentation

◆ m_groupNames

std::vector<std::string> DD4hep_TrackingMaterialAnalyser::m_groupNames
private

Definition at line 47 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by analyze(), and DD4hep_TrackingMaterialAnalyser().

◆ m_groups

std::vector<DD4hep_MaterialAccountingGroup *> DD4hep_TrackingMaterialAnalyser::m_groups
private

◆ m_isHFNose

bool DD4hep_TrackingMaterialAnalyser::m_isHFNose
private

Definition at line 45 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser().

◆ m_isHGCal

bool DD4hep_TrackingMaterialAnalyser::m_isHGCal
private

Definition at line 44 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser().

◆ m_materialToken

edm::EDGetTokenT<std::vector<MaterialAccountingTrack> > DD4hep_TrackingMaterialAnalyser::m_materialToken
private

Definition at line 35 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by analyze(), and DD4hep_TrackingMaterialAnalyser().

◆ m_plotter

std::unique_ptr<DD4hep_TrackingMaterialPlotter> DD4hep_TrackingMaterialAnalyser::m_plotter
private

◆ m_saveDetailedPlots

bool DD4hep_TrackingMaterialAnalyser::m_saveDetailedPlots
private

Definition at line 41 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser(), and endJob().

◆ m_saveParameters

bool DD4hep_TrackingMaterialAnalyser::m_saveParameters
private

Definition at line 42 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser(), and endJob().

◆ m_saveSummaryPlot

bool DD4hep_TrackingMaterialAnalyser::m_saveSummaryPlot
private

Definition at line 40 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser(), and endJob().

◆ m_saveXml

bool DD4hep_TrackingMaterialAnalyser::m_saveXml
private

Definition at line 43 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser(), and endJob().

◆ m_skipAfterLastDetector

bool DD4hep_TrackingMaterialAnalyser::m_skipAfterLastDetector
private

Definition at line 38 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser(), and split().

◆ m_skipBeforeFirstDetector

bool DD4hep_TrackingMaterialAnalyser::m_skipBeforeFirstDetector
private

Definition at line 39 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser(), and split().

◆ m_splitMode

SplitMode DD4hep_TrackingMaterialAnalyser::m_splitMode
private

Definition at line 37 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by DD4hep_TrackingMaterialAnalyser(), and split().

◆ m_tag

edm::ESInputTag DD4hep_TrackingMaterialAnalyser::m_tag
private

Definition at line 36 of file DD4hep_TrackingMaterialAnalyser.h.

Referenced by analyze(), and DD4hep_TrackingMaterialAnalyser().

DD4hep_TrackingMaterialAnalyser::m_groupNames
std::vector< std::string > m_groupNames
Definition: DD4hep_TrackingMaterialAnalyser.h:47
MuonGeometrySanityCheck_cfi.detectors
def detectors(dt=True, csc=True, me42=False, chambers=True, superlayers=False, layers=False)
Definition: MuonGeometrySanityCheck_cfi.py:13
DD4hep_MaterialAccountingGroup::tracks
unsigned int tracks(void) const
Definition: DD4hep_MaterialAccountingGroup.h:70
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11776
DD4hep_TrackingMaterialAnalyser::m_tag
edm::ESInputTag m_tag
Definition: DD4hep_TrackingMaterialAnalyser.h:36
step
step
Definition: StallMonitor.cc:94
edm::errors::LogicError
Definition: EDMException.h:37
DD4hep_TrackingMaterialAnalyser::INNER_LAYER
Definition: DD4hep_TrackingMaterialAnalyser.h:22
DD4hep_TrackingMaterialAnalyser::saveLayerPlots
void saveLayerPlots()
Definition: DD4hep_TrackingMaterialAnalyser.cc:127
edm
HLT enums.
Definition: AlignableModifier.h:19
DD4hep_TrackingMaterialAnalyser::m_saveParameters
bool m_saveParameters
Definition: DD4hep_TrackingMaterialAnalyser.h:42
DD4hep_TrackingMaterialAnalyser::m_splitMode
SplitMode m_splitMode
Definition: DD4hep_TrackingMaterialAnalyser.h:37
cms::cuda::assert
assert(be >=bs)
DD4hep_MaterialAccountingGroup::sigmaRadiationLengths
double sigmaRadiationLengths(void) const
Definition: DD4hep_MaterialAccountingGroup.cc:224
DD4hep_TrackingMaterialAnalyser::m_saveXml
bool m_saveXml
Definition: DD4hep_TrackingMaterialAnalyser.h:43
DD4hep_TrackingMaterialAnalyser::UNDEFINED
Definition: DD4hep_TrackingMaterialAnalyser.h:22
DD4hep_MaterialAccountingGroup::sigmaLength
double sigmaLength(void) const
Definition: DD4hep_MaterialAccountingGroup.cc:220
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DD4hep_TrackingMaterialAnalyser::m_isHGCal
bool m_isHGCal
Definition: DD4hep_TrackingMaterialAnalyser.h:44
contentValuesFiles.parts
parts
Definition: contentValuesFiles.py:58
DD4hep_MaterialAccountingGroup
Definition: DD4hep_MaterialAccountingGroup.h:23
DD4hep_TrackingMaterialAnalyser::m_groups
std::vector< DD4hep_MaterialAccountingGroup * > m_groups
Definition: DD4hep_TrackingMaterialAnalyser.h:46
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52858
DD4hep_TrackingMaterialAnalyser::m_plotter
std::unique_ptr< DD4hep_TrackingMaterialPlotter > m_plotter
Definition: DD4hep_TrackingMaterialAnalyser.h:48
mps_fire.end
end
Definition: mps_fire.py:242
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DD4hep_TrackingMaterialAnalyser::m_skipBeforeFirstDetector
bool m_skipBeforeFirstDetector
Definition: DD4hep_TrackingMaterialAnalyser.h:39
DD4hep_MaterialAccountingGroup::averageLength
double averageLength(void) const
Definition: DD4hep_MaterialAccountingGroup.cc:212
DD4hep_MaterialAccountingGroup::sigmaEnergyLoss
double sigmaEnergyLoss(void) const
Definition: DD4hep_MaterialAccountingGroup.cc:230
DD4hep_TrackingMaterialAnalyser::NEAREST_LAYER
Definition: DD4hep_TrackingMaterialAnalyser.h:22
DD4hep_TrackingMaterialAnalyser::m_saveSummaryPlot
bool m_saveSummaryPlot
Definition: DD4hep_TrackingMaterialAnalyser.h:40
MaterialAccountingTrack
Definition: MaterialAccountingTrack.h:10
DD4hep_TrackingMaterialAnalyser::saveXml
void saveXml(const char *name)
Definition: DD4hep_TrackingMaterialAnalyser.cc:111
DD4hep_TrackingMaterialAnalyser::OUTER_LAYER
Definition: DD4hep_TrackingMaterialAnalyser.h:22
DD4hep_MaterialAccountingGroup::savePlots
void savePlots(void)
Definition: DD4hep_MaterialAccountingGroup.cc:149
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
DD4hep_TrackingMaterialAnalyser::m_saveDetailedPlots
bool m_saveDetailedPlots
Definition: DD4hep_TrackingMaterialAnalyser.h:41
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
DD4hep_MaterialAccountingGroup::averageEnergyLoss
double averageEnergyLoss(void) const
Definition: DD4hep_MaterialAccountingGroup.cc:216
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:45
DD4hep_TrackingMaterialAnalyser::m_skipAfterLastDetector
bool m_skipAfterLastDetector
Definition: DD4hep_TrackingMaterialAnalyser.h:38
MaterialAccountingStep
Definition: MaterialAccountingStep.h:9
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
DD4hep_MaterialAccountingGroup::averageRadiationLengths
double averageRadiationLengths(void) const
Definition: DD4hep_MaterialAccountingGroup.cc:234
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
DD4hep_TrackingMaterialAnalyser::m_materialToken
edm::EDGetTokenT< std::vector< MaterialAccountingTrack > > m_materialToken
Definition: DD4hep_TrackingMaterialAnalyser.h:35
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
DD4hep_TrackingMaterialAnalyser::m_isHFNose
bool m_isHFNose
Definition: DD4hep_TrackingMaterialAnalyser.h:45
DD4hep_TrackingMaterialAnalyser::split
void split(MaterialAccountingTrack &track)
Definition: DD4hep_TrackingMaterialAnalyser.cc:192
DD4hep_TrackingMaterialAnalyser::saveParameters
void saveParameters(const char *name)
Definition: DD4hep_TrackingMaterialAnalyser.cc:70
DD4hep_MaterialAccountingGroup::name
const std::string & name(void) const
Definition: DD4hep_MaterialAccountingGroup.h:71
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
DD4hep_TrackingMaterialAnalyser::findLayer
int findLayer(const MaterialAccountingDetector &detector)
Definition: DD4hep_TrackingMaterialAnalyser.cc:352
watchdog.group
group
Definition: watchdog.py:82