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