From f8672281bc8171a189ef76aff387f1881d8ea96f Mon Sep 17 00:00:00 2001 From: Colleen Treado <treado.c@gmail.com> Date: Mon, 5 Jun 2017 22:09:08 -0400 Subject: [PATCH] updating HitAnalysis package + SiLorentzLorentzSvc.cxx to run in R21 - fixing input HITS file calls in topOptions files; removing extraneous warnings in TrackRecord tool; cleaning code for consistency b/w tools --- .../src/SiLorentzAngleSvc.cxx | 27 ++- .../share/AFPHitAnalysis_topOptions.py | 11 +- .../share/ALFAHitAnalysis_topOptions.py | 4 +- .../share/AllHitAnalysis_topOptions.py | 84 ++++--- .../share/CSCHitAnalysis_topOptions.py | 10 +- .../share/CaloHitAnalysis_topOptions.py | 15 +- .../share/HitAnalysis_topOptions.py | 82 ++++--- .../share/LucidHitAnalysis_topOptions.py | 8 +- .../share/MDTHitAnalysis_topOptions.py | 10 +- .../share/MuonHitAnalysis_topOptions.py | 32 ++- .../share/RPCHitAnalysis_topOptions.py | 10 +- .../share/SiHitAnalysis_topOptions.py | 29 +-- .../share/TGCHitAnalysis_topOptions.py | 8 +- .../share/TRTHitAnalysis_topOptions.py | 8 +- .../share/TrackRecordAnalysis_topOptions.py | 26 +- .../share/TruthHitAnalysis_topOptions.py | 8 +- .../share/ZDCHitAnalysis_topOptions.py | 8 +- .../Tools/HitAnalysis/src/AFPHitAnalysis.cxx | 53 ++-- .../Tools/HitAnalysis/src/AFPHitAnalysis.h | 6 +- .../Tools/HitAnalysis/src/ALFAHitAnalysis.cxx | 104 ++++---- .../Tools/HitAnalysis/src/ALFAHitAnalysis.h | 11 +- .../Tools/HitAnalysis/src/CSCHitAnalysis.cxx | 68 +++--- .../Tools/HitAnalysis/src/CSCHitAnalysis.h | 6 +- .../Tools/HitAnalysis/src/CaloHitAnalysis.cxx | 166 ++++++------- .../Tools/HitAnalysis/src/CaloHitAnalysis.h | 14 +- .../HitAnalysis/src/LucidHitAnalysis.cxx | 130 +++++----- .../Tools/HitAnalysis/src/LucidHitAnalysis.h | 9 +- .../Tools/HitAnalysis/src/MDTHitAnalysis.cxx | 39 ++- .../Tools/HitAnalysis/src/MDTHitAnalysis.h | 9 +- .../Tools/HitAnalysis/src/RPCHitAnalysis.cxx | 48 ++-- .../Tools/HitAnalysis/src/RPCHitAnalysis.h | 7 +- .../Tools/HitAnalysis/src/SiHitAnalysis.cxx | 91 +++---- .../Tools/HitAnalysis/src/SiHitAnalysis.h | 13 +- .../Tools/HitAnalysis/src/TGCHitAnalysis.cxx | 49 ++-- .../Tools/HitAnalysis/src/TGCHitAnalysis.h | 9 +- .../Tools/HitAnalysis/src/TRTHitAnalysis.cxx | 108 ++++----- .../Tools/HitAnalysis/src/TRTHitAnalysis.h | 9 +- .../HitAnalysis/src/TrackRecordAnalysis.cxx | 162 ++++++------- .../HitAnalysis/src/TrackRecordAnalysis.h | 10 +- .../HitAnalysis/src/TruthHitAnalysis.cxx | 227 ++++++++---------- .../Tools/HitAnalysis/src/TruthHitAnalysis.h | 8 +- .../Tools/HitAnalysis/src/ZDCHitAnalysis.cxx | 129 +++++----- .../Tools/HitAnalysis/src/ZDCHitAnalysis.h | 2 - 43 files changed, 918 insertions(+), 949 deletions(-) diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleSvc.cxx b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleSvc.cxx index 230b2c3231a..15768f306e4 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleSvc.cxx +++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleSvc.cxx @@ -78,19 +78,28 @@ StatusCode SiLorentzAngleSvc::initialize() { } m_isPixel = (m_detectorName == "Pixel"); - // Get conditions summary service. - CHECK(m_siConditionsSvc.retrieve()); + // Get conditions summary service. + if (!m_siConditionsSvc.empty()) { + ATH_MSG_DEBUG("Conditions Summary Service not empty --> attempting to retrieve."); + CHECK(m_siConditionsSvc.retrieve()); + } + else { + ATH_MSG_DEBUG("Conditions Summary Service not requested."); + } // Get the detector manager CHECK(m_detStore->retrieve(m_detManager, m_detectorName)); - if (m_siConditionsSvc->hasCallBack()) { - //Register callback. To be triggered after SiConditionsSvc's callback, - ATH_MSG_INFO("Registering callback." ); - CHECK(m_detStore->regFcn(&ISiliconConditionsSvc::callBack,&*m_siConditionsSvc,&ISiLorentzAngleSvc::callBack,dynamic_cast<ISiLorentzAngleSvc*>(this),true)); - } - else { - ATH_MSG_WARNING("Conditions Summary Service has no callback." ); + if (!m_siConditionsSvc.empty()) { + ATH_MSG_DEBUG("Conditions Summary Service not empty --> checking if has callback."); + if (m_siConditionsSvc->hasCallBack()) { + //Register callback. To be triggered after SiConditionsSvc's callback, + ATH_MSG_INFO("Registering callback." ); + CHECK(m_detStore->regFcn(&ISiliconConditionsSvc::callBack,&*m_siConditionsSvc,&ISiLorentzAngleSvc::callBack,dynamic_cast<ISiLorentzAngleSvc*>(this),true)); + } + else { + ATH_MSG_WARNING("Conditions Summary Service has no callback." ); + } } // Get maximum hash for vector sizes. We need the idhelper for this. diff --git a/Simulation/Tools/HitAnalysis/share/AFPHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/AFPHitAnalysis_topOptions.py index 2afbcca4cdb..f22c3e8ac83 100755 --- a/Simulation/Tools/HitAnalysis/share/AFPHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/AFPHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,8 +19,8 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import AFPHitAnalysis topSequence += AFPHitAnalysis() AFPHitAnalysis = AFPHitAnalysis() -AFPHitAnalysis.NtupleFileName = '/AFPHitAnalysis/ntuples/' -AFPHitAnalysis.HistPath = '/AFPHitAnalysis/histos/' +AFPHitAnalysis.NtupleFileName = '/AFPHitAnalysis/' +AFPHitAnalysis.HistPath = '/AFPHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() @@ -41,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/ALFAHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/ALFAHitAnalysis_topOptions.py index 05ece5efe46..4065c4d2854 100755 --- a/Simulation/Tools/HitAnalysis/share/ALFAHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/ALFAHitAnalysis_topOptions.py @@ -10,7 +10,7 @@ include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,6 +19,7 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import ALFAHitAnalysis topSequence += ALFAHitAnalysis() ALFAHitAnalysis = ALFAHitAnalysis() +ALFAHitAnalysis.NtupleFileName = '/ALFAHitAnalysis/' ALFAHitAnalysis.HistPath = '/ALFAHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/AllHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/AllHitAnalysis_topOptions.py index 54b3b857854..e815ea4a872 100755 --- a/Simulation/Tools/HitAnalysis/share/AllHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/AllHitAnalysis_topOptions.py @@ -2,7 +2,6 @@ from AthenaCommon.AppMgr import ServiceMgr import AthenaPoolCnvSvc.ReadAthenaPool - from PartPropSvc.PartPropSvcConf import PartPropSvc include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") @@ -11,9 +10,8 @@ include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/afs/cern.ch/work/a/ancuetog/HitsAreas/20.3.X.Y-VAL-r3/atlasG4_10ttbar_20.3.X.Y-VAL-r3-modtime.NoFrozenShower.DeadLAr.hits.pool.root" ) -#athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) -ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) +ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() @@ -21,57 +19,70 @@ from HitAnalysis.HitAnalysisConf import * topSequence += SiHitAnalysis('PixelHitAnalysis') topSequence.PixelHitAnalysis.CollectionName='PixelHits' +topSequence.PixelHitAnalysis.NtupleFileName='/HitAnalysis/Pixel/' +topSequence.PixelHitAnalysis.HistPath='/HitAnalysis/Pixel/' + topSequence += SiHitAnalysis('SCTHitAnalysis') topSequence.SCTHitAnalysis.CollectionName='SCT_Hits' +topSequence.SCTHitAnalysis.NtupleFileName='/HitAnalysis/SCT/' +topSequence.SCTHitAnalysis.HistPath='/HitAnalysis/SCT/' + topSequence += SiHitAnalysis('BCMHitAnalysis') topSequence.BCMHitAnalysis.CollectionName='BCMHits' +topSequence.BCMHitAnalysis.NtupleFileName='/HitAnalysis/BCM/' +topSequence.BCMHitAnalysis.HistPath='/HitAnalysis/BCM/' + topSequence += SiHitAnalysis('BLMHitAnalysis') topSequence.BLMHitAnalysis.CollectionName='BLMHits' +topSequence.BLMHitAnalysis.NtupleFileName='/HitAnalysis/BLM/' +topSequence.BLMHitAnalysis.HistPath='/HitAnalysis/BLM/' + topSequence += TRTHitAnalysis('TRTHitAnalysis') +topSequence.TRTHitAnalysis.NtupleFileName='/HitAnalysis/TRT/' +topSequence.TRTHitAnalysis.HistPath='/HitAnalysis/TRT/' + topSequence += RPCHitAnalysis('RPCHitAnalysis') +topSequence.RPCHitAnalysis.NtupleFileName='/HitAnalysis/RPC/' +topSequence.RPCHitAnalysis.HistPath='/HitAnalysis/RPC/' + topSequence += MDTHitAnalysis('MDTHitAnalysis') +topSequence.MDTHitAnalysis.NtupleFileName='/HitAnalysis/MDT/' +topSequence.MDTHitAnalysis.HistPath='/HitAnalysis/MDT/' + topSequence += CSCHitAnalysis('CSCHitAnalysis') +topSequence.CSCHitAnalysis.NtupleFileName='/HitAnalysis/CSC/' +topSequence.CSCHitAnalysis.HistPath='/HitAnalysis/CSC/' + topSequence += TGCHitAnalysis('TGCHitAnalysis') +topSequence.TGCHitAnalysis.NtupleFileName='/HitAnalysis/TGC/' +topSequence.TGCHitAnalysis.HistPath='/HitAnalysis/TGC/' + #topSequence += ALFAHitAnalysis('ALFAHitAnalysis') +#topSequence.ALFAHitAnalysis.NtupleFileName='/HitAnalysis/ALFA/' +#topSequence.ALFAHitAnalysis.HistPath='/HitAnalysis/ALFA/' + #topSequence += LucidHitAnalysis('LucidHitAnalysis') +#topSequence.LucidHitAnalysis.NtupleFileName='/HitAnalysis/Lucid/' +#topSequence.LucidHitAnalysis.HistPath='/HitAnalysis/Lucid/' + #topSequence += ZDCHitAnalysis('ZDCHitAnalysis') +#topSequence.ZDCHitAnalysis.NtupleFileName='/HitAnalysis/ZDC/' +#topSequence.ZDCHitAnalysis.HistPath='/HitAnalysis/ZDC/' + topSequence += TrackRecordAnalysis('TrackRecordAnalysis') +topSequence.TrackRecordAnalysis.NtupleFileName='/HitAnalysis/Track/' +topSequence.TrackRecordAnalysis.HistPath='/HitAnalysis/Track/' + topSequence += TruthHitAnalysis('TruthHitAnalysis') -topSequence += CaloHitAnalysis('CaloHitAnalysis') +topSequence.TruthHitAnalysis.NtupleFileName = '/HitAnalysis/Truth/' +topSequence.TruthHitAnalysis.HistPath = '/HitAnalysis/Truth/' +topSequence += CaloHitAnalysis('CaloHitAnalysis') +topSequence.CaloHitAnalysis.NtupleFileName = '/HitAnalysis/Calo/' +topSequence.CaloHitAnalysis.HistPath = '/HitAnalysis/Calo/' -topSequence.PixelHitAnalysis.HistPath='/HitAnalysis/Pixel/histos/' -topSequence.SCTHitAnalysis.HistPath='/HitAnalysis/SCT/histos/' -topSequence.BCMHitAnalysis.HistPath='/HitAnalysis/BCM/histos/' -topSequence.BLMHitAnalysis.HistPath='/HitAnalysis/BLM/histos/' -topSequence.TRTHitAnalysis.HistPath='/HitAnalysis/TRT/histos/' -topSequence.RPCHitAnalysis.HistPath='/HitAnalysis/RPC/histos/' -topSequence.MDTHitAnalysis.HistPath='/HitAnalysis/MDT/histos/' -topSequence.CSCHitAnalysis.HistPath='/HitAnalysis/CSC/histos/' -topSequence.TGCHitAnalysis.HistPath='/HitAnalysis/TGC/histos/' -#topSequence.ALFAHitAnalysis.HistPath='/HitAnalysis/' -#topSequence.LucidHitAnalysis.HistPath='/HitAnalysis/' -#topSequence.ZDCHitAnalysis.HistPath='/HitAnalysis/' -topSequence.TrackRecordAnalysis.HistPath='/HitAnalysis/Track/histos/' -topSequence.TruthHitAnalysis.HistPath = '/HitAnalysis/Truth/histos/' -topSequence.CaloHitAnalysis.HistPath = '/HitAnalysis/Calo/histos/' -topSequence.PixelHitAnalysis.NtupleFileName='/HitAnalysis/Pixel/ntuple/' -topSequence.SCTHitAnalysis.NtupleFileName='/HitAnalysis/SCT/ntuple/' -topSequence.BCMHitAnalysis.NtupleFileName='/HitAnalysis/BCM/ntuple/' -topSequence.BLMHitAnalysis.NtupleFileName='/HitAnalysis/BLM/ntuple/' -topSequence.TRTHitAnalysis.NtupleFileName='/HitAnalysis/TRT/ntuple/' -topSequence.RPCHitAnalysis.NtupleFileName='/HitAnalysis/RPC/ntuple/' -topSequence.MDTHitAnalysis.NtupleFileName='/HitAnalysis/MDT/ntuple/' -topSequence.CSCHitAnalysis.NtupleFileName='/HitAnalysis/CSC/ntuple/' -topSequence.TGCHitAnalysis.NtupleFileName='/HitAnalysis/TGC/ntuple/' -#topSequence.ALFAHitAnalysis.NtupleFileName='/HitAnalysis/' -#topSequence.LucidHitAnalysis.NtupleFileName='/HitAnalysis/' -#topSequence.ZDCHitAnalysis.NtupleFileName='/HitAnalysis/' -topSequence.TrackRecordAnalysis.NtupleFileName='/HitAnalysis/Track/ntuple/' -topSequence.TruthHitAnalysis.NtupleFileName = '/HitAnalysis/Truth/ntuple/' -topSequence.CaloHitAnalysis.NtupleFileName = '/HitAnalysis/Calo/ntuple/' -#Add some more TH2 histograms +#Add some more TH2 histograms topSequence.PixelHitAnalysis.ExpertMode= "off" @@ -85,7 +96,6 @@ from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() ServiceMgr.THistSvc.Output += ["HitAnalysis DATAFILE='AllHitAnalysis.root' OPT='RECREATE'" ] - ServiceMgr.MessageSvc.OutputLevel = INFO ServiceMgr.MessageSvc.defaultLimit = 9999999 diff --git a/Simulation/Tools/HitAnalysis/share/CSCHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/CSCHitAnalysis_topOptions.py index 3cc733d76a2..dd817a4ea6e 100755 --- a/Simulation/Tools/HitAnalysis/share/CSCHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/CSCHitAnalysis_topOptions.py @@ -1,16 +1,16 @@ -q#from AthenaCommon.AppMgr import ToolSvc +#from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ServiceMgr import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,6 +19,7 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import CSCHitAnalysis topSequence += CSCHitAnalysis() CSCHitAnalysis = CSCHitAnalysis() +CSCHitAnalysis.NtupleFileName = '/CSCHitAnalysis/' CSCHitAnalysis.HistPath = '/CSCHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/CaloHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/CaloHitAnalysis_topOptions.py index 95306b508b4..d3b16e0b037 100755 --- a/Simulation/Tools/HitAnalysis/share/CaloHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/CaloHitAnalysis_topOptions.py @@ -4,23 +4,24 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -#include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import CaloHitAnalysis +topSequence += CaloHitAnalysis() CaloHitAnalysis = CaloHitAnalysis() -topSequence += CaloHitAnalysis -CaloHitAnalysis.HistPath = '/CaloHitAnalysis/histos/' -CaloHitAnalysis.NtupleFileName = '/CaloHitAnalysis/ntuple/' +CaloHitAnalysis.NtupleFileName = '/CaloHitAnalysis/' +CaloHitAnalysis.HistPath = '/CaloHitAnalysis/' + #ExpertMode adds more histograms to the output. Default mode is off CaloHitAnalysis.ExpertMode = "off" #CalibHits adds Calibrated hits histograms to the output. Default mode is off @@ -30,7 +31,6 @@ from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() ServiceMgr.THistSvc.Output += ["CaloHitAnalysis DATAFILE='CaloHitAnalysis.root' OPT='RECREATE'" ] - ServiceMgr.MessageSvc.OutputLevel = INFO ServiceMgr.MessageSvc.defaultLimit = 9999999 @@ -46,4 +46,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include( "TrkDetDescrSvc/AtlasTrackingGeometrySvc.py" ) # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/HitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/HitAnalysis_topOptions.py index 2719aae9383..ecece8910f8 100755 --- a/Simulation/Tools/HitAnalysis/share/HitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/HitAnalysis_topOptions.py @@ -1,56 +1,73 @@ #from AthenaCommon.AppMgr import ToolSvc -#from AthenaCommon.AppMgr import ServiceMgr -#import AthenaPoolCnvSvc.ReadAthenaPool +from AthenaCommon.AppMgr import ServiceMgr +import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) + +#import os +#from glob import glob +#from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +#athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) +#ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() -import os -from glob import glob from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() -from HitAnalysis.HitAnalysisConf import * + +from HitAnalysis.HitAnalysisConf import * topSequence += SiHitAnalysis('PixelHitAnalysis') -topSequence.PixelHitAnalysis.CollectionName='PixelHits' +topSequence.PixelHitAnalysis.CollectionName = 'PixelHits' +topSequence.PixelHitAnalysis.HistPath = '/HitAnalysis/Pixel/' + topSequence += SiHitAnalysis('SCTHitAnalysis') -topSequence.SCTHitAnalysis.CollectionName='SCT_Hits' +topSequence.SCTHitAnalysis.CollectionName = 'SCT_Hits' +topSequence.SCTHitAnalysis.HistPath = '/HitAnalysis/SCT/' + topSequence += SiHitAnalysis('BCMHitAnalysis') -topSequence.BCMHitAnalysis.CollectionName='BCMHits' +topSequence.BCMHitAnalysis.CollectionName = 'BCMHits' +topSequence.BCMHitAnalysis.HistPath = '/HitAnalysis/BCM/' + topSequence += SiHitAnalysis('BLMHitAnalysis') -topSequence.BLMHitAnalysis.CollectionName='BLMHits' +topSequence.BLMHitAnalysis.CollectionName = 'BLMHits' +topSequence.BLMHitAnalysis.HistPath = '/HitAnalysis/BLM/' + topSequence += TRTHitAnalysis('TRTHitAnalysis') +topSequence.TRTHitAnalysis.HistPath = '/HitAnalysis/TRT/' + topSequence += RPCHitAnalysis('RPCHitAnalysis') +topSequence.RPCHitAnalysis.HistPath = '/HitAnalysis/RPC/' + topSequence += MDTHitAnalysis('MDTHitAnalysis') +topSequence.MDTHitAnalysis.HistPath = '/HitAnalysis/MDT/' + topSequence += CSCHitAnalysis('CSCHitAnalysis') +topSequence.CSCHitAnalysis.HistPath = '/HitAnalysis/CSC/' + topSequence += TGCHitAnalysis('TGCHitAnalysis') +topSequence.TGCHitAnalysis.HistPath = '/HitAnalysis/TGC/' + #topSequence += ALFAHitAnalysis('ALFAHitAnalysis') +#topSequence.ALFAHitAnalysis.HistPath = '/HitAnalysis/ALFA/' + #topSequence += LucidHitAnalysis('LucidHitAnalysis') +#topSequence.LucidHitAnalysis.HistPath = '/HitAnalysis/Lucid/' + #topSequence += ZDCHitAnalysis('ZDCHitAnalysis') -topSequence += TrackRecordAnalysis('TrackRecordAnalysis') -topSequence += TruthHitAnalysis('TruthHitAnalysis') -topSequence += CaloHitAnalysis('CaloHitAnalysis') +#topSequence.ZDCHitAnalysis.HistPath = '/HitAnalysis/ZDC/' +topSequence += TrackRecordAnalysis('TrackRecordAnalysis') +topSequence.TrackRecordAnalysis.HistPath = '/HitAnalysis/Track/' +topSequence += TruthHitAnalysis('TruthHitAnalysis') +topSequence.TruthHitAnalysis.HistPath = '/HitAnalysis/Truth/' -topSequence.PixelHitAnalysis.HistPath='/HitAnalysis/' -topSequence.SCTHitAnalysis.HistPath='/HitAnalysis/' -topSequence.BCMHitAnalysis.HistPath='/HitAnalysis/' -topSequence.BLMHitAnalysis.HistPath='/HitAnalysis/' -topSequence.TRTHitAnalysis.HistPath='/HitAnalysis/' -topSequence.RPCHitAnalysis.HistPath='/HitAnalysis/' -topSequence.MDTHitAnalysis.HistPath='/HitAnalysis/' -topSequence.CSCHitAnalysis.HistPath='/HitAnalysis/' -topSequence.TGCHitAnalysis.HistPath='/HitAnalysis/' -#topSequence.ALFAHitAnalysis.HistPath='/HitAnalysis/' -#topSequence.LucidHitAnalysis.HistPath='/HitAnalysis/' -#topSequence.ZDCHitAnalysis.HistPath='/HitAnalysis/' -topSequence.TrackRecordAnalysis.HistPath='/HitAnalysis/' -topSequence.TruthHitAnalysis.HistPath = '/HitAnalysis/' -topSequence.CaloHitAnalysis.HistPath = '/HitAnalysis/' -#Add some more TH2 histograms +topSequence += CaloHitAnalysis('CaloHitAnalysis') +topSequence.CaloHitAnalysis.HistPath = '/HitAnalysis/Calo' + +#Add some more TH2 histograms topSequence.PixelHitAnalysis.ExpertMode= "off" @@ -60,10 +77,6 @@ topSequence.BLMHitAnalysis.ExpertMode= "off" topSequence.CaloHitAnalysis.ExpertMode = "off" topSequence.CaloHitAnalysis.CalibHits = "off" -#from GaudiSvc.GaudiSvcConf import THistSvc -#ServiceMgr += THistSvc() -#ServiceMgr.THistSvc.Output += ["CaloHitAnalysis DATAFILE='CaloHitAnalysis_v2.root' OPT='RECREATE'" ] - ServiceMgr.MessageSvc.OutputLevel = INFO ServiceMgr.MessageSvc.defaultLimit = 9999999 @@ -80,4 +93,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include( "TrkDetDescrSvc/AtlasTrackingGeometrySvc.py" ) # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/LucidHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/LucidHitAnalysis_topOptions.py index b4404d517df..0255deadc37 100755 --- a/Simulation/Tools/HitAnalysis/share/LucidHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/LucidHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,6 +19,7 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import LucidHitAnalysis topSequence += LucidHitAnalysis() LucidHitAnalysis = LucidHitAnalysis() +LucidHitAnalysis.NtupleFileName = '/LucidHitAnalysis/' LucidHitAnalysis.HistPath = '/LucidHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/MDTHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/MDTHitAnalysis_topOptions.py index 8cac6fc0153..f29cb9b63d5 100755 --- a/Simulation/Tools/HitAnalysis/share/MDTHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/MDTHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,7 +19,8 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import MDTHitAnalysis topSequence += MDTHitAnalysis() MDTHitAnalysis = MDTHitAnalysis() -MDTHitAnalysis.NtupleFileName = 'MDTHitAnalysis' +MDTHitAnalysis.NtupleFileName = '/MDTHitAnalysis/' +MDTHitAnalysis.HistPath = '/MDTHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/MuonHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/MuonHitAnalysis_topOptions.py index 1d887bb4d46..cc465ff0c46 100755 --- a/Simulation/Tools/HitAnalysis/share/MuonHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/MuonHitAnalysis_topOptions.py @@ -4,30 +4,39 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() + from HitAnalysis.HitAnalysisConf import RPCHitAnalysis -topSequence += RPCHitAnalysis('RPCHitAnalysis') -topSequence.RPCHitAnalysis.HistPath = '/MuonHitAnalysis/' +topSequence += RPCHitAnalysis('RPCHitAnalysis') +topSequence.RPCHitAnalysis.NtupleFileName = '/MuonHitAnalysis/RPC/' +topSequence.RPCHitAnalysis.HistPath = '/MuonHitAnalysis/RPC/' + from HitAnalysis.HitAnalysisConf import MDTHitAnalysis -topSequence += MDTHitAnalysis('MDTHitAnalysis') -topSequence.MDTHitAnalysis.HistPath = '/MuonHitAnalysis/' +topSequence += MDTHitAnalysis('MDTHitAnalysis') +topSequence.MDTHitAnalysis.NtupleFileName = '/MuonHitAnalysis/MDT/' +topSequence.MDTHitAnalysis.HistPath = '/MuonHitAnalysis/MDT/' + from HitAnalysis.HitAnalysisConf import CSCHitAnalysis -topSequence += CSCHitAnalysis('CSCHitAnalysis') -topSequence.CSCHitAnalysis.HistPath = '/MuonHitAnalysis/' +topSequence += CSCHitAnalysis('CSCHitAnalysis') +topSequence.CSCHitAnalysis.NtupleFileName = '/MuonHitAnalysis/CSC/' +topSequence.CSCHitAnalysis.HistPath = '/MuonHitAnalysis/CSC/' + from HitAnalysis.HitAnalysisConf import TGCHitAnalysis -topSequence += TGCHitAnalysis('TGCHitAnalysis') -topSequence.TGCHitAnalysis.HistPath = '/MuonHitAnalysis/' +topSequence += TGCHitAnalysis('TGCHitAnalysis') +topSequence.TGCHitAnalysis.NtupleFileName = '/MuonHitAnalysis/TGC/' +topSequence.TGCHitAnalysis.HistPath = '/MuonHitAnalysis/TGC/' + from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() @@ -48,4 +57,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/RPCHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/RPCHitAnalysis_topOptions.py index 17160c375da..3f5d1905540 100755 --- a/Simulation/Tools/HitAnalysis/share/RPCHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/RPCHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,7 +19,8 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import RPCHitAnalysis topSequence += RPCHitAnalysis() RPCHitAnalysis = RPCHitAnalysis() -RPCHitAnalysis.NtupleFileName = 'RPCHitAnalysis' +RPCHitAnalysis.NtupleFileName = '/RPCHitAnalysis/' +RPCHitAnalysis.HistPath = '/RPCHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/SiHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/SiHitAnalysis_topOptions.py index e274b8fb193..0d71eb7c547 100755 --- a/Simulation/Tools/HitAnalysis/share/SiHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/SiHitAnalysis_topOptions.py @@ -4,37 +4,39 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() + from HitAnalysis.HitAnalysisConf import SiHitAnalysis topSequence += SiHitAnalysis('PixelHitAnalysis') topSequence.PixelHitAnalysis.CollectionName='PixelHits' +topSequence.PixelHitAnalysis.NtupleFileName='/SiHitAnalysis/' +topSequence.PixelHitAnalysis.HistPath='/SiHitAnalysis/' + topSequence += SiHitAnalysis('SCTHitAnalysis') topSequence.SCTHitAnalysis.CollectionName='SCT_Hits' +topSequence.SCTHitAnalysis.NtupleFileName='/SiHitAnalysis/' +topSequence.SCTHitAnalysis.HistPath='/SiHitAnalysis/' + topSequence += SiHitAnalysis('BCMHitAnalysis') topSequence.BCMHitAnalysis.CollectionName='BCMHits' +topSequence.BCMHitAnalysis.NtupleFileName='/SiHitAnalysis/' +topSequence.BCMHitAnalysis.HistPath='/SiHitAnalysis/' + topSequence += SiHitAnalysis('BLMHitAnalysis') topSequence.BLMHitAnalysis.CollectionName='BLMHits' - -topSequence.PixelHitAnalysis.HistPath='/SiHitAnalysis/histos/' -topSequence.SCTHitAnalysis.HistPath='/SiHitAnalysis/histos/' -topSequence.BCMHitAnalysis.HistPath='/SiHitAnalysis/histos/' -topSequence.BLMHitAnalysis.HistPath='/SiHitAnalysis/histos/' - -topSequence.PixelHitAnalysis.NtupleFileName='/SiHitAnalysis/ntuples/' -topSequence.SCTHitAnalysis.NtupleFileName='/SiHitAnalysis/ntuples/' -topSequence.BCMHitAnalysis.NtupleFileName='/SiHitAnalysis/ntuples/' -topSequence.BLMHitAnalysis.NtupleFileName='/SiHitAnalysis/ntuples/' +topSequence.BLMHitAnalysis.NtupleFileName='/SiHitAnalysis/' +topSequence.BLMHitAnalysis.HistPath='/SiHitAnalysis/' #Add some more TH2 histograms @@ -62,4 +64,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include( "TrkDetDescrSvc/AtlasTrackingGeometrySvc.py" ) # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/TGCHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/TGCHitAnalysis_topOptions.py index ec86239c82d..d5a7d70e879 100755 --- a/Simulation/Tools/HitAnalysis/share/TGCHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/TGCHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,6 +19,7 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import TGCHitAnalysis topSequence += TGCHitAnalysis() TGCHitAnalysis = TGCHitAnalysis() +TGCHitAnalysis.NtupleFileName = '/TGCHitAnalysis/' TGCHitAnalysis.HistPath = '/TGCHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/TRTHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/TRTHitAnalysis_topOptions.py index 799b65c1b5a..157d3fc1c48 100755 --- a/Simulation/Tools/HitAnalysis/share/TRTHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/TRTHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,6 +19,7 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import TRTHitAnalysis topSequence += TRTHitAnalysis() TRTHitAnalysis = TRTHitAnalysis() +TRTHitAnalysis.NtupleFileName = '/TRTHitAnalysis/' TRTHitAnalysis.HistPath = '/TRTHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include( "TrkDetDescrSvc/AtlasTrackingGeometrySvc.py" ) # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/TrackRecordAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/TrackRecordAnalysis_topOptions.py index eb6c8b3d313..d4deea7d5d3 100755 --- a/Simulation/Tools/HitAnalysis/share/TrackRecordAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/TrackRecordAnalysis_topOptions.py @@ -4,29 +4,34 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*.root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() + from HitAnalysis.HitAnalysisConf import TrackRecordAnalysis topSequence += TrackRecordAnalysis('TrackRecordCaloEntry') -topSequence.TrackRecordCaloEntry.CollectionName='CaloEntryLayer' -topSequence.TrackRecordCaloEntry.HistPath='/TrackRecordAnalysis/' +topSequence.TrackRecordCaloEntry.CollectionName = 'CaloEntryLayer' +topSequence.TrackRecordCaloEntry.NtupleFileName = '/TrackRecordAnalysis/' +topSequence.TrackRecordCaloEntry.HistPath = '/TrackRecordAnalysis/' + topSequence += TrackRecordAnalysis('TrackRecordMuonEntry') -topSequence.TrackRecordMuonEntry.CollectionName='MuonEntryLayer' -topSequence.TrackRecordMuonEntry.HistPath='/TrackRecordAnalysis/' -topSequence += TrackRecordAnalysis('TrackRecordMuonExit') -topSequence.TrackRecordMuonExit.CollectionName='MuonExitLayer' -topSequence.TrackRecordMuonExit.HistPath='/TrackRecordAnalysis/' +topSequence.TrackRecordMuonEntry.CollectionName = 'MuonEntryLayer' +topSequence.TrackRecordMuonEntry.NtupleFileName = '/TrackRecordAnalysis/' +topSequence.TrackRecordMuonEntry.HistPath = '/TrackRecordAnalysis/' +topSequence += TrackRecordAnalysis('TrackRecordMuonExit') +topSequence.TrackRecordMuonExit.CollectionName = 'MuonExitLayer' +topSequence.TrackRecordMuonExit.NtupleFileName = '/TrackRecordAnalysis/' +topSequence.TrackRecordMuonExit.HistPath = '/TrackRecordAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -48,4 +53,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/TruthHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/TruthHitAnalysis_topOptions.py index 8a872418ae8..3299fb3dc50 100755 --- a/Simulation/Tools/HitAnalysis/share/TruthHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/TruthHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" + "HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,6 +19,7 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import TruthHitAnalysis topSequence += TruthHitAnalysis() TruthHitAnalysis = TruthHitAnalysis() +TruthHitAnalysis.NtupleFileName = '/TruthHitAnalysis/' TruthHitAnalysis.HistPath = '/TruthHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/share/ZDCHitAnalysis_topOptions.py b/Simulation/Tools/HitAnalysis/share/ZDCHitAnalysis_topOptions.py index 5e0ef00009e..02da3c262fb 100755 --- a/Simulation/Tools/HitAnalysis/share/ZDCHitAnalysis_topOptions.py +++ b/Simulation/Tools/HitAnalysis/share/ZDCHitAnalysis_topOptions.py @@ -4,13 +4,13 @@ import AthenaPoolCnvSvc.ReadAthenaPool from PartPropSvc.PartPropSvcConf import PartPropSvc -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") -include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) +include("ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py") +include("EventAthenaPool/EventAthenaPool_joboptions.py" ) import os from glob import glob from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = glob( "/tmp/"+os.environ['USER']+"HITS*root*" ) +athenaCommonFlags.FilesInput = glob( "/tmp/" + os.environ['USER'] + "/" +"HITS*root*" ) ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() # This is stupid and redundant, but necessary from AthenaCommon.AlgSequence import AlgSequence @@ -19,6 +19,7 @@ topSequence = AlgSequence() from HitAnalysis.HitAnalysisConf import ZDCHitAnalysis topSequence += ZDCHitAnalysis() ZDCHitAnalysis = ZDCHitAnalysis() +ZDCHitAnalysis.NtupleFileName = '/ZDCHitAnalysis/' ZDCHitAnalysis.HistPath = '/ZDCHitAnalysis/' from GaudiSvc.GaudiSvcConf import THistSvc @@ -40,4 +41,3 @@ from RecExConfig.AutoConfiguration import * ConfigureFieldAndGeo() # Configure the settings for the geometry include("RecExCond/AllDet_detDescr.py") # Actually load the geometry #include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") # Tracking geometry, handy for ID work - diff --git a/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.cxx index 8e2dac96fca..e689e089ed5 100755 --- a/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.cxx @@ -7,12 +7,10 @@ #include "AFP_SimEv/AFP_SIDSimHit.h" #include "AFP_SimEv/AFP_SIDSimHitCollection.h" - #include "TH1.h" #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -34,21 +32,34 @@ AFPHitAnalysis::AFPHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator , h_detID(0) , h_pixelRow(0) , h_pixelCol(0) + , m_hitID(0) + , m_pdgID(0) + , m_trackID(0) + , m_kine(0) + , m_edep(0) + , m_stepX(0) + , m_stepY(0) + , m_stepZ(0) + , m_time(0) + , m_stationID(0) + , m_detID(0) + , m_pixelRow(0) + , m_pixelCol(0) , m_tree(0) - , m_ntupleFileName("/AFPHitAnalysis/ntuples/") - , m_path("/AFPHitAnalysis/histos/") + , m_ntupleFileName("/AFPHitAnalysis/") + , m_path("/AFPHitAnalysis/") , m_thistSvc("THistSvc", name) { - declareProperty("HistPath", m_path); - declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("HistPath", m_path); } + StatusCode AFPHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing AFPHitAnalysis" ); // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - /** now define the histograms**/ h_hitID = new TH1D("h_hitID", "hitID",100, 0., 100.); @@ -95,15 +106,14 @@ StatusCode AFPHitAnalysis::initialize() { h_pixelRow->StatOverflows(); CHECK(m_thistSvc->regHist(m_path+h_pixelRow->GetName(), h_pixelRow)); - h_pixelCol = new TH1D("h_pixelCol", "pixelCol", 20, 0,20); h_pixelCol->StatOverflows(); CHECK(m_thistSvc->regHist(m_path+h_pixelCol->GetName(), h_pixelCol)); /** now add branches and leaves to the tree */ - m_tree= new TTree("NtupleAFPHitAnanalysis","AFPHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; - CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); + m_tree = new TTree("AFP","AFP"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; + CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); if (m_tree){ m_tree->Branch("hitID", &m_hitID); @@ -117,16 +127,16 @@ StatusCode AFPHitAnalysis::initialize() { m_tree->Branch("stationID", &m_stationID); m_tree->Branch("detID", &m_detID); m_tree->Branch("pixelRow", &m_pixelRow); - m_tree->Branch("pixelCol", &m_pixelCol); - - - }else{ + m_tree->Branch("pixelCol", &m_pixelCol); + } + else { ATH_MSG_ERROR("No tree found!"); } + + ATH_MSG_INFO("Exiting AFPHitAnalysis::initialize()"); return StatusCode::SUCCESS; } - StatusCode AFPHitAnalysis::execute() { @@ -146,10 +156,15 @@ StatusCode AFPHitAnalysis::execute() { m_pixelRow->clear(); m_pixelCol->clear(); + ATH_MSG_INFO( "AFPHitAnalysis tree branches cleared" ); + AFP_SIDSimHitConstIter hi; const DataHandle<AFP_SIDSimHitCollection> iter; - CHECK(evtStore()->retrieve(iter,"AFP_SIDSimHitCollection")); - for(hi=(*iter).begin(); hi != (*iter).end();++hi){ + CHECK( evtStore()->retrieve(iter,"AFP_SIDSimHitCollection") ); + + ATH_MSG_DEBUG( "AFP_SIDSSimHitCollection retrieved" ); + + for ( hi=(*iter).begin(); hi != (*iter).end(); ++hi ) { AFP_SIDSimHit ghit(*hi); h_hitID->Fill(ghit.m_nHitID); h_pdgID->Fill(ghit.m_nParticleEncoding); @@ -165,7 +180,6 @@ StatusCode AFPHitAnalysis::execute() { h_pixelRow->Fill(ghit.m_nPixelRow); h_pixelCol->Fill(ghit.m_nPixelCol); - m_hitID->push_back(ghit.m_nHitID); m_pdgID->push_back(ghit.m_nParticleEncoding); m_trackID->push_back(ghit.m_nTrackID); @@ -182,5 +196,6 @@ StatusCode AFPHitAnalysis::execute() { } if (m_tree) m_tree->Fill(); + return StatusCode::SUCCESS; } diff --git a/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.h index 7dfd58e0e68..63f4d61983f 100755 --- a/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/AFPHitAnalysis.h @@ -15,10 +15,10 @@ #include "TH1.h" #include "TTree.h" - class TH1; class TTree; - + + class AFPHitAnalysis : public AthAlgorithm { public: @@ -59,6 +59,7 @@ class AFPHitAnalysis : public AthAlgorithm { std::vector<int>* m_detID; std::vector<int>* m_pixelRow; std::vector<int>* m_pixelCol; + TTree * m_tree; std::string m_ntupleFileName; std::string m_path; @@ -67,4 +68,3 @@ class AFPHitAnalysis : public AthAlgorithm { }; #endif // AFP_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.cxx index b1074bce7cd..049933ff3d7 100644 --- a/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.cxx @@ -11,7 +11,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -24,81 +23,76 @@ ALFAHitAnalysis::ALFAHitAnalysis(const std::string& name, ISvcLocator* pSvcLocat , m_fiber(0) , m_sign(0) , m_energy(0) + , m_tree(0) - , m_ntupleFileName("/ALFAHitsAnalysis/ntuples/") - , m_path("/ALFAHitsAnalysis/histos") + , m_ntupleFileName("/ALFAHitsAnalysis/") + , m_path("/ALFAHitsAnalysis/") , m_thistSvc("THistSvc", name) { - for(int i(0); i<8; i++){ + for (int i(0); i<8; i++) { h_E_full_sum_h[i]=0; h_E_layer_sum_h[i]=0; h_hit_layer[i]=0; h_hit_fiber[i]=0; - } declareProperty("NtupleFileName", m_ntupleFileName); declareProperty("HistPath", m_path); } + StatusCode ALFAHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing ALFAHitAnalysis" ); - // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - - /** now add branches and leaves to the tree */ std::stringstream s; - for(unsigned int j=0; j<8;j++){ + for (unsigned int j=0; j<8; j++) { s.str(""); - s <<"edep_in_det_no."<< j+1; + s << "edep_in_det_no." << j+1; float Emax = 5; - if(j==3) Emax=150; - h_E_full_sum_h[j] = new TH1D(s.str().c_str(),s.str().c_str(), 100,0,Emax); + if (j==3) Emax = 150; + h_E_full_sum_h[j] = new TH1D(s.str().c_str(), s.str().c_str(), 100, 0, Emax); h_E_full_sum_h[j]->StatOverflows(); - CHECK(m_thistSvc->regHist(m_path+h_E_full_sum_h[j]->GetName(), h_E_full_sum_h[j])); + CHECK( m_thistSvc->regHist( m_path + h_E_full_sum_h[j]->GetName(), h_E_full_sum_h[j] ) ); s.str(""); - s <<"edep_per_layer_det_no."<< j+1; - h_E_layer_sum_h[j] = new TH1D(s.str().c_str(),s.str().c_str(), 100,0,15); + s << "edep_per_layer_det_no." << j+1; + h_E_layer_sum_h[j] = new TH1D(s.str().c_str(), s.str().c_str(), 100, 0, 15); h_E_layer_sum_h[j]->StatOverflows(); - CHECK(m_thistSvc->regHist(m_path+h_E_layer_sum_h[j]->GetName(), h_E_layer_sum_h[j])); + CHECK( m_thistSvc->regHist( m_path + h_E_layer_sum_h[j]->GetName(), h_E_layer_sum_h[j] ) ); s.str(""); - s <<"hit_layer_det_no."<< j+1; - h_hit_layer[j] = new TH1D(s.str().c_str(),s.str().c_str(),50,0,50); + s << "hit_layer_det_no." << j+1; + h_hit_layer[j] = new TH1D(s.str().c_str(), s.str().c_str(), 50, 0, 50); h_hit_layer[j]->StatOverflows(); - CHECK(m_thistSvc->regHist(m_path+h_hit_layer[j]->GetName(), h_hit_layer[j])); + CHECK( m_thistSvc->regHist( m_path + h_hit_layer[j]->GetName(), h_hit_layer[j] ) ); s.str(""); - s <<"hit_fiber_det_no."<< j+1; - h_hit_fiber[j] = new TH1D(s.str().c_str(),s.str().c_str(),100,0,60); + s << "hit_fiber_det_no." << j+1; + h_hit_fiber[j] = new TH1D(s.str().c_str(), s.str().c_str(), 100, 0, 60); h_hit_fiber[j]->StatOverflows(); - CHECK(m_thistSvc->regHist(m_path+h_hit_fiber[j]->GetName(), h_hit_fiber[j])); - - } + CHECK( m_thistSvc->regHist( m_path + h_hit_fiber[j]->GetName(), h_hit_fiber[j] ) ); + } - m_tree= new TTree("NtupleALFAHitAnalysis", "ALFAHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + m_tree = new TTree("ALFA", "ALFA"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/" ; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - - - /** now add branches and leaves to the tree */ - if (m_tree){ + if (m_tree) { m_tree->Branch("station", &m_station); m_tree->Branch("plate", &m_plate); m_tree->Branch("fiber", &m_fiber); m_tree->Branch("energy", &m_energy); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } + return StatusCode::SUCCESS; } - StatusCode ALFAHitAnalysis::execute() { ATH_MSG_DEBUG( "In ALFAHitAnalysis::execute()" ); @@ -110,15 +104,15 @@ StatusCode ALFAHitAnalysis::execute() { m_energy->clear(); //cleaning - int fiber,plate,sign,station; + int fiber, plate, sign, station; double E_fiber_sum[8][10][64][2], E_full_sum[8], E_layer_sum[8][20]; - for (int l= 0;l<8;l++){ + for (int l= 0; l<8; l++) { E_full_sum[l] = 0.; - for ( int i = 0; i < 10; i++ ){ + for (int i = 0; i < 10; i++) { E_layer_sum[l][i] = 0.; - E_layer_sum[l][i+10] = 0.; - for ( int j = 0; j < 64; j++ ){ - for ( int k = 0; k < 2; k++ ){ + E_layer_sum[l][i+10] = 0.; + for (int j = 0; j < 64; j++) { + for (int k = 0; k < 2; k++) { E_fiber_sum[l][i][j][k] = 0.; } } @@ -127,28 +121,28 @@ StatusCode ALFAHitAnalysis::execute() { ALFA_HitConstIter iter; const DataHandle<ALFA_HitCollection> col_alfa; - CHECK(evtStore()->retrieve(col_alfa,"ALFA_HitCollection")); - for(iter=(*col_alfa).begin(); iter!=(*col_alfa).end();++iter){ + CHECK( evtStore()->retrieve( col_alfa, "ALFA_HitCollection" ) ); + for (iter = (*col_alfa).begin(); iter != (*col_alfa).end(); ++iter) { station = (*iter).GetStationNumber(); - plate = (*iter).GetPlateNumber(); - fiber = (*iter).GetFiberNumber(); - sign = (*iter).GetSignFiber(); - E_fiber_sum[station-1][plate-1][fiber-1][(1-sign)/2]+=((*iter).GetEnergyDeposit()); + plate = (*iter).GetPlateNumber(); + fiber = (*iter).GetFiberNumber(); + sign = (*iter).GetSignFiber(); + E_fiber_sum[station-1][plate-1][fiber-1][(1-sign)/2] += ((*iter).GetEnergyDeposit()); m_station->push_back(station); m_plate->push_back(plate); m_fiber->push_back(fiber); m_sign->push_back(sign); m_energy->push_back((*iter).GetEnergyDeposit()); - } // End iteration + } // End iteration - for(int l=0;l<8;l++){ - for(int i=0;i<10; i++){ - for(int j=0;j<64;j++){ - for(int k=0;k<2;k++){ - E_full_sum[l]+=E_fiber_sum[l][i][j][k]; - E_layer_sum[l][2*i+k]+=E_fiber_sum[l][i][j][k]; - if(E_fiber_sum[l][i][j][k]>0.){ + for (int l=0; l<8; l++){ + for (int i=0; i<10; i++){ + for (int j=0; j<64; j++){ + for (int k=0; k<2; k++){ + E_full_sum[l] += E_fiber_sum[l][i][j][k]; + E_layer_sum[l][2*i+k] += E_fiber_sum[l][i][j][k]; + if (E_fiber_sum[l][i][j][k] > 0.) { h_hit_layer[l]->Fill(2*i+k+1); h_hit_fiber[l]->Fill(j+1); } @@ -156,14 +150,14 @@ StatusCode ALFAHitAnalysis::execute() { } } } - for(int l = 0;l<8;l++){ + for (int l=0; l<8; l++) { h_E_full_sum_h[l]->Fill(E_full_sum[l]); - for(int i = 0; i< 20;i++){ + for (int i = 0; i< 20; i++) { h_E_layer_sum_h[l]->Fill(E_layer_sum[l][i]); } } if (m_tree) m_tree->Fill(); + return StatusCode::SUCCESS; } - diff --git a/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.h index 8d833d12f70..5f27159bef4 100755 --- a/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/ALFAHitAnalysis.h @@ -10,7 +10,6 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ITHistSvc.h" - #include <string> #include <vector> #include "TH1.h" @@ -18,7 +17,8 @@ class TH1; class TTree; - + + class ALFAHitAnalysis : public AthAlgorithm { public: @@ -31,7 +31,6 @@ class ALFAHitAnalysis : public AthAlgorithm { private: - std::string m_collection; /** Some variables**/ TH1* h_E_full_sum_h[8]; TH1* h_E_layer_sum_h[8]; @@ -43,16 +42,14 @@ class ALFAHitAnalysis : public AthAlgorithm { std::vector<int>* m_fiber; std::vector<int>* m_sign; std::vector<double>* m_energy; - - + + std::string m_collection; TTree * m_tree; std::string m_ntupleFileName; std::string m_path; ServiceHandle<ITHistSvc> m_thistSvc; - }; #endif // ALFA_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.cxx index a03e6f7fad3..a7f4d52f449 100755 --- a/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.cxx @@ -16,7 +16,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -57,21 +56,22 @@ CSCHitAnalysis::CSCHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator , m_hits_time(0) , m_hits_edep(0) , m_hits_kine(0) + , m_tree(0) - , m_ntupleFileName("/CSCHitAnalysis/ntuples/") - , m_path("/CSCHitAnalysis/histos/") + , m_ntupleFileName("/CSCHitAnalysis/") + , m_path("/CSCHitAnalysis/") , m_thistSvc("THistSvc", name) { declareProperty("NtupleFileName", m_ntupleFileName); declareProperty("HistPath", m_path); } + StatusCode CSCHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing CSCHitAnalysis" ); // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - /** Histograms**/ h_hits_x = new TH1D("h_csc_hits_x","hits_x", 100,-2000, 2000); @@ -118,7 +118,6 @@ StatusCode CSCHitAnalysis::initialize() { h_hits_sz->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_sz->GetName(), h_hits_sz)); - h_hits_ex = new TH1D("h_csc_hits_ex","hits_ex", 100,-10, 10); h_hits_ex->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_ex->GetName(), h_hits_ex)); @@ -143,13 +142,11 @@ StatusCode CSCHitAnalysis::initialize() { h_hits_kine->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_kine->GetName(), h_hits_kine)); - m_tree= new TTree("NtupleCSCHitAnalysis","CSCHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; - CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - - - /** now add branches and leaves to the tree */ + m_tree = new TTree("CSC", "CSC"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; + CHECK(m_thistSvc->regTree(fullNtupleName, m_tree)); + if (m_tree){ m_tree->Branch("x", &m_hits_x); m_tree->Branch("y", &m_hits_y); @@ -166,13 +163,14 @@ StatusCode CSCHitAnalysis::initialize() { m_tree->Branch("time", &m_hits_time); m_tree->Branch("edep", &m_hits_edep); m_tree->Branch("kine", &m_hits_kine); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } + return StatusCode::SUCCESS; -} +} - StatusCode CSCHitAnalysis::execute() { ATH_MSG_DEBUG( "In CSCHitAnalysis::execute()" ); @@ -192,17 +190,16 @@ StatusCode CSCHitAnalysis::execute() { m_hits_time->clear(); m_hits_edep->clear(); m_hits_kine->clear(); - - const DataHandle<CSCSimHitCollection> csc_container; - if (evtStore()->retrieve(csc_container, "CSC_Hits" )==StatusCode::SUCCESS) { - for(CSCSimHitCollection::const_iterator i_hit = csc_container->begin(); - i_hit != csc_container->end();++i_hit){ + if (evtStore()->retrieve(csc_container, "CSC_Hits") == StatusCode::SUCCESS) { + for (CSCSimHitCollection::const_iterator i_hit = csc_container->begin(); + i_hit != csc_container->end(); ++i_hit) { //CSCSimHitCollection::const_iterator i_hit; //for(auto i_hit : *csc_container){ GeoCSCHit ghit(*i_hit); - if(!ghit) continue; + if (!ghit) continue; + Amg::Vector3D p = ghit.getGlobalPosition(); h_hits_x->Fill(p.x()); h_hits_y->Fill(p.y()); @@ -212,12 +209,12 @@ StatusCode CSCHitAnalysis::execute() { h_zr->Fill(p.z(), p.perp()); h_hits_eta->Fill(p.eta()); h_hits_phi->Fill(p.phi()); - h_hits_sx->Fill( (*i_hit).getHitStart().x()); - h_hits_sy->Fill( (*i_hit).getHitStart().y()); - h_hits_sz->Fill( (*i_hit).getHitStart().z()); - h_hits_ex->Fill( (*i_hit).getHitEnd().x()); - h_hits_ey->Fill( (*i_hit).getHitEnd().y()); - h_hits_ez->Fill( (*i_hit).getHitEnd().z()); + h_hits_sx->Fill((*i_hit).getHitStart().x()); + h_hits_sy->Fill((*i_hit).getHitStart().y()); + h_hits_sz->Fill((*i_hit).getHitStart().z()); + h_hits_ex->Fill((*i_hit).getHitEnd().x()); + h_hits_ey->Fill((*i_hit).getHitEnd().y()); + h_hits_ez->Fill((*i_hit).getHitEnd().z()); h_hits_edep->Fill((*i_hit).energyDeposit()); h_hits_time->Fill((*i_hit).globalTime()); h_hits_kine->Fill((*i_hit).kineticEnergy()); @@ -228,21 +225,20 @@ StatusCode CSCHitAnalysis::execute() { m_hits_r->push_back(p.perp()); m_hits_eta->push_back(p.eta()); m_hits_phi->push_back(p.phi()); - m_hits_start_x->push_back( (*i_hit).getHitStart().x()); - m_hits_start_y->push_back( (*i_hit).getHitStart().y()); - m_hits_start_z->push_back( (*i_hit).getHitStart().z()); - m_hits_end_x->push_back( (*i_hit).getHitEnd().x()); - m_hits_end_y->push_back( (*i_hit).getHitEnd().y()); - m_hits_end_z->push_back( (*i_hit).getHitEnd().z()); + m_hits_start_x->push_back((*i_hit).getHitStart().x()); + m_hits_start_y->push_back((*i_hit).getHitStart().y()); + m_hits_start_z->push_back((*i_hit).getHitStart().z()); + m_hits_end_x->push_back((*i_hit).getHitEnd().x()); + m_hits_end_y->push_back((*i_hit).getHitEnd().y()); + m_hits_end_z->push_back((*i_hit).getHitEnd().z()); m_hits_edep->push_back((*i_hit).energyDeposit()); m_hits_time->push_back((*i_hit).globalTime()); - m_hits_kine->push_back((*i_hit).kineticEnergy()); - + m_hits_kine->push_back((*i_hit).kineticEnergy()); } } // End while hits + if (m_tree) m_tree->Fill(); - - return StatusCode::SUCCESS; + } diff --git a/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.h index c85d3e63a67..c33042c6578 100755 --- a/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/CSCHitAnalysis.h @@ -16,12 +16,11 @@ #include "TH2.h" #include "TTree.h" - - class TH1; class TH2; class TTree; - + + class CSCHitAnalysis : public AthAlgorithm { public: @@ -77,4 +76,3 @@ class CSCHitAnalysis : public AthAlgorithm { }; #endif // CSC_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.cxx index ae15f656052..9781d1ef148 100755 --- a/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.cxx @@ -74,24 +74,25 @@ CaloHitAnalysis::CaloHitAnalysis(const std::string& name, ISvcLocator* pSvcLocat , m_calib_partID(0) , m_expert("off") , m_calib("off") - , m_thistSvc("THistSvc",name) - , m_path("/CaloHitAnalysis/") - , m_tree(0) - , m_ntupleFileName("/ntuples/") , m_tileID(0) , m_tileMgr(0) + + , m_tree(0) + , m_ntupleFileName("/CaloHitAnalysis/") + , m_path("/CaloHitAnalysis/") + , m_thistSvc("THistSvc", name) { - declareProperty("HistPath", m_path); declareProperty("ExpertMode", m_expert="off"); declareProperty("CalibHits", m_calib="off"); declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("HistPath", m_path); } + StatusCode CaloHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing CaloHitAnalysis" ); CHECK( detStore()->retrieve(m_tileMgr) ); - CHECK( detStore()->retrieve(m_tileID) ); // Grab the Ntuple and histogramming service for the tree @@ -138,13 +139,12 @@ StatusCode CaloHitAnalysis::initialize() { h_r_e = new TH2D("h_Calo_r_e", "energy vs radius", 100, 0,6000, 100,0,500); h_r_e->StatOverflows(); - if( m_expert == "on") - { - CHECK(m_thistSvc->regHist( m_path+h_time_e->GetName(), h_time_e)); - CHECK(m_thistSvc->regHist( m_path+h_eta_e->GetName(), h_eta_e)); - CHECK(m_thistSvc->regHist( m_path+h_phi_e->GetName(), h_phi_e)); - CHECK(m_thistSvc->regHist( m_path+h_r_e->GetName(), h_r_e)); - } + if (m_expert == "on") { + CHECK(m_thistSvc->regHist(m_path + h_time_e->GetName(), h_time_e)); + CHECK(m_thistSvc->regHist(m_path + h_eta_e->GetName(), h_eta_e)); + CHECK(m_thistSvc->regHist(m_path + h_phi_e->GetName(), h_phi_e)); + CHECK(m_thistSvc->regHist(m_path + h_r_e->GetName(), h_r_e)); + } //Histograms for calibrated hits h_calib_eta = new TH1D("h_calib_eta", "calib. hits eta", 50,-5,5); @@ -177,53 +177,52 @@ StatusCode CaloHitAnalysis::initialize() { h_calib_eTotpartID = new TH1D("h_calib_eTotpartID", "calib. hits partID weighted with energy",600,0,300000); h_calib_eTotpartID->StatOverflows(); - if( m_calib == "on") - { - CHECK(m_thistSvc->regHist( m_path+h_calib_eta->GetName(), h_calib_eta)); - CHECK(m_thistSvc->regHist( m_path+h_calib_phi->GetName(), h_calib_phi)); - CHECK(m_thistSvc->regHist( m_path+h_calib_rz->GetName(), h_calib_rz)); - CHECK(m_thistSvc->regHist( m_path+h_calib_etaphi->GetName(), h_calib_etaphi)); - CHECK(m_thistSvc->regHist( m_path+h_calib_eEM->GetName(), h_calib_eEM)); - CHECK(m_thistSvc->regHist( m_path+h_calib_eNonEM->GetName(), h_calib_eNonEM)); - CHECK(m_thistSvc->regHist( m_path+h_calib_eInv->GetName(), h_calib_eInv)); - CHECK(m_thistSvc->regHist( m_path+h_calib_eEsc->GetName(), h_calib_eEsc)); - CHECK(m_thistSvc->regHist( m_path+h_calib_eTot->GetName(), h_calib_eTot)); - CHECK(m_thistSvc->regHist( m_path+h_calib_eTotpartID->GetName(), h_calib_eTotpartID)); - } - + if( m_calib == "on") { + CHECK(m_thistSvc->regHist(m_path + h_calib_eta->GetName(), h_calib_eta)); + CHECK(m_thistSvc->regHist(m_path + h_calib_phi->GetName(), h_calib_phi)); + CHECK(m_thistSvc->regHist(m_path + h_calib_rz->GetName(), h_calib_rz)); + CHECK(m_thistSvc->regHist(m_path + h_calib_etaphi->GetName(), h_calib_etaphi)); + CHECK(m_thistSvc->regHist(m_path + h_calib_eEM->GetName(), h_calib_eEM)); + CHECK(m_thistSvc->regHist(m_path + h_calib_eNonEM->GetName(), h_calib_eNonEM)); + CHECK(m_thistSvc->regHist(m_path + h_calib_eInv->GetName(), h_calib_eInv)); + CHECK(m_thistSvc->regHist(m_path + h_calib_eEsc->GetName(), h_calib_eEsc)); + CHECK(m_thistSvc->regHist(m_path + h_calib_eTot->GetName(), h_calib_eTot)); + CHECK(m_thistSvc->regHist(m_path + h_calib_eTotpartID->GetName(), h_calib_eTotpartID)); + } - m_tree = new TTree( "CaloHitNtuple", "CaloHitAna" ); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("Calo", "Calo"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK( m_thistSvc->regTree(fullNtupleName, m_tree) ); - if(m_tree) - { - m_tree->Branch("CellEta", &m_cell_eta); - m_tree->Branch("CellPhi", &m_cell_phi); - m_tree->Branch("CellX", &m_cell_x); - m_tree->Branch("CellY", &m_cell_y); - m_tree->Branch("CellZ", &m_cell_z); - m_tree->Branch("CellE", &m_cell_e); - m_tree->Branch("CellRadius", &m_cell_radius); - m_tree->Branch("Time", &m_time); - m_tree->Branch("CalibEta", &m_calib_eta); - m_tree->Branch("CalibPhi", &m_calib_phi); - m_tree->Branch("CalibRadius", &m_calib_radius); - m_tree->Branch("CalibZ", &m_calib_z); - m_tree->Branch("Calib_eEM", &m_calib_eEM); - m_tree->Branch("Calib_eNonEM", &m_calib_eNonEM); - m_tree->Branch("Calib_eInv", &m_calib_eInv); - m_tree->Branch("Calib_eEsc", &m_calib_eEsc); - m_tree->Branch("Calib_eTot", &m_calib_eTot); - m_tree->Branch("Calib_partID", &m_calib_partID); - - }else{ + if(m_tree) { + m_tree->Branch("CellEta", &m_cell_eta); + m_tree->Branch("CellPhi", &m_cell_phi); + m_tree->Branch("CellX", &m_cell_x); + m_tree->Branch("CellY", &m_cell_y); + m_tree->Branch("CellZ", &m_cell_z); + m_tree->Branch("CellE", &m_cell_e); + m_tree->Branch("CellRadius", &m_cell_radius); + m_tree->Branch("Time", &m_time); + m_tree->Branch("CalibEta", &m_calib_eta); + m_tree->Branch("CalibPhi", &m_calib_phi); + m_tree->Branch("CalibRadius", &m_calib_radius); + m_tree->Branch("CalibZ", &m_calib_z); + m_tree->Branch("Calib_eEM", &m_calib_eEM); + m_tree->Branch("Calib_eNonEM", &m_calib_eNonEM); + m_tree->Branch("Calib_eInv", &m_calib_eInv); + m_tree->Branch("Calib_eEsc", &m_calib_eEsc); + m_tree->Branch("Calib_eTot", &m_calib_eTot); + m_tree->Branch("Calib_partID", &m_calib_partID); + } + else { ATH_MSG_ERROR( "No tree found!" ); } return StatusCode::SUCCESS; } + StatusCode CaloHitAnalysis::execute() { ATH_MSG_DEBUG( "In CaloHitAnalysis::execute()" ); @@ -247,11 +246,11 @@ StatusCode CaloHitAnalysis::execute() { m_calib_partID->clear(); std::string lArKey [4] = {"LArHitEMB", "LArHitEMEC", "LArHitFCAL", "LArHitHEC"}; - for (unsigned int i=0;i<4;i++){ + for (unsigned int i=0; i<4; i++) { const DataHandle<LArHitContainer> iter; - if (evtStore()->retrieve(iter,lArKey[i])==StatusCode::SUCCESS) { + if (evtStore()->retrieve(iter,lArKey[i]) == StatusCode::SUCCESS) { LArHitContainer::const_iterator hi; - for (auto hi : *iter ){ + for (auto hi : *iter ) { GeoLArHit ghit(*hi); if (!ghit) continue; const CaloDetDescrElement *hitElement = ghit.getDetDescrElement(); @@ -260,8 +259,8 @@ StatusCode CaloHitAnalysis::execute() { double eta = hitElement->eta(); double phi = hitElement->phi(); double radius = hitElement->r(); - float x = hitElement->x(); - float y = hitElement->y(); + float x = hitElement->x(); + float y = hitElement->y(); double z = hitElement->z(); h_cell_e->Fill( energy ); @@ -271,12 +270,11 @@ StatusCode CaloHitAnalysis::execute() { h_xy->Fill(x,y); h_zr->Fill(z,radius); h_etaphi->Fill(eta, phi); - if( m_expert == "on"){ + if (m_expert == "on") { h_time_e->Fill(time, energy); h_eta_e->Fill(eta, energy); h_phi_e->Fill(phi, energy); - h_r_e->Fill(radius, energy); - + h_r_e->Fill(radius, energy); } m_cell_eta->push_back(eta); m_cell_phi->push_back(phi); @@ -286,34 +284,31 @@ StatusCode CaloHitAnalysis::execute() { m_cell_z->push_back(z); m_cell_radius->push_back(radius); m_time->push_back(time); - } // End while hits - } // End statuscode success upon retrieval of hits - } // End detector type loop + } // End statuscode success upon retrieval of hits + } // End detector type loop const DataHandle<TileHitVector> hitVec; //const TileHitVector* hitVec; - if (evtStore()->retrieve(hitVec,"TileHitVec")==StatusCode::SUCCESS && - m_tileMgr && - m_tileID ){ - for(auto i_hit : *hitVec ){ + if (evtStore()->retrieve(hitVec,"TileHitVec") == StatusCode::SUCCESS && m_tileMgr && m_tileID) { + for (auto i_hit : *hitVec) { Identifier pmt_id = (i_hit).identify(); Identifier cell_id = m_tileID->cell_id(pmt_id); const CaloDetDescrElement* ddElement = (m_tileID->is_tile_aux(cell_id)) ? 0 : m_tileMgr->get_cell_element(cell_id); - if(ddElement){ + if (ddElement) { double tot_e = 0.; double tot_time = 0.; - for (int t=0;t<(i_hit).size();++t) tot_e += (i_hit).energy(t); - for (int t=0;t<(i_hit).size();++t) tot_time += (i_hit).time(t); - h_cell_e->Fill( tot_e ); - h_cell_eta->Fill( ddElement->eta() ); - h_cell_phi->Fill( ddElement->phi() ); - h_cell_radius->Fill( ddElement->z() ); - h_xy->Fill(ddElement->x(),ddElement->y()); + for (int t=0; t<(i_hit).size(); ++t) tot_e += (i_hit).energy(t); + for (int t=0; t<(i_hit).size(); ++t) tot_time += (i_hit).time(t); + h_cell_e->Fill(tot_e); + h_cell_eta->Fill(ddElement->eta()); + h_cell_phi->Fill(ddElement->phi()) ; + h_cell_radius->Fill(ddElement->z()); + h_xy->Fill(ddElement->x(), ddElement->y()); h_zr->Fill(ddElement->r(), ddElement->r()); h_etaphi->Fill(ddElement->eta(), ddElement->phi()); - if( m_expert == "on"){ + if (m_expert == "on") { h_time_e->Fill(tot_time, tot_e); h_eta_e->Fill(ddElement->eta(), tot_e); h_phi_e->Fill(ddElement->phi(), tot_e); @@ -331,27 +326,26 @@ StatusCode CaloHitAnalysis::execute() { } } - //For calibrated hits std::string LArCalibKey [3] = {"LArCalibrationHitActive", "LArCalibrationHitInactive","LArCalibrationHitDeadMaterial"}; - for(unsigned int j=0; j<3;j++){ - if(m_calib != "on") continue; + for (unsigned int j=0; j<3; j++) { + if (m_calib != "on") continue; const DataHandle<CaloCalibrationHitContainer> iterator; CaloCalibrationHitContainer::const_iterator hit_i; - if(evtStore()->retrieve(iterator, LArCalibKey[j])==StatusCode::SUCCESS){ + if(evtStore()->retrieve(iterator, LArCalibKey[j]) == StatusCode::SUCCESS) { //Not tested - for(auto hit_i : *iterator){ + for (auto hit_i : *iterator) { GeoCaloCalibHit geoHit(*hit_i, LArCalibKey[j]); - if(!geoHit) continue; + if (!geoHit) continue; const CaloDetDescrElement* Element = geoHit.getDetDescrElement(); double eta = Element->eta(); double phi = Element->phi(); double radius = Element->r(); - double z =Element->z(); - double emEnergy = geoHit.energyEM(); + double z = Element->z(); + double emEnergy = geoHit.energyEM(); double nonEmEnergy = geoHit.energyNonEM(); double invEnergy = geoHit.energyInvisible(); - double escEnergy = geoHit.energyEscaped(); + double escEnergy = geoHit.energyEscaped(); double totEnergy = geoHit.energyTotal(); double particleID = (*hit_i).particleID(); @@ -376,11 +370,11 @@ StatusCode CaloHitAnalysis::execute() { m_calib_eEsc->push_back(escEnergy); m_calib_eTot->push_back(totEnergy); m_calib_partID->push_back(particleID); - } } } + if(m_tree) m_tree->Fill(); + return StatusCode::SUCCESS; } - diff --git a/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.h index a0e04559e5a..9b6a78c4452 100755 --- a/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/CaloHitAnalysis.h @@ -22,6 +22,7 @@ class TH1; class TH2; class TTree; + class CaloHitAnalysis : public AthAlgorithm { public: @@ -57,6 +58,9 @@ class CaloHitAnalysis : public AthAlgorithm { TH1* h_calib_eTot; TH1* h_calib_eTotpartID; + const TileID * m_tileID; + const TileDetDescrManager * m_tileMgr; + std::vector<float>* m_cell_eta; std::vector<float>* m_cell_phi; std::vector<float>* m_cell_x; @@ -75,19 +79,15 @@ class CaloHitAnalysis : public AthAlgorithm { std::vector<float>* m_calib_eEsc; std::vector<float>* m_calib_eTot; std::vector<float>* m_calib_partID; - std::string m_expert; std::string m_calib; - ServiceHandle<ITHistSvc> m_thistSvc; - std::string m_path; - + TTree* m_tree; std::string m_ntupleFileName; - const TileID * m_tileID; - const TileDetDescrManager * m_tileMgr; + std::string m_path; + ServiceHandle<ITHistSvc> m_thistSvc; }; #endif // CALO_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.cxx index 57b312d3454..92deeefe57b 100755 --- a/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.cxx @@ -4,15 +4,12 @@ #include "LucidHitAnalysis.h" - #include "LUCID_SimEvent/LUCID_SimHitCollection.h" - #include "TH1.h" #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -47,22 +44,22 @@ LucidHitAnalysis::LucidHitAnalysis(const std::string& name, ISvcLocator* pSvcLoc , m_hit_posttime(0) , m_gen_volume(0) , m_wavelength(0) + , m_tree(0) - , m_ntupleFileName("/LucidHitAnalysis/ntuple/") - , m_path("/LucidHitAnalysis/histos/") + , m_ntupleFileName("/LucidHitAnalysis/") + , m_path("/LucidHitAnalysis/") , m_thistSvc("THistSvc", name) { declareProperty("NtupleFileName", m_ntupleFileName); declareProperty("HistPath", m_path); - } + StatusCode LucidHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing LucidHitAnalysis" ); // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - /** Histograms**/ h_hit_x = new TH1D("h_hit_x", "hit_x", 100,-150.,150.); @@ -121,9 +118,9 @@ StatusCode LucidHitAnalysis::initialize() { h_wavelength->StatOverflows(); CHECK(m_thistSvc->regHist( m_path+h_wavelength->GetName(), h_wavelength)); - - m_tree= new TTree("NtupleLucidHitAnalysis","LucidHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("Lucid","Lucid"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); if (m_tree){ @@ -139,74 +136,71 @@ StatusCode LucidHitAnalysis::initialize() { m_tree->Branch("posttime", &m_hit_posttime); m_tree->Branch("gen_volume", &m_gen_volume); m_tree->Branch("wavelength", &m_wavelength); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } + return StatusCode::SUCCESS; } - StatusCode LucidHitAnalysis::execute() { ATH_MSG_DEBUG( "In LucidHitAnalysis::execute()" ); - m_hit_x->clear(); - m_hit_y->clear(); - m_hit_z->clear(); - m_hit_post_x->clear(); - m_hit_post_y->clear(); - m_hit_post_z->clear(); - m_hit_edep->clear(); - m_hit_pdgid->clear(); - m_hit_pretime->clear(); - m_hit_posttime->clear(); - m_gen_volume->clear(); - m_wavelength->clear(); - - - const DataHandle<LUCID_SimHitCollection> iter; - if (evtStore()->retrieve(iter)==StatusCode::SUCCESS) { - for(LUCID_SimHitCollection::const_iterator i_hit = (*iter).begin(); - i_hit != (*iter).end();++i_hit){ - double x = i_hit->GetX(); - double y = i_hit->GetY(); - double z = i_hit->GetZ(); - double r = sqrt(x*x+y*y); - h_hit_x->Fill(i_hit->GetX()); - h_hit_y->Fill(i_hit->GetY()); - h_hit_z->Fill(i_hit->GetZ()); - h_xy->Fill(x, y); - h_zr->Fill(z, r); - h_hit_post_x->Fill(i_hit->GetEPX()); - h_hit_post_y->Fill(i_hit->GetEPY()); - h_hit_post_z->Fill(i_hit->GetEPZ()); - h_hit_edep->Fill(i_hit->GetEnergy()); - h_hit_pdgid->Fill(i_hit->GetPdgCode()); - h_hit_pretime->Fill(i_hit->GetPreStepTime()); - h_hit_posttime->Fill(i_hit->GetPostStepTime()); - h_genvolume->Fill(i_hit->GetGenVolume()); - h_wavelength->Fill(i_hit->GetWavelength()); - - - m_hit_x->push_back(i_hit->GetX()); - m_hit_y->push_back(i_hit->GetY()); - m_hit_z->push_back(i_hit->GetZ()); - m_hit_post_x->push_back(i_hit->GetEPX()); - m_hit_post_y->push_back(i_hit->GetEPY()); - m_hit_post_z->push_back(i_hit->GetEPZ()); - m_hit_edep->push_back(i_hit->GetEnergy()); - m_hit_pdgid->push_back(i_hit->GetPdgCode()); - m_hit_pretime->push_back(i_hit->GetPreStepTime()); - m_hit_posttime->push_back(i_hit->GetPostStepTime()); - m_gen_volume->push_back(i_hit->GetGenVolume()); - m_wavelength->push_back(i_hit->GetWavelength()); - } - } // End while hits + m_hit_x->clear(); + m_hit_y->clear(); + m_hit_z->clear(); + m_hit_post_x->clear(); + m_hit_post_y->clear(); + m_hit_post_z->clear(); + m_hit_edep->clear(); + m_hit_pdgid->clear(); + m_hit_pretime->clear(); + m_hit_posttime->clear(); + m_gen_volume->clear(); + m_wavelength->clear(); + + const DataHandle<LUCID_SimHitCollection> iter; + if (evtStore()->retrieve(iter) == StatusCode::SUCCESS) { + for (LUCID_SimHitCollection::const_iterator i_hit = (*iter).begin(); i_hit != (*iter).end(); ++i_hit) { + double x = i_hit->GetX(); + double y = i_hit->GetY(); + double z = i_hit->GetZ(); + double r = sqrt(x*x+y*y); + + h_hit_x->Fill(i_hit->GetX()); + h_hit_y->Fill(i_hit->GetY()); + h_hit_z->Fill(i_hit->GetZ()); + h_xy->Fill(x, y); + h_zr->Fill(z, r); + h_hit_post_x->Fill(i_hit->GetEPX()); + h_hit_post_y->Fill(i_hit->GetEPY()); + h_hit_post_z->Fill(i_hit->GetEPZ()); + h_hit_edep->Fill(i_hit->GetEnergy()); + h_hit_pdgid->Fill(i_hit->GetPdgCode()); + h_hit_pretime->Fill(i_hit->GetPreStepTime()); + h_hit_posttime->Fill(i_hit->GetPostStepTime()); + h_genvolume->Fill(i_hit->GetGenVolume()); + h_wavelength->Fill(i_hit->GetWavelength()); + + m_hit_x->push_back(i_hit->GetX()); + m_hit_y->push_back(i_hit->GetY()); + m_hit_z->push_back(i_hit->GetZ()); + m_hit_post_x->push_back(i_hit->GetEPX()); + m_hit_post_y->push_back(i_hit->GetEPY()); + m_hit_post_z->push_back(i_hit->GetEPZ()); + m_hit_edep->push_back(i_hit->GetEnergy()); + m_hit_pdgid->push_back(i_hit->GetPdgCode()); + m_hit_pretime->push_back(i_hit->GetPreStepTime()); + m_hit_posttime->push_back(i_hit->GetPostStepTime()); + m_gen_volume->push_back(i_hit->GetGenVolume()); + m_wavelength->push_back(i_hit->GetWavelength()); + } + } // End while hits - if (m_tree) m_tree->Fill(); - - - + if (m_tree) m_tree->Fill(); return StatusCode::SUCCESS; + } diff --git a/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.h index 056751fbcbc..3fb396e819d 100755 --- a/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/LucidHitAnalysis.h @@ -16,11 +16,11 @@ #include "TH2.h" #include "TTree.h" - class TH1; class TH2; class TTree; - + + class LucidHitAnalysis : public AthAlgorithm { public: @@ -33,7 +33,6 @@ class LucidHitAnalysis : public AthAlgorithm { private: - std::string m_collection; /** Some histograms**/ TH1* h_hit_x; TH1* h_hit_y; @@ -49,7 +48,6 @@ class LucidHitAnalysis : public AthAlgorithm { TH1* h_hit_posttime; TH1* h_genvolume; TH1* h_wavelength; - std::vector<float>* m_hit_x; std::vector<float>* m_hit_y; @@ -64,8 +62,6 @@ class LucidHitAnalysis : public AthAlgorithm { std::vector<float>* m_gen_volume; std::vector<float>* m_wavelength; - - TTree * m_tree; std::string m_ntupleFileName; std::string m_path; @@ -74,4 +70,3 @@ class LucidHitAnalysis : public AthAlgorithm { }; #endif // LUCID_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.cxx index 1f7ddd9d3fe..1759e6d4ab7 100755 --- a/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.cxx @@ -15,7 +15,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -54,25 +53,24 @@ MDTHitAnalysis::MDTHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator , m_hits_edep(0) , m_hits_kine(0) , m_hits_step(0) + , m_tree(0) - , m_ntupleFileName("MDTHitAnalysis/ntuple/") - , m_path("/MDTHitAnalysis/histos/") + , m_ntupleFileName("/MDTHitAnalysis/") + , m_path("/MDTHitAnalysis/") , m_thistSvc("THistSvc", name) { declareProperty("NtupleFileName", m_ntupleFileName); declareProperty("HistPath", m_path); - } + StatusCode MDTHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing MDTHitAnalysis" ); // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - /** Histograms */ - h_hits_x = new TH1D("h_hits_mdt_x","hits_x", 100,-25000, 25000); h_hits_x->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_x->GetName(), h_hits_x)); @@ -137,13 +135,11 @@ StatusCode MDTHitAnalysis::initialize() { h_hits_step->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_step->GetName(), h_hits_step)); - m_tree= new TTree("NtupleMDTHitAnalysis","MDTHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("MDT","MDT"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - - - /** now add branches and leaves to the tree */ if (m_tree){ m_tree->Branch("x", &m_hits_x); m_tree->Branch("y", &m_hits_y); @@ -159,14 +155,14 @@ StatusCode MDTHitAnalysis::initialize() { m_tree->Branch("edep", &m_hits_edep); m_tree->Branch("kine", &m_hits_kine); m_tree->Branch("step", &m_hits_step); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } return StatusCode::SUCCESS; -} +} - StatusCode MDTHitAnalysis::execute() { ATH_MSG_DEBUG( "In MDTHitAnalysis::execute()" ); @@ -187,13 +183,13 @@ StatusCode MDTHitAnalysis::execute() { m_hits_step->clear(); const DataHandle<MDTSimHitCollection> mdt_container; - if (evtStore()->retrieve(mdt_container, "MDT_Hits" )==StatusCode::SUCCESS) { - for(MDTSimHitCollection::const_iterator i_hit = mdt_container->begin(); - i_hit != mdt_container->end();++i_hit){ + if (evtStore()->retrieve(mdt_container, "MDT_Hits") == StatusCode::SUCCESS) { + for (MDTSimHitCollection::const_iterator i_hit = mdt_container->begin(); i_hit != mdt_container->end(); ++i_hit) { //MDTSimHitCollection::const_iterator i_hit; //for(auto i_hit : *mdt_container){ GeoMDTHit ghit(*i_hit); - if(!ghit) continue; + if (!ghit) continue; + Amg::Vector3D p = ghit.getGlobalPosition(); h_hits_x->Fill(p.x()); h_hits_y->Fill(p.y()); @@ -212,7 +208,6 @@ StatusCode MDTHitAnalysis::execute() { h_hits_step->Fill((*i_hit).stepLength()); h_hits_kine->Fill((*i_hit).kineticEnergy()); - m_hits_x->push_back(p.x()); m_hits_y->push_back(p.y()); m_hits_z->push_back(p.z()); @@ -220,9 +215,9 @@ StatusCode MDTHitAnalysis::execute() { m_hits_eta->push_back(p.eta()); m_hits_phi->push_back(p.phi()); m_hits_driftR->push_back((*i_hit).driftRadius()); - m_hits_lx->push_back( (*i_hit).localPosition().x()); - m_hits_ly->push_back( (*i_hit).localPosition().y()); - m_hits_lz->push_back( (*i_hit).localPosition().z()); + m_hits_lx->push_back((*i_hit).localPosition().x()); + m_hits_ly->push_back((*i_hit).localPosition().y()); + m_hits_lz->push_back((*i_hit).localPosition().z()); m_hits_edep->push_back((*i_hit).energyDeposit()); m_hits_time->push_back((*i_hit).globalTime()); m_hits_step->push_back((*i_hit).stepLength()); diff --git a/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.h index 85b154dad37..a73f01bc84e 100755 --- a/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/MDTHitAnalysis.h @@ -16,13 +16,11 @@ #include "TH2.h" #include "TTree.h" - - class TH1; class TH2; class TTree; - + class MDTHitAnalysis : public AthAlgorithm { public: @@ -52,6 +50,7 @@ class MDTHitAnalysis : public AthAlgorithm { TH1* h_hits_edep; TH1* h_hits_kine; TH1* h_hits_step; + std::vector<float>* m_hits_x; std::vector<float>* m_hits_y; std::vector<float>* m_hits_z; @@ -69,11 +68,9 @@ class MDTHitAnalysis : public AthAlgorithm { TTree * m_tree; std::string m_ntupleFileName; - std::string m_path; - ServiceHandle<ITHistSvc> m_thistSvc; + ServiceHandle<ITHistSvc> m_thistSvc; }; #endif // MDT_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.cxx index b83c04c183d..cc91f7834f4 100755 --- a/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.cxx @@ -15,7 +15,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -52,22 +51,23 @@ RPCHitAnalysis::RPCHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator , m_hits_edep(0) , m_hits_kine(0) , m_hits_step(0) + , m_tree(0) - , m_ntupleFileName("/RPCHitAnalysis/ntuple/") - , m_path("/RPCHitAnalysis/histos/") + , m_ntupleFileName("/RPCHitAnalysis/") + , m_path("/RPCHitAnalysis/") , m_thistSvc("THistSvc", name) { declareProperty("NtupleFileName", m_ntupleFileName); declareProperty("HistPath", m_path); - } + StatusCode RPCHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing RPCHitAnalysis" ); // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - + /** Histograms**/ h_hits_x = new TH1D("h_hits_rpc_x","hits_x", 100,-11000, 11000); h_hits_x->StatOverflows(); @@ -113,7 +113,6 @@ StatusCode RPCHitAnalysis::initialize() { h_hits_lz->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_lz->GetName(), h_hits_lz)); - h_hits_time = new TH1D("h_hits_rpc_time","hits_time", 100,0, 120); h_hits_time->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_time->GetName(), h_hits_time)); @@ -130,14 +129,11 @@ StatusCode RPCHitAnalysis::initialize() { h_hits_step->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_step->GetName(), h_hits_step)); - - m_tree= new TTree("NtupleRPCHitAnalysis","RPCHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("RPC","RPC"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - - - /** now add branches and leaves to the tree */ if (m_tree){ m_tree->Branch("x", &m_hits_x); m_tree->Branch("y", &m_hits_y); @@ -152,13 +148,13 @@ StatusCode RPCHitAnalysis::initialize() { m_tree->Branch("edep", &m_hits_edep); m_tree->Branch("kine", &m_hits_kine); m_tree->Branch("step", &m_hits_step); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } return StatusCode::SUCCESS; -} - +} StatusCode RPCHitAnalysis::execute() { @@ -179,13 +175,13 @@ StatusCode RPCHitAnalysis::execute() { m_hits_step->clear(); const DataHandle<RPCSimHitCollection> rpc_container; - if (evtStore()->retrieve(rpc_container, "RPC_Hits" )==StatusCode::SUCCESS) { - for(RPCSimHitCollection::const_iterator i_hit = rpc_container->begin(); - i_hit != rpc_container->end();++i_hit){ + if (evtStore()->retrieve(rpc_container, "RPC_Hits") == StatusCode::SUCCESS) { + for (RPCSimHitCollection::const_iterator i_hit = rpc_container->begin(); i_hit != rpc_container->end(); ++i_hit) { //RPCSimHitCollection::const_iterator i_hit; //for(auto i_hit : *rpc_container){ GeoRPCHit ghit(*i_hit); - if(!ghit) continue; + if (!ghit) continue; + Amg::Vector3D p = ghit.getGlobalPosition(); h_hits_x->Fill(p.x()); h_hits_y->Fill(p.y()); @@ -195,9 +191,9 @@ StatusCode RPCHitAnalysis::execute() { h_zr->Fill(p.z(),p.perp()); h_hits_eta->Fill(p.eta()); h_hits_phi->Fill(p.phi()); - h_hits_lx->Fill( (*i_hit).localPosition().x()); - h_hits_ly->Fill( (*i_hit).localPosition().y()); - h_hits_lz->Fill( (*i_hit).localPosition().z()); + h_hits_lx->Fill((*i_hit).localPosition().x()); + h_hits_ly->Fill((*i_hit).localPosition().y()); + h_hits_lz->Fill((*i_hit).localPosition().z()); h_hits_edep->Fill((*i_hit).energyDeposit()); h_hits_time->Fill((*i_hit).globalTime()); h_hits_step->Fill((*i_hit).stepLength()); @@ -209,9 +205,9 @@ StatusCode RPCHitAnalysis::execute() { m_hits_r->push_back(p.perp()); m_hits_eta->push_back(p.eta()); m_hits_phi->push_back(p.phi()); - m_hits_lx->push_back( (*i_hit).localPosition().x()); - m_hits_ly->push_back( (*i_hit).localPosition().y()); - m_hits_lz->push_back( (*i_hit).localPosition().z()); + m_hits_lx->push_back((*i_hit).localPosition().x()); + m_hits_ly->push_back((*i_hit).localPosition().y()); + m_hits_lz->push_back((*i_hit).localPosition().z()); m_hits_edep->push_back((*i_hit).energyDeposit()); m_hits_time->push_back((*i_hit).globalTime()); m_hits_step->push_back((*i_hit).stepLength()); @@ -219,7 +215,7 @@ StatusCode RPCHitAnalysis::execute() { } } // End while hits + if (m_tree) m_tree->Fill(); - if (m_tree) m_tree->Fill(); return StatusCode::SUCCESS; } diff --git a/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.h index fadb854c212..2384dcd2482 100755 --- a/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/RPCHitAnalysis.h @@ -16,12 +16,11 @@ #include "TH2.h" #include "TTree.h" - - class TH1; class TH2; class TTree; - + + class RPCHitAnalysis : public AthAlgorithm { public: @@ -51,7 +50,6 @@ class RPCHitAnalysis : public AthAlgorithm { TH1* h_hits_kine; TH1* h_hits_step; - std::vector<float>* m_hits_x; std::vector<float>* m_hits_y; std::vector<float>* m_hits_z; @@ -74,4 +72,3 @@ class RPCHitAnalysis : public AthAlgorithm { }; #endif // RPC_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.cxx index 8c757c7893a..28b14711c41 100644 --- a/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.cxx @@ -13,7 +13,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -22,7 +21,6 @@ //m_collection: "PixelHits", "SCT_Hits", "BCMHits" and "BLMHits" SiHitAnalysis::SiHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) - , m_collection("BCMHits") , h_hits_x(0) , h_hits_y(0) , h_hits_z(0) @@ -44,32 +42,44 @@ SiHitAnalysis::SiHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator) , m_hits_eloss(0) , m_hits_step(0) , m_hits_barcode(0) - , m_tree(0) - , m_ntupleFileName("/ntuples/") + + , m_collection("BCMHits") , m_expert("off") + + , m_tree(0) + , m_ntupleFileName("/SiHitAnalysis/") , m_path("/SiHitAnalysis/") , m_thistSvc("THistSvc", name) { declareProperty("CollectionName", m_collection="BCMHits"); - declareProperty("HistPath", m_path); declareProperty("ExpertMode", m_expert = "off"); declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("HistPath", m_path); } StatusCode SiHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing SiHitAnalysis" ); std::string detName("Pixel"); - //initialise pixel or SCT variables - if(m_collection=="PixelHits"){ + std::string ntupName("SiPixel"); + + if (m_collection=="PixelHits") { detName = "Pixel"; - }else if (m_collection=="SCT_Hits"){ + ntupName = "SiPixel"; + } + else if (m_collection=="SCT_Hits") { detName = "SCT"; - }else if(m_collection=="BCMHits"){ + ntupName = "SiSCT"; + } + else if (m_collection=="BCMHits") { detName = "BCM"; - }else if(m_collection=="BLMHits"){ + ntupName = "SiBCM"; + } + else if (m_collection=="BLMHits") { detName = "BLM"; - }else{ + ntupName = "SiBLM"; + } + else { ATH_MSG_ERROR("SiHitsAnalysis for "<< name()<<"not supported!!! \n"); return StatusCode::FAILURE; } @@ -82,7 +92,7 @@ StatusCode SiHitAnalysis::initialize() { float bin_up = 600; float radius_up = 600; float radius_down = 200; - if(detName=="Pixel"){ + if (detName=="Pixel") { bin_down = -170; bin_up = 170; radius_up = 170; @@ -128,7 +138,6 @@ StatusCode SiHitAnalysis::initialize() { h_r_eloss = new TH2D(("h_"+detName+"_r_eloss").c_str(), ("h_"+detName+ " Eloss vs. r").c_str(),100, radius_down,radius_down,100,0,50); h_r_eloss->StatOverflows(); - CHECK(m_thistSvc->regHist(m_path + h_hits_x->GetName(), h_hits_x)); CHECK(m_thistSvc->regHist(m_path + h_hits_y->GetName(), h_hits_y)); CHECK(m_thistSvc->regHist(m_path + h_hits_z->GetName(), h_hits_z)); @@ -140,23 +149,20 @@ StatusCode SiHitAnalysis::initialize() { CHECK(m_thistSvc->regHist(m_path + h_hits_step->GetName(), h_hits_step)); CHECK(m_thistSvc->regHist(m_path + h_hits_barcode->GetName(), h_hits_barcode)); - //To be filled only when the expert mode is on. - if(m_expert == "on") - { - CHECK(m_thistSvc->regHist(m_path + h_time_eloss->GetName(), h_time_eloss)); - CHECK(m_thistSvc->regHist(m_path + h_z_eloss->GetName(), h_z_eloss)); - CHECK(m_thistSvc->regHist(m_path + h_r_eloss->GetName(), h_r_eloss)); - } - - /**ntuple**/ - CHECK(m_thistSvc.retrieve()); - m_tree= new TTree(detName.c_str(), detName.c_str()); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"+detName; - CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); + if (m_expert == "on") { + CHECK(m_thistSvc->regHist(m_path + h_time_eloss->GetName(), h_time_eloss)); + CHECK(m_thistSvc->regHist(m_path + h_z_eloss->GetName(), h_z_eloss)); + CHECK(m_thistSvc->regHist(m_path + h_r_eloss->GetName(), h_r_eloss)); + } + CHECK(m_thistSvc.retrieve()); /** now add branches and leaves to the tree */ + m_tree = new TTree(ntupName.c_str(), ntupName.c_str()); + std::string fullNtupleName = "/" + m_ntupleFileName + "/" + detName; + CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); + if (m_tree){ m_tree->Branch((detName+"_x").c_str(), &m_hits_x); m_tree->Branch((detName+"_y").c_str(), &m_hits_y); @@ -166,17 +172,18 @@ StatusCode SiHitAnalysis::initialize() { m_tree->Branch((detName+"_eloss").c_str(), &m_hits_eloss); m_tree->Branch((detName+"_step").c_str(), &m_hits_step); m_tree->Branch((detName+"_barcode").c_str(), &m_hits_barcode); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } return StatusCode::SUCCESS; } - StatusCode SiHitAnalysis::execute() { ATH_MSG_DEBUG( "In SiHitAnalysis::execute()" ); + m_hits_x->clear(); m_hits_y->clear(); m_hits_z->clear(); @@ -187,9 +194,8 @@ StatusCode SiHitAnalysis::execute() { m_hits_barcode->clear(); const DataHandle<SiHitCollection> p_collection; - if (evtStore()->retrieve(p_collection, m_collection )==StatusCode::SUCCESS) { - for(SiHitConstIterator i_hit = p_collection->begin(); - i_hit != p_collection->end();++i_hit){ + if (evtStore()->retrieve(p_collection, m_collection) == StatusCode::SUCCESS) { + for (SiHitConstIterator i_hit = p_collection->begin(); i_hit != p_collection->end() ;++i_hit) { GeoSiHit ghit(*i_hit); HepGeom::Point3D<double> p = ghit.getGlobalPosition(); h_hits_x->Fill(p.x()); @@ -200,19 +206,19 @@ StatusCode SiHitAnalysis::execute() { h_zr->Fill(p.z(),p.perp()); h_hits_eloss->Fill(i_hit->energyLoss()); h_hits_time->Fill(i_hit->meanTime()); - double step_length=(i_hit->localStartPosition()-i_hit->localEndPosition()).mag(); + double step_length=(i_hit->localStartPosition() - i_hit->localEndPosition()).mag(); h_hits_step->Fill(step_length); h_hits_barcode->Fill(i_hit->particleLink().barcode()); - if(m_expert == "on") - { - h_time_eloss->Fill(i_hit->meanTime(), i_hit->energyLoss()); - if(i_hit->getBarrelEndcap()==0) { - h_z_eloss->Fill(p.z(), i_hit->energyLoss()); - }else{ - h_r_eloss->Fill(p.perp(), i_hit->energyLoss()); - } + if (m_expert == "on") { + h_time_eloss->Fill(i_hit->meanTime(), i_hit->energyLoss()); + if (i_hit->getBarrelEndcap()==0) { + h_z_eloss->Fill(p.z(), i_hit->energyLoss()); + } + else { + h_r_eloss->Fill(p.perp(), i_hit->energyLoss()); } + } m_hits_x->push_back(p.x()); m_hits_y->push_back(p.y()); @@ -223,10 +229,9 @@ StatusCode SiHitAnalysis::execute() { m_hits_step->push_back(step_length); m_hits_barcode->push_back(i_hit->particleLink().barcode()); } // End while hits - } // End statuscode success upon retrieval of hits + } // End statuscode success upon retrieval of hits + if (m_tree) m_tree->Fill(); - return StatusCode::SUCCESS; } - diff --git a/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.h index 29fdc72de8e..fe304cbf7e7 100755 --- a/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/SiHitAnalysis.h @@ -10,7 +10,6 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ITHistSvc.h" - #include <string> #include <vector> #include "TH1.h" @@ -19,7 +18,8 @@ class TH1; class TH2; class TTree; - + + class SiHitAnalysis : public AthAlgorithm { public: @@ -32,7 +32,6 @@ class SiHitAnalysis : public AthAlgorithm { private: - std::string m_collection; /** Some variables**/ TH1* h_hits_x; TH1* h_hits_y; @@ -56,15 +55,15 @@ class SiHitAnalysis : public AthAlgorithm { std::vector<float>* m_hits_eloss; std::vector<float>* m_hits_step; std::vector<float>* m_hits_barcode; + + std::string m_collection; + std::string m_expert; TTree* m_tree; std::string m_ntupleFileName; - - std::string m_expert; - std::string m_path; + std::string m_path; ServiceHandle<ITHistSvc> m_thistSvc; }; #endif // SI_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.cxx index 437baef10b8..d6e6282615c 100755 --- a/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.cxx @@ -15,7 +15,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -58,9 +57,10 @@ TGCHitAnalysis::TGCHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator , m_hits_edep(0) , m_hits_kine(0) , m_hits_step(0) + , m_tree(0) - , m_ntupleFileName("/TGCHitAnalysis/ntuple/") - , m_path("/TGCHitAnalysis/histos/") + , m_ntupleFileName("/TGCHitAnalysis/") + , m_path("/TGCHitAnalysis/") , m_thistSvc("THistSvc", name) { declareProperty("NtupleFileName", m_ntupleFileName); @@ -72,7 +72,7 @@ StatusCode TGCHitAnalysis::initialize() { // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - + /** Histograms**/ h_hits_x = new TH1D("h_hits_tgc_x","hits_x", 100,-5000, 5000); h_hits_x->StatOverflows(); @@ -98,7 +98,6 @@ StatusCode TGCHitAnalysis::initialize() { h_rz->StatOverflows(); CHECK(m_thistSvc->regHist( m_path+h_rz->GetName(), h_rz)); - h_hits_eta = new TH1D("h_hits_tgc_eta", "hits_eta", 100,-10.0,10.0); h_hits_eta->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_eta->GetName(), h_hits_eta)); @@ -147,14 +146,12 @@ StatusCode TGCHitAnalysis::initialize() { h_hits_step->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_hits_step->GetName(), h_hits_step)); - m_tree= new TTree("NtupleTGCHitAnalysis","TGCHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("TGC", "TGC"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - - - /** now add branches and leaves to the tree */ - if (m_tree){ + if (m_tree) { m_tree->Branch("x", &m_hits_x); m_tree->Branch("y", &m_hits_y); m_tree->Branch("z", &m_hits_z); @@ -171,15 +168,14 @@ StatusCode TGCHitAnalysis::initialize() { m_tree->Branch("edep", &m_hits_edep); m_tree->Branch("kine", &m_hits_kine); m_tree->Branch("step", &m_hits_step); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } - return StatusCode::SUCCESS; } - StatusCode TGCHitAnalysis::execute() { ATH_MSG_DEBUG( "In TGCHitAnalysis::execute()" ); @@ -202,13 +198,13 @@ StatusCode TGCHitAnalysis::execute() { m_hits_step->clear(); const DataHandle<TGCSimHitCollection> tgc_container; - if (evtStore()->retrieve(tgc_container, "TGC_Hits" )==StatusCode::SUCCESS) { - for(TGCSimHitCollection::const_iterator i_hit = tgc_container->begin(); - i_hit != tgc_container->end();++i_hit){ + if (evtStore()->retrieve(tgc_container, "TGC_Hits" ) == StatusCode::SUCCESS) { + for (TGCSimHitCollection::const_iterator i_hit = tgc_container->begin(); i_hit != tgc_container->end(); ++i_hit) { //TGCSimHitCollection::const_iterator i_hit; - //for(auto i_hit : *tgc_container){ + //for(auto i_hit : *tgc_container){ GeoTGCHit ghit(*i_hit); - if(!ghit) continue; + if (!ghit) continue; + Amg::Vector3D p = ghit.getGlobalPosition(); h_hits_x->Fill(p.x()); h_hits_y->Fill(p.y()); @@ -218,9 +214,9 @@ StatusCode TGCHitAnalysis::execute() { h_rz->Fill(p.perp(), p.z()); h_hits_eta->Fill(p.eta()); h_hits_phi->Fill(p.phi()); - h_hits_lx->Fill( (*i_hit).localPosition().x()); - h_hits_ly->Fill( (*i_hit).localPosition().y()); - h_hits_lz->Fill( (*i_hit).localPosition().z()); + h_hits_lx->Fill((*i_hit).localPosition().x()); + h_hits_ly->Fill((*i_hit).localPosition().y()); + h_hits_lz->Fill((*i_hit).localPosition().z()); h_hits_dcx->Fill((*i_hit).localDireCos().x()); h_hits_dcy->Fill((*i_hit).localDireCos().y()); h_hits_dcz->Fill((*i_hit).localDireCos().z()); @@ -235,9 +231,9 @@ StatusCode TGCHitAnalysis::execute() { m_hits_r->push_back(p.perp()); m_hits_eta->push_back(p.eta()); m_hits_phi->push_back(p.phi()); - m_hits_lx->push_back( (*i_hit).localPosition().x()); - m_hits_ly->push_back( (*i_hit).localPosition().y()); - m_hits_lz->push_back( (*i_hit).localPosition().z()); + m_hits_lx->push_back((*i_hit).localPosition().x()); + m_hits_ly->push_back((*i_hit).localPosition().y()); + m_hits_lz->push_back((*i_hit).localPosition().z()); m_hits_dcx->push_back((*i_hit).localDireCos().x()); m_hits_dcy->push_back((*i_hit).localDireCos().y()); m_hits_dcz->push_back((*i_hit).localDireCos().z()); @@ -250,6 +246,5 @@ StatusCode TGCHitAnalysis::execute() { if (m_tree) m_tree->Fill(); - - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } diff --git a/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.h index 74a73d45031..e27066d14b0 100755 --- a/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/TGCHitAnalysis.h @@ -16,11 +16,11 @@ #include "TH2.h" #include "TTree.h" - class TH1; class TH2; class TTree; - + + class TGCHitAnalysis : public AthAlgorithm { public: @@ -34,8 +34,6 @@ class TGCHitAnalysis : public AthAlgorithm { private: /** Some variables**/ - - TH1* h_hits_x; TH1* h_hits_y; TH1* h_hits_z; @@ -72,8 +70,6 @@ class TGCHitAnalysis : public AthAlgorithm { std::vector<float>* m_hits_kine; std::vector<float>* m_hits_step; - - TTree * m_tree; std::string m_ntupleFileName; std::string m_path; @@ -82,4 +78,3 @@ class TGCHitAnalysis : public AthAlgorithm { }; #endif // TGC_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.cxx index e5fdacefa93..c0cfe7c2918 100755 --- a/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.cxx @@ -12,7 +12,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -44,24 +43,24 @@ TRTHitAnalysis::TRTHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator , m_TRT_kine_photons(0) , m_TRT_kine_nonphotons(0) , m_TRT_barcode(0) + , m_tree(0) - , m_path("/histos/TRTHitAnalysis/") - , m_ntupleFileName("/ntuples/TRTHitAnalysis/") + , m_ntupleFileName("/TRTHitAnalysis/") + , m_path("/TRTHitAnalysis/") , m_thistSvc("THistSvc", name) - { - declareProperty("HistPath", m_path); declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("HistPath", m_path); } + StatusCode TRTHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing TRTHitAnalysis" ); // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - + /** Histograms **/ - h_TRT_x = new TH1D("h_TRT_x","hits_x", 100,-1100, 1100); h_TRT_x->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_TRT_x->GetName(), h_TRT_x)); @@ -114,14 +113,12 @@ StatusCode TRTHitAnalysis::initialize() { h_TRT_barcode->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_TRT_barcode->GetName(), h_TRT_barcode)); - - /*ntuples*/ - - m_tree= new TTree("TRTHitNtuple","TRTHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("TRT","TRT"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - if (m_tree){ + if (m_tree) { m_tree->Branch("x", &m_TRT_x); m_tree->Branch("y", &m_TRT_y); m_tree->Branch("z", &m_TRT_z); @@ -133,15 +130,14 @@ StatusCode TRTHitAnalysis::initialize() { m_tree->Branch("KineticEnergy_photons", &m_TRT_kine_photons); m_tree->Branch("KineticEnergy_nonphotons", &m_TRT_kine_nonphotons); m_tree->Branch("barcode", &m_TRT_barcode); - }else{ + } + else { ATH_MSG_ERROR("No tree found!"); } - return StatusCode::SUCCESS; } - StatusCode TRTHitAnalysis::execute() { ATH_MSG_DEBUG( "In TRTHitAnalysis::execute()" ); @@ -159,48 +155,46 @@ StatusCode TRTHitAnalysis::execute() { m_TRT_barcode->clear(); const DataHandle<TRTUncompressedHitCollection> p_collection; - if (evtStore()->retrieve(p_collection, "TRTUncompressedHits" )==StatusCode::SUCCESS) { - for(TRTUncompressedHitConstIter i_hit = p_collection->begin(); - i_hit != p_collection->end();++i_hit){ - GeoTRTUncompressedHit ghit(*i_hit); - HepGeom::Point3D<double> p = ghit.getGlobalPosition(); - - h_TRT_x->Fill(p.x()); - h_TRT_y->Fill(p.y()); - h_TRT_z->Fill(p.z()); - h_TRT_r->Fill(p.perp()); - h_TRT_xy->Fill(p.x(), p.y()); - h_TRT_zr->Fill(p.z(),sqrt(pow(p.x(),2)+pow(p.y(),2))); - h_TRT_barcode->Fill(i_hit->particleLink().barcode()); - - m_TRT_x->push_back(p.x()); - m_TRT_y->push_back(p.y()); - m_TRT_z->push_back(p.z()); - m_TRT_r->push_back(p.perp()); - m_TRT_barcode->push_back(i_hit->particleLink().barcode()); - int particleId(i_hit->GetParticleEncoding()); - if(particleId == 22 || static_cast<int>(abs(particleId)/100000)==41 || static_cast<int>(abs(particleId)/10000000) == 1){ - h_TRT_time_photons->Fill(i_hit->GetGlobalTime()); - h_TRT_edep_photons->Fill(i_hit->GetEnergyDeposit()); - h_TRT_kine_photons->Fill(i_hit->GetKineticEnergy()); - m_TRT_time_photons->push_back(i_hit->GetGlobalTime()); - m_TRT_edep_photons->push_back(i_hit->GetEnergyDeposit()); - m_TRT_kine_photons->push_back(i_hit->GetKineticEnergy()); - }else{ - h_TRT_time_nonphotons->Fill(i_hit->GetGlobalTime()); - h_TRT_edep_nonphotons->Fill(i_hit->GetEnergyDeposit()); - h_TRT_kine_nonphotons->Fill(i_hit->GetKineticEnergy()); - - m_TRT_time_nonphotons->push_back(i_hit->GetGlobalTime()); - m_TRT_edep_nonphotons->push_back(i_hit->GetEnergyDeposit()); - m_TRT_kine_nonphotons->push_back(i_hit->GetKineticEnergy()); - } - } // End while hits - } - if (m_tree) m_tree->Fill(); - + if (evtStore()->retrieve(p_collection, "TRTUncompressedHits") == StatusCode::SUCCESS) { + for (TRTUncompressedHitConstIter i_hit = p_collection->begin(); i_hit != p_collection->end(); ++i_hit) { + GeoTRTUncompressedHit ghit(*i_hit); + HepGeom::Point3D<double> p = ghit.getGlobalPosition(); + + h_TRT_x->Fill(p.x()); + h_TRT_y->Fill(p.y()); + h_TRT_z->Fill(p.z()); + h_TRT_r->Fill(p.perp()); + h_TRT_xy->Fill(p.x(), p.y()); + h_TRT_zr->Fill(p.z(),sqrt(pow(p.x(),2)+pow(p.y(),2))); + h_TRT_barcode->Fill(i_hit->particleLink().barcode()); + + m_TRT_x->push_back(p.x()); + m_TRT_y->push_back(p.y()); + m_TRT_z->push_back(p.z()); + m_TRT_r->push_back(p.perp()); + m_TRT_barcode->push_back(i_hit->particleLink().barcode()); + int particleId(i_hit->GetParticleEncoding()); + if(particleId == 22 || static_cast<int>(abs(particleId)/100000)==41 || static_cast<int>(abs(particleId)/10000000)==1) { + h_TRT_time_photons->Fill(i_hit->GetGlobalTime()); + h_TRT_edep_photons->Fill(i_hit->GetEnergyDeposit()); + h_TRT_kine_photons->Fill(i_hit->GetKineticEnergy()); + m_TRT_time_photons->push_back(i_hit->GetGlobalTime()); + m_TRT_edep_photons->push_back(i_hit->GetEnergyDeposit()); + m_TRT_kine_photons->push_back(i_hit->GetKineticEnergy()); + } + else { + h_TRT_time_nonphotons->Fill(i_hit->GetGlobalTime()); + h_TRT_edep_nonphotons->Fill(i_hit->GetEnergyDeposit()); + h_TRT_kine_nonphotons->Fill(i_hit->GetKineticEnergy()); + m_TRT_time_nonphotons->push_back(i_hit->GetGlobalTime()); + m_TRT_edep_nonphotons->push_back(i_hit->GetEnergyDeposit()); + m_TRT_kine_nonphotons->push_back(i_hit->GetKineticEnergy()); + } + } // End while hits + } + + if (m_tree) m_tree->Fill(); return StatusCode::SUCCESS; } - diff --git a/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.h index 7c34cfe043c..de25e66b791 100755 --- a/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/TRTHitAnalysis.h @@ -10,7 +10,6 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ITHistSvc.h" - #include <string> #include <vector> #include "TH1.h" @@ -20,7 +19,8 @@ class TH1; class TH2; class TTree; - + + class TRTHitAnalysis : public AthAlgorithm { public: @@ -48,7 +48,6 @@ class TRTHitAnalysis : public AthAlgorithm { TH1* h_TRT_kine_nonphotons; TH1* h_TRT_barcode; - std::vector<float>* m_TRT_x; std::vector<float>* m_TRT_y; std::vector<float>* m_TRT_z; @@ -64,10 +63,8 @@ class TRTHitAnalysis : public AthAlgorithm { TTree * m_tree; std::string m_path; std::string m_ntupleFileName; - ServiceHandle<ITHistSvc> m_thistSvc; - + ServiceHandle<ITHistSvc> m_thistSvc; }; #endif // TRT_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.cxx index 92e687af1d5..c74f23f6142 100755 --- a/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.cxx @@ -5,7 +5,6 @@ #include "TrackRecordAnalysis.h" // Section of includes for TrackRecord tests - #include "TrackRecord/TrackRecord.h" #include "TrackRecord/TrackRecordCollection.h" #include "CLHEP/Vector/LorentzVector.h" @@ -14,7 +13,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -51,38 +49,45 @@ TrackRecordAnalysis::TrackRecordAnalysis(const std::string& name, ISvcLocator* p , m_time(0) , m_edep(0) , m_pdg(0) + + , m_collection("CaloEntryLayer") + , m_tree(0) - , m_ntupleFileName("/TrackRecordAnalysis/ntuple/") - , m_path("/TrackRecordAnalysis/histos/") + , m_ntupleFileName("/TrackRecordAnalysis/") + , m_path("/TrackRecordAnalysis/") , m_thistSvc("THistSvc", name) - , m_collection("CaloEntryLayer") { + declareProperty("CollectionName", m_collection="CaloEntryLayer"); declareProperty("NtupleFileName", m_ntupleFileName); declareProperty("HistPath", m_path); - declareProperty("CollectionName", m_collection="CaloEntryLayer"); } + StatusCode TrackRecordAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing TrackRecordAnalysis" ); - // Grab the Ntuple and histogramming service for the tree std::string detName("CaloEntry"); std::string ntupName("TrackRecordCaloEntry"); - if(m_collection=="CaloEntryLayer"){ + + if (m_collection == "CaloEntryLayer") { detName="CaloEntry"; ntupName="TrackRecordCaloEntry"; - } else if(m_collection=="MuonEntryLayer"){ + } + else if (m_collection == "MuonEntryLayer") { detName="MuonEntry"; ntupName="TrackRecordMuonEntry"; - } else if(m_collection=="MuonExitLayer"){ + } + else if (m_collection == "MuonExitLayer") { detName="MuonExit"; ntupName="TrackRecordMuonExit"; - }else{ + } + else { ATH_MSG_ERROR("TrackRecordAnalysis for "<< name() << "not supported !!! \n"); return StatusCode::FAILURE; - } - std::cout<<"Name "<<name()<<std::endl; + + std::cout << "Name " << name() << std::endl; + //Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); @@ -93,7 +98,7 @@ StatusCode TrackRecordAnalysis::initialize() { float eta_up = 5.8; float z_down = -7000; float z_up = 7000; - if(detName =="CaloEntry"){ + if (detName == "CaloEntry") { x_down = -1180; x_up = 1180; radius = 1200; @@ -101,7 +106,6 @@ StatusCode TrackRecordAnalysis::initialize() { eta_up = 5.6; z_down = -3700; z_up = 3700; - } /** Histograms**/ @@ -165,37 +169,33 @@ StatusCode TrackRecordAnalysis::initialize() { h_pdg->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_pdg->GetName(), h_pdg)); - - m_tree= new TTree(ntupName.c_str(),ntupName.c_str()); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"+detName; + /** now add branches and leaves to the tree */ + m_tree = new TTree(ntupName.c_str(), ntupName.c_str()); + std::string fullNtupleName = "/" + m_ntupleFileName + "/" + detName; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - - - /** now add branches and leaves to the tree */ - if (m_tree){ - m_tree->Branch("x", &m_x); - m_tree->Branch("y", &m_y); - m_tree->Branch("z", &m_z); - m_tree->Branch("r", &m_r); - m_tree->Branch("eta", &m_eta); - m_tree->Branch("phi", &m_phi); - m_tree->Branch("px", &m_px); - m_tree->Branch("py", &m_py); - m_tree->Branch("pz", &m_pz); - m_tree->Branch("pt", &m_pt); - m_tree->Branch("time", &m_time); - m_tree->Branch("energy", &m_edep); - m_tree->Branch("pdg", &m_pdg); - }else{ - ATH_MSG_ERROR("No tree found!"); - } - + if (m_tree){ + m_tree->Branch("x", &m_x); + m_tree->Branch("y", &m_y); + m_tree->Branch("z", &m_z); + m_tree->Branch("r", &m_r); + m_tree->Branch("eta", &m_eta); + m_tree->Branch("phi", &m_phi); + m_tree->Branch("px", &m_px); + m_tree->Branch("py", &m_py); + m_tree->Branch("pz", &m_pz); + m_tree->Branch("pt", &m_pt); + m_tree->Branch("time", &m_time); + m_tree->Branch("energy", &m_edep); + m_tree->Branch("pdg", &m_pdg); + } + else { + ATH_MSG_ERROR("No tree found!"); + } return StatusCode::SUCCESS; } - StatusCode TrackRecordAnalysis::execute() { ATH_MSG_DEBUG( "In TrackRecordAnalysis::execute()" ); @@ -214,51 +214,49 @@ StatusCode TrackRecordAnalysis::execute() { m_edep->clear(); m_pdg->clear(); - const DataHandle<TrackRecordCollection> TRcoll; - if (evtStore()->retrieve(TRcoll, m_collection )==StatusCode::SUCCESS) { - for(TrackRecordCollection::const_iterator track = TRcoll->begin(); - track != TRcoll->end();++track){ - //TrackRecordCollection::const_iterator track; - //for(auto track : *TRcoll){ - std::cout<<"Entra en el loop"<<std::endl; + const DataHandle<TrackRecordCollection> TRcoll; + if (evtStore()->retrieve(TRcoll, m_collection ) == StatusCode::SUCCESS) { + for (TrackRecordCollection::const_iterator track = TRcoll->begin(); track != TRcoll->end(); ++track) { + //TrackRecordCollection::const_iterator track; + //for(auto track : *TRcoll){ + //std::cout<<"Entra en el loop"<<std::endl; + CLHEP::Hep3Vector p =(*track).GetPosition(); - h_hits_x->Fill(p.x()); - h_hits_y->Fill(p.y()); - h_hits_z->Fill(p.z()); - h_hits_r->Fill(p.perp()); - h_xy->Fill(p.x(), p.y()); - h_zr->Fill(p.z(),p.perp()); - h_hits_eta->Fill(p.eta()); - h_hits_phi->Fill(p.phi()); - CLHEP::Hep3Vector mom = (*track).GetMomentum(); - h_hits_px->Fill( mom.x()); - h_hits_py->Fill( mom.y()); - h_hits_pz->Fill( mom.z()); - h_hits_pt->Fill( mom.perp()); - h_edep->Fill((*track).GetEnergy()); - h_time->Fill((*track).GetTime()); - h_pdg->Fill((*track).GetPDGCode()); + h_hits_x->Fill(p.x()); + h_hits_y->Fill(p.y()); + h_hits_z->Fill(p.z()); + h_hits_r->Fill(p.perp()); + h_xy->Fill(p.x(), p.y()); + h_zr->Fill(p.z(),p.perp()); + h_hits_eta->Fill(p.eta()); + h_hits_phi->Fill(p.phi()); + + CLHEP::Hep3Vector mom = (*track).GetMomentum(); + h_hits_px->Fill(mom.x()); + h_hits_py->Fill(mom.y()); + h_hits_pz->Fill(mom.z()); + h_hits_pt->Fill(mom.perp()); + h_edep->Fill((*track).GetEnergy()); + h_time->Fill((*track).GetTime()); + h_pdg->Fill((*track).GetPDGCode()); - m_x->push_back(p.x()); - m_y->push_back(p.y()); - m_z->push_back(p.z()); - m_r->push_back(p.perp()); - m_eta->push_back(p.eta()); - m_phi->push_back(p.phi()); - m_px->push_back( mom.x()); - m_py->push_back( mom.y()); - m_pz->push_back( mom.z()); - m_pt->push_back( mom.perp()); - m_edep->push_back((*track).GetEnergy()); - m_time->push_back((*track).GetTime()); - m_pdg->push_back((*track).GetPDGCode()); - } - } // End while hits - + m_x->push_back(p.x()); + m_y->push_back(p.y()); + m_z->push_back(p.z()); + m_r->push_back(p.perp()); + m_eta->push_back(p.eta()); + m_phi->push_back(p.phi()); + m_px->push_back(mom.x()); + m_py->push_back(mom.y()); + m_pz->push_back(mom.z()); + m_pt->push_back(mom.perp()); + m_edep->push_back((*track).GetEnergy()); + m_time->push_back((*track).GetTime()); + m_pdg->push_back((*track).GetPDGCode()); + } + } // End while hits - if (m_tree) m_tree->Fill(); + if (m_tree) m_tree->Fill(); - - return StatusCode::SUCCESS; } diff --git a/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.h b/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.h index 9f530143fde..3915bcd40c4 100755 --- a/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/TrackRecordAnalysis.h @@ -16,8 +16,6 @@ #include "TH2.h" #include "TTree.h" - - class TH1; class TH2; class TTree; @@ -35,7 +33,6 @@ class TrackRecordAnalysis : public AthAlgorithm { private: - /** Some variables**/ TH1* h_hits_x; TH1* h_hits_y; @@ -53,8 +50,6 @@ class TrackRecordAnalysis : public AthAlgorithm { TH1* h_edep; TH1* h_pdg; - - std::vector<float>* m_x; std::vector<float>* m_y; std::vector<float>* m_z; @@ -68,13 +63,14 @@ class TrackRecordAnalysis : public AthAlgorithm { std::vector<float>* m_time; std::vector<float>* m_edep; std::vector<float>* m_pdg; + + std::string m_collection; TTree * m_tree; std::string m_ntupleFileName; std::string m_path; ServiceHandle<ITHistSvc> m_thistSvc; - std::string m_collection; + }; #endif // TRACK_RECORD_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.cxx index 36025ca049e..08e9927572c 100755 --- a/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.cxx @@ -14,7 +14,6 @@ #include "TTree.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -64,22 +63,22 @@ TruthHitAnalysis::TruthHitAnalysis(const std::string& name, ISvcLocator* pSvcLoc , m_barcode(0) , m_status(0) , m_pdgid(0) + , m_tree(0) - , m_ntupleFileName("/TruthHitAnalysis/ntuples/") - , m_path("/TruthHitAnalysis/histos/") + , m_ntupleFileName("/TruthHitAnalysis/") + , m_path("/TruthHitAnalysis/") , m_thistSvc("THistSvc", name) - { - declareProperty("HistPath", m_path); - declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("HistPath", m_path); } + StatusCode TruthHitAnalysis::initialize() { ATH_MSG_DEBUG( "Initializing TruthHitAnalysis" ); // Grab the Ntuple and histogramming service for the tree CHECK(m_thistSvc.retrieve()); - /** histograms declaration */ h_n_vert = new TH1D("h_n_vert","n_vert", 100,200, 1500); @@ -94,7 +93,6 @@ StatusCode TruthHitAnalysis::initialize() { h_n_vert_prim->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_n_vert_prim->GetName(), h_n_vert_prim)); - h_n_part_prim = new TH1D("h_n_part_prim","n_part prim", 100,200, 1500); h_n_part_prim->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_n_part_prim->GetName(), h_n_part_prim)); @@ -139,7 +137,6 @@ StatusCode TruthHitAnalysis::initialize() { h_vtx_sec_zr->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_vtx_sec_zr->GetName(), h_vtx_sec_zr)); - h_n_generations = new TH1D("h_n_generations","h_generations", 100,0, 25); h_n_generations->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_n_generations->GetName(), h_n_generations)); @@ -196,16 +193,12 @@ StatusCode TruthHitAnalysis::initialize() { h_part_p->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_part_p->GetName(), h_part_p)); - - m_tree= new TTree("TruthHitNtuple ","TruthHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("Truth", "Truth"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - - - /** now add branches and leaves to the tree */ - if (m_tree){ - + if (m_tree) { m_tree->Branch("vtx_x", &m_vtx_x); m_tree->Branch("vtx_y", &m_vtx_y); m_tree->Branch("vtx_z", &m_vtx_z); @@ -219,17 +212,15 @@ StatusCode TruthHitAnalysis::initialize() { m_tree->Branch("truth_phi", &m_truth_phi); m_tree->Branch("barcode", &m_barcode); m_tree->Branch("status", &m_status); - m_tree->Branch("pdg_id", &m_pdgid); - - }else{ + m_tree->Branch("pdg_id", &m_pdgid); + } + else { ATH_MSG_ERROR("No tree found!"); } - return StatusCode::SUCCESS; -} +} - StatusCode TruthHitAnalysis::execute() { ATH_MSG_DEBUG( "In TruthHitAnalysis::execute()" ); @@ -248,111 +239,103 @@ StatusCode TruthHitAnalysis::execute() { m_barcode->clear(); m_status->clear(); m_pdgid->clear(); - const DataHandle<EventInfo> event; if (!evtStore()->retrieve(event, "McEventInfo" ).isSuccess()) return StatusCode::FAILURE; - const DataHandle<McEventCollection> mcCollection; - if(evtStore()->retrieve(mcCollection,"TruthEvent")==StatusCode::SUCCESS){ - McEventCollection::const_iterator currentGenEventIter = mcCollection->begin(); - if(currentGenEventIter != mcCollection->end()){ - int nvtx = 0; - int nvtx_sec=0; - for(HepMC::GenEvent::vertex_const_iterator vtx=(*currentGenEventIter)->vertices_begin(); vtx!=(*currentGenEventIter)->vertices_end();++vtx){ - - - double x = (*vtx)->position().x(); - double y = (*vtx)->position().y(); - double z = (*vtx)->position().z(); - double r = sqrt(x*x+y*y); - h_vtx_x->Fill(x); - h_vtx_y->Fill(y); - h_vtx_r->Fill(r); - h_vtx_z->Fill(z); - - - int bcode = (*vtx)->barcode(); - m_vtx_x->push_back(x); - m_vtx_y->push_back(y); - m_vtx_r->push_back(r); - m_vtx_z->push_back(z); - m_vtx_barcode->push_back(bcode); - - if((*vtx)->barcode()>-20000){ - h_vtx_prim_xy->Fill(x,y); - h_vtx_prim_zr->Fill(z,r); - ++nvtx; - } else{ - h_vtx_sec_xy->Fill(x,y); - h_vtx_sec_zr->Fill(z,r); - ++nvtx_sec; - } - - } //End iteration over vertices - - h_n_vert->Fill(nvtx+nvtx_sec); - h_n_vert_prim->Fill(nvtx); - h_n_vert_sec->Fill(nvtx_sec); - int npart_prim=0; - int npart_sec=0; - HepMC::GenEvent::particle_const_iterator currentGenParticleIter; - for(currentGenParticleIter=(*currentGenEventIter)->particles_begin(); currentGenParticleIter!=(*currentGenEventIter)->particles_end(); ++currentGenParticleIter){ - - - const HepMC::FourVector mom=(*currentGenParticleIter)->momentum(); - - - h_truth_px->Fill(mom.x()); - h_truth_py->Fill(mom.y()); - h_truth_pz->Fill(mom.z()); - h_truth_pt->Fill(mom.perp()); - h_truth_eta->Fill(mom.eta()); - h_truth_phi->Fill(mom.phi()); - h_barcode->Fill((*currentGenParticleIter)->barcode()); - - h_part_status->Fill((*currentGenParticleIter)->status()); - - m_truth_px->push_back(mom.x()); - m_truth_py->push_back(mom.y()); - m_truth_pz->push_back(mom.z()); - m_truth_pt->push_back(mom.perp()); - m_truth_eta->push_back(mom.eta()); - m_truth_phi->push_back(mom.phi()); - m_barcode->push_back((*currentGenParticleIter)->barcode()); - m_status->push_back((*currentGenParticleIter)->status()); - int pdg = (*currentGenParticleIter)->pdg_id(); - m_pdgid->push_back(pdg); - - if((*currentGenParticleIter)->barcode()<200000){ - h_part_pdgid->Fill(pdg); - h_part_p->Fill(mom.rho()); - h_part_eta->Fill(mom.eta()); - h_part_phi->Fill(mom.phi()); - ++npart_prim; - if((*currentGenParticleIter)->barcode()<10000){ - h_n_generations->Fill(0); - }else{ - h_n_generations->Fill(1); - } - } //End barcode <200000 - else{ - h_part_pdgid_sec->Fill(pdg); - ++npart_sec; - const int gen = (*currentGenParticleIter)->barcode()/1000000 +2; - h_n_generations ->Fill(gen); - } } // End iteration over particles - - h_n_part_prim->Fill(npart_prim); - h_n_part_sec->Fill(npart_sec); - h_n_part->Fill(npart_prim+npart_sec); + const DataHandle<McEventCollection> mcCollection; + if (evtStore()->retrieve(mcCollection,"TruthEvent") == StatusCode::SUCCESS) { + McEventCollection::const_iterator currentGenEventIter = mcCollection->begin(); + if (currentGenEventIter != mcCollection->end()) { + int nvtx = 0; + int nvtx_sec=0; + for (HepMC::GenEvent::vertex_const_iterator vtx=(*currentGenEventIter)->vertices_begin(); vtx!=(*currentGenEventIter)->vertices_end(); ++vtx) { + double x = (*vtx)->position().x(); + double y = (*vtx)->position().y(); + double z = (*vtx)->position().z(); + double r = sqrt(x*x+y*y); + h_vtx_x->Fill(x); + h_vtx_y->Fill(y); + h_vtx_r->Fill(r); + h_vtx_z->Fill(z); + + int bcode = (*vtx)->barcode(); + m_vtx_x->push_back(x); + m_vtx_y->push_back(y); + m_vtx_r->push_back(r); + m_vtx_z->push_back(z); + m_vtx_barcode->push_back(bcode); + + if ((*vtx)->barcode() > -20000) { + h_vtx_prim_xy->Fill(x,y); + h_vtx_prim_zr->Fill(z,r); + ++nvtx; + } + else { + h_vtx_sec_xy->Fill(x,y); + h_vtx_sec_zr->Fill(z,r); + ++nvtx_sec; + } + } //End iteration over vertices + + h_n_vert->Fill(nvtx+nvtx_sec); + h_n_vert_prim->Fill(nvtx); + h_n_vert_sec->Fill(nvtx_sec); + + int npart_prim=0; + int npart_sec=0; + HepMC::GenEvent::particle_const_iterator currentGenParticleIter; + for (currentGenParticleIter=(*currentGenEventIter)->particles_begin(); currentGenParticleIter!=(*currentGenEventIter)->particles_end(); ++currentGenParticleIter) { + const HepMC::FourVector mom = (*currentGenParticleIter)->momentum(); + + h_truth_px->Fill(mom.x()); + h_truth_py->Fill(mom.y()); + h_truth_pz->Fill(mom.z()); + h_truth_pt->Fill(mom.perp()); + h_truth_eta->Fill(mom.eta()); + h_truth_phi->Fill(mom.phi()); + h_barcode->Fill((*currentGenParticleIter)->barcode()); + h_part_status->Fill((*currentGenParticleIter)->status()); + m_truth_px->push_back(mom.x()); + m_truth_py->push_back(mom.y()); + m_truth_pz->push_back(mom.z()); + m_truth_pt->push_back(mom.perp()); + m_truth_eta->push_back(mom.eta()); + m_truth_phi->push_back(mom.phi()); + m_barcode->push_back((*currentGenParticleIter)->barcode()); + m_status->push_back((*currentGenParticleIter)->status()); + + int pdg = (*currentGenParticleIter)->pdg_id(); + m_pdgid->push_back(pdg); - } // End mcCollection - } // End statuscode success upon retrieval of events + if ((*currentGenParticleIter)->barcode() < 200000) { + h_part_pdgid->Fill(pdg); + h_part_p->Fill(mom.rho()); + h_part_eta->Fill(mom.eta()); + h_part_phi->Fill(mom.phi()); + ++npart_prim; + if ((*currentGenParticleIter)->barcode() < 10000) { + h_n_generations->Fill(0); + } + else { + h_n_generations->Fill(1); + } + } //End barcode <200000 + else { + h_part_pdgid_sec->Fill(pdg); + ++npart_sec; + const int gen = (*currentGenParticleIter)->barcode()/1000000 + 2; + h_n_generations->Fill(gen); + } + } // End iteration over particles + + h_n_part_prim->Fill(npart_prim); + h_n_part_sec->Fill(npart_sec); + h_n_part->Fill(npart_prim+npart_sec); + } // End mcCollection + } // End statuscode success upon retrieval of events - - if (m_tree) m_tree->Fill(); + if (m_tree) m_tree->Fill(); return StatusCode::SUCCESS; } - diff --git a/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.h index e868d555a3d..567639b8fdb 100755 --- a/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/TruthHitAnalysis.h @@ -10,7 +10,6 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ITHistSvc.h" - #include <string> #include <vector> #include "TH1.h" @@ -20,7 +19,8 @@ class TH1; class TH2; class TTree; - + + class TruthHitAnalysis : public AthAlgorithm { public: @@ -63,7 +63,6 @@ class TruthHitAnalysis : public AthAlgorithm { TH1* h_part_phi; TH1* h_part_p; - std::vector<float>* m_vtx_x; std::vector<float>* m_vtx_y; std::vector<float>* m_vtx_z; @@ -84,9 +83,6 @@ class TruthHitAnalysis : public AthAlgorithm { std::string m_path; ServiceHandle<ITHistSvc> m_thistSvc; - - }; #endif // TRUTH_HIT_ANALYSIS_H - diff --git a/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.cxx b/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.cxx index 7b838ddb126..ed6d1d565a0 100755 --- a/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.cxx +++ b/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.cxx @@ -4,17 +4,14 @@ #include "ZDCHitAnalysis.h" - #include "ZDC_SimEvent/ZDC_SimStripHit_Collection.h" #include "ZDC_SimEvent/ZDC_SimStripHit.h" #include "ZDC_SimEvent/ZDC_SimPixelHit_Collection.h" #include "ZDC_SimEvent/ZDC_SimPixelHit.h" - #include "TH1.h" #include "TString.h" - #include <algorithm> #include <math.h> #include <functional> @@ -22,25 +19,28 @@ #include <stdio.h> ZDCHitAnalysis::ZDCHitAnalysis(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator) - , h_zdc_sidea_0(0) - , h_zdc_sidea_1(0) - , h_zdc_sidea_2(0) - , h_zdc_sidea_3(0) - , h_zdc_sidec_0(0) - , h_zdc_sidec_1(0) - , h_zdc_sidec_2(0) - , h_zdc_sidec_3(0) - , m_zdc_strip_side(0) - , m_zdc_strip_mod(0) - , m_zdc_strip_energy(0) - , m_zdc_pix_side(0) - , m_zdc_pix_mod(0) - , m_zdc_pix_energy(0) - , m_path("/ZDCHitAnalysis/") - , m_thistSvc("THistSvc", name) + : AthAlgorithm(name, pSvcLocator) + , h_zdc_sidea_0(0) + , h_zdc_sidea_1(0) + , h_zdc_sidea_2(0) + , h_zdc_sidea_3(0) + , h_zdc_sidec_0(0) + , h_zdc_sidec_1(0) + , h_zdc_sidec_2(0) + , h_zdc_sidec_3(0) + , m_zdc_strip_side(0) + , m_zdc_strip_mod(0) + , m_zdc_strip_energy(0) + , m_zdc_pix_side(0) + , m_zdc_pix_mod(0) + , m_zdc_pix_energy(0) + , m_tree(0) + , m_ntupleFileName("/ZDCHitAnalysis/") + , m_path("/ZDCHitAnalysis/") + , m_thistSvc("THistSvc", name) { - declareProperty("HistPath", m_path); + declareProperty("NtupleFileName", m_ntupleFileName); + declareProperty("HistPath", m_path); } StatusCode ZDCHitAnalysis::initialize() { @@ -50,7 +50,6 @@ StatusCode ZDCHitAnalysis::initialize() { CHECK(m_thistSvc.retrieve()); /** Histograms*/ - h_zdc_sidea_0 = new TH1D("m_edep_side_a0","edep_side_a0", 100,0, 1000); h_zdc_sidea_0->StatOverflows(); CHECK(m_thistSvc->regHist(m_path + h_zdc_sidea_0->GetName(), h_zdc_sidea_0)); @@ -84,27 +83,27 @@ StatusCode ZDCHitAnalysis::initialize() { CHECK(m_thistSvc->regHist(m_path + h_zdc_sidec_3->GetName(), h_zdc_sidec_3)); - m_tree= new TTree("NtupleZDCHitAnalysis","ZDCHitAna"); - std::string fullNtupleName = "/"+m_ntupleFileName+"/"; + /** now add branches and leaves to the tree */ + m_tree = new TTree("ZDC","ZDC"); + std::string fullNtupleName = "/" + m_ntupleFileName + "/"; CHECK(m_thistSvc->regTree(fullNtupleName,m_tree)); - /** now add branches and leaves to the tree */ - if (m_tree){ - m_tree->Branch("strip_side", &m_zdc_strip_side); - m_tree->Branch("strip_mode", &m_zdc_strip_mod); - m_tree->Branch("strip_energy", &m_zdc_strip_energy); - - m_tree->Branch("pix_side", &m_zdc_pix_side); - m_tree->Branch("pix_mode", &m_zdc_pix_mod); - m_tree->Branch("pix_energy", &m_zdc_pix_energy); - - }else{ - ATH_MSG_ERROR("No tree found!"); - } + if (m_tree) { + m_tree->Branch("strip_side", &m_zdc_strip_side); + m_tree->Branch("strip_mode", &m_zdc_strip_mod); + m_tree->Branch("strip_energy", &m_zdc_strip_energy); + + m_tree->Branch("pix_side", &m_zdc_pix_side); + m_tree->Branch("pix_mode", &m_zdc_pix_mod); + m_tree->Branch("pix_energy", &m_zdc_pix_energy); + } + else { + ATH_MSG_ERROR("No tree found!"); + } + return StatusCode::SUCCESS; -} +} - StatusCode ZDCHitAnalysis::execute() { ATH_MSG_DEBUG( "In ZDCHitAnalysis::execute()" ); @@ -115,24 +114,25 @@ StatusCode ZDCHitAnalysis::execute() { m_zdc_pix_side->clear(); m_zdc_pix_mod->clear(); m_zdc_pix_energy->clear(); + double ene_strip = -999.; int side_strip = -1; - int mod_strip = -1; + int mod_strip = -1; double ene_pix = -999.; int side_pix = -1; - int mod_pix = -1; + int mod_pix = -1; ZDC_SimStripHit_ConstIterator striphi; const DataHandle<ZDC_SimStripHit_Collection> stripiter; CHECK(evtStore()->retrieve(stripiter,"ZDC_SimStripHit_Collection")); - for(striphi=(*stripiter).begin(); striphi != (*stripiter).end();++striphi){ + for (striphi=(*stripiter).begin(); striphi != (*stripiter).end(); ++striphi) { ZDC_SimStripHit ghit(*striphi); - ene_strip=ghit.GetEdep(); - side_strip = ghit.GetSide(); - mod_strip = ghit.GetMod(); + ene_strip = ghit.GetEdep(); + side_strip = ghit.GetSide(); + mod_strip = ghit.GetMod(); - if(side_pix==1){ - switch(mod_strip){ + if (side_pix==1) { + switch (mod_strip) { case 0: h_zdc_sidea_0->Fill(ene_strip); break; @@ -146,8 +146,9 @@ StatusCode ZDCHitAnalysis::execute() { h_zdc_sidea_3->Fill(ene_strip); break; } - }else{ - switch (mod_strip){ + } + else { + switch (mod_strip) { case 0: h_zdc_sidec_0->Fill(ene_strip); break; @@ -167,14 +168,14 @@ StatusCode ZDCHitAnalysis::execute() { ZDC_SimPixelHit_ConstIterator pixelhi; const DataHandle<ZDC_SimPixelHit_Collection> pixeliter; CHECK(evtStore()->retrieve(pixeliter,"ZDC_SimPixelHit_Collection")); - for(pixelhi=(*pixeliter).begin(); pixelhi != (*pixeliter).end();++pixelhi){ + for (pixelhi=(*pixeliter).begin(); pixelhi != (*pixeliter).end(); ++pixelhi) { ZDC_SimPixelHit ghit(*pixelhi); - ene_pix=ghit.GetEdep(); - side_pix = ghit.GetSide(); - mod_pix = ghit.GetMod(); + ene_pix = ghit.GetEdep(); + side_pix = ghit.GetSide(); + mod_pix = ghit.GetMod(); - if(side_pix==1){ - switch(mod_pix){ + if (side_pix==1) { + switch (mod_pix) { case 0: h_zdc_sidea_0->Fill(ene_pix); break; @@ -188,8 +189,9 @@ StatusCode ZDCHitAnalysis::execute() { h_zdc_sidea_3->Fill(ene_pix); break; } - }else{ - switch (mod_pix){ + } + else { + switch (mod_pix) { case 0: h_zdc_sidec_0->Fill(ene_pix); break; @@ -205,14 +207,15 @@ StatusCode ZDCHitAnalysis::execute() { } } - m_zdc_strip_side->push_back(side_strip); - m_zdc_strip_mod->push_back(mod_strip); - m_zdc_strip_energy->push_back(ene_strip); - m_zdc_pix_side->push_back(side_pix); - m_zdc_pix_mod->push_back(mod_pix); - m_zdc_pix_energy->push_back(ene_pix); + m_zdc_strip_side->push_back(side_strip); + m_zdc_strip_mod->push_back(mod_strip); + m_zdc_strip_energy->push_back(ene_strip); + m_zdc_pix_side->push_back(side_pix); + m_zdc_pix_mod->push_back(mod_pix); + m_zdc_pix_energy->push_back(ene_pix); } if (m_tree) m_tree->Fill(); + return StatusCode::SUCCESS; } diff --git a/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.h b/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.h index cf7678b4e77..a0d2edab82a 100755 --- a/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.h +++ b/Simulation/Tools/HitAnalysis/src/ZDCHitAnalysis.h @@ -15,7 +15,6 @@ #include "TH1.h" #include "TTree.h" - class TH1; class TTree; @@ -58,4 +57,3 @@ class ZDCHitAnalysis : public AthAlgorithm { }; #endif // ZDC_HIT_ANALYSIS_H - -- GitLab