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