Skip to content
Snippets Groups Projects
Commit b71828af authored by Nikita Belyaev's avatar Nikita Belyaev
Browse files

Added the first code to calculate track parameters, GeoModel and Eigen libraries added

parent a0416f4a
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ atlas_subdir( TRTMonitoringRun3 )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaMonitoring
GaudiKernel
InnerDetector/InDetRawEvent/InDetRawData
LumiBlock/LumiBlockComps
......@@ -32,8 +33,7 @@ atlas_depends_on_subdirs( PUBLIC
Tools/LWHists
Tracking/TrkEvent/TrkTrack
Tracking/TrkEvent/TrkTrackSummary
Tracking/TrkTools/TrkToolInterfaces
Control/AthenaMonitoring
Tracking/TrkTools/TrkToolInterfaces #Control/AthenaMonitoring
Control/AthenaCommon
Control/AthenaConfiguration
Control/AthenaKernel
......@@ -44,6 +44,8 @@ atlas_depends_on_subdirs( PUBLIC
AtlasTest/TestTools)
# External dependencies:
find_package( Eigen )
find_package( GeoModel )
find_package( Boost COMPONENTS filesystem thread system )
find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
find_package( ROOT COMPONENTS Tree Hist RIO pthread MathCore Core Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11)
......@@ -51,21 +53,18 @@ find_package( ROOT COMPONENTS Tree Hist RIO pthread MathCore Core Graf Graf3d Gp
atlas_add_library( TRTMonitoringRun3Lib
src/*.cxx
PUBLIC_HEADERS TRTMonitoringRun3
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel LumiBlockCompsLib AthenaMonitoringLib
LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaBaseComps GaudiKernel LumiBlockCompsLib AthenaMonitoringLib
PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} AthenaMonitoringLib AthenaKernel SGAudCore AthenaPoolUtilities EventInfo LWHists )
atlas_add_component( TRTMonitoringRun3
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} TRTMonitoringRun3Lib AthenaMonitoringLib GaudiKernel InDetRawData LumiBlockCompsLib CommissionEvent AthContainers AtlasDetDescr Identifier xAODEventInfo xAODTrigger EventPrimitives TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack LWHists TrkTrack TrkTrackSummary TrkToolInterfaces )
# Install files from the package:
#atlas_install_headers( TRTMonitoringRun3 )
#atlas_install_headers( AthenaMonitoring )
#atlas_install_headers( AthenaCommon )
#atlas_install_headers( AthenaConfiguration )
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
......@@ -11,6 +11,29 @@
#include "TRandom3.h"
#include "AthenaMonitoring/ManagedMonitorToolBase.h"
#include "GaudiKernel/StatusCode.h"
// Data handles
#include "StoreGate/ReadHandleKey.h"
#include "TrkTrack/TrackCollection.h"
#include "CommissionEvent/ComTime.h"
#include "xAODTrigger/TrigDecision.h"
#include "xAODEventInfo/EventInfo.h"
#include "InDetRawData/InDetTimeCollection.h"
#include "InDetRawData/InDetRawDataCLASS_DEF.h"
// Tool interfaces
#include "LumiBlockComps/ILuminosityTool.h"
#include "TrkToolInterfaces/ITrackSummaryTool.h"
#include "TrkToolInterfaces/ITrackHoleSearchTool.h"
#include "TRT_DriftFunctionTool/ITRT_DriftFunctionTool.h"
// STDLIB
#include <string>
#include <vector>
#include <set>
class TRTMonitoringRun3_Tool : public AthMonitorAlgorithm {
public:
TRTMonitoringRun3_Tool( const std::string& name, ISvcLocator* pSvcLocator );
......
......@@ -31,11 +31,11 @@ def TRTMonitoringRun3_ToolConfig(inputFlags):
# base class configuration following the inputFlags. The returned object
# is the algorithm.
from TRTMonitoringRun3.TRTMonitoringRun3Conf import TRTMonitoringRun3_Tool
exampleMonAlg = helper.addAlgorithm(TRTMonitoringRun3_Tool,'ExampleMonAlg')
TRTMonitoringRun3Alg = helper.addAlgorithm(TRTMonitoringRun3_Tool,'TRTMonitoringRun3Alg')
# You can actually make multiple instances of the same algorithm and give
# them different configurations
anotherExampleMonAlg = helper.addAlgorithm(TRTMonitoringRun3_Tool,'AnotherExampleMonAlg')
anotherTRTMonitoringRun3Alg = helper.addAlgorithm(TRTMonitoringRun3_Tool,'AnotherTRTMonitoringRun3Alg')
# # If for some really obscure reason you need to instantiate an algorithm
# # yourself, the AddAlgorithm method will still configure the base
......@@ -46,9 +46,9 @@ def TRTMonitoringRun3_ToolConfig(inputFlags):
### STEP 3 ###
# Edit properties of a algorithm
# some generic property
# exampleMonAlg.RandomHist = True
# TRTMonitoringRun3Alg.RandomHist = True
# to enable a trigger filter, for example:
#exampleMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
#TRTMonitoringRun3Alg.TriggerChain = 'HLT_mu26_ivarmedium'
### STEP 4 ###
# Add some tools. N.B. Do not use your own trigger decion tool. Use the
......@@ -60,64 +60,86 @@ def TRTMonitoringRun3_ToolConfig(inputFlags):
# from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
# caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
# result.merge(caloNoiseAcc)
# exampleMonAlg.CaloNoiseTool = caloNoiseTool
# TRTMonitoringRun3Alg.CaloNoiseTool = caloNoiseTool
# # Then, add a tool that doesn't have its own configuration function. In
# # this example, no accumulator is returned, so no merge is necessary.
# from MyDomainPackage.MyDomainPackageConf import MyDomainTool
# exampleMonAlg.MyDomainTool = MyDomainTool()
# TRTMonitoringRun3Alg.MyDomainTool = MyDomainTool()
# Add a generic monitoring tool (a "group" in old language). The returned
# object here is the standard GenericMonitoringTool.
myGroup = helper.addGroup(
exampleMonAlg,
'ExampleMonitor',
TRTMonitoringRun3Alg,
'TRTMonitoringRun3Monitor',
'run_/'
)
# Add a GMT for the other example monitor algorithm
anotherGroup = helper.addGroup(anotherExampleMonAlg,'ExampleMonitor')
anotherGroup = helper.addGroup(anotherTRTMonitoringRun3Alg,'TRTMonitoringRun3Monitor')
### STEP 5 ###
# Configure histograms
# ====================================== TRT/Barrel/Expert ======================================
myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
path='TRT/Barrel/Expert',xbins=100,xmin=0.0,xmax=50.0)
myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
path='TRT/EndCap/Expert',xbins=100,xmin=0.0,xmax=50.0)
# ===============================================================================================
# ====================================== TRT/Shift/Barrel =======================================
myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
path='TRT/Shift/Barrel',xbins=100,xmin=0.0,xmax=50.0)
myGroup.defineHistogram('hNumTrksDetPhi_B_passed,hNumTrksDetPhi_B',type='TEfficiency',title='Number of Reconstructed Tracks vs #phi (2D) (Barrel);#phi (deg);Number of Tracks',
path='TRT/Shift/Barrel',xbins=60,xmin=0.0,xmax=360.0)
myGroup.defineHistogram('hTimeResidual_B_passed,hTimeResidual_B',type='TEfficiency',title='Time Residuals for Xenon Straws (Barrel);Time Residual (ns);Norm. Entries',
path='TRT/Shift/Barrel',xbins=200,xmin=-20.0,xmax=20.0)
# ===============================================================================================
# ====================================== TRT/Shift/EndCap =======================================
myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
path='TRT/Shift/EndCap',xbins=100,xmin=0.0,xmax=50.0)
# ===============================================================================================
# ====================================== TRT/Shift/Summary ======================================
myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
path='TRT/Shift/Summary',xbins=100,xmin=0.0,xmax=50.0)
myGroup.defineHistogram('hIntLum_passed,hIntLum',type='TEfficiency',title='Luminocity;;Luminosity [#mub^{1}]',
path='TRT/Shift/Summary',xbins=1,xmin=0.0,xmax=1.0)
# ===============================================================================================
# ====================================== TRT/Aging/Barrel =======================================
myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
path='TRT/Aging/Barrel',xbins=100,xmin=0.0,xmax=50.0)
# ===============================================================================================
# ====================================== TRT/Aging/EndCap =======================================
myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
path='TRT/Aging/EndCap',xbins=100,xmin=0.0,xmax=50.0)
# ===============================================================================================
# ================================= lowStat_LB/TRT/Aging/Barrel =================================
anotherGroup.defineHistogram('run',title='Run Number;run;Events',
path='lowStat_LB/TRT/Aging/Barrel',xbins=1000000,xmin=-0.5,xmax=999999.5)
# ===============================================================================================
# ================================= lowStat_LB/TRT/Aging/EndCap =================================
anotherGroup.defineHistogram('run',title='Run Number;run;Events',
path='lowStat_LB/TRT/Aging/EndCap',xbins=1000000,xmin=-0.5,xmax=999999.5)
# ===============================================================================================
# ================================= lowStat_LB/TRT/Shift/Barrel =================================
anotherGroup.defineHistogram('run',title='Run Number;run;Events',
path='lowStat_LB/TRT/Shift/Barrel',xbins=1000000,xmin=-0.5,xmax=999999.5)
# ===============================================================================================
# ================================= lowStat_LB/TRT/Shift/EndCap =================================
anotherGroup.defineHistogram('run',title='Run Number;run;Events',
path='lowStat_LB/TRT/Shift/EndCap',xbins=1000000,xmin=-0.5,xmax=999999.5)
# ===============================================================================================
### STEP 6 ###
# Finalize. The return value should be a tuple of the ComponentAccumulator
# and the sequence containing the created algorithms. If we haven't called
......
......@@ -6,6 +6,47 @@
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoring/Monitored.h"
#include "AthContainers/DataVector.h"
#include "InDetReadoutGeometry/TRT_DetectorManager.h"
#include "InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h"
#include "TrkTrackSummary/TrackSummary.h"
#include "AtlasDetDescr/AtlasDetectorID.h"
#include "Identifier/Identifier.h"//may be obsolete, TRT_ID includes this
#include "InDetIdentifier/TRT_ID.h"
#include "InDetRawData/InDetRawDataContainer.h"
#include "TrkTrack/Track.h"
#include "TrkTrack/TrackCollection.h"
#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
#include "TRT_ConditionsServices/ITRT_ConditionsSvc.h"
#include "TRT_ConditionsServices/ITRT_StrawStatusSummaryTool.h"
#include "TRT_ConditionsServices/ITRT_DAQ_ConditionsSvc.h"
#include "TRT_ConditionsServices/ITRT_ByteStream_ConditionsSvc.h"
#include "TRT_ConditionsServices/ITRT_StrawNeighbourSvc.h"
#include "InDetConditionsSummaryService/IInDetConditionsSvc.h"
#include "xAODTrigger/TrigDecision.h"
#include "EventPrimitives/EventPrimitivesHelpers.h"
#include "StoreGate/ReadHandle.h"
#include "TProfile.h"
#include "LWHists/TH1F_LW.h"
#include "LWHists/TH2F_LW.h"
#include "LWHists/TProfile_LW.h"
#include "LWHists/TH1D_LW.h"
#include "LWHists/LWHist1D.h"
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
#define CAN_REBIN(hist) hist->SetCanExtend(TH1::kAllAxes)
#else
#define CAN_REBIN(hist) hist->SetBit(TH1::kCanRebin)
#endif
#include <sstream>
#include <iomanip>
#include <memory>
TRTMonitoringRun3_Tool::TRTMonitoringRun3_Tool( const std::string& name, ISvcLocator* pSvcLocator )
:AthMonitorAlgorithm(name,pSvcLocator)
,m_doRandom(false)
......@@ -39,6 +80,9 @@ StatusCode TRTMonitoringRun3_Tool::fillHistograms( const EventContext& ctx ) con
auto hNumTrksDetPhi_B = Monitored::Scalar<float>("hNumTrksDetPhi_B",0.0);
auto hNumTrksDetPhi_B_passed = Monitored::Scalar<float>("hNumTrksDetPhi_B_passed",false);
auto hTimeResidual_B = Monitored::Scalar<float>("hTimeResidual_B",0.0);
auto hTimeResidual_B_passed = Monitored::Scalar<float>("hTimeResidual_B_passed",false);
// Set the values of the monitored variables for the event
lumiPerBCID = lbAverageInteractionsPerCrossing();
......@@ -50,20 +94,53 @@ StatusCode TRTMonitoringRun3_Tool::fillHistograms( const EventContext& ctx ) con
if (m_doRandom) {
random = r.Rndm();
}
DataVector<Trk::Track>::const_iterator p_trk;
const DataVector<const Trk::TrackStateOnSurface> *trackStates = (**p_trk).trackStateOnSurfaces();
DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin0 = trackStates->begin();
DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin = trackStates->begin();
DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItEnd = trackStates->end();
for (TSOSItBegin = TSOSItBegin0; TSOSItBegin != TSOSItEnd; ++TSOSItBegin) {
const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>((*TSOSItBegin)->measurementOnTrack());
const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters *>((*TSOSItBegin)->trackParameters());
if (!trtCircle) continue;
if (!aTrackParam) continue;
Identifier surfaceID;
surfaceID = trtCircle->identify();
TRTCond::RtRelation const *rtr = getRtRelation(surfaceID); //TRTCond::RtRelation const *rtr = m_TRTCalDbTool->getRtRelation(surfaceID);
float locR = aTrackParam->parameters()[Trk::driftRadius];
const InDet::TRT_DriftCircle *RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle *>(trtCircle->prepRawData());
// Calculation of the monitoring variables
const double thist0 = getT0(surfaceID); //const double thist0 = m_TRTCalDbTool->getT0(surfaceID);
const double trkdrifttime = (!rtr) ? 0 : rtr->drifttime(fabs(locR));
const double timeresidual = RawDriftCircle->rawDriftTime() - thist0 - trkdrifttime;
hTimeResidual_B = timeresidual;
hTimeResidual_B_passed = hTimeResidual_B>0.7;
fill("TRTMonitoringRun3Monitor",hTimeResidual_B,hTimeResidual_B_passed);
}
// Fake efficiency calculator
pT = r.Landau(15);
pT_passed = pT>r.Poisson(15);
hIntLum = lbDuration()*lbAverageLuminosity();
hIntLum_passed = hIntLum>0.7;
pT = r.Landau(15);
pT_passed = pT>r.Poisson(15);
hIntLum = lbDuration()*lbAverageLuminosity();
hIntLum_passed = hIntLum>0.7;
hNumTrksDetPhi_B = 1.;
hNumTrksDetPhi_B_passed = 1.;
hNumTrksDetPhi_B_passed = hNumTrksDetPhi_B>0.7;
// Fill. First argument is the tool name, all others are the variables to be saved.
fill("ExampleMonitor",lumiPerBCID,lb,random,pT,pT_passed,hIntLum,hIntLum_passed,hNumTrksDetPhi_B,hNumTrksDetPhi_B_passed);
fill("TRTMonitoringRun3Monitor",lumiPerBCID,lb,random,pT,pT_passed,hIntLum,hIntLum_passed,hNumTrksDetPhi_B,hNumTrksDetPhi_B_passed);
// Alternative fill method. Get the group yourself, and pass it to the fill function.
auto tool = getGroup("ExampleMonitor");
auto tool = getGroup("TRTMonitoringRun3Monitor");
fill(tool,run);
return StatusCode::SUCCESS;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment