CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
RooUtil::EventIndexMap Class Reference

#include <eventindexmap.h>

Public Member Functions

 EventIndexMap ()
 
TEventList * getEventList (TString)
 
bool hasEventList (TString)
 
void load (TString filename)
 
 ~EventIndexMap ()
 

Public Attributes

std::map< TString, TEventList * > eventlistmap_
 

Detailed Description

Definition at line 16 of file eventindexmap.h.

Constructor & Destructor Documentation

◆ EventIndexMap()

RooUtil::EventIndexMap::EventIndexMap ( )

Definition at line 5 of file eventindexmap.cc.

5 {}

◆ ~EventIndexMap()

RooUtil::EventIndexMap::~EventIndexMap ( )

Definition at line 6 of file eventindexmap.cc.

6 {}

Member Function Documentation

◆ getEventList()

TEventList * RooUtil::EventIndexMap::getEventList ( TString  cms4file)

Definition at line 41 of file eventindexmap.cc.

References RooUtil::error().

41  {
42  if (not hasEventList(cms4file))
43  error(TString::Format("Does not have the event list for the input %s but asked for it!", cms4file.Data()),
44  __FUNCTION__);
45 
46  return eventlistmap_[cms4file];
47 }
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
std::map< TString, TEventList * > eventlistmap_
Definition: eventindexmap.h:18
bool hasEventList(TString)

◆ hasEventList()

bool RooUtil::EventIndexMap::hasEventList ( TString  cms4file)

Definition at line 36 of file eventindexmap.cc.

36  {
37  return eventlistmap_.find(cms4file) != eventlistmap_.end();
38 }
std::map< TString, TEventList * > eventlistmap_
Definition: eventindexmap.h:18

◆ load()

void RooUtil::EventIndexMap::load ( TString  filename)

Definition at line 9 of file eventindexmap.cc.

References corrVsCorr::filename, compare_using_db::ifile, cuy::ii, mps_splice::line, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by RooUtil::Looper< LSTEff >::setEventIndexMap().

9  {
10  eventlistmap_.clear();
11 
12  std::ifstream ifile;
13  ifile.open(filename.Data());
15 
16  while (std::getline(ifile, line)) {
17  std::string cms4path;
18  int number_of_events;
19  TEventList* event_indexs = new TEventList(cms4path.c_str());
20  unsigned int event_index;
21 
22  std::stringstream ss(line);
23 
24  ss >> cms4path >> number_of_events;
25 
26  for (int ii = 0; ii < number_of_events; ++ii) {
27  ss >> event_index;
28  event_indexs->Enter(event_index);
29  }
30 
31  eventlistmap_[cms4path] = event_indexs;
32  }
33 }
std::map< TString, TEventList * > eventlistmap_
Definition: eventindexmap.h:18
ii
Definition: cuy.py:589

Member Data Documentation

◆ eventlistmap_

std::map<TString, TEventList*> RooUtil::EventIndexMap::eventlistmap_

Definition at line 18 of file eventindexmap.h.