CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
BesGeoSelector.cxx
Go to the documentation of this file.
1/*
2 * 2018/5/11 Long Peixun IHEP
3 * Geometry Selection for EventDisplay
4*/
5
6#include "BesVisClient/BesGeoSelector.h"
7#include <algorithm>
8#include <iostream>
9using namespace std;
10
12
13void BesGeoSelector::addGeomFile(const char* fname, int startno)
14{
15 cout << "BesGeoSelector: " << fname << " start number " << startno << endl;
16 fgeom.push_back(GeomFileInfo(fname, startno));
17 sort(fgeom.begin(), fgeom.end());
18}
19
21{
22 fgeom.clear();
23}
24
25//Given run number, select a suitable geometry file, and return file name.
27{
28 int absno = (run_no >= 0 ? run_no : -run_no);
29 for (vector<GeomFileInfo>::reverse_iterator i = fgeom.rbegin(); i != fgeom.rend(); ++i)
30 {
31 if (absno >= i->startno)
32 {
33 return i->filename.c_str();
34 }
35 }
36 cout << "BesGeoSelector Error: There is no suitable detector geometry!" << endl;
37 return "";
38}
39
40//Given file name, find whether the list contains this file.
41bool BesGeoSelector::hasGeomFile(const char* fname)
42{
43 string filename(fname);
44 for (vector<GeomFileInfo>::iterator i = fgeom.begin(); i != fgeom.end(); ++i)
45 {
46 if (filename == i->filename) return true;
47 }
48 return false;
49}
const char * getGeomFileNameFromRunNo(int run_no)
bool hasGeomFile(const char *fname)
void addGeomFile(const char *fname, int startno)