Skip to content
Snippets Groups Projects
Commit 0860b1b3 authored by Salvador Marti I Garcia's avatar Salvador Marti I Garcia Committed by Adam Edward Barton
Browse files

InDetPerformanceMonitoring read DRAW_ZMUMU and sigma_qOverP in ntuple

parent b3a8609a
No related branches found
No related tags found
No related merge requests found
......@@ -190,6 +190,7 @@ class IDPerfMonZmumu : public AthAlgorithm
double m_positive_d0{};
double m_positive_z0_err{};
double m_positive_d0_err{};
double m_positive_sigma_qOverP{};
double m_positive_z0_PV{};
double m_positive_d0_PV{};
double m_positive_z0_PVerr{};
......@@ -217,6 +218,7 @@ class IDPerfMonZmumu : public AthAlgorithm
double m_negative_d0{};
double m_negative_z0_err{};
double m_negative_d0_err{};
double m_negative_sigma_qOverP{};
double m_negative_z0_PV{};
double m_negative_d0_PV{};
double m_negative_z0_PVerr{};
......
from MuonRecExample.MuonRecFlags import muonRecFlags
#--------------------------------------------------------------------------------
# Input
#--------------------------------------------------------------------------------
# configure flags so that only Muon Standalone reco is run
import MuonRecExample.MuonRecStandaloneOnlySetup
#import MuonCombinedRecExample.MuonCombinedRecOnlySetup
from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
from MuonRecExample import MuonRecUtils
#Need the beam spot for the TrackParticleCreator
if not ('conddb' in dir()):
IOVDbSvc = Service("IOVDbSvc")
from IOVDbSvc.CondDB import conddb
conddb.addFolderSplitOnline("INDET", "/Indet/Onl/Beampos", "/Indet/Beampos", className="AthenaAttributeList")
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
if not hasattr(condSeq, "BeamSpotCondAlg"):
from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg
condSeq += BeamSpotCondAlg( "BeamSpotCondAlg" )
#ToolSvc += MDTCablingDbTool
import MuonCnvExample.MuonCablingConfig
#--------------------------------------------------------------------------------
# Output
#--------------------------------------------------------------------------------
muonRecFlags.doCalibNtuple = False # write calibration ntuple?
###
#Set to false, because re-reco of muon truth does not work. Lock it because downstream python alters its value to True otherwise.
rec.doTruth.set_Value_and_Lock(False)
rec.doTrigger = False
rec.doWriteAOD=True
#Disables PFO Thnning - these cotnainers do not exist, unless you run jet finding
from ParticleBuilderOptions.AODFlags import AODFlags
AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False)
muonRecFlags.doStandalone.set_Value_and_Lock(True)
muonRecFlags.doTrackPerformance = True
muonRecFlags.TrackPerfSummaryLevel = 2
muonRecFlags.TrackPerfDebugLevel = 5
muonRecFlags.doCSCs = True
muonRecFlags.doTGCs = False
muonStandaloneFlags.printSummary = True
muonCombinedRecFlags.doTrackPerformance = True
muonCombinedRecFlags.doMuGirl = True
muonCombinedRecFlags.printSummary = True
##### no more flags after this line #####
try:
print (' == runzmumu == muonconfig == include("MuonRecExample/MuonRec_topOptions.py")')
include("MuonRecExample/MuonRec_topOptions.py")
###### put any user finetuning after this line #####
##### DO NOT ADD ANYTHING AFTER THIS LINE #####
except:
# print the stacktrace (saving could fail, and would then obscure the real problem)
import traceback
traceback.print_exc()
# always write config so far for debugging
from AthenaCommon.ConfigurationShelve import saveToAscii
saveToAscii("config.txt")
# add DetFlags
from MuonRecExample.MuonRecUtils import dumpDetFlags
dumpDetFlags("config.txt")
# but still exit with error
import sys
sys.exit(10)
else:
# and write config to include user changes after topOptions
from AthenaCommon.ConfigurationShelve import saveToAscii
saveToAscii("config.txt")
# add DetFlags
from MuonRecExample.MuonRecUtils import dumpDetFlags
dumpDetFlags("config.txt")
......@@ -8,7 +8,7 @@ import socket # find hostname with socket.gethostname()
print (' == runzmumu == START == TestArea = %s' %os.getenv("TestArea"))
###############################
# MC
MC_bool = False
MC_bool = True
# user defined ID alignment constants
inputConstantsFile = "NONE"
......@@ -20,7 +20,7 @@ userAlignTags = False
useIDADynamicFolders = True
if (MC_bool): useIDADynamicFolders = False # dynamic folders must be disabled in MC
EvtMax = 1000 # -1 all events
EvtMax = 10 # -1 all events
SkipEvents = 0
#fill Alignment monitoring
......@@ -116,6 +116,12 @@ if ("default" not in conditionsTag):
globalflags.ConditionsTag.set_Value_and_Lock(conditionsTag)
globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2016-01-00-01")
# Find out if input is DRAW
inputIsDRAW = False
if any ("DRAW" in infiles for infiles in ConfigFlags.Input.Files):
inputIsDRAW = True
print (' == runzmumu == input is DRAW ')
##########################
# athena recognizes if input file is data or mc.
# However from 22.0.30 when using data and trying to change alignment tags as soon as one tries:
......@@ -135,16 +141,23 @@ rec.AutoConfiguration=['everything']
rec.doInDet.set_Value_and_Lock(True)
rec.doPerfMon.set_Value_and_Lock(False)
#
rec.doBTagging.set_Value_and_Lock(False)
rec.doZdc.set_Value_and_Lock(False)
rec.doLucid.set_Value_and_Lock(False)
rec.doTile.set_Value_and_Lock(False)
rec.doLArg.set_Value_and_Lock(False)
rec.doCalo.set_Value_and_Lock(False)
rec.doMuon.set_Value_and_Lock(False)
rec.doMuonCombined.set_Value_and_Lock(False)
rec.doEgamma.set_Value_and_Lock(False)
rec.doJetMissingETTag.set_Value_and_Lock(False)
rec.doTrigger.set_Value_and_Lock(False)
# extras
rec.doTruth.set_Value_and_Lock(False)
if (inputIsDRAW):
# These are not needed for our purposes and can cause athena crash when running over DRAW
print (" == runzmumu == switching off R3LargeD0 and TrackSegmentsDisappearing")
from InDetRecExample.InDetJobProperties import InDetFlags
InDetFlags.doR3LargeD0 = False
InDetFlags.doTrackSegmentsDisappearing = False
#
# use dynamic alignment folders?
......@@ -157,6 +170,7 @@ include("RecExCond/RecExCommon_DetFlags.py") # include("RecExCond/RecExCommon_fl
DetFlags.ID_setOn()
DetFlags.Calo_setOff()
DetFlags.Muon_setOn()
#
if ('21.' in os.getenv("Athena_VERSION") ):
print (' == runzmumu == including InDetRecExample/InDetRecConditionsAccess.py')
......@@ -175,7 +189,7 @@ if ("NONE" not in inputConstantsFile or userAlignTags):
print (' == runzmumu == use this set of alignment constants on RD')
if (userAlignTags):
if (True):
if (False):
print (' == runzmumu == setting userAlignTags == 2018_ReAlign_Initial ')
conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID-R2dynamic_2018_ReAlign_Initial")
conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX-R2dynamic_2018_ReAlign_Initial")
......@@ -184,7 +198,7 @@ if ("NONE" not in inputConstantsFile or userAlignTags):
conddb.addOverride("/Indet/IBLDist", "IndetIBLDist-R2dynamic_2018_ReAlign_Initial")
conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1-R2dynamic_2018_ReAlign_Initial")
conddb.addOverride("/TRT/AlignL2", "TRTAlignL2-R2dynamic_2018_ReAlign_Initial")
if (False):
if (True):
print (' == runzmumu == setting userAlignTags == Run2_Legacy_looser')
conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID_Run2_Legacy_looser")
conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX_Run2_Legacy_looser")
......@@ -229,16 +243,33 @@ if ("NONE" not in inputConstantsFile or userAlignTags):
else:
print (' == runzmumu == setting user alignment constants or tags: NO user input')
'''
if not MC_bool:
print (' == runzmumu == setting TRT Status HT (rel22) == ')
from IOVDbSvc.CondDB import conddb
##################################
if (inputIsDRAW):
print (' == runzmumu == setting /TRT/Onl/Cond/StatusHT')
try:
conddb
except NameError:
from IOVDbSvc.CondDB import conddb
else:
print (' == runzmumu == conddb already defined')
conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/StatusHT","/TRT/Cond/StatusHT",className='TRTCond::StrawStatusMultChanContainer')
'''
else:
print (' == runzmumu == no need of /TRT/Onl/Cond/StatusHT')
##################################
# main jobOptions
include("RecExCommon/RecExCommon_topOptions.py")
#
if ('22.' in os.getenv("Athena_VERSION") and inputIsDRAW):
ToolSvc.InDetAmbiTrackSelectionTool.doEmCaloSeed = False
if ('22.' in os.getenv("Athena_VERSION") and inputIsDRAW and False):
print (' == runzmumu == include("MuonConfig.py")')
include("MuonConfig.py") # test
#include("MuonRecExample/MuonRec_topOptions.py")
#
from PerfMonComps.PerfMonFlags import jobproperties
jobproperties.PerfMonFlags.doMonitoring = False
......@@ -253,12 +284,12 @@ ToolSvc += m_TrackSelectorTool_TightPrimary
print (m_TrackSelectorTool_TightPrimary)
# track refitters
print (' ========= runzmumu == including ElectronEoverPTracking.py for defining track fitters')
print (' == runzmumu == including ElectronEoverPTracking.py for defining track fitters')
include("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
# track to vertex association
if ('22.0' in os.getenv("Athena_VERSION")):
print (" ========= runzmumu == trakc to vertex association tool: defining working point ")
print (" == runzmumu == track to vertex association tool: defining working point ")
from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TrackVertexAssociationTool
t2vatool = CP__TrackVertexAssociationTool(name = "TrackVertexAssociationTool",
WorkingPoint="SV_Reject")
......@@ -268,10 +299,10 @@ ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidation
trackrefit1 = MuonRefitterTool
if ('22.0' in os.getenv("Athena_VERSION")):
print (' ========= runzmumu == Rel 22 --> trackrefit2 = MuonRefitterToolIDSiOnly')
print (' == runzmumu == Rel 22 --> trackrefit2 = MuonRefitterToolIDSiOnly')
trackrefit2 = MuonRefitterToolIDSiOnly
else:
print (' ========= runzmumu == Rel 21 --> trackrefit2 = MuonRefitterTool2')
print (' == runzmumu == Rel 21 --> trackrefit2 = MuonRefitterTool2')
trackrefit2 = MuonRefitterTool2
from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
......
......@@ -285,6 +285,7 @@ StatusCode IDPerfMonZmumu::bookTrees()
m_defaultTree->Branch("Negative_d0", &m_negative_d0, "Negative_d0/D");
m_defaultTree->Branch("Negative_z0_err", &m_negative_z0_err, "Negative_z0_err/D");
m_defaultTree->Branch("Negative_d0_err", &m_negative_d0_err, "Negative_d0_err/D");
m_defaultTree->Branch("Positive_Px", &m_positive_px, "Positive_Px/D");
m_defaultTree->Branch("Positive_Py", &m_positive_py, "Positive_Py/D");
m_defaultTree->Branch("Positive_Pz", &m_positive_pz, "Positive_Pz/D");
......@@ -371,7 +372,7 @@ StatusCode IDPerfMonZmumu::bookTrees()
m_refit1Tree->Branch("Negative_d0", &m_negative_d0, "Negative_d0/D");
m_refit1Tree->Branch("Negative_z0_err", &m_negative_z0_err, "Negative_z0_err/D");
m_refit1Tree->Branch("Negative_d0_err", &m_negative_d0_err, "Negative_d0_err/D");
m_refit1Tree->Branch("Negative_sigma_qoverp", &m_negative_sigma_qOverP, "Negative_sigma_qoverp/D");
m_refit1Tree->Branch("Positive_Px", &m_positive_px, "Positive_Px/D");
m_refit1Tree->Branch("Positive_Py", &m_positive_py, "Positive_Py/D");
......@@ -380,6 +381,7 @@ StatusCode IDPerfMonZmumu::bookTrees()
m_refit1Tree->Branch("Positive_d0", &m_positive_d0, "Positive_d0/D");
m_refit1Tree->Branch("Positive_z0_err", &m_positive_z0_err, "Positive_z0_err/D");
m_refit1Tree->Branch("Positive_d0_err", &m_positive_d0_err, "Positive_d0_err/D");
m_refit1Tree->Branch("Positive_sigma_qoverp", &m_positive_sigma_qOverP, "Positive_sigma_qoverp/D");
if(m_doIP){
m_refit1Tree->Branch("Negative_d0_PV", &m_negative_d0_PV , "Negative_d0_PV/D");
......@@ -1288,7 +1290,7 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp
double PVz0res = 0;
double PVd0 = 0;
double PVz0 = 0;
double sigma_qOverP = 0;
px = trackp->p4().Px();
py = trackp->p4().Py();
......@@ -1296,9 +1298,10 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp
d0 = trackp->d0();
z0 = trackp->z0();
d0res = std::sqrt(trackp->definingParametersCovMatrix()(0,0));
z0res = std::sqrt(trackp->definingParametersCovMatrix()(1,1));
d0res = std::sqrt(trackp->definingParametersCovMatrix()(Trk::d0,Trk::d0));
z0res = std::sqrt(trackp->definingParametersCovMatrix()(Trk::z0,Trk::z0));
sigma_qOverP = std::sqrt(trackp->definingParametersCovMatrix()(Trk::qOverP,Trk::qOverP));
if (vertex == nullptr) {
ATH_MSG_WARNING("in FillRecParametersTP. WARNING: Vertex is NULL");
return StatusCode::FAILURE;
......@@ -1340,6 +1343,7 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp
m_positive_z0_err = z0res;
m_positive_d0 = d0;
m_positive_d0_err = d0res;
m_positive_sigma_qOverP = sigma_qOverP;
if(m_doIP){
m_positive_z0_PV = PVz0;
m_positive_d0_PV = PVd0;
......@@ -1356,6 +1360,7 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp
m_negative_z0_err = z0res;
m_negative_d0 = d0;
m_negative_d0_err = d0res;
m_negative_sigma_qOverP = sigma_qOverP;
if(m_doIP){
m_negative_z0_PV = PVz0;
m_negative_d0_PV = PVd0;
......@@ -1784,6 +1789,7 @@ void IDPerfMonZmumu::Clear4MuNtupleVariables()
m_positive_z0 = 0.;
m_positive_d0_err = 0.;
m_positive_z0_err = 0.;
m_positive_sigma_qOverP = 0.;
m_positive_1_vtx = 0;
m_positive_parent = 0;
......@@ -1794,6 +1800,7 @@ void IDPerfMonZmumu::Clear4MuNtupleVariables()
m_negative_z0 = 0.;
m_negative_d0_err = 0.;
m_negative_z0_err = 0.;
m_negative_sigma_qOverP = 0.;
m_negative_1_vtx = 0;
m_negative_parent = 0;
......
......@@ -657,7 +657,7 @@ void ZmumuEvent::finalize()
{
m_xMuonID.finalize();
std::cout << " ** ZmumuEvent ** STATS -- " << std::endl
std::cout << " ** ZmumuEvent ** -- STATS -- " << std::endl
<< " Analyzed events : " << m_analyzedEventCount << std::endl
<< " Tested muons : " << m_testedMuonCount << std::endl
<< " Accepted muons : " << m_acceptedMuonCount << std::endl
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment