4#include "GaudiKernel/Algorithm.h"
5#include "GaudiKernel/NTuple.h"
6#include "GaudiKernel/INTupleSvc.h"
21#include "CLHEP/Alist/AList.h"
33#include "HepPDT/ParticleDataTable.hh"
49 CgemLineFit(
const std::string& name, ISvcLocator* pSvcLocator);
74 static void fcn( Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
75 static void fcn2( Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
76 static void fcn3( Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
80 static double dx(
double layerid,
double R,
double dr,
double phi0,
double z0,
double tanl,
double x );
81 static double dV(
int layer,
double R ,
double dr,
double phi0,
double z0,
double tglam,
double x,
double V);
87 vector<double>
Get4Par(HepLorentzVector p4,Hep3Vector bp);
88 bool HitPos(HepLorentzVector p4,Hep3Vector bp);
97 static vector<double>
Trans(
double par0,
double par1,
double par2,
double par3);
98 static vector<int>
GetNMaxQ(vector<double> Q_11,vector<int> L_11,
int Nmax);
99 static double func(
double layer,
double R,
double dr,
double phi0,
double z0,
double tglam,
double V,
double x);
104 static double Min_diff(
double arg1,
double arg2);
116 void Swap(
int i,
int j);
128 bool ThreeClsts_Flag;
132 NTuple::Tuple* m_tuple_track;
133 NTuple::Item<long> tr_run;
134 NTuple::Item<long> tr_event;
136 NTuple::Item<double> tr_drho;
137 NTuple::Item<double> tr_phi0;
138 NTuple::Item<double> tr_dz0;
139 NTuple::Item<double> tr_tanLam;
140 NTuple::Item<double> tr_chisq;
142 NTuple::Item<bool> tr_Is_fitted;
144 NTuple::Item<long> tr_ncluster;
147 NTuple::Array<int> tr_id_cluster;
149 NTuple::Array<double> tr_x_cluster;
150 NTuple::Array<double> tr_y_cluster;
151 NTuple::Array<double> tr_z_cluster;
152 NTuple::Array<double> tr_phi_cluster;
154 NTuple::Array<double> tr_Q_cluster;
155 NTuple::Array<long> tr_layer_cluster;
156 NTuple::Array<long> tr_sheet_cluster;
157 NTuple::Array<bool> tr_Is_selected_cluster;
159 NTuple::Tuple* m_tuple;
160 NTuple::Item<double> run;
162 NTuple::Item<double> R0;
163 NTuple::Item<double> R1;
164 NTuple::Item<double> R2;
166 NTuple::Item<double> status1;
167 NTuple::Item<double> status2;
168 NTuple::Item<double> status3;
170 NTuple::Item<double> clst_2;
171 NTuple::Item<double> clst_0;
172 NTuple::Item<double> clst_1;
174 NTuple::Item<double> clst_00;
175 NTuple::Item<double> clst_01;
177 NTuple::Item<double> clst_10;
178 NTuple::Item<double> clst_11;
180 NTuple::Item<double> event;
181 NTuple::Item<double> phi_o1;
182 NTuple::Item<double> phi_o2;
183 NTuple::Item<double> ini_1;
184 NTuple::Item<double> ini_0;
185 NTuple::Item<double> ini_2;
186 NTuple::Item<double> ini_3;
189 NTuple::Item<double> inim_1;
190 NTuple::Item<double> inim_0;
191 NTuple::Item<double> inim_2;
192 NTuple::Item<double> inim_3;
193 NTuple::Item<double> inii_1;
194 NTuple::Item<double> inii_0;
195 NTuple::Item<double> inii_2;
196 NTuple::Item<double> inii_3;
197 NTuple::Item<double> par0;
198 NTuple::Item<double> par1;
199 NTuple::Item<double> par2;
200 NTuple::Item<double> par3;
201 NTuple::Item<double> Err_par0;
202 NTuple::Item<double> Err_par1;
203 NTuple::Item<double> Err_par2;
204 NTuple::Item<double> Err_par3;
205 NTuple::Item<double> newpar0;
206 NTuple::Item<double> newpar1;
207 NTuple::Item<double> newpar2;
208 NTuple::Item<double> newpar3;
209 NTuple::Item<double> newErr_par0;
210 NTuple::Item<double> newErr_par1;
211 NTuple::Item<double> newErr_par2;
212 NTuple::Item<double> newErr_par3;
213 NTuple::Item<double> MC_par0;
214 NTuple::Item<double> MC_par1;
215 NTuple::Item<double> MC_par2;
216 NTuple::Item<double> MC_par3;
217 NTuple::Item<double> MC_px;
218 NTuple::Item<double> MC_py;
219 NTuple::Item<double> MC_pz;
221 NTuple::Item<double> x_0_up;
222 NTuple::Item<double> x_1_up;
223 NTuple::Item<double> x_2_up;
224 NTuple::Item<double> x_0_down;
225 NTuple::Item<double> x_1_down;
226 NTuple::Item<double> x_2_down;
227 NTuple::Item<double> v_0_up;
228 NTuple::Item<double> v_1_up;
229 NTuple::Item<double> v_2_up;
230 NTuple::Item<double> v_0_down;
231 NTuple::Item<double> v_1_down;
232 NTuple::Item<double> v_2_down;
233 NTuple::Item<double> z_1_up;
234 NTuple::Item<double> z_2_up;
235 NTuple::Item<double> z_0_up;
236 NTuple::Item<double> z_1_down;
237 NTuple::Item<double> z_2_down;
238 NTuple::Item<double> z_0_down;
241 NTuple::Item<double> x_0_up_m;
242 NTuple::Item<double> x_1_up_m;
243 NTuple::Item<double> x_2_up_m;
244 NTuple::Item<double> x_0_down_m;
245 NTuple::Item<double> x_1_down_m;
246 NTuple::Item<double> x_2_down_m;
247 NTuple::Item<double> v_0_up_m;
248 NTuple::Item<double> v_1_up_m;
249 NTuple::Item<double> v_2_up_m;
250 NTuple::Item<double> v_0_down_m;
251 NTuple::Item<double> v_1_down_m;
252 NTuple::Item<double> v_2_down_m;
253 NTuple::Item<double> z_1_up_m;
254 NTuple::Item<double> z_2_up_m;
255 NTuple::Item<double> z_0_up_m;
256 NTuple::Item<double> z_1_down_m;
257 NTuple::Item<double> z_2_down_m;
258 NTuple::Item<double> z_0_down_m;
268 NTuple::Item<double> x_0_up_f;
269 NTuple::Item<double> x_1_up_f;
270 NTuple::Item<double> x_2_up_f;
271 NTuple::Item<double> x_0_down_f;
272 NTuple::Item<double> x_1_down_f;
273 NTuple::Item<double> x_2_down_f;
274 NTuple::Item<double> v_0_up_f;
275 NTuple::Item<double> v_1_up_f;
276 NTuple::Item<double> v_2_up_f;
277 NTuple::Item<double> v_0_down_f;
278 NTuple::Item<double> v_1_down_f;
279 NTuple::Item<double> v_2_down_f;
281 NTuple::Item<double> x_0_up_mc;
282 NTuple::Item<double> x_1_up_mc;
283 NTuple::Item<double> x_2_up_mc;
284 NTuple::Item<double> x_0_down_mc;
285 NTuple::Item<double> x_1_down_mc;
286 NTuple::Item<double> x_2_down_mc;
287 NTuple::Item<double> v_0_up_mc;
288 NTuple::Item<double> v_1_up_mc;
289 NTuple::Item<double> v_2_up_mc;
290 NTuple::Item<double> v_0_down_mc;
291 NTuple::Item<double> v_1_down_mc;
292 NTuple::Item<double> v_2_down_mc;
295 NTuple::Item<double> inner_phi1;
296 NTuple::Item<double> inner_phi2;
297 NTuple::Item<double> inner_V1;
298 NTuple::Item<double> inner_V2;
299 NTuple::Item<double> inner_z1;
300 NTuple::Item<double> inner_z2;
301 NTuple::Item<double> chisq_1;
302 NTuple::Item<double> chisq_2;
303 NTuple::Item<double> chisq_3;
306 NTuple::Item<double> pos_x;
307 NTuple::Item<double> pos_y;
308 NTuple::Item<double> pos_z;
310 NTuple::Item<double> hit_x;
311 NTuple::Item<double> hit_y;
312 NTuple::Item<double> hit_z;
314 NTuple::Item<double> ang_1;
315 NTuple::Item<double> ang_1_x;
316 NTuple::Item<double> ang_1_v;
318 NTuple::Item<double> ang_2;
319 NTuple::Item<double> ang_2_x;
320 NTuple::Item<double> ang_2_v;
322 NTuple::Item<double> ang_3;
323 NTuple::Item<double> ang_3_x;
324 NTuple::Item<double> ang_3_v;
326 NTuple::Item<double> ang_4;
327 NTuple::Item<double> ang_4_x;
328 NTuple::Item<double> ang_4_v;
331 NTuple::Item<double> inter_1_x;
332 NTuple::Item<double> inter_1_V;
333 NTuple::Item<double> inter_1_flag;
334 NTuple::Item<double> inter_1_z;
337 NTuple::Item<double> inter_2_x;
338 NTuple::Item<double> inter_2_V;
339 NTuple::Item<double> inter_2_flag;
340 NTuple::Item<double> inter_2_z;
343 NTuple::Item<double> inter_3_x;
344 NTuple::Item<double> inter_3_V;
345 NTuple::Item<double> inter_3_flag;
346 NTuple::Item<double> inter_3_z;
348 NTuple::Item<double> inter_4_x;
349 NTuple::Item<double> inter_4_V;
350 NTuple::Item<double> inter_4_flag;
351 NTuple::Item<double> inter_4_z;
352 NTuple::Item<double> Res_phi;
353 NTuple::Item<double> Res_V;
354 NTuple::Item<double> Test_phi;
355 NTuple::Item<double> Test_V;
double arg(const EvtComplex &c)
ObjectVector< RecMdcHit > RecMdcHitCol
SmartRefVector< RecCgemCluster > ClusterRefVec
ObjectVector< RecMdcTrack > RecMdcTrackCol
static vector< int > GetNMaxQ(vector< double > Q_11, vector< int > L_11, int Nmax)
void Filter(int layerid, StraightLine *l1)
void InAngle(StraightLine sl)
StraightLine * IniPar(double phi1, double z1, int i, double phi2, double z2, int j)
vector< double > Get4Par(HepLorentzVector p4, Hep3Vector bp)
double Min_dis_up(int R_id, double x, double z, StraightLine *l1)
int GetVirLay(int geolay, double phi)
void Fit_Clusters(double par[])
static void fcn2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
bool Layer_cross(int R_id, StraightLine *l1)
static vector< double > Trans(double par0, double par1, double par2, double par3)
double Min_dis_down(int R_id, double x, double z, StraightLine *l1)
static void fcn3(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
static void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
void IncidentAngle(StraightLine *cosmic_ray, HepPoint3D cluster, double theta, double ang[])
static double dV(int layer, double R, double dr, double phi0, double z0, double tglam, double x, double V)
double Min_dis(int R_id, double x, double z, StraightLine *l1)
vector< double > MC_truth()
bool HitPos(HepLorentzVector p4, Hep3Vector bp)
static double func(double layer, double R, double dr, double phi0, double z0, double tglam, double V, double x)
static void to_0_2pi(double &arg)
TMinuit * Fit(StraightLine *l_outer, int sheetflag, int typ)
static double dx(double layerid, double R, double dr, double phi0, double z0, double tanl, double x)
void Get_OtherIniPar(int clst_0, int clst_1, int clst_2)
static double Min_diff(double arg1, double arg2)
void Store_Trk(TMinuit *fit, int trkid)
double RealPhi(double SimuPhi)
vector< double > Get_Clusters(vector< double >Vec_truth)
StatusCode registerTrack(RecMdcTrackCol *&recMdcTrackCol, RecMdcHitCol *&recMdcHitCol)