BOSS 7.0.1
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 ()
 
 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 ()
 
virtual StatusCode initialize ()
 
virtual void reset ()=0
 
 IEFAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~IEFAlgorithm ()
 
virtual StatusCode initialize ()
 
virtual void reset ()=0
 

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

Constructor & Destructor Documentation

◆ EFFlightTime() [1/2]

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

Definition at line 19 of file EFFlightTime.cxx.

19 :
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

◆ ~EFFlightTime() [1/2]

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}

◆ EFFlightTime() [2/2]

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

◆ ~EFFlightTime() [2/2]

virtual EFFlightTime::~EFFlightTime ( )
virtual

Member Function Documentation

◆ execute() [1/2]

StatusCode EFFlightTime::execute ( )

Definition at line 71 of file EFFlightTime.cxx.

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

◆ execute() [2/2]

StatusCode EFFlightTime::execute ( )

◆ finalize() [1/2]

StatusCode EFFlightTime::finalize ( )

Definition at line 206 of file EFFlightTime.cxx.

206 {
207 MsgStream log(msgSvc(), name());
208 log << MSG::INFO << "in finalize()" << endmsg;
209 return StatusCode::SUCCESS;
210}

◆ finalize() [2/2]

StatusCode EFFlightTime::finalize ( )

◆ initialize() [1/2]

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()" << endreq;
42
44
45 StatusCode sc;
46 sc = m_HltStoreSvc->put("dtof1", m_dtof1);
47 if ( sc.isFailure() ) {
48 log << MSG::ERROR << "m_HltStoreSvc->put(dtof1) wrong" << endreq;
49 return sc;
50 }
51 sc = m_HltStoreSvc->put("dphi1", m_dphi1);
52 if ( sc.isFailure() ) {
53 log << MSG::ERROR << "m_HltStoreSvc->put(dphi1) wrong" << endreq;
54 return sc;
55 }
56 sc = m_HltStoreSvc->put("dtof2", m_dtof2);
57 if ( sc.isFailure() ) {
58 log << MSG::ERROR << "m_HltStoreSvc->put(dtof2) wrong" << endreq;
59 return sc;
60 }
61 sc = m_HltStoreSvc->put("dphi2", m_dphi2);
62 if ( sc.isFailure() ) {
63 log << MSG::ERROR << "m_HltStoreSvc->put(dphi2) wrong" << endreq;
64 return sc;
65 }
66
67 log << MSG::DEBUG << "finish initialize()" << endreq;
68 return StatusCode::SUCCESS;
69}
virtual StatusCode initialize()

◆ initialize() [2/2]

virtual StatusCode EFFlightTime::initialize ( )
virtual

Reimplemented from IEFAlgorithm.

◆ reset() [1/2]

void EFFlightTime::reset ( )
virtual

Implements IEFAlgorithm.

Definition at line 212 of file EFFlightTime.cxx.

212 {
213
214 if(m_run){
215 m_dtof1->reset();
216 m_dphi1->reset();
217 m_dtof2->reset();
218 m_dphi2->reset();
219 m_run=0;
220 }
221 return;
222}

Referenced by execute().

◆ reset() [2/2]

void EFFlightTime::reset ( )
virtual

Implements IEFAlgorithm.


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