test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 47 of file beamerCreator.py.

References any().

Referenced by edm::eventsetup::ComponentFactory< T >.addTo(), AlignmentProducer.AlignmentProducer(), HLTTauDQMPathPlotter.bookHistograms(), RecoBTag.checkCreateDirectory(), CombinedHitTripletGenerator.CombinedHitTripletGenerator(), CombinedMultiHitGenerator.CombinedMultiHitGenerator(), CombinedSeedComparitor.CombinedSeedComparitor(), CombinedTrajectoryFactory.CombinedTrajectoryFactory(), CompositeLogicalTrajectoryFilter.CompositeLogicalTrajectoryFilter(), CompositeTrajectoryFilter.CompositeTrajectoryFilter(), CompositeTSG.CompositeTSG(), edmplugin::PluginFactory< R *(Args...)>.create(), PCLTrackerAlProducer.createCalibrations(), edm::serviceregistry::ServicesManager.createServices(), createWatchers(), CSCSegmentBuilder.CSCSegmentBuilder(), CtfSpecialSeedGenerator.CtfSpecialSeedGenerator(), DTDigitizer.DTDigitizer(), EgammaHLTRegionalPixelSeedGeneratorProducers.EgammaHLTRegionalPixelSeedGeneratorProducers(), ora::ContainerSchema.extend(), EcalUncalibRecHitProducer.fillDescriptions(), edm::serviceregistry::ServicesManager.fillListOfMakers(), edm::Factory.findMaker(), LumiCorrectionParam.getCorrection(), HGCalRecHitProducer.HGCalRecHitProducer(), HGCalUncalibRecHitProducer.HGCalUncalibRecHitProducer(), RunManager.initG4(), RunManagerMT.initG4(), TStorageFactoryFile.Initialize(), VersionedSelector< T >.initialize(), mps_validate.main(), edm.makeInput(), edm::PresenceFactory.makePresence(), edm::VectorInputSourceFactory.makeVectorInputSource(), ora::ContainerSchema.mappingForDependentClass(), PFRecHitCreatorBase.PFRecHitCreatorBase(), PFRecHitProducer.PFRecHitProducer(), PFRecoTauChargedHadronProducer.PFRecoTauChargedHadronProducer(), PFTauMVAInputDiscriminantTranslator.PFTauMVAInputDiscriminantTranslator(), PhotonEnergyCorrector.PhotonEnergyCorrector(), PixelTrackReconstruction.PixelTrackReconstruction(), PixelTripletHLTGenerator.PixelTripletHLTGenerator(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1.processEvent(), CSCChannelMapperESProducer.produce(), CSCIndexerESProducer.produce(), NavigationSchoolESProducer.produce(), TrajectoryCleanerESProducer.produce(), DetIdAssociatorESProducer.produce(), CandidateProducer< TColl, CColl, Selector, Conv, Creator, Init >.produce(), RecoTauCleanerImpl< Prod >.RecoTauCleanerImpl(), RecoTauPiZeroProducer.RecoTauPiZeroProducer(), RecoTauProducer.RecoTauProducer(), SeedFilter.SeedFilter(), SeedForPhotonConversionFromQuadruplets.SeedForPhotonConversionFromQuadruplets(), SeedGeneratorFromRegionHitsEDProducer.SeedGeneratorFromRegionHitsEDProducer(), TrajectorySeedProducer.TrajectorySeedProducer(), edmplugin::PluginFactory< R *(Args...)>.tryToCreate(), TSGFromL1Muon.TSGFromL1Muon(), TSGFromOrderedHits.TSGFromOrderedHits(), TSGSmart.TSGSmart(), and edm::eventsetup.validateEventSetupParameters().

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