BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/TrkReco-00-09-02/test/Test.cxx
Go to the documentation of this file.
1#include "math.h"
2#include "stdio.h"
3
4#include "AsciiDmp/AsciiData.h"
5#include "AsciiDmp/dmplib.h"
6
7#include <iostream>
8#include <fstream>
9#include <vector>
10
11#include "TrkReco/TUpdater.h"
12#include "TrkReco/Helix.h"
13#include "TrkReco/Bfield.h"
14#include "TrkReco/TrkReco.h"
15//#include "BesKernel/BesEvent.h"
16#include "MdcRecGeo/MdcRecGeo.h"
17#include "MdcTables/MdcTables.h"
18
19int main(){
20
21 TrkReco* _trkreco = TrkReco::getTrkReco();
22
23 _trkreco->init(0);
24
25 Bfield *fBfield=Bfield::getBfield(5);
26// cout<<"Bfield:"<<endl;
27// cout<<"bz(0.1,0.1,0.5):"<<fBfield->bz(0.1,0.1,0.5)<<endl;
28 delete fBfield;
29
30 HepPoint3D fPivot(0,0,0);
31 Hep3Vector fmomentum(1,1,1);
32 Helix fHelix(fPivot,fmomentum,1.0);
33// cout<<"Helix:"<<endl;
34// cout<<"radius: "<<fHelix.radius()<<endl;
35
36 TUpdater fUpd;
37// cout <<"TUpdater"<<endl;
38 fUpd.update();
39 fUpd.dump();
40// cout<<"Hi, event routine is running"<<endl;
41
42 ifstream is("AsciiDmp_out.dat");
43
44 if (! is.good()) {
45 std::cout<< " The input file is wrong! " <<std::endl;
46 return 0;
47 }
48
49// EVENT list;
50 EVENT evt;
51 vector<EVENT> evt_list;
52
53//event loop ..
54 for (int ix = 0; ix < 100; ix++) {
55
56 // initialisation
57 evt.set_initialized();
58
59 try {
60 is >> evt;
61 } catch (AsciiWrongTag& ex) {
62 std::cerr << "wrong tag, got " << ex.got()
63 << " expected: " << ex.expected()
64 << std::endl;
65 return 0;
66 }
67 catch (AsciiDumpException& ex) {
68 std::cerr << "AsciiDumpException was caught!" << std::endl;
69 }
70
71// Output MC info.
72 KINE mckn = evt.kine;
73 kine mctrk = mckn.kineList[0];
74 cout<<"==============New Event, MC info ================"<<endl;
75 cout<<"nTrk:"<<mckn.nKine
76 <<" idPart"<<mctrk.idPart
77 <<" chrg:"<<mctrk.q
78 <<" pt:"<<mctrk.pt
79 <<" theta0:"<<mctrk.theta0
80 <<" phi0:"<<mctrk.phi0<<endl;
81// cout<<"Total mdcDigi of this event= "<<evt.mdcDigi.nDigi<<";"<<evt.mdcDigi.digi.size()<<endl;
82
83//Clear the old MdcRec_wirhit tables and create the hits' info for the new event.
84 unsigned nt = MdcRecWirhitCol::getMdcRecWirhitCol()->size();
85// cout<<"Col size = "<<nt<<endl;
87
88 MDCDIGI mdigi=evt.mdcDigi;
89 MdcRecGeo* fGeom=MdcRecGeo::getMdcRecGeo();
90// cout<<fGeom->Wire(7,72)->Layer()<<"; "<<fGeom->Wire(7,72)->Cell()<<"; "
91// <<fGeom->Wire(7,72)->Lyr()->NCell()<<endl;
92 for(unsigned i=0; i<mdigi.nDigi; i++){
93// MdcRec_wirhit* mhit = new MdcRec_wirhit;
94// mhit->tdc = evt.mdcDigi.digi[i].driftTime;
95// mhit->adc = evt.mdcDigi.digi[i].energyDeposit;
96// MdcRecWirhitCol::getMdcRecWirhitCol()->push_back(*mhit);
97 MdcRec_wirhit mhit;
98 mhit.geo = fGeom->Wire(mdigi.digi[i].layerNo-1,mdigi.digi[i].cellNo-1);
99 mhit.tdc = mdigi.digi[i].driftTime;
100 mhit.adc = mdigi.digi[i].energyDeposit;
101 mhit.ddl = mhit.tdc * 40/10000;
102 mhit.ddr = mhit.ddl;
103 mhit.erddl = 0.013;
104 mhit.erddr = 0.013;
105 mhit.lr = 2;
106 mhit.stat = 0;
107 mhit.stat = mhit.stat |= 1048576; //bit20
108 mhit.stat = mhit.stat |= 2097152; //bit21
109 mhit.stat = mhit.stat |= 4194304; //bit22
110 mhit.stat = mhit.stat |= 1073741824; //bit30
111// cout<<"layerNo = "<<mhit.geo->Layer()<<"; "<<mdigi.digi[i].layerNo<<endl;
112// cout<<"cellNo = "<<mhit.geo->Cell()<<"; "<<mdigi.digi[i].cellNo<<endl;
113// cout<<"NCell of this layer = "<<mhit.geo->Lyr()->NCell()<<endl;
114 MdcRecWirhitCol::getMdcRecWirhitCol()->push_back(mhit);
115 }
116// _trkreco->event(BesEvent * ,int * );
117 _trkreco->event();
118
119 std::cout << "Event No = " << evt.header.eventNo<<std::endl;
120 evt_list.push_back(evt);
121 }
122
123//Clear the MdcRec_wirhit tables
124 unsigned nt = MdcRecWirhitCol::getMdcRecWirhitCol()->size();
125 for(unsigned i=0; i<nt; i++){
126// delete &(*MdcRecWirhitCol::getMdcRecWirhitCol())[i];
127 }
129
130 is.close();
131
132 /*
133 cout<<"Total Event = "<<evt_list.size()<<endl;
134 cout<<"event1-mdc-ndigi :"<<evt_list[0].mdcDigi.nDigi<<endl;
135 cout<<"event2-mdc-ndigi :"<<evt_list[1].mdcDigi.nDigi<<endl;
136 cout<<"event3-mdc-ndigi :"<<evt_list[2].mdcDigi.nDigi<<endl;
137 cout<<"event1-mdc-digi15-cell :"<<evt_list[0].mdcDigi.digi[14].cellNo<<endl;
138 cout<<"event1-mdc-digi15-cell :"<<evt_list[1].mdcDigi.digi[14].cellNo<<endl;
139 cout<<"event1-mdc-digi15-cell :"<<evt_list[2].mdcDigi.digi[14].cellNo<<endl;
140*/
141 _trkreco->term();
142
143 return 1;
144
145}
std::string got() const
Definition: dmplib.hh:22
std::string expected() const
Definition: dmplib.hh:21
static Bfield * getBfield(int)
returns Bfield object.
MDCDIGI mdcDigi
Definition: AsciiData.hh:398
EVHEAD header
Definition: AsciiData.hh:393
int eventNo
Definition: AsciiData.hh:27
int nDigi
Definition: AsciiData.hh:223
static vector< MdcRec_wirhit > * getMdcRecWirhitCol(void)
Definition: MdcTables.cxx:169
const MdcGeoWire * geo
Definition: MdcTables.h:335
A class to handle update timing of static objects of tracking.
Definition: TUpdater.h:25
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TUpdater.cxx:26
virtual void update(void)
updates an object.
Definition: TUpdater.cxx:37
void set_initialized()
Definition: dmplib.hh:69
A tracking module.
Definition: TrkReco.h:46
#define ix(i)