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 **************************************************************************/
19 * Class for reading the Trigger Data Stream from Raw.
20 * please read documentation for AliPHOSTriggerRawReader::ReadFromStream .
24 #include "AliPHOSTriggerRawReader.h"
26 #include "AliCaloRawStreamV3.h"
27 #include "AliPHOSTRURawReader.h"
29 ClassImp(AliPHOSTriggerRawReader)
32 //________________________________________________________________
33 AliPHOSTriggerRawReader::AliPHOSTriggerRawReader()
37 // default constructor.
40 for(Int_t mod=0; mod<kNMods; mod++)
41 for(Int_t row=0; row<kNTRURows; ++row)
42 for(Int_t branch=0; branch<kNBranches; ++branch)
43 fTRUs[mod][row][branch] = 0;
47 //________________________________________________________________
48 AliPHOSTriggerRawReader::~AliPHOSTriggerRawReader()
52 for(Int_t mod = 0; mod < kNMods; ++mod)
53 for(Int_t row = 0; row < kNTRURows; ++row)
54 for(Int_t branch = 0; branch < kNBranches; branch++)
55 delete fTRUs[mod][row][branch];
59 //________________________________________________________________
60 AliPHOSTRURawReader* AliPHOSTriggerRawReader::GetTRU(Int_t mod, Int_t truRow, Int_t branch)
62 // Get TRU Raw Reader.
64 if( ! fTRUs[mod][truRow][branch] )
65 fTRUs[mod][truRow][branch] = new AliPHOSTRURawReader();
66 return fTRUs[mod][truRow][branch];
70 //________________________________________________________________
71 void AliPHOSTriggerRawReader::ReadFromStream(AliCaloRawStreamV3* rawStream)
73 // Give a AliCaloRawStreamV3* to an instance of this class.
74 // It will read from the stream. The stream is passed to 'AliPHOSTRURawReader's
75 // which are accesible through 'AliPHOSTriggerRawReader::GetTRU'.
76 // note that @param rawStream will not be left in the same state in terms of
77 // bunch position, i.e. rawStream->NextBunch() will be called.
79 // It is up to the user to check that
80 // the is at a channel which is tru data, i.e.:
81 // while (rawStream->NextDDL()) {
82 // while (rawStream->NextChannel()) {
83 // if ( rawStream->IsTRUData() )
84 // triggerReader->ReadFromStream(rawStream);
86 // // do something else
89 // . Other uses will result in undefined behaviour!
91 while (rawStream->NextBunch()) {
92 Int_t module = rawStream->GetModule();
93 Int_t rcuRow = rawStream->GetRow();
94 Int_t branch = 1 - rawStream->GetBranch(); // !!! Found this to be necessary, -Henrik Qvigstad <henrik.qvigstad@cern.ch>
96 GetTRU(module, rcuRow, branch)->ReadFromStream(rawStream);
100 //________________________________________________________________
101 void AliPHOSTriggerRawReader::Reset()
105 for(Int_t mod = 0; mod < kNMods; ++mod)
106 for(Int_t truRow = 0; truRow < kNTRURows; ++truRow)
107 for(Int_t branch = 0; branch < kNBranches; branch++)
108 if( fTRUs[mod][truRow][branch] )
109 fTRUs[mod][truRow][branch]->Reset();