]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/AliACORDERawData.cxx
script that allows to 1) merge the QA data available in AliEn and belonging to a...
[u/mrichter/AliRoot.git] / ACORDE / AliACORDERawData.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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 ///////////////////////////////////////////////////////////////////////////////
16 //                                                                           //
17 //  From ACORDE digits to Raw data
18 //
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
22 //         bits 31-32 = '00'
23 // Word 10: bits 1 to 30 --> Modules 31 to 60
24 //          bits 31-32 = '01'
25 // Word 11: bits 1 to 30 --> Modules 1 to 30
26 //          bits 31-32 = '10'
27 // Word 12: bits 1 to 30 --> Modules 1 to 30
28 //          bits 31-32 = '11'
29 // Words 9 and 10 are the single muon trigger
30 // Words 11 and 12 are the multi muon trigger
31 //                                                                           //
32 ///////////////////////////////////////////////////////////////////////////////
33
34 #include "AliACORDERawData.h"
35 #include "AliDAQ.h"
36 #include "AliFstream.h"
37 #include "AliRawDataHeaderSim.h"
38
39
40 ClassImp(AliACORDERawData)
41
42
43 AliACORDERawData::AliACORDERawData()
44   :TObject(),
45    fWord9(0),
46    fWord10(0),
47    fWord11(0),
48    fWord12(0)
49 {
50 }
51
52 AliACORDERawData::AliACORDERawData(const AliACORDERawData &r)
53   :TObject(),
54    fWord9(0),
55    fWord10(0),
56    fWord11(0),
57    fWord12(0)
58 {
59   ((AliACORDERawData &) r).Copy(*this);
60 }
61
62 AliACORDERawData::~AliACORDERawData()
63
64 {
65
66 }
67
68 AliACORDERawData &AliACORDERawData::operator=(const AliACORDERawData &r)
69
70 {
71   if (this != &r)  ((AliACORDERawData &) r).Copy(*this);
72   return *this;
73 }
74
75 void AliACORDERawData::WriteACORDERawData(Bool_t *b,Bool_t multi)
76
77 {
78   // set words
79   SetACORDERawWords(b,multi);
80
81   // open output file
82   const char *fileName = AliDAQ::DdlFileName("ACORDE",0);
83   AliFstream* fFile = new AliFstream(fileName);
84
85   // write header
86   AliRawDataHeaderSim header;
87   UInt_t header_position = fFile->Tellp();
88   fFile->WriteBuffer((char*)(&header), sizeof(header));
89
90   // write digits
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));
95   
96   // write header again
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);
103 }
104
105 void AliACORDERawData::SetACORDERawWords(Bool_t *b,Bool_t multi)
106
107 {
108   // set modules
109   for (Int_t i=0;i<30;i++) {
110     if (b[i]) {
111       fWord9|=(1<<i);
112       if (multi) fWord11|=(1<<i);
113     }
114     if (b[i+30]) {
115       fWord10|=(1<<i);
116       if (multi) fWord12|=(1<<i);
117     }
118   } // end for
119   // set labels
120   fWord10|=(1<<30);
121   fWord12|=(1<<30);
122   fWord11|=(1<<31);
123   fWord12|=(1<<31);
124 }