From 227e86508e7e45e802afee5a3f36355cb358aa2d Mon Sep 17 00:00:00 2001 From: Nikola Dikic <nikola.dikic@cern.ch> Date: Thu, 5 Mar 2020 18:13:23 +0100 Subject: [PATCH] Added first histogram - Luminosity block --- .../python/Run3AFPExampleMonitorAlgorithm.py | 4 ++-- .../src/AFPSiLayerAlgorithm.cxx | 21 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py b/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py index 591748f53976..27d8407ae2f7 100644 --- a/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py +++ b/ForwardDetectors/AFP/Run3AFPMonitoring/python/Run3AFPExampleMonitorAlgorithm.py @@ -68,7 +68,7 @@ def Run3AFPExampleMonitoringConfig(inputFlags): # Add a GMT for the other example monitor algorithm # anotherGroup = helper.addGroup(anotherExampleMonAlg,'AFPSiLayer') - AFPGroup.defineHistogram('totHits', title='Luminosity Block;lb;total number of Hits', path='Global',xbins=1000,xmin=-0.5,xmax=999.5,weight='nhits') + AFPGroup.defineHistogram('lb', title='Luminosity Block;lb;total number of Hits', path='Global',xbins=1000,xmin=-0.5,xmax=999.5,weight='nhits') ### STEP 5 ### # Configure histogramsIf you want to create histograms with variable bin widths, ROOT provides another constructor suited for this purpose. Instead of passing the data interval and the number of bins, you have to pass an array (single or double precision) of bin edges. When the histogram has n bins, then there are n+1 distinct edges, so the array you pass must be of size n+1. @@ -142,4 +142,4 @@ if __name__=='__main__': # exampleMonitorAcc.getEventAlgo('ExampleMonAlg').OutputLevel = 2 # DEBUG cfg.printConfig(withDetails=False) # set True for exhaustive info - cfg.run(100) #use cfg.run(20) to only run on first 20 events + cfg.run(1000) #use cfg.run(20) to only run on first 20 events diff --git a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx index 17c9c3ed0717..02fd4178e1d1 100644 --- a/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx +++ b/ForwardDetectors/AFP/Run3AFPMonitoring/src/AFPSiLayerAlgorithm.cxx @@ -68,7 +68,9 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const auto random = Monitored::Scalar<float>("random",0.0); auto testweight = Monitored::Scalar<float>("testweight",1.0); */ - auto totHits = Monitored::Scalar<int>("totHits", 0); // Nikola + auto lb = Monitored::Scalar<int>("lb", 0); // Nikola + auto nhits = Monitored::Scalar<float>("nhits", 1.0); + /* // Two variables (value and passed) needed for TEfficiency auto pT = Monitored::Scalar<float>("pT",0.0); @@ -78,13 +80,15 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const // h_timeOverThreshold = lbAverageInteractionsPerCrossing(ctx); // h_hitMultiplicity = lbAverageInteractionsPerCrossing(ctx); // h_hitMap = lbAverageInteractionsPerCrossing(ctx); - totHits = GetEventInfo(ctx)->lumiBlock(); // Nikola + lb = GetEventInfo(ctx)->lumiBlock(); // Nikola + nhits = 1.0; // This should be changed to: nhits = afpHitContainer.size() ; !!!!!!!!! /* lumiPerBCID = lbAverageInteractionsPerCrossing(ctx); lb = GetEventInfo(ctx)->lumiBlock(); run = GetEventInfo(ctx)->runNumber(); testweight = 2.0; - + + TRandom3 r(ctx.eventID().event_number()); // Example of using flags if (m_doRandom) { @@ -99,7 +103,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const //fill("AFPSiLayer", h_timeOverThreshold, h_hitMultiplicity,lumiPerBCID,lb,random,pT,pT_passed,testweight); //fill("AFPSiLayerAlgorithm",h_hitMultiplicity,lb,random,pT,pT_passed,testweight); //////////fill("AFPSiLayer", h_timeOverThreshold, h_hitMultiplicity); - //fill("AFPSiLayerTool", totHits); + //fill("AFPSiLayerTool", lb); // Alternative fill method. Get the group yourself, and pass it to the fill function. //auto tool = getGroup("AFPSiLayer"); @@ -146,6 +150,7 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const ATH_CHECK( afpHitContainer.initialize() ); //for (const auto& muonItr : *muons) { + //nhits = afpHitContainer.size(); for(const xAOD::AFPSiHit *hitsItr: *afpHitContainer) { std::cout << hitsItr->stationID() << std::endl; @@ -154,10 +159,14 @@ StatusCode AFPSiLayerAlgorithm::fillHistograms( const EventContext& ctx ) const { case 2: std::cout << hitsItr->pixelColIDChip() << std::endl; + std::cout << "Case 2; Test" << std::endl; + //fill(*hitsItr); + fill("AFPSiLayerTool", lb, nhits); break; - //case s_cFarStationIndex: + case 3: + std::cout << "Case 3; Test" << std::endl; //m_cFarStation.fillHistograms(*hitsItr); - //break; + break; default: ATH_MSG_WARNING("Unrecognised station index: " << hitsItr->stationID()); } -- GitLab