Public Member Functions | Private Attributes | Friends | List of all members
caldp::DriftResponse Class Reference

Structure to hold drift response in a single channel at a single time. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-25/CalibrationDataProducts/DriftResponse.h"

Public Member Functions

 DriftResponse ()
 
 DriftResponse (int fRun, uint32_t fStartTime, uint32_t fEndTime)
 
 ~DriftResponse ()
 
int Run () const
 
uint32_t StartTime () const
 Return run number. More...
 
uint32_t EndTime () const
 Return subrun start time. More...
 
void AddChannelResponse (int fOffChan, double fMean, double fMeanErr, double fRMS, int fNHits)
 Return subrun end time. More...
 
double Mean (int fOffChan) const
 Function to add response value for single channel;. More...
 
double MeanErr (int fOffChan) const
 Return mean for given offline channel. More...
 
double RMS (int fOffChan) const
 Return mean error for given offline channel. More...
 
double NHits (int fOffChan) const
 Return rms for given offline channel. More...
 
bool CheckForChannel (int fOffChan) const
 Return number of hits for given offline channel. More...
 
bool GetChannelResponse (int fOffChan, double &fMean, double &fMeanErr, double &fRMS, int &fNHits) const
 Check for existence of channel in DriftResponse. More...
 
std::map< int, MeanStruct > const & ReturnMap () const
 

Private Attributes

int run
 
uint32_t startTime
 Run number. More...
 
uint32_t endTime
 Start time of the run period. More...
 
std::map< int, MeanStructmeanMap
 End time of the run period. More...
 

Friends

std::ostream & operator<< (std::ostream &o, const DriftResponse &dr)
 

Detailed Description

Structure to hold drift response in a single channel at a single time.

Definition at line 36 of file DriftResponse.h.

Constructor & Destructor Documentation

caldp::DriftResponse::DriftResponse ( )

Definition at line 24 of file DriftResponse.cxx.

24  :
25  run (-1),
26  startTime(0),
27  endTime (0)
28  { }
uint32_t startTime
Run number.
Definition: DriftResponse.h:70
uint32_t endTime
Start time of the run period.
Definition: DriftResponse.h:71
caldp::DriftResponse::DriftResponse ( int  fRun,
uint32_t  fStartTime,
uint32_t  fEndTime 
)

Definition at line 32 of file DriftResponse.cxx.

32  :
33  run (fRun),
34  startTime(fStartTime),
35  endTime (fEndTime)
36  { }
uint32_t startTime
Run number.
Definition: DriftResponse.h:70
uint32_t endTime
Start time of the run period.
Definition: DriftResponse.h:71
caldp::DriftResponse::~DriftResponse ( )

Definition at line 40 of file DriftResponse.cxx.

40 { }

Member Function Documentation

void caldp::DriftResponse::AddChannelResponse ( int  fOffChan,
double  fMean,
double  fMeanErr,
double  fRMS,
int  fNHits 
)

Return subrun end time.

Definition at line 44 of file DriftResponse.cxx.

References om::cout, allTimeWatchdog::endl, make_pair(), meanMap, and caldp::MeanStruct::SetResponse().

Referenced by calib::DriftResponseCalc::endRun(), and calib::DriftCorrection::respondToCloseOutputFiles().

44  {
45 
46  if ( meanMap.find(fOffChan) == meanMap.end() ) {
47 
48  MeanStruct meanResp;
49 
50  meanResp.SetResponse(fMean,fMeanErr,fRMS,fNHits);
51 
52  //Insert a new entry into the map.
53  meanMap.insert(std::make_pair(fOffChan,meanResp));
54  } else {
55  std::cout << "Print an error message here about the entry already existing." << std::endl;
56  }
57  } //End AddChannelResponse
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
OStream cout
Definition: OStream.cxx:6
bool caldp::DriftResponse::CheckForChannel ( int  fOffChan) const

Return number of hits for given offline channel.

Definition at line 142 of file DriftResponse.cxx.

References meanMap.

Referenced by calib::DriftResponseCalc::endRun().

142  {
143 
144  if ( meanMap.find(fOffChan) == meanMap.end() ) return false;
145 
146  return true;
147 
148  }
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
uint32_t caldp::DriftResponse::EndTime ( ) const
inline

Return subrun start time.

Definition at line 48 of file DriftResponse.h.

References caldp::MeanStruct::Mean(), caldp::MeanStruct::MeanErr(), caldp::MeanStruct::NHits(), and caldp::MeanStruct::RMS().

Referenced by calib::DriftCorrection::beginRun(), caldp::operator<<(), and calib::DriftCorrection::respondToCloseOutputFiles().

48 {return endTime; }; ///Return subrun end time
uint32_t endTime
Start time of the run period.
Definition: DriftResponse.h:71
bool caldp::DriftResponse::GetChannelResponse ( int  fOffChan,
double &  fMean,
double &  fMeanErr,
double &  fRMS,
int fNHits 
) const

Check for existence of channel in DriftResponse.

Definition at line 61 of file DriftResponse.cxx.

References caldp::MeanStruct::Mean(), caldp::MeanStruct::MeanErr(), meanMap, caldp::MeanStruct::NHits(), and caldp::MeanStruct::RMS().

61  {
62 
63  fMean = -1;
64  fMeanErr = -1;
65  fRMS = -1;
66  fNHits = -1;
67 
68  if ( meanMap.find(fOffChan) == meanMap.end() ) {
69  return false;
70  }
71 
72  const MeanStruct meanResp = meanMap.at(fOffChan);
73 
74  fMean = meanResp.Mean();
75  fMeanErr = meanResp.MeanErr();
76  fRMS = meanResp.RMS();
77  fNHits = meanResp.NHits();
78 
79  return true;
80 
81 
82  } //End AddChannelResp
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
double caldp::DriftResponse::Mean ( int  fOffChan) const

Function to add response value for single channel;.

Definition at line 85 of file DriftResponse.cxx.

References caldp::MeanStruct::Mean(), and meanMap.

85  {
86 
87  double fMean = -1;
88 
89  if ( meanMap.find(fOffChan) != meanMap.end() ) {
90  const MeanStruct meanAtChan = meanMap.at(fOffChan);
91  fMean = meanAtChan.Mean();
92  }
93 
94  return fMean;
95 
96  }
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
double caldp::DriftResponse::MeanErr ( int  fOffChan) const

Return mean for given offline channel.

Definition at line 99 of file DriftResponse.cxx.

References caldp::MeanStruct::MeanErr(), and meanMap.

99  {
100 
101  double fMeanErr = -1;
102 
103  if ( meanMap.find(fOffChan) != meanMap.end() ) {
104  const MeanStruct meanAtChan = meanMap.at(fOffChan);
105  fMeanErr = meanAtChan.MeanErr();
106  }
107 
108  return fMeanErr;
109 
110  }
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
double caldp::DriftResponse::NHits ( int  fOffChan) const

Return rms for given offline channel.

Definition at line 127 of file DriftResponse.cxx.

References meanMap, and caldp::MeanStruct::NHits().

127  {
128 
129  double fNHits = -1;
130 
131  if ( meanMap.find(fOffChan) != meanMap.end() ) {
132  const MeanStruct meanAtChan = meanMap.at(fOffChan);
133  fNHits = meanAtChan.NHits();
134  }
135 
136  return fNHits;
137 
138  }
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
std::map<int, MeanStruct > const& caldp::DriftResponse::ReturnMap ( ) const
inline

Definition at line 61 of file DriftResponse.h.

References msf_helper::o, and caldp::operator<<().

Referenced by calib::DriftCorrection::beginRun(), caldp::operator<<(), and calib::DriftCorrection::respondToCloseOutputFiles().

61 { return meanMap; };
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
double caldp::DriftResponse::RMS ( int  fOffChan) const

Return mean error for given offline channel.

Definition at line 113 of file DriftResponse.cxx.

References meanMap, and caldp::MeanStruct::RMS().

113  {
114 
115  double fRMS = -1;
116 
117  if ( meanMap.find(fOffChan) != meanMap.end() ) {
118  const MeanStruct meanAtChan = meanMap.at(fOffChan);
119  fRMS = meanAtChan.RMS();
120  }
121 
122  return fRMS;
123 
124  }
std::map< int, MeanStruct > meanMap
End time of the run period.
Definition: DriftResponse.h:73
int caldp::DriftResponse::Run ( ) const
inline

Definition at line 46 of file DriftResponse.h.

References updateRunHistoryTables::run.

Referenced by calib::DriftCorrection::beginRun(), and caldp::operator<<().

46 {return run; }; ///Return run number
uint32_t caldp::DriftResponse::StartTime ( ) const
inline

Return run number.

Definition at line 47 of file DriftResponse.h.

References make_associated_cosmic_defs::startTime.

Referenced by calib::DriftCorrection::beginRun(), caldp::operator<<(), and calib::DriftCorrection::respondToCloseOutputFiles().

47 {return startTime; }; ///Return subrun start time
uint32_t startTime
Run number.
Definition: DriftResponse.h:70

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const DriftResponse dr 
)
friend

Definition at line 152 of file DriftResponse.cxx.

153  {
154  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
155  o << "Run = " << std::setw(1) << std::right << dr.Run()
156  << " StartTime = " << std::setw(1) << std::right << dr.StartTime()
157  << " EndTime = " << std::setw(3) << std::right << dr.EndTime();
158 
159  MeanStruct firstChan = dr.ReturnMap().begin()->second;
160 
161  o << "\nResponse for channel " << dr.ReturnMap().begin()->first << " is"
162  << "\n\tMean: " << firstChan.Mean()
163  << "\n\tMeanErr: " << firstChan.MeanErr()
164  << "\n\tRMS: " << firstChan.RMS()
165  << "\n\tNHits: " << firstChan.NHits()
166  << std::endl;
167 
168  return o;
169  }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112

Member Data Documentation

uint32_t caldp::DriftResponse::endTime
private

Start time of the run period.

Definition at line 71 of file DriftResponse.h.

std::map<int, MeanStruct > caldp::DriftResponse::meanMap
private

End time of the run period.

Definition at line 73 of file DriftResponse.h.

Referenced by AddChannelResponse(), CheckForChannel(), GetChannelResponse(), Mean(), MeanErr(), NHits(), and RMS().

int caldp::DriftResponse::run
private

Definition at line 69 of file DriftResponse.h.

Referenced by Metric.Metric::__repr__(), and fabricate.Builder::memoize().

uint32_t caldp::DriftResponse::startTime
private

Run number.

Definition at line 70 of file DriftResponse.h.


The documentation for this class was generated from the following files: