103 {
104
106
107 MsgStream log(
msgSvc(), name());
108
109
110
111 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
112 if (!eventHeader) {
113 log << MSG::FATAL << "Could not find Event Header" << endreq;
114 return( StatusCode::FAILURE);
115 }
116
117
118 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
119 if (!mdcTrackCol) {
120 log << MSG::FATAL << "Could not find Mdc track collection!!" << endreq;
121 return( StatusCode::FAILURE);
122 }
123
124 RecMdcTrackCol::iterator iterTrk=mdcTrackCol->begin();
125 double max1=0.;
126 double max2=0.;
127 double cost1=-999,cost2=-999,phi1=-999,phi2=-999;
128 int hit1=-999,hit2=-999,shit1=-999,shit2=-999,charg1=-999,charg2=-999;
129 double mdcbalance=-999;
130
131 unsigned int ntrk=mdcTrackCol->size();
132 double kappa=-999,tanl=-999,sint=-999;
133 double p=-999,theta=-999,phi=-999;
134 double vz1=-999,vz2=-999,vr1=-999,vr2=-999;
135
136
137 for(;iterTrk!= mdcTrackCol->end();iterTrk++) {
138
139
140
141 phi=(*iterTrk)->helix(1);
142 kappa=(*iterTrk)->helix(2);
143 tanl=(*iterTrk)->helix(4);
144
145 theta=0.5*3.1415926-atan(tanl);
147
148
149
150 if(
abs(kappa)>0.001&&
abs(sint)>0.01){
151 p=
abs(1./kappa)/sint;
152 }
153 else{
154 p=1000.;
155 log << MSG::WARNING << "FastTrk=>"<<" kappa=" <<kappa<<"; sint="<<sint<<endreq;
156 }
157 if(p>=max1){
158 max2=max1;
159 cost2=cost1;
160 phi2=phi1;
161 max1=p;
163 phi1=phi;
164 vz2=vz1;
165 vz1=(*iterTrk)->helix(3);
166 vr2=vr1;
167 vr1=(*iterTrk)->helix(0);
168 hit2=hit1;
169 hit1=(*iterTrk)->getNhits();
170 shit2=shit1;
171 shit1=(*iterTrk)->nster();
172 charg2=charg1;
173 charg1=(*iterTrk)->charge();
174 }
175 else if(p>max2){
176 max2=p;
178 phi2=phi;
179 vz2=(*iterTrk)->helix(3);
180 vr2=(*iterTrk)->helix(0);
181 hit2=(*iterTrk)->getNhits();
182 shit2=(*iterTrk)->nster();
183 charg2=(*iterTrk)->charge();
184 }
185 log << MSG::DEBUG << "p=" <<p <<", "<<"theta="<<theta
186 <<", phi="<<phi<<", vz="<<(*iterTrk)->helix(3)<<", vr="<<(*iterTrk)->helix(0)<<endreq;
187 if(
cos(theta)>0) mdcbalance +=1.;
188 else if(
cos(theta)<0) mdcbalance -=1.;
189 }
190 if(ntrk>=2) mdcbalance /= ntrk;
191 else mdcbalance = 1;
192
193 double acol=180.;
194 if(ntrk>=2){
195 acol=180.-180./3.1415926*acos(
cos(phi1)*
sin(acos(cost1))*
cos(phi2)*
sin(acos(cost2))
197 +cost1*cost2);
198 }
199
200 log << MSG::INFO << "ntrk=" << ntrk << "; mdc balance=" <<mdcbalance
201 <<"; pmax1="<< max1 <<"; pmax2="<< max2
202 <<"; acol="<< acol<<"; cost1="<<cost1<<"; cost2="<<cost2<<endreq;
203
204
214
236
239
241
242 return StatusCode::SUCCESS;
243}
double sin(const BesAngle a)
double cos(const BesAngle a)
void setValue(float value)
bool addToEFVec(uint32_t val, uint32_t pos)
bool appToEFVec(double val, uint32_t pos)
bool setVecBit(uint32_t val, uint32_t vecpos, uint32_t bbegin, uint32_t bend)