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
38 // Default constructor
\r
39 // Get calibration data
\r
41 fCalibData = GetCalibData();
\r
42 fAcordeRecoParam = GetRecoParam();
\r
45 //_______________________________________________________________________
\r
46 AliACORDECalibData *AliACORDEReconstructor::GetCalibData() const
\r
50 //____________________________________________________________________________
\r
51 AliACORDERecoParam *AliACORDEReconstructor::GetRecoParam() const
\r
55 //_____________________________________________________________________________
\r
56 AliACORDEReconstructor& AliACORDEReconstructor::operator =
\r
57 (const AliACORDEReconstructor& /*reconstructor*/)
\r
59 // assignment operator
\r
61 Fatal("operator =", "assignment operator not implemented");
\r
65 //_____________________________________________________________________________
\r
66 AliACORDEReconstructor::~AliACORDEReconstructor()
\r
72 //_____________________________________________________________________________
\r
73 void AliACORDEReconstructor::Init()
\r
76 fESDACORDE = new AliESDACORDE;
\r
79 void AliACORDEReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
\r
83 AliError("No digits tree!");
\r
87 TClonesArray* digitsArray = new TClonesArray("AliACORDEdigit");
\r
88 digitsTree->Branch("ACORDEdigit", &digitsArray);
\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
101 digitsTree->Fill();
\r
105 void AliACORDEReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliESDEvent* esd) const
\r
108 // fills ESD with ACORDE Digits
\r
112 AliError("No digits tree!");
\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
122 digitBranch->SetAddress(&digitsArray);
\r
124 digitsTree->GetEvent(0);
\r
126 Bool_t AcoHitSingle[60],AcoHitMulti[60];
\r
127 for(Int_t i = 0; i < 60; i++) { AcoHitSingle[i] = AcoHitMulti[i] = kFALSE; }
\r
129 Int_t nDigits = digitsArray->GetEntriesFast();
\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
135 AcoHitSingle[module-1] = kTRUE;
\r
136 AcoHitMulti[module-1] = kTRUE;
\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
145 AliDebug(1, Form("Writing ACORDE data to ESD Tree"));
\r
146 esd->SetACORDEData(fESDACORDE);
\r