]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONrawclusters.C
check if STAGE_POOL and STAGE_HOST are set, if not warn user.
[u/mrichter/AliRoot.git] / MUON / MUONrawclusters.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 /* $Id$ */
17
18 #if !defined(__CINT__) || defined(__MAKECINT__)
19 #include "iostream.h"
20
21 #include <TClassTable.h>
22 #include <TClonesArray.h>
23 #include <TFile.h>
24 #include <TParticle.h>
25 #include <TROOT.h>
26 #include <TTree.h>
27
28 #include "AliHeader.h"
29 #include "AliRun.h"
30
31 #include "AliMUON.h"
32
33 #include "AliMUONClusterFinderVS.h"
34 #endif
35
36 void MUONrawclusters (char* filename="galice.root", Int_t evNumber1=0,Int_t evNumber2=9999) 
37 {
38   //////////////////////////////////////
39   //                                  //
40   // ROOT macro for ALICE Dimuon Arm: //
41   // Clusterization of digits         //
42   //                                  //
43   //////////////////////////////////////
44   //
45   // Adds the tree TR for raw clusters
46   // to the ROOT file "galice.root"
47   // containing the digits (tree TD).
48   //
49   // Arguments:
50   //   evNumber1 = first event number to act on in file "galice.root"
51   //   evNumber2 = last event number to act on in file "galice.root"
52   //
53   // Input/output file:
54   //   "galice.root"
55   //
56   //__________________________________________________________________________
57
58 //  // Dynamically link some shared libs
59
60   //if (gClassTable->GetID("AliRun") < 0) {
61   //    gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
62   //    loadlibs();
63   //    }
64
65  // Creating Run Loader and openning file containing Hits
66   AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","UPDATE");
67   if (RunLoader ==0x0) {
68     printf(">>> Error : Error Opening %s file \n",filename);
69     return;
70   }
71
72   // Loading AliRun master
73   RunLoader->UnloadgAlice();
74   RunLoader->LoadgAlice();
75   gAlice = RunLoader->GetAliRun();
76
77   // Loading MUON subsystem
78   AliMUON * MUON = (AliMUON *) gAlice->GetDetector("MUON");
79   AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
80   AliMUONData * muondata = MUON->GetMUONData();
81
82   Int_t ievent, nevents;
83   nevents = RunLoader->GetNumberOfEvents();
84
85   for (Int_t i=0; i<10; i++) {
86     //RecModel = new AliMUONClusterFinderVS();
87     AliMUONClusterFinderVS *RecModel = new AliMUONClusterFinderVS();
88     //  RecModel->SetTracks(16,17);    
89     //  RecModel->SetTracks(266,267);    
90     RecModel->SetGhostChi2Cut(10);
91     MUON->SetReconstructionModel(i,RecModel);
92   } 
93
94   MUONLoader->LoadDigits("READ");
95   MUONLoader->LoadRecPoints("UPDATE");
96
97   // Testing if RawClusterisation has already been done
98   RunLoader->GetEvent(0);
99   if (MUONLoader->TreeR()) {
100     if (muondata->IsRawClusterBranchesInTree()) {
101       MUONLoader->UnloadRecPoints();
102       MUONLoader->LoadRecPoints("RECREATE");
103       printf("Recreating RecPoints files\n");
104     }
105   }
106 //
107 //   Loop over events              
108   //
109     Int_t Nh=0;
110     Int_t Nh1=0;
111     //    gAlice->RunReco("MUON", evNumber1, evNumber2);
112     if (evNumber2>nevents) evNumber2=nevents;
113     for(Int_t ievent=evNumber1; ievent<evNumber2; ievent++) {
114       printf("event %d\n",ievent);
115       RunLoader->GetEvent(ievent);
116
117       // Test if rawcluster has already been done before
118       if (MUONLoader->TreeR() == 0x0) 
119         MUONLoader->MakeRecPointsContainer();
120       else {
121         if (muondata->IsRawClusterBranchesInTree()){ // Test if rawcluster has already been done before
122           if (ievent==evNumber1) MUONLoader->UnloadRecPoints();
123           MUONLoader->MakeRecPointsContainer();  // Redoing clusterisation
124           Info("RecPointsContainer","Recreating RecPointsContainer and deleting previous ones");
125         }
126       }
127       muondata->MakeBranch("RC");
128       muondata->SetTreeAddress("D,RC");
129       MUON->Digits2Reco(); 
130     }
131     MUONLoader->UnloadDigits();
132     MUONLoader->UnloadRecPoints();
133 }
134
135