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\".";
79 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
82 std::cout << fmt::sprintf(
"\tnumber of hits: %9d",
layer.tracks()) << std::endl;
84 "\tnormalized segment length: %9.1f ± %9.1f cm",
layer.averageLength(),
layer.sigmaLength())
86 std::cout << fmt::sprintf(
"\tnormalized radiation lengths: %9.3f ± %9.3f",
87 layer.averageRadiationLengths(),
88 layer.sigmaRadiationLengths())
90 std::cout << fmt::sprintf(
"\tnormalized energy loss: %6.5fe-03 ± %6.5fe-03 GeV",
91 layer.averageEnergyLoss(),
92 layer.sigmaEnergyLoss())
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",
97 layer.averageLength(),
99 layer.averageRadiationLengths(),
100 layer.sigmaRadiationLengths(),
101 layer.averageEnergyLoss(),
102 layer.sigmaEnergyLoss())
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" 123 xml <<
"</Groups>" << std::endl;
128 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
166 LogInfo(
"TrackingMaterialAnalyser") <<
"TrackingMaterialAnalyser: List of the tracker groups: " << std::endl;
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;
192 std::vector<int>
group(
track.detectors().size());
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;
232 limits[
i] = (
track.detectors()[
i - 1].m_curvilinearOut +
track.detectors()[
i].m_curvilinearIn) / 2.;
240 limits[
i] =
track.detectors()[
i].m_curvilinearIn - TOLERANCE;
247 limits[
i] =
track.detectors()[
i - 1].m_curvilinearOut + TOLERANCE;
274 unsigned int index = 0;
275 while (
i <
track.steps().size()) {
294 std::cerr <<
"MaterialAccountingTrack::split(): ERROR: internal logic error, expected " <<
limits[
index]
308 std::pair<MaterialAccountingStep, MaterialAccountingStep>
parts =
step.split(
fraction);
334 for (
unsigned int i = 0;
i <
track.detectors().size(); ++
i)
357 std::cerr <<
"TrackingMaterialAnalyser::findLayer(...): ERROR: detector does not belong to any DetLayer" 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" 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)
T getParameter(std::string const &) const
bool m_skipAfterLastDetector
~TrackingMaterialAnalyser() override
void split(MaterialAccountingTrack &track)
void saveXml(const char *name)
void saveParameters(const char *name)
int findLayer(const MaterialAccountingDetector &detector)
def detectors(dt=True, csc=True, me42=False, chambers=True, superlayers=False, layers=False)
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
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< std::vector< MaterialAccountingTrack > > m_materialToken
Log< level::Info, false > LogInfo
std::vector< std::string > m_groupNames
TrackingMaterialPlotter * m_plotter
std::vector< MaterialAccountingGroup * > m_groups
bool m_skipBeforeFirstDetector
TrackingMaterialAnalyser(const edm::ParameterSet &)
void plotSegmentInLayer(const MaterialAccountingStep &step, int layer)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > m_dddToken