Removing output of hit pointers in AliMUONTrack class. New switch in ALiMUONv1 for...
[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");
374ebd7d 56 // MUONLoader->LoadHits("READ");
a501728c 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++) {
8547965d 80 //MUONLoader->LoadHits("READ");
81 MUONLoader->LoadRecPoints("READ");
a501728c 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();
89 // Dump current event
90 Reco->EventDump();
91
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);
374ebd7d 96 //printf(">>> TEST TEST event %d Number of hits in the track %d is %d \n",event,i,track->GetNTrackHits());
a501728c 97 }
374ebd7d 98
1a1cdff8 99 muondata->Fill("RT");
374ebd7d 100 MUONLoader->WriteTracks("OVERWRITE");
a501728c 101 muondata->ResetRecTracks();
8547965d 102 //MUONLoader->UnloadHits();
103 MUONLoader->UnloadRecPoints();
a501728c 104 } // Event loop
a501728c 105}