CMS 3D CMS Logo

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

Functions

def main
 

Variables

string allLabel = 'all'
 
list collection_choices = [allLabel]
 
string default = "DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root"
 
string help = "DQM file to plot the validation plots from"
 
string hitCalLabel = 'hitCalibration'
 
string hitValLabel = 'hitValidation'
 
string layerClustersLabel = 'layerClusters'
 
tuple opts = parser.parse_args()
 
tuple parser = argparse.ArgumentParser(description="Create set of HGCal validation plots from one or more DQM files.")
 
list simClustersIters = [hgcalValidator.label_SimClustersLevel._InputTag__moduleLabel, "ticlSimTracksters"]
 
string simLabel = 'simulation'
 
list trackstersIters = ['ticlTracksters'+iteration for iteration in ticlIterLabelsMerge]
 
string trackstersLabel = 'tracksters'
 
string trackstersWithEdgesLabel = 'trackstersWithEdges'
 

Function Documentation

def makeHGCalValidationPlots.main (   opts)

Definition at line 30 of file makeHGCalValidationPlots.py.

References hgcalPlots.append_hgcalCaloParticlesPlots(), hgcalPlots.append_hgcalDigisPlots(), hgcalPlots.append_hgcalHitsPlots(), hgcalPlots.append_hgcalLayerClustersPlots(), hgcalPlots.append_hgcalSimClustersPlots(), hgcalPlots.append_hgcalTrackstersPlots(), hgcalPlots.create_hgcalTrackstersPlotter(), join(), and print().

30 
31 def main(opts):
32 
33  drawArgs={}
34  extendedFlag = False
35  if opts.no_ratio:
36  drawArgs["ratio"] = False
37  if opts.separate:
38  drawArgs["separate"] = True
39  if opts.png:
40  drawArgs["saveFormat"] = ".png"
41  if opts.extended:
42  extendedFlag = True
43  if opts.verbose:
44  plotting.verbose = True
45 
46  filenames = [(f, f.replace(".root", "")) for f in opts.files]
47  sample = SimpleSample(opts.subdirprefix[0], opts.html_sample, filenames)
48 
49  val = SimpleValidation([sample], opts.outputDir[0])
50  if opts.separate:
51  val = SeparateValidation([sample], opts.outputDir[0])
52  htmlReport = val.createHtmlReport(validationName=opts.html_validation_name[0])
53 
54  #layerClusters
55  def plot_LC():
56  hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
57  hgcalPlots.append_hgcalLayerClustersPlots(hgcalValidator.label_layerClusterPlots._InputTag__moduleLabel, "Layer Clusters", extendedFlag)
58  val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)
59 
60  #simClusters
61  def plot_SC():
62  hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter]
63  for i_iter in simClustersIters:
65  val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs)
66 
67  #tracksters
68  def plot_Tst():
69  hgctrackster = [hgcalPlots.hgcalTrackstersPlotter]
70  for tracksterCollection in trackstersIters :
71  hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection)
72  val.doPlots(hgctrackster, plotterDrawArgs=drawArgs)
73 
74  #trackstersWithEdges
75  def plot_TstEdges():
76  plot_Tst()
77  for tracksterCollection in trackstersIters :
78  hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)]
79  val.doPlots(hgctracksters, plotterDrawArgs=drawArgs)
80 
81  #caloParticles
82  def plot_CP():
83  particletypes = {"pion-":"-211", "pion+":"211", "pion0": "111",
84  "muon-": "-13", "muon+":"13",
85  "electron-": "-11", "electron+": "11", "photon": "22",
86  "kaon0L": "310", "kaon0S": "130",
87  "kaon-": "-321", "kaon+": "321"}
88  hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter]
89  for i_part, i_partID in particletypes.items() :
90  hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID, i_part)
91  val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs)
92 
93  #hitValidation
94  def plot_hitVal():
95  hgchit = [hgcalPlots.hgcalHitPlotter]
96  hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits")
97  hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits")
98  hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis")
99  val.doPlots(hgchit, plotterDrawArgs=drawArgs)
100 
101  #hitCalibration
102  def plot_hitCal():
103  hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter]
104  val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs)
105 
106 
107  plotDict = {hitCalLabel:[plot_hitCal], hitValLabel:[plot_hitVal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersWithEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP]}
108 
109  if (opts.collection != allLabel):
110  for task in plotDict[opts.collection]:
111  task()
112  else:
113  for label in plotDict:
114  if (label == trackstersLabel): continue # already run in trackstersWithEdges
115  for task in plotDict[label]:
116  task()
117 
118  if opts.no_html:
119  print("Plots created into directory '%s'." % opts.outputDir)
120  else:
121  htmlReport.write()
122 
123  print("Plots and HTML report created into directory '%s'. You can just move it to some www area and access the pages via web browser" % (','.join(opts.outputDir)))
def append_hgcalSimClustersPlots
Definition: hgcalPlots.py:2414
def append_hgcalDigisPlots
Definition: hgcalPlots.py:2764
def append_hgcalCaloParticlesPlots
Definition: hgcalPlots.py:2507
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def append_hgcalTrackstersPlots
Definition: hgcalPlots.py:2466
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def create_hgcalTrackstersPlotter
Definition: hgcalPlots.py:2558
def append_hgcalHitsPlots
Definition: hgcalPlots.py:2695
def append_hgcalLayerClustersPlots
Definition: hgcalPlots.py:2274

Variable Documentation

string makeHGCalValidationPlots.allLabel = 'all'

Definition at line 25 of file makeHGCalValidationPlots.py.

list makeHGCalValidationPlots.collection_choices = [allLabel]

Definition at line 27 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.default = "DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root"

Definition at line 127 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.help = "DQM file to plot the validation plots from"

Definition at line 128 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.hitCalLabel = 'hitCalibration'

Definition at line 19 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.hitValLabel = 'hitValidation'

Definition at line 20 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.layerClustersLabel = 'layerClusters'

Definition at line 21 of file makeHGCalValidationPlots.py.

tuple makeHGCalValidationPlots.opts = parser.parse_args()

Definition at line 152 of file makeHGCalValidationPlots.py.

tuple makeHGCalValidationPlots.parser = argparse.ArgumentParser(description="Create set of HGCal validation plots from one or more DQM files.")

Definition at line 125 of file makeHGCalValidationPlots.py.

list makeHGCalValidationPlots.simClustersIters = [hgcalValidator.label_SimClustersLevel._InputTag__moduleLabel, "ticlSimTracksters"]

Definition at line 15 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.simLabel = 'simulation'

Definition at line 24 of file makeHGCalValidationPlots.py.

list makeHGCalValidationPlots.trackstersIters = ['ticlTracksters'+iteration for iteration in ticlIterLabelsMerge]

Definition at line 16 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.trackstersLabel = 'tracksters'

Definition at line 22 of file makeHGCalValidationPlots.py.

string makeHGCalValidationPlots.trackstersWithEdgesLabel = 'trackstersWithEdges'

Definition at line 23 of file makeHGCalValidationPlots.py.