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 #if !defined(__CINT__) || defined(__MAKECINT__)
25 #include <TClonesArray.h>
29 #include "AliMUONData.h"
30 #include "AliMUONEventReconstructor.h"
31 #include "AliMUONTrack.h"
32 #include "AliMUONTrackHit.h"
33 #include "AliMUONTrackParam.h"
36 void MUONTracker (Text_t *FileName = "galice.root", Int_t FirstEvent = 0, Int_t LastEvent = 9999)
39 cout << "MUONTracker" << endl;
40 cout << "FirstEvent " << FirstEvent << endl;
41 cout << "LastEvent " << LastEvent << endl;
42 cout << "FileName ``" << FileName << "''" << endl;
44 // Creating Run Loader and openning file containing Hits, Digits and RecPoints
45 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"Event","UPDATE");
46 if (RunLoader ==0x0) {
47 printf(">>> Error : Error Opening %s file \n",FileName);
51 // Loading AliRun master
52 RunLoader->LoadgAlice();
53 gAlice = RunLoader->GetAliRun();
54 RunLoader->LoadKinematics("READ");
56 // Loading MUON subsystem
57 AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON");
58 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
59 AliMUONData * muondata = MUON->GetMUONData();
62 nevents = RunLoader->GetNumberOfEvents();
64 MUONLoader->LoadRecPoints("READ");
65 MUONLoader->LoadTracks("UPDATE");
68 // Testing if Tracking has already been done
69 RunLoader->GetEvent(0);
70 if (MUONLoader->TreeT()) {
71 if (muondata->IsTrackBranchesInTree()) {
72 MUONLoader->UnloadTracks();
73 MUONLoader->LoadTracks("RECREATE");
74 printf("Recreating Tracks files\n");
78 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
80 // The right place for changing AliMUONEventReconstructor parameters
81 // with respect to the default ones
82 // Reco->SetMaxSigma2Distance(100.0);
83 // Reco->SetPrintLevel(20);
84 Reco->SetPrintLevel(0);
85 // Reco->SetBendingResolution(0.0);
86 // Reco->SetNonBendingResolution(0.0);
87 cout << "AliMUONEventReconstructor: actual parameters" << endl;
89 // gObjectTable->Print();
91 if (LastEvent>nevents) LastEvent=nevents;
93 for (Int_t event = FirstEvent; event < LastEvent; event++) {
94 cout << "Event: " << event << endl;
95 RunLoader->GetEvent(event);
96 if (MUONLoader->TreeT() == 0x0) MUONLoader->MakeTracksContainer();
98 muondata->MakeBranch("RT");
99 muondata->SetTreeAddress("RT");
100 Reco->EventReconstruct();
101 // Dump current event
102 // Reco->EventDump();
104 // Duplicating rectrack data in muondata for output
105 for(Int_t i=0; i<Reco->GetNRecTracks(); i++) {
106 AliMUONTrack * track = (AliMUONTrack*) Reco->GetRecTracksPtr()->At(i);
107 muondata->AddRecTrack(*track);
108 //printf(">>> TEST TEST event %d Number of hits in the track %d is %d \n",event,i,track->GetNTrackHits());
111 muondata->Fill("RT");
112 MUONLoader->WriteTracks("OVERWRITE");
113 muondata->ResetRecTracks();
114 muondata->ResetRawClusters();
116 MUONLoader->UnloadRecPoints();
117 MUONLoader->UnloadTracks();