10 #include <fmt/printf.h>
36 if (strcasecmp(splitmode.c_str(),
"NearestLayer") == 0) {
38 }
else if (strcasecmp(splitmode.c_str(),
"InnerLayer") == 0) {
40 }
else if (strcasecmp(splitmode.c_str(),
"OuterLayer") == 0) {
45 <<
"Invalid SplitMode \"" << splitmode
46 <<
"\". Acceptable values are \"NearestLayer\", \"InnerLayer\", \"OuterLayer\".";
56 if (m_saveSummaryPlot) {
59 }
else if (m_isHFNose) {
79 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
82 std::cout << fmt::sprintf(
"\tnumber of hits: %9d", layer.
tracks()) << std::endl;
86 std::cout << fmt::sprintf(
"\tnormalized radiation lengths: %9.3f ± %9.3f",
90 std::cout << fmt::sprintf(
"\tnormalized energy loss: %6.5fe-03 ± %6.5fe-03 GeV",
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",
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"
119 <<
" <Parameter name=\"TrackerXi\" value=\"" << layer.
averageEnergyLoss() <<
"\"/>\n"
123 xml <<
"</Groups>" << std::endl;
128 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
146 m_plotter->normalize();
166 LogInfo(
"TrackingMaterialAnalyser") <<
"TrackingMaterialAnalyser: List of the tracker groups: " << std::endl;
167 for (
unsigned int i = 0; i <
m_groups.size(); ++
i)
168 LogInfo(
"TrackingMaterialAnalyser") << i <<
" TrackingMaterialAnalyser:\t" <<
m_groups[
i]->info() << std::endl;
173 for (std::vector<MaterialAccountingTrack>::const_iterator
t = h_tracks->begin(),
end = h_tracks->end();
t !=
end;
193 for (
unsigned int i = 0;
i < track.
detectors().size(); ++
i)
196 for (
unsigned int i = 0;
i <
group.size(); ++
i)
198 LogInfo(
"TrackingMaterialAnalyser") <<
"For detector i: " <<
i <<
" index: " <<
group[
i]
199 <<
" R-ranges: " <<
m_groups[
group[
i] - 1]->getBoundingR().first <<
", "
201 <<
" Z-ranges: " <<
m_groups[
group[
i] - 1]->getBoundingZ().first <<
", "
209 for (
unsigned int i = 1;
i < track.
steps().size(); ++
i)
212 const double TOLERANCE = 0.0001;
217 limits[0] = track.
detectors()[0].m_curvilinearIn - TOLERANCE;
219 limits[0] = -TOLERANCE;
240 limits[
i] = track.
detectors()[
i].m_curvilinearIn - TOLERANCE;
247 limits[
i] = track.
detectors()[
i - 1].m_curvilinearOut + TOLERANCE;
263 while (end < limits[0]) {
265 end = begin + step.
length();
274 unsigned int index = 0;
275 while (i < track.
steps().size()) {
278 end = begin + step.
length();
292 if (begin < limits[index]
or end > limits[index + 2]) {
294 std::cerr <<
"MaterialAccountingTrack::split(): ERROR: internal logic error, expected " << limits[
index]
295 <<
" < " << begin <<
" < " << limits[index + 1] << std::endl;
299 if (limits[index] <= begin and end <= limits[index + 1]) {
306 double fraction = (limits[index + 1] -
begin) / (end - begin);
308 std::pair<MaterialAccountingStep, MaterialAccountingStep>
parts = step.
split(fraction);
317 if (index + 1 < detectors)
324 track.
detectors()[
index].account(parts.first, begin, limits[index + 1]);
326 if (index < detectors)
327 track.
detectors()[
index].account(parts.second, limits[index + 1], end);
334 for (
unsigned int i = 0;
i < track.
detectors().size(); ++
i)
357 std::cerr <<
"TrackingMaterialAnalyser::findLayer(...): ERROR: detector does not belong to any DetLayer"
359 std::cerr <<
"TrackingMaterialAnalyser::findLayer(...): detector position: " << std::fixed
360 <<
" (r: " << std::setprecision(1) << std::setw(5) << detector.
position().
perp()
361 <<
", z: " << std::setprecision(1) << std::setw(6) << detector.
position().
z()
362 <<
", phi: " << std::setprecision(3) << std::setw(6) << detector.
position().
phi() <<
")" << std::endl;
366 std::cerr <<
"TrackingMaterialAnalyser::findLayer(...): ERROR: detector belongs to " << inside <<
" DetLayers"
368 std::cerr <<
"TrackingMaterialAnalyser::findLayer(...): detector position: " << std::fixed
369 <<
" (r: " << std::setprecision(1) << std::setw(5) << detector.
position().
perp()
370 <<
", z: " << std::setprecision(1) << std::setw(6) << detector.
position().
z()
371 <<
", phi: " << std::setprecision(3) << std::setw(6) << detector.
position().
phi() <<
")" << std::endl;
void plotSegmentUnassigned(const MaterialAccountingStep &step)
const std::vector< MaterialAccountingDetector > & detectors() const
bool m_skipAfterLastDetector
const std::vector< MaterialAccountingStep > & steps() const
double averageRadiationLengths(void) const
return the average normalized number of radiation lengths
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
double sigmaLength(void) const
return the sigma of the normalized layer thickness
#define DEFINE_FWK_MODULE(type)
double sigmaRadiationLengths(void) const
return the sigma of the normalized number of radiation lengths
~TrackingMaterialAnalyser() override
Geom::Phi< T > phi() const
double length(void) const
double sigmaEnergyLoss(void) const
return the sigma of the normalized energy loss density factor for Bethe-Bloch
void split(MaterialAccountingTrack &track)
unsigned int tracks(void) const
return the number of tracks that hit this layer
double averageLength(void) const
return the average normalized layer thickness
void saveXml(const char *name)
constexpr std::array< uint8_t, layerIndexSize > layer
void saveParameters(const char *name)
int findLayer(const MaterialAccountingDetector &detector)
double averageEnergyLoss(void) const
return the average normalized energy loss density factor for Bethe-Bloch
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< std::vector< MaterialAccountingTrack > > m_materialToken
const std::string & name(void) const
get the layer name
Log< level::Info, false > LogInfo
std::vector< std::string > m_groupNames
TrackingMaterialPlotter * m_plotter
std::vector< MaterialAccountingGroup * > m_groups
bool m_skipBeforeFirstDetector
void savePlots(void)
save the plots
T getParameter(std::string const &) const
std::pair< MaterialAccountingStep, MaterialAccountingStep > split(double fraction) const
split the step (0..1) in (0..f) + (f..1) using linear interpolation
const GlobalPoint & position() const
TrackingMaterialAnalyser(const edm::ParameterSet &)
void plotSegmentInLayer(const MaterialAccountingStep &step, int layer)
const MaterialAccountingStep & summary() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
edm::ESGetToken< DDCompactView, IdealGeometryRecord > m_dddToken