CMS 3D CMS Logo

Classes | Functions
beamerCreator Namespace Reference

Classes

class  Out
 
class  TexTemplate
 

Functions

def create (alignables, pedeDump, additionalData, outputFile, config)
 

Function Documentation

◆ create()

def beamerCreator.create (   alignables,
  pedeDump,
  additionalData,
  outputFile,
  config 
)

Definition at line 44 of file beamerCreator.py.

44 def create(alignables, pedeDump, additionalData, outputFile, config):
45  logger = logging.getLogger("mpsvalidate")
46 
47  # load template
48  with open(os.path.join(config.mpspath, "templates",
49  "mpsvalidate_beamer_template.tex")) as template:
50  data = template.read()
51  template.close()
52 
53  # create object where data could be substituted
54  data = TexTemplate(data)
55 
56  # output string
57  out = Out()
58  text = ""
59 
60  # title page
61  if (config.message):
62  text += """\centering
63  \\vspace*{{4cm}}
64  \Huge\\bfseries Alignment Validation\par
65  \\vspace{{2cm}}
66  \scshape\huge Alignment Campaign\\\\ {{{0}}}\par
67  \\vfill
68  \large \\today\par""".format(config.message)
69  else:
70  text += """\centering
71  \\vspace*{4cm}
72  \Huge\\bfseries Alignment Validation\par
73  \\vfill
74  \large \\today\par"""
75  out.addSlide("", text)
76 
77  # table of contents
78  text = "\\tableofcontents"
79  out.addSlide("Overview", text)
80 
81  # general information
82  out.add("\section{General information}")
83  text = ""
84  if (config.message):
85  text = "Project: {{{0}}}\\\\\n".format(config.message)
86  text += "Input-Path:\n"
87  text += "\\begin{verbatim}\n"
88  text += config.jobDataPath+"\n"
89  text += "\\end{verbatim}\n"
90  out.addSlide_fragile("General information", text)
91 
92  # alignment_merge.py
93  try:
94  out.add("\subsection{Alignment Configuration}")
95  text = "\\textbf{{PedeSteerer method:}} {{{0}}}\\\\\n".format(
96  additionalData.pede_steerer_method)
97  text += "\\textbf{{PedeSteerer options:}}\\\\\n"
98  for line in additionalData.pede_steerer_options:
99  text += "{{{0}}}\\\\\n".format(line)
100  text += "\\textbf{{PedeSteerer command:}} {0}\\\\\n".format(
101  additionalData.pede_steerer_command)
102  out.addSlide("Alignment Configuration", text)
103  except Exception as e:
104  logger.error("data not found - {0} {1}".format(type(e), e))
105 
106  # table of input files with number of tracks
107  if config.showmonitor:
108  out.add("\subsection{Datasets with tracks}")
109  text = """\\begin{table}[h]
110  \centering
111  \caption{Datasets with tracks}
112  \\begin{tabular}{ccc}
113  \hline
114  Dataset & Number of used tracks & Weight \\\\
115  \hline \n"""
116  try:
117  for monitor in mpsv_classes.MonitorData.monitors:
118  text += "{0} & {1} & {2}\\\\\n".format(monitor.name, monitor.ntracks,
119  monitor.weight if monitor.weight != None else "--")
120  except Exception as e:
121  logger.error("data not found - {0} {1}".format(type(e), e))
122  if (pedeDump.nrec):
123  text += "\hline\nNumber of records & {0}\\\\\n".format(pedeDump.nrec)
124  text += """\hline
125  \end{tabular}\n
126  \end{table}\n"""
127  text += "The information in this table is based on the monitor root files. Note that the number of tracks which where used in the pede step can differ from this table.\n"
128  out.addSlide("Datasets with tracks", text)
129 
130  # pede.dump.gz
131  out.add("\subsection{Pede monitoring information}")
132  try:
133  if (pedeDump.sumValue != 0):
134  text = r"\begin{{align*}}Sum(Chi^2)/Sum(Ndf) &= {0}\\ &= {1}\end{{align*}}".format(
135  pedeDump.sumSteps, pedeDump.sumValue)
136  else:
137  text = r"\begin{{align*}}Sum(W*Chi^2)/Sum(Ndf)/<W> &= {0}\\ &= {1}\end{{align*}}".format(
138  pedeDump.sumSteps, pedeDump.sumWValue)
139  text += r"with correction for down-weighting: {0}\\".format(
140  pedeDump.correction)
141  text += r"Peak dynamic memory allocation: {0} GB\\".format(pedeDump.memory)
142  text += r"Total time: {0} h {1} m {2} s\\".format(
143  pedeDump.time[0], pedeDump.time[1], pedeDump.time[2])
144  text += r"Number of records: {0}\\".format(pedeDump.nrec)
145  text += r"Total number of parameters: {0}\\".format(pedeDump.ntgb)
146  text += r"Number of variable parameters: {0}\\".format(pedeDump.nvgb)
147  out.addSlide("Pede monitoring information", text)
148  except Exception as e:
149  logger.error("data not found - {0} {1}".format(type(e), e))
150 
151  # Parameter plots
152  out.add("\section{Parameter plots}")
153 
154  # high level Structures
155  out.add("\subsection{High-level parameters}")
156  big = [x for x in config.outputList if (x.plottype == "big")]
157 
158  for i in big:
159  text = "\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".format(
160  config.outputPath, i.filename)
161 
162  out.addSlide("High-level parameters", text)
163 
164  # time (IOV) dependent plots
165  out.add("\subsection{High-level parameters versus time (IOV)}")
166  time = [x for x in config.outputList if (x.plottype == "time")]
167 
168  if time:
169  # get list with names of the structures
170  for structure in [x.name for x in time if x.parameter == "xyz"]:
171  for mode in ["xyz", "rot"]:
172  text = "\\framesubtitle{{{0}}}\n".format(structure)
173  if any([x.filename for x in time if (x.parameter == mode and x.name == structure)]):
174  filename = [x.filename for x in time if (x.parameter == mode and x.name == structure)][0]
175  text += "\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".format(
176  config.outputPath, filename)
177 
178  out.addSlide("High-level parameters versus time (IOV)", text)
179 
180  # hole modules
181  out.add("\subsection{Module-level parameters}")
182  # check if there are module plots
183  if any(x for x in config.outputList if (x.plottype == "mod" and x.number == "")):
184 
185  # loop over all structures
186  for moduleName in [x.name for x in alignables.structures]:
187 
188  # check if there is a plot for this module
189  if any(x for x in config.outputList if (x.plottype == "mod" and x.number == "" and x.name == moduleName)):
190 
191  # loop over modes
192  for mode in ["xyz", "rot", "dist"]:
193 
194  # get module plot
195  module = [x for x in config.outputList if (
196  x.plottype == "mod" and x.number == "" and x.name == moduleName and x.parameter == mode)]
197  # get list of sub module plots
198  moduleSub = [x for x in config.outputList if (
199  x.plottype == "subMod" and x.number != "" and x.name == moduleName and x.parameter == mode)]
200 
201  # check if plot there is a plot in this mode
202  if module:
203  text = "\\framesubtitle{{{0}}}\n".format(moduleName)
204  text += "\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".format(
205  config.outputPath, module[0].filename)
206 
207  out.addSlide("Module-level parameters", text)
208 
209  # loop over submodules
210  for plot in moduleSub:
211  text = "\\framesubtitle{{{0}}}\n".format(
212  moduleName)
213  text += "\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".format(
214  config.outputPath, plot.filename)
215 
216  out.addSlide("Module-level parameters", text)
217 
218  # plot taken from the millePedeMonitor_merge.root file
219  out.add("\section{Monitor plots}")
220  for plot in [x for x in config.outputList if x.plottype == "monitor"]:
221  text = "\\framesubtitle{{{0}}}\n".format(plot.name)
222  text += "\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".format(
223  config.outputPath, plot.filename)
224  out.addSlide("Monitor", text)
225 
226  data = data.substitute(out=out.text)
227 
228  with open(os.path.join(config.outputPath, outputFile), "w") as output:
229  output.write(data)
230  output.close()
231 
232  # TODO run pdflatex
233  for i in range(2):
234  os.system("pdflatex -output-directory={0} {1}/{2}".format(
235  config.outputPath, config.outputPath, outputFile))

References any(), and FastTimerService_cff.range.

Referenced by FWItemAccessorFactory.accessorFor(), edm::eventsetup::ComponentFactory< T >.addTo(), AlignmentMonitorAsAnalyzer.AlignmentMonitorAsAnalyzer(), FFTJetProducer.beginJob(), HLTTauDQMPathPlotter.bookHistograms(), FFTJetProducer.buildGridAlg(), RecoBTag.checkCreateDirectory(), CombinedSeedComparitor.CombinedSeedComparitor(), CombinedTrajectoryFactory.CombinedTrajectoryFactory(), CompositeLogicalTrajectoryFilter.CompositeLogicalTrajectoryFilter(), CompositeTrajectoryFilter.CompositeTrajectoryFilter(), CompositeTSG.CompositeTSG(), AlignmentProducerBase.createCalibrations(), AlignmentProducerBase.createMonitors(), edm::serviceregistry::ServicesManager.createServiceFor(), createWatchers(), CSCSegmentBuilder.CSCSegmentBuilder(), CtfSpecialSeedGenerator.CtfSpecialSeedGenerator(), EcalBarrelClusterFastTimer.EcalBarrelClusterFastTimer(), gen::ExternalDecayDriver.ExternalDecayDriver(), FastSimProducer.FastSimProducer(), fftjetcms.fftjet_MembershipFunction_parser(), EcalUncalibRecHitProducer.fillDescriptions(), edm::serviceregistry::ServicesManager.fillListOfMakers(), edm::Factory.findMaker(), LumiCorrectionParam.getCorrection(), dqm::impl::MonitorElement.getQReport(), HGCalTriggerNtupleManager.HGCalTriggerNtupleManager(), HLTMuonIsoFilter.HLTMuonIsoFilter(), RunManager.initG4(), RunManagerMT.initG4(), TStorageFactoryFile.Initialize(), MillePedeAlignmentAlgorithm.initialize(), edm::PluginDescription< T >.loadDescription(), l1t::UnpackerFactory.make(), l1t::PackerFactory.make(), edm.makeInput(), edm::PresenceFactory.makePresence(), edm::VectorInputSourceFactory.makeVectorInputSource(), MTDDigiProducer.MTDDigiProducer(), pat::ObjectModifier< T >.ObjectModifier(), evf::EvFDaqDirector.openFULockfileStream(), PFClusterProducer.PFClusterProducer(), PFRecHitCreatorBase.PFRecHitCreatorBase(), PFRecHitProducer.PFRecHitProducer(), PFRecoTauChargedHadronProducer.PFRecoTauChargedHadronProducer(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1.processEvent(), TrajectoryCleanerESProducer.produce(), CSCChannelMapperESProducer.produce(), CSCIndexerESProducer.produce(), HGCalTriggerGeometryESProducer.produce(), NavigationSchoolESProducer.produce(), CandidateProducer< TColl, CColl, Selector, Conv, Creator, Init >.produce(), RecoTauPiZeroProducer.RecoTauPiZeroProducer(), RecoTauProducer.RecoTauProducer(), SeedGeneratorFromRegionHitsEDProducer.SeedGeneratorFromRegionHitsEDProducer(), PFBlockAlgo.setImporters(), PFBlockAlgo.setLinkers(), TSGFromOrderedHits.TSGFromOrderedHits(), TSGSmart.TSGSmart(), edm::eventsetup.validateEventSetupParameters(), and VirtualJetProducer.VirtualJetProducer().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
any
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:38
format
HcalHPDFilter_cfg.Out
Out
Definition: HcalHPDFilter_cfg.py:16