]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/AliACORDEReconstructor.cxx
More elaborated AliEVE macro for online reco visualisation. 2D and 3D TPC sectors...
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEReconstructor.cxx
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: AliACORDEReconstructor.cxx 20956 2007-09-26 14:22:18Z mrodrigu $ */
17 //////////////////////////////////////////////////////////////////////////////
18 //                                                                          //
19 //  Class for ACORDE reconstruction                                         //
20 //////////////////////////////////////////////////////////////////////////////
21
22 #include "AliRawReader.h"
23
24 #include "AliACORDEReconstructor.h"
25 #include "AliACORDERawStream.h"
26 #include "AliESDEvent.h"
27 #include "AliACORDEdigit.h"
28
29 ClassImp(AliACORDEReconstructor)
30
31 AliACORDEReconstructor:: AliACORDEReconstructor():
32   AliReconstructor(),
33   fESDACORDE(0x0),
34   fCalibData(0x0)
35 {
36   // Default constructor  
37   // Get calibration data
38
39   fCalibData = GetCalibData(); 
40 }
41
42 //FALTA IMPLEMENTAR_______________________________________________________________________
43 AliACORDECalibData *AliACORDEReconstructor::GetCalibData() const
44 {
45   // TO BE IMPLEMENTED !!
46   return 0x0;
47 }
48 //_____________________________________________________________________________
49 AliACORDEReconstructor& AliACORDEReconstructor::operator = 
50   (const AliACORDEReconstructor& /*reconstructor*/)
51 {
52 // assignment operator
53
54   Fatal("operator =", "assignment operator not implemented");
55   return *this;
56 }
57
58 //_____________________________________________________________________________
59 AliACORDEReconstructor::~AliACORDEReconstructor()
60 {
61 // destructor
62 //NECESITAS esta clase
63   delete fESDACORDE; 
64 }
65
66 //_____________________________________________________________________________
67 void AliACORDEReconstructor::Init()
68 {
69 // initializer
70 //NECESITAS esta clase
71     fESDACORDE  = new AliESDACORDE;
72 }
73
74 void AliACORDEReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
75 {
76
77   if (!digitsTree) {
78     AliError("No digits tree!");
79     return;
80   }
81
82   TClonesArray* digitsArray = new TClonesArray("AliACORDEdigit");
83   digitsTree->Branch("ACORDEdigit", &digitsArray);
84
85   rawReader->Reset();
86   AliACORDERawStream rawStream(rawReader);
87   if (rawStream.Next()) {
88     for(Int_t iChannel = 0; iChannel < 60; iChannel++) {
89       Int_t  index = iChannel / 30;
90       Int_t  bit   = iChannel % 30;
91       if (rawStream.GetWord(index) & (1 << bit))
92         new ((*digitsArray)[digitsArray->GetEntriesFast()]) AliACORDEdigit(iChannel+1,0);
93     }
94   }
95
96   digitsTree->Fill();
97                         
98 }
99
100 void AliACORDEReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const
101 {
102
103   // fills ESD with ACORDE Digits
104
105   if (!digitsTree)
106     {
107       AliError("No digits tree!");
108       return;
109     }
110
111   TClonesArray* digitsArray = NULL;
112   TBranch* digitBranch = digitsTree->GetBranch("ACORDEdigit");
113   if (!digitBranch) {
114     AliError("No ACORDE digits branch found!");
115     return;
116   }
117   digitBranch->SetAddress(&digitsArray);
118
119   digitsTree->GetEvent(0);
120
121   Bool_t AcoADCSingle[60],AcoADCMulti[60];
122   for(Int_t i = 0; i < 60; i++) { AcoADCSingle[i] = AcoADCMulti[i] = kFALSE; }
123
124   Int_t nDigits = digitsArray->GetEntriesFast();
125     
126   for (Int_t d=0; d<nDigits; d++) {    
127     AliACORDEdigit* digit = (AliACORDEdigit*)digitsArray->At(d);
128     Int_t module = digit->GetModule();
129
130     AcoADCSingle[module-1] = kTRUE;
131     AcoADCMulti[module-1] = kTRUE;
132   }
133         
134   fESDACORDE->SetACORDESingleMuon(AcoADCSingle);
135   fESDACORDE->SetACORDEMultiMuon(AcoADCMulti);
136
137   if (esd)
138     {
139       AliDebug(1, Form("Writing ACORDE data to ESD Tree"));
140       esd->SetACORDEData(fESDACORDE);
141     }   
142 }
143
144