Commit a7f5c408 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (TRT_TrackHoleSearch-01-00-00)

parent 699ef0ed
################################################################################
# Package: TRT_TrackHoleSearch
################################################################################
# Declare the package name:
atlas_subdir( TRT_TrackHoleSearch )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
GaudiKernel
Tracking/TrkEvent/TrkParameters
Tracking/TrkTools/TrkToolInterfaces
Trigger/TrigEvent/TrigDecisionInterface
PRIVATE
DetectorDescription/Identifier
Event/EventInfo
Event/EventPrimitives
InnerDetector/InDetConditions/InDetConditionsSummaryService
InnerDetector/InDetConditions/TRT_ConditionsServices
InnerDetector/InDetDetDescr/InDetIdentifier
InnerDetector/InDetRecEvent/InDetRIO_OnTrack
Tracking/TrkDetDescr/TrkSurfaces
Tracking/TrkEvent/TrkEventPrimitives
Tracking/TrkEvent/TrkEventUtils
Tracking/TrkEvent/TrkTrack
Tracking/TrkEvent/TrkTrackSummary
Tracking/TrkEvent/VxVertex
Tracking/TrkExtrapolation/TrkExInterfaces )
# External dependencies:
find_package( CLHEP )
find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint )
# Component(s) in the package:
atlas_add_component( TRT_TrackHoleSearch
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel TrkParameters TrkToolInterfaces Identifier EventInfo EventPrimitives TRT_ConditionsServicesLib InDetIdentifier InDetRIO_OnTrack TrkSurfaces TrkEventPrimitives TrkEventUtils TrkTrack TrkTrackSummary VxVertex TrkExInterfaces )
# Install files from the package:
atlas_install_headers( TRT_TrackHoleSearch )
atlas_install_joboptions( share/*.py )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// TRTStrawEfficiency.h
// author: Ryan D. Reece <ryan.reece@cern.ch>
// created: Nov 2009
#ifndef TRT_TrackHoleSearch_TRTStrawEfficiency_h
#define TRT_TrackHoleSearch_TRTStrawEfficiency_h
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/ServiceHandle.h"
#include "TrkToolInterfaces/IUpdator.h"
#include "TrigDecisionInterface/ITrigDecisionTool.h"
#include <string>
#include <vector>
namespace Trk
{
class ITrackHoleSearchTool;
class TrackStateOnSurface;
}
class ITHistSvc;
class TRT_ID;
class ITRT_StrawNeighbourSvc;
class TTree;
class TRTStrawEfficiency : public AthAlgorithm
{
public:
TRTStrawEfficiency(const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode finalize();
StatusCode execute();
private:
// configurables
//----------------------------------
ToolHandle<Trk::ITrackHoleSearchTool> m_trt_hole_finder;
std::string m_track_collection;
float m_max_abs_d0;
float m_max_abs_z0;
float m_min_pT;
float m_min_p; /* added by dan */
float m_max_abs_eta;
int m_min_pixel_hits;
int m_min_sct_hits;
int m_min_trt_hits;
ServiceHandle<ITHistSvc> m_hist_svc;
ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc;
std::string m_tree_name;
std::string m_stream_name;
std::string m_event_info_key;
std::string m_required_trigger;
std::string m_vertexCollectionName; /* added by dan */
// private data
//----------------------------------
TTree* m_tree;
const TRT_ID* m_TRT_ID;
ToolHandle<Trk::IUpdator> m_updator;
ToolHandle<Trig::ITrigDecisionTool> m_trigDec;
unsigned int m_num_events;
unsigned int m_num_tracks;
unsigned int m_num_preselected_tracks;
// ntuple branches
unsigned int m_event_number;
unsigned int m_run_number;
unsigned int m_lumi_block;
float m_track_pt;
float m_track_eta;
float m_track_phi;
float m_track_d0;
float m_track_z0;
int m_n_pixel_hits;
int m_n_sct_hits;
int m_n_trt_hits;
std::vector<int> m_hit_bec;
std::vector<int> m_hit_phi;
std::vector<int> m_hit_layer;
std::vector<int> m_hit_strawlayer;
std::vector<int> m_hit_straw;
std::vector<int> m_hit_chip;
std::vector<int> m_hit_pad;
std::vector<float> m_hit_x;
std::vector<float> m_hit_y;
std::vector<float> m_hit_z;
std::vector<float> m_hit_center_x;
std::vector<float> m_hit_center_y;
std::vector<float> m_hit_center_z;
std::vector<float> m_hit_R;
std::vector<float> m_hit_locR;
std::vector<int> m_hit_HL;
std::vector<int> m_hit_det;
std::vector<float> m_hit_ub_locR;
std::vector<float> m_hit_ub_x;
std::vector<float> m_hit_ub_y;
std::vector<float> m_hit_ub_z;
int m_n_pixel_holes;
int m_n_sct_holes;
int m_n_trt_holes;
std::vector<int> m_hole_bec;
std::vector<int> m_hole_phi;
std::vector<int> m_hole_layer;
std::vector<int> m_hole_strawlayer;
std::vector<int> m_hole_straw;
std::vector<int> m_hole_chip;
std::vector<int> m_hole_pad;
std::vector<float> m_hole_x;
std::vector<float> m_hole_y;
std::vector<float> m_hole_z;
std::vector<float> m_hole_center_x;
std::vector<float> m_hole_center_y;
std::vector<float> m_hole_center_z;
std::vector<float> m_hole_locR;
std::vector<float> m_hole_locR_error;
std::vector<int> m_hole_det;
//---- branches added by dan -------
std::vector<int> m_hit_tube_hit;
int m_n_primary_vertex;
int m_n_tube_hits;
// private methods
//----------------------------------
void make_branches();
void clear_branches();
int fill_hit_data(const Trk::TrackStateOnSurface& hit);
int fill_hole_data(const Trk::TrackStateOnSurface& hole);
};
#endif // TRT_TrackHoleSearch_TRTStrawEfficiency_h
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// TRTTrackHoleSearchTool.h
// author: Ryan D. Reece <ryan.reece@cern.ch>
// created: Jan 2010
#ifndef TRT_TrackHoleSearch_TRTTrackHoleSearchTool_h
#define TRT_TrackHoleSearch_TRTTrackHoleSearchTool_h
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/ServiceHandle.h"
#include "TrkToolInterfaces/ITrackHoleSearchTool.h"
#include "TrkParameters/TrackParameters.h"
#include <string>
#include <vector>
#include <fstream>
namespace Trk
{
class IExtrapolator;
class CylinderSurface;
class Track;
class Surface;
}
class TRT_ID;
class IInDetConditionsSvc;
class TRTTrackHoleSearchTool : public Trk::ITrackHoleSearchTool, public AthAlgTool
{
public:
TRTTrackHoleSearchTool(const std::string& type, const std::string& name, const IInterface* parent);
StatusCode initialize();
StatusCode finalize();
/** Input : track, partHyp
Output: Changes in information
This method fills the fields relevant to the hole counts in the vector information. These fields should be initialised to 0.
The relevant indices are specified by the enumeration in Tracking/TrkEvent/TrkTrackSummary.
If problems occur, the information counters are reset to -1 flagging them as not set.
The parthyp argument is relevant for the extrapolation steps in the hole search.
*/
void countHoles(const Trk::Track& track,
std::vector<int>& information ,
const Trk::ParticleHypothesis partHyp = Trk::pion) const;
/** Input : track, parthyp
Return: A DataVector containing pointers to TrackStateOnSurfaces which each represent an identified hole on the track.
The parthyp argument is relevant for the extrapolation steps in the hole search.
Attention: This is a factory, ownership of the return vector is passed to the calling method.
*/
const DataVector<const Trk::TrackStateOnSurface>* getHolesOnTrack(const Trk::Track& track,
const Trk::ParticleHypothesis partHyp = Trk::pion) const;
/** Input : track, parthyp
Return: A pointer to a new Trk::Track which containes the information of the input track plus the tsos of the identified holes
The parthyp argument is relevant for the extrapolation steps in the hole search.
Attention: This is a factory, ownership of the return track is passed to the calling method.
*/
const Trk::Track* getTrackWithHoles(const Trk::Track& track,
const Trk::ParticleHypothesis partHyp = Trk::pion) const;
/** Input : track, parthyp
Return: A pointer to a new Trk::Track which containes the information of the input track plus the tsos of the identified holes or outliers
The parthyp argument is relevant for the extrapolation steps in the hole search.
Attention: This is a factory, ownership of the return track is passed to the calling method.
*/
const Trk::Track* getTrackWithHolesAndOutliers(const Trk::Track& track,
const Trk::ParticleHypothesis partHyp = Trk::pion) const;
private:
// configurables
//----------------------------------
ToolHandle<Trk::IExtrapolator> m_extrapolator;
ServiceHandle<IInDetConditionsSvc> m_conditions_svc;
bool m_use_conditions_svc;
float m_outer_radius;
float m_max_z;
int m_max_trailing_holes;
bool m_begin_at_first_trt_hit;
bool m_end_at_last_trt_hit;
bool m_bcheck;
bool m_do_dump_bad_straw_log;
float m_locR_cut;
float m_locR_sigma_cut;
float m_locZ_cut;
// private data
//----------------------------------
mutable bool m_has_been_called;
const TRT_ID* m_TRT_ID;
Trk::CylinderSurface* m_trt_outer_surf;
// private methods
//----------------------------------
int extrapolateBetweenHits(const Trk::TrackParameters* start_parameters,
const Trk::Surface& end_surf,
DataVector<const Trk::TrackStateOnSurface>* holes,
const Trk::ParticleHypothesis partHyp = Trk::pion) const;
void dump_bad_straw_log() const;
DataVector<const Trk::TrackStateOnSurface>::const_iterator
find_first_trt_hit(const DataVector<const Trk::TrackStateOnSurface>& track_states) const;
DataVector<const Trk::TrackStateOnSurface>::const_iterator
find_last_hit_before_trt(const DataVector<const Trk::TrackStateOnSurface>& track_states) const;
const Trk::Track* addHolesToTrack(
const Trk::Track& track,
const DataVector<const Trk::TrackStateOnSurface>* holes) const;
};
#endif // TRT_TrackHoleSearch_TRTTrackHoleSearchTool_h
package TRT_TrackHoleSearch
author Ryan Reece <ryan.reece@cern.ch>
#--------------------------------------------------------------------
public
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use AthenaBaseComps AthenaBaseComps-* Control
use TrkParameters TrkParameters-* Tracking/TrkEvent
use TrkToolInterfaces TrkToolInterfaces-* Tracking/TrkTools
use TrigDecisionInterface TrigDecisionInterface-* Trigger/TrigEvent
end_public
#--------------------------------------------------------------------
private
use EventInfo EventInfo-* Event
use AtlasCLHEP AtlasCLHEP-* External
use AtlasROOT AtlasROOT-* External
use VxVertex VxVertex-* Tracking/TrkEvent
use Identifier Identifier-* DetectorDescription
use InDetConditionsSummaryService InDetConditionsSummaryService-* InnerDetector/InDetConditions
use TRT_ConditionsServices TRT_ConditionsServices-* InnerDetector/InDetConditions
use InDetIdentifier InDetIdentifier-* InnerDetector/InDetDetDescr
use InDetRIO_OnTrack InDetRIO_OnTrack-* InnerDetector/InDetRecEvent
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent
use TrkTrack TrkTrack-* Tracking/TrkEvent
use TrkTrackSummary TrkTrackSummary-* Tracking/TrkEvent
use TrkEventUtils TrkEventUtils-* Tracking/TrkEvent
use TrkExInterfaces TrkExInterfaces-* Tracking/TrkExtrapolation
use EventPrimitives EventPrimitives-* Event
end_private
#--------------------------------------------------------------------
apply_pattern declare_joboptions files="*.py"
apply_tag ROOTMathLibs
apply_pattern component_library
library TRT_TrackHoleSearch *.cxx components/*.cxx
#!/usr/bin/env python
__author__ = 'Ryan D. Reece <ryan.reece@cern.ch>'
__date__ = '2009-04-20'
__copyright__ = 'Copyright 2010 Ryan D. Reece'
__license__ = 'GPL <http://www.gnu.org/licenses/gpl.html>'
__doc__ = """
NAME
print_hole_log.py - Creates a log file of TRT holes.
SYNOPSIS
print_hole_log.py (no arguments)
DESCRIPTION
Creates a log file of TRT holes from reading Ryan's
trt_eff.root ntuple for TRT straw efficiency studies.
AUTHOR
%(author)s
COPYRIGHT
%(copyright)s
License: %(license)s
%(date)s
""" % {'author':__author__, 'date':__date__, 'copyright':__copyright__, 'license':__license__}
#------------------------------------------------------------------------------
import sys
import ROOT, ROOT_vector_vector
#______________________________________________________________________________
def main(argv):
f = ROOT.TFile('trt_eff.root', 'READ')
t = f.Get('trt_eff')
o = file('trt_holes.log', 'w')
event_number = 0
# loop over tracks
nentries = t.GetEntries()
for i in xrange(nentries):
t.GetEntry(i)
if event_number != t.event_number:
# new event
event_number = t.event_number
o.write('======================================================================================\n')
o.write(' Run: %10s, LB: %10s, Event: %10s\n' % (t.run_number, t.lumi_block, t.event_number) )
o.write('======================================================================================\n')
o.write('--------------------------------------------------------------------------------------\n')
o.write(' Track pT: %4g, eta: %3f, phi: %3f, d0: %4g, z0: %4g\n' % (t.track_pt, t.track_eta, t.track_phi, t.track_d0, t.track_z0) )
o.write(' # pix hits: %3i, # SCT hits: %3i, # TRT hits: %3i\n' % (t.n_pixel_hits, t.n_sct_hits, t.n_trt_hits) )
o.write(' # pix holes: %3i, # SCT holes: %3i, # TRT holes: %3i\n' % (t.n_pixel_holes, t.n_sct_holes, t.n_trt_holes) )
o.write('------ TRT holes -------------------------------\n')
o.write(' # bec phi layer strawlayer straw locR locR_error x y z\n')
# loop over holes
n_holes = len(t.hole_det)
for i in xrange(n_holes):
if t.hole_det[i] == 3: # TRT
o.write('%(n)3i %(bec)3i %(phi)3i %(layer)3i %(strawlayer)3i %(straw)3i %(locR)8.4g %(locR_error)11.2g %(x)8.4g %(y)8.4g %(z)8.4g\n' % {
'n' : i+1,
'bec' : t.hole_bec[i],
'phi' : t.hole_phi[i],
'layer' : t.hole_layer[i],
'strawlayer' : t.hole_strawlayer[i],
'straw' : t.hole_straw[i],
'locR' : t.hole_locR[i],
'locR_error' : t.hole_locR_error[i],
'x' : t.hole_x[i],
'y' : t.hole_y[i],
'z' : t.hole_z[i],
} )
#______________________________________________________________________________
if __name__ == '__main__':
main(sys.argv[1:])
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE LumiRangeCollection SYSTEM "http://atlas-runquery.cern.ch/LumiRangeCollection.dtd">
<!-- Good-runs-list created by AtlRunQuery.py on 2011-01-19 15:56:14.517651 -->
<LumiRangeCollection>
<NamedLumiRange>
<Name>MyLBCollection</Name>
<Version>2.1</Version>
<Metadata Name="Query">find run 167607 and dq pix LBSUMM#DetStatus-v03-repro05-00 g and dq CP_TRACKING LBSUMM#DetStatus-v03-repro05-00 g and dq GLOBAL_STATUS LBSUMM#DetStatus-v03-repro05-00 g and dq ATLSOL LBSUMM#DetStatus-v03-repro05-00 g</Metadata>
<Metadata Name="RunList">167607</Metadata>
<Metadata Name="RQTSVNVersion">CoolRunQuery-00-03-56</Metadata>
<Metadata Name="StreamListInfo">
<Stream Name="physics_CosmicCalo" TotalNumOfEvents="427890" NumOfSelectedEvents="336384"/>
<Stream Name="physics_CosmicMuons" TotalNumOfEvents="10203" NumOfSelectedEvents="10203"/>
<Stream Name="physics_Egamma" TotalNumOfEvents="3886539" NumOfSelectedEvents="3886539"/>
<Stream Name="physics_EnhancedBias" TotalNumOfEvents="237283" NumOfSelectedEvents="237283"/>
<Stream Name="physics_IDCosmic" TotalNumOfEvents="1716" NumOfSelectedEvents="1716"/>
<Stream Name="physics_JetTauEtmiss" TotalNumOfEvents="4832983" NumOfSelectedEvents="4832983"/>
<Stream Name="physics_MinBias" TotalNumOfEvents="651906" NumOfSelectedEvents="651906"/>
<Stream Name="physics_Muons" TotalNumOfEvents="5709963" NumOfSelectedEvents="5709963"/>
<Stream Name="physics_Standby" TotalNumOfEvents="177915" NumOfSelectedEvents="0"/>
<Stream Name="physics_ZeroBias" TotalNumOfEvents="28596" NumOfSelectedEvents="28596"/>
</Metadata>
<LumiBlockCollection>
<Run>167607</Run>
<LBRange Start="86" End="430"/>
</LumiBlockCollection>
</NamedLumiRange>
</LumiRangeCollection>
\ No newline at end of file
#--------------------------------------------------------------
# options
#--------------------------------------------------------------
if not 'sample' in globals():
sample = 'mc' # 'data' or 'mc'
if not 'do_grl' in globals():
do_grl = True
#--------------------------------------------------------------
# input samples
#--------------------------------------------------------------
from glob import glob
if sample == 'data':
# file_list = glob('/local_data0/reece/data/trt_eff/data/data10_7TeV.00167607.physics_Egamma.merge.ESD.r1774_p327_tid203271_00/ESD*.root*')
file_list = glob('/local_data0/reece/data/trt_eff/data/data10_7TeV.00167607.physics_JetTauEtmiss.merge.ESD.r1774_p327_tid203202_00/ESD*.root*')
file_list.sort()
# output_ntuple = 'trt_eff.data10_7TeV.00167607.physics_Egamma.root'
output_ntuple = 'trt_eff.data10_7TeV.00167607.physics_JetTauEtmiss.root'
elif sample == 'mc':
file_list = glob('/local_data0/reece/data/trt_eff/mc/mc10_valid.105012.J3_pythia_jetjet.recon.ESD.e574_s934_s946_r1624_tid177734_00/ESD*.root*')
file_list.sort()
output_ntuple = 'trt_eff.mc10_valid.105012.J3_pythia_jetjet.root'
else:
pass
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.FilesInput = file_list
import AthenaPython.ConfigLib as apcl
cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig', input_files=athenaCommonFlags.FilesInput())
cfg.configure_job()
theApp.EvtMax = 10
#------------------------------------------------------------------------------
# Good Run List
#------------------------------------------------------------------------------
if do_grl and sample == 'data':
# add LumiBlockMetaDataTool to ToolSvc and configure
from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool
theLumiBlockMetaDataTool = LumiBlockMetaDataTool( "LumiBlockMetaDataTool" )
theLumiBlockMetaDataTool.calcLumi = False # False by default
theLumiBlockMetaDataTool.storeXMLFiles = True
theLumiBlockMetaDataTool.applyDQCuts = True
theLumiBlockMetaDataTool.OutputLevel = INFO
ToolSvc += theLumiBlockMetaDataTool
# add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc
from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
theMetaDataSvc = MetaDataSvc( "MetaDataSvc" )
theMetaDataSvc.MetaDataTools += [ theLumiBlockMetaDataTool ]
svcMgr += theMetaDataSvc
# Configure the goodrunslist selector tool
from GoodRunsLists.GoodRunsListsConf import *
theGoodRunsListSelectorTool = GoodRunsListSelectorTool()
theGoodRunsListSelectorTool.GoodRunsListVec = [ 'MyLBCollection.xml' ]
theGoodRunsListSelectorTool.PassThrough = False
theGoodRunsListSelectorTool.OutputLevel = INFO
ToolSvc += theGoodRunsListSelectorTool
## This Athena job consists of algorithms that loop over events;
## here, the (default) top sequence is used:
from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
job = AlgSequence()
seq = AthSequencer("AthFilterSeq")
## GRL selector, dummy ntuple dumper
from GoodRunsListsUser.GoodRunsListsUserConf import *
theGRLTriggerSelectorAlg = GRLTriggerSelectorAlg('GRLTriggerAlg1')
theGRLTriggerSelectorAlg.GoodRunsListArray = ['MyLBCollection']
theGRLTriggerSelectorAlg.OutputLevel = INFO
# theGRLTriggerSelectorAlg.TriggerSelectionRegistration = 'L1_MBTS_1' # 'L1_MBTS_1_1' #'L1_RD0_EMPTY'
seq += theGRLTriggerSelectorAlg
# theDummyDumperAlg = DummyDumperAlg('DummyDumperAlg1')
# theDummyDumperAlg.RootFileName = 'selection1.root'
# theDummyDumperAlg.GRLNameVec = [ 'LumiBlocks_GoodDQ0', 'IncompleteLumiBlocks_GoodDQ0' ]
# job += theDummyDumperAlg
#--------------------------------------------------------------
# Control
#--------------------------------------------------------------
# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
OutputLevel = INFO
# --- produce an atlantis data file
doJiveXML = False
# --- run the Virtual Point 1 event visualisation
doVP1 = False
# --- controls what is written out. ESD includes AOD, so it's normally enough
doWriteESD = False
doWriteAOD = False
# --- do auditors ?
doAuditors = False
import os
if os.environ['CMTCONFIG'].endswith('-dbg'):
# --- do EDM monitor (debug mode only)
doEdmMonitor = True
# --- write out a short message upon entering or leaving each algorithm
doNameAuditor = True
else: