]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONrawclusters.C
Fixed bug in parent assignment and implemented Birk's law in the Step Manager
[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 //#include "AliMUONClusterFinderAZ.h"
35 #include "AliMUONClusterReconstructor.h"
36 #endif
37
38 void MUONrawclusters (char* filename="galice.root", Int_t evNumber1=0,Int_t evNumber2=9999) 
39 {
40  // Creating Run Loader and openning file containing Hits
41   AliRunLoader* RunLoader = AliRunLoader::Open(filename,"MUONLoader","UPDATE");
42   if (RunLoader ==0x0) {
43     printf(">>> Error : Error Opening %s file \n",filename);
44     return;
45   }
46   if (RunLoader->GetAliRun() == 0x0) RunLoader->LoadgAlice();
47   
48   // Loading MUON subsystem
49   AliLoader* MUONLoader = RunLoader->GetLoader("MUONLoader");
50   
51   MUONLoader->LoadDigits("READ");
52   MUONLoader->LoadRecPoints("UPDATE");
53
54   Int_t ievent, nevents;
55   nevents = RunLoader->GetNumberOfEvents();
56
57   AliMUONClusterReconstructor* Reco = new AliMUONClusterReconstructor(MUONLoader);
58   AliMUONData* muondata = Reco->GetMUONData();
59
60   for (Int_t i=0; i<10; i++) {
61     AliMUONClusterFinderVS* RecModel = new AliMUONClusterFinderVS();
62     //  RecModel->SetTracks(16,17);    
63     //  RecModel->SetTracks(266,267);    
64     RecModel->SetGhostChi2Cut(10);
65     Reco->SetReconstructionModel(i,RecModel);
66   } 
67
68   // Testing if RawClusterisation has already been done
69   RunLoader->GetEvent(0);
70   if (MUONLoader->TreeR()) {
71     if (muondata->IsRawClusterBranchesInTree()) {
72       MUONLoader->UnloadRecPoints();
73       MUONLoader->LoadRecPoints("RECREATE");
74       printf("Recreating RecPoints files\n");
75     }
76   }
77
78 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
79     if (evNumber2 > nevents) evNumber2 = nevents;
80
81     for(ievent = evNumber1; ievent < evNumber2; ievent++) {
82       printf("event %d\n",ievent);
83       RunLoader->GetEvent(ievent);
84
85       // Test if rawcluster has already been done before
86       if (MUONLoader->TreeR() == 0x0) 
87         MUONLoader->MakeRecPointsContainer();
88       else {
89         if (muondata->IsRawClusterBranchesInTree()){ 
90           // Test if rawcluster has already been done before
91           if (ievent == evNumber1) MUONLoader->UnloadRecPoints();
92           MUONLoader->MakeRecPointsContainer();  // Redoing clusterisation
93           Info("RecPointsContainer",
94                "Recreating RecPointsContainer and deleting previous ones");
95         }
96       }
97       muondata->MakeBranch("RC");
98       muondata->SetTreeAddress("D,RC");
99
100       Reco->Digits2Clusters();
101   
102       muondata->Fill("RC"); //Filling Reconstructed Cluster
103       MUONLoader->WriteRecPoints("OVERWRITE");
104       muondata->ResetRawClusters();  
105       muondata->ResetDigits();     
106     }
107     MUONLoader->UnloadDigits();
108     MUONLoader->UnloadRecPoints();
109 }
110
111