3 from JetMonitoring.JetMonitoringConf
import JetKinematicHistos, HistosForJetSelection, LeadingJetsRelations, EfficiencyResponseHistos
6 from JetMonitoring.JetHistoManager
import jetHistoManager
as jhm
7 from JetMonitoring.JetAttributeHistoManager
import attributeHistoManager
8 from JetMonitoring.HistoDefinitionHelpers
import createHistoDefTool
as hdef
13 compactSpecification = {
27 "DetectorEta" : ((
"DetectorEta;DetectorEta;",100,-5,5),(
"DetectorEta",
"float")),
28 "NTrimSubjets" : ((
"NTrimSubjets;NTrimSubjets;",20,0,20),(
"NTrimSubjets",
"int")),
29 "TrackSumPt" : ((
"TrackSumPt;TrackSumPt;",80,0,8000),(
"TrackSumPt",
"float")),
30 "TrackSumMass" : ((
"TrackSumMass;TrackSumMass;",100,0,10000),(
"TrackSumMass",
"float")),
31 "Qw" : ((
"Qw;Qw;",100,0,100000),(
"Qw",
"float")),
32 "KtDR" : ((
"KtDR;KtDR;",100,0,10),(
"KtDR",
"float")),
34 "Tau1" : ((
"Tau1;Tau1;",100,0,1.0),(
"Tau1",
"float")),
35 "Tau2" : ((
"Tau2;Tau2;",100,0,1.0),(
"Tau2",
"float")),
36 "Tau3" : ((
"Tau3;Tau3;",100,0,1.0),(
"Tau3",
"float")),
37 "Tau1_wta" : ((
"Tau1_wta;Tau1_wta;",100,0,1.0),(
"Tau1_wta",
"float")),
38 "Tau2_wta" : ((
"Tau2_wta;Tau2_wta;",100,0,1.0),(
"Tau2_wta",
"float")),
39 "Tau3_wta" : ((
"Tau3_wta;Tau3_wta;",100,0,1.0),(
"Tau3_wta",
"float")),
40 "Tau21" : ((
"Tau21;Tau21;",100,0,1.0),(
"Tau21",
"float")),
41 "Tau32" : ((
"Tau32;Tau32;",100,0,1.0),(
"Tau32",
"float")),
42 "Tau21_wta" : ((
"Tau21_wta;Tau21_wta;",100,0,1.0),(
"Tau21_wta",
"float")),
43 "Tau32_wta" : ((
"Tau32_wta;Tau32_wta;",100,0,1.0),(
"Tau32_wta",
"float")),
45 "Dip12" : ((
"Dip12;Dip12;",100,-1,2),(
"Dip12",
"float")),
46 "Dip13" : ((
"Dip13;Dip13;",100,-1,2),(
"Dip13",
"float")),
47 "Dip23" : ((
"Dip23;Dip23;",100,-1,2),(
"Dip23",
"float")),
48 "DipExcl12" : ((
"DipExcl12;DipExcl12;",100,-1,2),(
"DipExcl12",
"float")),
50 "Split12" : ((
"Split12;Split12;",100,0,70000),(
"Split12",
"float")),
51 "Split23" : ((
"Split23;Split23;",60,0,24000),(
"Split23",
"float")),
52 "Split34" : ((
"Split34;Split34;",100,0,10000),(
"Split34",
"float")),
54 "ZCut12" : ((
"ZCut12;ZCut12;",100,0,1.0),(
"ZCut12",
"float")),
55 "ZCut23" : ((
"ZCut23;ZCut23;",100,0,1.0),(
"ZCut23",
"float")),
56 "ZCut34" : ((
"ZCut34;ZCut34;",100,0,1.0),(
"ZCut34",
"float")),
58 "Angularity" : ((
"Angularity;Angularity;",50,-.1,.1), (
"Angularity",
"float")),
60 "PlanarFlow" : ((
"PlanarFlow;PlanarFlow;",100,-1,1.1),(
"PlanarFlow",
"float")),
62 "Mu12" : ((
"Mu12;Mu12;",100,0,1.0),(
"Mu12",
"float")),
64 "ECF1" : ((
"ECF1;ECF1;",50,0,200000),(
"ECF1",
"float")),
65 "ECF2" : ((
"ECF2;ECF2;",100,0,2e10),(
"ECF2",
"float")),
66 "ECF3" : ((
"ECF3;ECF3;",100,0,1e14),(
"ECF3",
"float")),
67 "ECF1_Beta2" : ((
"ECF1_Beta2;ECF1_Beta2;",100,-1,1),(
"ECF1_Beta2",
"float")),
68 "ECF2_Beta2" : ((
"ECF2_Beta2;ECF2_Beta2;",100,-1,1),(
"ECF2_Beta2",
"float")),
69 "ECF3_Beta2" : ((
"ECF3_Beta2;ECF3_Beta2;",100,-1,1),(
"ECF3_Beta2",
"float")),
71 "C1" : ((
"C1;C1;",100,-1,1), (
"C1",
"float")),
72 "C2" : ((
"C2;C2;",100,-1,1), (
"C2",
"float")),
73 "D2" : ((
"D2;D2;",100, 0,10), (
"D2",
"float")),
74 "C1_Beta2" : ((
"C1;C1;",100,-1,1), (
"C1",
"float")),
75 "C2_Beta2" : ((
"C2_Beta2;C2_Beta2;",100,-1,1), (
"C2_Beta2",
"float")),
76 "D2_Beta2" : ((
"D2_Beta2;D2_Beta2;",100,-1,1), (
"D2_Beta2",
"float")),
78 "ThrustMin" : ((
"ThrustMin;ThrustMin;",100,-1,2),(
"ThrustMin",
"float")),
79 "ThrustMaj" : ((
"ThrustMaj;ThrustMaj;",100,-1,2),(
"ThrustMaj",
"float")),
80 "FoxWolfram0" : ((
"FoxWolfram0;FoxWolfram0;",100,-1,1),(
"FoxWolfram0",
"float")),
81 "FoxWolfram1" : ((
"FoxWolfram0;FoxWolfram1;",100,-1,1),(
"FoxWolfram1",
"float")),
82 "FoxWolfram2" : ((
"FoxWolfram0;FoxWolfram2;",100,-1,1),(
"FoxWolfram2",
"float")),
83 "FoxWolfram3" : ((
"FoxWolfram0;FoxWolfram3;",100,-1,1),(
"FoxWolfram3",
"float")),
84 "FoxWolfram4" : ((
"FoxWolfram0;FoxWolfram4;",100,-1,1),(
"FoxWolfram4",
"float")),
85 "Sphericity" : ((
"Sphericity;Sphericity;",100,0,1),(
"Sphericity",
"float")),
86 "Aplanarity" : ((
"Aplanarity;Aplanarity;",100,0,1),(
"Aplanarity",
"float")),
88 "PullMag" : ((
"PullMag;PullMag;",100,0,100),(
"PullMag",
"float")),
89 "PullPhi" : ((
"PullPhi;PullPhi;",100,-6.3,6.3),(
"PullPhi",
"float")),
90 "Pull_C00" : ((
"Pull_C00;Pull_C00;",100,-1,1),(
"Pull_C00",
"float")),
91 "Pull_C01" : ((
"Pull_C01;Pull_C01;",100,-1,1),(
"Pull_C01",
"float")),
92 "Pull_C10" : ((
"Pull_C10;Pull_C10;",100,-1,1),(
"Pull_C10",
"float")),
93 "Pull_C11" : ((
"Pull_C11;Pull_C11;",100,-1,1),(
"Pull_C11",
"float")),
95 "Charge" : ((
"Charge;Charge;",100,-2,2),(
"Charge",
"float")),
97 "ShowerDeconstructionW": ((
"ShowerDeconstructionW;ShowerDeconstructionW;",100,-100,100),(
"ShowerDeconstructionW",
"float")),
98 "ShowerDeconstructionTop": ((
"ShowerDeconstructionTop;ShowerDeconstructionTop;",100,-100,100),(
"ShowerDeconstructionTop",
"float")),
100 "Volatility" : ((
"Volatility;Volatility;",100,-100,100),(
"Volatility",
"float")),
102 "pt" : ((
"Jet Pt;Pt [MeV];", 100, 0, 200) , (
"pt",
"float",
"gev" ) ),
103 "Width" : ((
"Jet Width;Width;", 50, 0, 1.0) , (
"Width",
"float" ) ),
104 "Width15" : ((
"Jet Width;Width;", 50, 0, 1.5) , (
"Width",
"float" ) ),
105 "EMFrac" : ((
"EM Fraction;EM fraction;", 50, -0.1, 1.4), (
"EMFrac",
"float") ),
106 "HECFrac" : ((
"HEC Fraction;HEC fraction;", 50, -0.1, 1.4), (
"HECFrac",
"float") ),
107 "Timing" : ((
"Jet Time info;Time;", 40, -20, 20) , (
"Timing",
"float") ),
108 "NegativeE" : ((
"Negative E in Jet;Energy;", 80, -10, 0), (
"NegativeE",
"float",
"gev") ),
109 "LArQuality" : ((
"LAr quality;Energy;", 50, -0.4, 1.2), (
"LArQuality",
"float") ),
111 "GhostTruthCount" : ((
"Number of associate truth part;Number;", 60,0,60) , (
"GhostTruthCount",
"int")),
112 "GhostTruthAssociationFraction" : ((
"Fraction of associated truth particles from a matched truth jet jet;GhostTruthAssociationFraction;", 50,0,1.) , (
"GhostTruthAssociationFraction",
"float")),
113 "GhostTrackCount" : ((
"Number of associate tracks;Number;", 60,0,60), (
"GhostTrackCount",
"int") ),
114 "GhostMuonSegmentCount" : ((
"Number of associated muon segments;Number;", 60,0,60), (
"GhostMuonSegmentCount",
"int") ),
115 "JVF" : ((
"Jet Vertex Fraction;JVF;", 60,0,1.2), (
"JVF",
"vector<float>") ),
116 "JVF[0]" : ((
"Jet Vertex Fraction;JVF;", 60,0,1.2), (
"JVF[0]",
"vector<float>") ),
117 'JVFCorr' : ((
"Jet JVT JVFCorr;;", 120, -1.2, 1.2) , (
"JVFCorr",
"float" ) ),
118 'Jvt' : ((
"Jet JVT;;", 70, -0.2, 1.2) , (
"Jvt",
"float" ) ),
119 'JvtRpt' : ((
"Jet JVT Rpt;;", 75, 0, 1.5) , (
"JvtRpt",
"float" ) ),
120 "SumPtTrkPt500" : ((
"Sum Pt of all tracks above 0.5 GeV:SumPt(p_{T}>0.5 GeV);", 100,0,200), (
"SumPtTrkPt500",
"vector<float>",
"gev") ),
121 "SumPtTrkPt500[0]" : ((
"Sum Pt of tracks from PV0 above 0.5 GeV:SumPt(p_{T}>0.5 GeV);", 100,0,200), (
"SumPtTrkPt500[0]",
"vector<float>",
"gev") ),
122 "NumTrkPt500[0]" : ((
"Number of tracks from PV0 above 0.5 GeV:N_{tracks}(p_{T}>0.5 GeV);", 100,0,100), (
"NumTrkPt500[0]",
"vector<int>") ),
123 "NumTrkPt1000[0]" : ((
"Number of all tracks above 1 GeV:N_{tracks}(p_{T}>1 GeV);", 100,0,100), (
"NumTrkPt1000[0]",
"vector<int>") ),
124 "TrackWidthPt1000[0]": ((
"Width from tracks from PV0 above 1 GeV:Track Width(p_{T}>1 GeV);", 75,0.,1.5), (
"TrackWidthPt1000[0]",
"vector<float>") ),
125 "SumPtChargedPFOPt500" : ((
"Sum Pt of all charged PFOs above 0.5 GeV:SumPt chargedPFO(p_{T}>0.5 GeV);", 100,0,200), (
"SumPtChargedPFOPt500",
"vector<float>",
"gev") ),
126 "SumPtChargedPFOPt500[0]" : ((
"Sum Pt of all charged PFOs from PV0 above 0.5 GeV:SumPt(p_{T}>0.5 GeV);", 100,0,200), (
"SumPtChargedPFOPt500[0]",
"vector<float>",
"gev") ),
127 "NumChargedPFOPt500[0]" : ((
"Number of charged PFOs from PVO above 0.5 GeV:N_{charged PFO}(p_{T}>0.5 GeV);", 100,0,100), (
"NumChargedPFOPt500[0]",
"vector<int>") ),
128 "NumChargedPFOPt1000[0]" :((
"Number of charged PFOs from PVO above 1 GeV:N_{charged PFO}(p_{T}>1 GeV);", 100,0,100), (
"NumChargedPFOPt1000[0]",
"vector<int>") ),
129 "ChargedPFOWidthPt1000[0]": ((
"Width from charged PFOs from PV0 above 1 GeV:Charged PFO Width(p_{T}>1 GeV);", 75,0.,1.5), (
"ChargedPFOWidthPt1000[0]",
"vector<float>") ),
130 "ActiveArea" : ((
"Active Area;Area;", 80, 0, 0.8), (
"ActiveArea",
"float") ),
131 "ActiveArea15" : ((
"Active Area;Area;", 80, 0, 1.5), (
"ActiveArea",
"float") ),
132 "BchCorrDotx" : ((
"BchCorrDotx:BchCorrDotx;",50,0,1), (
"BchCorrDotx",
"float") ),
133 "BchCorrCell" : ((
"BchCorrCell:BchCorrCell;",50,0,1), (
"BchCorrCell",
"float") ),
135 "AverageLArQF" : ((
"Average LAr QF;AverageLArQF;",100,0, 65535), (
"AverageLArQF",
"float") ),
136 "HECQuality" : ((
"HEC Quality;HEC Quality;",50,-0.1, 1.4), (
"HECQuality",
"float") ),
137 "FracSamplingMax" : ((
"FracSamplingMax; FracSamplingMax;",50,-0.1, 1.2), (
"FracSamplingMax",
"float") ),
140 "FracSamplingMaxIndex" : ((
"FracSamplingMaxIndex; FracSamplingMaxIndex;",24,0,24), (
"FracSamplingMaxIndex",
"int") ),
143 "N90Constituents" : ((
"N90Constituents; N90Constituents;",15,0,15), (
"N90Constituents",
"float") ),
144 "CentroidR" : ((
"CentroidR; CentroidR;",100,0,7500), (
"CentroidR",
"float") ),
145 "OotFracClusters5" : ((
"OotFracClusters5; OotFracClusters5;",50,-0.1,1.2), (
"OotFracClusters5",
"float") ),
146 "OotFracClusters10": ((
"OotFracClusters10; OotFracClusters10;",50,-0.1,1.2), (
"OotFracClusters10",
"float") ),
148 "ptN" : ((
"Jet Pt;Pt [GeV];", 250, 0., 5000.) , (
"pt",
"float",
"gev" ) ),
149 "LeadingClusterCenterLambda": ((
"LeadingClusterCenterLambda; LeadingClusterCenterLambda;",100,0.,10000.), (
"LeadingClusterCenterLambda",
"float") ),
150 "LeadingClusterSecondLambda": ((
"LeadingClusterSecondLambda; LeadingClusterSecondLambda;",100,0.,10000.), (
"LeadingClusterSecondLambda",
"float") ),
153 "LeadingClusterSecondR": ((
"LeadingClusterSecondR; LeadingClusterSecondR;",100,0.,100000.), (
"LeadingClusterSecondR",
"float") ),
160 "DFCommonJets_QGTagger_NTracks": ((
"DFCommonJets_QGTagger_NTracks; DFCommonJets_QGTagger_NTracks;",30,0.,30.), (
"DFCommonJets_QGTagger_NTracks",
"int") ),
161 "DFCommonJets_QGTagger_TracksWidth": ((
"DFCommonJets_QGTagger_TracksWidth; DFCommonJets_QGTagger_TracksWidth;",16,-1.1,0.5), (
"DFCommonJets_QGTagger_TracksWidth",
"float") ),
162 "DFCommonJets_QGTagger_TracksC1": ((
"DFCommonJets_QGTagger_TracksC1; DFCommonJets_QGTagger_TracksC1;",16,-1.1,0.5), (
"DFCommonJets_QGTagger_TracksC1",
"float") ),
163 "DFCommonJets_fJvt": ((
"DFCommonJets_fJvt; DFCommonJets_fJvt;",23,0.,2.3), (
"DFCommonJets_fJvt",
"float") ),
165 "rg": ((
"rg; rg;",29,-1.2,1.7), (
"rg",
"float") ),
166 "zg": ((
"zg; zg;",19,-1.2,0.7), (
"zg",
"float") ),
169 "HadronConeExclTruthLabelID": ((
"HadronConeExclTruthLabelID; HadronConeExclTruthLabelID;", 150, -100.5, 49.5), (
"HadronConeExclTruthLabelID",
"int") ),
170 "HadronConeExclExtendedTruthLabelID": ((
"HadronConeExclExtendedTruthLabelID; HadronConeExclExtendedTruthLabelID; ;", 150, -100.5, 49.5), (
"HadronConeExclExtendedTruthLabelID",
"int")),
171 "HadronGhostTruthLabelID": ((
"HadronGhostTruthLabelID; HadronGhostTruthLabelID;", 150, -100.5, 49.5), (
"HadronGhostTruthLabelID",
"int")),
172 "HadronGhostExtendedTruthLabelID": ((
"HadronGhostExtendedTruthLabelID; HadronGhostExtendedTruthLabelID;", 150, -100.5, 49.5), (
"HadronGhostExtendedTruthLabelID",
"int")),
183 caloSamples =[
"PreSamplerB",
"EMB1",
"EMB2",
"EMB3",
"PreSamplerE",
"EME1",
"EME2",
"EME3",
"HEC0",
"HEC1",
"HEC2",
"HEC3",
"TileBar0",
"TileBar1",
"TileBar2",
"TileGap1",
"TileGap2",
"TileGap3",
"TileExt0",
"TileExt1",
"TileExt2",
"FCAL0",
"FCAL1",
"FCAL2", ]
184 for i,c
in enumerate(caloSamples):
185 compactSpecification[ c ] = ( (
"Energy in "+c+
";Energy(GeV);",100,-10,1000), (
"EnergyPerSampling[%d]"%(i,),
"vector<float>",
"gev"))
190 attributeHistoManager.buildKnownTools(compactSpecification)
194 jhm.addTool( JetKinematicHistos(
"allkinematics",PlotOccupancy=
True, PlotAveragePt=
True, PlotNJet=
True , PlotNConstit =
True) )
195 jhm.addTool( JetKinematicHistos(
"basickinematics") )
196 jhm.addTool( JetKinematicHistos(
"basickinematics_emscale", JetScale=
"JetEMScaleMomentum") )
197 jhm.addTool( JetKinematicHistos(
"basickinematics_constscale", JetScale=
"JetConstitScaleMomentum") )
199 jhm.addTool( LeadingJetsRelations(
"leadingjetrel",
201 hdef(
'ljrDeltaEta',
"#Delta #eta (lead, sublead);#Delta#eta;Entries",100,-10,10 ),
202 hdef(
'ljrDeltaPhi',
"#Delta #Phi (lead, sublead);#Delta#Phi;Entries",100,0,3.142 ),
203 hdef(
'ljrDeltaR',
"#Delta R (lead, sublead);#Delta R;Entries",100,0,10 ),
204 hdef(
'ljrFrac',
"(sublead Pt)/(lead Pt);ratio;Entries",100,0,1. ),
211 jhm.addTool( EfficiencyResponseHistos(
"effresponse",
213 hdef(
'erhEfficiencyR1',
"Jet p_{T} Efficiency #DeltaR = 0.1;p_{T}^{Truth} (GeV);Efficiency",50,0,100 ),
214 hdef(
'erhEfficiencyR2',
"Jet p_{T} Efficiency #DeltaR = 0.2;p_{T}^{Truth} (GeV);Efficiency",50,0,100 ),
215 hdef(
'erhEfficiencyR3',
"Jet p_{T} Efficiency #DeltaR = 0.3;p_{T}^{Truth} (GeV);Efficiency",50,0,100 ),
217 hdef(
'erhResponse',
"Jet p_{T} Response;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}};Number of jets",50,-1,1 ),
218 hdef(
'erhResponseVsEta',
"Jet p_{T} Response vs #eta;#eta of jet;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}}",50,-5,5 ),
219 hdef(
'erhResponseVsPt',
"Jet p_{T} Response vs p_{T};p_{T}^{Truth} of jet;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}}",50,0,1000 ),
221 hdef(
'erhResponse_noShift',
"Jet p_{T} Response;#frac{p_{T}^{Jet}}{p_{T}^{Truth}};Number of jets",50,0,2 ),
222 hdef(
'erhResponseVsEta_noShift',
"Jet p_{T} Response vs #eta;#eta of jet;#frac{p_{T}^{Jet}}{p_{T}^{Truth}}",50,-5,5 ),
223 hdef(
'erhResponseVsPt_noShift',
"Jet p_{T} Response vs p_{T};p_{T}^{Truth} of jet;#frac{p_{T}^{Jet}}{p_{T}^{Truth}}",50,0,1000 ),
225 hdef(
'erhDeltaR',
"#DeltaR between Jet and closest Truth Jet;#DeltaR;Number of jets",50,0,4 ),
231 jhm.addTool( HistosForJetSelection(
"alljets", SelectionType=0) )
232 jhm.addTool( HistosForJetSelection(
"leadingjet", SelectionType=1) )
233 jhm.addTool( HistosForJetSelection(
"subleadingjet", SelectionType=2) )
245 if isinstance(selectType, str):
247 tool = jhm.tool(selectType)
248 if issubclass( tool.__class__ , HistosForJetSelection):
255 attSel = attributeHistoManager.addSelector(selectType)
257 if histoNameSuffix==
"" : histoNameSuffix = attSel.getName()
258 selTool = HistosForJetSelection(
"hjsel_"+attSel.getName(), SelectionType=3,
259 JetSelectorTool = attSel ,
260 HistoTitleSuffix =
' ('+selectType+
')',
261 HistoNameSuffix = histoNameSuffix)
266 print (
"ERROR can't build histo tool for a jet selection. Uknown or wrong selection request :",selectType , selTool)
269 if selectionName !=
"":
270 selTool = selTool.clone(selectionName)
272 interpretedTools = []
274 if isinstance(h,str):
276 interpretedTools.append(h)
278 selTool.HistoTools = interpretedTools
281 for k,v
in otherArgs.items():
282 setattr(selTool, k, v)