CGEM BOSS
6.6.5.h
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>
9
using namespace
std
;
10
11
BesGeoSelector::BesGeoSelector
() {}
12
13
void
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
20
void
BesGeoSelector::clear
()
21
{
22
fgeom.clear();
23
}
24
25
//Given run number, select a suitable geometry file, and return file name.
26
const
char
*
BesGeoSelector::getGeomFileNameFromRunNo
(
int
run_no)
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.
41
bool
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
}
BesGeoSelector.h
BesGeoSelector::BesGeoSelector
BesGeoSelector()
Definition
BesGeoSelector.cxx:11
BesGeoSelector::clear
void clear()
Definition
BesGeoSelector.cxx:20
BesGeoSelector::getGeomFileNameFromRunNo
const char * getGeomFileNameFromRunNo(int run_no)
Definition
BesGeoSelector.cxx:26
BesGeoSelector::hasGeomFile
bool hasGeomFile(const char *fname)
Definition
BesGeoSelector.cxx:41
BesGeoSelector::addGeomFile
void addGeomFile(const char *fname, int startno)
Definition
BesGeoSelector.cxx:13
std
Definition
RootEventData_rootcint.cxx:16
GeomFileInfo
Definition
BesGeoSelector.h:14
6.6.5.h
EventDisplay
BesVisClient
BesVisClient-00-05-10
src
BesGeoSelector.cxx
Generated by
1.12.0