Skip to content
Snippets Groups Projects
Commit 5e7f84a0 authored by Savannah Rose Shively's avatar Savannah Rose Shively
Browse files

tracker efficiency setup

parent 3699aca3
No related branches found
No related tags found
No related merge requests found
Pipeline #2980867 failed
################################################################################
# Package: TrackerEfficiencyExample
################################################################################
# Declare the package name:
atlas_subdir( TrackerEfficiencyExample )
# Component(s) in the package:
atlas_add_component( TrackerEfficiencyExample
src/*.cxx src/*.h
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps xAODFaserWaveform ScintRawEvent
GaudiKernel
AthViews StoreGateLib SGtests )
#atlas_install_headers( TrackerPrepRawDataFormation )
atlas_install_python_modules( python/*.py )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#!/usr/bin/env python
import sys
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def TrackerEfficiencyExampleCfg(flags, **kwargs):
"""Return ComponentAccumulator for TrackerEfficiencyAlg"""
acc = ComponentAccumulator()
Tracker__TrackerEfficiencyAlg=CompFactory.TrackerEfficiencyAlg
acc.addEventAlgo(Tracker__TrackerEfficiencyAlg(**kwargs))
thistSvc = CompFactory.THistSvc()
thistSvc.Output += ["HIST DATAFILE='TrackerEfficiencyHistograms.root' OPT='RECREATE'"]
acc.addService(thistSvc)
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
from CalypsoConfiguration.AllConfigFlags import ConfigFlags
Configurable.configurableRun3Behavior = True
# Flags for this job
ConfigFlags.Input.isMC = True # Needed to bypass autoconfig
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-01" # Needed to bypass autoconfig, only the "OFLCOND" matters at the moment
ConfigFlags.GeoModel.FaserVersion = "FASER-01" # Default FASER geometry
#REPLACE WITH FRIEDMAN STUFF==========
#ConfigFlags.Detector.SimulateFaserSCT = True
ConfigFlags.Input.Files = ["run001332.ESD.pool.root"] #["cosmics.HITS.pool.root"]#["my.COSMICHITS.pool.root"]
ConfigFlags.lock()
#=========================
# Configure components
from CalypsoConfiguration.MainServicesConfig import MainServicesCfg
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
acc = MainServicesCfg(ConfigFlags)
acc.merge(PoolReadCfg(ConfigFlags))
# Set things up to create a conditions DB with neutral Tracker alignment transforms
acc.merge(TrackerEfficiencyExampleCfg(ConfigFlags))
# Execute and finish
sys.exit(int(acc.run(maxEvents=-1).isFailure()))
# __author__ = 'Savannah Shively'
\ No newline at end of file
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/** @file TrackerEfficiencyAlg.cxx
* Implementation file for the TrackerEfficiencyAlg class.
* @author Savannah Shively
* @date 2 September 2021
*/
#include "TrackerEfficiencyAlg.h"
#include "StoreGate/ReadHandle.h"
#include <TH1F.h>
#include <TTree.h>
#include <TBranch.h>
//static const std::string moduleFailureReason{"TrackerEfficiencyAlg: Exceeds max clusters"};
// Constructor with parameters:
TrackerEfficiencyAlg::TrackerEfficiencyAlg(const std::string& name, ISvcLocator* pSvcLocator) :
AthReentrantAlgorithm(name, pSvcLocator),
AthHistogramming( name ),
m_idHelper{nullptr},
m_histSvc ( "THistSvc/THistSvc", name ){}
// Initialize method:
StatusCode TrackerEfficiencyAlg::initialize() {
ATH_MSG_INFO("TrackerEfficiencyAlg::initialize()");
// Tree
m_tree = new TTree("residTree","Cosmics residuals");
//hist test
m_hist = new TH1D("Stations", "Stations hit", 4, 0, 3);
ATH_CHECK(histSvc()->regHist("/HIST/myhist", m_hist));
return StatusCode::SUCCESS;
}
StatusCode TrackerEfficiencyAlg::execute(const EventContext& ctx) const
{
// Done
return StatusCode::SUCCESS;
}
StatusCode TrackerEfficiencyAlg::finalize()
{
ATH_MSG_INFO("TrackerEfficiencyAlg::finalize()");
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/** @file TrackerEfficiencyAlg.cxx
* Implementation file for the TrackerEfficiencyAlg class.
* @author Savannah Shively
* @date 2 September 2021
*/
#ifndef FASERTrackerEfficiency_TrackerEfficiencyALG_H
#define FASERTrackerEfficiency_TrackerEfficiencyALG_H
// Base class
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaBaseComps/AthHistogramming.h"
//Gaudi
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
//STL
#include <map>
#include <string>
//RDO
#include <TH1.h>
#include <math.h>
#include <TProfile.h>
class FaserSCT_ID;
class ISvcLocator;
class StatusCode;
class TH1;
class TTree;
namespace Trk
{
class TrackStateOnSurface;
}
class TrackerEfficiencyAlg : public AthReentrantAlgorithm, AthHistogramming
{
public:
/// Constructor with parameters:
TrackerEfficiencyAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~TrackerEfficiencyAlg(){};
/** @name Usual algorithm methods */
//@{
///Retrieve the tools used and initialize variables
virtual StatusCode initialize() override;
///Form clusters and record them in StoreGate (detector store)
virtual StatusCode execute(const EventContext& ctx) const override;
///Clean up and release the collection containers
virtual StatusCode finalize() override;
//Make this algorithm clonable.
virtual bool isClonable() const override { return true; }
//@}
const ServiceHandle<ITHistSvc>& histSvc() const;
private:
/** @name Disallow default instantiation, copy, assignment */
//@{
TrackerEfficiencyAlg() = delete;
TrackerEfficiencyAlg(const TrackerEfficiencyAlg&) = delete;
TrackerEfficiencyAlg &operator=(const TrackerEfficiencyAlg&) = delete;
//@}
const FaserSCT_ID* m_idHelper;
ServiceHandle<ITHistSvc> m_histSvc;
mutable TTree* m_tree;
//RDO
TH1* m_hist; // Example histogram
};
// For the THistSvc
inline const ServiceHandle<ITHistSvc>& TrackerEfficiencyAlg::histSvc() const
{
return m_histSvc;
}
#endif // FASERTrackerEfficiency_TrackerEfficiencyLG_H
#include "../TrackerEfficiencyAlg.h"
DECLARE_COMPONENT( TrackerEfficiencyAlg ) //change alg name if update file/class etc
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