CMS 3D CMS Logo

offlineValidationTemplates.py
Go to the documentation of this file.
1 
3 offlineTemplate = """
4 process.oneGoodVertexFilter = cms.EDFilter("VertexSelector",
5  src = cms.InputTag("offlinePrimaryVertices"),
6  cut = cms.string("!isFake && ndof > 4 && abs(z) <= 15 && position.Rho <= 2"), # tracksSize() > 3 for the older cut
7  filter = cms.bool(True), # otherwise it won't filter the events, just produce an empty vertex collection.
8  )
9 
10 
11 
12 process.FilterGoodEvents=cms.Sequence(process.oneGoodVertexFilter)
13 
14 
15 process.noScraping= cms.EDFilter("FilterOutScraping",
16  src=cms.InputTag(".oO[TrackCollection]Oo."),
17  applyfilter = cms.untracked.bool(True),
18  debugOn = cms.untracked.bool(False), ## Or 'True' to get some per-event info
19  numtrack = cms.untracked.uint32(10),
20  thresh = cms.untracked.double(0.25)
21  )
22 ####################################
23 
24 # Use compressions settings of TFile
25 # see https://root.cern.ch/root/html534/TFile.html#TFile:SetCompressionSettings
26 # settings = 100 * algorithm + level
27 # level is from 1 (small) to 9 (large compression)
28 # algo: 1 (ZLIB), 2 (LMZA)
29 # see more about compression & performance: https://root.cern.ch/root/html534/guides/users-guide/InputOutput.html#compression-and-performance
30 compressionSettings = 207
31 
32  ##
33  ## Load and Configure OfflineValidation and Output File
34  ##
35 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
36 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..compressionSettings = compressionSettings,
37 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'FinalTrackRefitter'
38 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'FinalTrackRefitter'
39 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = .oO[offlineModuleLevelHistsTransient]Oo.
40 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelProfiles = .oO[offlineModuleLevelProfiles]Oo.
41 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..stripYResiduals = .oO[stripYResiduals]Oo.
42 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..maxTracks = .oO[maxtracks]Oo./ .oO[parallelJobs]Oo.
43 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..chargeCut = .oO[chargeCut]Oo.
44 """
45 
46 OfflineValidationSequence = "process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo."
47 
48 
49 
51 mergeOfflineParJobsTemplate="""
52 #include "Alignment/OfflineValidation/scripts/merge_TrackerOfflineValidation.C"
53 
54 int TkAlOfflineJobsMerge(TString pars, TString outFile)
55 {
56 // load framework lite just to find the CMSSW libs...
57 gSystem->Load("libFWCoreFWLite");
58 FWLiteEnabler::enable();
59 
60 return hadd(pars, outFile);
61 }
62 """
63 
64 
65 
67 offlineFileOutputTemplate = """
68 process.TFileService.fileName = '.oO[outputFile]Oo.'
69 """
70 
71 
72 
74 offlineDqmFileOutputTemplate = """
75 process.DqmSaverTkAl.workflow = '.oO[workflow]Oo.'
76 process.DqmSaverTkAl.dirName = '.oO[workdir]Oo./.'
77 process.DqmSaverTkAl.forceRunNumber = .oO[firstRunNumber]Oo.
78 """
79 
80 
81 
83 extendedValidationExecution="""
84 #run extended offline validation scripts
85 echo -e "\n\nRunning extended offline validation"
86 
87 cp .oO[extendedValScriptPath]Oo. .
88 root -x -b -q -l TkAlExtendedOfflineValidation.C
89 
90 """
91 
92 
93 
95 extendedValidationTemplate="""
96 #include "Alignment/OfflineValidation/macros/PlotAlignmentValidation.C"
97 #include "FWCore/FWLite/interface/FWLiteEnabler.h"
98 
99 void TkAlExtendedOfflineValidation()
100 {
101  TkAlStyle::legendheader = ".oO[legendheader]Oo.";
102  TkAlStyle::legendoptions = ".oO[legendoptions]Oo.";
103  TkAlStyle::set(.oO[publicationstatus]Oo., .oO[era]Oo., ".oO[customtitle]Oo.", ".oO[customrighttitle]Oo.");
104  bool bigtext = .oO[bigtext]Oo.;
105  gStyle->SetTitleH ( 0.07 );
106  gStyle->SetTitleW ( 1.00 );
107  gStyle->SetTitleFont ( 132 );
108  // load framework lite just to find the CMSSW libs...
109  gSystem->Load("libFWCoreFWLite");
110  FWLiteEnabler::enable();
111 
112  PlotAlignmentValidation p(bigtext);
113 .oO[PlottingInstantiation]Oo.
114  p.setOutputDir(".oO[datadir]Oo./.oO[PlotsDirName]Oo.");
115  p.useFitForDMRplots(.oO[usefit]Oo.);
116  p.setTreeBaseDir(".oO[OfflineTreeBaseDir]Oo.");
117  p.plotDMR(".oO[DMRMethod]Oo.",.oO[DMRMinimum]Oo.,".oO[DMROptions]Oo.");
118  p.plotSurfaceShapes(".oO[SurfaceShapes]Oo.");
119  p.plotChi2("root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./.oO[validationId]Oo._result.root");
120  vector<int> moduleids = {.oO[moduleid]Oo.};
121  for (auto moduleid : moduleids) {
122  p.residual_by_moduleID(moduleid);
123  }
124 }
125 """