]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONTriggerTracker.C
New definition of name ofobject in TMap tables. Fixing conding convention violations
[u/mrichter/AliRoot.git] / MUON / MUONTriggerTracker.C
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
25 #include "AliRun.h"
26 #include "AliMUON.h"
27 #include "AliMUONData.h"
28 #include "AliMUONEventReconstructor.h"
29 #endif
30
31 void MUONTriggerTracker (Text_t *FileName = "galice.root", Int_t FirstEvent = 0, Int_t LastEvent = 9999)
32 {
33   //
34   cout << "MUONTriggerTracker" << 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
40   AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"MUONLoader","UPDATE");
41   if (RunLoader ==0x0) {
42     printf(">>> Error : Error Opening %s file \n",FileName);
43     return;
44   }
45   
46   // Loading AliRun master
47   if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
48   gAlice = RunLoader->GetAliRun();
49   // RunLoader->LoadKinematics("READ");
50   
51   // Loading MUON subsystem
52   AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
53  
54   Int_t nevents;
55   nevents = RunLoader->GetNumberOfEvents();
56
57   MUONLoader->LoadRecPoints("READ");
58   MUONLoader->LoadTracks("UPDATE"); 
59
60
61   AliMUONEventReconstructor *Reco = new AliMUONEventReconstructor(MUONLoader);
62   AliMUONData* muondata = Reco->GetMUONData();
63
64   // Testing if Trigger Tracking has already been done
65   RunLoader->GetEvent(0);
66   if (MUONLoader->TreeT()) {
67       if (muondata->IsTriggerTrackBranchesInTree()) {
68       MUONLoader->UnloadTracks();
69       MUONLoader->LoadTracks("RECREATE");
70       printf("Recreating Tracks files\n");
71     }
72   }
73
74   Reco->SetPrintLevel(0);    
75   if  (LastEvent>nevents) LastEvent=nevents;
76
77   // Loop over events
78   for (Int_t event = FirstEvent; event < LastEvent; event++) {
79       cout << "Event: " << event << endl;
80       RunLoader->GetEvent(event);
81       if (MUONLoader->TreeT() == 0x0) MUONLoader->MakeTracksContainer();      
82       
83       muondata->MakeBranch("RL");
84       muondata->SetTreeAddress("RL");
85       Reco->EventReconstructTrigger();
86  
87       muondata->Fill("RL");
88       MUONLoader->WriteTracks("OVERWRITE");  
89       muondata->ResetRecTriggerTracks();
90       muondata->ResetTrigger();
91   } // Event loop
92
93   MUONLoader->UnloadRecPoints();
94   MUONLoader->UnloadTracks();
95 }