ATLAS Offline Software
DataContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
8 #include "TMath.h"
9 
10 #include <iostream>
11 using std::cout;
12 using std::endl;
13 
14 using namespace LArSamples;
15 
16 
18  : m_gain(CaloGain::UNKNOWNGAIN), m_eventIndex(-1),
19  m_energy(Definitions::none), m_time(Definitions::none), m_quality(Definitions::none),
20  m_pedestal(Definitions::none), m_pedestalRMS(Definitions::none),
21  m_status(0xffffffff), m_adcMax(-1)
22 {
23  ClassCounts::incrementInstanceCount("DataContainer");
24 }
25 
26 
27 DataContainer::DataContainer(CaloGain::CaloGain gain, const std::vector<short>& samples,
28  float energy, float time, float quality,
29  int eventIndex,
30  LArVectorProxy autoCorrs, float noise,
31  float pedestal, float pedestalRMS,
32  int status, float adcMax)
33  : m_gain(gain), m_samples(samples), m_eventIndex(eventIndex),
34  m_energy(energy), m_time(time), m_quality(quality),
35  m_pedestal(pedestal), m_pedestalRMS(pedestalRMS),
36  m_status(status), m_adcMax(adcMax)
37 {
38  ClassCounts::incrementInstanceCount("DataContainer");
39  m_corrs.reserve( autoCorrs.size());
40  m_corrs.push_back(noise*noise);
41  for (unsigned int i = 0; i < autoCorrs.size() && i < nSamples() - 1; ++i)
42  m_corrs.push_back(autoCorrs[i]*noise*noise);
43 }
44 
45 
46 DataContainer::DataContainer(CaloGain::CaloGain gain, const std::vector<short>& samples,
47  const std::vector<float>& corrs,
48  int eventIndex,
49  float energy, float time, float quality,
50  float pedestal, float pedestalRMS,
51  int status, float adcMax)
52  : m_gain(gain), m_samples(samples), m_corrs(corrs), m_eventIndex(eventIndex),
53  m_energy(energy), m_time(time), m_quality(quality),
54  m_pedestal(pedestal), m_pedestalRMS(pedestalRMS),
55  m_status(status), m_adcMax(adcMax)
56 {
57  ClassCounts::incrementInstanceCount("DataContainer");
58 }
59 
60 
61 DataContainer::DataContainer(const DataContainer& other, double adcMax, double time)
62  : m_gain(other.m_gain), m_samples(other.m_samples), m_corrs(other.m_corrs),
63  m_eventIndex(other.m_eventIndex),
64  m_energy(other.m_energy), m_time(adcMax > 0 ? time : other.m_time), m_quality(other.m_quality),
65  m_pedestal(other.m_pedestal), m_pedestalRMS(other.m_pedestalRMS),
66  m_status(other.m_status), m_adcMax(adcMax > 0 ? adcMax : other.m_adcMax)
67 {
68  ClassCounts::incrementInstanceCount("DataContainer");
69 }
70 
71 
73 {
74  ClassCounts::decrementInstanceCount("DataContainer");
75 }
76 
77 
79 {
80  //if (gain() == CaloGain::UNKNOWNGAIN) return false;
81  if (eventIndex() < 0) return false;
82  if (Definitions::isNone(energy())) return false;
83  if (Definitions::isNone(ofcTime())) return false;
84  if (Definitions::isNone(quality())) return false;
85  //if (Definitions::isNone(pedestal())) return false;
86  //if (m_corrs.size() == 0) return false; temporary
87  if (status() < 0) return false;
88 
89  return true;
90 }
CaloGain::UNKNOWNGAIN
@ UNKNOWNGAIN
Definition: CaloGain.h:20
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
LArSamples::DataContainer::ofcTime
float ofcTime() const
Definition: DataContainer.h:70
LArSamples
Definition: AbsShape.h:24
LArSamples::DataContainer::isValid
bool isValid() const
Definition: DataContainer.cxx:78
LArSamples::DataContainer::nSamples
unsigned int nSamples() const
Definition: DataContainer.h:57
CaloGain
Definition: CaloGain.h:10
DataContainer.h
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArSamples::DataContainer::~DataContainer
virtual ~DataContainer()
Destructor.
Definition: DataContainer.cxx:72
LArSamples::ClassCounts::decrementInstanceCount
void decrementInstanceCount() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:33
LArSamples::DataContainer::m_corrs
std::vector< float > m_corrs
noise + correlations in MeV
Definition: DataContainer.h:107
LArSamples::DataContainer::DataContainer
DataContainer()
Constructor
Definition: DataContainer.cxx:17
InDetDD::none
@ none
Definition: InDetDD_Defs.h:19
LArSamples::Definitions
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:13
LArSamples::DataContainer::energy
float energy() const
Definition: DataContainer.h:67
LArSamples::ClassCounts::incrementInstanceCount
void incrementInstanceCount() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:32
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
LArSamples::DataContainer
Definition: DataContainer.h:25
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
LArSamples::DataContainer::eventIndex
int eventIndex() const
Definition: DataContainer.h:64
LArSamples::Definitions::isNone
static bool isNone(double x)
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:18
LArSamples::DataContainer::status
int status() const
Definition: DataContainer.h:80
merge.status
status
Definition: merge.py:17
LArSamples::DataContainer::quality
float quality() const
Definition: DataContainer.h:73
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
LArVectorProxy
Proxy for accessing a range of float values like a vector.
Definition: LArVectorProxy.h:38
ClassCounts.h
EventInfoCnvParams::eventIndex
thread_local event_number_t eventIndex
Definition: IEvtIdModifierSvc.h:34