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 **************************************************************************/
18 // Macro MUONTracker.C (TO BE COMPILED)
19 // for testing the C++ reconstruction code
20 // Output is using aliroot standard output MUON.Tracks.root
21 // The output is a TClonesArray of AliMUONTracks.
22 // Gines MARTINEZ, Subatech, sep 2003
24 #include <TClonesArray.h>
28 #include "AliMUONData.h"
29 #include "AliMUONEventReconstructor.h"
30 #include "AliMUONTrack.h"
31 #include "AliMUONTrackHit.h"
32 #include "AliMUONTrackParam.h"
34 void MUONTracker (Text_t *FileName = "galice.root", Int_t FirstEvent = 0, Int_t LastEvent = 9999)
37 cout << "MUONTracker" << endl;
38 cout << "FirstEvent " << FirstEvent << endl;
39 cout << "LastEvent " << LastEvent << endl;
40 cout << "FileName ``" << FileName << "''" << endl;
42 // Creating Run Loader and openning file containing Hits, Digits and RecPoints
43 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"Event","UPDATE");
44 if (RunLoader ==0x0) {
45 printf(">>> Error : Error Opening %s file \n",FileName);
48 // Loading AliRun master
49 RunLoader->LoadgAlice();
50 gAlice = RunLoader->GetAliRun();
51 RunLoader->LoadKinematics("READ");
53 // Loading MUON subsystem
54 AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON");
55 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
56 // MUONLoader->LoadHits("READ");
57 MUONLoader->LoadRecPoints("READ");
58 AliMUONData * muondata = MUON->GetMUONData();
59 muondata->SetLoader(MUONLoader);
61 Int_t ievent, nevents;
62 nevents = RunLoader->GetNumberOfEvents();
64 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
66 // The right place for changing AliMUONEventReconstructor parameters
67 // with respect to the default ones
68 // Reco->SetMaxSigma2Distance(100.0);
69 // Reco->SetPrintLevel(20);
70 Reco->SetPrintLevel(1);
71 // Reco->SetBendingResolution(0.0);
72 // Reco->SetNonBendingResolution(0.0);
73 cout << "AliMUONEventReconstructor: actual parameters" << endl;
75 // gObjectTable->Print();
77 if (LastEvent>nevents) LastEvent=nevents;
79 for (Int_t event = FirstEvent; event < LastEvent; event++) {
80 //MUONLoader->LoadHits("READ");
81 MUONLoader->LoadRecPoints("READ");
82 cout << "Event: " << event << endl;
83 RunLoader->GetEvent(event);
84 muondata->SetTreeAddress("RC");
85 if (MUONLoader->TreeT() == 0x0) MUONLoader->MakeTree("T");
86 muondata->MakeBranch("RT");
87 muondata->SetTreeAddress("RT");
88 Reco->EventReconstruct();
92 // Duplicating rectrack data in muondata for output
93 for(Int_t i=0; i<Reco->GetNRecTracks(); i++) {
94 AliMUONTrack * track = (AliMUONTrack*) Reco->GetRecTracksPtr()->At(i);
95 muondata->AddRecTrack(*track);
96 //printf(">>> TEST TEST event %d Number of hits in the track %d is %d \n",event,i,track->GetNTrackHits());
100 MUONLoader->WriteTracks("OVERWRITE");
101 muondata->ResetRecTracks();
102 //MUONLoader->UnloadHits();
103 MUONLoader->UnloadRecPoints();