Warnings fixed
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEReconstructor.cxx
CommitLineData
dc7f1e9e 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16/* $Id: AliACORDEReconstructor.cxx 20956 2007-09-26 14:22:18Z mrodrigu $ */\r
17//////////////////////////////////////////////////////////////////////////////\r
18// //\r
19// Class for ACORDE reconstruction //\r
20//////////////////////////////////////////////////////////////////////////////\r
21\r
22#include "AliRawReader.h"\r
23\r
24#include "AliACORDEReconstructor.h"\r
25#include "AliACORDERawStream.h"\r
26#include "AliESDEvent.h"\r
27#include "AliACORDEdigit.h"\r
28#include "AliACORDERecoParam.h"\r
29\r
30ClassImp(AliACORDEReconstructor)\r
31\r
32AliACORDEReconstructor:: AliACORDEReconstructor():\r
33 AliReconstructor(),\r
34 fESDACORDE(0x0),\r
35 fAcordeRecoParam(0x0),\r
dbf24214 36 fCalibData(0x0),\r
37 fDigitsArray(0)\r
dc7f1e9e 38{\r
39 // Default constructor \r
40 // Get calibration data\r
41\r
42 fCalibData = GetCalibData();\r
43 fAcordeRecoParam = GetRecoParam();\r
44}\r
45\r
46//_______________________________________________________________________\r
47AliACORDECalibData *AliACORDEReconstructor::GetCalibData() const\r
48{\r
49 return 0x0;\r
50}\r
51//____________________________________________________________________________\r
52AliACORDERecoParam *AliACORDEReconstructor::GetRecoParam() const\r
53{\r
54 return 0x0;\r
55}\r
56//_____________________________________________________________________________\r
57AliACORDEReconstructor& AliACORDEReconstructor::operator = \r
58 (const AliACORDEReconstructor& /*reconstructor*/)\r
59{\r
60// assignment operator\r
61\r
62 Fatal("operator =", "assignment operator not implemented");\r
63 return *this;\r
64}\r
65\r
66//_____________________________________________________________________________\r
67AliACORDEReconstructor::~AliACORDEReconstructor()\r
68{\r
69// destructor\r
dbf24214 70 delete fESDACORDE;\r
71 delete fDigitsArray;\r
dc7f1e9e 72}\r
73\r
74//_____________________________________________________________________________\r
75void AliACORDEReconstructor::Init()\r
76{\r
77// initializer\r
78 fESDACORDE = new AliESDACORDE;\r
79}\r
80\r
81void AliACORDEReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const\r
82{\r
83\r
84 if (!digitsTree) {\r
85 AliError("No digits tree!");\r
86 return;\r
87 }\r
88\r
dbf24214 89 if (!fDigitsArray)\r
90 fDigitsArray = new TClonesArray("AliACORDEdigit", 60);\r
91\r
92 digitsTree->Branch("ACORDEdigit", &fDigitsArray);\r
dc7f1e9e 93\r
94 rawReader->Reset();\r
95 AliACORDERawStream rawStream(rawReader);\r
96 if (rawStream.Next()) {\r
97 for(Int_t iChannel = 0; iChannel < 60; iChannel++) {\r
98 Int_t index = iChannel / 30;\r
99 Int_t bit = iChannel % 30;\r
100 if (rawStream.GetWord(index) & (1 << bit))\r
a7d9d4ae 101 new ((*fDigitsArray)[fDigitsArray->GetEntriesFast()]) AliACORDEdigit(iChannel,0);\r
dc7f1e9e 102 }\r
103 }\r
104\r
105 digitsTree->Fill();\r
dbf24214 106\r
107 fDigitsArray->Clear();\r
dc7f1e9e 108}\r
109\r
110void AliACORDEReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const\r
111{\r
112\r
113 // fills ESD with ACORDE Digits\r
114\r
115 if (!digitsTree)\r
116 {\r
117 AliError("No digits tree!");\r
118 return;\r
119 }\r
120\r
dc7f1e9e 121 TBranch* digitBranch = digitsTree->GetBranch("ACORDEdigit");\r
122 if (!digitBranch) {\r
123 AliError("No ACORDE digits branch found!");\r
124 return;\r
125 }\r
dbf24214 126 digitBranch->SetAddress(&fDigitsArray);\r
dc7f1e9e 127\r
128 digitsTree->GetEvent(0);\r
129\r
130 Bool_t AcoHitSingle[60],AcoHitMulti[60];\r
131 for(Int_t i = 0; i < 60; i++) { AcoHitSingle[i] = AcoHitMulti[i] = kFALSE; }\r
132\r
dbf24214 133 Int_t nDigits = fDigitsArray->GetEntriesFast();\r
dc7f1e9e 134 \r
135 for (Int_t d=0; d<nDigits; d++) { \r
dbf24214 136 AliACORDEdigit* digit = (AliACORDEdigit*) fDigitsArray->At(d);\r
dc7f1e9e 137 Int_t module = digit->GetModule();\r
138\r
a7d9d4ae 139 AcoHitSingle[module] = kTRUE;\r
140 AcoHitMulti[module] = kTRUE;\r
dc7f1e9e 141 } \r
4c0f7539 142 if (!esd) {\r
143 AliError("NO ACORDE ESD branch found!");\r
144 return;\r
145}\r
dc7f1e9e 146 TString ActiveTriggerDetector = esd->GetFiredTriggerClasses();\r
147 if (ActiveTriggerDetector.Contains("ASL")) fESDACORDE->SetACORDEBitPattern(AcoHitSingle);\r
148 else if (ActiveTriggerDetector.Contains("AMU")) fESDACORDE->SetACORDEBitPattern(AcoHitMulti);\r
149 else fESDACORDE->SetACORDEBitPattern(AcoHitSingle);\r
150\r
151 if (esd)\r
152 {\r
153 AliDebug(1, Form("Writing ACORDE data to ESD Tree"));\r
154 esd->SetACORDEData(fESDACORDE);\r
dbf24214 155 }\r
156\r
157 fDigitsArray->Clear();\r
dc7f1e9e 158}\r
159\r
160\r