1 /**************************************************************************
2 * Copyright(c) 1998-2003, 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 **************************************************************************/
15 ///////////////////////////////////////////////////////////////////////////////
17 // From ACORDE digits to Raw data
19 // there are 4 words of 32 bits corresponding to word 9 to 12
20 // (words up to 8 correspond to the header)
21 // Word 9: bits 1 to 30 --> Modules 1 to 30
23 // Word 10: bits 1 to 30 --> Modules 31 to 60
25 // Word 11: bits 1 to 30 --> Modules 1 to 30
27 // Word 12: bits 1 to 30 --> Modules 1 to 30
29 // Words 9 and 10 are the single muon trigger
30 // Words 11 and 12 are the multi muon trigger
32 ///////////////////////////////////////////////////////////////////////////////
34 #include "AliACORDERawData.h"
36 #include "AliFstream.h"
37 #include "AliRawDataHeaderSim.h"
40 ClassImp(AliACORDERawData)
43 AliACORDERawData::AliACORDERawData()
52 AliACORDERawData::AliACORDERawData(const AliACORDERawData &r)
59 ((AliACORDERawData &) r).Copy(*this);
62 AliACORDERawData::~AliACORDERawData()
68 AliACORDERawData &AliACORDERawData::operator=(const AliACORDERawData &r)
71 if (this != &r) ((AliACORDERawData &) r).Copy(*this);
75 void AliACORDERawData::WriteACORDERawData(Bool_t *b,Bool_t multi)
79 SetACORDERawWords(b,multi);
82 const char *fileName = AliDAQ::DdlFileName("ACORDE",0);
83 AliFstream* fFile = new AliFstream(fileName);
86 AliRawDataHeaderSim header;
87 UInt_t header_position = fFile->Tellp();
88 fFile->WriteBuffer((char*)(&header), sizeof(header));
91 fFile->WriteBuffer((char*)(&fWord9), sizeof(fWord9));
92 fFile->WriteBuffer((char*)(&fWord10), sizeof(fWord10));
93 fFile->WriteBuffer((char*)(&fWord11), sizeof(fWord11));
94 fFile->WriteBuffer((char*)(&fWord12), sizeof(fWord12));
97 UInt_t current_position = fFile->Tellp();
98 fFile->Seekp(header_position);
99 header.fSize = current_position-header_position;
100 header.SetAttribute(0); // valid data
101 fFile->WriteBuffer((char*)(&header), sizeof(header));
102 fFile->Seekp(current_position);
105 void AliACORDERawData::SetACORDERawWords(Bool_t *b,Bool_t multi)
109 for (Int_t i=0;i<30;i++) {
112 if (multi) fWord11|=(1<<i);
116 if (multi) fWord12|=(1<<i);
120 fWord10|=(unsigned int)(1<<30);
121 fWord12|=(unsigned int)(1<<30);
122 fWord11|=(unsigned int)(1<<31);
123 fWord12|=(unsigned int)(1<<31);