CMS 3D CMS Logo

eventindexmap.cc
Go to the documentation of this file.
1 #include "eventindexmap.h"
2 
3 using namespace RooUtil;
4 
7 
8 //_____________________________________________________________________________________
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 }
34 
35 //_____________________________________________________________________________________
36 bool RooUtil::EventIndexMap::hasEventList(TString cms4file) {
37  return eventlistmap_.find(cms4file) != eventlistmap_.end();
38 }
39 
40 //_____________________________________________________________________________________
41 TEventList* RooUtil::EventIndexMap::getEventList(TString cms4file) {
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 load(TString filename)
Definition: eventindexmap.cc:9
void error(TString msg, const char *fname="", int is_error=1)
Definition: printutil.cc:44
ii
Definition: cuy.py:589
bool hasEventList(TString)
TEventList * getEventList(TString)