Skip to content
Snippets Groups Projects
Commit 98cda39c authored by Graeme Stewart's avatar Graeme Stewart
Browse files

PhysicsAnalysis/D3PDMaker/TrigCaloD3PDMaker deleted from 20.11

parent f9c51487
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 496 deletions
package TrigCaloD3PDMaker
author Takanori Kono <takanori.kohno@cern.ch>
use AtlasPolicy AtlasPolicy-*
use TrigCaloEvent TrigCaloEvent-* Trigger/TrigEvent
private
use AthenaKernel AthenaKernel-* Control
use CaloGeoHelpers CaloGeoHelpers-* Calorimeter
use D3PDMakerUtils D3PDMakerUtils-* PhysicsAnalysis/D3PDMaker
use TrigT1CaloEvent TrigT1CaloEvent-* Trigger/TrigT1
use GaudiInterface GaudiInterface-* External
use SGTools SGTools-* Control
use StoreGate StoreGate-* Control
end_private
library TrigCaloD3PDMaker *.cxx components/*.cxx
apply_pattern component_library
apply_pattern declare_python_modules files="*.py"
apply_pattern declare_joboptions files="*.py"
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
import D3PDMakerCoreComps
from TrigCaloD3PDMaker.TrigEMClusterD3PDObject import TrigEMClusterD3PDObject
from TrigCaloD3PDMaker.TrigEMRingerD3PDObject import TrigEMRingerD3PDObject
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
def TrigCaloD3PD(fname, tname='t', seq=topSequence):
alg = D3PDMakerCoreComps.MakerAlg(tname, seq=seq, file=fname)
alg += TrigEMClusterD3PDObject(3)
alg += TrigEMRingerD3PDObject(3)
return alg
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
import D3PDMakerCoreComps
TrigEMClusterContainer_sgkey = 'HLT_TrigT2CaloEgamma,HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma'
TrigEMClusterD3PDObject = make_SGDataVector_D3PDObject('DataVector<xAOD::TrigEMCluster_v1>',
TrigEMClusterContainer_sgkey,
'trig_L2_emcl_',
'TrigEMClusterD3PDObject')
# Level 0
TrigEMClusterD3PDObject.defineBlock (
0, 'Basics',
D3PDMakerCoreComps.AuxDataFillerTool,
Vars = ['quality = clusterQuality < unsigned int: 0'])
TrigEMClusterD3PDObject.defineBlock (
0, 'Basics1',
D3PDMakerCoreComps.AuxDataFillerTool,
Vars = ['E = energy < float: 0',
'Et = et < float:0',
'eta < float:0',
'phi < float:0'])
# Level 1
TrigEMClusterD3PDObject.defineBlock (
1, 'HypoVars1',
D3PDMakerCoreComps.AuxDataFillerTool,
Vars = ['E237 = e237 < float:0',
'E277 = e277 < float:0',
'fracs1 < float:0',
'weta2 < float:0',
'Ehad1 = ehad1 < float:0',
'eta1 < float:0',
'emaxs1 < float:0',
'e2tsts1 < float:0',
'E233 = e233 < float:0',
'wstot < float:0'])
# Level 2
TrigEMClusterD3PDObject.defineBlock (
2, 'Details',
D3PDMakerCoreComps.AuxDataFillerTool,
Vars = ['rawEnergy < float:0',
'rawEta < float:0',
'rawPhi < float:0',
'RoIWord = RoIword < long: 0',
'nCells < int: 0'])
#TrigEMClusterD3PDObject.defineBlock (
# 2, 'Details1',
# D3PDMakerCoreComps.AuxDataFillerTool,
# Vars = ['energyInSample = energySample'])
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
from TrigCaloD3PDMaker.TrigCaloD3PDMakerConf import D3PD__TrigEMRingerFillerTool
TrigEMClusterContainer_sgkey = 'HLT_TrigT2CaloEgamma'
TrigEMRingerD3PDObject = make_SGDataVector_D3PDObject('TrigEMClusterContainer',
TrigEMClusterContainer_sgkey,
'trig_L2_emcl_ringer_',
'TrigEMRingerD3PDObject')
# Level 0
TrigEMRingerD3PDObject.defineBlock(0, 'Basics',
D3PD__TrigEMRingerFillerTool,
WriteBasics=True)
# Level 1
TrigEMRingerD3PDObject.defineBlock(1, 'HypoVars',
D3PD__TrigEMRingerFillerTool,
WriteHypoVars=True)
# Level 2
TrigEMRingerD3PDObject.defineBlock(2, 'Details',
D3PD__TrigEMRingerFillerTool,
WriteDetails=True)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
from TrigCaloD3PDMaker.TrigCaloD3PDMakerConf \
import D3PD__TriggerTowerFillerTool, D3PD__TriggerTowerFillerTool
TriggerTowerCollection_sgkey = 'TriggerTowers'
TriggerTowerD3PDObject = make_SGDataVector_D3PDObject('DataVector<LVL1::TriggerTower>',
TriggerTowerCollection_sgkey,
'tt_',
'TriggerTowerD3PDObject')
# Level 0
TriggerTowerD3PDObject.defineBlock(0, 'Basics',
D3PD__TriggerTowerFillerTool)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# $Id: __init__.py 287965 2010-03-25 16:14:16Z krasznaa $
#
# @file TrigCaloD3PDMaker/python/__init__.py
# @author scott snyder <snyder@bnl.gov>
# @date Sep, 2009
# @brief Define shortcuts for referencing configurables in this package.
#
# With this, instead of writing
#
# TrigCaloD3PDMaker.TrigCaloD3PDMakerConf.D3PD__TrigEMClusterFillerTool
#
# we can write
#
# TrigCaloD3PDMaker.TrigEMClusterFillerTool
#
import TrigCaloD3PDMakerConf
for k, v in TrigCaloD3PDMakerConf.__dict__.items():
if k.startswith ('D3PD__'):
globals()[k[6:]] = v
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.FilesInput = [
# ttbar AOD
# '/rscratch/pcatr18/tkohno/data/test/ttbar/AOD.092344._000274.pool.root.1',
# Zee AOD
'/rscratch/pcatr18/tkohno/data/test/zeeAod.root',
]
athenaCommonFlags.EvtMax = -1
from RecExConfig.RecFlags import rec
rec.doCBNT.set_Value_and_Lock(False)
rec.doWriteESD.set_Value_and_Lock(False)
rec.doWriteAOD.set_Value_and_Lock(False)
rec.doAOD.set_Value_and_Lock(False)
rec.doESD.set_Value_and_Lock(False)
rec.doDPD.set_Value_and_Lock(False)
rec.doWriteTAG.set_Value_and_Lock(False)
rec.AutoConfiguration = ['everything']
# rec.AutoConfiguration.set_Value_and_Lock(['ConditionsTag'])
include ("RecExCommon/RecExCommon_topOptions.py")
from TrigCaloD3PDMaker.TrigCaloD3PD import TrigCaloD3PD
alg = TrigCaloD3PD('d3pd.root')
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/*
D3PD::TrigEMRingerFillerTool.cxx
*/
#include "TrigEMRingerFillerTool.h"
#include "CaloGeoHelpers/CaloSampling.h"
#include "AthenaKernel/errorcheck.h"
#include <iostream>
namespace D3PD {
TrigEMRingerFillerTool::TrigEMRingerFillerTool(const std::string& type,
const std::string& name,
const IInterface* parent) :
BlockFillerTool<TrigEMCluster>(type, name, parent),
m_incSvc ("IncidentSvc", name),
m_sgKeyName("HLT_TrigRingerNeuralFex")
{
m_WriteBasics = true;
m_WriteHypoVars = true;
book().ignore(); // avoid coverity warnings.
declareProperty("WriteBasics", m_WriteBasics=false, "Write basic information");
declareProperty("WriteHypoVars", m_WriteHypoVars=false, "Write variables used in hypo");
declareProperty("WriteDetails", m_WriteDetails=false, "Write detailed variables");
declareProperty ("IncidentService", m_incSvc, "Gaudi incident service.");
}
StatusCode TrigEMRingerFillerTool::initialize()
{
//We add a listener that will monitor when the store gate gets clear (at the end of each event)
CHECK( m_incSvc.retrieve() );
m_incSvc->addListener (this, "StoreCleared");
//Initializing SG service for retrieving the NNoutput from it.
StatusCode sc = service("StoreGateSvc", m_pStoreGate);
if (sc.isFailure()) return sc;
return StatusCode::SUCCESS;
}
void TrigEMRingerFillerTool::handle (const Incident& inc)
{
//Reseting the cluster counter at the beginning of a new event.
if (inc.type() == "StoreCleared") m_emClusCount = 0;
}
StatusCode TrigEMRingerFillerTool::book()
{
if (m_WriteBasics)
{
CHECK(addVariable("emClusIdx", m_emClusIdx));
CHECK(addVariable("rings", m_rings));
}
if (m_WriteHypoVars) CHECK(addVariable("nnOutput", m_nnOut));
m_emClusCount = 0;
return StatusCode::SUCCESS;
}
StatusCode TrigEMRingerFillerTool::fill(const TrigEMCluster& x)
{
//If the EM cluster has a ring structure attached...
if (x.rings())
{
if (m_WriteBasics)
{
*m_emClusIdx = m_emClusCount;
const std::vector<float> rings = x.rings()->rings();
m_rings->assign(rings.begin(), rings.end());
}
//We take from SG the NNOutputContainer, we we look for the NNOutput attached to the
//same TrigEmCluster passed as a parameter to this method.
if ( (m_WriteHypoVars) && (m_pStoreGate->contains<TrigRNNOutputContainer>(m_sgKeyName)) )
{
m_pStoreGate->retrieve(m_sgNNOut, m_sgKeyName);
//We iterate over all NN output stored in SG, looking for the one attached to the EM Cluster apssed to this member.
for(TrigRNNOutputContainer::const_iterator it = m_sgNNOut->begin(); it != m_sgNNOut->end(); ++it)
{
const TrigEMCluster *emCluster = (*it)->cluster();
if ((*emCluster) == x) // We save the NN output when we find a match.
{
const std::vector<float> nnOut = (*it)->output();
m_nnOut->assign(nnOut.begin(), nnOut.end());
break;
}
}
}
}
else if (m_WriteBasics) *m_emClusIdx = -1; // Assigning -1 if a ring was not found within this cluster.
m_emClusCount++;
return StatusCode::SUCCESS;
}
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef __D3PD_TrigEMRingerFillerTool_h__
#define __D3PD_TrigEMRingerFillerTool_h__
/*
D3PD::TrigEMRingerFillerTool.h
*/
#include <vector>
#include <string>
#include "D3PDMakerUtils/BlockFillerTool.h"
#include "TrigCaloEvent/TrigEMCluster.h"
#include "StoreGate/StoreGateSvc.h"
#include "TrigCaloEvent/TrigRNNOutputContainer.h"
namespace D3PD {
class TrigEMRingerFillerTool : public D3PD::BlockFillerTool<TrigEMCluster>,
public IIncidentListener {
public:
TrigEMRingerFillerTool(const std::string& type, const std::string& name,
const IInterface* parent);
~TrigEMRingerFillerTool() {};
StatusCode book();
StatusCode fill(const TrigEMCluster& x);
//These 2 methods below are for handling the store gate incident (clear).
virtual StatusCode initialize();
virtual void handle (const Incident& inc);
private:
// Properties
bool m_WriteBasics;
bool m_WriteHypoVars;
bool m_WriteDetails;
// D3PD variables
std::vector<float> *m_rings;
std::vector<float> *m_nnOut;
int *m_emClusIdx;
/// Property: Incident service.
ServiceHandle<IIncidentSvc> m_incSvc;
/// For store gate access.
StoreGateSvc *m_pStoreGate;
const TrigRNNOutputContainer *m_sgNNOut;
const std::string m_sgKeyName;
unsigned m_emClusCount;
};
}
#endif // __D3PD_TrigEMRingerFillerTool_h__
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/*
D3PD::TriggerTowerFillerTool.cxx
*/
#include "TriggerTowerFillerTool.h"
#include "CaloGeoHelpers/CaloSampling.h"
#include "AthenaKernel/errorcheck.h"
#include "TrigT1CaloEvent/TriggerTower_ClassDEF.h"
using namespace std;
namespace D3PD {
TriggerTowerFillerTool::TriggerTowerFillerTool(const std::string& type,
const std::string& name,
const IInterface* parent) :
BlockFillerTool<LVL1::TriggerTower>(type, name, parent)
{
book().ignore(); // Avoid coverity warnings.
}
TriggerTowerFillerTool::~TriggerTowerFillerTool() {
}
StatusCode TriggerTowerFillerTool::book() {
CHECK(addVariable("em_E", m_energy_em));
CHECK(addVariable("had_E", m_energy_had));
CHECK(addVariable("em_peak", m_em_peak));
CHECK(addVariable("had_peak", m_had_peak));
CHECK(addVariable("em_adc_peak", m_em_adc_peak));
CHECK(addVariable("had_adc_peak", m_had_adc_peak));
CHECK(addVariable("em_lut", m_em_lut));
CHECK(addVariable("had_lut", m_had_lut));
CHECK(addVariable("em_adc", m_em_adc));
CHECK(addVariable("had_adc", m_had_adc));
CHECK(addVariable("eta", m_eta));
CHECK(addVariable("phi", m_phi));
return StatusCode::SUCCESS;
}
StatusCode TriggerTowerFillerTool::fill(const LVL1::TriggerTower& x) {
*m_energy_em = x.emEnergy();
*m_energy_had = x.hadEnergy();
*m_eta = x.eta();
*m_phi = x.phi();
*m_em_lut = x.emLUT();
*m_had_lut = x.hadLUT();
*m_em_adc = x.emADC();
*m_had_adc = x.hadADC();
*m_em_peak = x.emPeak();
*m_had_peak = x.hadPeak();
*m_em_adc_peak = x.emADCPeak();
*m_had_adc_peak = x.hadADCPeak();
return StatusCode::SUCCESS;
}
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef __D3PD_TriggerTowerFillerTool_h__
#define __D3PD_TriggerTowerFillerTool_h__
/*
D3PD::TriggerTowerFillerTool.h
*/
#include <vector>
#include "D3PDMakerUtils/BlockFillerTool.h"
#include "TrigT1CaloEvent/TriggerTower.h"
namespace D3PD {
class TriggerTowerFillerTool : public D3PD::BlockFillerTool<LVL1::TriggerTower> {
public:
TriggerTowerFillerTool(const std::string& type, const std::string& name,
const IInterface* parent);
~TriggerTowerFillerTool();
StatusCode book();
StatusCode fill(const LVL1::TriggerTower& x);
private:
// Properties
// D3PD variables
float* m_energy_em;
float* m_energy_had;
float* m_eta;
float* m_phi;
std::vector<int>* m_em_lut;
std::vector<int>* m_had_lut;
std::vector<int>* m_em_adc;
std::vector<int>* m_had_adc;
int* m_em_peak ;
int* m_had_peak ;
int* m_em_adc_peak ;
int* m_had_adc_peak ;
};
}
#endif // __D3PD_TriggerTowerFillerTool_h__
/*
TrigCaloD3PDMaker_entries.cxx
*/
#include "GaudiKernel/DeclareFactoryEntries.h"
#include "../TrigEMRingerFillerTool.h"
#include "../TriggerTowerFillerTool.h"
DECLARE_NAMESPACE_TOOL_FACTORY(D3PD, TrigEMRingerFillerTool)
DECLARE_NAMESPACE_TOOL_FACTORY(D3PD, TriggerTowerFillerTool)
/*
TrigCaloD3PDMaker_load.cxx
*/
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES(TrigCaloD3PDMaker)
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "SGTools/BaseInfo.h"
#include "TrigCaloEvent/TrigCaloCluster.h"
#include "TrigCaloEvent/TrigEMCluster.h"
#include "TrigT1CaloEvent/TriggerTowerCollection.h"
SG_ADD_BASE(TrigEMCluster, TrigCaloCluster);
SG_ADD_BASE (TriggerTowerCollection, DataVector<TriggerTower> );
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