Skip to content
Snippets Groups Projects
Commit 8c5a4fca authored by Nikola Dikic's avatar Nikola Dikic
Browse files

Started ToF

parent e8cee7b4
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!36664AFP DQM [rel 22],!36035AFP Run3 merge request - added automatic check,!32548AFP Run3 Monitoring DQ Data Quality - changes in python file,!28689First template for AFP Run3 Monitoring DQ Data Quality
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef AFPTOFALGORITHM_H
#define AFPTOFALGORITHM_H
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoringKernel/Monitored.h"
#include "StoreGate/ReadHandleKey.h"
#include "xAODForward/AFPToFHitContainer.h"
#include "xAODForward/AFPToFHit.h"
#include "TRandom3.h"
class AFPToFAlgorithm : public AthMonitorAlgorithm {
public:
AFPToFAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~AFPToFAlgorithm();
virtual StatusCode initialize() override;
virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
private:
Gaudi::Property<bool> m_doRandom {this,"RandomHist",false};
std::vector<int> m_abGroups1;
std::vector<std::vector<int>> m_abGroups2;
std::map<std::string,int> m_cGroups1;
//std::map<std::string,std::map<std::string,std::map<std::string,int>>> m_HitmapGroups;
std::map<std::string,std::map<std::string,int>> m_HitmapGroups;
SG::ReadHandleKey<xAOD::AFPSiHitContainer> m_afpHitContainerKey;
// m_HitmapGroups = buildToolMap<std::string,std::map<std::string,int>>
protected:
std::vector<std::string> m_pixlayers = { "P0", "P1", "P2", "P3"};
std::vector<std::string> m_stationnames = { "farAside", "nearAside" , "nearCside" , "farCside"};
static const int s_cNearStationIndex;
static const int s_cFarStationIndex;
const std::string m_histsDirectoryName;
};
#endif
......@@ -34,6 +34,9 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPSiLayerAlgorithm
afpSiLayerAlgorithm = helper.addAlgorithm(AFPSiLayerAlgorithm,'AFPSiLayerAlg')
from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPToFAlgorithm
afpToFAlgorithm = helper.addAlgorithm(AFPToFAlgorithm,'AFPToFAlg')
# You can actually make multiple instances of the same algorithm and give
# them different configuration
#anotherExampleMonAlg = helper.addAlgorithm(AFPSiLayerAlgorithm,'AnotherExampleMonAlg')
......@@ -63,6 +66,7 @@ def Run3AFPExampleMonitoringConfig(inputFlags):
# Add a generic monitoring tool (a "group" in old language). The returned
# object here is the standard GenericMonitoringTool.
AFPGroup = helper.addGroup( afpSiLayerAlgorithm, 'AFPSiLayerTool', 'AFP/' )
AFPToFGroup = helper.addGroup( afpToFAlgorithm, 'AFPToFTool', 'AFP/' )
# station0_1 = helper.addGroup(afpSiLayerAlgorithm, 'AFPSiLayer','Station0/')
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*
*
* AFPSiLayerAlgorithm
*
*
*/
#include "Run3AFPMonitoring/AFPSiLayerAlgorithm.h"
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*
*
* AFPToFAlgorithm
*
*
*/
#include "Run3AFPMonitoring/AFPToFAlgorithm.h"
#include "StoreGate/ReadHandleKey.h"
#include "xAODForward/AFPStationID.h"
AFPToFAlgorithm::AFPToFAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
:AthMonitorAlgorithm(name,pSvcLocator)
//, m_histsDirectoryName ("AFP/")
//, m_cNearStation (s_cNearStationIndex)
//, m_cFarStation (s_cFarStationIndex)
, m_afpToFContainerKey("AFPToFContainer")
{
declareProperty( "AFPToFContainer", m_afpToFContainerKey );
}
AFPToFAlgorithm::~AFPToFAlgorithm() {}
StatusCode AFPToFAlgorithm::initialize() {
using namespace Monitored;
m_HitmapGroups = buildToolMap<std::map<std::string,int>>(m_tools,"AFPToFTool",m_stationnames,m_pixlayers);
// std::map<std::string,std::map<std::string,int>> <std::map<std::string,int>>
// We must declare to the framework in initialize what SG objects we are going to use
SG::ReadHandleKey<xAOD::AFPToFContainer> afpToFContainerKey("AFPToFHits");
ATH_CHECK(m_afpToFContainerKey.initialize());
// ...
return AthMonitorAlgorithm::initialize();
}
StatusCode AFPToFAlgorithm::fillHistograms( const EventContext& ctx ) const {
using namespace Monitored;
// Declare the quantities which should be monitored
// My histograms:
// auto h_hitMultiplicity = Monitored::Scalar<int>("h_hitMultiplicity", 0);
// auto h_timeOverThreshold = Monitored::Scalar<int>("h_timeOverThreshold", 0);
// auto h_hitMap = Monitored::Scalar<int>("h_hitMap", 0);
// End
auto lb = Monitored::Scalar<int>("lb", 0); // Nikola
auto nhits = Monitored::Scalar<int>("nhits", 1);
lb = GetEventInfo(ctx)->lumiBlock(); // Nikola
SG::ReadHandle<xAOD::AFPToFContainer> afpToFContainer(m_afpToFContainerKey, ctx);
if(! afpToFContainer.isValid())
{
ATH_MSG_ERROR("evtStore() does not contain hits collection with name " << m_afpToFContainerKey);
return StatusCode::FAILURE;
}
/******************************************
*
* const int xAOD::AFPStationID::farA = 0;
* const int xAOD::AFPStationID::nearA = 1;
* const int xAOD::AFPStationID::nearC = 2;
* const int xAOD::AFPStationID::farC = 3;
*
******************************************/
ATH_CHECK( afpToFContainer.initialize() );
nhits = afpToFContainer->size();
fill("AFPSiLayerTool", lb, nhits);
auto pixelRowIDChip = Monitored::Scalar<int>("pixelRowIDChip", 0); // Nikola
auto pixelColIDChip = Monitored::Scalar<int>("pixelColIDChip", 0); // Nikola
auto h_hitMap = Monitored::Scalar<int>("h_hitMap", 0); // Nikola
for(const xAOD::AFPSiHit *hitsItr: *afpToFContainer)
{
pixelRowIDChip=hitsItr->pixelRowIDChip();
pixelColIDChip = hitsItr->pixelColIDChip();
std::cout << "Hits iteration -> stationID = " << hitsItr->stationID() << std::endl;
std::cout << "Hits iteration -> pixelLayerID = " << hitsItr->pixelLayerID() << std::endl;
if (hitsItr->stationID()<4 && hitsItr->stationID()>=0 && hitsItr->pixelLayerID()<4 && hitsItr->pixelLayerID()>=0)
{
std::cout << "I AM RIGHT BEFORE FILL METHOD\n" << std::endl;
fill(m_tools[m_HitmapGroups.at( m_stationnames.at(hitsItr->stationID())).at( m_pixlayers.at(hitsItr->pixelLayerID()))] , pixelRowIDChip, pixelColIDChip);
}
else
ATH_MSG_WARNING("Unrecognised station index: " << hitsItr->stationID());
}
return StatusCode::SUCCESS;
}
......@@ -3,5 +3,7 @@
*/
#include "Run3AFPMonitoring/AFPSiLayerAlgorithm.h"
#include "Run3AFPMonitoring/AFPToFAlgorithm.h"
DECLARE_COMPONENT( AFPSiLayerAlgorithm )
//DECLARE_COMPONENT( AFPToFAlgorithm )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment