3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/SmartDataPtr.h"
17: Algorithm(name, pSvcLocator),
23 declareProperty(
"dump", m_dump =
false);
24 declareProperty(
"ReadInjSigIntervalFromDB", m_readInjSigIntervalFromDB =
true);
25 declareProperty(
"ReadInjSigTimeFromDB", m_readInjSigTimeFromDB =
true);
26 declareProperty(
"InjSigInterval", m_interval=60);
27 declareProperty(
"RunListFile", m_runListFile);
28 m_printInterval =
true;
33 MsgStream log(
msgSvc(), name());
35 StatusCode sc = service(
"CalibDataSvc", m_calibDataSvc);
36 if ( sc.isFailure() ) {
37 log << MSG::FATAL <<
"can not get CalibDataSvc" << endreq;
38 return StatusCode::FAILURE;
41 sc = service(
"InjSigIntervalSvc", m_InjSigIntervalSvc);
42 if( sc != StatusCode::SUCCESS ){
43 log << MSG::FATAL <<
"can not use InjSigIntervalSvc" << endreq;
46 sc = service(
"InjSigTimeSvc", m_InjSigTimeSvc);
47 if( sc != StatusCode::SUCCESS ){
48 log << MSG::FATAL <<
"can not use InjSigTimeSvc" << endreq;
51 if ( ! m_runListFile.empty() ) {
53 std::ifstream ifs(m_runListFile.c_str());
55 while ( ifs.good() ) {
56 m_runList.push_back(
runNo);
65 return StatusCode::SUCCESS;
70 MsgStream log(
msgSvc(), name());
72 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
75 if ( m_fixer ==
NULL ) {
78 m_run = eventHeader->runNumber();
79 if ( std::find(m_runList.begin(), m_runList.end(), m_run) != m_runList.end() ) {
80 SmartDataPtr<CalibData::CorrectedETSCal> calConst(m_calibDataSvc,
"/Calib/CorrectedETS");
85 log << MSG::FATAL <<
"no result in DB for run " << m_run << endreq;
86 return StatusCode::FAILURE;
92 if ( m_alreadyInDB ) {
93 if ( m_run != eventHeader->runNumber() ) {
94 log << MSG::FATAL <<
"crossed runs are not supported" << endreq;
95 return StatusCode::FAILURE;
98 SmartDataPtr<CalibData::CorrectedETSCal> calConst(m_calibDataSvc,
"/Calib/CorrectedETS");
100 if ( m_count >= calConst->getNpar() || eventHeader->eventNumber() != calConst->getEvt(m_count) ) {
101 log << MSG::FATAL <<
"only 1 input file is supported" << endreq;
102 return StatusCode::FAILURE;
105 eventHeader->setRawEtsT1( eventHeader->etsT1() );
106 eventHeader->setEtsT1( calConst->getEts1(m_count) );
107 eventHeader->setEtsT2( calConst->getEts2_pre(m_count) );
108 eventHeader->setEtsFlag( calConst->getFlag_pre(m_count) );
112 return StatusCode::SUCCESS;
119 m_fixer->
fixT1(eventHeader);
125 if(m_readInjSigTimeFromDB){
126 int Npar = m_InjSigTimeSvc-> getNpar();
127 for(
int i=0; i<Npar; i++){
128 int flag = m_InjSigTimeSvc-> getFlag(i);
129 ULong64_t
time = m_InjSigTimeSvc-> getIST(i);
130 m_vecFlag.push_back(
flag);
131 m_vecTime.push_back(
time);
133 std::cout<<
"flag: "<<
flag<<
" time: "<<
time<<std::endl;
136 m_readInjSigTimeFromDB =
false;
139 if(m_readInjSigIntervalFromDB){
140 m_interval = double(m_InjSigIntervalSvc->
getTInterval());
141 m_readInjSigIntervalFromDB =
false;
145 cout <<
"ResetEts::execute() m_interval = " << m_interval << endl;
146 m_printInterval =
false;
149 unsigned long t1 = eventHeader->etsT1();
150 unsigned long t2 = eventHeader->etsT2();
154 std::cout<<
"raw data"<<std::endl<<
"Event: " << eventHeader->eventNumber()
155 <<
" run: " << eventHeader->runNumber()
156 <<
" time: " << eventHeader->time()
157 <<
" ETS_old: " << t1
158 <<
" IST_old: " << t2
163 double size = m_interval*
unit;
164 unsigned long ets2_pre = 0;
168 int vec_size = m_vecTime.size();
169 for(
int i=m_curIndex;i<vec_size;i++)
171 if (t1 < m_vecTime[i])
174 flag_pre = m_vecFlag[i];
175 ets2_pre = m_vecTime[i];
181 double delta= ((double)m_vecTime[i-1]-(
double)t1)/size;
193 ets2_pre = m_vecTime[i-1];
194 flag_pre = m_vecFlag[i-1];
200 else if (t1 >= m_vecTime[vec_size-1]){
201 flag_pre = m_vecFlag[vec_size-1];
202 ets2_pre = m_vecTime[vec_size-1];
209 eventHeader->setEtsT2(ets2_pre);
210 eventHeader->setEtsFlag(flag_pre);
214 std::cout<<
"ReSetETSAlg"<<std::endl<<
"Event: " << eventHeader->eventNumber()
215 <<
" run: " << eventHeader->runNumber()
216 <<
" time: " << eventHeader->time()
217 <<
" ETS_new: " << eventHeader->etsT1()
218 <<
" IST_new: " << eventHeader->etsT2()
219 <<
" flag_pre: " << eventHeader->etsFlag()
224 return StatusCode::SUCCESS;
229 if ( m_fixer !=
NULL ) {
233 return StatusCode::SUCCESS;
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in !Latex Output unit
void fixT1(Event::EventHeader *header)
virtual int getTInterval() const =0
ResetEtsAlg(const std::string &name, ISvcLocator *pSvcLocator)