|  | ATLAS Offline Software
    | 
 
 
 
Go to the documentation of this file.
    9 #include "CaloDetDescr/CaloDetDescrElement.h" 
   11 #include "CLHEP/Matrix/Matrix.h" 
   12 #include "CLHEP/Matrix/Vector.h" 
   14 #include "CoralBase/Blob.h" 
   16 #include "GaudiKernel/ThreadLocalContext.h" 
   19 using CLHEP::HepMatrix;
 
   20 using CLHEP::HepVector;
 
   37   m_triggerChainProp(
""),
 
  121   ATH_MSG_INFO ( 
" end of CaloCellNoiseAlg::initialize " );
 
  122   return StatusCode::SUCCESS; 
 
  132       return StatusCode::SUCCESS;
 
  138       return StatusCode::SUCCESS;
 
  145        return StatusCode::SUCCESS;
 
  149   return StatusCode::SUCCESS; 
 
  163     bool passTrig = 
false;
 
  168      return StatusCode::SUCCESS;
 
  176   const EventContext& ctx = Gaudi::Hive::currentContext();
 
  177   unsigned int lumiblock = ctx.eventID().lumi_block();
 
  194            return StatusCode::SUCCESS;
 
  208       return StatusCode::SUCCESS;
 
  215       totalNoise = noiseH.
cptr();
 
  229      cell0.identifier = 
id.get_identifier32().get_compact();
 
  231      cell0.eta = calodde->
eta();
 
  232      cell0.phi = calodde->
phi();
 
  252     m_tree = 
new TTree(
"mytree",
"Calo Noise ntuple");
 
  255     m_tree->Branch(
"identifier",
m_treeData->m_identifier,
"identifier[ncell]/I");
 
  267       return StatusCode::SUCCESS;
 
  277     return StatusCode::SUCCESS;
 
  283    for (; first_cell != end_cell; ++first_cell)
 
  293           double energy=  (*first_cell)->energy();
 
  305             double frac = oldN/(1.+oldN);
 
  306             double Anew = 1.+oldN;
 
  307             double newAverage = 
frac*oldAverage + 
energy/Anew;
 
  308             double deltaE = (
energy-oldAverage);
 
  309             double newRMS     = 
frac*(oldRMS + deltaE*deltaE/Anew);
 
  320   return StatusCode::SUCCESS;
 
  331   if (
sc.isFailure() || !attrListColl) {
 
  339    if ((*first).first == 0) {
 
  340       std::ostringstream attrStr1;
 
  341       (*first).second.toOutputStream( attrStr1 );
 
  343                       " Attribute list " << attrStr1.str() );
 
  345       luminosity = attrList[
"LBAvInstLumi"].data<
float>() *1
e-3;  
 
  382  return StatusCode::SUCCESS;
 
  388  return StatusCode::SUCCESS;
 
  394  const EventContext& ctx = Gaudi::Hive::currentContext();
 
  408    pedestal = pedH.
cptr();
 
  414    elecNoise = noiseH.
cptr();
 
  419  FILE* 
fp = fopen(
"calonoise.txt",
"w");
 
  421  TBranch* b1 = 
m_tree->GetBranch(
"luminosity");
 
  422  TBranch* b2 = 
m_tree->GetBranch(
"nevt");
 
  423  TBranch* b3 = 
m_tree->GetBranch(
"average");
 
  424  TBranch* b4 = 
m_tree->GetBranch(
"rms");
 
  425  TBranch* b5 = 
m_tree->GetBranch(
"nevt_good");
 
  434  std::vector<float> anoise;
 
  435  std::vector<float> bnoise;
 
  440    std::vector<float> 
x;
 
  441    std::vector<float> 
y;
 
  442    std::vector<float> ey;
 
  457      if (
x.size()==1) anoise[
icell]=
y[0];
 
  460      HepMatrix 
alpha(2,2);
 
  463      for (
unsigned int i=0;
i<2;
i++) {
 
  464        for (
unsigned int j=0;j<2;j++) {
 
  466          for (
unsigned int k=0;
k<
x.size();
k++) {
 
  471      for (
unsigned int i=0;
i<2;
i++) {
 
  473          for (
unsigned int k=0;
k<
x.size();
k++) {
 
  484      for (
unsigned int i=0;
i<
x.size();
i++) {
 
  506           ATH_MSG_DEBUG ( 
" regionId,eta,phimin,phimax " << regionId << 
" " << 
eta << 
" " << phimin << 
" " << phimax );
 
  524              float patched_noise = 
sum/((
float)(nring));
 
  525              if (patched_noise>anoise[
icell]) anoise[
icell] = patched_noise;
 
  527           ATH_MSG_DEBUG( 
" corrected noise nring, anoise[icell] " << nring << 
" " << anoise[
icell]  );
 
  566    int ii = (
int) (idSubHash);
 
  582         float anoise_corr=anoise[
icell];
 
  584         if (
gain != gainref) {
 
  594             polynom_adc2mev0 = adc2mev->
ADC2MEV(
id,gainref);
 
  596           if (polynom_adc2mev0.size()>1) adc2mev0=polynom_adc2mev0[1];
 
  609           if (polynom_adc2mev1.size()>1) adc2mev1=polynom_adc2mev1[1];
 
  614           if (noise0>0 && noise1>0 && adc2mev0>0 && adc2mev1>0.) {
 
  615             anoise_corr = anoise[
icell]*noise1/noise0 * adc2mev1/adc2mev0;
 
  626           if (anoise_corr<1. && adb>1
e-6) { 
 
  631             float delta = std::fabs((anoise_corr-adb)/adb);
 
  634                                 << 
" computed " << anoise_corr  << 
" reference " << adb );
 
  639         fprintf(
fp,
"%5d %5d %5d %8.3f %8.3f\n",iCool,ii,
gain,anoise_corr,bnoise[
icell]);
 
  650           float anoise_corr = anoise[
icell];
 
  653           fprintf(
fp,
"%5d %5d %5d %8.3f %8.3f\n",iCool,ii,
gain,anoise_corr,bnoise[
icell]);
 
  660  return StatusCode::SUCCESS;
 
  665  return StatusCode::SUCCESS;
 
  
def retrieve(aClass, aKey=None)
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
char data[hepevt_bytes_allocation_ATLAS]
const_iterator end() const
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
virtual StatusCode finalize() override
standard Athena-Algorithm method
Const iterator class for DataVector/DataList.
std::string show_to_string(const Identifier id, const IdContext *context=0, char sep='.') const
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Scalar phi() const
phi method
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
bool is_lar(Identifier id) const
Scalar eta() const
pseudorapidity method
SG::ReadCondHandleKey< CaloNoise > m_elecNoiseKey
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
CaloCellNoiseAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Identifier region_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy) const
Make a region ID from constituting fields and subCalo index; for (Mini)FCAL and Tiles,...
ServiceHandle< ITHistSvc > m_thistSvc
std::unique_ptr< TreeData > m_treeData
bool msgLvl(const MSG::Level lvl) const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
virtual ~CaloCellNoiseAlg()
Default Destructor.
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
bool empty() const
Test if the key is blank.
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
This class is a collection of AttributeLists where each one is associated with a channel number....
const CaloCell_ID * m_calo_id
bool is_valid() const
Check if id is in a valid state.
std::string m_lumiFolderName
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
bool is_em(const Identifier id) const
test if the id belongs to LArEM
This class initializes the Calo (LAr and Tile) offline identifiers.
size_type calo_cell_hash_max() const
cell 'global' hash table max size
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadCondHandleKey< ILArNoise > m_noiseKey
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
IdentifierHash subcalo_cell_hash(const Identifier cellId, int &subCalo) const
create hash id from 'global' cell id
ToolHandle< Trig::TrigDecisionTool > m_trigDecTool
TDT handle.
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
virtual StatusCode initialize() override
standard Athena-Algorithm method
static StatusCode readNtuple()
unsigned int m_lumiblockOld
std::string m_triggerChainProp
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
StatusCode initialize(bool used=true)
Container class for CaloCell.
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
FloatArrayProperty m_cuts
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
#define ATH_MSG_WARNING(x)
ChanAttrListMap::const_iterator const_iterator
float eta() const
cell eta
float phi() const
cell phi
virtual StatusCode execute() override
standard Athena-Algorithm method
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
SG::ReadCondHandleKey< CaloNoise > m_totalNoiseKey
constexpr int pow(int base, int exp) noexcept
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting
virtual StatusCode stop() override
standard Athena-Algorithm method
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Proxy for accessing a range of float values like a vector.
const_pointer_type cptr()
std::vector< CellInfo > m_CellList