Tracker for newIO. TClonesArray of AliMUONTrack in TreeT in MUON.Tracks.root
[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
a501728c 24#include <TClonesArray.h>
25
26#include "AliRun.h"
27#include "AliMUON.h"
28#include "AliMUONData.h"
29#include "AliMUONEventReconstructor.h"
30#include "AliMUONTrack.h"
31#include "AliMUONTrackHit.h"
32#include "AliMUONTrackParam.h"
33
ba9436c6 34void MUONTracker (Text_t *FileName = "galice.root", Int_t FirstEvent = 0, Int_t LastEvent = 9999)
a501728c 35{
36 //
37 cout << "MUONTracker" << endl;
38 cout << "FirstEvent " << FirstEvent << endl;
39 cout << "LastEvent " << LastEvent << endl;
40 cout << "FileName ``" << FileName << "''" << endl;
41
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);
46 return;
47 }
48 // Loading AliRun master
49 RunLoader->LoadgAlice();
50 gAlice = RunLoader->GetAliRun();
51 RunLoader->LoadKinematics("READ");
52
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);
60
61 Int_t ievent, nevents;
62 nevents = RunLoader->GetNumberOfEvents();
63
64 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
65
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;
74 Reco->Dump();
75 // gObjectTable->Print();
76
ba9436c6 77 if (LastEvent>nevents) LastEvent=nevents;
a501728c 78 // Loop over events
79 for (Int_t event = FirstEvent; event < LastEvent; event++) {
80 cout << "Event: " << event << endl;
81 RunLoader->GetEvent(event);
82 muondata->SetTreeAddress("RC");
83 if (MUONLoader->TreeT() == 0x0) MUONLoader->MakeTree("T");
84 muondata->MakeBranch("RT");
85 muondata->SetTreeAddress("RT");
86 Reco->EventReconstruct();
87 // Dump current event
88 Reco->EventDump();
89
90 // Duplicating rectrack data in muondata for output
91 for(Int_t i=0; i<Reco->GetNRecTracks(); i++) {
92 AliMUONTrack * track = (AliMUONTrack*) Reco->GetRecTracksPtr()->At(i);
93 muondata->AddRecTrack(*track);
94 }
95
1a1cdff8 96 muondata->Fill("RT");
a501728c 97 MUONLoader->WriteTracks("OVERWRITE");
98 muondata->ResetRecTracks();
99 } // Event loop
e50989e9 100 MUONLoader->UnloadHits();
a501728c 101 MUONLoader->UnloadRecPoints();
102}