14 |
_actionsPositions.push_back(GetSize() - 1); |
_actionsPositions.push_back(GetSize() - 1); |
15 |
_sumLT.push_back(0); |
_sumLT.push_back(0); |
16 |
_sum.push_back(0); |
_sum.push_back(0); |
17 |
|
_badsum.push_back(0); |
18 |
} |
} |
19 |
|
|
20 |
void LiveTimeCollection::OnBad(PamLevel2 *event, int actNumber, unsigned int inc) { |
void LiveTimeCollection::OnBad(PamLevel2 *event, int actNumber, unsigned int inc) { |
21 |
if((event->GetOrbitalInfo()->absTime - _currenttime > 1000.) || (_currenttime == 0)){ |
if((event->GetOrbitalInfo()->absTime - _currenttime > 1000.) || (_currenttime == 0)){ |
22 |
for(unsigned int j = 0; j < _sumLT.size(); j++ ) _sumLT[j] = 0; |
for(unsigned int j = 0; j < _sumLT.size(); j++ ){ |
23 |
|
if(_currenttime == 0) _badsum[j] = 0; else {_badsum[j] += _sumLT[j]; _gapNumb++;} |
24 |
|
_sumLT[j] = 0; |
25 |
|
} |
26 |
} |
} |
27 |
_currenttime = event->GetOrbitalInfo()->absTime; |
_currenttime = event->GetOrbitalInfo()->absTime; |
28 |
unsigned int Inc = 0; |
unsigned int Inc = 0; |
35 |
return _sum[actNumber] * 0.16 /1000. ; |
return _sum[actNumber] * 0.16 /1000. ; |
36 |
} |
} |
37 |
|
|
38 |
|
Float_t LiveTimeCollection::GetBadsumLiveTime(unsigned int actNumber) { |
39 |
|
if(actNumber >= _sum.size()) return -1; |
40 |
|
return _badsum[actNumber] * 0.16 /1000. ; |
41 |
|
} |
42 |
|
|
43 |
int LiveTimeCollection::ApplyCut(PamLevel2 *event) { |
int LiveTimeCollection::ApplyCut(PamLevel2 *event) { |
44 |
|
|
45 |
_nEv++; |
_nEv++; |
79 |
Int_t inc = 0; |
Int_t inc = 0; |
80 |
unsigned int lastPosition = _cuts.size(); |
unsigned int lastPosition = _cuts.size(); |
81 |
for (unsigned int i = iBeforeCuts; i < _actions.size(); i++) { |
for (unsigned int i = iBeforeCuts; i < _actions.size(); i++) { |
82 |
actNumber = i-1; |
actNumber = i; |
83 |
if (_actionsPositions[i] < (int) firstFailed){ |
if (_actionsPositions[i] < (int) firstFailed){ |
84 |
if((event->GetOrbitalInfo()->absTime - _currenttime > 1000.) || (_currenttime == 0)){ |
if((event->GetOrbitalInfo()->absTime - _currenttime > 1000.) || (_currenttime == 0)){ |
85 |
for(unsigned int j = 0; j < _sumLT.size(); j++ ) _sumLT[j] = 0; |
for(unsigned int j = 0; j < _sumLT.size(); j++ ) { |
86 |
|
if(_currenttime == 0) _badsum[j] = 0; else {_badsum[j] += _sumLT[j]; _gapNumb++;} |
87 |
|
_sumLT[j] = 0; |
88 |
|
} |
89 |
} |
} |
90 |
if( che ){ |
if( che ){ |
91 |
inc = event->GetTrigLevel2()->dltime[0]; |
inc = event->GetTrigLevel2()->dltime[0]; |
92 |
Inc = inc; |
Inc = inc; |
93 |
_sum[i] += _sumLT[i]+inc; |
} |
94 |
event->GetTrigLevel2()->dltime[0] += _sumLT[i] ; |
_sum[i] += (_sumLT[i]+inc); |
95 |
che = false; |
event->GetTrigLevel2()->dltime[0] += _sumLT[i] + inc; |
96 |
}else _sum[i] += (_sumLT[i]+inc); |
che = false; |
97 |
_actions[i]->OnGood(event); |
_actions[i]->OnGood(event); |
98 |
_sumLT[i] = 0; |
_sumLT[i] = 0; |
99 |
_currenttime = event->GetOrbitalInfo()->absTime; |
_currenttime = event->GetOrbitalInfo()->absTime; |
120 |
} |
} |
121 |
|
|
122 |
void LiveTimeCollection::Finalize() { |
void LiveTimeCollection::Finalize() { |
123 |
|
SmartCollection::Finalize(); |
124 |
ofstream livetimereport; |
ofstream livetimereport; |
125 |
livetimereport.open (_livetimereport); |
livetimereport.open (_livetimereport); |
126 |
livetimereport << "Action name\t\tsum live time"<<endl; |
livetimereport << "Action name\t\tsum live time"<<endl; |
127 |
for (UInt_t i = 0; i < _sum.size(); i++) livetimereport << _actions[i]->GetName()<<"\t"<<GetSumLiveTime(i)<<"sec"<<endl; |
for (UInt_t i = 0; i < _sum.size(); i++) livetimereport << _actions[i]->GetName()<<"\t"<<GetSumLiveTime(i)<<"sec"<<"\t"<<GetBadsumLiveTime(i)<<"\t"<<_gapNumb<<endl; |
128 |
livetimereport.close(); |
livetimereport.close(); |
129 |
} |
} |