CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
FileFilterAlg Class Reference

#include <FileFilterAlg.h>

+ Inheritance diagram for FileFilterAlg:

Public Member Functions

 FileFilterAlg (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 FileFilterAlg (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Constructor & Destructor Documentation

◆ FileFilterAlg() [1/2]

FileFilterAlg::FileFilterAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 21 of file FileFilterAlg.cxx.

21 :
22Algorithm(name, pSvcLocator)
23{
24 declareProperty("EventListFile",m_EventListFile="EventList.txt");
25}

◆ FileFilterAlg() [2/2]

FileFilterAlg::FileFilterAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Member Function Documentation

◆ execute() [1/2]

StatusCode FileFilterAlg::execute ( )

Definition at line 60 of file FileFilterAlg.cxx.

61{
62 //interface to event data service
63 ISvcLocator* svcLocator = Gaudi::svcLocator();
64 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
65 if (sc.isFailure())
66 std::cout<<"Could not accesss EventDataSvc!"<<std::endl;
67
68 setFilterPassed(false);
69
70 SmartDataPtr<Event::EventHeader> eventHeader(m_evtSvc,"/Event/EventHeader");
71 if(!eventHeader)
72 std::cout<<"Could not retrieve EventHeader"<<std::endl;
73
74 int run=eventHeader->runNumber();
75 int event=eventHeader->eventNumber();
76 std::cout<<"run: "<<run<<" event: "<<event<<std::endl;
77 //if(run==-10513 && event==0)
78 map<int,vector<int> >::iterator iter = eventMap.find(run);
79 if(iter!=eventMap.end()){
80 vector<int>::iterator it = find(iter->second.begin(), iter->second.end(), event);
81 if( it != iter->second.end() ) {
82 std::cout<<"find run: "<<run<<" event: "<<event<<std::endl;
83 setFilterPassed(true);
84 }
85 }
86
87 return StatusCode::SUCCESS;
88
89}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

◆ execute() [2/2]

StatusCode FileFilterAlg::execute ( )

◆ finalize() [1/2]

StatusCode FileFilterAlg::finalize ( )

Definition at line 50 of file FileFilterAlg.cxx.

51{
52 MsgStream log(msgSvc(), name());
53 log << MSG::INFO << "FileFilterAlg finalize()" << endreq;
54
55 return StatusCode::SUCCESS;
56
57}

◆ finalize() [2/2]

StatusCode FileFilterAlg::finalize ( )

◆ initialize() [1/2]

StatusCode FileFilterAlg::initialize ( )

Definition at line 27 of file FileFilterAlg.cxx.

28{
29 MsgStream log(msgSvc(), name());
30 log << MSG::INFO << " FileFilterAlg initialize()" << endreq;
31
32 ifstream fin(m_EventListFile.c_str());
33
34 int runNo,eventNo;
35
36 while ( !(fin>>runNo>>eventNo).eof() )
37 {
38 cout<<"runNo: "<<runNo<<" eventNo: "<<eventNo<<endl;
39 eventMap[runNo].push_back(eventNo);
40 }
41 map<int,vector<int> >::iterator iter;
42 for(iter=eventMap.begin();iter!=eventMap.end();iter++)
43 {
44 cout<<iter->first<<endl;
45 }
46
47 return StatusCode::SUCCESS;
48}
int runNo
int eventNo

◆ initialize() [2/2]

StatusCode FileFilterAlg::initialize ( )

The documentation for this class was generated from the following files: