|
|
Go to the documentation of this file.
10 #include <fmt/printf.h>
35 if (strcasecmp(splitmode.c_str(),
"NearestLayer") == 0) {
37 }
else if (strcasecmp(splitmode.c_str(),
"InnerLayer") == 0) {
39 }
else if (strcasecmp(splitmode.c_str(),
"OuterLayer") == 0) {
44 <<
"Invalid SplitMode \"" << splitmode
45 <<
"\". Acceptable values are \"NearestLayer\", \"InnerLayer\", \"OuterLayer\".";
78 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
81 std::cout << fmt::sprintf(
"\tnumber of hits: %9d", layer.
tracks()) << std::endl;
85 std::cout << fmt::sprintf(
"\tnormalized radiation lengths: %9.3f ± %9.3f",
89 std::cout << fmt::sprintf(
"\tnormalized energy loss: %6.5fe-03 ± %6.5fe-03 GeV",
93 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",
111 std::ofstream xml(
name);
112 xml <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl;
113 xml <<
"<Groups>" << std::endl;
114 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
116 xml <<
" <Group name=\"" << layer.
name() <<
"\">\n"
118 <<
" <Parameter name=\"TrackerXi\" value=\"" << layer.
averageEnergyLoss() <<
"\"/>\n"
122 xml <<
"</Groups>" << std::endl;
127 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]
295 <<
" < " << begin <<
" < " <<
limits[
index + 1] << std::endl;
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;
std::vector< std::string > m_groupNames
const std::string & name(void) const
get the layer name
def detectors(dt=True, csc=True, me42=False, chambers=True, superlayers=False, layers=False)
double sigmaEnergyLoss(void) const
return the sigma of the normalized energy loss density factor for Bethe-Bloch
void analyze(const edm::Event &, const edm::EventSetup &) override
double averageRadiationLengths(void) const
return the average normalized number of radiation lengths
void plotSegmentUnassigned(const MaterialAccountingStep &step)
int findLayer(const MaterialAccountingDetector &detector)
void saveXml(const char *name)
double sigmaRadiationLengths(void) const
return the sigma of the normalized number of radiation lengths
Log< level::Info, false > LogInfo
#define DEFINE_FWK_MODULE(type)
TrackingMaterialAnalyser(const edm::ParameterSet &)
TrackingMaterialPlotter * m_plotter
double averageEnergyLoss(void) const
return the average normalized energy loss density factor for Bethe-Bloch
bool m_skipBeforeFirstDetector
void plotSegmentInLayer(const MaterialAccountingStep &step, int layer)
double sigmaLength(void) const
return the sigma of the normalized layer thickness
unsigned int tracks(void) const
return the number of tracks that hit this layer
edm::EDGetTokenT< std::vector< MaterialAccountingTrack > > m_materialToken
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
void savePlots(void)
save the plots
T getParameter(std::string const &) const
void saveParameters(const char *name)
bool m_skipAfterLastDetector
double averageLength(void) const
return the average normalized layer thickness
std::vector< MaterialAccountingGroup * > m_groups
~TrackingMaterialAnalyser() override
void split(MaterialAccountingTrack &track)