]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONTriggerTracker.C
Declaring flange as MANY.
[u/mrichter/AliRoot.git] / MUON / MUONTriggerTracker.C
CommitLineData
2295bc99 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/* */
17
18// Macro MUONTriggerTracker.C (TO BE COMPILED)
19// for testing the C++ trigger reconstruction code
20// Output is using aliroot standard output MUON.Tracks.root
21// The output is a TClonesArray of AliMUONTriggerTracks.
22
23#if !defined(__CINT__) || defined(__MAKECINT__)
24#include <TClonesArray.h>
25
26#include "AliRun.h"
27#include "AliMUON.h"
28#include "AliMUONData.h"
29#include "AliMUONEventReconstructor.h"
30#include "AliMUONTriggerTrack.h"
31#endif
32
33void MUONTriggerTracker (Text_t *FileName = "galice.root", Int_t FirstEvent = 0, Int_t LastEvent = 9999)
34{
35 //
36 cout << "MUONTriggerTracker" << endl;
37 cout << "FirstEvent " << FirstEvent << endl;
38 cout << "LastEvent " << LastEvent << endl;
39 cout << "FileName ``" << FileName << "''" << endl;
40
41 // Creating Run Loader and openning file containing Hits, Digits and RecPoints
42 AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"Event","UPDATE");
43 if (RunLoader ==0x0) {
44 printf(">>> Error : Error Opening %s file \n",FileName);
45 return;
46 }
47 // Loading AliRun master
48 RunLoader->LoadgAlice();
49 gAlice = RunLoader->GetAliRun();
50 RunLoader->LoadKinematics("READ");
51
52 // Loading MUON subsystem
53 AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON");
54 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
55 // MUONLoader->LoadHits("READ");
56 MUONLoader->LoadRecPoints("READ");
57 MUONLoader->LoadTracks("UPDATE");
58 AliMUONData * muondata = MUON->GetMUONData();
59 muondata->SetLoader(MUONLoader);
60
61 Int_t nevents;
62 nevents = RunLoader->GetNumberOfEvents();
63
64 AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor();
65
66 Reco->SetPrintLevel(0);
67 cout << "AliMUONEventReconstructor: actual parameters" << endl;
68// Reco->Dump();
69 // gObjectTable->Print();
70
71 MUONLoader->LoadRecPoints("READ");
72
73 if (LastEvent>nevents) LastEvent=nevents;
74 // Loop over events
75 for (Int_t event = FirstEvent; event < LastEvent; event++) {
76 //MUONLoader->LoadHits("READ");
77 cout << "Event: " << event << endl;
78 RunLoader->GetEvent(event);
79
80// Test if track has already been done before
81 if (MUONLoader->TreeT() == 0x0) {
82 MUONLoader->MakeTracksContainer();
83 } else {
84 if (muondata->IsTriggerTrackBranchesInTree()){ // Test if trigger track has already been done before
85 if (event==FirstEvent) MUONLoader->UnloadTracks();
86 MUONLoader->MakeTracksContainer(); // Redoing trigger tracks
87 Info("TrackContainer","Recreating TrackContainer and deleting previous ones");
88 }
89 }
90
91 muondata->MakeBranch("RL");
92 muondata->SetTreeAddress("RL");
93 Reco->EventReconstructTrigger();
94 // Dump current event
95 // Reco->EventDumpTrigger();
96
97 // Duplicating rectriggertrack data in muondata for output
98 for(Int_t i=0; i<Reco->GetNRecTriggerTracks(); i++) {
99 AliMUONTriggerTrack * triggertrack = (AliMUONTriggerTrack*) Reco->GetRecTriggerTracksPtr()->At(i);
100 muondata->AddRecTriggerTrack(*triggertrack);
101// printf(">>> TEST TEST event %d Number of hits in the track %d is %d \n",event,i,track->GetNTrackHits());
102 }
103
104 muondata->Fill("RL");
105 MUONLoader->WriteTracks("OVERWRITE");
106 muondata->ResetRecTriggerTracks();
107 muondata->ResetTrigger();
108 } // Event loop
109 MUONLoader->UnloadRecPoints();
110 MUONLoader->UnloadTracks();
111}