From c0bd3970dceac31f13543a2342b7e4e33e530c2f Mon Sep 17 00:00:00 2001 From: sshively <savannah.rose.shively@cern.ch> Date: Thu, 24 Jun 2021 01:11:07 +0200 Subject: [PATCH] cleanup. energyloss attempt --- .../ClusterReadExample/src/ClusterReadAlg.cxx | 37 ++++++++----------- .../ClusterReadExample/src/ClusterReadAlg.h | 12 ++---- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx index 2f989c96..94e0f16c 100644 --- a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx +++ b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.cxx @@ -44,7 +44,6 @@ ClusterReadAlg::ClusterReadAlg(const std::string& name, ISvcLocator* pSvcLocator // Initialize method: StatusCode ClusterReadAlg::initialize() { ATH_MSG_INFO("ClusterReadAlg::initialize()"); - //std::cout<<m_numberOfEvents; ATH_CHECK(m_mcEventKey.initialize() ); ATH_CHECK( m_faserSiHitKey.initialize() ); //TH_CHECK( m_faserRdoKey.initialize()); @@ -56,31 +55,22 @@ StatusCode ClusterReadAlg::initialize() { // Get the SCT ID helper ATH_CHECK(detStore()->retrieve(m_idHelper, "FaserSCT_ID")); - - // Histograms - m_chi2 = new TH1F("chi2", "Fit #chi^2;#chi^2;Events/bin", 100, 0, 50); + // Histograms + // 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("mc_Event", &m_mcEventKey2, "chi2/F"); + m_tree->Branch("mc_Event", &m_mcEventKey, "mcEvent/F"); m_tree->Branch("waveformExists", &m_waveformExists, "waveform/B"); m_tree->Branch("station", &m_station, "station/I"); + //hist test + m_hist = new TH1D("Stations", "Stations hit", 4, 0, 3); + ATH_CHECK(histSvc()->regHist("/HIST/myhist", m_hist)); + m_hist2 = new TH1D("EnergyLoss", "Energy",100,0,0.1); + ATH_CHECK(histSvc()->regHist("/HIST/Ehist", m_hist2)); - //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)); return StatusCode::SUCCESS; @@ -131,9 +121,12 @@ StatusCode ClusterReadAlg::execute(const EventContext& ctx) const int row =hit.getRow(); int module = hit.getModule(); int sensor = hit.getSensor(); - std::cout<<"St:"<<station<<"\tPl:"<<plane<<"\tMod:"<<module<<"\n"; - - m_station[station]++; + int energyloss= hit.energyLoss(); + //std::cout<<"St:"<<station<<"\tPl:"<<plane<<"\tMod:"<<module<<"\n"; + std::cout<<"\nENERGY LOSS"<<energyloss<<'\n'; + ++m_station[station]; + m_hist->Fill(station); + if (energyloss!=0) m_hist2->Fill(energyloss); } //SG::ReadHandle<FaserSCT_RDO_Container> h_sctRDO(m_faserRdoKey); @@ -155,8 +148,8 @@ StatusCode ClusterReadAlg::finalize() ATH_MSG_INFO( m_numberOfTriggeredEvents << " triggered events processed" ); ATH_MSG_INFO( m_numberOfClusterCollection<< " cluster collections processed" ); ATH_MSG_INFO( m_numberOfCluster<< " cluster processed" ); - ATH_MSG_INFO( m_numberOfFits << " fits performed" ); + ATH_MSG_INFO("station distribution" << m_station[0] << m_station[1]<< m_station[2]<< m_station[3]); diff --git a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h index 70adcbfb..26d0f755 100644 --- a/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h +++ b/Control/CalypsoExample/ClusterReadExample/src/ClusterReadAlg.h @@ -105,22 +105,16 @@ class ClusterReadAlg : public AthReentrantAlgorithm, AthHistogramming //SG::ReadHandleKey<TrackerSimDataCollection> m_sctMap {this, "TrackerSimDataCollection", "SCT_SDO_Map"}; - - mutable TH1* m_chi2; mutable TTree* m_tree; mutable int m_hash; - mutable float m_residual; - mutable float m_pull; - mutable float m_refitChi2; - mutable float m_mcEventKey2; mutable bool m_waveformExists; - mutable int m_station[5]={}; + mutable int m_station[5]={}; //replace with coordinate vector later + mutable float m_energyLoss; mutable std::atomic<int> m_numberOfEvents{0}; mutable std::atomic<int> m_numberOfTriggeredEvents{0}; mutable std::atomic<int> m_numberOfClusterCollection{0}; mutable std::atomic<int> m_numberOfCluster{0}; - mutable std::atomic<int> m_numberOfFits{0}; //isvalids mutable bool m_triggerisValid = false; @@ -128,7 +122,7 @@ class ClusterReadAlg : public AthReentrantAlgorithm, AthHistogramming //RDO TH1* m_hist; // Example histogram - TH1* m_incAnglHist; + TH1* m_hist2; TProfile* m_hprof; -- GitLab