diff --git a/Control/CalypsoExample/ClusterReadExample/CMakeLists.txt b/Control/CalypsoExample/ClusterReadExample/CMakeLists.txt index d0600df5c54fc14297139c8208037de528e741f7..96adceb7fa283db3f1d41bb93422ecd5f21c3bd7 100644 --- a/Control/CalypsoExample/ClusterReadExample/CMakeLists.txt +++ b/Control/CalypsoExample/ClusterReadExample/CMakeLists.txt @@ -9,7 +9,7 @@ atlas_subdir( ClusterReadExample ) atlas_add_component( ClusterReadExample src/*.cxx src/*.h src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps AthViews StoreGateLib SGtests Identifier GaudiKernel TrackerRawData TrackerPrepRawData FaserDetDescr TrackerIdentifier TrackerReadoutGeometry xAODFaserTrigger TrkTrack TrkEventPrimitives TrkRIO_OnTrack GeneratorObjects) + LINK_LIBRARIES AthenaBaseComps AthViews StoreGateLib SGtests Identifier GaudiKernel TrackerRawData TrackerPrepRawData FaserDetDescr TrackerIdentifier TrackerReadoutGeometry xAODFaserTrigger TrkTrack TrkEventPrimitives TrackerSimEvent TrkRIO_OnTrack GeneratorObjects) atlas_install_python_modules( python/*.py ) diff --git a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx index 306f7a1541cfd83a4a789533bacea67f448e6945..2f989c96be67b51525499d4e5c3f46754c40a913 100644 --- a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx +++ b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx @@ -46,7 +46,7 @@ StatusCode ClusterReadAlg::initialize() { ATH_MSG_INFO("ClusterReadAlg::initialize()"); //std::cout<<m_numberOfEvents; ATH_CHECK(m_mcEventKey.initialize() ); - //ATH_CHECK( m_faserSiHitKey.initialize() ); + ATH_CHECK( m_faserSiHitKey.initialize() ); //TH_CHECK( m_faserRdoKey.initialize()); //ATH_CHECK( m_sctMap.initialize()); ATH_CHECK(m_faserTriggerDataKey.initialize()); @@ -63,23 +63,24 @@ StatusCode ClusterReadAlg::initialize() { // Tree m_tree = new TTree("residTree","Cosmics residuals"); m_tree->Branch("id", &m_hash, "id/I"); - 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("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("waveformExists", &m_waveformExists, "waveform/B"); + m_tree->Branch("station", &m_station, "station/I"); - ATH_CHECK(histSvc()->regHist("/HIST/chi2", m_chi2)); + //ATH_CHECK(histSvc()->regHist("/HIST/chi2", m_chi2)); ATH_CHECK(histSvc()->regTree("/HIST/residTree", m_tree)); //rdo - m_hist = new TH1D("GroupSize", "RDO Group Size", 8, 0, 8); //first string is root object name, second is histogram title - m_hprof = new TProfile("IncAngleGroup", "Mean Group Size vs Incident Angle", 10, -.1, .1 ,0,5); - m_incAnglHist = new TH1D("IncAngleHist", "Incident Angle Count", 10, -.1, .1); - ATH_CHECK(histSvc()->regHist("/HIST/myhist", m_hist)); - ATH_CHECK(histSvc()->regHist("/HIST/myhistprof", m_hprof)); - ATH_CHECK(histSvc()->regHist("/HIST/myhistAngl", m_incAnglHist)); + //m_hist = new TH1D("GroupSize", "RDO Group Size", 8, 0, 8); //first string is root object name, second is histogram title + //m_hprof = new TProfile("IncAngleGroup", "Mean Group Size vs Incident Angle", 10, -.1, .1 ,0,5); + //m_incAnglHist = new TH1D("IncAngleHist", "Incident Angle Count", 10, -.1, .1); + //ATH_CHECK(histSvc()->regHist("/HIST/myhist", m_hist)); + //ATH_CHECK(histSvc()->regHist("/HIST/myhistprof", m_hprof)); + //ATH_CHECK(histSvc()->regHist("/HIST/myhistAngl", m_incAnglHist)); return StatusCode::SUCCESS; @@ -116,16 +117,29 @@ 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; + if (m_clusterisValid || m_triggerisValid) { + m_waveformExists = true; + } + // 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<FaserSiHitCollection> h_siHits(m_faserSiHitKey); + ATH_MSG_INFO("Read FaserSiHitCollection with " << h_siHits->size() << " hits"); + + for (const FaserSiHit& hit : *h_siHits){ + int station= hit.getStation(); + int plane =hit.getPlane(); + int row =hit.getRow(); + int module = hit.getModule(); + int sensor = hit.getSensor(); + std::cout<<"St:"<<station<<"\tPl:"<<plane<<"\tMod:"<<module<<"\n"; + m_station[station]++; + + } //SG::ReadHandle<FaserSCT_RDO_Container> h_sctRDO(m_faserRdoKey); //SG::ReadHandle<TrackerSimDataCollection> h_collectionMap(m_sctMap); - //m_waveformExists = true; + m_tree->Fill(); diff --git a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h index 2eb1fea1460ea65e1cb49773aa34f76d96192724..70adcbfb0938fcf5fd865dfc9cb6473c8d24f40c 100644 --- a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h +++ b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h @@ -36,7 +36,7 @@ #include <math.h> #include <TProfile.h> #include "GeneratorObjects/McEventCollection.h" -//#include "TrackerSimEvent/FaserSiHitCollection.h" +#include "TrackerSimEvent/FaserSiHitCollection.h" #include "TrackerRawData/FaserSCT_RDO_Container.h" //#include "TrackerSimData/TrackerSimDataCollection.h" @@ -100,7 +100,7 @@ class ClusterReadAlg : public AthReentrantAlgorithm, AthHistogramming //RDO SG::ReadHandleKey<McEventCollection> m_mcEventKey { this, "McEventCollection", "TruthEvent" }; - //SG::ReadHandleKey<FaserSiHitCollection> m_faserSiHitKey { this, "FaserSiHitCollection", "SCT_Hits" }; + 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"}; @@ -114,6 +114,7 @@ class ClusterReadAlg : public AthReentrantAlgorithm, AthHistogramming mutable float m_refitChi2; mutable float m_mcEventKey2; mutable bool m_waveformExists; + mutable int m_station[5]={}; mutable std::atomic<int> m_numberOfEvents{0}; mutable std::atomic<int> m_numberOfTriggeredEvents{0};