diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/CMakeLists.txt b/Control/CalypsoExample/TrackerEfficiencyExample/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6313afbe62a89f23f246299409aadbf99a88b2f --- /dev/null +++ b/Control/CalypsoExample/TrackerEfficiencyExample/CMakeLists.txt @@ -0,0 +1,17 @@ +################################################################################ +# 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 ) diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/python/TrackerEfficiencyConfig.py b/Control/CalypsoExample/TrackerEfficiencyExample/python/TrackerEfficiencyConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..178c1b87952210890af171bafcde1f50643da908 --- /dev/null +++ b/Control/CalypsoExample/TrackerEfficiencyExample/python/TrackerEfficiencyConfig.py @@ -0,0 +1,48 @@ +# 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())) + + diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/python/__init__.py b/Control/CalypsoExample/TrackerEfficiencyExample/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..eaec2db0a9e570f578a21e647c2d7d4c42d9bad5 --- /dev/null +++ b/Control/CalypsoExample/TrackerEfficiencyExample/python/__init__.py @@ -0,0 +1 @@ +# __author__ = 'Savannah Shively' \ No newline at end of file diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.cxx b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..033918d16832a16d8e16214244544f99f2b95253 --- /dev/null +++ b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.cxx @@ -0,0 +1,53 @@ +/* + 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; +} + + diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.h b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..cfaf444f5f53ebdc5f6feae488d4d34b2ba196ad --- /dev/null +++ b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.h @@ -0,0 +1,89 @@ +/* + 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 + + + diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/src/components/TrackerEfficiencyExample_entries.cxx b/Control/CalypsoExample/TrackerEfficiencyExample/src/components/TrackerEfficiencyExample_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d2e8b1147d195b57b8452a39550fcaddfac673c2 --- /dev/null +++ b/Control/CalypsoExample/TrackerEfficiencyExample/src/components/TrackerEfficiencyExample_entries.cxx @@ -0,0 +1,3 @@ +#include "../TrackerEfficiencyAlg.h" + +DECLARE_COMPONENT( TrackerEfficiencyAlg ) //change alg name if update file/class etc