1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliACORDEReconstructor.cxx 20956 2007-09-26 14:22:18Z mrodrigu $ */
17 //////////////////////////////////////////////////////////////////////////////
19 // Class for ACORDE reconstruction //
20 //////////////////////////////////////////////////////////////////////////////
22 #include "AliRawReader.h"
24 #include "AliACORDEReconstructor.h"
25 #include "AliACORDERawStream.h"
26 #include "AliESDEvent.h"
27 #include "AliACORDEdigit.h"
28 #include "AliACORDERecoParam.h"
30 ClassImp(AliACORDEReconstructor)
32 AliACORDEReconstructor:: AliACORDEReconstructor():
35 fAcordeRecoParam(0x0),
38 // Default constructor
39 // Get calibration data
41 fCalibData = GetCalibData();
42 fAcordeRecoParam = GetRecoParam();
45 //_______________________________________________________________________
46 AliACORDECalibData *AliACORDEReconstructor::GetCalibData() const
50 //____________________________________________________________________________
51 AliACORDERecoParam *AliACORDEReconstructor::GetRecoParam() const
55 //_____________________________________________________________________________
56 AliACORDEReconstructor& AliACORDEReconstructor::operator =
57 (const AliACORDEReconstructor& /*reconstructor*/)
59 // assignment operator
61 Fatal("operator =", "assignment operator not implemented");
65 //_____________________________________________________________________________
66 AliACORDEReconstructor::~AliACORDEReconstructor()
72 //_____________________________________________________________________________
73 void AliACORDEReconstructor::Init()
76 fESDACORDE = new AliESDACORDE;
79 void AliACORDEReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
83 AliError("No digits tree!");
87 TClonesArray* digitsArray = new TClonesArray("AliACORDEdigit");
88 digitsTree->Branch("ACORDEdigit", &digitsArray);
91 AliACORDERawStream rawStream(rawReader);
92 if (rawStream.Next()) {
93 for(Int_t iChannel = 0; iChannel < 60; iChannel++) {
94 Int_t index = iChannel / 30;
95 Int_t bit = iChannel % 30;
96 if (rawStream.GetWord(index) & (1 << bit))
97 new ((*digitsArray)[digitsArray->GetEntriesFast()]) AliACORDEdigit(iChannel+1,0);
105 void AliACORDEReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const
108 // fills ESD with ACORDE Digits
112 AliError("No digits tree!");
116 TClonesArray* digitsArray = NULL;
117 TBranch* digitBranch = digitsTree->GetBranch("ACORDEdigit");
119 AliError("No ACORDE digits branch found!");
122 digitBranch->SetAddress(&digitsArray);
124 digitsTree->GetEvent(0);
126 Bool_t AcoADCSingle[60],AcoADCMulti[60];
127 for(Int_t i = 0; i < 60; i++) { AcoADCSingle[i] = AcoADCMulti[i] = kFALSE; }
129 Int_t nDigits = digitsArray->GetEntriesFast();
131 for (Int_t d=0; d<nDigits; d++) {
132 AliACORDEdigit* digit = (AliACORDEdigit*)digitsArray->At(d);
133 Int_t module = digit->GetModule();
135 AcoADCSingle[module-1] = kTRUE;
136 AcoADCMulti[module-1] = kTRUE;
139 fESDACORDE->SetACORDESingleMuon(AcoADCSingle);
140 fESDACORDE->SetACORDEMultiMuon(AcoADCMulti);
144 AliDebug(1, Form("Writing ACORDE data to ESD Tree"));
145 esd->SetACORDEData(fESDACORDE);