ATLAS Offline Software
Classes | Public Member Functions | Public Attributes | Private Attributes | List of all members
Root::TGoodRun Class Reference

#include <TGoodRun.h>

Inheritance diagram for Root::TGoodRun:
Collaboration diagram for Root::TGoodRun:

Classes

struct  SorterL2H
 

Public Member Functions

 TGoodRun ()
 
 TGoodRun (const Int_t &runnr)
 
virtual ~TGoodRun ()
 
 TGoodRun (const Root::TGoodRun &other)
 
TGoodRunoperator= (const TGoodRun &other)
 
const Root::TGoodRun GetOverlapWith (const TGoodRun &other) const
 
const Root::TGoodRun GetSumWith (const TGoodRun &other) const
 
const Root::TGoodRun GetPartOnlyIn (const TGoodRun &other) const
 
const Root::TGoodRun GetPartNotIn (const TGoodRun &other) const
 
Bool_t IsEmpty () const
 
Bool_t HasLB (const Int_t &lumiblocknr) const
 
std::vector< Root::TLumiBlockRange >::iterator Find (const Int_t &lumiblocknr)
 
std::vector< Root::TLumiBlockRange >::const_iterator Find (const Int_t &lumiblocknr) const
 
Int_t GetRunNumber () const
 
void SetRunNumber (const Int_t &runnr)
 
void Summary () const
 
void Sort ()
 
void Compress ()
 
void AddLB (const Int_t &lumiblocknr)
 

Public Attributes

elements
 STL member. More...
 

Private Attributes

Int_t m_runnr
 

Detailed Description

Definition at line 27 of file TGoodRun.h.

Constructor & Destructor Documentation

◆ TGoodRun() [1/3]

Root::TGoodRun::TGoodRun ( )

◆ TGoodRun() [2/3]

Root::TGoodRun::TGoodRun ( const Int_t &  runnr)

Definition at line 22 of file TGoodRun.cxx.

23  : std::vector<TLumiBlockRange>()
24  , TObject()
25  , m_runnr(runnr)
26 {
27 }

◆ ~TGoodRun()

Root::TGoodRun::~TGoodRun ( )
virtual

Definition at line 30 of file TGoodRun.cxx.

31 {
32 }

◆ TGoodRun() [3/3]

Root::TGoodRun::TGoodRun ( const Root::TGoodRun other)

Definition at line 35 of file TGoodRun.cxx.

36  : std::vector<TLumiBlockRange>(other)
37  , TObject(other)
38  , m_runnr(other.m_runnr)
39 {
40 }

Member Function Documentation

◆ AddLB()

void Root::TGoodRun::AddLB ( const Int_t &  lumiblocknr)

Definition at line 266 of file TGoodRun.cxx.

267 {
268  if ( lumiblocknr<0 ) return;
269  if ( this->HasLB(lumiblocknr) ) return;
270 
271  // add at end
272  std::vector< TLumiBlockRange >::iterator eitr = this->Find(lumiblocknr-1);
273  if (eitr!=this->end()) {
274  eitr->SetEnd(lumiblocknr);
275  this->Compress();
276  return;
277  }
278  // add at beginning
279  std::vector< TLumiBlockRange >::iterator bitr = this->Find(lumiblocknr+1);
280  if (bitr!=this->end()) {
281  bitr->SetBegin(lumiblocknr);
282  this->Compress();
283  return;
284  }
285  // add as new range
286  this->push_back(Root::TLumiBlockRange(lumiblocknr,lumiblocknr));
287  this->Sort();
288  return;
289 }

◆ Compress()

void Root::TGoodRun::Compress ( )

Definition at line 200 of file TGoodRun.cxx.

201 {
202  // this function throws away redundant lb ranges.
203 
204  // need to be sure goodrun is sorted in lumiblock ranges
205  this->Sort();
206 
207  std::vector<TLumiBlockRange>::iterator itr, cbegin, cend;
208  int fbegin(-1), /* fend(-1), */ tbegin(-1), tend(-1), lbegin(-1), lend(-1);
209 
210  for (itr=this->begin(); itr!=this->end();) {
211  cbegin = itr;
212  cend = itr;
213 
214  // first lumiblock of merge
215  fbegin = cbegin->Begin();
216  //fend = cbegin->End();
217 
218  // search all connecting lumi ranges
219  bool go_on(true);
220  for (++itr; itr!=this->end() && go_on; ++itr) {
221  tbegin = cend->Begin();
222  tend = cend->End();
223  lbegin = itr->Begin();
224  lend = itr->End();
225  if ( lbegin>=tbegin && lend>=tend ) { // should always be true
226  if (tend+1<lbegin) { go_on=false; }
227  else { cend = itr; }
228  }
229  }
230 
231  // reset iterator
232  itr=cend; ++itr;
233 
234  if (cbegin!=cend) {
235  // first lumiblock of merge
236  fbegin = cbegin->Begin();
237  //fend = cbegin->End();
238  // last lumiblock of merge
239  lbegin = cend->Begin();
240  lend = cend->End();
241  // remove [cbegin,itr)
242  itr = this->erase(cbegin,itr);
243  // insert merge lbrange before itr
244  this->insert(itr,Root::TLumiBlockRange(fbegin,lend));
245  }
246  }
247 }

◆ Find() [1/2]

std::vector< Root::TLumiBlockRange >::iterator Root::TGoodRun::Find ( const Int_t &  lumiblocknr)

Definition at line 149 of file TGoodRun.cxx.

150 {
152 
153  Bool_t pass(kFALSE);
154  for (; itr!=this->end(); ++itr) {
155  pass = itr->Contains(lumiblocknr) ;
156  if (pass) break;
157  }
158 
159  return itr;
160 }

◆ Find() [2/2]

std::vector< Root::TLumiBlockRange >::const_iterator Root::TGoodRun::Find ( const Int_t &  lumiblocknr) const

Definition at line 164 of file TGoodRun.cxx.

165 {
166  std::vector<TLumiBlockRange>::const_iterator itr = this->begin();
167 
168  Bool_t pass(kFALSE);
169  for (; itr!=this->end(); ++itr) {
170  pass = itr->Contains(lumiblocknr) ;
171  if (pass) break;
172  }
173 
174  return itr;
175 }

◆ GetOverlapWith()

const Root::TGoodRun Root::TGoodRun::GetOverlapWith ( const TGoodRun other) const

Definition at line 57 of file TGoodRun.cxx.

58 {
59  Int_t runnr = ( this->GetRunNumber()==other.GetRunNumber() ? this->GetRunNumber() : -1 ) ;
60 
61  Root::TGoodRun overlaprun(runnr);
62  if (runnr==-1) return overlaprun; // no overlap -> empty overlap
63 
64  std::vector<Root::TLumiBlockRange>::const_iterator itr1 = this->begin();
65  std::vector<Root::TLumiBlockRange>::const_iterator itr2 = other.begin();
66 
67  for (; itr1!=this->end(); ++itr1) {
68  for (itr2=other.begin(); itr2!=other.end(); ++itr2) {
69  const Root::TLumiBlockRange lbr = itr1->GetOverlapWith(*itr2) ;
70  if (!lbr.IsEmpty()) overlaprun.push_back(lbr);
71  }
72  }
73 
74  return overlaprun;
75 }

◆ GetPartNotIn()

const Root::TGoodRun Root::TGoodRun::GetPartNotIn ( const TGoodRun other) const

Definition at line 108 of file TGoodRun.cxx.

109 {
110  Root::TGoodRun notinother(*this);
111 
112  if (this->GetRunNumber()==other.GetRunNumber()) {
113 
114  Root::TGoodRun tmprun(this->GetRunNumber());
115  std::vector<Root::TLumiBlockRange>::const_iterator itro,itrt,lbvecitr;
116 
117  for (itro=other.begin(); itro!=other.end(); ++itro) {
118  tmprun.clear();
119  for (itrt=notinother.begin(); itrt!=notinother.end(); ++itrt) {
120  std::vector<Root::TLumiBlockRange> lbvec = itrt->GetPartNotIn(*itro);
121  for (lbvecitr=lbvec.begin(); lbvecitr!=lbvec.end(); ++lbvecitr)
122  tmprun.push_back(*lbvecitr);
123  }
124  notinother=tmprun;
125  }
126  }
127 
128  return notinother;
129 }

◆ GetPartOnlyIn()

const Root::TGoodRun Root::TGoodRun::GetPartOnlyIn ( const TGoodRun other) const

Definition at line 101 of file TGoodRun.cxx.

102 {
103  return other.GetPartNotIn(*this);
104 }

◆ GetRunNumber()

Int_t Root::TGoodRun::GetRunNumber ( ) const
inline

Definition at line 52 of file TGoodRun.h.

56 {

◆ GetSumWith()

const Root::TGoodRun Root::TGoodRun::GetSumWith ( const TGoodRun other) const

Definition at line 79 of file TGoodRun.cxx.

80 {
81  Int_t runnr = ( this->GetRunNumber()==other.GetRunNumber() ? this->GetRunNumber() : -1 ) ;
82 
83  Root::TGoodRun sumrun(runnr);
84  if (runnr==-1) return sumrun; // only add runs with same runnumber
85 
86  Root::TGoodRun overlap = this->GetOverlapWith(other);
87  Root::TGoodRun onlyinother = this->GetPartOnlyIn(other);
88  Root::TGoodRun notinother = this->GetPartNotIn(other);
89 
90  std::vector<Root::TLumiBlockRange>::const_iterator itr;
91  for (itr=overlap.begin(); itr!=overlap.end(); ++itr) sumrun.push_back(*itr);
92  for (itr=onlyinother.begin(); itr!=onlyinother.end(); ++itr) sumrun.push_back(*itr);
93  for (itr=notinother.begin(); itr!=notinother.end(); ++itr) sumrun.push_back(*itr);
94  sumrun.Sort(); // sort lb ranges
95 
96  return sumrun;
97 }

◆ HasLB()

Bool_t Root::TGoodRun::HasLB ( const Int_t &  lumiblocknr) const

Definition at line 133 of file TGoodRun.cxx.

134 {
135  std::vector<TLumiBlockRange>::const_iterator itr = this->begin();
136  std::vector<TLumiBlockRange>::const_iterator end = this->end();
137 
138  Bool_t pass(kFALSE);
139  for (; itr!=end; ++itr) {
140  pass = pass || itr->Contains(lumiblocknr) ;
141  if (pass) break;
142  }
143 
144  return pass;
145 }

◆ IsEmpty()

Bool_t Root::TGoodRun::IsEmpty ( ) const

Definition at line 251 of file TGoodRun.cxx.

252 {
253  if (this->GetRunNumber()<0) return kTRUE;
254  if (this->empty()) return kTRUE;
255 
256  Bool_t isEmpty(kTRUE);
257  std::vector< TLumiBlockRange >::const_iterator litr = this->begin();
258  for (; litr!=this->end() && isEmpty; ++litr)
259  isEmpty = isEmpty && litr->IsEmpty();
260 
261  return isEmpty;
262 }

◆ operator=()

Root::TGoodRun & Root::TGoodRun::operator= ( const TGoodRun other)

Definition at line 44 of file TGoodRun.cxx.

45 {
46  if (&other==this) {
47  return *this ;
48  }
49  std::vector<TLumiBlockRange>::operator=(other);
50  m_runnr = other.m_runnr;
51 
52  return *this ;
53 }

◆ SetRunNumber()

void Root::TGoodRun::SetRunNumber ( const Int_t &  runnr)
inline

Definition at line 53 of file TGoodRun.h.

56 {

◆ Sort()

void Root::TGoodRun::Sort ( )

Definition at line 193 of file TGoodRun.cxx.

194 {
195  std::sort(this->begin(),this->end(),SorterL2H());
196 }

◆ Summary()

void Root::TGoodRun::Summary ( ) const

Definition at line 179 of file TGoodRun.cxx.

180 {
181  Root::TMsgLogger m_logger("TGoodRun");
182  m_logger << kINFO << "Run: " << m_runnr << GEndl;
183 
184  std::vector<TLumiBlockRange>::const_iterator itr = this->begin();
185  std::vector<TLumiBlockRange>::const_iterator end = this->end();
186 
187  for (; itr!=end; ++itr)
188  itr->Summary() ;
189 }

Member Data Documentation

◆ elements

T std::vector< T >::elements
inherited

STL member.

◆ m_runnr

Int_t Root::TGoodRun::m_runnr
private

Definition at line 63 of file TGoodRun.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Root::TGoodRun::GetPartOnlyIn
const Root::TGoodRun GetPartOnlyIn(const TGoodRun &other) const
Definition: TGoodRun.cxx:101
Root::TGoodRun
Definition: TGoodRun.h:27
Root::TGoodRun::Sort
void Sort()
Definition: TGoodRun.cxx:193
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
GEndl
#define GEndl
Definition: TMsgLogger.h:151
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Root::TLumiBlockRange::IsEmpty
Bool_t IsEmpty() const
Definition: TLumiBlockRange.h:50
Root::TGoodRun::GetPartNotIn
const Root::TGoodRun GetPartNotIn(const TGoodRun &other) const
Definition: TGoodRun.cxx:108
python.TriggerHandler.tend
string tend
Definition: TriggerHandler.py:300
Root::kINFO
@ kINFO
Definition: TMsgLogger.h:50
beamspotman.runnr
runnr
Definition: beamspotman.py:724
Root::TGoodRun::HasLB
Bool_t HasLB(const Int_t &lumiblocknr) const
Definition: TGoodRun.cxx:133
Root::TGoodRun::m_runnr
Int_t m_runnr
Definition: TGoodRun.h:63
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
Root::TGoodRun::Compress
void Compress()
Definition: TGoodRun.cxx:200
Root::TLumiBlockRange
Definition: TLumiBlockRange.h:26
Root::TGoodRun::GetRunNumber
Int_t GetRunNumber() const
Definition: TGoodRun.h:52
Root::TGoodRun::GetOverlapWith
const Root::TGoodRun GetOverlapWith(const TGoodRun &other) const
Definition: TGoodRun.cxx:57
Root::TMsgLogger
Definition: TMsgLogger.h:52
Root::TGoodRun::Find
std::vector< Root::TLumiBlockRange >::iterator Find(const Int_t &lumiblocknr)
Definition: TGoodRun.cxx:149