From 320dd902e0fc617795cae63f676b146e23c77c92 Mon Sep 17 00:00:00 2001
From: Mark Hodgkinson <m.hodgkinson@sheffield.ac.uk>
Date: Fri, 13 Oct 2017 14:26:25 +0100
Subject: [PATCH] Add ESD example job options for serial and MT particle flow.
 Fix two misconfigurations in the MT version of particle flow, such that it
 gives same output as serial version. Add DEBUG message to
 PFRevoerSplitShowersTool.cxx to aid future debugging.

Former-commit-id: 4327d1c7ee8e97a61c39280abb9c592c5112414e
---
 .../eflowRec/PFCellLevelSubtractionTool.h     |  2 +-
 .../eflowRec/share/PFlowMTConfig.py           |  2 +-
 Reconstruction/eflowRec/share/run_ESDMT.py    | 59 +++++++++++++++++++
 .../eflowRec/share/run_ESDSerial.py           | 58 ++++++++++++++++++
 .../src/PFRecoverSplitShowersTool.cxx         |  5 ++
 5 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 Reconstruction/eflowRec/share/run_ESDMT.py
 create mode 100644 Reconstruction/eflowRec/share/run_ESDSerial.py

diff --git a/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h b/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h
index 3151ebecf12..531e243d3ac 100644
--- a/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h
+++ b/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h
@@ -68,7 +68,7 @@ public:
   ToolHandle<IEFlowCellEOverPTool> m_theEOverPTool{this,"eflowCellEOverPTool","eflowCellEOverPTool","Energy Flow E/P Values and Shower Paremeters Tool"};
 
   /** Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction */
-  Gaudi::Property<double> m_subtractionSigmaCut{this,"SubtractionSigmaCut",1.2,"Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction"};
+  Gaudi::Property<double> m_subtractionSigmaCut{this,"SubtractionSigmaCut",1.5,"Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction"};
   /** Parameter that controls whether a track, in a track-cluster system, will be processed by the split shower recovery algorithm */
   Gaudi::Property<double> m_consistencySigmaCut{this,"ConsistencySigmaCut",1.0,"Parameter that controls whether a track, in a track-cluster system, will be processed by the split shower recovery algorithm"};
 
diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py
index 06d50a81035..23ec2f8d586 100644
--- a/Reconstruction/eflowRec/share/PFlowMTConfig.py
+++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py
@@ -91,7 +91,7 @@ MatchingTool_Recover.TrackPositionType   = 'EM2EtaPhi' # str
 MatchingTool_Recover.ClusterPositionType = 'PlainEtaPhi' # str
 MatchingTool_Recover.DistanceType        = 'EtaPhiSquareDistance' # str
 MatchingTool_Recover.MatchCut = 0.2*0.2 # float
-PFRecoverSplitShowersTool.PFTrackClusterMatchingTool = MatchingTool
+PFRecoverSplitShowersTool.PFTrackClusterMatchingTool = MatchingTool_Recover
 
 PFAlgorithm.SubtractionToolList += [PFRecoverSplitShowersTool]
 
diff --git a/Reconstruction/eflowRec/share/run_ESDMT.py b/Reconstruction/eflowRec/share/run_ESDMT.py
new file mode 100644
index 00000000000..abfaaebfbdb
--- /dev/null
+++ b/Reconstruction/eflowRec/share/run_ESDMT.py
@@ -0,0 +1,59 @@
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=["/data/hodgkinson/scratchFiles/mc15_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s2832_r7968/ESD.08355655._001904.pool.root.1"] 
+
+
+doDumpProperties=True
+
+from RecExConfig.RecAlgsFlags import recAlgs
+recAlgs.doEFlow.set_Value_and_Lock(True)
+
+from RecExConfig.RecFlags import rec
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+
+#change some calo flags
+from CaloRec.CaloRecFlags import jobproperties
+jobproperties.CaloRecFlags.Enabled.set_Value_and_Lock(True)
+jobproperties.CaloRecFlags.doCaloCluster.set_Value_and_Lock(True)
+jobproperties.CaloRecFlags.doEmCluster.set_Value_and_Lock(False)
+jobproperties.CaloRecFlags.doCaloTopoCluster.set_Value_and_Lock(True)
+
+#this turns off CaloCluster2xAOD
+rec.doWritexAOD.set_Value_and_Lock(False)
+#nothing to say on these
+rec.doWriteTAG.set_Value_and_Lock(False)
+rec.doTruth.set_Value_and_Lock(False)
+rec.doAODCaloCells.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False)
+#Turns off xAODRingSetConfWriter
+rec.doCaloRinger.set_Value_and_Lock(False)
+
+#disables VertexCnvAlg
+from InDetRecExample.InDetJobProperties import jobproperties
+jobproperties.InDetJobProperties.doxAOD.set_Value_and_Lock(False)
+#Disables AllExecutedEvents
+rec.doFileMetaData.set_Value_and_Lock(False)
+
+athenaCommonFlags.EvtMax=1
+include ("RecExCommon/RecExCommon_topOptions.py")
+topSequence.CaloTopoCluster.ClustersOutputName="CaloCalTopoClusterV2"
+#topSequence.eflowEMCaloObjectBuilder.CalClustersName="CaloCalTopoClusterV2"
+topSequence.PFClusterSelector.calClustersName="CaloCalTopoClusterV2"
+topSequence.PFOChargedCreatorAlgorithm.PFOOutputName="JetETMissChargedParticleFlowObjectsV2"
+#topSequence.PFOChargedCreatorAlgorithm.OutputLevel=DEBUG
+topSequence.PFONeutralCreatorAlgorithm.PFOOutputName="JetETMissNeutralParticleFlowObjectsV2"
+#topSequence.PFONeutralCreatorAlgorithm.OutputLevel=DEBUG
+#topSequence.PFTrackSelector.OutputLevel=DEBUG
+#topSequence.PFLeptonSelector.OutputLevel=DEBUG
+#topSequence.PFAlgorithm.OutputLevel=DEBUG
+#ServiceMgr.MessageSvc.debugLimit = 1000000
+import AthenaCommon.PropertiesManip as manip
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissChargedParticleFlowObjects')
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissChargedParticleFlowObjectsAux.')
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissNeutralParticleFlowObjects')
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissNeutralParticleFlowObjectsAux.')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissChargedParticleFlowObjectsV2')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissChargedParticleFlowObjectsV2Aux.')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissNeutralParticleFlowObjectsV2')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissNeutralParticleFlowObjectsV2Aux.')
+
diff --git a/Reconstruction/eflowRec/share/run_ESDSerial.py b/Reconstruction/eflowRec/share/run_ESDSerial.py
new file mode 100644
index 00000000000..3d253ac9e1b
--- /dev/null
+++ b/Reconstruction/eflowRec/share/run_ESDSerial.py
@@ -0,0 +1,58 @@
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=["/data/hodgkinson/scratchFiles/mc15_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s2832_r7968/ESD.08355655._001904.pool.root.1"] 
+
+doDumpProperties=True
+
+from RecExConfig.RecAlgsFlags import recAlgs
+recAlgs.doEFlow.set_Value_and_Lock(True)
+
+from RecExConfig.RecFlags import rec
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+
+#change some calo flags
+from CaloRec.CaloRecFlags import jobproperties
+jobproperties.CaloRecFlags.Enabled.set_Value_and_Lock(True)
+jobproperties.CaloRecFlags.doCaloCluster.set_Value_and_Lock(True)
+jobproperties.CaloRecFlags.doEmCluster.set_Value_and_Lock(False)
+jobproperties.CaloRecFlags.doCaloTopoCluster.set_Value_and_Lock(True)
+
+#this turns off CaloCluster2xAOD
+rec.doWritexAOD.set_Value_and_Lock(False)
+#nothing to say on these
+rec.doWriteTAG.set_Value_and_Lock(False)
+rec.doTruth.set_Value_and_Lock(False)
+rec.doAODCaloCells.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False)
+#Turns off xAODRingSetConfWriter
+rec.doCaloRinger.set_Value_and_Lock(False)
+
+#disables VertexCnvAlg
+from InDetRecExample.InDetJobProperties import jobproperties
+jobproperties.InDetJobProperties.doxAOD.set_Value_and_Lock(False)
+#Disables AllExecutedEvents
+rec.doFileMetaData.set_Value_and_Lock(False)
+
+athenaCommonFlags.EvtMax=1
+include ("RecExCommon/RecExCommon_topOptions.py")
+topSequence.CaloTopoCluster.ClustersOutputName="CaloCalTopoClusterV2"
+topSequence.eflowEMCaloObjectBuilder.CalClustersName="CaloCalTopoClusterV2"
+#topSequence.eflowObjectBuilder_EM.OutputLevel=DEBUG
+#topSequence.eflowCaloObjectBuilder_EM.OutputLevel=DEBUG
+#topSequence.eflowEMCaloObjectBuilder.OutputLevel=DEBUG
+eflowObjectCreatorTool_update = topSequence.eflowObjectBuilder_EM.PrivateToolList[2]
+eflowObjectCreatorTool_update.PFOOutputName="JetETMissV2"
+topSequence.eflowVertextInformationSetter_EM.PFOInputName="JetETMissV2NeutralParticleFlowObjects"
+topSequence.eflowOverlapRemoval_EM.PFOInputName="JetETMissV2NeutralParticleFlowObjects"
+
+import AthenaCommon.PropertiesManip as manip
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissChargedParticleFlowObjects')
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissChargedParticleFlowObjectsAux.')
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissNeutralParticleFlowObjects')
+manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissNeutralParticleFlowObjectsAux.')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissV2ChargedParticleFlowObjects')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissV2ChargedParticleFlowObjectsAux.')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissV2NeutralParticleFlowObjects')
+manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissV2NeutralParticleFlowObjectsAux.')
+
+#ServiceMgr.MessageSvc.debugLimit = 1000000
diff --git a/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx b/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx
index e6fd11aa784..2954be3bb81 100644
--- a/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx
+++ b/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx
@@ -178,6 +178,11 @@ int PFRecoverSplitShowersTool::matchAndCreateEflowCaloObj() {
     }
     /* Get list of matched clusters */
     std::vector<eflowRecCluster*> matchedClusters = m_matchingTool->doMatches(thisEfRecTrack, m_clustersToConsider, -1);
+
+    if (msgLvl(MSG::DEBUG)){
+      for (auto thisEFRecCluster : matchedClusters) ATH_MSG_DEBUG("Have matched cluster with e, eta, phi of " << thisEFRecCluster->getCluster()->e() << ", " <<  thisEFRecCluster->getCluster()->eta() << " and " << thisEFRecCluster->getCluster()->phi());
+    }
+
     if (matchedClusters.empty()) { continue; }
 
     m_nTrackClusterMatches += matchedClusters.size();
-- 
GitLab