]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONTracker.C
Sign error for bz corrected.
[u/mrichter/AliRoot.git] / MUON / MUONTracker.C
CommitLineData
e50989e9 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
a501728c 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.
e50989e9 22// Gines MARTINEZ, Subatech, sep 2003
23
d8d3b5b8 24#if !defined(__CINT__) || defined(__MAKECINT__)
a501728c 25#include "AliRun.h"
26#include "AliMUON.h"
27#include "AliMUONData.h"
28#include "AliMUONEventReconstructor.h"
d8d3b5b8 29#endif
a501728c 30
ba9436c6 31void MUONTracker (Text_t *FileName = "galice.root", Int_t FirstEvent = 0, Int_t LastEvent = 9999)
a501728c 32{
33 //
34 cout << "MUONTracker" << endl;
35 cout << "FirstEvent " << FirstEvent << endl;
36 cout << "LastEvent " << LastEvent << endl;
37 cout << "FileName ``" << FileName << "''" << endl;
38
39 // Creating Run Loader and openning file containing Hits, Digits and RecPoints
52c9bc11 40 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"MUONLoader","UPDATE");
a501728c 41 if (RunLoader ==0x0) {
42 printf(">>> Error : Error Opening %s file \n",FileName);
43 return;
44 }
45 // Loading AliRun master
52c9bc11 46 if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
a501728c 47 gAlice = RunLoader->GetAliRun();
52c9bc11 48 // RunLoader->LoadKinematics("READ");
a501728c 49
50 // Loading MUON subsystem
a501728c 51 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
c6cd5030 52
53 MUONLoader->LoadRecPoints("READ");
54 MUONLoader->LoadTracks("UPDATE");
52c9bc11 55
56 Int_t nevents;
57 nevents = RunLoader->GetNumberOfEvents();
58
59 AliMUONEventReconstructor* Reco = new AliMUONEventReconstructor(MUONLoader);
60 AliMUONData* muondata = Reco->GetMUONData();
c6cd5030 61
52c9bc11 62 // Testing if Tracker has already been done
c6cd5030 63 RunLoader->GetEvent(0);
64 if (MUONLoader->TreeT()) {
65 if (muondata->IsTrackBranchesInTree()) {
66 MUONLoader->UnloadTracks();
67 MUONLoader->LoadTracks("RECREATE");
52c9bc11 68 printf("Recreating RecPoints files\n");
c6cd5030 69 }
70 }
a501728c 71
72 // The right place for changing AliMUONEventReconstructor parameters
73 // with respect to the default ones
74 // Reco->SetMaxSigma2Distance(100.0);
75 // Reco->SetPrintLevel(20);
276c44b7 76 Reco->SetPrintLevel(0);
a501728c 77 // Reco->SetBendingResolution(0.0);
78 // Reco->SetNonBendingResolution(0.0);
52c9bc11 79 // cout << "AliMUONEventReconstructor: actual parameters" << endl;
a501728c 80
ba9436c6 81 if (LastEvent>nevents) LastEvent=nevents;
52c9bc11 82
a501728c 83 // Loop over events
84 for (Int_t event = FirstEvent; event < LastEvent; event++) {
52c9bc11 85 //MUONLoader->LoadHits("READ");
276c44b7 86 cout << "Event: " << event << endl;
87 RunLoader->GetEvent(event);
52c9bc11 88 // Test if trigger track has already been done before
89 if (MUONLoader->TreeT() == 0x0) {
90 MUONLoader->MakeTracksContainer();
91 } else {
92 if (muondata->IsTrackBranchesInTree()){ // Test if track has already been done before
93 if (event==FirstEvent) MUONLoader->UnloadTracks();
94 MUONLoader->MakeTracksContainer(); // Redoing Tracking
95 Info("TrackContainer","Recreating TrackContainer and deleting previous ones");
96 }
97 }
98
276c44b7 99 muondata->MakeBranch("RT");
ac1fde5a 100 muondata->SetTreeAddress("RT");
276c44b7 101 Reco->EventReconstruct();
52c9bc11 102
103 muondata->Fill("RT");
104 MUONLoader->WriteTracks("OVERWRITE");
105 muondata->ResetRecTracks();
106 muondata->ResetRawClusters();
a501728c 107 } // Event loop
52c9bc11 108
c6cd5030 109 MUONLoader->UnloadRecPoints();
110 MUONLoader->UnloadTracks();
a501728c 111}