BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EventAssemblyAlg.cxx
Go to the documentation of this file.
1#include "EventAssembly/EventAssemblyAlg.h"
2
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/AlgFactory.h"
5#include "GaudiKernel/ISvcLocator.h"
6#include "GaudiKernel/SmartDataPtr.h"
7#include "GaudiKernel/IDataProviderSvc.h"
8#include "GaudiKernel/IDataManagerSvc.h"
9#include "GaudiKernel/PropertyMgr.h"
10//#include "GaudiKernel/INTupleSvc.h"
11//#include "GaudiKernel/IHistogramSvc.h"
12
13#include "EventModel/EventHeader.h"
14#include "EvtRecEvent/EvtRecObject.h"
15#include "EvtRecEvent/EvtRecTrack.h"
16#include "EvtRecEvent/EvtRecEvent.h"
17#include "EvTimeEvent/RecEsTime.h"
18#include "Identifier/Identifier.h"
19#include "Identifier/TofID.h"
20
21
22/////////////////////////////////////////////////////////////////////////////
23EventAssemblyAlg::EventAssemblyAlg(const std::string& name, ISvcLocator* pSvcLocator):Algorithm(name, pSvcLocator)
24{
25 //Declare the properties
26 declareProperty("MsgFlag",myMsgFlag=false);
27 declareProperty("ActiveCutFlag",myActiveCutFlag=true);
28 declareProperty("EmcThetaMatchCut",myEmcThetaCut=-1);
29 declareProperty("EmcPhiMatchCut",myEmcPhiCut=-1);
30 declareProperty("EmcThetaNSigmaCut",myEmcThetaNSigmaCut=5);
31 declareProperty("EmcPhiNSigmaCut",myEmcPhiNSigmaCut=5);
32 declareProperty("ParticleId",myParticleId);
33 declareProperty("Output", m_Output = 0);
34}
35
36//////////////////////////////////////////
38{
39 MsgStream log(msgSvc(), name());
40 log << MSG::INFO << "in initialize()" << endreq;
41
42 if(myEmcThetaCut<0) myEmcThetaCut = 0.1745;
43 if(myEmcPhiCut<0) myEmcPhiCut = 0.2618;
44
45 log << MSG::INFO <<"EmcThetaCut,EmcPhiCut: "<<myEmcThetaCut<<", "<<myEmcPhiCut<<endreq;
46 log << MSG::INFO <<"emcThetaNSigmaCut, emcPhiNSigmaCut: "<<myEmcThetaNSigmaCut<<", "<<myEmcPhiNSigmaCut<<endreq;
47
48 if(m_Output == 1){
49 NTuplePtr nt1(ntupleSvc(), "FILE998/match");
50 if ( nt1 ) myNTuple1 = nt1;
51 else {
52 myNTuple1 = ntupleSvc()->book("FILE998/match", CLID_ColumnWiseTuple, "match");
53 if ( myNTuple1 ) {
54 myNTuple1->addItem("exted",myExted);
55 myNTuple1->addItem("matched",myMatched);
56 myNTuple1->addItem("Ematched",myEnergyMatched);
57 }
58 else {
59 log << MSG::ERROR << " Cannot book N-tuple:" << long(myNTuple1) << endmsg;
60 //return StatusCode::FAILURE;
61 }
62 }
63 }
64 return StatusCode::SUCCESS;
65}
66
67///////////////////////////////////////
69{
70 MsgStream log(msgSvc(), name());
71 log << MSG::INFO << "in execute()" << endreq;
72
73 int numOfChargedTrks = 0;
74 int numOfKalTrks = 0;
75 int numOfDedx = 0;
76 int numOfExt = 0;
77 int numOfTof = 0;
78 int numOfShower = 0;
79 int numOfMatchedShower = 0;
80 int numOfMucTrks = 0;
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" << endreq;
87 return( StatusCode::FAILURE);
88 }
89 log << MSG::INFO << ": retrieved event: " << eventHeader->eventNumber() << " run: " << eventHeader->runNumber() << endreq;
90
91 //Part 2: Retrieve Rec data
92 SmartDataPtr<RecMdcTrackCol> recMdcTrackCol(eventSvc(),EventModel::Recon::RecMdcTrackCol);
93 RecMdcTrackCol::iterator beginOfMdcTrkCol = RecMdcTrackCol::iterator(NULL);
94 if(!recMdcTrackCol)
95 {
96 log<<MSG::INFO<<"Could not find RecMdcTrackCol!"<<endreq;
97 }
98 else
99 {
100 beginOfMdcTrkCol = recMdcTrackCol->begin();
101 numOfChargedTrks = recMdcTrackCol->size();
102 }
103
104 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(eventSvc(), EventModel::Recon::RecMdcKalTrackCol);
105 RecMdcKalTrackCol::iterator beginOfMdcKalTrackCol = RecMdcKalTrackCol::iterator(NULL);
106 if(!mdcKalTrackCol)
107 {
108 log<<MSG::INFO<<"Could not find MdcKalTrackCol!"<<endreq;
109 }
110 else
111 {
112 numOfKalTrks = mdcKalTrackCol->size();
113 beginOfMdcKalTrackCol = mdcKalTrackCol->begin();
114 }
115
116
117 SmartDataPtr<RecMdcDedxCol> mdcDedxCol(eventSvc(), EventModel::Recon::RecMdcDedxCol);
118 RecMdcDedxCol::iterator beginOfDedxCol = RecMdcDedxCol::iterator(NULL);
119 if(!mdcDedxCol)
120 {
121 log<<MSG::INFO<<"Could not find MdcDedxCol!"<<endreq;
122 }
123 else {
124 numOfDedx = mdcDedxCol->size();
125 beginOfDedxCol = mdcDedxCol->begin();
126 }
127
128
129 SmartDataPtr<RecExtTrackCol> extTrackCol(eventSvc(), EventModel::Recon::RecExtTrackCol);
130 RecExtTrackCol::iterator beginOfExtTrackCol = RecExtTrackCol::iterator(NULL);
131 if(!extTrackCol)
132 {
133 log<<MSG::INFO<<"Could not find RecExtTrackCol!"<<endreq;
134 }
135 else
136 {
137 beginOfExtTrackCol = extTrackCol->begin();
138 numOfExt = extTrackCol->size();
139 }
140
141 SmartDataPtr<RecTofTrackCol> TofTrackCol(eventSvc(), EventModel::Recon::RecTofTrackCol);
142 RecTofTrackCol::iterator beginOfTofTrackCol = RecTofTrackCol::iterator(NULL);
143 if(!TofTrackCol)
144 {
145 log<<MSG::INFO<<"Could not find RecTofTrackCol!"<<endreq;
146 }
147 else
148 {
149 beginOfTofTrackCol = TofTrackCol->begin();
150 numOfTof = TofTrackCol->size();
151 }
152
153 SmartDataPtr<RecEmcShowerCol> emcRecShowerCol(eventSvc(), EventModel::Recon::RecEmcShowerCol);
154 RecEmcShowerCol::iterator beginOfEmcTrackCol = RecEmcShowerCol::iterator(NULL);
155 if(!emcRecShowerCol)
156 {
157 log<<MSG::INFO<<"Could not find RecEmcShowerCol!"<<endreq;
158 }
159 else
160 {
161 beginOfEmcTrackCol = emcRecShowerCol->begin();
162 numOfShower = emcRecShowerCol->size();
163 }
164
165 SmartDataPtr<RecMucTrackCol> mucTrackCol(eventSvc(), EventModel::Recon::RecMucTrackCol);
166 RecMucTrackCol::iterator beginOfMucTrackCol = RecMucTrackCol::iterator(NULL);
167 if(!mucTrackCol)
168 {
169 log<<MSG::INFO<<"Could not find RecMucTrackCol!"<<endreq;
170 }
171 else
172 {
173 beginOfMucTrackCol = mucTrackCol->begin();
174 numOfMucTrks = mucTrackCol->size();
175 }
176
177 //Some match flag
178
179 int MaxHit = numOfChargedTrks+numOfShower+numOfTof;
180
181 vector<bool> dEdxMatched;
182 vector<bool> kalTrkMatched;
183 vector<bool> extMatched;
184 vector<bool> TofMatched;
185 vector<bool> emcMatched;
186 vector<bool> mucMatched;
187
188 for(int i=0;i<MaxHit;i++)
189 {
190 dEdxMatched.push_back(false);
191 kalTrkMatched.push_back(false);
192 extMatched.push_back(false);
193 TofMatched.push_back(false);
194 emcMatched.push_back(false);
195 mucMatched.push_back(false);
196 }
197
198
199 //Part 3: Match tracks
200 // RecTrackListCol* aNewRecTrkListCol = new RecTrackListCol;
201 EvtRecTrackCol* aNewEvtRecTrackCol = new EvtRecTrackCol;
202 if(numOfChargedTrks+numOfShower)//if mdc trackCol and emc trackCol neither exists,there is no match job.
203 {
204 for(int i=0;i<numOfChargedTrks;i++)//match charged tracks
205 {
206 EvtRecTrack* aNewEvtRecTrack = new EvtRecTrack;
207 int mdcTrkID = (*(beginOfMdcTrkCol+i))->trackId();
208 aNewEvtRecTrack->setTrackId(mdcTrkID);
209 aNewEvtRecTrack->setMdcTrack(*(beginOfMdcTrkCol+i));
210 // aNewEvtRecTrack->setMdcTrkIdx(i);
211 for(int j=0;j<numOfKalTrks;j++)//match MdcKalTrack
212 if( !kalTrkMatched[j] && mdcTrkID==(*(beginOfMdcKalTrackCol+j))->trackId() )
213 {
214 aNewEvtRecTrack->setMdcKalTrack(*(beginOfMdcKalTrackCol+j));
215 // aNewRecTrkList->setMdcKalTrkIdx(j);
216 kalTrkMatched[j]=true;
217 }
218
219 for(int j=0;j<numOfDedx;j++)//match dEdx
220 if( !dEdxMatched[j] && mdcTrkID==(*(beginOfDedxCol+j))->trackId() )
221 {
222 aNewEvtRecTrack->setMdcDedx(*(beginOfDedxCol+j));
223 // aNewRecTrkList->setDedxTrkIdx(j);
224 dEdxMatched[j]=true;
225 }
226
227 for(int j=0;j<numOfExt;j++)//match ExtTrack
228 if( !extMatched[j] && mdcTrkID==(*(beginOfExtTrackCol+j))->trackId() )
229 {
230 aNewEvtRecTrack->setExtTrack(*(beginOfExtTrackCol+j));
231 // aNewRecTrkList->setExtTrkIdx(j);
232 extMatched[j]=true;
233 }
234 for(int j=0;j<numOfTof;j++)//match Tof
235 if( !TofMatched[j] && mdcTrkID==(*(beginOfTofTrackCol+j))->trackID() )
236 {
237 aNewEvtRecTrack->addTofTrack(*(beginOfTofTrackCol+j));
238 // aNewRecTrkList->setTofTrkIdx(j);
239 TofMatched[j]=true;
240 }
241 for(int j=0;j<numOfMucTrks;j++)//match MucTrack
242 if( !mucMatched[j] && mdcTrkID==(*(beginOfMucTrackCol+j))->trackId() )
243 {
244 aNewEvtRecTrack->setMucTrack(*(beginOfMucTrackCol+j));
245 // aNewRecTrkList->setMucTrkIdx(j);
246 mucMatched[j]=true;
247 }
248
249 if(m_Output==1){
250 myExted = -1.;
251 myMatched = -1.;
252 myEnergyMatched = -1.;
253 }
254 if(aNewEvtRecTrack->isExtTrackValid()&&(aNewEvtRecTrack->extTrack())->emcVolumeNumber()!=-1)//start to match Emc showers
255 {
256 if(m_Output==1)myExted = 1.;
257 //resieve ext information @ Emc
258 Hep3Vector extPos = (aNewEvtRecTrack->extTrack())->emcPosition();
259 double extTheta = extPos.theta();
260 double extPhi = extPos.phi();
261
262 double dAngleMin = 9999.;
263 int indexOfEmcNearest = -1;
264
265 for(int j=0;j<numOfShower;j++)//start to find nearest emc shower
266 {
267 if(!emcMatched[j])
268 {
269 HepPoint3D emcPot = (*(beginOfEmcTrackCol+j))->position();
270 Hep3Vector emcPos(emcPot.x(),emcPot.y(),emcPot.z());
271 double dAngle = extPos.angle(emcPos);
272 if(dAngle<dAngleMin)
273 {
274 dAngleMin = dAngle;
275 indexOfEmcNearest = j;
276 }
277 }
278 }
279 if(indexOfEmcNearest>=0)//if nearest Emc shower is found
280 {
281 HepPoint3D emcPot = (*(beginOfEmcTrackCol+indexOfEmcNearest))->position();
282 double theta = emcPot.theta();
283 double phi = emcPot.phi();
284 double deltaTheta = (extTheta-theta);
285 double deltaPhi = fmod(extPhi-phi+5*M_PI,2*M_PI)-M_PI;
286 if(myActiveCutFlag)
287 {
288 double tanLamda = (*(beginOfMdcTrkCol+i))->helix(4);
289 double kappa = (*(beginOfMdcTrkCol+i))->helix(2);
290 double p = sqrt(1+tanLamda*tanLamda)/fabs(kappa);
291 double aThetaCut = thetaCut(p,myEmcThetaNSigmaCut,myParticleId);
292 double aPhiCUt = phiCut(p,myEmcPhiNSigmaCut,myParticleId);
293 if(fabs(deltaTheta)<aThetaCut && fabs(deltaPhi)<aPhiCUt)
294 {
295 aNewEvtRecTrack->setEmcShower(*(beginOfEmcTrackCol+indexOfEmcNearest));
296 // aNewRecTrkList->setEmcTrkIdx(indexOfEmcNearest);
297 emcMatched[indexOfEmcNearest]=true;
298 numOfMatchedShower++;
299 if(m_Output==1)myMatched = 1.;
300 }
301 }
302 else if(fabs(deltaTheta)<myEmcThetaCut && fabs(deltaPhi)<myEmcPhiCut)//if the nearest shower is in the fixed match window,it will be matched.
303 {
304 aNewEvtRecTrack->setEmcShower(*(beginOfEmcTrackCol+indexOfEmcNearest));
305 // aNewRecTrkList->setEmcTrkIdx(indexOfEmcNearest);
306 emcMatched[indexOfEmcNearest]=true;
307 numOfMatchedShower++;
308 if(m_Output==1)myMatched = 1.;
309 }
310 }
311 }
312 aNewEvtRecTrackCol->push_back(aNewEvtRecTrack);
313 if(m_Output==1){
314 myEnergyMatched = 0.;
315 myNTuple1->write();
316 }
317 }//end charged track match
318
319 int id=0;
320 for(int i=0;i<numOfShower;i++)//If Emc shower isn't macthed, it will be added to the end of RecTrackListCol
321 {
322 if(!emcMatched[i])
323 {
324 EvtRecTrack* aNewEvtRecTrack = new EvtRecTrack;
325 aNewEvtRecTrack->setTrackId(id+numOfChargedTrks);
326 aNewEvtRecTrack->setEmcShower(*(beginOfEmcTrackCol+i));
327 // aNewRecTrkList->setEmcTrkIdx(i);
328
329 //EMC and TOF match
330 HepPoint3D emcPos((*(beginOfEmcTrackCol+i))->position());
331 double emcPhi = emcPos.phi();
332 emcPhi = emcPhi < 0 ? emcPhi+CLHEP::twopi : emcPhi;
333
334 int module=9999, nphi1=9999, nphi2=9999, nphi1_mrpc=9999;
335 module = (*(beginOfEmcTrackCol+i))->module();
336 if(module==1) { //barrel
337 nphi1 = (int)(emcPhi*88./CLHEP::twopi); //tof layer1 number
338 nphi2 = (int)(emcPhi*88./CLHEP::twopi+0.5); //tof layer2 number
339 nphi2 += 88;
340 } else { //endcap
341 nphi1 = (int)(emcPhi*48./CLHEP::twopi+0.5);
342
343
344 //new mrpc detector
345 double fi_endtof_mrpc = atan2(emcPos.y(),emcPos.x())-3.141592654/2.;
346 if(fi_endtof_mrpc<0) fi_endtof_mrpc += 2*3.141592654;
347 nphi1_mrpc=((int)(fi_endtof_mrpc/(3.141593/18)))+1; //We have 36 modules in each endcap (divided again into two layers)! The numbering starts with 1.
348
349 if(nphi1_mrpc%2==0){nphi1_mrpc=nphi1_mrpc/2;} //Calculate the correct number as in each endcap we have two layers of modules furnished with numbers 1 to 18.
350 else {nphi1_mrpc=(nphi1_mrpc+1)/2;}
351
352 if(emcPos.z()>0) {(nphi1_mrpc -= 19); nphi1_mrpc=nphi1_mrpc*(-1);} //Consider that for the east endcap the module at x=0;y=max has the number 18 (the numbering is != to west endcap)
353 // nphi1_mrpc is now the number of the nearest ToF module!
354
355 }
356
357 int dPhiMin = 9999;
358 int partid_dPhiMin = 7;
359 bool mrpcmatch = false;
360
361 int indexOfTofNearest = -1;
362 for(int j=0;j<numOfTof;j++) { //start to find nearest Tof shower
363 if( !TofMatched[j] ) {
364
365 Identifier id((*(beginOfTofTrackCol+j))->tofID());
366 bool is_mrpc = TofID::is_mrpc(id);
367
368 if(!is_mrpc)
369 {
370 int barrel_ec = TofID::barrel_ec(id);
371 int layer = TofID::layer(id);
372 int im = TofID::phi_module(id);
373 im += layer * 88;
374
375 if(module!=barrel_ec) continue;
376
377 int dPhi;
378 if(layer == 0) {
379 dPhi = abs(im - nphi1);
380 } else {
381 dPhi = abs(im - nphi2);
382 }
383 if(module==1) {
384 dPhi = dPhi>=44 ? 88-dPhi : dPhi;
385 } else {
386 dPhi = dPhi>=24 ? 48-dPhi : dPhi;
387 }
388
389 if(dPhi < dPhiMin) {
390 dPhiMin = dPhi;
391 indexOfTofNearest = j;
392 }
393 }//close if(!is_mrpc)
394 else//is_mrpc
395 {
396 int barrel_ec = TofID::barrel_ec(id);
397 int module_mrpc = TofID::module(id);
398
399 int dphi;
400 dphi = abs(module_mrpc-nphi1_mrpc);
401
402 if(dphi < dPhiMin)
403 {
404 dPhiMin=dphi;
405 partid_dPhiMin=barrel_ec;
406 indexOfTofNearest = j;
407 mrpcmatch = true;
408 }
409 }//close else is_mrpc
410
411 }//close if( !TofMatched[j] )
412 }//close for(int j=0;j<numOfTof;j++)
413
414 /*
415 if(0)
416 {
417 cout << "Event Assembly Algorithm" <<endl;
418 cout << "EMC Shower number = " << i << endl;
419 cout << "mrpcmatch ? " << mrpcmatch << endl;
420 cout << "indexOfTofNearest " << indexOfTofNearest <<endl;
421 cout << "dphiMin " << dPhiMin << endl;
422 cout << "partid_mrpc " << partid_dPhiMin <<endl;
423 cout << "partid_emc " << module <<endl <<endl;
424 }
425 */
426
427 //match in z-direction
428 if(indexOfTofNearest>=0) {
429 HepPoint3D tofPos(0,0.867,(*(beginOfTofTrackCol+indexOfTofNearest))->zrhit());
430 double matWindow = 0;
431 double eShower = (*(beginOfEmcTrackCol+i))->e5x5();//energy of a 5x5 cluster
432 if(eShower>0) {
433 matWindow = 0.01277+0.004268/sqrt(eShower);
434 }
435 }
436
437
438 if(indexOfTofNearest>=0 && dPhiMin<=1) { //if nearest Tof shower is found
439 // calculate matching window for barrel
440 double eShower = (*(beginOfEmcTrackCol+i))->e5x5();
441 double matWindow = 0;
442 if(eShower>0) {
443 matWindow = 0.01277+0.004268/sqrt(eShower);
444 }
445 matWindow = 0.2; //temp code
446
447 HepPoint3D tofPos(0,0.867,(*(beginOfTofTrackCol+indexOfTofNearest))->zrhit());
448 if(fabs(tofPos.theta()-emcPos.theta())<matWindow || module!=1) {
449 aNewEvtRecTrack->addTofTrack(*(beginOfTofTrackCol+indexOfTofNearest));
450 TofMatched[indexOfTofNearest]=true;
451 //cout << "EventAssembly : New neutral Toftrack added " << endl;
452
453 }
454 }//close if(indexOfTofNearest>=0 && dPhiMin<=1)
455
456 aNewEvtRecTrackCol->push_back(aNewEvtRecTrack);
457 id++;
458 }//close if(!)
459 }//close for(int i=0;i<numOfShower;i++) <---This are the EMC showers
460 }//end match
461
462 //match statistics
463 if(myMsgFlag) cout<<"Charged tracks: "<<numOfChargedTrks<<" Ext track: "<<numOfExt <<" Shower:"<<numOfShower<<" Matched shower:"<<numOfMatchedShower<<endl;
464
465 //Part 4: register RecTrackListCol and EventList in TDS
466 DataObject *aDataObject1;
467 eventSvc()->findObject(EventModel::EvtRec::Event, aDataObject1);
468 if ( aDataObject1 == NULL ) {
469 EvtRecObject* aRecObject = new EvtRecObject;
470 StatusCode sc = eventSvc()->registerObject(EventModel::EvtRec::Event, aRecObject);
471 if ( sc.isFailure() ) {
472 log << MSG::FATAL << "Could not register EvtRecObject in TDS!" << endreq;
473 return StatusCode::FAILURE;
474 }
475 }
476
477 DataObject* aDataObject2;
478 eventSvc()->findObject(EventModel::EvtRec::EvtRecEvent, aDataObject2);
479 if ( aDataObject2 == NULL ) {
480 EvtRecEvent* aRecEvent = new EvtRecEvent;
481 aRecEvent->setTotalTracks(numOfChargedTrks+numOfShower-numOfMatchedShower);
482 aRecEvent->setTotalCharged(numOfChargedTrks);
483 aRecEvent->setTotalNeutral(numOfShower-numOfMatchedShower);
484 StatusCode sc = eventSvc()->registerObject(EventModel::EvtRec::EvtRecEvent, aRecEvent);
485 if ( sc.isFailure() ) {
486 log << MSG::FATAL << "Could not register EvtRecEvent in TDS!" << endreq;
487 return( StatusCode::FAILURE);
488 }
489 }
490 else {
491 EvtRecEvent* aRecEvent = dynamic_cast<EvtRecEvent*>(aDataObject2);
492 aRecEvent->setTotalTracks(numOfChargedTrks+numOfShower-numOfMatchedShower);
493 aRecEvent->setTotalCharged(numOfChargedTrks);
494 aRecEvent->setTotalNeutral(numOfShower-numOfMatchedShower);
495 }
496
497 DataObject* aDataObject3;
498 eventSvc()->findObject(EventModel::EvtRec::EvtRecTrackCol, aDataObject3);
499 if ( aDataObject3 != NULL ) {
500 //IDataManagerSvc* dataMgrSvc = dynamic_cast<IDataManagerSvc*> (eventSvc());
501 SmartIF<IDataManagerSvc> dataMgrSvc(eventSvc());
502 dataMgrSvc->clearSubTree(EventModel::EvtRec::EvtRecTrackCol);
503 eventSvc()->unregisterObject(EventModel::EvtRec::EvtRecTrackCol);
504 }
505
506 StatusCode sc = eventSvc()->registerObject(EventModel::EvtRec::EvtRecTrackCol, aNewEvtRecTrackCol);
507 if ( sc.isFailure() ) {
508 log << MSG::FATAL << "Could not register EvtRecTrackCol in TDS!" << endreq;
509 return( StatusCode::FAILURE);
510 }
511
512 //Part 5: check RecTrackListCol in TDS
513 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
514 if(!evtRecTrackCol)
515 {
516 log<<MSG::FATAL<<"Could not find RecTrackListCol in TDS!"<<endreq;
517 }
518
519 EvtRecTrackCol::iterator itOfRecTrkListCol = evtRecTrackCol->begin();
520 if(myMsgFlag)
521 for(int i=0;itOfRecTrkListCol!=evtRecTrackCol->end();itOfRecTrkListCol++,i++)
522 {
523 cout<<"******************** Track "<<i<<": *********************"<<endl;
524 cout<<"Track ID: "<<(*itOfRecTrkListCol)->trackId()<<endl;
525 if((*itOfRecTrkListCol)->isMdcTrackValid())
526 {
527 RecMdcTrack* mdcTrk = (*itOfRecTrkListCol)->mdcTrack();
528 double kappa = mdcTrk->helix(2);
529 double tanl = mdcTrk->helix(4);
530 cout<<"Mdc kappa, tanl: "<<kappa<<", "<<tanl<<endl;
531 }
532 if((*itOfRecTrkListCol)->isExtTrackValid())
533 {
534 RecExtTrack* extTrack = (*itOfRecTrkListCol)->extTrack();
535 Hep3Vector emcPos = extTrack->emcPosition();
536 cout<<"Ext Emc pos:"<<emcPos.x()<<","<<emcPos.y()<<","<<emcPos.z()<<endl;
537 }
538 if((*itOfRecTrkListCol)->isEmcShowerValid())
539 {
540 RecEmcShower* emcTrack = (*itOfRecTrkListCol)->emcShower();
541 HepPoint3D emcPos = emcTrack->position();
542 double x = emcPos.x();
543 double y = emcPos.y();
544 double z = emcPos.z();
545 cout<<"Emc rec pos:"<<x<<","<<y<<","<<z<<endl;
546 }
547 }
548
549 return StatusCode::SUCCESS;
550}
551
552// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
554{
555 MsgStream log(msgSvc(), name());
556 log << MSG::INFO << "in finalize()" << endreq;
557
558 return StatusCode::SUCCESS;
559}
560
561
562
563//////////////////////////////
564double EventAssemblyAlg::thetaCut(double p,double nSigma,int parId)
565{
566 if(p<0.3) p=0.3;
567 if(parId<1||parId>3) parId=3;
568 if(nSigma<=0) nSigma = 5.;
569 double cut = myEmcThetaCut;
570 switch(parId)
571 {
572 case 1:cut = fabs(-0.00159)+(exp(-3.566*p-4.14)+0.006804)*nSigma; break;
573 case 2:cut = fabs(-0.00145)+(exp(-4.268*p-3.305)+0.01129)*nSigma; break;
574 case 3:cut = fabs(-0.00161)+(exp(-5.955*p-3.052)+0.01751)*nSigma; break;
575 }
576
577 return cut;
578}
579
580///////////////////////////////
581double EventAssemblyAlg::phiCut(double p,double nSigma,int parId)
582{
583 if(p<0.3) p=0.3;
584 if(parId<1||parId>3) parId=3;
585 if(nSigma<=0) nSigma = 5.;
586 double cut = myEmcPhiCut;
587 switch(parId)
588 {
589 case 1:cut = fabs(exp(-2.187*p-2.945)+0.03236)+(exp(-2.977*p-3.558)+0.005566)*nSigma; break;
590 case 2:cut = fabs(exp(-2.216*p-2.13)+0.03314)+(exp(-2.436*p-3.392)+0.005049)*nSigma; break;
591 case 3:cut = fabs(exp(-1.63*p-2.931)+0.03223)+(exp(-3.192*p-2.756)+0.01533)*nSigma; break;
592 }
593
594 return cut;
595}
596
Double_t x[10]
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
Definition: KarFin.h:27
#define M_PI
Definition: TConstant.h:4
const HepVector helix() const
......
EventAssemblyAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode execute()
StatusCode initialize()
void addTofTrack(const SmartRef< RecTofTrack > trk)
static bool is_mrpc(const Identifier &id)
Definition: TofID.cxx:113
static int phi_module(const Identifier &id)
Definition: TofID.cxx:73
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: TofID.cxx:61
static int layer(const Identifier &id)
Definition: TofID.cxx:66
static int module(const Identifier &id)
Definition: TofID.cxx:130