1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 Revision 1.8 2001/01/26 22:05:41 morsch
18 Unresolved conflicts resolved.
20 Revision 1.7 2001/01/26 21:54:46 morsch
21 Use access functions to AliMUONHit member data.
24 Revision 1.6 2001/01/26 20:00:53 hristov
25 Major upgrade of AliRoot code
27 Revision 1.4 2000/12/21 22:14:38 morsch
28 Clean-up of coding rule violations.
30 Revision 1.3 2000/10/02 21:28:09 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.2 2000/06/15 07:58:49 morsch
34 Code from MUON-dev joined
36 Revision 1.1.2.7 2000/06/09 22:06:29 morsch
37 Some coding rule violations corrected. Will soon be obsolete.
39 Revision 1.1.2.6 2000/05/02 07:15:29 morsch
40 Put back TH1.h and TH2.h includes.
42 Revision 1.1.2.5 2000/02/17 18:12:43 morsch
43 Corrections in trackf_read_spoint causing segmentation violations in previous version (I. Chevrot)
44 New histos (I. Chevrot)
46 Revision 1.1.2.4 2000/02/15 18:01:08 morsch
49 Revision 1.1.2.3 2000/02/15 17:59:01 morsch
52 Revision 1.1.2.2 2000/02/15 18:54:56 morsch
53 Reference between track contributing to reconstructed hit and particle corrected
56 #include "AliCallf77.h"
57 #include "AliMUONTrackReconstructor.h"
62 #include "AliMUONHit.h"
63 #include "AliMUONPadHit.h"
64 #include "AliMUONDigit.h"
65 #include "AliMUONRawCluster.h"
66 #include "AliMUONReconstHit.h"
75 #include <TParticle.h>
80 # define reco_init reco_init_
81 # define cutpxz cutpxz_
82 # define sigmacut sigmacut_
83 # define xpreci xpreci_
84 # define ypreci ypreci_
85 # define reconstmuon reconstmuon_
86 # define reconstmuon2 reconstmuon2_
87 # define trackf_read_geant trackf_read_geant_
88 # define trackf_read_fit trackf_read_fit_
89 # define trackf_read_spoint trackf_read_spoint_
90 # define chfill chfill_
91 # define chfill2 chfill2_
94 # define hist_create hist_create_
95 # define hist_closed hist_closed_
98 # define trackf_fit trackf_fit_
99 # define prec_fit prec_fit_
100 # define fcnfit fcnfit_
101 # define reco_term reco_term_
103 # define reco_init RECO_INIT
104 # define cutpxz CUTPXZ
105 # define sigmacut SIGMACUT
106 # define xpreci XPRECI
107 # define ypreci YPRECI
108 # define reconstmuon RECONSTMUON
109 # define reconstmuon2 RECONSTMUON2
110 # define trackf_read_geant TRACKF_READ_GEANT
111 # define trackf_read_fit TRACKF_READ_FIT
112 # define trackf_read_spoint TRACKF_READ_SPOINT
113 # define chfill CHFILL
114 # define chfill2 CHFILL2
117 # define hist_create HIST_CREATE
118 # define hist_closed HIST_CLOSED
121 # define trackf_fit TRACKF_FIT
122 # define prec_fit PREC_FIT
123 # define fcnfit FCNFIT
124 # define reco_term RECO_TERM
129 void type_of_call reco_init(Double_t &, Double_t &, Double_t &);
130 void type_of_call reco_term();
131 void type_of_call cutpxz(Double_t &);
132 void type_of_call sigmacut(Double_t &);
133 void type_of_call xpreci(Double_t &);
134 void type_of_call ypreci(Double_t &);
135 void type_of_call reconstmuon(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &);
136 void type_of_call reconstmuon2(Int_t &, Int_t &, Int_t &);
137 void type_of_call trackf_read_fit(Int_t &, Int_t &, Int_t &, Int_t *, Double_t *, Double_t *);
138 void type_of_call trackf_read_geant(Int_t *, Double_t *, Double_t *, Double_t *, Int_t *, Int_t *, Double_t *, Double_t *, Double_t *, Double_t *,Int_t &, Double_t *, Double_t *, Double_t *, Int_t &, Int_t &, Double_t *, Double_t *, Double_t *, Double_t *);
139 void type_of_call trackf_read_spoint(Int_t *, Double_t *, Double_t *, Double_t *, Int_t *, Int_t *, Double_t *, Double_t *, Double_t *, Double_t *,Int_t &, Double_t *, Double_t *, Double_t *, Int_t &, Int_t &, Double_t *, Double_t *, Double_t *, Double_t *);
140 void type_of_call chfill(Int_t &, Float_t &, Float_t &, Float_t &);
141 void type_of_call chfill2(Int_t &, Float_t &, Float_t &, Float_t &);
142 void type_of_call chf1(Int_t &, Float_t &, Float_t &);
143 void type_of_call chfnt(Int_t &, Int_t &, Int_t *, Int_t *, Float_t *, Float_t *, Float_t *, Float_t *, Float_t *, Float_t *, Float_t *, Float_t *);
144 void type_of_call hist_create();
145 void type_of_call hist_closed();
146 void type_of_call fcnf(Int_t &, Double_t *, Double_t &, Double_t *, Int_t);
147 void type_of_call fcn(Int_t &, Double_t *, Double_t &, Double_t *, Int_t &, Int_t &);
148 void type_of_call trackf_fit(Int_t &, Double_t *, Double_t *, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &);
149 void type_of_call prec_fit(Double_t &, Double_t &, Double_t &, Double_t &, Double_t&, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &);
150 void type_of_call fcnfitf(Int_t &, Double_t *, Double_t &, Double_t *, Int_t);
151 void type_of_call fcnfit(Int_t &, Double_t *, Double_t &, Double_t *, Int_t &, Int_t &);
152 Float_t type_of_call rndm() {return gRandom->Rndm();}
153 void type_of_call fit_trace(Float_t &, Float_t &, Float_t &, Float_t &, Float_t &, Float_t &, Int_t &, Int_t &, Int_t &, Int_t &);
156 static TTree *gAliNtupleGlobal;
157 static TFile *gAliFileGlobal;
158 static TTree *gAliTreeK1;
159 static TTree *gAliTrH1;
160 static TClonesArray *gAliHits2; //List of hits for one track only
161 static TClonesArray *gAliParticles2; //List of particles in the Kine tree
164 // variables of the tracking ntuple
166 Int_t ievr; // number of event
167 Int_t ntrackr; // number of tracks per event
168 Int_t istatr[500]; // 1 = good muon, 2 = ghost, 0 = something else
169 Int_t isignr[500]; // sign of the track
170 Float_t pxr[500]; // x momentum of the reconstructed track
171 Float_t pyr[500]; // y momentum of the reconstructed track
172 Float_t pzr[500]; // z momentum of the reconstructed track
173 Float_t zvr[500]; // z vertex
174 Float_t chi2r[500]; // chi2 of the fit of the track with the field map
175 Float_t pxv[500]; // x momentum at vertex
176 Float_t pyv[500]; // y momentum at vertex
177 Float_t pzv[500]; // z momentum at vertex
180 ClassImp(AliMUONTrackReconstructor)
182 //___________________________________________________
183 AliMUONTrackReconstructor::AliMUONTrackReconstructor()
193 //_____________________________________________________________________________
194 void AliMUONTrackReconstructor::Reconst2(Int_t &ifit, Int_t &idebug, Int_t &nev)
198 reconstmuon2(ifit,idebug,nev);
201 //_____________________________________________________________________________
202 void AliMUONTrackReconstructor::Reconst(Int_t &ifit, Int_t &idebug, Int_t bgdEvent, Int_t &nev, Int_t &idres, Int_t &ireadgeant, Option_t *option,Text_t *filename)
205 // open kine and hits tree of background file for reconstruction of geant hits
206 // call tracking fortran program
207 static Bool_t first=kTRUE;
209 const char *addBackground = strstr(option,"Add");
211 if (addBackground ) { // only in case of background with geant hits
214 cout<<"filename "<<fFileName<<endl;
215 pFile=new TFile(fFileName);
216 cout<<"I have opened "<<fFileName<<" file "<<endl;
217 gAliHits2 = new TClonesArray("AliMUONHit",1000);
218 gAliParticles2 = new TClonesArray("TParticle",1000);
222 if(gAliHits2) gAliHits2->Clear();
223 if(gAliParticles2) gAliParticles2->Clear();
224 if(gAliTrH1) delete gAliTrH1;
226 if(gAliTreeK1) delete gAliTreeK1;
228 // Get Hits Tree header from file
230 sprintf(treeName,"TreeH%d",bgdEvent);
231 gAliTrH1 = (TTree*)gDirectory->Get(treeName);
232 // printf("gAliTrH1 %p of treename %s for event %d \n",gAliTrH1,treeName,bgdEvent);
234 printf("ERROR: cannot find Hits Tree for event:%d\n",bgdEvent);
236 // set branch addresses
239 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
240 sprintf(branchname,"%s",pMUON->GetName());
241 if (gAliTrH1 && gAliHits2) {
242 branch = gAliTrH1->GetBranch(branchname);
243 if (branch) branch->SetAddress(&gAliHits2);
245 gAliTrH1->GetEntries();
247 sprintf(treeName,"TreeK%d",bgdEvent);
248 gAliTreeK1 = (TTree*)gDirectory->Get(treeName);
250 printf("ERROR: cannot find Kine Tree for event:%d\n",bgdEvent);
252 // set branch addresses
254 gAliTreeK1->SetBranchAddress("Particles", &gAliParticles2);
255 gAliTreeK1->GetEvent(0);
257 // get back to the first file
258 TTree *treeK = gAlice->TreeK();
260 if (treeK) file1 = treeK->GetCurrentFile();
263 } // end if addBackground
265 // call tracking fortran program
266 reconstmuon(ifit,idebug,nev,idres,ireadgeant);
269 //________________________________________________________________________________
270 void AliMUONTrackReconstructor::Init(Double_t &seff, Double_t &sb0, Double_t &sbl3)
273 // introduce in fortran program somme parameters and cuts for tracking
274 // create output file "reconst.root" (histos + ntuple)
275 cutpxz(fSPxzCut); // Pxz cut (GeV/c) to begin the track finding
276 sigmacut(fSSigmaCut); // Number of sigmas delimiting the searching areas
277 xpreci(fSXPrec); // Chamber precision in X (cm)
278 ypreci(fSYPrec); // Chamber precision in Y (cm)
279 reco_init(seff,sb0,sbl3);
282 //__________________________________________
283 void AliMUONTrackReconstructor::FinishEvent()
286 // TTree *treeK = gAlice->TreeK();
288 // if (treeK) file1 = treeK->GetCurrentFile();
292 //_____________________________________
293 void AliMUONTrackReconstructor::Close()
296 // write histos and ntuple to "reconst.root" file
300 //________________________________________________________
301 void chfill(Int_t &id, Float_t &x, Float_t &y, Float_t &w)
304 // fill histo like hfill in fortran
306 sprintf(name,"h%d",id);
307 TH1F *h1 = (TH1F*) gDirectory->Get(name);
311 //_________________________________________________________
312 void chfill2(Int_t &id, Float_t &x, Float_t &y, Float_t &w)
315 // fill histo like hfill2 in fortran
317 sprintf(name,"h%d",id);
318 TH2F *h2 = (TH2F*) gDirectory->Get(name);
322 //__________________________________________
323 void chf1(Int_t &id, Float_t &x, Float_t &w)
326 // fill histo like hf1 in fortran
328 sprintf(name,"h%d",id);
329 TH1F *h1 = (TH1F*) gDirectory->Get(name);
337 // Create an output file ("reconst.root")
338 // Create some histograms and an ntuple
340 gAliFileGlobal = new TFile("reconst.root","RECREATE","Ntuple - reconstruction");
342 gAliNtupleGlobal = new TTree("ntuple","Reconst ntuple");
343 gAliNtupleGlobal->Branch("ievr",&NtupleSt.ievr,"ievr/I");
344 gAliNtupleGlobal->Branch("ntrackr",&NtupleSt.ntrackr,"ntrackr/I");
345 gAliNtupleGlobal->Branch("istatr",&NtupleSt.istatr[0],"istatr[500]/I");
346 gAliNtupleGlobal->Branch("isignr",&NtupleSt.isignr[0],"isignr[500]/I");
347 gAliNtupleGlobal->Branch("pxr",&NtupleSt.pxr[0],"pxr[500]/F");
348 gAliNtupleGlobal->Branch("pyr",&NtupleSt.pyr[0],"pyr[500]/F");
349 gAliNtupleGlobal->Branch("pzr",&NtupleSt.pzr[0],"pzr[500]/F");
350 gAliNtupleGlobal->Branch("zvr",&NtupleSt.zvr[0],"zvr[500]/F");
351 gAliNtupleGlobal->Branch("chi2r",&NtupleSt.chi2r[0],"chi2r[500]/F");
352 gAliNtupleGlobal->Branch("pxv",&NtupleSt.pxv[0],"pxv[500]/F");
353 gAliNtupleGlobal->Branch("pyv",&NtupleSt.pyv[0],"pyv[500]/F");
354 gAliNtupleGlobal->Branch("pzv",&NtupleSt.pzv[0],"pzv[500]/F");
358 new TH1F("h100","particule id du hit geant",20,0.,20.);
359 new TH1F("h101","position en x du hit geant",100,-200.,200.);
360 new TH1F("h102","position en y du hit geant",100,-200.,200.);
361 new TH1F("h103","chambre de tracking concernee",15,0.,14.);
362 new TH1F("h104","moment ptot du hit geant",50,0.,100.);
363 new TH1F("h105","px au vertex",50,0.,20.);
364 new TH1F("h106","py au vertex",50,0.,20.);
365 new TH1F("h107","pz au vertex",50,0.,20.);
366 new TH1F("h108","position zv",50,-15.,15.);
367 new TH1F("h109","position en x du hit reconstruit",100,-300.,300.);
368 new TH1F("h110","position en y du hit reconstruit",100,-300.,300.);
369 new TH1F("h111","delta x station 1",100,-0.3,0.3);
370 new TH1F("h112","delta x station 2",100,-0.3,0.3);
371 new TH1F("h113","delta x station 3",100,-0.3,0.3);
372 new TH1F("h114","delta x station 4",100,-0.5,0.5);
373 new TH1F("h115","delta x station 5",100,-0.5,0.5);
374 new TH1F("h116","delta x station 1",100,-2,2);
375 new TH1F("h117","delta x station 2",100,-2,2);
376 new TH1F("h121","delta y station 1",100,-0.04,0.04);
377 new TH1F("h122","delta y station 2",100,-0.04,0.04);
378 new TH1F("h123","delta y station 3",100,-0.04,0.04);
379 new TH1F("h124","delta y station 4",100,-0.04,0.04);
380 new TH1F("h125","delta y station 5",100,-0.04,0.04);
384 for (int i=0;i<10;i++) {
385 sprintf(hname,"deltax%d",i);
386 sprintf(hname1,"h12%d",i);
387 new TH1F(hname1,hname ,100,-0.4,0.4);
388 sprintf(hname,"deltay%d",i);
389 sprintf(hname1,"h13%d",i);
390 new TH1F(hname1,hname ,100,-0.4,0.4);
393 new TH2F("h2000","VAR X st. 5",30,3.0,183.0,100,0.,25.);
394 new TH2F("h2001","VAR Y st. 5",30,3.0,183.0,100,0.,25.);
396 new TH2F("h2500","P vs X HHIT",30,3.0,183.0,200,0.,200.);
397 new TH2F("h2501","P vs X HHIT**2",30,3.0,183.0,200,0.,5000.);
398 new TH2F("h2502","P vs X EPH2 st. 5",30,3.0,183.0,100,0.,0.000005);
399 new TH2F("h2503","P vs X EAL2 st. 5",30,3.0,183.0,100,0.,0.01);
400 //new TH2F("h2504","P vs X EXM2 st. 5",30,3.0,183.0,100,0.,1.5);
401 new TH2F("h2504","P vs X EXM2 st. 5",30,3.0,183.0,100,0.,0.1);
402 new TH2F("h2505","P vs X EYM2 st. 5",30,3.0,183.0,100,0.,30.);
404 new TH2F("h2507","P vs X EPH st. 5",30,3.0,183.0,100,0.,0.003);
405 new TH2F("h2508","P vs X EAL st. 5",30,3.0,183.0,100,0.,0.3);
406 //new TH2F("h2509","P vs X EXM st. 5",30,3.0,183.0,100,0.,1.5);
407 new TH2F("h2509","P vs X EXM st. 5",30,3.0,183.0,100,0.,0.4);
408 new TH2F("h2510","P vs X EYM st. 5",30,3.0,183.0,100,0.,30.);
410 new TH2F("h2511","P vs X EPH cut st. 5",30,3.0,183.0,100,0.,0.01);
411 new TH2F("h2512","P vs X EAL cut st. 5",30,3.0,183.0,100,0.,0.3);
412 //new TH2F("h2513","P vs X EXM cut st. 5",30,3.0,183.0,100,0.,1.5);
413 new TH2F("h2513","P vs X EXM cut st. 5",30,3.0,183.0,100,0.,0.4);
414 new TH2F("h2514","P vs X EYM cut st. 5",30,3.0,183.0,100,0.,30.);
416 new TH2F("h2400","P vs X HHIT",30,3.0,183.0,200,0.,200.);
417 new TH2F("h2401","P vs X HHIT**2",30,3.0,183.0,200,0.,5000.);
418 new TH2F("h2402","P vs X EPH2 st. 4",30,3.0,183.0,100,0.,0.000005);
419 new TH2F("h2403","P vs X EAL2 st. 4",30,3.0,183.0,100,0.,0.05);
420 //new TH2F("h2404","P vs X EXM2 st. 4",30,3.0,183.0,100,0.,1.5);
421 new TH2F("h2404","P vs X EXM2 st. 4",30,3.0,183.0,100,0.,0.1);
422 new TH2F("h2405","P vs X EYM2 st. 4",30,3.0,183.0,100,0.,30.);
424 new TH2F("h2407","P vs X EPH st. 4",30,3.0,183.0,100,0.,0.003);
425 new TH2F("h2408","P vs X EAL st. 4",30,3.0,183.0,100,0.,0.3);
426 //new TH2F("h2409","P vs X EXM st. 4",30,3.0,183.0,100,0.,1.5);
427 new TH2F("h2409","P vs X EXM st. 4",30,3.0,183.0,100,0.,0.1);
428 new TH2F("h2410","P vs X EYM st. 4",30,3.0,183.0,100,0.,30.);
430 new TH2F("h2411","P vs X EPH cut st. 4",30,3.0,183.0,100,0.,0.01);
431 new TH2F("h2412","P vs X EAL cut st. 4",30,3.0,183.0,100,0.,0.3);
432 //new TH2F("h2413","P vs X EXM cut st. 4",30,3.0,183.0,100,0.,1.5);
433 new TH2F("h2413","P vs X EXM cut st. 4",30,3.0,183.0,100,0.,0.1);
434 new TH2F("h2414","P vs X EYM cut st. 4",30,3.0,183.0,100,0.,30.);
436 new TH1F("h2301","P2",30,3.0,183.0);
437 new TH2F("h2302","P2 vs X EPH2 st. 3",30,3.0,183.0,100,0.,0.0006);
438 new TH2F("h2303","P2 vs X EAL2 st. 3",30,3.0,183.0,100,0.,0.0005);
439 //new TH2F("h2304","P2 vs X EXM2 st. 3",30,3.0,183.0,100,0.,1.5);
440 new TH2F("h2304","P2 vs X EXM2 st. 3",30,3.0,183.0,100,0.,2.);
441 new TH2F("h2305","P2 vs X EYM2 st. 3",30,3.0,183.0,100,0.,3.);
443 new TH2F("h2307","P vs X EPH2 st. 3",30,3.0,183.0,100,0.,0.0006);
444 new TH2F("h2308","P vs X EAL2 st. 3",30,3.0,183.0,100,0.,0.005);
445 //new TH2F("h2309","P vs X EXM2 st. 3",30,3.0,183.0,100,0.,1.5);
446 new TH2F("h2309","P vs X EXM2 st. 3",30,3.0,183.0,100,0.,2.);
447 new TH2F("h2310","P vs X EYM2 st. 3",30,3.0,183.0,100,0.,3.);
449 new TH2F("h2311","P vs X EPH cut st. 3",30,3.0,183.0,100,0.,0.06);
450 new TH2F("h2312","P vs X EAL cut st. 3",30,3.0,183.0,100,0.,0.05);
451 //new TH2F("h2313","P vs X EXM cut st. 3",30,3.0,183.0,100,0.,1.5);
452 new TH2F("h2313","P vs X EXM cut st. 3",30,3.0,183.0,100,0.,6.);
453 new TH2F("h2314","P vs X EYM cut st. 3",30,3.0,183.0,100,0.,7.);
455 new TH2F("h2315","P2 vs X EPH cut st. 3",30,3.0,183.0,100,0.,0.06);
456 new TH2F("h2316","P2 vs X EAL cut st. 3",30,3.0,183.0,100,0.,0.05);
457 //new TH2F("h2317","P2 vs X EXM cut st. 3",30,3.0,183.0,100,0.,1.5);
458 new TH2F("h2317","P2 vs X EXM cut st. 3",30,3.0,183.0,100,0.,6.);
459 new TH2F("h2318","P2 vs X EYM cut st. 3",30,3.0,183.0,100,0.,7.);
462 new TH1F("h2201","P2",30,3.0,183.0);
463 new TH2F("h2202","P2 vs X EPH2 st. 2",30,3.0,183.0,100,0.,0.0006);
464 new TH2F("h2203","P2 vs X EAL2 st. 2",30,3.0,183.0,100,0.,0.005);
465 //new TH2F("h2204","P2 vs X EXM2 st. 2",30,3.0,183.0,100,0.,1.5);
466 new TH2F("h2204","P2 vs X EXM2 st. 2",30,3.0,183.0,100,0.,7.);
467 new TH2F("h2205","P2 vs X EYM2 st. 2",30,3.0,183.0,100,0.,5.);
469 new TH2F("h2207","P vs X EPH2 st. 2",30,3.0,183.0,100,0.,0.0006);
470 new TH2F("h2208","P vs X EAL2 st. 2",30,3.0,183.0,100,0.,0.005);
471 //new TH2F("h2209","P vs X EXM2 st. 2",30,3.0,183.0,100,0.,1.5);
472 new TH2F("h2209","P vs X EXM2 st. 2",30,3.0,183.0,100,0.,7.);
473 new TH2F("h2210","P vs X EYM2 st. 2",30,3.0,183.0,100,0.,5.);
475 new TH2F("h2211","P vs X EPH cut st. 2",30,3.0,183.0,100,0.,0.05);
476 new TH2F("h2212","P vs X EAL cut st. 2",30,3.0,183.0,100,0.,0.2);
477 //new TH2F("h2213","P vs X EXM cut st. 2",30,3.0,183.0,100,0.,1.5);
478 new TH2F("h2213","P vs X EXM cut st. 2",30,3.0,183.0,100,0.,11.);
479 new TH2F("h2214","P vs X EYM cut st. 2",30,3.0,183.0,100,0.,10.);
481 new TH2F("h2215","P2 vs X EPH cut st. 2",30,3.0,183.0,100,0.,0.05);
482 new TH2F("h2216","P2 vs X EAL cut st. 2",30,3.0,183.0,100,0.,0.2);
483 //new TH2F("h2217","P2 vs X EXM cut st. 2",30,3.0,183.0,100,0.,1.5);
484 new TH2F("h2217","P2 vs X EXM cut st. 2",30,3.0,183.0,100,0.,11.);
485 new TH2F("h2218","P2 vs X EYM cut st. 2",30,3.0,183.0,100,0.,10.);
488 new TH2F("h2102","P2 vs X EPH2 st. 2",30,3.0,183.0,100,0.,0.0006);
489 new TH2F("h2103","P2 vs X EAL2 st. 2",30,3.0,183.0,100,0.,0.005);
490 //new TH2F("h2104","P2 vs X EXM2 st. 2",30,3.0,183.0,100,0.,1.5);
491 new TH2F("h2104","P2 vs X EXM2 st. 2",30,3.0,183.0,100,0.,7.);
492 new TH2F("h2105","P2 vs X EYM2 st. 2",30,3.0,183.0,100,0.,7.);
494 new TH2F("h2107","P vs X EPH2 st. 2",30,3.0,183.0,100,0.,0.0006);
495 new TH2F("h2108","P vs X EAL2 st. 2",30,3.0,183.0,100,0.,0.005);
496 //new TH2F("h2109","P vs X EXM2 st. 2",30,3.0,183.0,100,0.,1.5);
497 new TH2F("h2109","P vs X EXM2 st. 2",30,3.0,183.0,100,0.,7.);
498 new TH2F("h2110","P vs X EYM2 st. 2",30,3.0,183.0,100,0.,7.);
500 new TH2F("h2111","P vs X EPH cut st. 2",30,3.0,183.0,100,0.,0.1);
501 new TH2F("h2112","P vs X EAL cut st. 2",30,3.0,183.0,100,0.,0.2);
502 //new TH2F("h2113","P vs X EXM cut st. 2",30,3.0,183.0,100,0.,1.5);
503 new TH2F("h2113","P vs X EXM cut st. 2",30,3.0,183.0,100,0.,11.);
504 new TH2F("h2114","P vs X EYM cut st. 2",30,3.0,183.0,100,0.,11.);
506 new TH2F("h2115","P2 vs X EPH cut st. 2",30,3.0,183.0,100,0.,0.1);
507 new TH2F("h2116","P2 vs X EAL cut st. 2",30,3.0,183.0,100,0.,0.2);
508 //new TH2F("h2117","P2 vs X EXM cut st. 2",30,3.0,183.0,100,0.,1.5);
509 new TH2F("h2117","P2 vs X EXM cut st. 2",30,3.0,183.0,100,0.,11.);
510 new TH2F("h2118","P2 vs X EYM cut st. 2",30,3.0,183.0,100,0.,11.);
513 new TH1F("h2701","P2 fit 2",30,3.0,183.0);
514 new TH2F("h2702","P2 vs X EPH2 st. 1 fit 2",30,3.0,183.0,100,0.,0.0006);
515 new TH2F("h2703","P2 vs X EAL2 st. 1 fit 2",30,3.0,183.0,100,0.,0.005);
516 // new TH2F("h2704","P2 vs X EXM2 st. 1 fit 2",30,3.0,183.0,100,0.,1.5);
517 new TH2F("h2704","P2 vs X EXM2 st. 1 fit 2",30,3.0,183.0,100,0.,2.);
518 new TH2F("h2705","P2 vs X EYM2 st. 1 fit 2",30,3.0,183.0,100,0.,3.);
520 new TH2F("h2707","P vs X EPH2 st. 1 fit 2",30,3.0,183.0,100,0.,0.0006);
521 new TH2F("h2708","P vs X EAL2 st. 1 fit 2",30,3.0,183.0,100,0.,0.005);
522 //new TH2F("h2709","P vs X EXM2 st. 1 fit 2",30,3.0,183.0,100,0.,1.5);
523 new TH2F("h2709","P vs X EXM2 st. 1 fit 2",30,3.0,183.0,100,0.,2.);
524 new TH2F("h2710","P vs X EYM2 st. 1 fit 2",30,3.0,183.0,100,0.,3.);
526 new TH2F("h2711","P vs X EPH cut st. 1 fit 2",30,3.0,183.0,100,0.,0.07);
527 new TH2F("h2712","P vs X EAL cut st. 1 fit 2",30,3.0,183.0,100,0.,0.2);
528 //new TH2F("h2713","P vs X EXM cut st. 1 fit 2",30,3.0,183.0,100,0.,1.5);
529 new TH2F("h2713","P vs X EXM cut st. 1 fit 2",30,3.0,183.0,100,0.,6.);
530 new TH2F("h2714","P vs X EYM cut st. 1 fit 2",30,3.0,183.0,100,0.,7.);
532 new TH2F("h2715","P2 vs X EPH cut st. 1 fit 2",30,3.0,183.0,100,0.,0.07);
533 new TH2F("h2716","P2 vs X EAL cut st. 1 fit 2",30,3.0,183.0,100,0.,0.2);
534 //new TH2F("h2717","P2 vs X EXM cut st. 1 fit 2",30,3.0,183.0,100,0.,1.5);
535 new TH2F("h2717","P2 vs X EXM cut st. 1 fit 2",30,3.0,183.0,100,0.,6.);
536 new TH2F("h2718","P2 vs X EYM cut st. 1 fit 2",30,3.0,183.0,100,0.,7.);
539 new TH1F("h2801","P2 fit 1",30,3.0,183.0);
540 new TH2F("h2802","P2 vs X EPH2 st. 2 fit 1",30,3.0,183.0,100,0.,0.0006);
541 new TH2F("h2803","P2 vs X EAL2 st. 2 fit 1",30,3.0,183.0,100,0.,0.005);
542 //new TH2F("h2804","P2 vs X EXM2 st. 2 fit 1",30,3.0,183.0,100,0.,1.5);
543 new TH2F("h2804","P2 vs X EXM2 st. 2 fit 1",30,3.0,183.0,100,0.,2.);
544 new TH2F("h2805","P2 vs X EYM2 st. 2 fit 1",30,3.0,183.0,100,0.,3.);
546 new TH2F("h2807","P vs X EPH2 st. 2 fit 1",30,3.0,183.0,100,0.,0.0006);
547 new TH2F("h2808","P vs X EAL2 st. 2 fit 1",30,3.0,183.0,100,0.,0.005);
548 //new TH2F("h2809","P vs X EXM2 st. 2 fit 1",30,3.0,183.0,100,0.,1.5);
549 new TH2F("h2809","P vs X EXM2 st. 2 fit 1",30,3.0,183.0,100,0.,2.);
550 new TH2F("h2810","P vs X EYM2 st. 2 fit 1",30,3.0,183.0,100,0.,3.);
552 new TH2F("h2811","P vs X EPH cut st. 2 fit 1",30,3.0,183.0,100,0.,0.05);
553 new TH2F("h2812","P vs X EAL cut st. 2 fit 1",30,3.0,183.0,100,0.,0.2);
554 //new TH2F("h2813","P vs X EXM cut st. 2 fit 1",30,3.0,183.0,100,0.,1.5);
555 new TH2F("h2813","P vs X EXM cut st. 2 fit 1",30,3.0,183.0,100,0.,5.);
556 new TH2F("h2814","P vs X EYM cut st. 2 fit 1",30,3.0,183.0,100,0.,7.);
558 new TH2F("h2815","P2 vs X EPH cut st. 2 fit 1",30,3.0,183.0,100,0.,0.05);
559 new TH2F("h2816","P2 vs X EAL cut st. 2 fit 1",30,3.0,183.0,100,0.,0.2);
560 //new TH2F("h2817","P2 vs X EXM cut st. 2 fit 1",30,3.0,183.0,100,0.,1.5);
561 new TH2F("h2817","P2 vs X EXM cut st. 2 fit 1",30,3.0,183.0,100,0.,5.);
562 new TH2F("h2818","P2 vs X EYM cut st. 2 fit 1",30,3.0,183.0,100,0.,7.);
565 new TH2F("h1111","dx vs x station 1",30,-250.,250.,30,-0.5,0.5);
566 new TH2F("h1112","dx vs x station 2",30,-250.,250.,30,-0.5,0.5);
567 new TH2F("h1113","dx vs x station 3",30,-250.,250.,30,-0.5,0.5);
568 new TH2F("h1114","dx vs x station 4",30,-250.,250.,30,-0.5,0.5);
569 new TH2F("h1115","dx vs x station 5",30,-250.,250.,30,-0.5,0.5);
570 new TH2F("h1121","dy vs y station 1",30,-250.,250.,30,-0.04,0.04);
571 new TH2F("h1122","dy vs y station 2",30,-250.,250.,30,-0.04,0.04);
572 new TH2F("h1123","dy vs y station 3",30,-250.,250.,30,-0.04,0.04);
573 new TH2F("h1124","dy vs y station 4",30,-250.,250.,30,-0.04,0.04);
574 new TH2F("h1125","dy vs y station 5",30,-250.,250.,30,-0.04,0.04);
578 new TH1F("h500","Acceptance en H st. 4",500,0.,500.);
579 new TH1F("h600","Acceptance en H st. 5",500,0.,500.);
580 new TH1F("h700","X vertex track found",200,-10.,10.);
581 new TH1F("h701","Y vertex track found",200,-10.,10.);
582 new TH1F("h800","Rap. muon gen.",100,0.,5.);
583 new TH1F("h801","Rap. muon gen. recons.",100,0.,5.);
584 new TH1F("h802","Rap. muon gen. ghost ",100,0.,5.);
585 new TH1F("h900","Pt muon gen.",100,0.,20.);
586 new TH1F("h901","Pt muon gen. recons.",100,0.,20.);
587 new TH1F("h902","Pt muon gen. ghost",100,0.,20.);
588 new TH1F("h910","phi muon gen.",100,-10.,10.);
589 new TH1F("h911","phi muon gen. recons.",100,-10.,10.);
590 new TH1F("h912","phi muon gen. ghost",100,-10.,10.);
591 new TH2F("h1001","Y VS X hit st. 1",300,-300.,300.,300,-300.,300.);
592 new TH2F("h1002","Y VS X hit st. 2",300,-300.,300.,300,-300.,300.);
593 new TH2F("h1003","Y VS X hit st. 3",300,-300.,300.,300,-300.,300.);
594 new TH2F("h1004","Y VS X hit st. 4",300,-300.,300.,300,-300.,300.);
595 new TH2F("h1005","Y VS X hit st. 5",300,-300.,300.,300,-300.,300.);
596 // Histos variance dans 4
597 new TH2F("h11","VAR X st. 4",30,3.0,183.0,100,0.,2.);
598 new TH2F("h12","VAR Y st. 4",30,3.0,183.0,100,0.,600.);
599 new TH2F("h13","VAR PHI st. 4",30,3.0,183.0,100,0.,0.0001);
600 new TH2F("h14","VAR ALM st. 4",30,3.0,183.0,100,0.,0.05);
601 new TH1F("h15","P",30,3.0,183.0);
602 new TH1F("h411","VAR X st. 4",100,-1.42,1.42);
603 new TH1F("h412","VAR Y st. 4",100,-25.,25.);
604 new TH1F("h413","VAR PHI st. 4",100,-0.01,0.01);
605 new TH1F("h414","VAR ALM st. 4",100,-0.23,0.23);
607 new TH2F("h211","histo2-VAR X st. 4",30,3.0,183.0,100,0.,2.);
608 new TH2F("h212","histo2-VAR Y st. 4",30,3.0,183.0,100,0.,600.);
609 new TH1F("h213","histo2-VAR X st. 4",100,-1.42,1.42);
610 new TH1F("h214","histo2-VAR Y st. 4",100,-25.,25.);
611 new TH1F("h215","histo2-P",30,3.0,183.0);
613 // Histos variance dans 2
614 new TH2F("h21","VAR X st. 2",30,3.0,183.0,100,0.,3.);
615 new TH2F("h22","VAR Y st. 2",30,3.0,183.0,100,0.,7.);
616 new TH2F("h23","VAR PHI st. 2",30,3.0,183.0,100,0.,0.006);
617 new TH2F("h24","VAR ALM st. 2",30,3.0,183.0,100,0.,0.005);
618 new TH1F("h25","P",30,3.0,183.0);
619 new TH1F("h421","VAR X st. 2",100,-1.72,1.72);
620 new TH1F("h422","VAR Y st. 2",100,-2.7,2.7);
621 new TH1F("h423","VAR PHI st. 2",100,-0.08,0.08);
622 new TH1F("h424","VAR ALM st. 2",100,-0.072,0.072);
624 new TH2F("h221","histo2-VAR X st. 2",30,3.0,183.0,100,0.,3.);
625 new TH2F("h222","histo2-VAR Y st. 2",30,3.0,183.0,100,0.,7.);
626 new TH1F("h223","histo2-VAR X st. 2",100,-1.72,1.72);
627 new TH1F("h224","histo2-VAR Y st. 2",100,-2.7,2.7);
628 new TH1F("h225","histo2-P",30,3.0,183.0);
630 // Histos variance dans 1
631 new TH2F("h31","VAR X st. 1",30,3.0,183.0,100,0.,2.);
632 new TH2F("h32","VAR Y st. 1",30,3.0,183.0,100,0.,0.5);
633 new TH2F("h33","VAR PHI st. 1",30,3.0,183.0,100,0.,0.006);
634 new TH2F("h34","VAR ALM st. 1",30,3.0,183.0,100,0.,0.005);
635 new TH1F("h35","P",30,3.0,183.0);
636 new TH1F("h431","VAR X st. 1",100,-1.42,1.42);
637 new TH1F("h432","VAR Y st. 1",100,-0.72,0.72);
638 new TH1F("h433","VAR PHI st. 1",100,-0.08,0.08);
639 new TH1F("h434","VAR ALM st. 1",100,-0.072,0.072);
640 // Histos variance dans 1
641 new TH2F("h41","VAR X st. 1 fit 5,4,3,2,V",30,3.0,183.0,100,0.,4.);
642 new TH2F("h42","VAR Y st. 1 fit 5,4,3,2,V",30,3.0,183.0,100,0.,20.);
643 new TH2F("h43","VAR PHI st. 1 fit 5,4,3,2,V",30,3.0,183.0,100,0.,0.005);
644 new TH2F("h44","VAR ALM st. 1 fit 5,4,3,2,V",30,3.0,183.0,100,0.,0.005);
645 new TH1F("h45","P",30,3.0,183.0);
646 new TH1F("h441","VAR X st. 1 fit 5,4,3,2,V",100,-2.,2.);
647 new TH1F("h442","VAR Y st. 1 fit 5,4,3,2,V",100,-4.5,4.5);
648 new TH1F("h443","VAR PHI st. 1 fit 5,4,3,2,V",100,-0.072,0.072);
649 new TH1F("h444","VAR ALM st. 1 fit 5,4,3,2,V",100,-0.072,0.072);
651 new TH2F("h241","histo2-VAR X st. 1 fit 5,4,3,2,V",30,3.0,183.0,100,0.,4.);
652 new TH2F("h242","histo2-VAR Y st. 1 fit 5,4,3,2,V",30,3.0,183.0,100,0.,20.);
653 new TH1F("h243","histo2-VAR X st. 1 fit 5,4,3,2,V",100,-2.,2.);
654 new TH1F("h244","histo2-VAR Y st. 1 fit 5,4,3,2,V",100,-4.5,4.5);
655 new TH1F("h245","histo2-P",30,3.0,183.0);
657 // Histos variance dans 2
658 new TH2F("h51","VAR X st. 2 fit 5,4,3,1,V",30,3.0,183.0,100,0.,0.5);
659 new TH2F("h52","VAR Y st. 2 fit 5,4,3,1,V",30,3.0,183.0,100,0.,2.);
660 new TH2F("h53","VAR PHI st. 2 fit 5,4,3,1,V",30,3.0,183.0,100,0.,0.005);
661 new TH2F("h54","VAR ALM st. 2 fit 5,4,3,1,V",30,3.0,183.0,100,0.,0.01);
662 new TH1F("h55","P",30,3.0,183.0);
663 new TH1F("h451","VAR X st. 2 fit 5,4,3,1,V",100,-0.72,0.72);
664 new TH1F("h452","VAR Y st. 2 fit 5,4,3,1,V",100,-1.42,1.42);
665 new TH1F("h453","VAR PHI st. 2 fit 5,4,3,1,V",100,-0.072,0.072);
666 new TH1F("h454","VAR ALM st. 2 fit 5,4,3,1,V",100,-0.1,0.1);
667 new TH1F("h999","PTOT",30,3.0,183.0);
669 new TH2F("h251","histo2-VAR X st. 2 fit 5,4,3,1,V",30,3.0,183.0,100,0.,0.5);
670 new TH2F("h252","histo2-VAR Y st. 2 fit 5,4,3,1,V",30,3.0,183.0,100,0.,2.);
671 new TH1F("h253","histo2-VAR X st. 2 fit 5,4,3,1,V",100,-0.72,0.72);
672 new TH1F("h254","histo2-VAR Y st. 2 fit 5,4,3,1,V",100,-1.42,1.42);
673 new TH1F("h255","histo2-P",30,3.0,183.0);
674 // Histos variance dans 3
675 new TH2F("h61","VAR X st. 3 fit 4,5,V",30,3.0,183.0,100,0.,5.);
676 new TH2F("h62","VAR Y st. 3 fit 4,5,V",30,3.0,183.0,100,0.,2.);
677 new TH2F("h63","VAR PHI st. 3 fit 4,5,V",30,3.0,183.0,100,0.,0.0006);
678 new TH2F("h64","VAR ALM st. 3 fit 4,5,V",30,3.0,183.0,100,0.,0.0006);
679 new TH1F("h65","P",30,3.0,183.0);
680 new TH1F("h461","VAR X st. 3 fit 4,5,V",100,-2.25,2.25);
681 new TH1F("h462","VAR Y st. 3 fit 4,5,V",100,-1.42,1.42);
682 new TH1F("h463","VAR PHI st. 3 fit 4,5,V",100,-0.024,0.024);
683 new TH1F("h464","VAR ALM st. 3 fit 4,5,V",100,-0.024,0.024);
685 new TH2F("h261","histo2-VAR X st. 3 fit 4,5,V",30,3.0,183.0,100,0.,5.);
686 new TH2F("h262","histo2-VAR Y st. 3 fit 4,5,V",30,3.0,183.0,100,0.,2.);
687 new TH1F("h263","histo2-VAR X st. 3 fit 4,5,V",100,-2.25,2.25);
688 new TH1F("h264","histo2-VAR Y st. 3 fit 4,5,V",100,-1.42,1.42);
689 new TH1F("h265","Phisto2-",30,3.0,183.0);
690 // Histos dx,dy distribution between chambers inside stations
691 new TH1F("h71","DX in st. ID-70",100,-5.,5.);
692 new TH1F("h81","DY in st. ID-80",100,-5.,5.);
693 new TH1F("h72","DX in st. ID-70",100,-5.,5.);
694 new TH1F("h82","DY in st. ID-80",100,-5.,5.);
695 new TH1F("h73","DX in st. ID-70",100,-5.,5.);
696 new TH1F("h83","DY in st. ID-80",100,-5.,5.);
697 new TH1F("h74","DX in st. ID-70",100,-5.,5.);
698 new TH1F("h84","DY in st. ID-80",100,-5.,5.);
699 new TH1F("h75","DX in st. ID-70",100,-5.,5.);
700 new TH1F("h85","DY in st. ID-80",100,-5.,5.);
703 //_____________________________________________________________________________
704 void chfnt(Int_t &ievr, Int_t &ntrackr, Int_t *istatr, Int_t *isignr, Float_t *pxr, Float_t *pyr, Float_t *pzr, Float_t *zvr, Float_t *chi2r, Float_t *pxv, Float_t *pyv, Float_t *pzv)
708 NtupleSt.ievr = ievr;
709 NtupleSt.ntrackr = ntrackr;
710 for (Int_t i=0; i<500; i++) {
711 NtupleSt.istatr[i] = istatr[i];
712 NtupleSt.isignr[i] = isignr[i];
713 NtupleSt.pxr[i] = pxr[i];
714 NtupleSt.pyr[i] = pyr[i];
715 NtupleSt.pzr[i] = pzr[i];
716 NtupleSt.zvr[i] = zvr[i];
717 NtupleSt.chi2r[i] = chi2r[i];
718 NtupleSt.pxv[i] = pxv[i];
719 NtupleSt.pyv[i] = pyv[i];
720 NtupleSt.pzv[i] = pzv[i];
722 gAliNtupleGlobal->Fill();
729 // write histos and ntuple to "reconst.root" file
730 gAliFileGlobal->Write();
733 //________________________________________________________________________
734 void trackf_read_fit(Int_t &ievr, Int_t &nev, Int_t &nhittot1, Int_t *izch, Double_t *xgeant, Double_t *ygeant)
737 // introduce aliroot variables in fortran common
738 // tracking study from geant hits
741 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
742 TTree *treeH = gAlice->TreeH();
743 Int_t ntracks = (Int_t)treeH->GetEntries();
744 cout<<"ntrack="<<ntracks<<endl;
749 for (Int_t track=0; track<ntracks;track++) {
751 treeH->GetEvent(track);
756 for(AliMUONHit* mHit=(AliMUONHit*)pMUON->FirstHit(-1);
758 mHit=(AliMUONHit*)pMUON->NextHit())
760 if (mHit->Chamber() > 10) continue;
761 Int_t ftrack = mHit->Track();
762 Int_t id = gAlice->Particle(ftrack)->GetPdgCode();
764 if (id==kMuonPlus||id==kMuonMinus) {
765 xgeant[nhittot1] = mHit->Y();
766 ygeant[nhittot1] = mHit->X();
767 izch[nhittot1] = mHit->Chamber();
768 // printf("id %d ch %d x %f y %f\n",id,izch[nhittot1],xgeant[nhittot1],ygeant[nhittot1]);
776 gAliFileGlobal->cd();
779 //______________________________________________________________________________
780 void trackf_read_geant(Int_t *itypg, Double_t *xtrg, Double_t *ytrg, Double_t *ptotg, Int_t *idg, Int_t *izch, Double_t *pvert1g, Double_t *pvert2g, Double_t *pvert3g, Double_t *zvertg, Int_t &nhittot1, Double_t *cx, Double_t *cy, Double_t *cz, Int_t &ievr,Int_t &nev,Double_t *xgeant, Double_t *ygeant, Double_t *clsize1, Double_t *clsize2)
783 // introduce aliroot variables in fortran common
784 // tracking study from geant hits
787 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
789 // TTree *treeK = gAlice->TreeK();
790 TTree *treeH = gAlice->TreeH();
791 Int_t ntracks = (Int_t)treeH->GetEntries();
792 cout<<"ntrack="<<ntracks<<endl;
801 for (Int_t track=0; track<ntracks;track++) {
803 treeH->GetEvent(track);
809 for(AliMUONHit* mHit=(AliMUONHit*)pMUON->FirstHit(-1);
811 mHit=(AliMUONHit*)pMUON->NextHit())
815 if (mHit->Chamber() > 10) continue;
817 Int_t ftrack = mHit->Track();
818 Int_t id = gAlice->Particle(ftrack)->GetPdgCode();
820 // if (id==kMuonPlus||id==kMuonMinus) {
822 // inversion de x et y car le champ est inverse dans le programme tracking
825 xgeant[maxidg] = mHit->Y(); // x-pos of hit
826 ygeant[maxidg] = mHit->X(); // y-pos of hit
827 clsize1[maxidg] = 0; // cluster size on 1-st cathode
828 clsize2[maxidg] = 0; // cluster size on 2-nd cathode
829 cx[maxidg] = mHit->Cy(); // Px/P of hit
830 cy[maxidg] = mHit->Cx(); // Py/P of hit
831 cz[maxidg] = mHit->Cz(); // Pz/P of hit
832 izch[maxidg] = mHit->Chamber();
834 Int_t pdgtype = Int_t(mHit->fParticle); // particle number
835 itypg[maxidg] = gMC->IdFromPDG(pdgtype);
838 if (id==kMuonPlus) itypg[maxidg] = 5;
839 if (id==kMuonMinus) itypg[maxidg] = 6;
841 //printf("ich, itypg[maxidg] %d %d\n",izch[maxidg],itypg[maxidg]);
843 ptotg[maxidg] = mHit->Momentum(); // P of hit
845 particle = gAlice->Particle(ftrack);
846 Float_t thet = particle->Theta();
847 thet = thet*180./3.1416;
849 //cout<<"chambre "<<izch[maxidg]<<" ptot="<<ptotg[maxidg]<<" theta="<<thet<<" phi="<<mHit->fPhi<<" z="<<zz<<endl;
851 Int_t iparent = particle->GetFirstMother();
855 ip=gAlice->Particle(iparent)->GetFirstMother();
863 //printf("iparent - %d\n",iparent);
864 Int_t id1 = ftrack; // numero de la particule generee au vertex
865 Int_t idum = track+1;
866 Int_t id2 = gAlice->Particle(iparent)->GetPdgCode();
868 if (id2==443) id2=114;
874 //printf("id2 %d\n",id2);
875 idg[maxidg] = 30000*id1+10000*idum+id2;
877 pvert1g[maxidg] = particle->Py(); // Px vertex
878 pvert2g[maxidg] = particle->Px(); // Py vertex
879 pvert3g[maxidg] = particle->Pz(); // Pz vertex
880 zvertg[maxidg] = particle->Vz(); // z vertex
882 // cout<<"x="<<xgeant[maxidg]<<endl;
883 //cout<<"y="<<ygeant[maxidg]<<endl;
884 //cout<<"typ="<<itypg[maxidg]<<endl;
892 } // track loop first file
894 if (gAliTrH1 && gAliHits2 ) { // if background file
895 ntracks =(Int_t)gAliTrH1->GetEntries();
896 printf("Trackf_read - 2-nd file - ntracks %d\n",ntracks);
899 for (Int_t track=0; track<ntracks; track++) {
901 if (gAliHits2) gAliHits2->Clear();
902 gAliTrH1->GetEvent(track);
906 for (int i=0;i<gAliHits2->GetEntriesFast();i++)
908 mHit=(AliMUONHit*) (*gAliHits2)[i];
909 if (mHit->Chamber() > 10) continue;
912 // inversion de x et y car le champ est inverse dans le programme tracking !!!!
913 xtrg[maxidg] = 0; // only for reconstructed point
914 ytrg[maxidg] = 0; // only for reconstructed point
915 xgeant[maxidg] = mHit->Y(); // x-pos of hit
916 ygeant[maxidg] = mHit->X(); // y-pos of hit
917 clsize1[maxidg] = 0; // cluster size on 1-st cathode
918 clsize2[maxidg] = 0; // cluster size on 2-nd cathode
919 cx[maxidg] = mHit->Cy(); // Px/P of hit
920 cy[maxidg] = mHit->Cx(); // Py/P of hit
921 cz[maxidg] = mHit->Cz(); // Pz/P of hit
922 izch[maxidg] = mHit->Chamber(); // chamber number
923 ptotg[maxidg] = mHit->Momentum(); // P of hit
925 Int_t ftrack = mHit->Track();
926 Int_t id1 = ftrack; // track number
927 Int_t idum = track+1;
929 TClonesArray *fPartArray = gAliParticles2;
930 // TParticle *Part=NULL;
931 Int_t id = ((TParticle*) fPartArray->UncheckedAt(ftrack))->GetPdgCode();
932 if (id==kMuonPlus||id==kMuonMinus) {
933 if (id==kMuonPlus) itypg[maxidg] = 5;
934 else itypg[maxidg] = 6;
935 } else itypg[maxidg]=0;
937 Int_t id2=0; // set parent to 0 for background !!
938 idg[maxidg] = 30000*id1+10000*idum+id2;
941 pvert1g[maxidg] = 0; // Px vertex
942 pvert2g[maxidg] = 0; // Py vertex
943 pvert3g[maxidg] = 0; // Pz vertex
944 zvertg[maxidg] = 0; // z vertex
947 } // check limits (maxidg)
954 cout<<"nhittot1="<<nhittot1<<endl;
956 static Int_t nbres=0;
957 if (nres>=19) nbres++;
958 printf("nres, nbres %d %d \n",nres,nbres);
960 gAliFileGlobal->cd();
964 //________________________________________________________________________
965 void trackf_read_spoint(Int_t *itypg, Double_t *xtrg, Double_t *ytrg, Double_t *ptotg, Int_t *idg, Int_t *izch, Double_t *pvert1g, Double_t *pvert2g, Double_t *pvert3g, Double_t *zvertg, Int_t &nhittot1, Double_t *cx, Double_t *cy, Double_t *cz, Int_t &ievr,Int_t &nev,Double_t *xgeant, Double_t *ygeant,Double_t *clsize1, Double_t *clsize2)
969 // introduce aliroot variables in fortran common
970 // tracking study from reconstructed points
972 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
974 cout<<"numero de l'evenement "<<nev<<endl;
976 TTree *treeR = gAlice->TreeR();
977 Int_t nent=(Int_t)treeR->GetEntries();
979 printf("Found %d entries in the tree (must be one per cathode per event! + 1empty)\n",
987 for (Int_t ich=0;ich<10;ich++) {
988 printf("chambre %d\n",ich+1);
989 TClonesArray *reconstPoints = pMUON->RawClustAddress(ich);
991 pMUON->ResetRawClusters();
992 treeR->GetEvent(nent-1);
993 Int_t npoints = (Int_t) reconstPoints->GetEntries();
994 if (!npoints) continue;
995 printf("\n ch %d npoints = %d\n",ich+1,npoints);
996 // Loop over reconstruted points
997 for (Int_t ipoi=0; ipoi<npoints; ipoi++) {
998 printf(" point %d\n",ipoi);
999 AliMUONRawCluster* point =
1000 (AliMUONRawCluster*) reconstPoints->UncheckedAt(ipoi);
1002 mult1=point->fMultiplicity[0];
1003 mult2=point->fMultiplicity[1];
1004 xtrg[mpoi]=(Double_t) point->fY[0];
1005 ytrg[mpoi]=(Double_t) point->fX[0];
1007 Int_t itrack = point->fTracks[1];
1008 Int_t ihit = point->fTracks[0];
1011 clsize1[mpoi] = mult1;
1012 clsize2[mpoi] = mult2;
1013 Int_t id1, id2, idum;
1017 if (ihit >=0 && itrack >=0) {
1018 gAlice->ResetHits();
1019 gAlice->TreeH()->GetEvent(itrack);
1020 TClonesArray *pMUONhits = pMUON->Hits();
1022 mHit=(AliMUONHit*) (pMUONhits->UncheckedAt(ihit));
1023 Int_t id = (Int_t) mHit->Particle();
1024 xgeant[mpoi] = mHit->Y();
1025 ygeant[mpoi] = mHit->X();
1026 if (id == kMuonPlus) itypg[mpoi]=5;
1027 if (id == kMuonMinus) itypg[mpoi]=6;
1028 TParticle *particle;
1029 particle = gAlice->Particle(mHit->Track());
1030 TParticle* particleM=gAlice->Particle(particle->GetFirstMother());
1031 Int_t iparent=particleM->GetPdgCode();
1032 printf("\n Particle Id:%d %d \n", id, iparent);
1033 if (iparent == 443) id2=114;
1034 if (iparent == 553) id2=116;
1038 idg[mpoi] = 30000*id1+10000*idum+id2;
1040 } // loop over points
1041 } // loop over chamber
1043 cout<<"evenement "<<ievr<<endl;
1045 cout<<"nhittot1="<<nhittot1<<endl;
1049 gAliFileGlobal->cd();
1054 //____________________________________________________________________________
1055 void trackf_fit(Int_t &ivertex, Double_t *pest, Double_t *pstep, Double_t &pxzinv, Double_t &tphi, Double_t &talam, Double_t &xvert, Double_t &yvert)
1058 // Fit a track candidate with the following input parameters:
1059 // INPUT : IVERTEX : vertex flag, if IVERTEX=1 (XVERT,YVERT) are free paramaters
1060 // if IVERTEX=1 (XVERT,YVERT)=(0.,0.)
1061 // PEST(5) : starting value of parameters (minuit)
1062 // PSTEP(5) : step size for parameters (minuit)
1063 // OUTPUT : PXZINV,TPHI,TALAM,XVERT,YVERT : fitted value of the parameters
1065 static Double_t arglist[10];
1066 static Double_t c[5] = {0.4, 0.45, 0.45, 90., 90.};
1067 static Double_t b1, b2, epxz, efi, exs, exvert, eyvert;
1071 TMinuit *gMinuit = new TMinuit(5);
1072 gMinuit->mninit(5,10,7);
1073 gMinuit->SetFCN(fcnf); // constant m.f.
1077 gMinuit->mnexcm("SET PRINT", arglist, 1, ierflg);
1078 // gMinuit->mnseti('track fitting');
1080 gMinuit->mnparm(0, "invmom", pest[0], pstep[0], -c[0], c[0], ierflg);
1081 gMinuit->mnparm(1, "azimuth", pest[1], pstep[1], -c[1], c[1], ierflg);
1082 gMinuit->mnparm(2, "deep", pest[2], pstep[2], -c[2], c[2], ierflg);
1084 gMinuit->mnparm(3, "x ", pest[3], pstep[3], -c[3], c[3], ierflg);
1085 gMinuit->mnparm(4, "y ", pest[4], pstep[4], -c[4], c[4], ierflg);
1088 gMinuit->mnexcm("SET NOGR", arglist, 0, ierflg);
1089 gMinuit->mnexcm("MINIMIZE", arglist, 0, ierflg);
1090 gMinuit->mnexcm("EXIT" , arglist, 0, ierflg);
1092 gMinuit->mnpout(0, chname, pxzinv, epxz, b1, b2, ierflg);
1093 gMinuit->mnpout(1, chname, tphi, efi, b1, b2, ierflg);
1094 gMinuit->mnpout(2, chname, talam, exs, b1, b2, ierflg);
1096 gMinuit->mnpout(3, chname, xvert, exvert, b1, b2, ierflg);
1097 gMinuit->mnpout(4, chname, yvert, eyvert, b1, b2, ierflg);
1103 //________________________________________________________________________________
1104 void fcnf(Int_t &npar, Double_t *grad, Double_t &fval, Double_t *pest, Int_t iflag)
1107 // function called by trackf_fit
1109 fcn(npar,grad,fval,pest,iflag,futil);
1112 //____________________________________________________________________________
1113 void prec_fit(Double_t &pxzinv, Double_t &fis, Double_t &alams, Double_t &xvert, Double_t &yvert, Double_t &pxzinvf, Double_t &fif, Double_t &alf, Double_t &xvertf, Double_t &yvertf, Double_t &epxzinv, Double_t &efi, Double_t &exs, Double_t &exvert, Double_t &eyvert)
1116 // minuit fits for tracking finding
1118 static Double_t arglist[10];
1119 static Double_t c1[5] = {0.001, 0.001, 0.001, 1., 1.};
1120 static Double_t c2[5] = {0.5, 0.5, 0.5, 120., 120.};
1121 static Double_t emat[9];
1122 static Double_t b1, b2;
1123 Double_t fmin, fedm, errdef;
1124 Int_t npari, nparx, istat;
1129 TMinuit *gMinuit = new TMinuit(5);
1130 gMinuit->mninit(5,10,7);
1131 gMinuit->SetFCN(fcnfitf);
1134 gMinuit->mnexcm("SET PRINT", arglist, 1, ierflg);
1136 // gMinuit->mnseti('track fitting');
1138 gMinuit->mnparm(0,"invmom", pxzinv, c1[0], -c2[0], c2[0], ierflg); // 0.003, 0.5
1139 gMinuit->mnparm(1,"azimuth ", fis, c1[1], -c2[1], c2[1], ierflg);
1140 gMinuit->mnparm(2,"deep ", alams, c1[2], -c2[2], c2[2], ierflg);
1141 gMinuit->mnparm(3,"xvert", xvert, c1[3], -c2[3], c2[3], ierflg);
1142 gMinuit->mnparm(4,"yvert", yvert, c1[4], -c2[4], c2[4], ierflg);
1144 gMinuit->mnexcm("SET NOGR", arglist, 0, ierflg);
1146 gMinuit->mnexcm("MINIMIZE", arglist, 0, ierflg);
1147 gMinuit->mnexcm("EXIT", arglist, 0, ierflg);
1149 gMinuit->mnpout(0, chname, pxzinvf, epxzinv, b1, b2, ierflg);
1150 gMinuit->mnpout(1, chname, fif, efi, b1, b2, ierflg);
1151 gMinuit->mnpout(2, chname, alf, exs, b1, b2, ierflg);
1152 gMinuit->mnpout(3, chname, xvertf, exvert, b1, b2, ierflg);
1153 gMinuit->mnpout(4, chname, yvertf, eyvert, b1, b2, ierflg);
1155 gMinuit->mnemat(emat, 3);
1156 gMinuit->mnstat(fmin, fedm, errdef, npari, nparx, istat);
1161 //____________________________________________________________________
1162 void fcnfitf(Int_t &npar, Double_t *grad, Double_t &fval, Double_t *xval, Int_t iflag)
1165 // function called by prec_fit
1167 fcnfit(npar,grad,fval,xval,iflag,futil);