BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
LumTau Class Reference

#include <LumTau.h>

+ Inheritance diagram for LumTau:

Public Member Functions

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

Detailed Description

Definition at line 10 of file LumTau.h.

Constructor & Destructor Documentation

◆ LumTau()

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

Definition at line 54 of file LumTau.cxx.

54 :
55 Algorithm(name, pSvcLocator)
56{
57}

Member Function Documentation

◆ execute()

StatusCode LumTau::execute ( )

Definition at line 104 of file LumTau.cxx.

105{
106 StatusCode sc=StatusCode::SUCCESS;
107
108 MsgStream log(msgSvc(),name());
109 log<<MSG::INFO<<"in execute()"<<endreq;
110
111
112 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
113 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
114
115 log<<MSG::DEBUG<<"ncharg, nneu, tottks = "<<evtRecEvent->totalCharged()<<" , "<<evtRecEvent->totalNeutral()<<" , "<<evtRecEvent->totalTracks()<<endreq;
116 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(),EventModel::EvtRec::EvtRecTrackCol);
117
118 log<<MSG::DEBUG <<"ncharg, nneu, tottks = "<<evtRecEvent->totalCharged()<<" , "<<evtRecEvent->totalNeutral()<<" , "<<evtRecEvent->totalTracks()<<endreq;
119 SmartDataPtr<RecEsTimeCol> evTimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
120
121 int interval = 200;
122 interval = m_intervalSvc->getTInterval();
123 log<<MSG::DEBUG << "interval = " << interval << endreq;
124 m_topup = false;
125 if (interval <= 0 ) {
126 log << MSG::FATAL << "error in reading the interval!" << endreq;
127 return StatusCode::FAILURE;
128 }
129 else if ( interval < 100 ) { // top-up mode
130 m_topup = true;
131 }
132
133 double time = eventHeader->time();
134 log << MSG::DEBUG << "time = " << time << endreq;
135 if (time <=0 ) return StatusCode::SUCCESS;
136 m_time = time;
137 m_etsT1 = eventHeader->etsT1()/2000000.; // convert to second
138 log << MSG::DEBUG << "ets time = " << m_etsT1 << endreq;
139
140 m_run = eventHeader->runNumber();
141 m_rec = eventHeader->eventNumber();
142
143 if(m_rec%1000==0) log << MSG::INFO <<"Run "<<m_run<<" Event "<<m_rec<<endreq;
144
145 double Emax1 = -1;
146 double Emax2 = -1;
147 int Imax[2];
148
149 if((evtRecEvent->totalTracks() >= 2)){
150 double etot = 0.;
151 for(int i = 0;i < evtRecEvent->totalTracks(); i++)
152 {
153 if(i>=evtRecTrkCol->size()) break;
154 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
155 if(!(*itTrk)->isEmcShowerValid()) continue;
156 RecEmcShower *emcTrk = (*itTrk)->emcShower();
157 double Ener=emcTrk->energy();
158 if(Ener>Emax2)
159 {
160 Emax2=Ener;
161 Imax[1]=i;
162 }
163 if(Ener>Emax1)
164 {
165 Emax2=Emax1;
166 Imax[1]=Imax[0];
167 Emax1=Ener;
168 Imax[0]=i;
169 }
170 etot += Ener;
171 }
172
173 m_etot = etot;
174 m_e1 = Emax1;
175 m_e2 = Emax2;
176
177 log << MSG::INFO << "Emax1 = " << Emax1 <<"Emax2= "<<Emax2<< endreq;
178 if(Emax1 > 0 && Emax2 > 0){
179 double emcphi[2],emctht[2];
180 for(int i = 0;i < 2; i++)
181 {
182 if(i>=evtRecTrkCol->size()) break;
183 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + Imax[i];
184 if(!(*itTrk)->isEmcShowerValid()) continue;
185 RecEmcShower *emcTrk = (*itTrk)->emcShower();
186 emcphi[i]=emcTrk->phi();
187 emctht[i]=emcTrk->theta();
188 }
189
190 double dltphi=(fabs(emcphi[0]-emcphi[1])-pai)*180./pai;
191 double dlttht=(fabs(emctht[0]+emctht[1])-pai)*180./pai;
192 m_costht1=cos(emctht[0]);
193 m_costht2=cos(emctht[1]);
194 m_phi1=emcphi[0];
195 m_phi2=emcphi[1];
196 m_dlttht=dlttht;
197 m_dltphi=dltphi;
198 }
199 else{
200 m_etot = -1;
201 m_e1 = -1;
202 m_e2 = -1;
203 m_costht1 = -1;
204 m_costht2 = -1;
205 m_phi1 = -1;
206 m_phi2 = -1;
207 m_dlttht = -1;
208 m_dltphi = -1;
209 }
210 }
211 else{
212 m_etot = -1;
213 m_e1 = -1;
214 m_e2 = -1;
215 m_costht1 = -1;
216 m_costht2 = -1;
217 m_phi1 = -1;
218 m_phi2 = -1;
219 m_dlttht = -1;
220 m_dltphi = -1;
221 }
222
223// m_tuple2->write();
224
225 int DiskWrite = m_tuple2->write();
226 if(DiskWrite != 1){
227 log<<MSG::FATAL<<"ERROR In LumTau DiskWrite!"<<endreq;
228 exit(1);
229 }
230
231 return StatusCode::SUCCESS;
232}
const double pai
Definition: BbEmc.cxx:48
double cos(const BesAngle a)
Definition: BesAngle.h:213
Double_t etot
Double_t dltphi
Double_t time
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:111
IMessageSvc * msgSvc()
double theta() const
Definition: DstEmcShower.h:38
double phi() const
Definition: DstEmcShower.h:39
double energy() const
Definition: DstEmcShower.h:45
virtual int getTInterval() const =0
_EXTERN_ std::string EvtRecEvent
Definition: EventModel.h:116
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:117

◆ finalize()

StatusCode LumTau::finalize ( )

Definition at line 234 of file LumTau.cxx.

235{
236 MsgStream log(msgSvc(),name());
237 log << MSG::INFO <<"Event Finalize"<<endreq;
238 return StatusCode::SUCCESS;
239}

◆ hello()

StatusCode LumTau::hello ( )

◆ initialize()

StatusCode LumTau::initialize ( )

Definition at line 60 of file LumTau.cxx.

61{
62 MsgStream log(msgSvc(), name());
63
64 log << MSG::INFO << "in initialize()" << endmsg;
65
66 StatusCode status;
67
68 status = service("InjSigIntervalSvc", m_intervalSvc);
69 if ( status != StatusCode::SUCCESS ){
70 log << MSG::FATAL << "can not use InjSigIntervalSvc" << endreq;
71 }
72
73 NTuplePtr nt2(ntupleSvc(), "LumTau/event");
74 if ( nt2 ) m_tuple2 = nt2;
75 else
76 {
77 m_tuple2 = ntupleSvc()->book ("LumTau/event", CLID_ColumnWiseTuple, "Bhabha N-Tuple signal");
78 if ( m_tuple2 )
79 {
80 status = m_tuple2->addItem ("topup", m_topup);
81 status = m_tuple2->addItem ("run", m_run);
82 status = m_tuple2->addItem ("rec", m_rec);
83 status = m_tuple2->addItem ("time", m_time);
84 status = m_tuple2->addItem ("etsT1", m_etsT1);
85 status = m_tuple2->addItem ("etot", m_etot);
86 status = m_tuple2->addItem ("e1", m_e1);
87 status = m_tuple2->addItem ("e2", m_e2);
88 status = m_tuple2->addItem ("costht1", m_costht1);
89 status = m_tuple2->addItem ("costht2", m_costht2);
90 status = m_tuple2->addItem ("dltphi", m_dltphi);
91 status = m_tuple2->addItem ("dlttht", m_dlttht);
92 status = m_tuple2->addItem ("phi1", m_phi1);
93 status = m_tuple2->addItem ("phi2", m_phi2);
94 }
95 else
96 {
97 log << MSG::ERROR << "Cannot book N-tuple2:"<<long(m_tuple2)<<endmsg;
98 return StatusCode::FAILURE;
99 }
100 }
101 return StatusCode::SUCCESS;
102}
INTupleSvc * ntupleSvc()

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