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

TimeResidual calculation code have been added, but the RAW input is required

parent b71828af
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ atlas_depends_on_subdirs( PUBLIC
GaudiKernel
InnerDetector/InDetRawEvent/InDetRawData
LumiBlock/LumiBlockComps
InnerDetector/InDetConditions/TRT_ConditionsServices
Control/AthenaBaseComps
Trigger/TrigEvent/TrigDecisionInterface
PRIVATE
......@@ -24,7 +25,6 @@ atlas_depends_on_subdirs( PUBLIC
Event/xAOD/xAODEventInfo
Event/xAOD/xAODTrigger
InnerDetector/InDetConditions/InDetConditionsSummaryService
InnerDetector/InDetConditions/TRT_ConditionsServices
InnerDetector/InDetDetDescr/InDetIdentifier
InnerDetector/InDetDetDescr/InDetReadoutGeometry
InnerDetector/InDetRecEvent/InDetRIO_OnTrack
......@@ -55,7 +55,7 @@ atlas_add_library( TRTMonitoringRun3Lib
PUBLIC_HEADERS TRTMonitoringRun3
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} ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaBaseComps GaudiKernel LumiBlockCompsLib AthenaMonitoringLib
LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaBaseComps GaudiKernel LumiBlockCompsLib TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack InDetRawData TrkTrack TrkTrackSummary TrkToolInterfaces AthenaMonitoringLib InDetRawData
PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} AthenaMonitoringLib AthenaKernel SGAudCore AthenaPoolUtilities EventInfo LWHists )
atlas_add_component( TRTMonitoringRun3
......
......@@ -28,12 +28,28 @@
#include "TrkToolInterfaces/ITrackSummaryTool.h"
#include "TrkToolInterfaces/ITrackHoleSearchTool.h"
#include "TRT_DriftFunctionTool/ITRT_DriftFunctionTool.h"
#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
// STDLIB
#include <string>
#include <vector>
#include <set>
namespace Trk {
// class ITrackHoleSearchTool;
class Track;
class TrackStateOnSurface;
// class ITrackSummaryTool;
}
namespace InDetDD {
class TRT_DetectorManager;
}
class ITRT_CalDbTool;
class ITRT_ConditionsSvc;
class IInDetConditionsSvc;
class TRTMonitoringRun3_Tool : public AthMonitorAlgorithm {
public:
TRTMonitoringRun3_Tool( const std::string& name, ISvcLocator* pSvcLocator );
......@@ -41,6 +57,13 @@ public:
virtual StatusCode initialize() override;
virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
private:
Gaudi::Property<bool> m_doRandom {this,"RandomHist",false};
Gaudi::Property<bool> m_doRandom {this,"RandomHist",false}; //< Trigger chain string pulled from the job option and parsed into a vector?
ToolHandle<ITRT_CalDbTool> m_TRTCalDbTool;
SG::ReadHandleKey<TrackCollection> m_trackCollectionKey{this, "TrackCollection", "in"};
//SG::ReadHandleKey<TrackCollection> m_trackCollectionKey{this, "TRTTracksObjectName", "Tracks", "Name of tracks container"};
//SG::ReadHandleKey<TrackCollection> m_trackCollections{this, "Trk::TrackCollection_tlp5_CombinedInDetTracks", "in"};
//SG::ReadHandleKey<TrackCollection> m_trackCollectionKey;
//SG::ReadHandleKey<TrackCollection> m_TracksName;
//SG::ReadHandleKey<TrackCollection> m_trackCollectionKey{this, "TrackCollection", "in"};//SG::ReadHandleKey<TrackCollection> m_trackCollectionKey{this, "TRTTracksObjectName", "Tracks", "Name of tracks container"};
};
#endif
......@@ -61,6 +61,10 @@ def TRTMonitoringRun3_ToolConfig(inputFlags):
# caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
# result.merge(caloNoiseAcc)
# TRTMonitoringRun3Alg.CaloNoiseTool = caloNoiseTool
#from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbTool
#TRT_ConditionsServicesAcc, TRT_ConditionsServicesTool = TRT_CalDbTool(inputFlags)
#result.merge(TRT_ConditionsServicesAcc)
#TRTMonitoringRun3Alg.TRT_ConditionsServicesTool = TRT_ConditionsServicesTool
# # Then, add a tool that doesn't have its own configuration function. In
# # this example, no accumulator is returned, so no merge is necessary.
......@@ -121,8 +125,8 @@ def TRTMonitoringRun3_ToolConfig(inputFlags):
# ================================= 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)
anotherGroup.defineHistogram('lb',title='Luminosity;Luminosity bin;Luminosity [#mub^{1}]',
path='lowStat_LB/TRT/Aging/Barrel',xbins=2000,xmin=0.0,xmax=2000)
# ===============================================================================================
# ================================= lowStat_LB/TRT/Aging/EndCap =================================
......@@ -168,7 +172,7 @@ if __name__=='__main__':
#nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/'
#file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
nightly = '/afs/cern.ch/work/n/nbelyaev/DQ/Run3/build/'
file = 'data16_13TeV.00358031.physics_Main.recon.AOD.Athena.21.0.78.f961/AOD.11038520._000002.pool.root.1'
file = 'data16_13TeV.00358031.physics_Main.recon.AOD.Athena.21.0.78.f961/TRT.ESD.11038520._000002.pool.root.1'
ConfigFlags.Input.Files = [nightly+file]
ConfigFlags.Input.isMC = False
ConfigFlags.Output.HISTFileName = 'TRTMonitoringRun3_ToolOutput.root'
......@@ -180,7 +184,7 @@ if __name__=='__main__':
cfg = MainServicesSerialCfg()
cfg.merge(PoolReadCfg(ConfigFlags))
exampleMonitorAcc = TRTMonitoringRun3_ToolConfig(ConfigFlags)
TRTMonitoringRun3Acc = TRTMonitoringRun3_ToolConfig(ConfigFlags)
cfg.merge(exampleMonitorAcc)
cfg.merge(TRTMonitoringRun3Acc)
cfg.run()
......@@ -11,7 +11,6 @@
#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"
......@@ -36,13 +35,6 @@
#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>
......@@ -50,6 +42,8 @@
TRTMonitoringRun3_Tool::TRTMonitoringRun3_Tool( const std::string& name, ISvcLocator* pSvcLocator )
:AthMonitorAlgorithm(name,pSvcLocator)
,m_doRandom(false)
,m_TRTCalDbTool("TRT_CalDbTool", this)
,m_trackCollectionKey("Trk::TrackCollection_tlp5_CombinedInDetTracks")
{}
......@@ -57,6 +51,7 @@ TRTMonitoringRun3_Tool::~TRTMonitoringRun3_Tool() {}
StatusCode TRTMonitoringRun3_Tool::initialize() {
ATH_CHECK( m_trackCollectionKey.initialize() );
return AthMonitorAlgorithm::initialize();
}
......@@ -95,42 +90,55 @@ StatusCode TRTMonitoringRun3_Tool::fillHistograms( const EventContext& ctx ) con
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();
//Code for processing TimeResiduals with the RAW data
//SG::ReadHandle<TrackCollection> trackCollection(m_trackCollectionKey, ctx);//auto tracks = SG::makeHandle(m_TracksName);
//if (!trackCollection.isValid()) {
// //ATH_MSG_ERROR("Could not find track collection " << m_trackCollectionKey.key() << " in store");
// ATH_MSG_ERROR("evtStore() does not contain track Collection with name "<< m_trackCollectionKey.key());
// return StatusCode::FAILURE;
//}
////TrackCollection::const_iterator itrack = tracks->begin();//auto p_trk = trackCollection->begin();
////TrackCollection::const_iterator itrack_end = tracks->end();//
////for (; p_trk != trackCollection->end(); ++p_trk) {//for (; itrack != itrack_end; ++itrack) {
//for (const auto& trackCollectionItr : *trackCollection){
// std::cout << "All ok." << std::endl;
// const DataVector<const Trk::TrackStateOnSurface> *trackStates = trackCollectionItr->trackStateOnSurfaces();//const DataVector<const Trk::TrackStateOnSurface> *trackStates = (**itrack).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 = 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 = 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);
// }
//}
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();
std::cout << "lbDuration() = " << lbDuration() << "; lbAverageLuminosity() = " << lbAverageLuminosity() << std::endl;
hIntLum_passed = hIntLum>0.7;
hNumTrksDetPhi_B = 1.;
hNumTrksDetPhi_B_passed = hNumTrksDetPhi_B>0.7;
......
......@@ -20,8 +20,4 @@
//DECLARE_COMPONENT( DQBadLBFilterAlg )
//DECLARE_COMPONENT( TriggerTranslatorToolSimple )
//DECLARE_COMPONENT( GenericMonitoringTool )
DECLARE_COMPONENT( TRTMonitoringRun3_Tool )
#ifdef ONLINE
#endif
DECLARE_COMPONENT( TRTMonitoringRun3_Tool )
\ No newline at end of file
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