CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
beamerCreator Namespace Reference

Classes

class  Out
 
class  TexTemplate
 

Functions

def create
 

Function Documentation

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

Definition at line 44 of file beamerCreator.py.

References any(), and sistrip::SpyUtilities.range().

Referenced by edm::eventsetup::ComponentFactory< T >.addTo(), AlignmentMonitorAsAnalyzer.AlignmentMonitorAsAnalyzer(), BeamSpotDipServer.BeamSpotDipServer(), HLTTauDQMPathPlotter.bookHistograms(), RecoBTag.checkCreateDirectory(), CombinedSeedComparitor.CombinedSeedComparitor(), CombinedTrajectoryFactory.CombinedTrajectoryFactory(), CompositeLogicalTrajectoryFilter.CompositeLogicalTrajectoryFilter(), CompositeTrajectoryFilter.CompositeTrajectoryFilter(), CompositeTSG.CompositeTSG(), edmplugin::PluginFactory< R *(Args...)>.create(), AlignmentProducerBase.createCalibrations(), AlignmentProducerBase.createMonitors(), edm::serviceregistry::ServicesManager.createServiceFor(), createWatchers(), CSCSegmentBuilder.CSCSegmentBuilder(), CtfSpecialSeedGenerator.CtfSpecialSeedGenerator(), EcalBarrelClusterFastTimer.EcalBarrelClusterFastTimer(), etaMaxForPtThreshold_(), FastSimProducer.FastSimProducer(), EcalUncalibRecHitProducer.fillDescriptions(), edm::serviceregistry::ServicesManager.fillListOfMakers(), edm::Factory.findMaker(), edm.for(), LumiCorrectionParam.getCorrection(), MVAValueMapProducer< ParticleType >.getMVAEstimators(), HGCalTriggerNtupleManager.HGCalTriggerNtupleManager(), RunManagerMT.initG4(), TStorageFactoryFile.Initialize(), edm::PluginDescription< T >.loadDescription(), main(), edm.makeInput(), edm::PresenceFactory.makePresence(), edm::VectorInputSourceFactory.makeVectorInputSource(), MTDDigiProducer.MTDDigiProducer(), pat::ObjectModifier< T >.ObjectModifier(), PFClusterProducer.PFClusterProducer(), PFRecHitCreatorBase.PFRecHitCreatorBase(), PFRecHitProducer.PFRecHitProducer(), PFRecoTauChargedHadronProducer.PFRecoTauChargedHadronProducer(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1.processEvent(), CSCChannelMapperESProducer.produce(), CSCIndexerESProducer.produce(), TrajectoryCleanerESProducer.produce(), HGCalTriggerGeometryESProducer.produce(), NavigationSchoolESProducer.produce(), CandidateProducer< TColl, CColl, Selector, Conv, Creator, Init >.produce(), RecoTauPiZeroProducer.RecoTauPiZeroProducer(), RecoTauProducer.RecoTauProducer(), edmplugin::PluginFactory< R *(Args...)>.tryToCreate(), and edm::eventsetup.validateEventSetupParameters().

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