Speeding up the DA a bit
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEReconstructor.cxx
CommitLineData
bd95bae7 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"
fcdfb1ff 28#include "AliACORDERecoParam.h"
bd95bae7 29
30ClassImp(AliACORDEReconstructor)
31
32AliACORDEReconstructor:: AliACORDEReconstructor():
33 AliReconstructor(),
34 fESDACORDE(0x0),
fcdfb1ff 35 fAcordeRecoParam(0x0),
bd95bae7 36 fCalibData(0x0)
37{
38 // Default constructor
39 // Get calibration data
40
fcdfb1ff 41 fCalibData = GetCalibData();
42 fAcordeRecoParam = GetRecoParam();
bd95bae7 43}
44
fcdfb1ff 45//_______________________________________________________________________
bd95bae7 46AliACORDECalibData *AliACORDEReconstructor::GetCalibData() const
47{
fcdfb1ff 48 return 0x0;
49}
50//____________________________________________________________________________
51AliACORDERecoParam *AliACORDEReconstructor::GetRecoParam() const
52{
bd95bae7 53 return 0x0;
54}
55//_____________________________________________________________________________
56AliACORDEReconstructor& AliACORDEReconstructor::operator =
57 (const AliACORDEReconstructor& /*reconstructor*/)
58{
59// assignment operator
60
61 Fatal("operator =", "assignment operator not implemented");
62 return *this;
63}
64
65//_____________________________________________________________________________
66AliACORDEReconstructor::~AliACORDEReconstructor()
67{
68// destructor
bd95bae7 69 delete fESDACORDE;
70}
71
72//_____________________________________________________________________________
73void AliACORDEReconstructor::Init()
74{
75// initializer
bd95bae7 76 fESDACORDE = new AliESDACORDE;
77}
78
79void AliACORDEReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
80{
81
82 if (!digitsTree) {
83 AliError("No digits tree!");
84 return;
85 }
86
87 TClonesArray* digitsArray = new TClonesArray("AliACORDEdigit");
88 digitsTree->Branch("ACORDEdigit", &digitsArray);
89
90 rawReader->Reset();
91 AliACORDERawStream rawStream(rawReader);
92 if (rawStream.Next()) {
93 for(Int_t iChannel = 0; iChannel < 60; iChannel++) {
94 Int_t index = iChannel / 30;
95 Int_t bit = iChannel % 30;
96 if (rawStream.GetWord(index) & (1 << bit))
97 new ((*digitsArray)[digitsArray->GetEntriesFast()]) AliACORDEdigit(iChannel+1,0);
bd95bae7 98 }
99 }
100
101 digitsTree->Fill();
102
103}
104
105void AliACORDEReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const
106{
107
108 // fills ESD with ACORDE Digits
109
110 if (!digitsTree)
111 {
112 AliError("No digits tree!");
113 return;
114 }
115
116 TClonesArray* digitsArray = NULL;
117 TBranch* digitBranch = digitsTree->GetBranch("ACORDEdigit");
118 if (!digitBranch) {
119 AliError("No ACORDE digits branch found!");
120 return;
121 }
122 digitBranch->SetAddress(&digitsArray);
123
124 digitsTree->GetEvent(0);
125
126 Bool_t AcoADCSingle[60],AcoADCMulti[60];
127 for(Int_t i = 0; i < 60; i++) { AcoADCSingle[i] = AcoADCMulti[i] = kFALSE; }
128
129 Int_t nDigits = digitsArray->GetEntriesFast();
130
131 for (Int_t d=0; d<nDigits; d++) {
132 AliACORDEdigit* digit = (AliACORDEdigit*)digitsArray->At(d);
133 Int_t module = digit->GetModule();
134
135 AcoADCSingle[module-1] = kTRUE;
136 AcoADCMulti[module-1] = kTRUE;
137 }
138
139 fESDACORDE->SetACORDESingleMuon(AcoADCSingle);
140 fESDACORDE->SetACORDEMultiMuon(AcoADCMulti);
141
142 if (esd)
143 {
144 AliDebug(1, Form("Writing ACORDE data to ESD Tree"));
145 esd->SetACORDEData(fESDACORDE);
146 }
147}
148
149