--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// This is a class for reading the VZERO DDL raw data
+/// The format of the raw data corresponds to the one
+/// implemented in AliVZEROBuffer class.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliVZERORawStream.h"
+#include "AliRawReader.h"
+#include "AliLog.h"
+#include "AliDAQ.h"
+
+ClassImp(AliVZERORawStream)
+
+//_____________________________________________________________________________
+AliVZERORawStream::AliVZERORawStream(AliRawReader* rawReader) :
+ fCell(-1),
+ fADC(-1),
+ fTime(-1),
+ fPosition(-1),
+ fRawReader(rawReader),
+ fData(NULL)
+{
+ // create an object to read VZERO raw data
+ //
+ // select the raw data corresponding to
+ // the VZERO detector id
+ fRawReader->Reset();
+ AliDebug(1,Form("Selecting raw data for detector %d",AliDAQ::DetectorID("VZERO")));
+ fRawReader->Select("VZERO");
+}
+
+//_____________________________________________________________________________
+AliVZERORawStream::~AliVZERORawStream()
+{
+ // destructor
+}
+
+//_____________________________________________________________________________
+void AliVZERORawStream::Reset()
+{
+ // reset raw stream params
+
+ fCell = fADC = fTime = fPosition = -1;
+
+ if (fRawReader) fRawReader->Reset();
+}
+
+//_____________________________________________________________________________
+Bool_t AliVZERORawStream::Next()
+{
+ // read next digit from the VZERO raw data stream
+ // return kFALSE in case of error or no digits left
+
+ if (fPosition < 0) {
+ if (!fRawReader->ReadNextData(fData)) return kFALSE;
+ if (fRawReader->GetDataSize()%3 != 0) {
+ fRawReader->AddFatalErrorLog(kRawDataSizeErr,Form("size %d != n*12",fRawReader->GetDataSize()));
+ AliWarning(Form("Wrong VZERO raw data size: %d, expected n*12 bytes!",fRawReader->GetDataSize()));
+ return kFALSE;
+ }
+ fPosition = 0;
+ }
+
+ if (fPosition >= fRawReader->GetDataSize()) return kFALSE;
+
+ fCell = GetNextWord();
+ fADC = GetNextWord();
+ fTime = GetNextWord();
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Int_t AliVZERORawStream::GetNextWord()
+{
+ // This method returns the next 32 bit word
+ // inside the raw data payload.
+ // The method is supposed to be endian (platform)
+ // independent.
+ if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !");
+
+ Int_t word = 0;
+ word |= fData[fPosition++];
+ word |= fData[fPosition++] << 8;
+ word |= fData[fPosition++] << 16;
+ word |= fData[fPosition++] << 24;
+
+ return word;
+}
--- /dev/null
+#ifndef ALIVZERORAWSTREAM_H
+#define ALIVZERORAWSTREAM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// This is a class for reading the VZERO DDL raw data
+/// The format of the raw data corresponds to the one
+/// implemented in AliVZEROBuffer class.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliRawReader;
+
+class AliVZERORawStream: public TObject {
+ public :
+ AliVZERORawStream(AliRawReader* rawReader);
+ virtual ~AliVZERORawStream();
+
+ virtual void Reset();
+ virtual Bool_t Next();
+
+ Int_t GetCell() { return fCell; }
+ Int_t GetADC() { return fADC; }
+ Int_t GetTime() { return fTime; }
+
+ enum EVZERORawStreamError {
+ kRawDataSizeErr = 1
+ };
+
+ private:
+
+ AliVZERORawStream(const AliVZERORawStream& stream);
+ AliVZERORawStream& operator = (const AliVZERORawStream& stream);
+
+ Int_t GetNextWord();
+
+ Int_t fCell; // current VZERO cell
+ Int_t fADC; // current ADC count
+ Int_t fTime; // current time
+
+ Int_t fPosition; // current position in raw-data stream
+
+ AliRawReader* fRawReader; // object for reading the raw data
+
+ UChar_t* fData; // pointer to raw data payload
+
+ ClassDef(AliVZERORawStream, 0) // class for reading VZERO DDL raw data
+};
+
+#endif
///////////////////////////////////////////////////////////////////////////////
#include "AliRunLoader.h"
+#include "AliRawReader.h"
#include "AliVZEROReconstructor.h"
+#include "AliVZERORawStream.h"
#include "AliESD.h"
ClassImp(AliVZEROReconstructor)
}
+//______________________________________________________________________
+void AliVZEROReconstructor::Reconstruct(AliRunLoader* runLoader,AliRawReader* rawReader) const
+{
+
+ Int_t nEvents = runLoader->GetNumberOfEvents();
+
+ for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
+ if (!rawReader->NextEvent()) break;
+ AliVZERORawStream rawStream(rawReader);
+
+ Int_t NbPMV0A = 0;
+ Int_t NbPMV0C = 0;
+ Int_t MTotV0A = 0;
+ Int_t MTotV0C = 0;
+ Float_t ADCV0A = 0.0;
+ Float_t ADCV0C = 0.0;
+ Float_t MultV0A[4];
+ Float_t MultV0C[4];
+ Int_t MRingV0A[4];
+ Int_t MRingV0C[4];
+
+ Int_t ADC[64];
+ Float_t MIP[64];
+ for (Int_t i=0; i<64; i++){
+ ADC[i] = 0;
+ MIP[i] = 110.0;}
+ for (Int_t j=0; j<4; j++){
+ MultV0A[j] = 0.0;
+ MultV0C[j] = 0.0;
+ MRingV0A[j] = 0;
+ MRingV0C[j] = 0;}
+
+ // loop over VZERO entries
+ while (rawStream.Next()) {
+ Int_t PMNumber = rawStream.GetCell();
+ ADC[PMNumber] = rawStream.GetADC();
+ if (PMNumber<=31) {
+ if (PMNumber<=7) MultV0C[0]=MultV0C[0]+ float(ADC[PMNumber])/MIP[PMNumber];
+ if (PMNumber>=8 && PMNumber<=15) MultV0C[1]=MultV0C[1]+ float(ADC[PMNumber])/MIP[PMNumber];
+ if (PMNumber>=16 && PMNumber<=23) MultV0C[2]=MultV0C[2]+ float(ADC[PMNumber])/MIP[PMNumber];
+ if (PMNumber>=24 && PMNumber<=31) MultV0C[3]=MultV0C[3]+ float(ADC[PMNumber])/MIP[PMNumber];
+ ADCV0C = ADCV0C + float(ADC[PMNumber])/MIP[PMNumber];
+ if(ADC[PMNumber] > 4) NbPMV0C++;
+ }
+ if (PMNumber>=32) {
+ if (PMNumber>=32 && PMNumber<=39) MultV0A[0]=MultV0A[0]+ float(ADC[PMNumber])/MIP[PMNumber];
+ if (PMNumber>=40 && PMNumber<=47) MultV0A[1]=MultV0A[1]+ float(ADC[PMNumber])/MIP[PMNumber];
+ if (PMNumber>=48 && PMNumber<=55) MultV0A[2]=MultV0A[2]+ float(ADC[PMNumber])/MIP[PMNumber];
+ if (PMNumber>=56 && PMNumber<=63) MultV0A[3]=MultV0A[3]+ float(ADC[PMNumber])/MIP[PMNumber];
+ ADCV0A = ADCV0A + float(ADC[PMNumber])/MIP[PMNumber];
+ if(ADC[PMNumber] > 4) NbPMV0A++;
+ }
+ } // end of loop over digits
+
+ MTotV0A = int(ADCV0A + 0.5);
+ MTotV0C = int(ADCV0C + 0.5);
+ for (Int_t j=0; j<4; j++){
+ MRingV0A[j] = int(MultV0A[j] + 0.5);
+ MRingV0C[j] = int(MultV0C[j] + 0.5);}
+
+ AliDebug(1,Form("VZERO multiplicities : %d (V0A) %d (V0C)", MTotV0A, MTotV0C));
+ AliDebug(1,Form("Number of PMs fired : %d (V0A) %d (V0C)", NbPMV0A, NbPMV0C));
+
+ fESDVZERO->SetNbPMV0A(NbPMV0A);
+ fESDVZERO->SetNbPMV0C(NbPMV0C);
+ fESDVZERO->SetMTotV0A(MTotV0A);
+ fESDVZERO->SetMTotV0C(MTotV0C);
+ fESDVZERO->SetMRingV0A(MRingV0A);
+ fESDVZERO->SetMRingV0C(MRingV0C);
+ } // end of loop over events in digits tree
+}
//_____________________________________________________________________________
void AliVZEROReconstructor::FillESD(AliRunLoader* /*runLoader*/,
virtual void Reconstruct(AliRawReader* /*rawReader*/,
TTree* /*clustersTree*/) const {return;};
virtual void Reconstruct(AliRunLoader* /*runLoader*/,
- AliRawReader* /*rawReader*/) const {return;};
+ AliRawReader* /*rawReader*/) const;
virtual void Reconstruct(TTree*, TTree*) const {return;};
virtual void FillESD(AliRunLoader* /*runLoader*/, AliESD* /*esd*/) const;
#pragma link off all functions;
#pragma link C++ class AliVZEROReconstructor+;
+#pragma link C++ class AliVZERORawStream+;
#endif
#-*- Mode: Makefile -*-
# $Id$
-SRCS= \
-AliVZEROReconstructor.cxx
+SRCS= AliVZEROReconstructor.cxx \
+ AliVZERORawStream.cxx
HDRS:= $(SRCS:.cxx=.h)