BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
JobInputRoot.cxx
Go to the documentation of this file.
1// #include "GaudiKernel/IJobOptionsSvc.h"
2#include "GaudiKernel/ISvcLocator.h"
3// #include "GaudiKernel/Property.h"
4#include "GaudiKernel/SmartIF.h"
5#include "TFile.h"
6#include "TTree.h"
7#include <cstdlib>
8
9namespace DetVerSvcPack {
10
11 int getRunFromFileList( const std::string& flist ) {
12 std::string::size_type p1 = flist.find( '"' ) + 1;
13 std::string::size_type p2 = flist.find( '"', p1 );
14 std::string fn = flist.substr( p1, p2 - p1 );
15
16 TFile* file = TFile::Open( fn.c_str(), "READ" );
17 TTree* tree = (TTree*)file->Get( "Event" );
18 tree->SetMakeClass( 1 );
19 int run;
20 tree->SetBranchAddress( "m_runId", &run );
21 tree->GetEntry( 0 );
22
23 return abs( run );
24 }
25
26 int funcInputRoot( ISvcLocator* svcLct ) {
27 SmartIF<IJobOptionsSvc> iSvc( svcLct->service( "JobOptionsSvc" ) );
28 if ( iSvc.isValid() )
29 {
30 const std::vector<const Property*>* ps = iSvc->getProperties( "EventCnvSvc" );
31 std::vector<const Property*>::const_iterator it, end = ps->end();
32 for ( it = ps->begin(); it != end; ++it )
33 {
34 if ( ( *it )->name() == "digiRootInputFile" )
35 { return getRunFromFileList( ( *it )->toString() ); }
36 }
37 }
38 return -1;
39 }
40
41 extern int ( *pf_helper )( ISvcLocator* );
42
43 // initialize function pointer: pf_helper
47
48 InputRootInit init;
49} // namespace DetVerSvcPack
double p2[4]
double p1[4]
char * file
Definition DQA_TO_DB.cxx:16
int funcInputRoot(ISvcLocator *svcLct)
int getRunFromFileList(const std::string &flist)
int(* pf_helper)(ISvcLocator *)
Definition DetVerSvc.cxx:21