1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\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
16 /* $Id: AliACORDEReconstructor.cxx 20956 2007-09-26 14:22:18Z mrodrigu $ */
\r
17 //////////////////////////////////////////////////////////////////////////////
\r
19 // Class for ACORDE reconstruction //
\r
20 //////////////////////////////////////////////////////////////////////////////
\r
22 #include "AliRawReader.h"
\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
30 ClassImp(AliACORDEReconstructor)
\r
32 AliACORDEReconstructor:: AliACORDEReconstructor():
\r
35 fAcordeRecoParam(0x0),
\r
39 // Default constructor
\r
40 // Get calibration data
\r
42 fCalibData = GetCalibData();
\r
43 fAcordeRecoParam = GetRecoParam();
\r
46 //_______________________________________________________________________
\r
47 AliACORDECalibData *AliACORDEReconstructor::GetCalibData() const
\r
51 //____________________________________________________________________________
\r
52 AliACORDERecoParam *AliACORDEReconstructor::GetRecoParam() const
\r
56 //_____________________________________________________________________________
\r
57 AliACORDEReconstructor& AliACORDEReconstructor::operator =
\r
58 (const AliACORDEReconstructor& /*reconstructor*/)
\r
60 // assignment operator
\r
62 Fatal("operator =", "assignment operator not implemented");
\r
66 //_____________________________________________________________________________
\r
67 AliACORDEReconstructor::~AliACORDEReconstructor()
\r
71 delete fDigitsArray;
\r
74 //_____________________________________________________________________________
\r
75 void AliACORDEReconstructor::Init()
\r
78 fESDACORDE = new AliESDACORDE;
\r
81 void AliACORDEReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
\r
85 AliError("No digits tree!");
\r
90 fDigitsArray = new TClonesArray("AliACORDEdigit", 60);
\r
92 digitsTree->Branch("ACORDEdigit", &fDigitsArray);
\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
101 new ((*fDigitsArray)[fDigitsArray->GetEntriesFast()]) AliACORDEdigit(iChannel,0);
\r
105 digitsTree->Fill();
\r
107 fDigitsArray->Clear();
\r
110 void AliACORDEReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const
\r
113 // fills ESD with ACORDE Digits
\r
117 AliError("No digits tree!");
\r
121 TBranch* digitBranch = digitsTree->GetBranch("ACORDEdigit");
\r
122 if (!digitBranch) {
\r
123 AliError("No ACORDE digits branch found!");
\r
126 digitBranch->SetAddress(&fDigitsArray);
\r
128 digitsTree->GetEvent(0);
\r
130 Bool_t AcoHitSingle[60],AcoHitMulti[60];
\r
131 for(Int_t i = 0; i < 60; i++) { AcoHitSingle[i] = AcoHitMulti[i] = kFALSE; }
\r
133 Int_t nDigits = fDigitsArray->GetEntriesFast();
\r
135 for (Int_t d=0; d<nDigits; d++) {
\r
136 AliACORDEdigit* digit = (AliACORDEdigit*) fDigitsArray->At(d);
\r
137 Int_t module = digit->GetModule();
\r
139 AcoHitSingle[module] = kTRUE;
\r
140 AcoHitMulti[module] = kTRUE;
\r
142 TString ActiveTriggerDetector = esd->GetFiredTriggerClasses();
\r
143 if (ActiveTriggerDetector.Contains("ASL")) fESDACORDE->SetACORDEBitPattern(AcoHitSingle);
\r
144 else if (ActiveTriggerDetector.Contains("AMU")) fESDACORDE->SetACORDEBitPattern(AcoHitMulti);
\r
145 else fESDACORDE->SetACORDEBitPattern(AcoHitSingle);
\r
149 AliDebug(1, Form("Writing ACORDE data to ESD Tree"));
\r
150 esd->SetACORDEData(fESDACORDE);
\r
153 fDigitsArray->Clear();
\r