--- /dev/null
+#include "AliSTARTRawReader.h"
+#include "AliSTARTRawData.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReaderFile.h"
+
+
+#include <Riostream.h>
+#include "TMath.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TArrayI.h"
+#include "AliSTARTHist.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReader.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReaderFile.h"
+#include "AliSTARTRawReader.h"
+ClassImp(AliSTARTHist)
+
+ AliSTARTHist::AliSTARTHist() : TObject()
+{
+ fhADCR = new TH1F("hADCR","ADC right",100,1.,500);
+ fhADCL = new TH1F("hADCL","ADC right",100,1.,500);
+ fhTimeR = new TH1F("hTimeR","Time Right",100,400,1000);
+ fhTimeL = new TH1F("hTimeL","Time Left",100,10,500);
+ fhBestTimeR = new TH1F("hBestTimeR","Time Right",100,400,1000);
+ fhBestTimeL = new TH1F("hBestTimeL","Time Left",100,0,500);
+ fhADCDet = new TH1F("hADCDet","ADC vs Ndet",30,0.,30);
+ fhTimeDet = new TH1F("hTimeDet","Time vs Ndet",30,0,30);
+ fhTimeDiff = new TH1F("hTimeDiff"," Time diff",100,350,450);
+ fhMeanTime = new TH1F("hMeanTime"," Mean Time ",100,250,350);
+ fhT0detR = new TH1F("hT0detR"," T0 vs Ndet right ",15,0,15);
+ fhT0detL = new TH1F("hT0detL"," T0 vs Ndet left ",15,0,15);
+ fhTimevsADCL = new TH2F("hTimevsADCL","time vs ADC left",100,0,500,100,1,500);
+ fhTimevsADCR = new TH2F("hTimevsADCR","time vs ADC right",100,0,500,100,400,1000);
+}
+
+
+ AliSTARTHist::~AliSTARTHist()
+{
+ /*
+ delete fhADCR;
+ delete fhADCL;
+ delete fhTimeR;
+ delete fhTimeL;
+ delete fhBestTimeR;
+ delete fhBestTimeL;
+ delete fhADCDet;
+ delete fhTimeDet;
+ delete fhTimeDiff;
+ delete fhMeanTime;
+ delete fhT0detR;
+ delete fhT0detL;
+ delete fhTimevsADCL;
+ */
+}
+
+void AliSTARTHist::FillHist(AliRunLoader* runLoader,
+ AliRawReader* rawReader) const
+{
+
+ TArrayI *fTime= new TArrayI(24);
+ TArrayI *fADC = new TArrayI(24);
+ AliSTARTRawReader myrawreader;
+
+
+
+ Int_t iEvent = 0;
+ while (rawReader->NextEvent()) {
+ runLoader->GetEvent(iEvent++);
+
+ myrawreader.NextThing( rawReader);
+ myrawreader.GetTime(*fTime);
+ myrawreader.GetADC(*fADC);
+
+ Int_t besttimeleft=99999;
+ Int_t besttimeright=99999;
+ Int_t ibestR=999; Int_t ibestL=999;
+ for (Int_t i=0; i<12; i++ )
+ {
+ Int_t timel=fTime->At(i);
+ if(timel<besttimeleft && timel!=0) { besttimeleft=timel; ibestL=i;}
+ fhTimeL->Fill(timel);
+ fhTimeDet->Fill(i,timel);
+ Int_t adcl=fADC->At(i);
+ fhADCL->Fill(adcl);
+ fhADCDet->Fill(i,adcl);
+ Int_t timer=fTime->At(i+12);
+ if(timer<besttimeright && timer!=0){ besttimeright=timer; ibestR=i;}
+ fhTimeDet->Fill(i+12,timer);
+ fhTimeR->Fill(timer);
+ Int_t adcr=fADC->At(i+12);
+ fhADCR->Fill(adcr);
+ fhADCDet->Fill(i+12,adcr);
+ fhTimevsADCL->Fill(adcl,timel);
+ fhTimevsADCR->Fill(adcr,timer);
+
+ }
+
+ fhBestTimeR->Fill(besttimeright);
+ fhBestTimeL->Fill(besttimeleft);
+ Int_t timeDiff1=besttimeright-besttimeleft;
+ Float_t meanTime=(besttimeright+besttimeleft)/2.;
+ fhTimeDiff->Fill(timeDiff1);
+ fhMeanTime->Fill(meanTime);
+ // Float_t timeDiff2=((besttimeright-besttimeleft)-(350.-69.7))/2;
+ fhT0detR->Fill(ibestR); fhT0detL->Fill(ibestL);
+ }
+}
+
+
+
--- /dev/null
+#ifndef ALISTARTHIST_H
+#define ALISTARTHIST_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TArrayI.h"
+#include "AliRunLoader.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReader.h"
+
+class AliSTARTHist: public TObject
+{
+ public:
+ AliSTARTHist();
+ virtual ~AliSTARTHist();
+ void FillHist(AliRunLoader* runLoader,
+ AliRawReader* rawReader) const;
+ TH1F * hTimeR() {return fhTimeR;}
+ TH1F * hTimeL() {return fhTimeL;}
+ TH1F *hADCR() {return fhADCL;}
+ TH1F *hADCL() {return fhADCR;}
+ TH1F * hBestTimeR() {return fhBestTimeR;}
+ TH1F * hBestTimeL() {return fhBestTimeL;}
+ TH1F * hTimeDet() {return fhTimeDet;}
+ TH1F * hADCDet() {return fhADCDet;}
+ TH1F * hTimeDiff() {return fhTimeDiff;}
+ TH1F * hMeanTime() {return fhMeanTime;}
+ TH1F * hT0detL() {return fhT0detL;}
+ TH1F * hT0detR() {return fhT0detR;}
+ TH2F * hTimevsADCR() {return fhTimevsADCR;}
+ TH2F * hTimevsADCL() {return fhTimevsADCL;}
+
+ private:
+ TH1F *fhTimeR;
+ TH1F *fhTimeL;
+ TH1F *fhADCL;
+ TH1F *fhADCR;
+ TH1F *fhBestTimeR;
+ TH1F *fhBestTimeL;
+ TH1F *fhADCDet;
+ TH1F *fhTimeDet;
+ TH1F *fhMeanTime;
+ TH1F *fhTimeDiff;
+ TH1F * fhT0detL;
+ TH1F * fhT0detR;
+ TH2F *fhTimevsADCR;
+ TH2F *fhTimevsADCL;
+
+ ClassDef(AliSTARTHist, 0) // class for the START reconstruction
+
+};
+
+#endif
--- /dev/null
+#include "AliSTARTRawReader.h"
+#include "AliSTARTRawData.h"
+#include "AliRawReaderFile.h"
+
+
+#include <Riostream.h>
+#include "TMath.h"
+#include "TH1F.h"
+#include "TArrayI.h"
+#include "AliLog.h"
+
+ClassImp(AliSTARTRawReader)
+
+ AliSTARTRawReader::AliSTARTRawReader (): TTask("STARTRawReader","read raw data"),
+ fPMTId(-1),
+ fTimeTDC1(0),
+ fChargeADC1(0),
+ fTimeTDC2(0),
+ fChargeADC2(0)
+{
+ //
+// create an object to read STARTraw digits
+ AliDebug(1,"Start ");
+ fTimeTDC1 = new TArrayI(24);
+ fChargeADC1 = new TArrayI(24);
+ fTimeTDC2 = new TArrayI(24);
+ fChargeADC2 = new TArrayI(24);
+
+}
+ AliSTARTRawReader::~AliSTARTRawReader ()
+{
+ delete fTimeTDC1;
+ delete fTimeTDC2;
+ delete fChargeADC1 ;
+ delete fChargeADC2;
+
+}
+//------------------------------------------------------------------------------------------------
+
+UInt_t AliSTARTRawReader::UnpackWord(UInt_t packedWord, Int_t startBit, Int_t stopBit)
+{
+ //This method unpacks a words of StopBit-StartBit+1 bits starting from "StopBits"
+ UInt_t word;
+ UInt_t offSet;
+ Int_t length;
+ length=stopBit-startBit+1;
+ offSet=(UInt_t)TMath::Power(2,length)-1;
+ offSet<<=startBit;
+ word=packedWord&offSet;
+ word>>=startBit;
+ return word;
+}
+//---------------------------------------------------------------------------------------
+Bool_t AliSTARTRawReader::NextThing( AliRawReader *fRawReader)
+{
+// read the next raw digit
+// returns kFALSE if there is no digit left
+
+ UInt_t word, unpackword;
+ UInt_t fADC, fTime;
+ fRawReader->Select(13);
+
+ if (!fRawReader->ReadNextInt(fData)) return kFALSE;
+
+
+ Int_t size=fRawReader->GetDataSize();
+ for (Int_t i=0; i<size/32; i++)
+ {
+ word=0;
+ unpackword=0;
+ fRawReader->ReadNextInt(word);
+ unpackword=UnpackWord(word,0,5);
+ fPMTId=unpackword;
+ word=0;
+ unpackword=0;
+
+ fRawReader->ReadNextInt(word);
+ unpackword=UnpackWord(word,8,31);
+ fTime=unpackword;
+ fTimeTDC1->AddAt(fTime,fPMTId);
+ word=0;
+ unpackword=0;
+
+ fRawReader->ReadNextInt(word);
+ unpackword=UnpackWord(word,0,5);
+ fPMTId=unpackword;
+ word=0;
+ unpackword=0;
+
+ fRawReader->ReadNextInt(word);
+
+ unpackword=UnpackWord(word,8,31);
+ fTime=unpackword;
+ fTimeTDC2->AddAt(fTime,fPMTId);
+
+ word=0;
+ unpackword=0;
+ fRawReader->ReadNextInt(word);
+ unpackword=UnpackWord(word,0,5);
+ fPMTId=unpackword;
+ word=0;
+ unpackword=0;
+
+ fRawReader->ReadNextInt(word);
+ unpackword= UnpackWord(word,8,31);
+ fADC=unpackword;
+ fChargeADC1 -> AddAt(fADC, fPMTId);
+
+ word=0;
+ unpackword=0;
+
+ fRawReader->ReadNextInt(word);
+ unpackword=UnpackWord(word,0,5);
+ fPMTId=unpackword;
+
+ word=0;
+ unpackword=0;
+ fRawReader->ReadNextInt(word);
+
+ unpackword= UnpackWord(word,8,31);
+ fADC=unpackword;
+ fChargeADC2 -> AddAt(fADC, fPMTId);
+ }
+ return kTRUE;
+
+}
+
+//--------------------------------------------
+void AliSTARTRawReader::GetTime (TArrayI &o)
+{
+ //
+ Int_t i;
+ for (i=0; i<24; i++)
+ {
+ o[i]=fTimeTDC1->At(i);
+ }
+}
+//--------------------------------------------
+//--------------------------------------------
+void AliSTARTRawReader::GetADC (TArrayI &o)
+{
+ //
+ Int_t i;
+ for (i=0; i<24; i++)
+ {
+ o[i]=fChargeADC1->At(i);
+ }
+}
--- /dev/null
+#ifndef ALISTARTRAWREADER_H
+#define ALISTARTRAWREADER_H
+
+#include <TTask.h>
+#include <Riostream.h>
+#include "TArrayI.h"
+
+class AliRawReader;
+
+class AliSTARTRawReader : public TTask {
+ public :
+
+ AliSTARTRawReader() ;
+
+ virtual ~AliSTARTRawReader();
+
+
+ Int_t GetPMTId () {return fPMTId;}
+ UInt_t UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit); // unpack packed words
+ Bool_t NextThing(AliRawReader *rawReader); //read next raw digit
+
+ TArrayI *TimeTDC1() {return fTimeTDC1;}
+ TArrayI *TimeTDC2() {return fTimeTDC2;}
+ TArrayI *ChargeADC1() {return fChargeADC1;}
+ TArrayI *ChargeADC2() {return fChargeADC2;}
+ virtual void GetTime (TArrayI &o);
+ virtual void GetADC (TArrayI &o);
+
+
+protected :
+
+ UInt_t fData; // data read for file
+
+ AliRawReader* fRawReader; // object for reading the raw data
+ Int_t fPMTId ; // PMT number
+ TArrayI *fTimeTDC1 ; //TDC signal
+ TArrayI *fChargeADC1 ; //ADC signal
+ TArrayI *fTimeTDC2 ; //amplified TDC signal
+ TArrayI *fChargeADC2 ; //amplified ADC signal
+
+ ClassDef(AliSTARTRawReader, 0) //class for reading START Raw data
+};
+
+#endif
--- /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. *
+ **************************************************************************/
+
+/* $Id$ */
+/////////////////////////////////////////////////////////////////////////
+// Class AliSTARTRecPoint for START time and ADC signals
+// fTimeRight - right side TOF signal
+// fTimeLeft - left side TOF signal
+// fTimeBestRight - TOF first particle on the right side
+// TimeBestLeft - TOF first particle on the left side
+// fTimeAverage = (fTimeBestRight + TimeBestLeft ) /2. START signal
+// fVertex - vertex position
+//
+///////////////////////////////////////////////////////////////////////
+
+
+
+
+#include <TArrayI.h>
+#include "AliSTARTRecPoint.h"
+#include <Riostream.h>
+
+ClassImp(AliSTARTRecPoint)
+
+//------------------------------------
+ AliSTARTRecPoint::AliSTARTRecPoint() : TObject()
+{
+ //ctor
+ fTimeAverage=9999;
+ fTimeBestRight=9999;
+ fTimeBestLeft=9999;
+
+ fTime = new TArrayI(24);
+ fADC = new TArrayI(24);
+}
+//-----------------------------------
+AliSTARTRecPoint::~AliSTARTRecPoint() {
+ // destructor
+ delete fTime;
+ delete fADC;
+}
+//-----------------------------------
+void AliSTARTRecPoint::SetTime (TArrayI &o)
+{
+ ////////////////////////////////////////
+
+ Int_t i;
+ for (i=0; i<24; i++)
+ {
+ Int_t buf=o.At(i);
+ fTime->AddAt(buf,i);
+ }
+}
+//--------------------------------------------
+void AliSTARTRecPoint::GetTime (TArrayI &o)
+{
+ //
+ Int_t i;
+ for (i=0; i<24; i++)
+ {
+ o[i]=fTime->At(i);
+ }
+}
+//--------------------------------------------
+void AliSTARTRecPoint::GetADC (TArrayI &o)
+{
+ //
+ Int_t i;
+ for (i=0; i<24; i++)
+ {
+ o[i]=fADC->At(i);
+ }
+}
+//--------------------------------------------
+void AliSTARTRecPoint::SetADC (TArrayI &o)
+{
+ //
+ Int_t i;
+ // Float_t fProcessKoef=1; // for pb 0.001
+ for (i=0; i<24; i++)
+ {
+ Int_t buf=(o.At(i));
+ fADC->AddAt(buf,i);
+ }
+}
--- /dev/null
+#ifndef ALISTARTRECPOINT_H
+#define ALISTARTRECPOINT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+#include <TObject.h>
+class TArrayI;
+
+//___________________________________________
+class AliSTARTRecPoint: public TObject {
+////////////////////////////////////////////////////////////////////////
+ public:
+ AliSTARTRecPoint();
+ virtual ~AliSTARTRecPoint();
+ void SetMeanTime(Int_t time) {fTimeAverage=time;}
+ Int_t GetMeanTime() {return fTimeAverage;}
+ Int_t GetBestTimeRight() {return fTimeBestRight ;}
+ Int_t GetBestTimeLeft() {return fTimeBestLeft ;}
+ void SetTimeBestRight( Int_t time) {fTimeBestRight = time;}
+ void SetTimeBestLeft( Int_t time) {fTimeBestLeft = time;}
+ void SetTimeDifference( Int_t time) {fTimeDifference= time;}
+ Int_t GetTimeDifference() {return fTimeDifference;}
+ // void SetProcessKoef( Float_t pp) {fProcessKoef = pp;}
+ virtual void SetTime (TArrayI &o);
+ virtual void GetTime (TArrayI &o);
+ virtual void SetADC (TArrayI &o);
+ virtual void GetADC (TArrayI &o);
+ virtual const char* GetName() const {return "START_V";}
+ private:
+ // Float_t fProcessKoef; // for pp fProcessKoef=1 ; for Pb-Pb - 0.001
+ Int_t fTimeAverage; // Average time
+ Int_t fTimeDifference; // Diffrence time between left and right
+ Int_t fTimeBestRight; //TOF first particle on the right
+ Int_t fTimeBestLeft; //TOF first particle on the left
+ TArrayI *fTime; // array's TDC in ns
+ TArrayI *fADC; // array's ADC in number of photo electrons
+
+ ClassDef(AliSTARTRecPoint,1) //Digit (Header) object for set:START
+};
+
+
+#endif
+
+
+