]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
VZERO reconstruction starting from raw-data input. New AliVZERORawStream class for...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Apr 2007 16:29:49 +0000 (16:29 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Apr 2007 16:29:49 +0000 (16:29 +0000)
VZERO/AliVZERORawStream.cxx [new file with mode: 0644]
VZERO/AliVZERORawStream.h [new file with mode: 0644]
VZERO/AliVZEROReconstructor.cxx
VZERO/AliVZEROReconstructor.h
VZERO/VZEROrecLinkDef.h
VZERO/libVZEROrec.pkg

diff --git a/VZERO/AliVZERORawStream.cxx b/VZERO/AliVZERORawStream.cxx
new file mode 100644 (file)
index 0000000..ace84ad
--- /dev/null
@@ -0,0 +1,106 @@
+/**************************************************************************
+ * 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;
+}
diff --git a/VZERO/AliVZERORawStream.h b/VZERO/AliVZERORawStream.h
new file mode 100644 (file)
index 0000000..20b69e8
--- /dev/null
@@ -0,0 +1,54 @@
+#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
index 8485a03a736d90d2ec084e23625324c54d3e64d3..b586ac9e9c0a9edf822bb944fff04160c5e093ad 100644 (file)
@@ -22,7 +22,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliRunLoader.h"
+#include "AliRawReader.h"
 #include "AliVZEROReconstructor.h"
+#include "AliVZERORawStream.h"
 #include "AliESD.h"
 
 ClassImp(AliVZEROReconstructor)
@@ -154,6 +156,77 @@ void AliVZEROReconstructor::Reconstruct(AliRunLoader* runLoader) const
   
 }
 
+//______________________________________________________________________
+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*/, 
index 12525fb560cde30b5dc7486543539cc96511fd29..ad4245b3d8ed276e20a56207f52aae65761b16d0 100644 (file)
@@ -32,7 +32,7 @@ public:
   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;
index 57b22766798a321c8a8b4d1f0999055df509d319..bf4f02baf4a6fbc0d0a9f196d2d4b2c73d37ab63 100755 (executable)
@@ -7,5 +7,6 @@
 #pragma link off all functions;
  
 #pragma link C++ class  AliVZEROReconstructor+;
+#pragma link C++ class  AliVZERORawStream+;
 
 #endif
index 6878a499fe84e54328320574ea37704f689ba9e5..2ca005672d419790fd0036a0766e3ebad89c3c87 100644 (file)
@@ -1,8 +1,8 @@
 #-*- Mode: Makefile -*-
 # $Id$
 
-SRCS= \
-AliVZEROReconstructor.cxx
+SRCS= AliVZEROReconstructor.cxx \
+      AliVZERORawStream.cxx
 
 HDRS:= $(SRCS:.cxx=.h)