BOSS
7.1.2
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 "GaudiKernel/Bootstrap.h"
8
#include "
DetVerSvc/DetVerSvc.h
"
9
#include <algorithm>
10
#include <iostream>
11
using namespace
std
;
12
13
BesGeoSelector::BesGeoSelector
()
14
{}
15
16
void
BesGeoSelector::addGeomFile
(
const
char
* fname,
int
startno)
17
{
18
cout <<
"BesGeoSelector: "
<< fname <<
" start phase "
<< startno << endl;
19
fgeom.push_back(
GeomFileInfo
(fname, startno));
20
sort(fgeom.begin(), fgeom.end());
21
}
22
23
void
BesGeoSelector::clear
()
24
{
25
fgeom.clear();
26
}
27
28
//Given run number, select a suitable geometry file, and return file name.
29
const
char
*
BesGeoSelector::getGeomFileNameFromRunNo
(
int
run_no)
30
{
31
DetVerSvc
dvs(
"DetVerSvc"
, Gaudi::svcLocator());
//For converting runno to phase
32
dvs.
initialize
();
33
int
absno = (run_no >= 0 ? run_no : -run_no);
34
35
for
(vector<GeomFileInfo>::reverse_iterator i = fgeom.rbegin(); i != fgeom.rend(); ++i)
36
{
37
// if (absno >= i->startno)
38
// {
39
// return i->filename.c_str();
40
// }
41
42
//In BOSS 7.0.3, use DecVerSvc package to choose geometry
43
int
phase = dvs.
fromRun
(absno);
44
if
(phase >= i->startno)
45
{
46
return
i->filename.c_str();
47
}
48
}
49
cout <<
"BesGeoSelector Error: There is no suitable detector geometry!"
<< endl;
50
return
""
;
51
}
52
53
//Given file name, find whether the list contains this file.
54
bool
BesGeoSelector::hasGeomFile
(
const
char
* fname)
55
{
56
string
filename(fname);
57
for
(vector<GeomFileInfo>::iterator i = fgeom.begin(); i != fgeom.end(); ++i)
58
{
59
if
(filename == i->filename)
return
true
;
60
}
61
return
false
;
62
}
BesGeoSelector.h
DetVerSvc.h
BesGeoSelector::BesGeoSelector
BesGeoSelector()
Definition
BesGeoSelector.cxx:13
BesGeoSelector::clear
void clear()
Definition
BesGeoSelector.cxx:23
BesGeoSelector::getGeomFileNameFromRunNo
const char * getGeomFileNameFromRunNo(int run_no)
Definition
BesGeoSelector.cxx:29
BesGeoSelector::hasGeomFile
bool hasGeomFile(const char *fname)
Definition
BesGeoSelector.cxx:54
BesGeoSelector::addGeomFile
void addGeomFile(const char *fname, int startno)
Definition
BesGeoSelector.cxx:16
DetVerSvc
Definition
DetVerSvc.h:8
DetVerSvc::fromRun
int fromRun(unsigned int run)
Definition
DetVerSvc.cxx:88
DetVerSvc::initialize
virtual StatusCode initialize()
Definition
DetVerSvc.cxx:37
std
Definition
RootEventData/RootEventData_rootcint.cxx:38
GeomFileInfo
Definition
BesGeoSelector.h:14
7.1.2
EventDisplay
BesVisClient
BesVisClient-00-05-00
src
BesGeoSelector.cxx
Generated by
1.12.0