CMS 3D CMS Logo

Classes | Functions
beamerCreator Namespace Reference

Classes

class  Out
 
class  TexTemplate
 

Functions

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

Function Documentation

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

Definition at line 43 of file beamerCreator.py.

References any().

Referenced by edm::eventsetup::ComponentFactory< T >.addTo(), HLTTauDQMPathPlotter.bookHistograms(), CAHitQuadrupletGenerator.CAHitQuadrupletGenerator(), CAHitTripletGenerator.CAHitTripletGenerator(), RecoBTag.checkCreateDirectory(), CombinedHitTripletGenerator.CombinedHitTripletGenerator(), CombinedMultiHitGenerator.CombinedMultiHitGenerator(), CombinedSeedComparitor.CombinedSeedComparitor(), CombinedTrajectoryFactory.CombinedTrajectoryFactory(), CompositeLogicalTrajectoryFilter.CompositeLogicalTrajectoryFilter(), CompositeTrajectoryFilter.CompositeTrajectoryFilter(), CompositeTSG.CompositeTSG(), edmplugin::PluginFactory< R *(Args...)>.create(), AlignmentProducerBase.createCalibrations(), edm::serviceregistry::ServicesManager.createServiceFor(), createWatchers(), CSCSegmentBuilder.CSCSegmentBuilder(), CtfSpecialSeedGenerator.CtfSpecialSeedGenerator(), DTDigitizer.DTDigitizer(), EgammaHLTRegionalPixelSeedGeneratorProducers.EgammaHLTRegionalPixelSeedGeneratorProducers(), FastSimProducer.FastSimProducer(), EcalUncalibRecHitProducer.fillDescriptions(), edm::serviceregistry::ServicesManager.fillListOfMakers(), edm::Factory.findMaker(), FTLRecHitProducer.FTLRecHitProducer(), FTLUncalibratedRecHitProducer.FTLUncalibratedRecHitProducer(), LumiCorrectionParam.getCorrection(), gen::JetMatching.getPartonList(), HGCalMulticlusteringImpl.HGCalMulticlusteringImpl(), HGCalRecHitProducer.HGCalRecHitProducer(), HGCalTriggerNtupleManager.HGCalTriggerNtupleManager(), HGCalUncalibRecHitProducer.HGCalUncalibRecHitProducer(), RunManagerMT.initG4(), RunManager.initG4(), HGCalTriggerNtupleHGCMulticlusters.initialize(), TStorageFactoryFile.Initialize(), VersionedSelector< T >.initialize(), EgammaTowerIsolationNew< NC >.initSoa(), edm::PluginDescription< T >.loadDescription(), edm.makeInput(), edm::PresenceFactory.makePresence(), edm::VectorInputSourceFactory.makeVectorInputSource(), MTDRecHitProducer.MTDRecHitProducer(), MTDUncalibratedRecHitProducer.MTDUncalibratedRecHitProducer(), MVAValueMapProducer< ParticleType >.MVAValueMapProducer(), PFRecHitCreatorBase.PFRecHitCreatorBase(), PFRecHitProducer.PFRecHitProducer(), PFRecoTauChargedHadronProducer.PFRecoTauChargedHadronProducer(), PFTauMVAInputDiscriminantTranslator.PFTauMVAInputDiscriminantTranslator(), PhotonEnergyCorrector.PhotonEnergyCorrector(), PixelTripletHLTGenerator.PixelTripletHLTGenerator(), edm::PreMixingModule.PreMixingModule(), CSCIndexerESProducer.produce(), CSCChannelMapperESProducer.produce(), HGCalTriggerGeometryESProducer.produce(), NavigationSchoolESProducer.produce(), TrajectoryCleanerESProducer.produce(), DetIdAssociatorESProducer.produce(), CandidateProducer< TColl, CColl, Selector, Conv, Creator, Init >.produce(), RecoTauCleanerImpl< Prod >.RecoTauCleanerImpl(), RecoTauPiZeroProducer.RecoTauPiZeroProducer(), RecoTauProducer.RecoTauProducer(), RPCRecHitProducer.RPCRecHitProducer(), SeedCreatorFromRegionHitsEDProducerT< T_SeedCreator >.SeedCreatorFromRegionHitsEDProducerT(), SeedFilter.SeedFilter(), SeedFinderSelector.SeedFinderSelector(), SeedForPhotonConversionFromQuadruplets.SeedForPhotonConversionFromQuadruplets(), SeedGeneratorFromRegionHitsEDProducer.SeedGeneratorFromRegionHitsEDProducer(), MonitorElement.setAccumulate(), evf::EvFDaqDirector.setDeleteTracking(), PFBlockAlgo.setLinkers(), TrajectorySeedProducer.TrajectorySeedProducer(), edmplugin::PluginFactory< R *(Args...)>.tryToCreate(), TSGFromOrderedHits.TSGFromOrderedHits(), TSGSmart.TSGSmart(), edm::eventsetup.validateEventSetupParameters(), cond::persistency::GTSchema.~GTSchema(), cond::persistency::IOVSchema.~IOVSchema(), cond::persistency::RunInfoSchema.~RunInfoSchema(), cond::persistency::GLOBAL_TAG::Table.~Table(), cond::persistency::TAG::Table.~Table(), cond::persistency::RUN_INFO::Table.~Table(), cond::persistency::GLOBAL_TAG_MAP::Table.~Table(), cond::persistency::PAYLOAD::Table.~Table(), cond::persistency::IOV::Table.~Table(), and cond::persistency::TAG_LOG::Table.~Table().

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