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

'CMakeLists.txt' (InDetCosmicsFilters-00-00-21)

parent c6f27d4b
################################################################################
# Package: InDetCosmicsFilters
################################################################################
# Declare the package name:
atlas_subdir( InDetCosmicsFilters )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
PRIVATE
Control/StoreGate
DetectorDescription/AtlasDetDescr
DetectorDescription/Identifier
GaudiKernel
Tracking/TrkEvent/TrkRIO_OnTrack
Tracking/TrkEvent/TrkTrack )
# Component(s) in the package:
atlas_add_component( InDetCosmicsFilters
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests AtlasDetDescr Identifier GaudiKernel TrkRIO_OnTrack TrkTrack )
# Install files from the package:
atlas_install_headers( InDetCosmicsFilters )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// TrackFilter.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef INDETTRACKFILTER_H
#define INDETTRACKFILTER_H
// Gaudi includes
#include "AthenaBaseComps/AthAlgorithm.h"
#include <string>
class AtlasDetectorID;
namespace InDet
{
/** @class TrackFilter
Select potentially interesting events to slim the amount of events to process each time
@author Christian Schmitt <Christian.Schmitt@cern.ch>
*/
class TrackFilter : public AthAlgorithm
{
public:
/** Standard Athena-Algorithm Constructor */
TrackFilter(const std::string& name, ISvcLocator* pSvcLocator);
/** Default Destructor */
~TrackFilter();
/** standard Athena-Algorithm method */
StatusCode initialize();
/** standard Athena-Algorithm method */
StatusCode execute();
/** standard Athena-Algorithm method */
StatusCode finalize();
private:
/** member variables for algorithm properties: */
std::vector<std::string> m_inputTrackCollectionNames; //!< Name of the Track Collections to read in
int m_minTRTHits; //!< Minimal number of TRT Hits
int m_minSCTHits; //!< Minimal number of SCT Hits
int m_minPixelHits; //!< Minimal number of Pixel Hits
int m_minIDHits; //!< Minimal number of ID Hits
int m_minSCTonlyHits; //!< Minimal number of SCT Hits for SCT only tracks
int m_minTRTonlyHits; //!< Minimal number of TRT Hits for TRT only tracks
int m_evcount; //!< Event counter
int m_accept; //!< Counter of accepted events
const AtlasDetectorID* m_idHelper; //<! Detector ID helper
};
} // end of namespace
#endif
package InDetCosmicsFilters
author Wouter Hulsbergen
private
use GaudiInterface GaudiInterface-* External
use StoreGate StoreGate-* Control
use TrkTrack TrkTrack-* Tracking/TrkEvent
use TrkRIO_OnTrack TrkRIO_OnTrack-* Tracking/TrkEvent
use AtlasDetDescr AtlasDetDescr-* DetectorDescription
use Identifier Identifier-* DetectorDescription
public
use AtlasPolicy AtlasPolicy-*
use AthenaBaseComps AthenaBaseComps-* Control
apply_pattern component_library
library InDetCosmicsFilters *.cxx components/*.cxx
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage Event filters for Cosmic events
@section IntroductionInDetCosmicsFilters Introduction
This package contains currently one filter for Cosmic events.
The filter (TrackFilter) selects
those events that contain at least one good track in any specified trackcollection. This is meant for Cosmics in the pit where most of the events triggered by the Muon or Calorimeter don't have a track in the Inner Detector.
@author Christian.Schmitt@cern.ch
@author Wouter.Hulsbergen@cern.ch
@section requirementsInDetCosmicsFilters Requirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////////////
// TrackFilter.cxx, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#include "InDetCosmicsFilters/TrackFilter.h"
#include "StoreGate/StoreGateSvc.h"
#include "TrkRIO_OnTrack/RIO_OnTrack.h"
#include "TrkTrack/TrackStateOnSurface.h"
#include "TrkTrack/TrackCollection.h"
#include "Identifier/Identifier.h"
#include "AtlasDetDescr/AtlasDetectorID.h"
//================ Constructor =================================================
InDet::TrackFilter::TrackFilter(const std::string& name, ISvcLocator* pSvcLocator)
:
AthAlgorithm(name,pSvcLocator),
m_inputTrackCollectionNames(),
m_evcount(0),
m_accept(0)
{
// template for property decalration
declareProperty("MinTRTHits", m_minTRTHits=1);
declareProperty("MinSCTHits", m_minSCTHits=1);
declareProperty("MinPixelHits", m_minPixelHits=-1000);
declareProperty("MinIDHits", m_minIDHits=1);
declareProperty("MinSCTonlyHits", m_minSCTonlyHits=6);
declareProperty("MinTRTonlyHits", m_minTRTonlyHits=20);
declareProperty("TrackCollections",m_inputTrackCollectionNames);
}
//================ Destructor =================================================
InDet::TrackFilter::~TrackFilter()
{}
//================ Initialisation =================================================
StatusCode InDet::TrackFilter::initialize()
{
// Code entered here will be executed once at program start.
msg(MSG::INFO) << name() << " initialize()" << endreq;
if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) {
msg(MSG::FATAL) << "Could not get AtlasDetectorID helper" << endreq;
return StatusCode::FAILURE;
}
if(m_inputTrackCollectionNames.size()==0){
msg(MSG::ERROR) << "Configuration problem: TrackFilter configured with empty list of TrackCollections. Please fix your jobOptions!"<<endreq;
return StatusCode::FAILURE;
}
msg(MSG::INFO) << "initialize() successful in " << name() << endreq;
return StatusCode::SUCCESS;
}
//================ Finalisation =================================================
StatusCode InDet::TrackFilter::finalize()
{
// Code entered here will be executed once at the end of the program run.
msg(MSG::INFO) << "finalize() successful in " << name() << endreq;
msg(MSG::INFO) << "Events / accepted = "<<m_evcount <<" / "<<m_accept<<endreq;
return StatusCode::SUCCESS;
}
//================ Execution ====================================================
StatusCode InDet::TrackFilter::execute()
{
bool passed=false;
m_evcount++;
if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "execute() called in " << name() << endreq;
std::vector<std::string>::const_iterator it=m_inputTrackCollectionNames.begin();
std::vector<std::string>::const_iterator itE=m_inputTrackCollectionNames.end();
for(;it!=itE && !passed;it++){
// input TrackSegment Collection
const TrackCollection *tracks = 0;
StatusCode sc = evtStore()->retrieve(tracks, *it);
if(sc.isFailure()){
if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " could not open Track collection : " << *it << endreq;
if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " will skip this collection!!"<<endreq;
}else{
//loop over trackcollection and try to find a "good" track
TrackCollection::const_iterator itrk = tracks->begin();
TrackCollection::const_iterator itrkEnd = tracks->end();
for(; itrk != itrkEnd && !passed; ++itrk) {
const Trk::Track *track=*itrk;
int nscthits=0;
int ntrthits=0;
int npixhits=0;
for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos=track->trackStateOnSurfaces()->begin();
tsos!=track->trackStateOnSurfaces()->end(); ++tsos) {
const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>((*tsos)->measurementOnTrack());
if (hitOnTrack != 0) {
const Identifier& surfaceID = hitOnTrack->identify();
if(m_idHelper->is_sct(surfaceID)){
nscthits++;
}else if(m_idHelper->is_trt(surfaceID)){
ntrthits++;
}else if(m_idHelper->is_pixel(surfaceID)){
npixhits++;
}
}
}
int sumIDhits=nscthits+ntrthits+npixhits;
if((ntrthits>=m_minTRTHits && nscthits >= m_minSCTHits && npixhits >= m_minPixelHits && sumIDhits >= m_minIDHits) ||
(nscthits >= m_minSCTonlyHits) || (ntrthits>=m_minTRTonlyHits))
passed=true;
}
}
}
if(passed){
m_accept++;
}
setFilterPassed( passed );
if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Set filter passed to " << filterPassed() << endreq;
return StatusCode::SUCCESS;
}
//============================================================================================
#include "InDetCosmicsFilters/TrackFilter.h"
#include "GaudiKernel/DeclareFactoryEntries.h"
DECLARE_NAMESPACE_ALGORITHM_FACTORY( InDet , TrackFilter )
DECLARE_FACTORY_ENTRIES( InDetCosmicsFilters )
{
DECLARE_NAMESPACE_ALGORITHM( InDet , TrackFilter )
}
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES( InDetCosmicsFilters )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment