CMS 3D CMS Logo

printUniqueNames.cc
Go to the documentation of this file.
1 #include "printUniqueNames.h"
2 
3 #include <iostream>
4 #include <iterator>
5 #include <iomanip>
6 
7 using namespace std;
8 
9 void magneticfield::printUniqueNames(handles::const_iterator begin, handles::const_iterator end, bool uniq) {
10  std::vector<std::string> names;
11  for (handles::const_iterator i = begin; i != end; ++i) {
12  if (uniq)
13  names.push_back((*i)->name);
14  else
15  names.push_back((*i)->name + ":" + std::to_string((*i)->copyno));
16  }
17 
18  sort(names.begin(), names.end());
19  if (uniq) {
20  std::vector<std::string>::iterator i = unique(names.begin(), names.end());
21  int nvols = int(i - names.begin());
22  cout << nvols << " ";
23  copy(names.begin(), i, ostream_iterator<std::string>(cout, " "));
24  } else {
25  cout << names.size() << " ";
26  copy(names.begin(), names.end(), ostream_iterator<std::string>(cout, " "));
27  }
28  cout << endl;
29 }
mps_fire.i
i
Definition: mps_fire.py:428
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
magneticfield::printUniqueNames
void printUniqueNames(handles::const_iterator begin, handles::const_iterator end, bool uniq=true)
Just for debugging...
Definition: printUniqueNames.cc:9
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
mps_fire.end
end
Definition: mps_fire.py:242
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
createfilelist.int
int
Definition: createfilelist.py:10
printUniqueNames.h
std
Definition: JetResolutionObject.h:76
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24