CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
DotsConnection Class Reference

#include <DotsConnection.h>

+ Inheritance diagram for DotsConnection:

Public Member Functions

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

Detailed Description

Definition at line 19 of file DotsConnection.h.

Constructor & Destructor Documentation

◆ DotsConnection()

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

Definition at line 23 of file DotsConnection.cxx.

23 :
24 Algorithm(name, pSvcLocator)
25{
26 myMdcCalibFunSvc=NULL;
27
28 // Part 1: Declare the properties
29 //declareProperty("MyInt", m_myInt);
30 declareProperty("Ntuple", myNtProd=0);
31 declareProperty("driftTimeUpLimit", myDriftTimeUpLimit = 400);
32 declareProperty("MdcHitChi2Cut", myMdcHitChi2Cut = 100);
33 declareProperty("ChiCut_circle", myChiCut_circle=5);
34 declareProperty("NmaxDeact_circle", myNmaxDeact_circle=1);
35 declareProperty("ChiCut_helix", myChiCut_helix=5);
36 declareProperty("NmaxDeact_helix", myNmaxDeact_helix=1);
37 declareProperty("Debug", myDebug=0);
38 declareProperty("Chi2CutDiverge", myChi2CutDiverge=99999999);
39 //declareProperty("MCparID", myMCparID=1);//1: e, 2: mu, 3: pi, 4: K, 5: p
40}

Member Function Documentation

◆ execute()

StatusCode DotsConnection::execute ( )

Definition at line 204 of file DotsConnection.cxx.

204 {
205
206 // Part 1: Get the messaging service, print where you are
207 MsgStream log(msgSvc(), name());
208 log << MSG::INFO << "DotsConnection execute()" << endreq;
209
210 // Part 2: Print out the different levels of messages
211 /*log << MSG::DEBUG << "A DEBUG message" << endreq;
212 log << MSG::INFO << "An INFO message" << endreq;
213 log << MSG::WARNING << "A WARNING message" << endreq;
214 log << MSG::ERROR << "An ERROR message" << endreq;
215 log << MSG::FATAL << "A FATAL error message" << endreq;
216 */
217
218 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
219 if (!eventHeader) {
220 log << MSG::WARNING << "Could not find Event Header" << endreq;
221 return StatusCode::FAILURE;
222 }
223 myRun = eventHeader->runNumber();
224 myEvt = eventHeader->eventNumber();
225 if(myDebug) {
226 cout<<endl<<"------------------------------ "<<endl;
227 //cout<<"run, evt = "<<myEvt<<", "<<myRun<<endl;
228 cout<<"run:"<<myRun<<" , event: "<<myEvt<<endl;
229 }
230
231 //if(myRun==763)
232 //testDotsHelixFitterAllHits();
233
234 //testDotsHelixFitterPartHits();
235
236
237 // --- ideal tracking
238 getMcFinalChargedStates();
239 bool bookTrkCol = registerRecMdcTrack();
240 if(!bookTrkCol)
241 {
242 cout<<"DotsConnection::execute(): failed to register RecMdcTrackCol!"<<endl;
243 return StatusCode::FAILURE;
244 }
245 associateDigisToMcParticles();
246
247
248
249 return StatusCode::SUCCESS;
250}
IMessageSvc * msgSvc()

◆ finalize()

StatusCode DotsConnection::finalize ( )

Definition at line 254 of file DotsConnection.cxx.

254 {
255
256 // Part 1: Get the messaging service, print where you are
257 MsgStream log(msgSvc(), name());
258 log << MSG::INFO << "DotsConnection finalize()" << endreq;
259
260 return StatusCode::SUCCESS;
261}

◆ initialize()

StatusCode DotsConnection::initialize ( )

Definition at line 44 of file DotsConnection.cxx.

44 {
45
46 // Part 1: Get the messaging service, print where you are
47 MsgStream log(msgSvc(), name());
48 log << MSG::INFO << " DotsConnection initialize()" << endreq;
49
50 // Part 2: Print out the property values
51 // log << MSG::INFO << " MyInt = " << m_myInt << endreq;
52
53 // --- Get MdcGeomSvc ---
54 IMdcGeomSvc* imdcGeomSvc;
55 //StatusCode sc1 =Gaudi::svcLocator()->service("MdcGeomSvc", imdcGeomSvc);
56 StatusCode sc = service ("MdcGeomSvc", imdcGeomSvc);
57 myMdcGeomSvc = dynamic_cast<MdcGeomSvc*> (imdcGeomSvc);
58 if (sc.isFailure()) {
59 return( StatusCode::FAILURE);
60 }
61 int nWire = myMdcGeomSvc->getWireSize();
62 int nLayer= myMdcGeomSvc->getLayerSize();
63 int nSuperLayer= myMdcGeomSvc->getSuperLayerSize();
64 int nSeg= myMdcGeomSvc->getSegmentNo();
65 /*cout<<"nWire = "<<nWire
66 <<" nLayer="<<nLayer
67 <<" nSuperLayer="<<nSuperLayer
68 <<" nSeg="<<nSeg
69 <<endl;*/
70 int nCellTot=0;
71 for(int i=0; i<nLayer; i++)
72 {
73 const MdcGeoLayer* aLayer = myMdcGeomSvc->Layer(i);
74 myNWire[i]=aLayer->NCell();
75 myRLayer[i]=aLayer->Radius();
76 //cout<<"layer "<<i<<", "<<aLayer->NCell()<<" cells, slant "<<aLayer->Slant()<<", R="<<aLayer->Radius()<<endl;
77
78 double nomShift = aLayer->nomShift();
79 if(nomShift>0) myWireFlag[i]=1;
80 else if(nomShift<0) myWireFlag[i]=-1;
81 else myWireFlag[i]=0;
82
83 //nCellTot+=aLayer->NCell();
84 nCellTot+=myNWire[i];
85 for(int j=0; j<myNWire[i]; j++)
86 {
87 const MdcGeoWire* aWire = myMdcGeomSvc->Wire(i,j);
88 //cout<<" wire "<<j<<", BWpos ="<<aWire->Backward()
89 // <<", "<<aWire->BWirePos()
90 // <<", FWpos ="<<aWire->Forward()
91 // <<", "<<aWire->FWirePos()
92 // <<endl;
93 myWirePhi[i][j]=aWire->Forward().phi();
94 int iInnerLayer = i-1;
95 if(iInnerLayer>=0) {
96 for(int k=0; k<myNWire[iInnerLayer]; k++)
97 {
98 int k_last = k-1;
99 if(k_last<0) k_last=myNWire[iInnerLayer]-1;
100 double dphi_last = dPhi(myWirePhi[iInnerLayer][k_last], myWirePhi[i][j]);
101 double dphi = dPhi(myWirePhi[iInnerLayer][k], myWirePhi[i][j]);
102 if(dphi_last<0&&dphi>0) {
103 myInnerWire[i][j][0]=k_last;
104 myInnerWire[i][j][1]=k;
105 //cout<<"k_last, k ="<<k_last<<", "<<k<<endl;
106 break;
107 }
108 }
109 }
110 }
111 }
112 for(int i=0; i<nLayer; i++)
113 {
114 for(int j=0; j<myNWire[i]; j++)
115 {
116 int iOuterLayer = i+1;
117 if(iOuterLayer<nLayer) {
118 for(int k=0; k<myNWire[iOuterLayer]; k++)
119 {
120 int k_last = k-1;
121 if(k_last<0) k_last=myNWire[iOuterLayer]-1;
122 double dphi_last = dPhi(myWirePhi[iOuterLayer][k_last], myWirePhi[i][j]);
123 double dphi = dPhi(myWirePhi[iOuterLayer][k], myWirePhi[i][j]);
124 if(dphi_last<0&&dphi>0) {
125 myOuterWire[i][j][0]=k_last;
126 myOuterWire[i][j][1]=k;
127 //cout<<"k_last, k ="<<k_last<<", "<<k<<endl;
128 //cout<<"phi="<<myWirePhi[i][j]<<", outer phi = "<<myWirePhi[iOuterLayer][k_last]<<", "<<myWirePhi[iOuterLayer][k]<<endl;
129 break;
130 }
131 }
132 }
133 }
134 }
135 //cout<<"Total "<<nCellTot<<" cells"<<endl;
136 // ----------------------
137
138
139 // --- Initialize RawDataProviderSvc ---
140 IRawDataProviderSvc* irawDataProviderSvc;
141 sc = service ("RawDataProviderSvc", irawDataProviderSvc);
142 myRawDataProviderSvc = dynamic_cast<RawDataProviderSvc*> (irawDataProviderSvc);
143 if ( sc.isFailure() ){
144 log << MSG::FATAL << name()<<" Could not load RawDataProviderSvc!" << endreq;
145 return StatusCode::FAILURE;
146 }
147
148 // --- MdcCalibFunSvc ---
149 IMdcCalibFunSvc* imdcCalibSvc;
150 sc = service("MdcCalibFunSvc", imdcCalibSvc);
151 if ( sc.isSuccess() ){
152 myMdcCalibFunSvc = dynamic_cast<MdcCalibFunSvc*>(imdcCalibSvc);
153 }
154 else {
155 cout<<"DotsConnection::initialize(): can not get MdcCalibFunSvc"<<endl;
156 }
157 // --- initialize DotsHelixFitter ---
158 myDotsHelixFitter.initialize();
159 myDotsHelixFitter.setChi2Diverge(myChi2CutDiverge);
160 if(myNtProd&1)
161 {
162 NTuplePtr nt_ptr(ntupleSvc(),"TestDotsHelixFitter/trkPar");
163 if( nt_ptr ) myNtHelixFitter = nt_ptr;
164 else
165 {
166 myNtHelixFitter = ntupleSvc()->book("TestDotsHelixFitter/trkPar",CLID_ColumnWiseTuple,"trkPar");
167 if( myNtHelixFitter ) {
168 myNtHelixFitter->addItem ("run", myRUN);
169 myNtHelixFitter->addItem ("evt", myEVT);
170 myNtHelixFitter->addItem ("pid", myPID);
171 myNtHelixFitter->addItem ("Npar", myNPar, 0,5);
172 myNtHelixFitter->addIndexedItem("HelixMC", myNPar, myArrayHelixMC);
173 myNtHelixFitter->addIndexedItem("HelixFitted", myNPar, myArrayHelixFitted);
174 myNtHelixFitter->addItem ("NhitCircle", myNHitsCircle, 0,100);
175 myNtHelixFitter->addIndexedItem("LayerHitsCircle", myNHitsCircle, myLayerHitsCircle);
176 myNtHelixFitter->addIndexedItem("ChiHitsCircle", myNHitsCircle, myChiHitsCircle);
177 myNtHelixFitter->addItem ("Nhit", myNHits, 0,100);
178 myNtHelixFitter->addIndexedItem("LayerHits", myNHits, myLayerHits);
179 myNtHelixFitter->addIndexedItem("ChiHits", myNHits, myChiHits);
180 myNtHelixFitter->addItem ("NXhit", myNXHits, 0,100);
181 myNtHelixFitter->addItem ("NVhit", myNVHits, 0,100);
182 myNtHelixFitter->addItem ("NXCluster", myNXCluster, 0,100);
183 myNtHelixFitter->addItem ("NVCluster", myNVCluster, 0,100);
184 myNtHelixFitter->addItem ("TrkIdBest", myTrkIdBest);
185 myNtHelixFitter->addItem ("NHitsBestTrk", myNHitsBestTrk);
186 myNtHelixFitter->addItem ("NSameHitsBestTrk", myNSameHitsBestTrk);
187 //cout<<"myNtHelixFitter added !"<<endl;
188 }
189 }
190 }
191
192 // --- get MdcUtilitySvc
193 /*
194 sc = service("MdcUtilitySvc", myMdcUtilitySvc);
195 if( sc != StatusCode::SUCCESS ){
196 log << MSG::FATAL << "can not use MdcUtilitySvc" << endreq;
197 }*/
198
199
200 return StatusCode::SUCCESS;
201}
INTupleSvc * ntupleSvc()
void setChi2Diverge(double cut=1000000)
double Radius(void) const
Definition: MdcGeoLayer.h:160
double nomShift(void) const
Definition: MdcGeoLayer.h:169
int NCell(void) const
Definition: MdcGeoLayer.h:165
HepPoint3D Forward(void) const
Definition: MdcGeoWire.h:129
const MdcGeoWire *const Wire(unsigned id)
Definition: MdcGeomSvc.cxx:770
const int getSuperLayerSize()
Definition: MdcGeomSvc.cxx:681
const MdcGeoLayer *const Layer(unsigned id)
Definition: MdcGeomSvc.cxx:786
const int getSegmentNo()
Definition: MdcGeomSvc.cxx:691
const int getWireSize()
Definition: MdcGeomSvc.cxx:671
const int getLayerSize()
Definition: MdcGeomSvc.cxx:676

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