LCOV - code coverage report
Current view: top level - ACORDE/ACORDEsim - AliACORDERawData.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 35 49 71.4 %
Date: 2016-06-14 17:26:59 Functions: 7 11 63.6 %

          Line data    Source code
       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          12 : ClassImp(AliACORDERawData)
      41             : 
      42             : 
      43             : AliACORDERawData::AliACORDERawData()
      44           4 :   :TObject(),
      45           4 :    fWord9(0),
      46           4 :    fWord10(0),
      47           4 :    fWord11(0),
      48           4 :    fWord12(0)
      49          20 : {
      50           8 : }
      51             : 
      52             : AliACORDERawData::AliACORDERawData(const AliACORDERawData &r)
      53           0 :   :TObject(),
      54           0 :    fWord9(0),
      55           0 :    fWord10(0),
      56           0 :    fWord11(0),
      57           0 :    fWord12(0)
      58           0 : {
      59           0 :   ((AliACORDERawData &) r).Copy(*this);
      60           0 : }
      61             : 
      62             : AliACORDERawData::~AliACORDERawData()
      63             : 
      64           8 : {
      65             : 
      66          12 : }
      67             : 
      68             : AliACORDERawData &AliACORDERawData::operator=(const AliACORDERawData &r)
      69             : 
      70             : {
      71           0 :   if (this != &r)  ((AliACORDERawData &) r).Copy(*this);
      72           0 :   return *this;
      73             : }
      74             : 
      75             : void AliACORDERawData::WriteACORDERawData(Bool_t *b,Bool_t multi)
      76             : 
      77             : {
      78             :   // set words
      79           4 :   SetACORDERawWords(b,multi);
      80             : 
      81             :   // open output file
      82           4 :   const char *fileName = AliDAQ::DdlFileName("ACORDE",0);
      83           4 :   AliFstream* fFile = new AliFstream(fileName);
      84             : 
      85             :   // write header
      86           4 :   AliRawDataHeaderSim header;
      87           4 :   UInt_t header_position = fFile->Tellp();
      88           4 :   fFile->WriteBuffer((char*)(&header), sizeof(header));
      89             : 
      90             :   // write digits
      91           4 :   fFile->WriteBuffer((char*)(&fWord9), sizeof(fWord9));
      92           4 :   fFile->WriteBuffer((char*)(&fWord10), sizeof(fWord10));
      93           4 :   fFile->WriteBuffer((char*)(&fWord11), sizeof(fWord11));
      94           4 :   fFile->WriteBuffer((char*)(&fWord12), sizeof(fWord12));
      95             :   
      96             :   // write header again
      97           4 :   UInt_t current_position = fFile->Tellp();
      98           4 :   fFile->Seekp(header_position);
      99           4 :   header.fSize = current_position-header_position;
     100           4 :   header.SetAttribute(0);  // valid data
     101           4 :   fFile->WriteBuffer((char*)(&header), sizeof(header));
     102           4 :   fFile->Seekp(current_position);
     103           4 : }
     104             : 
     105             : void AliACORDERawData::SetACORDERawWords(Bool_t *b,Bool_t multi)
     106             : 
     107             : {
     108             :   // set modules
     109         248 :   for (Int_t i=0;i<30;i++) {
     110         120 :     if (b[i]) {
     111           0 :       fWord9|=(1<<i);
     112           0 :       if (multi) fWord11|=(1<<i);
     113             :     }
     114         120 :     if (b[i+30]) {
     115           0 :       fWord10|=(1<<i);
     116           0 :       if (multi) fWord12|=(1<<i);
     117             :     }
     118             :   } // end for
     119             :   // set labels
     120           4 :   fWord10|=(unsigned int)(1<<30);
     121           4 :   fWord12|=(unsigned int)(1<<30);
     122           4 :   fWord11|=(unsigned int)(1<<31); 
     123           4 :   fWord12|=(unsigned int)(1<<31);
     124           4 : }

Generated by: LCOV version 1.11