first running version
[u/mrichter/AliRoot.git] / AD / AliADReconstructor.cxx
CommitLineData
5e319bd5 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: AliADReconstructor.cxx 20956 2007-09-26 14:22:18Z mrodrigu $ */
17//////////////////////////////////////////////////////////////////////////////
18// //
19// Class for AD reconstruction //
20//////////////////////////////////////////////////////////////////////////////
21
22#include "AliRawReader.h"
23
24#include "AliADReconstructor.h"
25#include "AliESDEvent.h"
26#include "AliADdigit.h"
27
28ClassImp(AliADReconstructor)
29
30AliADReconstructor:: AliADReconstructor():
31 AliReconstructor(),
32 fESDAD(0x0),
33 fDigitsArray(0)
34{
35 // Default constructor
36 // Get calibration data
37
38}
39
40//_____________________________________________________________________________
41AliADReconstructor& AliADReconstructor::operator =
42 (const AliADReconstructor& /*reconstructor*/)
43{
44// assignment operator
45
46 Fatal("operator =", "assignment operator not implemented");
47 return *this;
48}
49
50//_____________________________________________________________________________
51AliADReconstructor::~AliADReconstructor()
52{
53// destructor
54 delete fESDAD;
55 delete fDigitsArray;
56}
57
58//_____________________________________________________________________________
59void AliADReconstructor::Init()
60{
61// initializer
62 fESDAD = new AliESDAD;
63}
64
65void AliADReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
66{
67
68 printf("Converting digits for AD .. not implemented \n");
69}
70
71void AliADReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const
72{
73
74 printf("Running AD Reconstruction \n");
75
76 // fills ESD with AD Digits
77
78 if (!digitsTree)
79 {
80 AliError("No digits tree!");
81 return;
82 }
83
84 TBranch* digitBranch = digitsTree->GetBranch("ADdigit");
85 if (!digitBranch) {
86 AliError("No AD digits branch found!");
87 return;
88 }
89 digitBranch->SetAddress(&fDigitsArray);
90
91 digitsTree->GetEvent(0);
92
93 Bool_t ADHits[16];
94 for(Int_t i = 0; i < 16; i++) { ADHits[i] = kFALSE; }
95
96 Int_t nDigits = fDigitsArray->GetEntriesFast();
97
98 for (Int_t d=0; d<nDigits; d++) {
99 AliADdigit* digit = (AliADdigit*) fDigitsArray->At(d);
100 Int_t module = digit->GetCell();
101 // printf("AD Module: %d\n",module);
102 ADHits[module] = kTRUE;
103 }
104 if (!esd) {
105 AliError("NO AD ESD branch found!");
106 return;
107}
108 fESDAD->SetADBitCell(ADHits);
109
110 if (esd)
111 {
112 AliDebug(1, Form("Writing AD data to ESD Tree"));
113 esd->SetADData(fESDAD);
114 }
115
116 fDigitsArray->Clear();
117}
118
119