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);
50 // Loading AliRun master
51 RunLoader->LoadgAlice();
52 gAlice = RunLoader->GetAliRun();
53 RunLoader->LoadKinematics("READ");
55 // Loading MUON subsystem
56 AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON");
57 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
58 // MUONLoader->LoadHits("READ");
59 MUONLoader->LoadRecPoints("READ");
60 MUONLoader->LoadTracks("UPDATE");
61 AliMUONData * muondata = MUON->GetMUONData();
62 muondata->SetLoader(MUONLoader);
65 nevents = RunLoader->GetNumberOfEvents();
67 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
69 // The right place for changing AliMUONEventReconstructor parameters
70 // with respect to the default ones
71 // Reco->SetMaxSigma2Distance(100.0);
72 // Reco->SetPrintLevel(20);
73 Reco->SetPrintLevel(0);
74 // Reco->SetBendingResolution(0.0);
75 // Reco->SetNonBendingResolution(0.0);
76 cout << "AliMUONEventReconstructor: actual parameters" << endl;
78 // gObjectTable->Print();
80 MUONLoader->LoadRecPoints("READ");
82 if (LastEvent>nevents) LastEvent=nevents;
84 for (Int_t event = FirstEvent; event < LastEvent; event++) {
85 //MUONLoader->LoadHits("READ");
86 cout << "Event: " << event << endl;
87 RunLoader->GetEvent(event);
88 // Test if trigger track has already been done before
89 if (MUONLoader->TreeT() == 0x0) {
90 MUONLoader->MakeTracksContainer();
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");
99 muondata->MakeBranch("RT");
100 muondata->SetTreeAddress("D,RT");
101 Reco->EventReconstruct();
102 // Dump current event
103 // Reco->EventDump();
105 // Duplicating rectrack data in muondata for output
106 for(Int_t i=0; i<Reco->GetNRecTracks(); i++) {
107 AliMUONTrack * track = (AliMUONTrack*) Reco->GetRecTracksPtr()->At(i);
108 muondata->AddRecTrack(*track);
109 //printf(">>> TEST TEST event %d Number of hits in the track %d is %d \n",event,i,track->GetNTrackHits());
112 muondata->Fill("RT");
113 MUONLoader->WriteTracks("OVERWRITE");
114 muondata->ResetRecTracks();
115 muondata->ResetRawClusters();
117 MUONLoader->UnloadRecPoints();
118 MUONLoader->UnloadTracks();