From 281a4bf04edf51a3f9cbc41f791eba9d807596cb Mon Sep 17 00:00:00 2001 From: sshively <savannah.rose.shively@cern.ch> Date: Tue, 22 Jun 2021 10:28:30 +0200 Subject: [PATCH] working state --- .../python/ClusterReadExampleConfig.py | 8 +++---- .../ClusterReadExample/src/ClusterReadAlg.cxx | 22 ++++++++++------- .../ClusterReadExample/src/ClusterReadAlg.h | 24 ++++++++++++------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Control/CalypsoExample/ClusterReadExample/python/ClusterReadExampleConfig.py b/Control/CalypsoExample/ClusterReadExample/python/ClusterReadExampleConfig.py index 618575c4..4fce257d 100644 --- a/Control/CalypsoExample/ClusterReadExample/python/ClusterReadExampleConfig.py +++ b/Control/CalypsoExample/ClusterReadExample/python/ClusterReadExampleConfig.py @@ -13,8 +13,8 @@ def ClusterReadExampleCfg(flags, **kwargs): # kwargs.setdefault("DataObjectName", "SCT_RDOs") kwargs.setdefault("ClustersName", "SCT_ClusterContainer") # kwargs.setdefault("SCT_FlaggedCondData", "SCT_Flags") - TEST_ClusterReadAlg=CompFactory.ClusterReadAlg - acc.addEventAlgo(TEST_ClusterReadAlg(**kwargs)) + Tracker__ClusterReadAlg=CompFactory.ClusterReadAlg + acc.addEventAlgo(Tracker__ClusterReadAlg(**kwargs)) thistSvc = CompFactory.THistSvc() thistSvc.Output += ["HIST DATAFILE='ClusterReadHistograms.root' OPT='RECREATE'"] @@ -30,10 +30,10 @@ if __name__ == "__main__": # Flags for this job ConfigFlags.Input.isMC = True # Needed to bypass autoconfig - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" # Needed to bypass autoconfig, only the "OFLCOND" matters at the moment + 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 #ConfigFlags.Detector.SimulateFaserSCT = True - ConfigFlags.Input.Files = ["run001332.ESD.pool.root"]#["my.COSMICHITS.pool.root"] + ConfigFlags.Input.Files = ["cosmics.HITS.pool.root"]#["my.COSMICHITS.pool.root"] ConfigFlags.lock() # Configure components diff --git a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx index b7314a11..306f7a15 100644 --- a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx +++ b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx @@ -29,8 +29,6 @@ POOLCollectiontree - IsSimulation (0 or 1) - event time check issimulation before continuing - coords, energy deposit, etc -- wtf is this doing that isnt done by clusterfit again...? - */ @@ -46,8 +44,11 @@ ClusterReadAlg::ClusterReadAlg(const std::string& name, ISvcLocator* pSvcLocator // Initialize method: StatusCode ClusterReadAlg::initialize() { ATH_MSG_INFO("ClusterReadAlg::initialize()"); - std::cout<<m_numberOfEvents; - + //std::cout<<m_numberOfEvents; + ATH_CHECK(m_mcEventKey.initialize() ); + //ATH_CHECK( m_faserSiHitKey.initialize() ); + //TH_CHECK( m_faserRdoKey.initialize()); + //ATH_CHECK( m_sctMap.initialize()); ATH_CHECK(m_faserTriggerDataKey.initialize()); ATH_CHECK(m_clusterContainerKey.initialize()); ATH_CHECK(m_trackCollection.initialize()); @@ -65,7 +66,7 @@ StatusCode ClusterReadAlg::initialize() { m_tree->Branch("residual", &m_residual, "residual/F"); m_tree->Branch("pull", &m_pull, "pull/F"); m_tree->Branch("chi2", &m_refitChi2, "chi2/F"); - m_tree->Branch("mc_Event", &m_mcEventKey2, "chi2/F"); + //m_tree->Branch("mc_Event", &m_mcEventKey2, "chi2/F"); m_tree->Branch("waveformExists", &m_waveformExists, "waveform/B"); @@ -88,6 +89,7 @@ StatusCode ClusterReadAlg::initialize() { StatusCode ClusterReadAlg::execute(const EventContext& ctx) const { + ++m_numberOfEvents; setFilterPassed(false, ctx); @@ -95,13 +97,13 @@ StatusCode ClusterReadAlg::execute(const EventContext& ctx) const std::unique_ptr<TrackCollection> outputTracks = std::make_unique<TrackCollection>(); SG::ReadHandle<xAOD::FaserTriggerData> triggerContainer{m_faserTriggerDataKey, ctx}; - ATH_CHECK(triggerContainer.isValid()); + m_triggerisValid = triggerContainer.isValid(); ++m_numberOfTriggeredEvents; SG::ReadHandle<Tracker::FaserSCT_ClusterContainer> clusterContainer{m_clusterContainerKey, ctx}; - ATH_CHECK(clusterContainer.isValid()); + m_clusterisValid = clusterContainer.isValid(); // Loop over stations @@ -114,14 +116,16 @@ StatusCode ClusterReadAlg::execute(const EventContext& ctx) const SG::ReadHandle<McEventCollection> h_mcEvents(m_mcEventKey); ATH_MSG_INFO("Read McEventContainer with " << h_mcEvents->size() << " events"); if (h_mcEvents->size() == 0) return StatusCode::FAILURE; + //if (!m_clusterisValid) return StatusCode::FAILURE; + //if (!m_triggerisValid) return StatusCode::FAILURE; // h_mcEvents->at(0)->print( msg().stream() ); //SG::ReadHandle<FaserSiHitCollection> h_siHits(m_faserSiHitKey); //ATH_MSG_INFO("Read FaserSiHitCollection with " << h_siHits->size() << " hits"); - SG::ReadHandle<FaserSCT_RDO_Container> h_sctRDO(m_faserRdoKey); + //SG::ReadHandle<FaserSCT_RDO_Container> h_sctRDO(m_faserRdoKey); //SG::ReadHandle<TrackerSimDataCollection> h_collectionMap(m_sctMap); - m_waveformExists = true; + //m_waveformExists = true; m_tree->Fill(); diff --git a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h index d72f1c1a..2eb1fea1 100644 --- a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h +++ b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h @@ -8,8 +8,8 @@ * @date 28 February 2021 */ -#ifndef FASERCLUSTERFIT_CLUSTERFITALG_H -#define FASERCLUSTERFIT_CLUSTERFITALG_H +#ifndef FASERCLUSTERREAD_CLUSTERREADALG_H +#define FASERCLUSTERREAD_CLUSTERREADALG_H // Base class #include "AthenaBaseComps/AthReentrantAlgorithm.h" @@ -91,13 +91,19 @@ class ClusterReadAlg : public AthReentrantAlgorithm, AthHistogramming SG::ReadHandleKey<xAOD::FaserTriggerData> m_faserTriggerDataKey { this, "FaserTriggerDataKey", "FaserTriggerData", "ReadHandleKey for xAOD::FaserTriggerData" }; SG::ReadHandleKey<Tracker::FaserSCT_ClusterContainer> m_clusterContainerKey { this, "ClustersName", "SCT_ClusterContainer", "FaserSCT cluster container" }; - SG::WriteHandleKey<TrackCollection> m_trackCollection { this, "OutputCollection", "ClusterFit", "Output track collection name" }; + SG::WriteHandleKey<TrackCollection> m_trackCollection { this, "OutputCollection", "ClusterRead", "Output track collection name" }; DoubleProperty m_zCenter { this, "ZCenter", 2300.0, "Global z position at which to reconstruct track parameters"}; UnsignedIntegerProperty m_triggerMask { this, "TriggerMask", 0x0, "Trigger mask to analyze (0 = pass all)" }; /// a handle on the Hist/TTree registration service ServiceHandle<ITHistSvc> m_histSvc; + //RDO + SG::ReadHandleKey<McEventCollection> m_mcEventKey { this, "McEventCollection", "TruthEvent" }; + //SG::ReadHandleKey<FaserSiHitCollection> m_faserSiHitKey { this, "FaserSiHitCollection", "SCT_Hits" }; + SG::ReadHandleKey<FaserSCT_RDO_Container> m_faserRdoKey { this, "FaserSCT_RDO_Container", "SCT_RDOs"}; + //SG::ReadHandleKey<TrackerSimDataCollection> m_sctMap {this, "TrackerSimDataCollection", "SCT_SDO_Map"}; + mutable TH1* m_chi2; @@ -115,16 +121,16 @@ class ClusterReadAlg : public AthReentrantAlgorithm, AthHistogramming mutable std::atomic<int> m_numberOfCluster{0}; mutable std::atomic<int> m_numberOfFits{0}; + //isvalids + mutable bool m_triggerisValid = false; + mutable bool m_clusterisValid = false; + //RDO TH1* m_hist; // Example histogram TH1* m_incAnglHist; TProfile* m_hprof; - SG::ReadHandleKey<McEventCollection> m_mcEventKey { this, "McEventCollection", "TruthEvent" }; - //SG::ReadHandleKey<FaserSiHitCollection> m_faserSiHitKey { this, "FaserSiHitCollection", "SCT_Hits" }; - SG::ReadHandleKey<FaserSCT_RDO_Container> m_faserRdoKey { this, "FaserSCT_RDO_Container", "SCT_RDOs"}; - //SG::ReadHandleKey<TrackerSimDataCollection> m_sctMap {this, "TrackerSimDataCollection", "SCT_SDO_Map"}; - + }; // For the THistSvc @@ -134,4 +140,4 @@ inline const ServiceHandle<ITHistSvc>& ClusterReadAlg::histSvc() const } -#endif // FASERCLUSTERFIT_CLUSTERFITALG_H +#endif // FASERCLUSTERREAD_CLUSTERREADLG_H -- GitLab