BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
JsiLL Class Reference

#include <JsiLL.h>

+ Inheritance diagram for JsiLL:

Public Member Functions

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

Detailed Description

Definition at line 23 of file DQA/JsiLL/JsiLL-00-00-04/JsiLL/JsiLL.h.

Constructor & Destructor Documentation

◆ JsiLL() [1/2]

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

Definition at line 60 of file JsiLL.cxx.

60 :
61 Algorithm(name, pSvcLocator) {
62
63 //Declare the properties
64 declareProperty("Vr0cut", m_vr0cut=5.0);
65 declareProperty("Vz0cut", m_vz0cut=20.0);
66 declareProperty("Vr1cut", m_vr1cut=1.0);
67 declareProperty("Vz1cut", m_vz1cut=5.0);
68 declareProperty("Vctcut", m_cthcut=0.93);
69 declareProperty("EnergyThreshold", m_energyThreshold=0.04);
70 declareProperty("GammaAngCut", m_gammaAngCut=20.0);
71}

◆ JsiLL() [2/2]

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

Member Function Documentation

◆ execute() [1/2]

StatusCode JsiLL::execute ( )

Definition at line 125 of file JsiLL.cxx.

125 {
126
127 MsgStream log(msgSvc(), name());
128 log << MSG::INFO << "in execute()" << endreq;
129
130 // DQA
131 // Add the line below at the beginning of execute()
132 //
133 setFilterPassed(false);
134
135 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
136 m_runNo=eventHeader->runNumber();
137 m_event=eventHeader->eventNumber();
138 log << MSG::DEBUG <<"run, evtnum = "
139 << m_runNo << " , "
140 << m_event <<endreq;
141
142
143 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
144 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
145 << evtRecEvent->totalCharged() << " , "
146 << evtRecEvent->totalNeutral() << " , "
147 << evtRecEvent->totalTracks() <<endreq;
148
149 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
150
151 if(evtRecEvent->totalNeutral()>100) {
152 return StatusCode::SUCCESS;
153 }
154
155 Vint iGood, iplus, iminus;
156 iGood.clear();
157 iplus.clear();
158 iminus.clear();
159 Vp4 ppip, ppim;
160 ppip.clear();
161 ppim.clear();
162
163 Hep3Vector xorigin(0,0,0);
164
165 IVertexDbSvc* vtxsvc;
166 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
167 if(vtxsvc->isVertexValid()){
168 double* dbv = vtxsvc->PrimaryVertex();
169 double* vv = vtxsvc->SigmaPrimaryVertex();
170 xorigin.setX(dbv[0]);
171 xorigin.setY(dbv[1]);
172 xorigin.setZ(dbv[2]);
173 }
174
175 int nCharge = 0;
176 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
177 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
178 if(!(*itTrk)->isMdcTrackValid()) continue;
179 if (!(*itTrk)->isMdcKalTrackValid()) continue;
180 RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
181
182 double pch =mdcTrk->p();
183 double x0 =mdcTrk->x();
184 double y0 =mdcTrk->y();
185 double z0 =mdcTrk->z();
186 double phi0=mdcTrk->helix(1);
187 double xv=xorigin.x();
188 double yv=xorigin.y();
189 double Rxy=fabs((x0-xv)*cos(phi0)+(y0-yv)*sin(phi0));
190
191 if(fabs(z0) >= m_vz0cut) continue;
192 if(Rxy >= m_vr0cut) continue;
193// if(fabs(m_Vct)>=m_cthcut) continue;
194
195 // DQA
196 TH1 *h(0);
197 if (m_thsvc->getHist("/DQAHist/JsiLL/hrxy", h).isSuccess()) {
198 h->Fill(Rxy);
199 } else {
200 log << MSG::ERROR << "Couldn't retrieve hrxy" << endreq;
201 }
202 if (m_thsvc->getHist("/DQAHist/JsiLL/hz", h).isSuccess()) {
203 h->Fill(z0);
204 } else {
205 log << MSG::ERROR << "Couldn't retrieve hz" << endreq;
206 }
207
208// iGood.push_back((*itTrk)->trackId());
209 iGood.push_back(i);
210 nCharge += mdcTrk->charge();
211 if (mdcTrk->charge() > 0) {
212 iplus.push_back(i);
213 } else {
214 iminus.push_back(i);
215 }
216 }
217
218 //
219 // Finish Good Charged Track Selection
220 //
221 int nGood = iGood.size();
222 log << MSG::DEBUG << "ngood, totcharge = " << nGood << " , " << nCharge << endreq;
223 if((nGood != 4)||(nCharge!=0)){
224 return StatusCode::SUCCESS;
225 }
226
227
228// for(int i = 0; i < nGood; i++) {
229// EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
230// if(!(*itTrk)->isMdcKalTrackValid())
231// return StatusCode::SUCCESS;
232// }
233
234 int pidp0 = 5, pidp1 = 3, pidm0 = 5, pidm1 = 3; //PID
235
236 RecMdcKalTrack *itTrkp = (*(evtRecTrkCol->begin() + iplus[0]))->mdcKalTrack();
237 RecMdcKalTrack *itTrkpip = (*(evtRecTrkCol->begin() + iplus[1]))->mdcKalTrack();
238 RecMdcKalTrack *itTrkpb = (*(evtRecTrkCol->begin() + iminus[0]))->mdcKalTrack();
239 RecMdcKalTrack *itTrkpim = (*(evtRecTrkCol->begin() + iminus[1]))->mdcKalTrack();
240
241
242
243 if (itTrkp->p() < itTrkpip->p()){
244 itTrkp = (*(evtRecTrkCol->begin() + iplus[1]))->mdcKalTrack();
245 itTrkpip = (*(evtRecTrkCol->begin() + iplus[0]))->mdcKalTrack();
246 pidp0 = 3;
247 pidp1 = 5;
248 }
249 if (itTrkpb->p() < itTrkpim->p()){
250 itTrkpb = (*(evtRecTrkCol->begin() + iminus[1]))->mdcKalTrack();
251 itTrkpim = (*(evtRecTrkCol->begin() + iminus[0]))->mdcKalTrack();
252 pidm0 = 3;
253 pidm1 = 5;
254 }
255 if (itTrkp->p() < 0.7 || itTrkp->p() >1.1) return StatusCode::SUCCESS;
256 if (itTrkpb->p() < 0.7 || itTrkpb->p() >1.1) return StatusCode::SUCCESS;
257 if (itTrkpip->p() > 0.35) return StatusCode::SUCCESS;
258 if (itTrkpim->p() > 0.35) return StatusCode::SUCCESS;
259
260
261
266
267
268 m_chisq = 9999.0;
269 // Vertex Fit
270 HepPoint3D vx(0., 0., 0.);
271 HepSymMatrix Evx(3, 0);
272 double bx = 1E+6;
273 double by = 1E+6;
274 double bz = 1E+6;
275 Evx[0][0] = bx*bx;
276 Evx[1][1] = by*by;
277 Evx[2][2] = bz*bz;
278
279 VertexParameter vxpar;
280 vxpar.setVx(vx);
281 vxpar.setEvx(Evx);
282
283 VertexFit* vtxfita0 = VertexFit::instance();
285 VertexFit* vtxfitb0 = VertexFit::instance();
287 VertexFit* vtxfit = VertexFit::instance();
288
289 WTrackParameter wpip = WTrackParameter(mpi, itTrkpip->getZHelix(), itTrkpip->getZError());
290 WTrackParameter wpim = WTrackParameter(mpi, itTrkpim->getZHelix(), itTrkpim->getZError());
291 WTrackParameter wp = WTrackParameter(mproton, itTrkp->getZHelixP(), itTrkp->getZErrorP());
292 WTrackParameter wpb = WTrackParameter(mproton, itTrkpb->getZHelixP(), itTrkpb->getZErrorP());
293
294 vtxfita0->init();
295 vtxfita0->AddTrack(0, wp);
296 vtxfita0->AddTrack(1, wpim);
297 vtxfita0->AddVertex(0, vxpar, 0, 1);
298 if(!vtxfita0->Fit(0)) return StatusCode::SUCCESS;
299 vtxfita0->Swim(0);
300 vtxfita0->BuildVirtualParticle(0);
301 vtxfita->init();
302 vtxfita->AddTrack(0, vtxfita0->wVirtualTrack(0));
303 vtxfita->setVpar(vtxfita0->vpar(0));
304 if(!vtxfita->Fit()) return StatusCode::SUCCESS;
305
306 WTrackParameter wLambda = vtxfita->wpar();
307
308 vtxfitb0->init();
309 vtxfitb0->AddTrack(0, wpb);
310 vtxfitb0->AddTrack(1, wpip);
311 vtxfitb0->AddVertex(0, vxpar, 0, 1);
312 if(!vtxfitb0->Fit(0)) return StatusCode::SUCCESS;
313 vtxfitb0->Swim(0);
314 vtxfitb0->BuildVirtualParticle(0);
315
316 vtxfitb->init();
317 vtxfitb->AddTrack(0, vtxfitb0->wVirtualTrack(0));
318 vtxfitb->setVpar(vtxfitb0->vpar(0));
319 if(!vtxfitb->Fit()) return StatusCode::SUCCESS;
320
321 WTrackParameter wLambdabar = vtxfitb->wpar();
322
323 vtxfit->init();
324 vtxfit->AddTrack(0, wLambda);
325 vtxfit->AddTrack(1, wLambdabar);
326 vtxfit->AddVertex(0, vxpar,0, 1);
327 if(!vtxfit->Fit(0)) return StatusCode::SUCCESS;
328 vtxfit->Swim(0);
329 WTrackParameter wwLambda = vtxfit->wtrk(0);
330 WTrackParameter wwLambdabar = vtxfit->wtrk(1);
331
332
333 // Kinamatic Fit
334
336
337
338 HepLorentzVector ecms(0.034065,0.0,0.0,3.0969);
339 const Hep3Vector u_cms = -ecms.boostVector();
340
341 kmfit->init();
342 kmfit->AddTrack(0, wwLambda);
343 kmfit->AddTrack(1, wwLambdabar);
344 kmfit->AddFourMomentum(0, ecms);
345
346 if(!kmfit->Fit()) return StatusCode::SUCCESS;
347 m_chisq = kmfit->chisq();
348 if(m_chisq > 50) return StatusCode::SUCCESS;
349 HepLorentzVector kmf_pLambda = kmfit->pfit(0);
350 HepLorentzVector kmf_pLambdabar = kmfit->pfit(1);
351
352 kmf_pLambda.boost(u_cms);
353 kmf_pLambdabar.boost(u_cms);
354 m_mLambda = kmf_pLambda.m();
355 m_mLambdabar = kmf_pLambdabar.m();
356 m_pLambda = kmf_pLambda.rho();
357 m_pLambdabar = kmf_pLambdabar.rho();
358
359 if(fabs(m_mLambda-1.1157)>0.003||fabs(m_mLambdabar-1.1157)>0.003) return StatusCode::SUCCESS;
360 // finale selection
361
362 m_tuple->write();
363// return StatusCode::SUCCESS;
364
365 ////////////////////////////////////////////////////////////
366 // DQA
367 // set tag and quality
368
369 // Pid: 1 - electron, 2 - muon, 3 - pion, 4 - kaon, 5 - proton
370 (*(evtRecTrkCol->begin()+iplus[0]))->setPartId(pidp0);
371 (*(evtRecTrkCol->begin()+iplus[1]))->setPartId(pidp1);
372 (*(evtRecTrkCol->begin()+iminus[0]))->setPartId(pidm0);
373 (*(evtRecTrkCol->begin()+iminus[1]))->setPartId(pidm1);
374 // Quality: defined by whether dE/dx or TOF is used to identify particle
375 // 0 - no dE/dx, no TOF (can be used for dE/dx and TOF calibration)
376 // 1 - only dE/dx (can be used for TOF calibration)
377 // 2 - only TOF (can be used for dE/dx calibration)
378 // 3 - Both dE/dx and TOF
379 (*(evtRecTrkCol->begin()+iplus[0]))->setQuality(0);
380 (*(evtRecTrkCol->begin()+iplus[1]))->setQuality(0);
381 (*(evtRecTrkCol->begin()+iminus[0]))->setQuality(0);
382 (*(evtRecTrkCol->begin()+iminus[1]))->setQuality(0);
383
384 // DQA
385 // Add the line below at the end of execute(), (before return)
386 //
387 setFilterPassed(true);
388 ////////////////////////////////////////////////////////////
389
390 return StatusCode::SUCCESS;
391
392}
const Hep3Vector u_cms
Definition: DQADtagAlg.cxx:62
std::vector< HepLorentzVector > Vp4
Definition: Gam4pikp.cxx:53
const double mpi
Definition: Gam4pikp.cxx:47
std::vector< int > Vint
Definition: Gam4pikp.cxx:52
double sin(const BesAngle a)
double cos(const BesAngle a)
const double mproton
Definition: PipiJpsi.cxx:50
const HepVector helix() const
......
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
static KinematicFit * instance()
void AddFourMomentum(int number, HepLorentzVector p4)
static SecondVertexFit * instance()
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
void init()
Definition: VertexFit.cxx:29
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition: VertexFit.cxx:89
static VertexFit * instance()
Definition: VertexFit.cxx:15
void BuildVirtualParticle(int number)
Definition: VertexFit.cxx:619
bool Fit()
Definition: VertexFit.cxx:301
const double ecms
Definition: inclkstar.cxx:42

◆ execute() [2/2]

StatusCode JsiLL::execute ( )

◆ finalize() [1/2]

StatusCode JsiLL::finalize ( )

Definition at line 395 of file JsiLL.cxx.

395 {
396
397 MsgStream log(msgSvc(), name());
398 log << MSG::INFO << "in finalize()" << endmsg;
399 return StatusCode::SUCCESS;
400}

◆ finalize() [2/2]

StatusCode JsiLL::finalize ( )

◆ initialize() [1/2]

StatusCode JsiLL::initialize ( )

Definition at line 75 of file JsiLL.cxx.

75 {
76 MsgStream log(msgSvc(), name());
77
78 log << MSG::INFO << "in initialize()" << endmsg;
79 StatusCode status;
80
81 // DQA
82 // The first directory specifier must be "DQAFILE"
83 // The second is the control sample name, the first letter is in upper format. eg. "Rhopi"
84 NTuplePtr nt(ntupleSvc(), "DQAFILE/JsiLL");
85 if ( nt ) m_tuple = nt;
86 else {
87 m_tuple = ntupleSvc()->book("DQAFILE/JsiLL", CLID_ColumnWiseTuple, "JsiLL ntuple");
88 if( m_tuple ) {
89 status = m_tuple->addItem("runNo", m_runNo);
90 status = m_tuple->addItem("event", m_event);
91 status = m_tuple->addItem("chisq", m_chisq);
92 status = m_tuple->addItem("mLambda", m_mLambda);
93 status = m_tuple->addItem("mLambdabar", m_mLambdabar);
94 status = m_tuple->addItem("pLambda", m_pLambda);
95 status = m_tuple->addItem("pLambdabar", m_pLambdabar);
96
97 } else {
98 log << MSG::ERROR << "Can not book N-tuple:" << long(m_tuple) << endreq;
99 }
100 }
101
102 if(service("THistSvc", m_thsvc).isFailure()) {
103 log << MSG::ERROR << "Couldn't get THistSvc" << endreq;
104 return StatusCode::FAILURE;
105 }
106
107 // "DQAHist" is fixed
108 // "Rhopi" is control sample name, just as ntuple case.
109 TH1F* hrxy = new TH1F("Rxy", "Rxy distribution", 110, -1., 10.);
110 if(m_thsvc->regHist("/DQAHist/JsiLL/hrxy", hrxy).isFailure()) {
111 log << MSG::ERROR << "Couldn't register Rxy" << endreq;
112 }
113 TH1F* hz = new TH1F("z", "z distribution", 200, -100., 100.);
114 if(m_thsvc->regHist("/DQAHist/JsiLL/hz", hz).isFailure()) {
115 log << MSG::ERROR << "Couldn't register z" << endreq;
116 }
117
118 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
119 return StatusCode::SUCCESS;
120
121
122}

◆ initialize() [2/2]

StatusCode JsiLL::initialize ( )

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