BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EFFlightTime Class Reference

#include <EFFlightTime.h>

Inheritance diagram for EFFlightTime:

Public Member Functions

 EFFlightTime (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~EFFlightTime ()
virtual StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
void reset ()
Public Member Functions inherited from IEFAlgorithm
 IEFAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~IEFAlgorithm ()

Additional Inherited Members

Protected Attributes inherited from IEFAlgorithm
int m_output
float m_beam
PropertyMgr m_propMgr
bool m_run
HltStoreSvcm_HltStoreSvc
IRawDataProviderSvcm_rawDigiSvc
EFResultm_ef

Detailed Description

Definition at line 15 of file EFFlightTime.h.

Constructor & Destructor Documentation

◆ EFFlightTime()

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

Definition at line 19 of file EFFlightTime.cxx.

20 : IEFAlgorithm( name, pSvcLocator ) {
21 int output = ( m_output % 10 ) / 1;
22 // declareProperty("OutputLevel",m_output = MSG::NIL);
23 MsgStream log( msgSvc(), name );
24 msgSvc()->setOutputLevel( name, output );
25 m_dtof1 = new CriteriaItemValue;
26 m_dphi1 = new CriteriaItemValue;
27 m_dtof2 = new CriteriaItemValue;
28 m_dphi2 = new CriteriaItemValue;
29}
*******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 output
Definition FoamA.h:89
IMessageSvc * msgSvc()
IEFAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)

◆ ~EFFlightTime()

EFFlightTime::~EFFlightTime ( )
virtual

Definition at line 31 of file EFFlightTime.cxx.

31 {
32 delete m_dtof1;
33 delete m_dphi1;
34 delete m_dtof2;
35 delete m_dphi2;
36}

Member Function Documentation

◆ execute()

StatusCode EFFlightTime::execute ( )

Definition at line 75 of file EFFlightTime.cxx.

75 {
76
77 reset();
78
79 MsgStream log( msgSvc(), name() );
80 // DataObject* pObject;
81
82 // Part 1: Get the event header, print out event and run number
83 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
84 if ( !eventHeader )
85 {
86 log << MSG::FATAL << "Could not find Event Header" << endmsg;
87 return ( StatusCode::FAILURE );
88 }
89
90 // Part 2: Retrieve Hits Collection
91 // SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),"/Event/Digi/TofDigiCol");
92 // if (!tofDigiCol) {
93 // log << MSG::FATAL << "EmcRec could not find Tof digi!!" << endmsg;
94 // return( StatusCode::FAILURE);
95 // }
96 // Part 3: Calculate time difference and back-to-back
97 // TofDigiCol::iterator iterTOF=tofDigiCol->begin();
98 VTOF topTOF;
99 VTOF bottomTOF;
100 topTOF.clear();
101 bottomTOF.clear();
102 Identifier id;
103 unsigned int idBarrel_Endcap, iphi;
104 double tdc;
105
106 TofDataVector tofDataVec = m_rawDigiSvc->tofDataVectorOnlineMode();
107 // TofDataVec tofDataVec=m_rawDigiSvc->tofDataVector(false,false,false,true);
108 if ( tofDataVec.size() > 1 )
109 {
110 TofDataVector::iterator iterTOF = tofDataVec.begin();
111 for ( ; iterTOF != tofDataVec.end(); iterTOF++ )
112 {
113 if ( ( *iterTOF )->barrel() )
114 {
115 idBarrel_Endcap = 1;
116 int id = ( *iterTOF )->tofId();
117 iphi = id % 88;
118 int ilayer = id / 88;
119 double t1 = ( *iterTOF )->tdc1();
120 double t2 = ( *iterTOF )->tdc2();
121 double tof = -999;
122 if ( t1 < 1500 && t2 < 1500 && t1 > 0 && t2 > 0 ) tof = 0.5 * ( t1 + t2 );
123 else if ( t1 < 1500 && t1 > 0 ) tof = t1;
124 else if ( t2 < 1500 && t2 > 0 ) tof = t2;
125 else continue;
126 log << MSG::DEBUG << "hit: "
127 << "(" << idBarrel_Endcap << "," << ilayer << "," << iphi << ")-->" << tof << " ns"
128 << endmsg;
129 // if(idBarrel_Endcap!=1&&idBarrel_Endcap!=0&&idBarrel_Endcap!=2)
130 // log << MSG::WARNING <<"TOF(" <<idBarrel_Endcap <<","<< ilayer << "," << iphi <<
131 // ")=>"
132 // << tdc <<endmsg;
133 if ( iphi < 41 && iphi > 2 )
134 { topTOF.push_back( EFTofHitsCol( idBarrel_Endcap, ilayer, iphi, tof ) ); }
135 else if ( iphi > 46 && iphi < 85 )
136 { bottomTOF.push_back( EFTofHitsCol( idBarrel_Endcap, ilayer, iphi, tof ) ); }
137 }
138 else
139 {
140 int iphi = ( *iterTOF )->tofId();
141 double tof = ( *iterTOF )->tdc();
142 if ( iphi >= 48 )
143 {
144 idBarrel_Endcap = 2;
145 iphi %= 48;
146 }
147 else idBarrel_Endcap = 0;
148 if ( iphi > 1 && iphi < 22 && tof > 0 && tof < 1500 )
149 { topTOF.push_back( EFTofHitsCol( idBarrel_Endcap, 0, iphi, tof ) ); }
150 else if ( iphi > 25 && iphi < 46 && tof > 0 && tof < 1500 )
151 { bottomTOF.push_back( EFTofHitsCol( idBarrel_Endcap, 0, iphi, tof ) ); }
152 }
153 }
154 }
155 double dtof1 = 99;
156 double dphi1 = 180;
157 double dtof2 = 99;
158 double dphi2 = 180;
159 if ( topTOF.size() >= 1 && bottomTOF.size() >= 1 )
160 {
161 for ( unsigned int i = 0; i < topTOF.size(); i++ )
162 {
163 double topPhi = 0.;
164 if ( topTOF[i].ib_e() == 1 ) { topPhi = topTOF[i].iphi() * 360. / 88.; }
165 else if ( topTOF[i].ib_e() == 0 || topTOF[i].ib_e() == 2 )
166 { topPhi = topTOF[i].iphi() * 360. / 48.; }
167 else { log << MSG::ERROR << "TOF Barrel_Encap ID not right!" << endmsg; }
168 for ( unsigned int j = 0; j < bottomTOF.size(); j++ )
169 {
170 double bottomPhi = 0.;
171 if ( bottomTOF[j].ib_e() == 1 ) { bottomPhi = bottomTOF[j].iphi() * 360. / 88.; }
172 else if ( bottomTOF[j].ib_e() == 0 || bottomTOF[j].ib_e() == 2 )
173 { bottomPhi = bottomTOF[j].iphi() * 360. / 48.; }
174 else { log << MSG::ERROR << "TOF Barrel_Encap ID not right!" << endmsg; }
175 double tmp1 = fabs( topTOF[i].GetT() - bottomTOF[j].GetT() );
176 double tmp2 = fabs( topTOF[i].GetT() - bottomTOF[j].GetT() + 7. );
177 if ( tmp2 < fabs( dtof2 + 7. ) )
178 {
179 dtof2 = topTOF[i].GetT() - bottomTOF[j].GetT();
180 dphi2 = abs( fabs( topPhi - bottomPhi ) - 180. );
181 }
182 if ( tmp1 < fabs( dtof1 ) )
183 {
184 dphi1 = abs( fabs( topPhi - bottomPhi ) - 180. );
185 dtof1 = topTOF[i].GetT() - bottomTOF[j].GetT();
186 }
187 }
188 }
189 }
190
191 log << MSG::INFO << "dtof1=" << dtof1 << ", dphi1=" << dphi1 << "dtof2=" << dtof2
192 << ", dphi2=" << dphi2 << endmsg;
193
194 // Part 4: Put the criteria item(s) to HltStoreSvc here
195 m_dtof1->setValue( dtof1 );
196 m_dphi1->setValue( dphi1 );
197 m_dtof2->setValue( dtof2 );
198 m_dphi2->setValue( dphi2 );
199 m_ef->appToEFVec( dtof1, 26 );
200 m_ef->appToEFVec( dphi1, 27 );
201 m_ef->appToEFVec( dtof2, 28 );
202 m_ef->appToEFVec( dphi2, 29 );
203 m_ef->setVecBit( true, 0, 5 );
204 m_ef->addToEFVec( 4 << 8, 1 );
205
206 m_run = 1;
207 return StatusCode::SUCCESS;
208}
std::vector< EFTofHitsCol > VTOF
EFResult * m_ef
IRawDataProviderSvc * m_rawDigiSvc

◆ finalize()

StatusCode EFFlightTime::finalize ( )

Definition at line 210 of file EFFlightTime.cxx.

210 {
211 MsgStream log( msgSvc(), name() );
212 log << MSG::INFO << "in finalize()" << endmsg;
213 return StatusCode::SUCCESS;
214}

◆ initialize()

StatusCode EFFlightTime::initialize ( )
virtual

Reimplemented from IEFAlgorithm.

Definition at line 38 of file EFFlightTime.cxx.

38 {
39
40 MsgStream log( msgSvc(), name() );
41 log << MSG::INFO << "in initialize()" << endmsg;
42
44
45 StatusCode sc;
46 sc = m_HltStoreSvc->put( "dtof1", m_dtof1 );
47 if ( sc.isFailure() )
48 {
49 log << MSG::ERROR << "m_HltStoreSvc->put(dtof1) wrong" << endmsg;
50 return sc;
51 }
52 sc = m_HltStoreSvc->put( "dphi1", m_dphi1 );
53 if ( sc.isFailure() )
54 {
55 log << MSG::ERROR << "m_HltStoreSvc->put(dphi1) wrong" << endmsg;
56 return sc;
57 }
58 sc = m_HltStoreSvc->put( "dtof2", m_dtof2 );
59 if ( sc.isFailure() )
60 {
61 log << MSG::ERROR << "m_HltStoreSvc->put(dtof2) wrong" << endmsg;
62 return sc;
63 }
64 sc = m_HltStoreSvc->put( "dphi2", m_dphi2 );
65 if ( sc.isFailure() )
66 {
67 log << MSG::ERROR << "m_HltStoreSvc->put(dphi2) wrong" << endmsg;
68 return sc;
69 }
70
71 log << MSG::DEBUG << "finish initialize()" << endmsg;
72 return StatusCode::SUCCESS;
73}
virtual StatusCode initialize()
HltStoreSvc * m_HltStoreSvc

◆ reset()

void EFFlightTime::reset ( )
virtual

Implements IEFAlgorithm.

Definition at line 216 of file EFFlightTime.cxx.

216 {
217
218 if ( m_run )
219 {
220 m_dtof1->reset();
221 m_dphi1->reset();
222 m_dtof2->reset();
223 m_dphi2->reset();
224 m_run = 0;
225 }
226 return;
227}

Referenced by execute().


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