BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
VData Class Reference

#include <VData.h>

Public Member Functions

 VData ()
 
void setVoltagesStd (VDataItem voltagesStd)
 
VDataItem getVoltageStd ()
 
void push_back_sorted (Time_t time_HV_SLOWCTRL, const VDataItem &data)
 add a entry to our cache. the entry has to be pushed back in ascending order, with no gap. inserting a item that is within timeboundary will fail and do nothing.
 
void updateBoundary ()
 
size_t size ()
 
Time_t getUpperBoundaryEventTime ()
 
Time_t getLowerBoundaryEventTime ()
 
VDataItem getVoltage (Time_t time)
 
std::vector< Time_t > & getTimeVector ()
 
VDataItemVectorgetVDataItemVector ()
 
double getVoltage (Time_t time, int layer)
 
VDataItem getDrop (Time_t time)
 
double getAvgDrop (Time_t time)
 
double getAvgDropButVeryDrop (Time_t time)
 
double getOffsetEvt2Db ()
 
void setOffsetEvt2Db (int time_offset)
 
void clear ()
 throw all cached data. next time you might have to prepare cache again..
 
bool isValid (Time_t time) const
 

Static Public Attributes

static const size_t MDC_layers =VDataItem::MDC_layers
 

Detailed Description

Definition at line 32 of file VData.h.

Constructor & Destructor Documentation

◆ VData()

VData::VData ( )

Definition at line 55 of file VData.cxx.

55 {
56 double a[]={
57 1871.65, 1988.291667, 2016.875, 2017.791667, 2044.25, 2029.25, 2016.75, 1986.5, 2111, 2199,
58 2187.5, 2226, 2214.75, 2233, 2216, 2222.75, 2199.5, 2217.75, 2189.25, 2142.75,
59 2119.5, 2192.25, 2209.5, 2218, 2201, 2211.25, 2227, 2226, 2186.25, 2201.5,
60 2217, 2211.5, 2177, 2191.25, 2192.25, 2135.75, 2133.25, 2200.75, 2218.75, 2204.25,
61 2137.5, 2139.75, 2059.5,
62 };
63 voltagesStd=VDataItem::fromArray(a);
64 time_offset=6;
65 Boundary_time_High=0;
66 Boundary_time_Low=0;
67}
static VDataItem fromArray(const double *item)
Definition VData.cxx:121

Member Function Documentation

◆ clear()

void VData::clear ( )

throw all cached data. next time you might have to prepare cache again..

Definition at line 73 of file VData.cxx.

73 {
74 Boundary_time_High=0;
75 Boundary_time_Low=0;
76 timeVector.clear();
77 VdataVector.clear();
78}

Referenced by MdcHvDropSvc::queryRelativeHvDrop().

◆ getAvgDrop()

double VData::getAvgDrop ( Time_t time)

Definition at line 89 of file VData.cxx.

89 {
90 VDataItem voltTripPerc=getDrop(time);
91 double totalDropPerc=0;
92 for (size_t i=0; i<voltTripPerc.size(); i++) totalDropPerc+=voltTripPerc[i];
93 return totalDropPerc/voltTripPerc.size();
94}
Double_t time
VDataItem getDrop(Time_t time)
Definition VData.cxx:81
static size_t size()
Definition VData.h:23

Referenced by MdcHvDropSvc::queryRelativeHvDrop().

◆ getAvgDropButVeryDrop()

double VData::getAvgDropButVeryDrop ( Time_t time)

Definition at line 95 of file VData.cxx.

95 {
96 VDataItem voltTripPerc=getDrop(time);
97 double totalDropPerc=0;
98 for (size_t i=0; i<20; i++) totalDropPerc+=voltTripPerc[i];
99 for (size_t i=25-1; i<voltTripPerc.size(); i++) totalDropPerc+=voltTripPerc[i];
100
101 return totalDropPerc/(voltTripPerc.size()-4);
102}

Referenced by MdcHvDropSvc::queryRelativeHvDrop().

◆ getDrop()

VDataItem VData::getDrop ( Time_t time)

Definition at line 81 of file VData.cxx.

81 {
82 VDataItem voltTripPerc;
83 VDataItem voltage=getVoltage(time);
84 for (size_t i=0; i<voltage.size(); i++){
85 voltTripPerc[i]=(voltagesStd[i]-voltage[i])/voltagesStd[i];
86 }
87 return voltTripPerc;
88}
VDataItem getVoltage(Time_t time)
Definition VData.cxx:31

Referenced by getAvgDrop(), and getAvgDropButVeryDrop().

◆ getLowerBoundaryEventTime()

Time_t VData::getLowerBoundaryEventTime ( )
inline

Definition at line 56 of file VData.h.

56{return this->Boundary_time_Low-time_offset;}

Referenced by getVoltage(), and MdcHvDropSvc::queryRelativeHvDrop().

◆ getOffsetEvt2Db()

double VData::getOffsetEvt2Db ( )
inline

Definition at line 64 of file VData.h.

64{return time_offset;}

Referenced by MdcHvDropSvc::queryRelativeHvDrop().

◆ getTimeVector()

std::vector< Time_t > & VData::getTimeVector ( )
inline

Definition at line 58 of file VData.h.

58{return timeVector;}

◆ getUpperBoundaryEventTime()

Time_t VData::getUpperBoundaryEventTime ( )
inline

Definition at line 55 of file VData.h.

55{return this->Boundary_time_High-time_offset;}

Referenced by getVoltage(), and MdcHvDropSvc::queryRelativeHvDrop().

◆ getVDataItemVector()

VDataItemVector & VData::getVDataItemVector ( )
inline

Definition at line 59 of file VData.h.

59{return VdataVector;}

◆ getVoltage() [1/2]

VDataItem VData::getVoltage ( Time_t time)

Definition at line 31 of file VData.cxx.

31 {
32 VDataItem voltage;
33 time+=time_offset;
34 if (time > Boundary_time_High || time < Boundary_time_Low) {
35 //MsgStream log(messageService(), name());
36 //log << MSG::INFO << "MdcHvDropSvc::initialize()" << endreq;
37 std::cerr << "Error! time exceeds boundary. up:down"<<getUpperBoundaryEventTime()<<":"<<getLowerBoundaryEventTime()<<std::endl;
38 std::cerr<< "this should not happen. check your code that matters with VData"<<std::endl;
39 //if (Boundary_time_High==Boundary_time_Low && Boundary_time_Low==0){
40 // std::cerr << "you need to call updateBoundary() after inserting items.";
41 //}
42 //std::cerr << std::endl;
43 return voltage;
44 }
45 std::vector<Time_t>::iterator iter = std::upper_bound(timeVector.begin(), timeVector.end(), time);
46 int index2 = iter - timeVector.begin();
47 Time_t time2 = timeVector[index2], time1 = timeVector[index2 - 1];
48
49 VDataItem &voltage2 = VdataVector[index2], &voltage1 = VdataVector[index2 - 1];
50 for (size_t i = 0; i < voltage.size(); i++) {
51 voltage[i] = voltage1[i] + ((double)(time - time1)) / (time2 - time1) * (voltage2[i] - voltage1[i]);
52 }
53 return voltage;
54}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
long Time_t
Definition VData.h:31
Time_t getUpperBoundaryEventTime()
Definition VData.h:55
Time_t getLowerBoundaryEventTime()
Definition VData.h:56

Referenced by getDrop().

◆ getVoltage() [2/2]

double VData::getVoltage ( Time_t time,
int layer )
inline

Definition at line 60 of file VData.h.

60{return getVoltage(time)[layer-1];}

Referenced by getVoltage().

◆ getVoltageStd()

VDataItem VData::getVoltageStd ( )
inline

Definition at line 46 of file VData.h.

46{return this->voltagesStd;}

◆ isValid()

bool VData::isValid ( Time_t time) const

Definition at line 17 of file VData.cxx.

17 {
18 time+=time_offset;
19 if (time > Boundary_time_High || time < Boundary_time_Low) {
20 return false;
21 }
22 std::vector<Time_t>::const_iterator iter = std::upper_bound(timeVector.begin(), timeVector.end(), time);
23 int index2 = iter - timeVector.begin();
24 Time_t time2 = timeVector[index2], time1 = timeVector[index2 - 1];
25 if (abs(time - time2) > 10 && abs(time - time1) > 10){
26 return false;
27 }
28 return true;
29}

Referenced by MdcHvDropSvc::queryRelativeHvDrop().

◆ push_back_sorted()

void VData::push_back_sorted ( Time_t time_HV_SLOWCTRL,
const VDataItem & data )

add a entry to our cache. the entry has to be pushed back in ascending order, with no gap. inserting a item that is within timeboundary will fail and do nothing.

Parameters
time_HV_SLOWCTRLa time in database time; not event time
data

Definition at line 110 of file VData.cxx.

110 {
111 if (time_HV_SLOWCTRL <= Boundary_time_High){ // first check if time is in boundary
112 // std::vector<Time_t>::iterator iter = std::upper_bound(timeVector.begin(), timeVector.end(), time_HV_SLOWCTRL);
113 // if (! (iter == timeVector.end())) {return;} //if found time in vector
114 return;
115 }
116 timeVector.push_back(time_HV_SLOWCTRL);
117 VdataVector.push_back(data);
119}
TTree * data
void updateBoundary()
Definition VData.h:48

◆ setOffsetEvt2Db()

void VData::setOffsetEvt2Db ( int time_offset)
inline

Definition at line 65 of file VData.h.

65{time_offset=time_offset;}

◆ setVoltagesStd()

void VData::setVoltagesStd ( VDataItem voltagesStd)
inline

Definition at line 45 of file VData.h.

45{this->voltagesStd=voltagesStd;}

◆ size()

size_t VData::size ( )
inline

Definition at line 54 of file VData.h.

54{return timeVector.size();}

Referenced by MdcHvDropSvc::queryRelativeHvDrop().

◆ updateBoundary()

void VData::updateBoundary ( )
inline

Definition at line 48 of file VData.h.

48 {
49 if (timeVector.size() >= 1) {
50 Boundary_time_High = timeVector[timeVector.size() - 1];
51 Boundary_time_Low = timeVector[0];
52 }
53 }

Referenced by push_back_sorted().

Member Data Documentation

◆ MDC_layers

const size_t VData::MDC_layers =VDataItem::MDC_layers
static

Definition at line 34 of file VData.h.


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