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