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),
39 // Default constructor
40 // Get calibration data
42 fCalibData = GetCalibData();
43 fAcordeRecoParam = GetRecoParam();
46 //_______________________________________________________________________
47 AliACORDECalibData *AliACORDEReconstructor::GetCalibData() const
51 //____________________________________________________________________________
52 AliACORDERecoParam *AliACORDEReconstructor::GetRecoParam() const
56 //_____________________________________________________________________________
57 AliACORDEReconstructor& AliACORDEReconstructor::operator =
58 (const AliACORDEReconstructor& /*reconstructor*/)
60 // assignment operator
62 Fatal("operator =", "assignment operator not implemented");
66 //_____________________________________________________________________________
67 AliACORDEReconstructor::~AliACORDEReconstructor()
74 //_____________________________________________________________________________
75 void AliACORDEReconstructor::Init()
78 fESDACORDE = new AliESDACORDE;
81 void AliACORDEReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
85 AliError("No digits tree!");
90 fDigitsArray = new TClonesArray("AliACORDEdigit", 60);
92 digitsTree->Branch("ACORDEdigit", &fDigitsArray);
95 AliACORDERawStream rawStream(rawReader);
96 if (rawStream.Next()) {
97 for(Int_t iChannel = 0; iChannel < 60; iChannel++) {
98 Int_t index = iChannel / 30;
99 Int_t bit = iChannel % 30;
100 if (rawStream.GetWord(index) & (1 << bit))
101 new ((*fDigitsArray)[fDigitsArray->GetEntriesFast()]) AliACORDEdigit(iChannel,0);
107 fDigitsArray->Clear();
110 void AliACORDEReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const
113 // fills ESD with ACORDE Digits
117 AliError("No digits tree!");
121 TBranch* digitBranch = digitsTree->GetBranch("ACORDEdigit");
123 AliError("No ACORDE digits branch found!");
126 digitBranch->SetAddress(&fDigitsArray);
128 digitsTree->GetEvent(0);
130 Bool_t AcoHitSingle[60],AcoHitMulti[60];
131 for(Int_t i = 0; i < 60; i++) { AcoHitSingle[i] = AcoHitMulti[i] = kFALSE; }
133 Int_t nDigits = fDigitsArray->GetEntriesFast();
135 for (Int_t d=0; d<nDigits; d++) {
136 AliACORDEdigit* digit = (AliACORDEdigit*) fDigitsArray->At(d);
137 Int_t module = digit->GetModule();
139 AcoHitSingle[module] = kTRUE;
140 AcoHitMulti[module] = kTRUE;
143 AliError("NO ACORDE ESD branch found!");
146 TString ActiveTriggerDetector = esd->GetFiredTriggerClasses();
147 if (ActiveTriggerDetector.Contains("ASL")) fESDACORDE->SetACORDEBitPattern(AcoHitSingle);
148 else if (ActiveTriggerDetector.Contains("AMU")) fESDACORDE->SetACORDEBitPattern(AcoHitMulti);
149 else fESDACORDE->SetACORDEBitPattern(AcoHitSingle);
153 AliDebug(1, Form("Writing ACORDE data to ESD Tree"));
154 esd->SetACORDEData(fESDACORDE);
157 fDigitsArray->Clear();