1#include "ValidRecMdcTrack/ValidRecMdcTrackAlg.h"
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/SmartDataPtr.h"
4#include "GaudiKernel/IHistogramSvc.h"
5#include "GaudiKernel/NTuple.h"
6#include "EventModel/EventHeader.h"
10#include "MdcRecEvent/RecMdcTrack.h"
11#include "Identifier/MdcID.h"
17 Algorithm(name, pSvcLocator) {
28 MsgStream log(
msgSvc(), name() );
29 log << MSG::INFO <<
"Booking Histograms" << endreq;
32 NTuplePtr nt1(
ntupleSvc(),
"FILE101/mdcTrack");
33 if( nt1 ) m_tuple1 = nt1;
35 m_tuple1 =
ntupleSvc()->book(
"FILE101/mdcTrack",CLID_RowWiseTuple,
"ValidRecMdcTrackNTuple1");
38 m_tuple1->addItem (
"eventNo",g_eventNo);
39 m_tuple1->addItem (
"runNo", g_runNo);
40 m_tuple1->addItem(
"nhits",g_hits);
41 m_tuple1->addItem (
"Id",g_track_id);
42 m_tuple1->addItem (
"Phi0",g_phi0);
43 m_tuple1->addItem (
"Cpa",g_kappa);
44 m_tuple1->addItem (
"Tanl",g_tanl);
45 m_tuple1->addItem (
"p",g_p);
47 m_tuple1->addItem (
"Dr",g_dr);
48 m_tuple1->addItem (
"Dz",g_dz);
49 m_tuple1->addItem (
"Chisq",g_chisq_of_fit);
50 m_tuple1->addItem (
"FiTerm",g_phi_terminal);
51 m_tuple1->addItem (
"Nhits",g_number_of_hits);
52 m_tuple1->addItem (
"Nster",g_number_of_stereo_hits);
54 m_tuple1->addItem (
"px",g_px);
55 m_tuple1->addItem (
"py",g_py);
56 m_tuple1->addItem (
"pz",g_pz);
57 m_tuple1->addItem (
"pxy",g_pxy);
58 m_tuple1->addItem (
"charge",g_charge);
59 m_tuple1->addItem (
"stat",g_stat);
60 m_tuple1->addItem (
"x",g_x);
61 m_tuple1->addItem (
"y",g_y);
62 m_tuple1->addItem (
"z",g_z);
63 m_tuple1->addItem (
"r",g_r);
64 m_tuple1->addItem (
"chi2",g_chi2);
65 m_tuple1->addItem (
"ndof",g_ndof);
66 m_tuple1->addItem (
"firstLayer",g_firstLayer);
67 m_tuple1->addItem (
"lastLayer",g_lastLayer);
68 m_tuple1->addItem (
"theta",g_theta);
69 m_tuple1->addItem (
"phi",g_phi);
72 log << MSG::ERROR <<
"----- Cannot book or register histograms -----" << endreq;
73 return StatusCode::FAILURE;
76 NTuplePtr nt2(
ntupleSvc(),
"FILE101/mdcHit");
77 if( nt2 ) m_tuple2 = nt2;
79 m_tuple2 =
ntupleSvc()->book(
"FILE101/mdcHit",CLID_RowWiseTuple,
"ValidRecMdcHitNTuple1");
82 m_tuple2->addItem (
"Hits_id",g_hits_id);
83 m_tuple2->addItem (
"Hits_ddl",g_hits_ddl);
84 m_tuple2->addItem (
"Hits_ddr",g_hits_ddr);
86 m_tuple2->addItem (
"doca",g_doca);
87 m_tuple2->addItem (
"Hits_mdc_id",g_hits_mdc_id);
88 m_tuple2->addItem (
"layer", g_layer);
89 m_tuple2->addItem (
"wire", g_wire );
91 m_tuple2->addItem (
"Hits_tdc",g_hits_tdc);
92 m_tuple2->addItem (
"Hits_adc",g_hits_adc);
94 log << MSG::ERROR <<
"----- Cannot book or register histograms -----" << endreq;
95 return StatusCode::FAILURE;
99 log << MSG::INFO <<
"Finished booking Histograms" << endreq;
100 return StatusCode::SUCCESS;
151 MsgStream log(
msgSvc(), name());
156 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
158 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
159 return( StatusCode::SUCCESS);
162 log << MSG::INFO <<
"retrieved event: " << eventHeader->eventNumber() <<
" run: " << eventHeader->runNumber() << endreq;
163 int eventNo=eventHeader->eventNumber();
164 int runNo=eventHeader->runNumber();
170 SmartDataPtr<RecMdcTrackCol> mdcTracks(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
173 log << MSG::ERROR <<
"Unable to retrieve RecMdcTrackCol" << endreq;
174 return StatusCode::FAILURE;
176 log << MSG::DEBUG <<
"RecMdcTrackCol retrieved of size "<< mdcTracks->size() << endreq;
177 for(RecMdcTrackCol::iterator it=mdcTracks->begin(); it!=mdcTracks->end(); it++)
202 g_track_id = (*it)->trackId();
203 g_phi0 = (*it)->helix()[1];
204 g_kappa = (*it)->helix()[2];
205 g_tanl = (*it)->helix()[4];
207 g_dr = (*it)->helix()[0];
208 g_dz = (*it)->helix()[3];
209 g_chisq_of_fit = (*it)->chi2();
210 g_phi_terminal = (*it)->getFiTerm();
211 g_number_of_hits = (*it)->getNhits();
212 g_number_of_stereo_hits=(*it)->nster();
218 g_pxy = (*it)->pxy();
219 g_charge = (*it)->charge();
220 g_stat = (*it)->stat();
225 g_chi2 = (*it)->chi2();
226 g_ndof = (*it)->ndof();
227 g_firstLayer = (*it)->firstLayer();
228 g_lastLayer = (*it)->lastLayer();
233 HitRefVec::iterator it_gothit = gothits.begin();
234 for( ; it_gothit != gothits.end(); it_gothit++){
235 g_hits_id = (*it_gothit)->getId();
237 g_hits_ddl = (*it_gothit)->getDriftDistLeft();
238 g_hits_ddr = (*it_gothit)->getDriftDistRight();
240 g_doca = (*it_gothit)->getDoca();
241 g_hits_mdc_id = (*it_gothit)->getMdcId();
248 g_hits_tdc = (*it_gothit)->getTdc();
249 g_hits_adc = (*it_gothit)->getAdc();
270 return StatusCode::SUCCESS;
276 MsgStream log(
msgSvc(), name());
277 log << MSG::INFO <<
"Finalizing..." << endreq;
278 return StatusCode::SUCCESS;
SmartRefVector< RecMdcHit > HitRefVec
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
ValidRecMdcTrackAlg(const std::string &name, ISvcLocator *pSvcLocator)