--- /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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a summary for TRM chain data. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFChainSummaryData.h"
+
+ClassImp(AliTOFChainSummaryData)
+
+AliTOFChainSummaryData::AliTOFChainSummaryData() :
+ TObject(),
+ fHeader(kFALSE),
+ fTrailer(kFALSE),
+ fChain(0),
+ fBunchID(0),
+ fPB24Temp(0),
+ fPB24ID(0),
+ fTSBit(0),
+ fStatus(0),
+ fEventCounter(0),
+ fTDCHitBuffer(0x0),
+ fTDCPackedHitBuffer(0x0),
+ fTDCErrorBuffer(0x0)
+{
+ /* default constructor */
+ fTDCHitBuffer = new AliTOFTDCHitBuffer();
+ fTDCPackedHitBuffer = new AliTOFTDCHitBuffer();
+ fTDCErrorBuffer = new AliTOFTDCErrorBuffer();
+}
+
+//_________________________________________________________________
+
+AliTOFChainSummaryData::AliTOFChainSummaryData(const AliTOFChainSummaryData &source) :
+ TObject(),
+ fHeader(source.fHeader),
+ fTrailer(source.fTrailer),
+ fChain(source.fChain),
+ fBunchID(source.fBunchID),
+ fPB24Temp(source.fPB24Temp),
+ fPB24ID(source.fPB24ID),
+ fTSBit(source.fTSBit),
+ fStatus(source.fStatus),
+ fEventCounter(source.fEventCounter),
+ fTDCHitBuffer(0x0),
+ fTDCPackedHitBuffer(0x0),
+ fTDCErrorBuffer(0x0)
+{
+/* copy constructor */
+ fTDCHitBuffer = new AliTOFTDCHitBuffer(*source.fTDCHitBuffer);
+ fTDCPackedHitBuffer = new AliTOFTDCHitBuffer(*source.fTDCPackedHitBuffer);
+ fTDCErrorBuffer = new AliTOFTDCErrorBuffer(*source.fTDCErrorBuffer);
+}
+
+//_________________________________________________________________
+
+AliTOFChainSummaryData &
+AliTOFChainSummaryData::operator = (const AliTOFChainSummaryData &source)
+{
+ /* operator = */
+ fHeader = source.fHeader;
+ fTrailer = source.fTrailer;
+ fChain = source.fChain;
+ fBunchID = source.fBunchID;
+ fPB24Temp = source.fPB24Temp;
+ fPB24ID = source.fPB24ID;
+ fTSBit = source.fTSBit;
+ fStatus = source.fStatus;
+ fEventCounter = source.fEventCounter;
+ *fTDCHitBuffer = *source.fTDCHitBuffer;
+ *fTDCPackedHitBuffer = *source.fTDCPackedHitBuffer;
+ *fTDCErrorBuffer = *source.fTDCErrorBuffer;
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFChainSummaryData::~AliTOFChainSummaryData()
+{
+ /* default destructor */
+ delete fTDCHitBuffer;
+ delete fTDCPackedHitBuffer;
+ delete fTDCErrorBuffer;
+}
+
+//_________________________________________________________________
+
+void
+AliTOFChainSummaryData::Reset()
+{
+ /* reset function */
+ fHeader = kFALSE;
+ fTrailer = kFALSE;
+ fChain = 0;
+ fBunchID = 0;
+ fPB24Temp = 0;
+ fPB24ID = 0;
+ fTSBit = 0;
+ fStatus = 0;
+ fEventCounter = 0;
+ fTDCHitBuffer->Reset();
+ fTDCPackedHitBuffer->Reset();
+ fTDCErrorBuffer->Reset();
+}
--- /dev/null
+#ifndef ALITOFCHAINSUMMARYDATA_H
+#define ALITOFCHAINSUMMARYDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a summary for TRM chain data. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "AliTOFTDCHitBuffer.h"
+#include "AliTOFTDCErrorBuffer.h"
+
+class AliTOFChainSummaryData : public TObject
+{
+ public:
+ AliTOFChainSummaryData(); //default constructor
+ AliTOFChainSummaryData(const AliTOFChainSummaryData &source); //copy constructor
+ AliTOFChainSummaryData &operator = (const AliTOFChainSummaryData &source); //operator =
+ virtual ~AliTOFChainSummaryData(); //destructor
+ /* getters */
+ Bool_t GetHeader() const {return fHeader;}; //get header
+ Bool_t GetTrailer() const {return fTrailer;}; //get trailer
+ UShort_t GetChain() const {return fChain;}; //get chain
+ UShort_t GetBunchID() const {return fBunchID;}; //get bunch ID
+ UShort_t GetPB24Temp() const {return fPB24Temp;}; //get PB24 temp
+ UShort_t GetPB24ID() const {return fPB24ID;}; //get PB24 ID
+ UShort_t GetTSBit() const {return fTSBit;}; //get TS bit
+ UShort_t GetStatus() const {return fStatus;}; //get status
+ UShort_t GetEventCounter() const {return fEventCounter;}; //get event counter
+ AliTOFTDCHitBuffer *GetTDCHitBuffer() const {return fTDCHitBuffer;}; //get TDC hit buffer
+ AliTOFTDCHitBuffer *GetTDCPackedHitBuffer() const {return fTDCPackedHitBuffer;}; //get TDC packed hit buffer
+ AliTOFTDCErrorBuffer *GetTDCErrorBuffer() const {return fTDCErrorBuffer;}; //get TDC error buffer
+ /* setters */
+ void SetHeader(Bool_t Header) {fHeader = Header;}; //set header
+ void SetTrailer(Bool_t Trailer) {fTrailer = Trailer;}; //set trailer
+ void SetChain(UShort_t Chain) {fChain = Chain;}; //set chain
+ void SetBunchID(UShort_t BunchID) {fBunchID = BunchID;}; //set bunch ID
+ void SetPB24Temp(UShort_t PB24Temp) {fPB24Temp = PB24Temp;}; //set PB24 temp
+ void SetPB24ID(UShort_t PB24ID) {fPB24ID = PB24ID;}; //set PB24 ID
+ void SetTSBit(UShort_t TSBit) {fTSBit = TSBit;}; //set TS bit
+ void SetStatus(UShort_t Status) {fStatus = Status;}; //set status
+ void SetEventCounter(UShort_t EventCounter) {fEventCounter = EventCounter;}; //set event counter
+ /* methods */
+ void Reset(); //reset
+ private:
+ Bool_t fHeader; //header detected
+ Bool_t fTrailer; //trailer detected
+ UShort_t fChain; //chain number
+ UShort_t fBunchID; //bunch ID
+ UShort_t fPB24Temp; //piggy-back temperature
+ UShort_t fPB24ID; //piggy-back ID
+ UShort_t fTSBit; //I2C reading of temperature sensor success
+ UShort_t fStatus; //status
+ UShort_t fEventCounter; //event counter
+ AliTOFTDCHitBuffer *fTDCHitBuffer; //TDC hit buffer
+ AliTOFTDCHitBuffer *fTDCPackedHitBuffer; //TDC packed hit buffer
+ AliTOFTDCErrorBuffer *fTDCErrorBuffer; //TDC error buffer
+
+ ClassDef(AliTOFChainSummaryData, 1);
+};
+
+#endif /* ALITOFCHAINSUMMARYDATA_H */
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
-
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
+
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
-
+
for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
}
//_________________________________________________________________________
+
+/*
+ * OLD CALIBRATE REC POINTS FUNCTION
+ */
+
+#if 0
void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
{
//
} // loop on clusters
}
+#endif
+
+//_________________________________________________________________________
+
+void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
+{
+ //
+ // Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
+ // in Z) in the global TClonesArray of AliTOFcluster,
+ // i.e. fRecPoints.
+ //
+
+ Int_t detectorIndex[5];
+ Double_t time, tot, corr;
+ Int_t deltaBC, l0l1, tdcBin;
+ for (Int_t ii = 0; ii < fNumberOfTofClusters; ii++) {
+ for(Int_t jj = 0; jj < 5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
+
+ Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
+
+ /* check channel enabled */
+ if (!fTOFcalib->IsChannelEnabled(index)) fTofClusters[ii]->SetStatus(kFALSE);
+
+ /* get cluster info */
+ time = fTofClusters[ii]->GetTDC() * AliTOFGeometry::TdcBinWidth(); /* ps */
+ tot = fTofClusters[ii]->GetToT() * AliTOFGeometry::ToTBinWidth() * 1.e-3; /* ns */
+ deltaBC = fTofClusters[ii]->GetDeltaBC();
+ l0l1 = fTofClusters[ii]->GetL0L1Latency();
+
+ /* get correction */
+ corr = fTOFcalib->GetTimeCorrection(index, tot, deltaBC, l0l1, timestamp); /* ps */
+ AliDebug(2, Form("calibrate index %d: time=%f (ps) tot=%f (ns) deltaBC=%d l0l1=%d timestamp=%d corr=%f (ps)", index, time, tot, deltaBC, l0l1, timestamp, corr));
+
+ /* apply time correction */
+ time -= corr;
+
+ /* convert in TDC bins and set cluster */
+ tdcBin = (Int_t)(time / AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
+ fTofClusters[ii]->SetTDC(tdcBin);
+
+ } // loop on clusters
+
+}
+
//______________________________________________________________________________
void AliTOFClusterFinder::ResetRecpoint()
void UnLoadClusters();
void SetVerbose(Int_t Verbose){fVerbose=Verbose;} // To set the verbose level
void SetDecoderVersion(Int_t version){fDecoderVersion=version;} // To set the decoder version
- Bool_t GetDecoderVersion() const {return fDecoderVersion;} // To get the decoder version
+ Int_t GetDecoderVersion() const {return fDecoderVersion;} // To get the decoder version
UShort_t GetClusterVolIndex(const Int_t * const ind) const; //Volume Id getter
void GetClusterPars(Int_t *ind, Double_t *pos, Double_t *cov) const; //cluster par getter
Int_t fVerbose; // Verbose level (0:no msg,
// 1:msg, 2:digits in txt files)
- Bool_t fDecoderVersion; //setting whether to use the new decoder version
- // -true -> new version
- // -false ->old version (default value!!)
+ Int_t fDecoderVersion; //setting whether to use the new decoder version
AliTOFcalib *fTOFcalib; // pointer to the TOF calibration info
AliTOFRawStream fTOFRawStream; // AliTOFRawStream variable
--- /dev/null
+#ifndef ALITOFDRMEVENTCRC_H
+#define ALITOFDRMEVENTCRC_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFDRMEventCRC
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetEventCRC() {return fEventCRC;};
+ UInt_t GetUNDEFINED() {return fUNDEFINED;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fEventCRC: 16;
+ UInt_t fUNDEFINED: 12;
+ UInt_t fWordType: 4;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFDRMGLOBALHEADER_H
+#define ALITOFDRMGLOBALHEADER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFDRMGlobalHeader
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetEventWords() {return fEventWords;};
+ UInt_t GetDRMID() {return fDRMID;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fEventWords: 17;
+ UInt_t fDRMID: 7;
+ UInt_t fWordType: 4;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFDRMGLOBALTRAILER_H
+#define ALITOFDRMGLOBALTRAILER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFDRMGlobalTrailer
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetLocalEventCounter() {return fLocalEventCounter;};
+ UInt_t GetUNDEFINED() {return fUNDEFINED;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fLocalEventCounter: 12;
+ UInt_t fUNDEFINED: 12;
+ UInt_t fWordType: 4;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFDRMSTATUSHEADER1_H
+#define ALITOFDRMSTATUSHEADER1_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFDRMStatusHeader1
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetPartecipatingSlotID() {return fPartecipatingSlotID;};
+ UInt_t GetCBit() {return fCBit;};
+ UInt_t GetVersID() {return fVersID;};
+ UInt_t GetDRMhSize() {return fDRMhSize;};
+ UInt_t GetUNDEFINED() {return fUNDEFINED;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fPartecipatingSlotID: 11;
+ UInt_t fCBit: 1;
+ UInt_t fVersID: 5;
+ UInt_t fDRMhSize: 4;
+ UInt_t fUNDEFINED: 3;
+ UInt_t fWordType: 4;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFDRMSTATUSHEADER2_H
+#define ALITOFDRMSTATUSHEADER2_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFDRMStatusHeader2
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetSlotEnableMask() {return fSlotEnableMask;};
+ UInt_t GetMBZ() {return fMBZ;};
+ UInt_t GetFaultID() {return fFaultID;};
+ UInt_t GetRTOBit() {return fRTOBit;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fSlotEnableMask: 11;
+ UInt_t fMBZ: 1;
+ UInt_t fFaultID: 11;
+ UInt_t fRTOBit: 1;
+ UInt_t fWordType: 4;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFDRMSTATUSHEADER4_H
+#define ALITOFDRMSTATUSHEADER4_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFDRMStatusHeader4
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetTemperature() {return fTemperature;};
+ UInt_t GetMBZ1() {return fMBZ1;};
+ UInt_t GetACKBit() {return fACKBit;};
+ UInt_t GetSensAD() {return fSensAD;};
+ UInt_t GetMBZ2() {return fMBZ2;};
+ UInt_t GetUNDEFINED() {return fUNDEFINED;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fTemperature: 10;
+ UInt_t fMBZ1: 1;
+ UInt_t fACKBit: 1;
+ UInt_t fSensAD: 3;
+ UInt_t fMBZ2: 1;
+ UInt_t fUNDEFINED: 8;
+ UInt_t fWordType: 4;
+};
+
+#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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a summary for DRM data. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFDRMSummaryData.h"
+
+ClassImp(AliTOFDRMSummaryData)
+
+AliTOFDRMSummaryData::AliTOFDRMSummaryData() :
+ TObject(),
+ fHeader(kFALSE),
+ fTrailer(kFALSE),
+ fSlotID(0),
+ fEventWords(0),
+ fDRMID(0),
+ fLocalEventCounter(0),
+ fPartecipatingSlotID(0),
+ fCBit(0),
+ fVersID(0),
+ fDRMhSize(0),
+ fSlotEnableMask(0),
+ fFaultID(0),
+ fRTOBit(0),
+ fL0BCID(0),
+ fRunTimeInfo(0),
+ fTemperature(0),
+ fACKBit(0),
+ fSensAD(0),
+ fEventCRC(0),
+ fDecoderCRC(0),
+ fDecoderSlotEnableMask(0),
+ fLTMSummaryData(0x0)
+{
+ /* default constructor */
+ fLTMSummaryData = new AliTOFLTMSummaryData();
+ for (Int_t iTRM = 0; iTRM < N_TRM; iTRM++)
+ fTRMSummaryData[iTRM] = new AliTOFTRMSummaryData();
+}
+
+//_________________________________________________________________
+
+AliTOFDRMSummaryData::AliTOFDRMSummaryData(const AliTOFDRMSummaryData &source) :
+ TObject(),
+ fHeader(source.fHeader),
+ fTrailer(source.fTrailer),
+ fSlotID(source.fSlotID),
+ fEventWords(source.fEventWords),
+ fDRMID(source.fDRMID),
+ fLocalEventCounter(source.fLocalEventCounter),
+ fPartecipatingSlotID(source.fPartecipatingSlotID),
+ fCBit(source.fCBit),
+ fVersID(source.fVersID),
+ fDRMhSize(source.fDRMhSize),
+ fSlotEnableMask(source.fSlotEnableMask),
+ fFaultID(source.fFaultID),
+ fRTOBit(source.fRTOBit),
+ fL0BCID(source.fL0BCID),
+ fRunTimeInfo(source.fRunTimeInfo),
+ fTemperature(source.fTemperature),
+ fACKBit(source.fACKBit),
+ fSensAD(source.fSensAD),
+ fEventCRC(source.fEventCRC),
+ fDecoderCRC(source.fDecoderCRC),
+ fDecoderSlotEnableMask(source.fDecoderSlotEnableMask),
+ fLTMSummaryData(0x0)
+{
+ /* copy constructor */
+ fLTMSummaryData = new AliTOFLTMSummaryData(*source.fLTMSummaryData);
+ for (Int_t iTRM = 0; iTRM < N_TRM; iTRM++)
+ fTRMSummaryData[iTRM] = new AliTOFTRMSummaryData(*source.fTRMSummaryData[iTRM]);
+}
+
+//_________________________________________________________________
+
+AliTOFDRMSummaryData &
+AliTOFDRMSummaryData::operator = (const AliTOFDRMSummaryData &source)
+{
+ /* operator = */
+ fHeader = source.fHeader;
+ fTrailer = source.fTrailer;
+ fSlotID = source.fSlotID;
+ fEventWords = source.fEventWords;
+ fDRMID = source.fDRMID;
+ fLocalEventCounter = source.fLocalEventCounter;
+ fPartecipatingSlotID = source.fPartecipatingSlotID;
+ fCBit = source.fCBit;
+ fVersID = source.fVersID;
+ fDRMhSize = source.fDRMhSize;
+ fSlotEnableMask = source.fSlotEnableMask;
+ fFaultID = source.fFaultID;
+ fRTOBit = source.fRTOBit;
+ fL0BCID = source.fL0BCID;
+ fRunTimeInfo = source.fRunTimeInfo;
+ fTemperature = source.fTemperature;
+ fACKBit = source.fACKBit;
+ fSensAD = source.fSensAD;
+ fEventCRC = source.fEventCRC;
+ fDecoderCRC = source.fDecoderCRC;
+ fDecoderSlotEnableMask = source.fDecoderSlotEnableMask;
+ *fLTMSummaryData = *source.fLTMSummaryData;
+ for (Int_t iTRM = 0; iTRM < N_TRM; iTRM++)
+ *fTRMSummaryData[iTRM] = *source.fTRMSummaryData[iTRM];
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFDRMSummaryData::~AliTOFDRMSummaryData()
+{
+ /* default destructor */
+ delete fLTMSummaryData;
+ for (Int_t iTRM = 0; iTRM < N_TRM; iTRM++)
+ delete fTRMSummaryData[iTRM];
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDRMSummaryData::Reset()
+{
+ /* reset function */
+ fHeader = kFALSE;
+ fTrailer = kFALSE;
+ fSlotID = 0;
+ fEventWords = 0;
+ fDRMID = 0;
+ fLocalEventCounter = 0;
+ fPartecipatingSlotID = 0;
+ fCBit = 0;
+ fVersID = 0;
+ fDRMhSize = 0;
+ fSlotEnableMask = 0;
+ fFaultID = 0;
+ fRTOBit = 0;
+ fL0BCID = 0;
+ fRunTimeInfo = 0;
+ fTemperature = 0;
+ fACKBit = 0;
+ fSensAD = 0;
+ fEventCRC = 0;
+ fDecoderCRC = 0;
+ fDecoderSlotEnableMask = 0;
+ fLTMSummaryData->Reset();
+ for (Int_t iTRM = 0; iTRM < N_TRM; iTRM++)
+ fTRMSummaryData[iTRM]->Reset();
+}
--- /dev/null
+#ifndef ALITOFDRMSUMMARYDATA_H
+#define ALITOFDRMSUMMARYDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a summary for DRM data. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "AliTOFLTMSummaryData.h"
+#include "AliTOFTRMSummaryData.h"
+
+#define N_TRM 10
+class AliTOFDRMSummaryData : public TObject
+{
+ public:
+ AliTOFDRMSummaryData(); //default contructor
+ AliTOFDRMSummaryData(const AliTOFDRMSummaryData &source); //copy contructor
+ AliTOFDRMSummaryData &operator = (const AliTOFDRMSummaryData &source); //operator =
+ virtual ~AliTOFDRMSummaryData(); //destructor
+ /* getters */
+ Bool_t GetHeader() const {return fHeader;}; //get header
+ Bool_t GetTrailer() const {return fTrailer;}; //get trailer
+ UShort_t GetSlotID() const {return fSlotID;}; //get slot ID
+ UInt_t GetEventWords() const {return fEventWords;}; //get event words
+ UShort_t GetDRMID() const {return fDRMID;}; //get DRM ID
+ UShort_t GetLocalEventCounter() const {return fLocalEventCounter;}; //get local event counter
+ UShort_t GetPartecipatingSlotID() const {return fPartecipatingSlotID;}; //get partecipating slot ID
+ UShort_t GetCBit() const {return fCBit;}; //get C bit
+ UShort_t GetVersID() const {return fVersID;}; //get vers ID
+ UShort_t GetDRMhSize() const {return fDRMhSize;}; //get DRM header size
+ UShort_t GetSlotEnableMask() const {return fSlotEnableMask;}; //get slot enable mask
+ UShort_t GetFaultID() const {return fFaultID;}; //get fault ID
+ UShort_t GetRTOBit() const {return fRTOBit;}; //get RTO bit
+ UShort_t GetL0BCID() const {return fL0BCID;}; //get L0 bunch ID
+ UShort_t GetRunTimeInfo() const {return fRunTimeInfo;}; //get run time info
+ UShort_t GetTemperature() const {return fTemperature;}; //get temperature
+ UShort_t GetACKBit() const {return fACKBit;}; //get ACK bit
+ UShort_t GetSensAD() const {return fSensAD;}; //get sens AD
+ UInt_t GetEventCRC() const {return fEventCRC;}; //get event CRC
+ UInt_t GetDecoderCRC() const {return fDecoderCRC;}; //get decoder CRC
+ UShort_t GetDecoderSlotEnableMask() const {return fDecoderSlotEnableMask;}; //get decoder slot enable mask
+ UShort_t GetDecoderSlotEnableMaskBit(UInt_t iBit) const {return fDecoderSlotEnableMask & (1 << iBit);}; //get decoder slot enable mask bit
+ AliTOFLTMSummaryData *GetLTMSummaryData() const {return fLTMSummaryData;}; //get LTM summary data
+ AliTOFTRMSummaryData *GetTRMSummaryData(Int_t TRM) const {return TRM < N_TRM ? fTRMSummaryData[TRM] : 0x0;}; //get TRM summary data
+ /* setters */
+ void SetHeader(Bool_t Header) {fHeader = Header;}; //set header
+ void SetTrailer(Bool_t Trailer) {fTrailer = Trailer;}; //set trailer
+ void SetSlotID(UShort_t SlotID) {fSlotID = SlotID;}; //set slot ID
+ void SetEventWords(UInt_t EventWords) {fEventWords = EventWords;}; //set event words
+ void SetDRMID(UShort_t DRMID) {fDRMID = DRMID;}; //set DRM ID
+ void SetLocalEventCounter(UShort_t LocalEventCounter) {fLocalEventCounter = LocalEventCounter;}; //set local event counter
+ void SetPartecipatingSlotID(UShort_t PartecipatingSlotID) {fPartecipatingSlotID = PartecipatingSlotID;}; //set partecipating slot ID
+ void SetCBit(UShort_t CBit) {fCBit = CBit;}; //set C bit
+ void SetVersID(UShort_t VersID) {fVersID = VersID;}; //set vers ID
+ void SetDRMhSize(UShort_t DRMhSize) {fDRMhSize = DRMhSize;}; //set DRM header size
+ void SetSlotEnableMask(UShort_t SlotEnableMask) {fSlotEnableMask = SlotEnableMask;}; //set slot enable mask
+ void SetFaultID(UShort_t FaultID) {fFaultID = FaultID;}; //set fault ID
+ void SetRTOBit(UShort_t RTOBit) {fRTOBit = RTOBit;}; //set RTO bit
+ void SetL0BCID(UShort_t L0BCID) {fL0BCID = L0BCID;}; //set L0 bunch ID
+ void SetRunTimeInfo(UShort_t RunTimeInfo) {fRunTimeInfo = RunTimeInfo;}; //set run time info
+ void SetTemperature(UShort_t Temperature) {fTemperature = Temperature;}; //set temperature
+ void SetACKBit(UShort_t ACKBit) {fACKBit = ACKBit;}; //set ACK bit
+ void SetSensAD(UShort_t SensAD) {fSensAD = SensAD;}; //set sens ID
+ void SetEventCRC(UInt_t EventCRC) {fEventCRC = EventCRC;}; //set event CRC
+ void SetDecoderCRC(UInt_t DecoderCRC) {fDecoderCRC = DecoderCRC;}; //set decoder CRC
+ void SetDecoderSlotEnableMask(UShort_t DecoderSlotEnableMask) {fDecoderSlotEnableMask = DecoderSlotEnableMask;}; //set decoder slot enable mask
+ void SetDecoderSlotEnableMaskBit(UInt_t iBit) {fDecoderSlotEnableMask |= (1 << iBit);}; //get decoder slot enable mask
+ /* methods */
+ void Reset(); //reset
+ private:
+ Bool_t fHeader; //header
+ Bool_t fTrailer; //trailer
+ UShort_t fSlotID; //slot ID
+ UInt_t fEventWords; //event words
+ UShort_t fDRMID; //DRM ID
+ UShort_t fLocalEventCounter; //local event counter
+ UShort_t fPartecipatingSlotID; //partecipating slot ID
+ UShort_t fCBit; //C bit
+ UShort_t fVersID; //vers ID
+ UShort_t fDRMhSize; //DRM header size
+ UShort_t fSlotEnableMask; //slot enable mask
+ UShort_t fFaultID; //fault ID
+ UShort_t fRTOBit; //RTO bit
+ UShort_t fL0BCID; //L0 bunch ID
+ UShort_t fRunTimeInfo; //run time info
+ UShort_t fTemperature; //temperature
+ UShort_t fACKBit; //ACK bit
+ UShort_t fSensAD; //sens ID
+ UInt_t fEventCRC; //event CRC
+ UInt_t fDecoderCRC; //decoder CRC
+ UShort_t fDecoderSlotEnableMask; //decoder slot enable mask
+ AliTOFLTMSummaryData *fLTMSummaryData; //LTM summary data
+ AliTOFTRMSummaryData *fTRMSummaryData[N_TRM]; //TRM summary data
+
+ ClassDef(AliTOFDRMSummaryData, 1);
+};
+
+#endif /* ALITOFDRMSUMMARYDATA_H */
--- /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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This classes provide decoder summaries for data. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFDecoderSummaryData.h"
+
+ClassImp(AliTOFDecoderSummaryData)
+
+AliTOFDecoderSummaryData::AliTOFDecoderSummaryData() :
+ TObject(),
+ fRunNumber(0),
+ fEventNumber(0),
+ fEquipmentID(0),
+ fInputWords(0),
+ fDecodedWords(0),
+ fDecoderStatus(0),
+ fErrorDetected(kFALSE),
+ fErrorSlotID(0),
+ fCurrentDRMID(0),
+ fCurrentSlotID(0),
+ fCurrentChain(0),
+ fV2718Patch(kFALSE),
+ fRecoverError(kFALSE),
+ fRecoveringError(kFALSE),
+ fSpider(kFALSE),
+ fDRMSummaryData(0x0)
+{
+ /* default constructor */
+ fDRMSummaryData = new AliTOFDRMSummaryData();
+}
+
+//_________________________________________________________________
+
+AliTOFDecoderSummaryData::AliTOFDecoderSummaryData(const AliTOFDecoderSummaryData &source) :
+ TObject(),
+ fRunNumber(source.fRunNumber),
+ fEventNumber(source.fEventNumber),
+ fEquipmentID(source.fEquipmentID),
+ fInputWords(source.fInputWords),
+ fDecodedWords(source.fDecodedWords),
+ fDecoderStatus(source.fDecoderStatus),
+ fErrorDetected(source.fErrorDetected),
+ fErrorSlotID(source.fErrorSlotID),
+ fCurrentDRMID(source.fCurrentDRMID),
+ fCurrentSlotID(source.fCurrentSlotID),
+ fCurrentChain(source.fCurrentChain),
+ fV2718Patch(source.fV2718Patch),
+ fRecoverError(source.fRecoverError),
+ fRecoveringError(source.fRecoveringError),
+ fSpider(kFALSE),
+ fDRMSummaryData(0x0)
+{
+ /* copy constructor */
+ fDRMSummaryData = new AliTOFDRMSummaryData(*source.fDRMSummaryData);
+}
+
+//_________________________________________________________________
+
+AliTOFDecoderSummaryData &
+AliTOFDecoderSummaryData::operator = (const AliTOFDecoderSummaryData &source)
+{
+ /* operator = */
+ fRunNumber = source.fRunNumber;
+ fEventNumber = source.fEventNumber;
+ fEquipmentID = source.fEquipmentID;
+ fInputWords = source.fInputWords;
+ fDecodedWords = source.fDecodedWords;
+ fDecoderStatus = source.fDecoderStatus;
+ fErrorDetected = source.fErrorDetected;
+ fErrorSlotID = source.fErrorSlotID;
+ fCurrentDRMID = source.fCurrentDRMID;
+ fCurrentSlotID = source.fCurrentSlotID;
+ fCurrentChain = source.fCurrentChain;
+ fV2718Patch = source.fV2718Patch;
+ fRecoverError = source.fRecoverError;
+ fRecoveringError = source.fRecoveringError;
+ fSpider = source.fSpider;
+ *fDRMSummaryData = *source.fDRMSummaryData;
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFDecoderSummaryData::~AliTOFDecoderSummaryData()
+{
+ /* default destructor */
+ delete fDRMSummaryData;
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderSummaryData::Reset()
+{
+ /* reset function */
+ fRunNumber = 0;
+ fEventNumber = 0;
+ fEquipmentID = 0;
+ fInputWords = 0;
+ fDecodedWords = 0;
+ fDecoderStatus = 0;
+ fErrorDetected = kFALSE;
+ fErrorSlotID = 0;
+ fCurrentDRMID = 0;
+ fCurrentSlotID = 0;
+ fCurrentChain = 0;
+ fV2718Patch = kFALSE;
+ fRecoverError = kFALSE;
+ fRecoveringError = kFALSE;
+ fSpider = kFALSE;
+ fDRMSummaryData->Reset();
+}
+
--- /dev/null
+#ifndef ALITOFDECODERSUMMARYDATA_H
+#define ALITOFDECODERSUMMARYDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a summary for decoder data. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "AliTOFDRMSummaryData.h"
+
+//decoder summary data
+class AliTOFDecoderSummaryData : public TObject
+{
+ public:
+ AliTOFDecoderSummaryData(); //default contructor
+ AliTOFDecoderSummaryData(const AliTOFDecoderSummaryData &source); //copy contructor
+ AliTOFDecoderSummaryData &operator = (const AliTOFDecoderSummaryData &source); //operator =
+ virtual ~AliTOFDecoderSummaryData(); //destructor
+ /* getters */
+ UInt_t GetRunNumber() const {return fRunNumber;}; //get run number
+ UInt_t GetEventNumber() const {return fEventNumber;}; //get event number
+ UInt_t GetEquipmentID() const {return fEquipmentID;}; //get equipment ID
+ UInt_t GetInputWords() const {return fInputWords;}; //get input words
+ UInt_t GetDecodedWords() const {return fDecodedWords;}; //get decoded words
+ UShort_t GetDecoderStatus() const {return fDecoderStatus;}; //get decoder status
+ Bool_t GetErrorDetected() const {return fErrorDetected;}; //get error detected
+ UShort_t GetErrorSlotID() const {return fErrorSlotID;}; // get error slot id
+ UShort_t GetCurrentDRMID() const {return fCurrentDRMID;}; //get current DRM ID
+ UShort_t GetCurrentSlotID() const {return fCurrentSlotID;}; //get current slot ID
+ UShort_t GetCurrentChain() const {return fCurrentChain;}; //get current chain
+ Bool_t GetV2718Patch() const {return fV2718Patch;}; //get V2718 patch
+ Bool_t GetRecoverError() const {return fRecoverError;}; //get recover error
+ Bool_t GetRecoveringError() const {return fRecoveringError;}; //get recovering error
+ Bool_t GetSpider() const {return fSpider;}; //get spider flag
+ AliTOFDRMSummaryData *GetDRMSummaryData() const {return fDRMSummaryData;}; //get DRM summary data
+ /* setters */
+ void SetRunNumber(UInt_t RunNumber) {fRunNumber = RunNumber;}; //set run number
+ void SetEventNumber(UInt_t EventNumber) {fEventNumber = EventNumber;}; //set event number
+ void SetEquipmentID(UInt_t EquipmentID) {fEquipmentID = EquipmentID;}; //set equipment ID
+ void SetInputWords(UInt_t InputWords) {fInputWords = InputWords;}; //set input words
+ void SetDecodedWords(UInt_t DecodedWords) {fDecodedWords = DecodedWords;}; //set decoded words
+ void SetDecoderStatus(UShort_t DecoderStatus) {fDecoderStatus = DecoderStatus;}; //set decoder status
+ void SetErrorDetected(Bool_t ErrorDetected) {fErrorDetected = ErrorDetected;}; //set error detected
+ void SetErrorSlotID(UShort_t value) {fErrorSlotID |= 1<< value;}; // set error slot id
+ void SetCurrentDRMID(UShort_t CurrentDRMID) {fCurrentDRMID = CurrentDRMID;}; //set current DRM ID
+ void SetCurrentSlotID(UShort_t CurrentSlotID) {fCurrentSlotID = CurrentSlotID;}; //set current slot ID
+ void SetCurrentChain(UShort_t CurrentChain) {fCurrentChain = CurrentChain;}; //set current chain
+ void SetV2718Patch(Bool_t V2718Patch) {fV2718Patch = V2718Patch;}; //set V2718 patch
+ void SetRecoverError(Bool_t RecoverError) {fRecoverError = RecoverError;}; //set recover error
+ void SetRecoveringError(Bool_t RecoveringError) {fRecoveringError = RecoveringError;}; //set recovering error
+ void SetSpider(Bool_t Spider) {fSpider = Spider;}; //set spider flag
+ /* methods */
+ void Reset(); //reset
+ private:
+ UInt_t fRunNumber; //run number
+ UInt_t fEventNumber; //event number
+ UInt_t fEquipmentID; //equipment ID
+ UInt_t fInputWords; //input words
+ UInt_t fDecodedWords; //decoded words
+ UShort_t fDecoderStatus; //decoder status
+ Bool_t fErrorDetected; //error detected
+ UShort_t fErrorSlotID; //error slot ID
+ UShort_t fCurrentDRMID; //current DRM ID
+ UShort_t fCurrentSlotID; //current slot ID
+ UShort_t fCurrentChain; //current chain
+ Bool_t fV2718Patch; //V2718 patch
+ Bool_t fRecoverError; //recover error
+ Bool_t fRecoveringError; //recoverisng error
+ Bool_t fSpider; //spider flag
+ AliTOFDRMSummaryData *fDRMSummaryData; //DRM summary data
+
+ ClassDef(AliTOFDecoderSummaryData, 1);
+};
+
+#endif /* ALITOFDECODERSUMMARYDATA */
--- /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. *
+***************************************************************************/
+
+/*
+$Log: AliTOFDecoder.cxx,v $
+Revision 1.4 2007/05/18 13:08:57 decaro
+Coding convention: RS1 violation -> suppression
+
+Revision 1.3 2007/05/08 11:56:05 arcelli
+improved verbosity in verbose mode (R.Preghenella)
+
+Revision 1.2 2007/05/03 11:34:43 decaro
+Coding convention: RS1 violation -> suppression
+
+Revision 1.1 2007/04/27 11:00:32 arcelli
+TOF Raw Data decoder
+
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// Class for raw data decoding //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+
+#include "AliLog.h"
+#include "AliTOFDecoderV2.h"
+#include "AliTOFTDCHit.h"
+
+ClassImp(AliTOFDecoderV2)
+
+//_________________________________________________________________
+
+AliTOFDecoderV2::AliTOFDecoderV2(AliRawReader *reader) :
+ TObject(),
+ fRawReader(reader),
+ fVerbose(kFALSE),
+ fLogErrors(kTRUE),
+ fV2718Patch(kFALSE),
+ fRecoverError(kTRUE),
+ fRecoverErrorThr(0),
+ fSpider(kTRUE),
+ fRunNumber(0),
+ fEventNumber(0),
+ fEquipmentID(0),
+ fDecoderSummaryData(0x0),
+ fDRMSummaryData(0x0),
+ fLTMSummaryData(0x0),
+ fTRMSummaryData(0x0),
+ fChainSummaryData(0x0),
+ fTDCHitBuffer(0x0),
+ fTDCPackedHitBuffer(0x0),
+ fTDCErrorBuffer(0x0),
+ fDRMGlobalHeader(0x0),
+ fDRMGlobalTrailer(0x0),
+ fDRMStatusHeader1(0x0),
+ fDRMStatusHeader2(0x0),
+ fDRMStatusHeader3(0x0),
+ fDRMStatusHeader4(0x0),
+ fDRMEventCRC(0x0),
+ fLTMGlobalHeader(0x0),
+ fLTMGlobalTrailer(0x0),
+ fLTMPDLData(0x0),
+ fLTMADCData(0x0),
+ fLTMORData(0x0),
+ fTRMGlobalHeader(0x0),
+ fTRMGlobalTrailer(0x0),
+ fTRMChainHeader(0x0),
+ fTRMChainTrailer(0x0),
+ fTDCPackedHit(0x0),
+ fTDCUnpackedHit(0x0),
+ fTRMTDCError(0x0),
+ fTRMDiagnosticErrorWord1(0x0),
+ fTRMDiagnosticErrorWord2(0x0),
+ fSpiderTDCID(-1),
+ fSpiderTDCPackedHitBuffer(0x0)
+{
+ //default constructor
+ if (fRawReader)
+ fRawReader->Select("TOF", 0, 71);
+
+ fDecoderSummaryData = new AliTOFDecoderSummaryData();
+
+ for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++)
+ fSpiderBufferFull[iChan] = kFALSE;
+}
+
+//_________________________________________________________________
+
+AliTOFDecoderV2::AliTOFDecoderV2(const AliTOFDecoderV2 &source) :
+ TObject(),
+ fRawReader(source.fRawReader),
+ fVerbose(source.fVerbose),
+ fLogErrors(source.fLogErrors),
+ fV2718Patch(source.fV2718Patch),
+ fRecoverError(source.fRecoverError),
+ fRecoverErrorThr(source.fRecoverErrorThr),
+ fSpider(source.fSpider),
+ fRunNumber(source.fRunNumber),
+ fEventNumber(source.fEventNumber),
+ fEquipmentID(source.fEquipmentID),
+ fDecoderSummaryData(0x0),
+ fDRMSummaryData(0x0),
+ fLTMSummaryData(0x0),
+ fTRMSummaryData(0x0),
+ fChainSummaryData(0x0),
+ fTDCHitBuffer(0x0),
+ fTDCPackedHitBuffer(0x0),
+ fTDCErrorBuffer(0x0),
+ fDRMGlobalHeader(0x0),
+ fDRMGlobalTrailer(0x0),
+ fDRMStatusHeader1(0x0),
+ fDRMStatusHeader2(0x0),
+ fDRMStatusHeader3(0x0),
+ fDRMStatusHeader4(0x0),
+ fDRMEventCRC(0x0),
+ fLTMGlobalHeader(0x0),
+ fLTMGlobalTrailer(0x0),
+ fLTMPDLData(0x0),
+ fLTMADCData(0x0),
+ fLTMORData(0x0),
+ fTRMGlobalHeader(0x0),
+ fTRMGlobalTrailer(0x0),
+ fTRMChainHeader(0x0),
+ fTRMChainTrailer(0x0),
+ fTDCPackedHit(0x0),
+ fTDCUnpackedHit(0x0),
+ fTRMTDCError(0x0),
+ fTRMDiagnosticErrorWord1(0x0),
+ fTRMDiagnosticErrorWord2(0x0),
+ fSpiderTDCID(-1),
+ fSpiderTDCPackedHitBuffer(0x0)
+{
+ //copy constructor
+ fDecoderSummaryData = new AliTOFDecoderSummaryData(*source.fDecoderSummaryData);
+
+ for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++)
+ fSpiderBufferFull[iChan] = kFALSE;
+}
+
+//_________________________________________________________________
+
+AliTOFDecoderV2 &
+AliTOFDecoderV2::operator = (const AliTOFDecoderV2 &source)
+{
+ //operator =
+ fRawReader = source.fRawReader;
+ fVerbose = source.fVerbose;
+ fLogErrors = source.fLogErrors;
+ fV2718Patch = source.fV2718Patch;
+ fRecoverError = source.fRecoverError;
+ fRecoverErrorThr = source.fRecoverErrorThr;
+ fSpider = source.fSpider;
+ fRunNumber = source.fRunNumber;
+ fEventNumber = source.fEventNumber;
+ fEquipmentID = source.fEquipmentID;
+ *fDecoderSummaryData = *source.fDecoderSummaryData;
+ return *this;
+}
+
+AliTOFDecoderV2::~AliTOFDecoderV2()
+{
+ delete fDecoderSummaryData;
+}
+
+//_________________________________________________________________
+
+Bool_t
+AliTOFDecoderV2::Decode(UInt_t *rawData, UInt_t nWords)
+{
+ /* main decoding routine.
+ * it loops over nWords 32-bit words
+ * starting at *rawData and decodes them.
+ * it also fills some buffers in order to
+ * have the decoded data available for other
+ * classes.
+ */
+
+ //reset decoder summary data
+ fDecoderSummaryData->Reset();
+
+ //fill decoder summary data
+ fDecoderSummaryData->SetRunNumber(fRunNumber);
+ fDecoderSummaryData->SetEventNumber(fEventNumber);
+ fDecoderSummaryData->SetEquipmentID(fEquipmentID);
+ fDecoderSummaryData->SetInputWords(nWords);
+ fDecoderSummaryData->SetRecoverError(fRecoverError);
+ fDecoderSummaryData->SetSpider(fSpider);
+
+ AliTOFTDCHit hit;
+ AliTOFTDCError error;
+
+ //decoder status
+ UShort_t decoderStatus = 0x0;
+
+ //CRC variables
+ UInt_t DRMCRC = 0x0;
+ UInt_t LTMCRC = 0x0;
+ UInt_t TRMCRC = 0x0;
+
+ // error warning counter
+ Int_t errorWarning = 0;
+
+ if (fRecoverError && fVerbose)
+ AliInfo("Recover error option enabled: potentially dangerous!");
+
+ /*** V2718 patch ***/
+ if (fV2718Patch){
+ decoderStatus = decoderStatus | DRM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ fDecoderSummaryData->SetCurrentDRMID(0x0);
+ fDecoderSummaryData->SetV2718Patch(kTRUE);
+ fDRMSummaryData = fDecoderSummaryData->GetDRMSummaryData();
+ fDRMSummaryData->SetHeader(kTRUE);
+ fDRMSummaryData->SetDRMID(0x0);
+ if (fVerbose)
+ AliInfo("DRM not present: - V2718 patch decoding -");
+ }
+ /*** V2718 patch ***/
+
+ if (fVerbose)
+ AliInfo("Start decoding");
+
+ if (fVerbose)
+ AliInfo("Loop over the data and decode");
+
+ if (fVerbose)
+ AliInfo(" St Hex Word \t Decoded Word");
+
+ //loop over raw data
+ for (UInt_t iWord = 0;
+ iWord < nWords;
+ iWord++, rawData++, fDecoderSummaryData->SetDecodedWords(iWord)){
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError() && fVerbose)
+ AliInfo(Form(" %02x - 0x%08x",decoderStatus,*rawData));
+
+ //compute CRC with current data
+ DRMCRC ^= *rawData;
+ LTMCRC ^= *rawData;
+ TRMCRC ^= *rawData;
+
+ //switch word type
+ switch (*rawData & WORD_TYPE_MASK){
+
+ case GLOBAL_HEADER:
+
+ //switch slot ID
+ switch (*rawData & SLOT_ID_MASK){
+
+ //DRM global header (slotID=1)
+ case 1:
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != DRM_HEADER_STATUS ){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected DRM global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set DRM global header
+ fDRMGlobalHeader = (AliTOFDRMGlobalHeader *)rawData;
+ //reset DRM CRC
+ DRMCRC = 0x0;
+ //fill decoder summary data
+ fDecoderSummaryData->SetCurrentDRMID(fDRMGlobalHeader->GetDRMID());
+ fDecoderSummaryData->SetCurrentSlotID(fDRMGlobalHeader->GetSlotID());
+ //get DRM summary data
+ fDRMSummaryData = fDecoderSummaryData->GetDRMSummaryData();
+ //reset DRM summary data
+ fDRMSummaryData->Reset();
+ //fill DRM summary data
+ FillDRMSummaryData(fDRMGlobalHeader);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t DRM global header",decoderStatus,*rawData));
+ //change decode status
+ decoderStatus = decoderStatus | DRM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ //decode DRM status headers
+ for (Int_t i = 0; i < DRM_STATUS_HEADER_WORDS; i++){
+ iWord++;
+ rawData++;
+ DRMCRC ^= *rawData;
+
+ switch (i){
+ case 0: //DRM status header 1
+ fDRMStatusHeader1 = (AliTOFDRMStatusHeader1 *)rawData;
+ FillDRMSummaryData(fDRMStatusHeader1);
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t DRM status header 1",decoderStatus,*rawData));
+ break;
+ case 1: //DRM status header 2
+ fDRMStatusHeader2 = (AliTOFDRMStatusHeader2 *)rawData;
+ FillDRMSummaryData(fDRMStatusHeader2);
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t DRM status header 2",decoderStatus,*rawData));
+ break;
+ case 2: //DRM status header 3
+ fDRMStatusHeader3 = (AliTOFDRMStatusHeader3 *)rawData;
+ FillDRMSummaryData(fDRMStatusHeader3);
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t DRM status header 3",decoderStatus,*rawData));
+ break;
+ case 3: //DRM status header 4
+ fDRMStatusHeader4 = (AliTOFDRMStatusHeader4 *)rawData;
+ FillDRMSummaryData(fDRMStatusHeader4);
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t DRM status header 4",decoderStatus,*rawData));
+ break;
+ }
+ }
+ //decode DRM event CRC
+ iWord++;
+ rawData++;
+ DRMCRC ^= *rawData;
+ //remove DRM event CRC from DRM CRC
+ DRMCRC ^= *rawData;
+ fDRMEventCRC = (AliTOFDRMEventCRC *)rawData;
+ FillDRMSummaryData(fDRMEventCRC);
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t DRM event CRC",decoderStatus,*rawData));
+ break;
+
+ //LTM global header (slotID=2)
+ case 2:
+ //recover error
+ if (fDecoderSummaryData->GetRecoveringError()){
+ //change decode status
+ decoderStatus = LTM_HEADER_STATUS;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ fDecoderSummaryData->SetRecoveringError(kFALSE);
+ if (fVerbose)
+ AliInfo("LTM global header found: error probably recovered");
+ }
+ //check decode status
+ if ( decoderStatus != LTM_HEADER_STATUS ){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected LTM global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set LTM global header
+ fLTMGlobalHeader = (AliTOFLTMGlobalHeader *)rawData;
+ //reset LTM CRC
+ LTMCRC = 0x0;
+ //fill decoder summary data
+ fDecoderSummaryData->SetCurrentSlotID(fLTMGlobalHeader->GetSlotID());
+ //get LTM summary data
+ fLTMSummaryData = fDRMSummaryData->GetLTMSummaryData();
+ //reset LTM summary data
+ fLTMSummaryData->Reset();
+ //fill LTM summary data
+ FillLTMSummaryData(fLTMGlobalHeader);
+ //set DRM slot enable mask bit
+ fDRMSummaryData->SetDecoderSlotEnableMaskBit(fLTMGlobalHeader->GetSlotID() - 2);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t LTM global header",decoderStatus,*rawData));
+ //change decode status
+ decoderStatus = decoderStatus | LTM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+
+ //decode LTM PDL data
+ for (Int_t iPDLWord = 0; iPDLWord < LTM_PDL_DATA_WORDS; iPDLWord++){
+ iWord++;
+ rawData++;
+ DRMCRC ^= *rawData;
+ LTMCRC ^= *rawData;
+ //set LTM PDL data
+ fLTMPDLData = (AliTOFLTMPDLData *)rawData;
+ //fill LTM summary data
+ FillLTMSummaryData(fLTMPDLData, iPDLWord);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t LTM PDL data \t\t PDL1=%03d PDL2=%03d PDL3=%03d PDL4=%03d",decoderStatus,*rawData,fLTMPDLData->GetPDLValue1(),fLTMPDLData->GetPDLValue2(),fLTMPDLData->GetPDLValue3(),fLTMPDLData->GetPDLValue4()));
+ }
+ //decode LTM ADC data
+ for (Int_t iADCWord = 0; iADCWord < LTM_ADC_DATA_WORDS; iADCWord++){
+ iWord++;
+ rawData++;
+ DRMCRC ^= *rawData;
+ LTMCRC ^= *rawData;
+ //set LTM ADC data
+ fLTMADCData = (AliTOFLTMADCData *)rawData;
+ //fill LTM summary data
+ FillLTMSummaryData(fLTMADCData, iADCWord);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t LTM ADC data \t\t ADC1=%04d ADC2=%04d ADC3=%04d",decoderStatus,*rawData,fLTMADCData->GetADCValue1(),fLTMADCData->GetADCValue2(),fLTMADCData->GetADCValue3()));
+ }
+ //decode LTM OR data
+ for (Int_t iORWord = 0; iORWord < LTM_OR_DATA_WORDS; iORWord++){
+ iWord++;
+ rawData++;
+ DRMCRC ^= *rawData;
+ LTMCRC ^= *rawData;
+ //set LTM OR data
+ fLTMORData = (AliTOFLTMORData *)rawData;
+ //fill LTM summary data
+ FillLTMSummaryData(fLTMORData, iORWord);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t LTM OR data \t\t ADC1=%04d ADC2=%04d ADC3=%04d",decoderStatus,*rawData,fLTMORData->GetORValue1(),fLTMORData->GetORValue2(),fLTMORData->GetORValue3()));
+ }
+ break;
+
+ //TRM global header (slotID=3-12)
+ case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12:
+ //recover error
+ if (fDecoderSummaryData->GetRecoveringError()){
+ //change decode status
+ decoderStatus = TRM_HEADER_STATUS;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ fDecoderSummaryData->SetRecoveringError(kFALSE);
+ if (fVerbose)
+ AliInfo("TRM global header found: error probably recovered");
+ }
+ //check decode status
+ if ( decoderStatus != TRM_HEADER_STATUS ){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set TRM global header
+ fTRMGlobalHeader = (AliTOFTRMGlobalHeader *)rawData;
+ //reset TRM CRC
+ TRMCRC = 0x0;
+ //fill decoder summary data
+ fDecoderSummaryData->SetCurrentSlotID(fTRMGlobalHeader->GetSlotID());
+ //get TRM summary data
+ fTRMSummaryData = fDRMSummaryData->GetTRMSummaryData(fTRMGlobalHeader->GetSlotID() - TRM_FIRST_SLOT_ID);
+ //reset TRM summary data
+ fTRMSummaryData->Reset();
+ //fill TRM summary data
+ FillTRMSummaryData(fTRMGlobalHeader);
+ //set DRM slot enable mask bit
+ fDRMSummaryData->SetDecoderSlotEnableMaskBit(fTRMGlobalHeader->GetSlotID() - 2);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t TRM global header \t slotID=%02d ACQ=%01d L=%01d",decoderStatus,*rawData,fTRMGlobalHeader->GetSlotID(),fTRMGlobalHeader->GetACQBits(),fTRMGlobalHeader->GetLBit()));
+ //change decode status
+ decoderStatus = decoderStatus | TRM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ break;
+
+ default:
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Not valid slotID in global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ break;
+
+ }
+ //end switch slotID
+ break;
+
+ case GLOBAL_TRAILER:
+
+ //switch slot ID
+ switch (*rawData & SLOT_ID_MASK){
+
+ //DRM global trailer (slotID=1)
+ case 1:
+ //recover error
+ if (fDecoderSummaryData->GetRecoveringError()){
+ //change decode status
+ decoderStatus = DRM_TRAILER_STATUS;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ fDecoderSummaryData->SetRecoveringError(kFALSE);
+ if (fVerbose)
+ AliInfo("DRM global trailer found: error probably recovered");
+ }
+ //check decode status
+ if ( decoderStatus != DRM_TRAILER_STATUS ){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected DRM global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set DRM global trailer
+ fDRMGlobalTrailer = (AliTOFDRMGlobalTrailer *)rawData;
+ //remove global trailer from DRM CRC
+ DRMCRC ^= *rawData;
+ //fill DRM summary data
+ FillDRMSummaryData(fDRMGlobalTrailer);
+ fDRMSummaryData->SetDecoderCRC(COMPUTE_DRM_CRC(DRMCRC));
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t DRM global trailer",decoderStatus,*rawData));
+ //change decode status
+ decoderStatus = decoderStatus & ~DRM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ break;
+
+ //LTM global trailer (slotID=2)
+ case 2:
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != LTM_TRAILER_STATUS ){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected LTM global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set LTM global trailer
+ fLTMGlobalTrailer = (AliTOFLTMGlobalTrailer *)rawData;
+ //remove global trailer from LTM CRC
+ LTMCRC ^= *rawData;
+ //fill LTM summary data
+ FillLTMSummaryData(fLTMGlobalTrailer);
+ fLTMSummaryData->SetDecoderCRC(COMPUTE_LTM_CRC(LTMCRC));
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t LTM global trailer",decoderStatus,*rawData));
+ //change decode status
+ decoderStatus = decoderStatus & ~LTM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ break;
+
+ //TRM global trailer (slotID=15)
+ case 15:
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != TRM_TRAILER_STATUS ){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set TRM global trailer
+ fTRMGlobalTrailer = (AliTOFTRMGlobalTrailer *)rawData;
+ //remove global trailer from TRM CRC
+ TRMCRC ^= *rawData;
+ //fill TRM summary data
+ FillTRMSummaryData(fTRMGlobalTrailer);
+ fTRMSummaryData->SetDecoderCRC(COMPUTE_TRM_CRC(TRMCRC));
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t TRM global trailer \t CRC=%04d eventCounter=%04d",decoderStatus,*rawData,fTRMGlobalTrailer->GetEventCRC(),fTRMGlobalTrailer->GetEventCounter()));
+ //change decode status
+ decoderStatus = decoderStatus & ~TRM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ break;
+
+ default:
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Not valid slotID/pattern in global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ break;
+ }
+ break;
+
+ case CHAIN_A_HEADER:
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != CHAIN_A_HEADER_STATUS && !fDecoderSummaryData->GetRecoveringError() ){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain A header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set TRM chain header
+ fTRMChainHeader = (AliTOFTRMChainHeader *)rawData;
+ //fill decoder summary data
+ fDecoderSummaryData->SetCurrentChain(0);
+ //get chain summary data
+ fChainSummaryData = fTRMSummaryData->GetChainSummaryData(0);
+ //reset chain summary data
+ fChainSummaryData->Reset();
+ //fill chain summary data
+ FillChainSummaryData(fTRMChainHeader);
+ //get tdc hit buffer
+ fTDCHitBuffer = fChainSummaryData->GetTDCHitBuffer();
+ //reset tdc hit buffer
+ fTDCHitBuffer->Reset();
+ //get tdc packed hit buffer
+ fTDCPackedHitBuffer = fChainSummaryData->GetTDCPackedHitBuffer();
+ //reset tdc packed hit buffer
+ fTDCPackedHitBuffer->Reset();
+ //get tdc error buffer
+ fTDCErrorBuffer = fChainSummaryData->GetTDCErrorBuffer();
+ //reset tdc error buffer
+ fTDCErrorBuffer->Reset();
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t TRM chain A header \t chain=%01d bunchID=%04d",decoderStatus,*rawData,0,fTRMChainHeader->GetBunchID()));
+ //change decode status
+ decoderStatus = decoderStatus | CHAIN_A_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ //reset spider
+ if (fSpider)
+ ResetSpider();
+ break;
+
+ case CHAIN_A_TRAILER:
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != CHAIN_A_TRAILER_STATUS && !fDecoderSummaryData->GetRecoveringError()){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain A trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set TRM chain trailer
+ fTRMChainTrailer = (AliTOFTRMChainTrailer *)rawData;
+ //fill chain summary data
+ FillChainSummaryData(fTRMChainTrailer);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t TRM chain A trailer",decoderStatus,*rawData));
+ //change decode status
+ decoderStatus = decoderStatus & ~CHAIN_A_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ break;
+
+ case CHAIN_B_HEADER:
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != CHAIN_B_HEADER_STATUS && !fDecoderSummaryData->GetRecoveringError()){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain B header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set TRM chain header
+ fTRMChainHeader = (AliTOFTRMChainHeader *)rawData;
+ //fill decoder summary data
+ fDecoderSummaryData->SetCurrentChain(1);
+ //get chain summary data
+ fChainSummaryData = fTRMSummaryData->GetChainSummaryData(1);
+ //reset chain summary data
+ fChainSummaryData->Reset();
+ //fill chain summary data
+ FillChainSummaryData(fTRMChainHeader);
+ //get tdc hit buffer
+ fTDCHitBuffer = fChainSummaryData->GetTDCHitBuffer();
+ //reset tdc hit buffer
+ fTDCHitBuffer->Reset();
+ //get tdc packed hit buffer
+ fTDCPackedHitBuffer = fChainSummaryData->GetTDCPackedHitBuffer();
+ //reset tdc packed hit buffer
+ fTDCPackedHitBuffer->Reset();
+ //get tdc error buffer
+ fTDCErrorBuffer = fChainSummaryData->GetTDCErrorBuffer();
+ //reset tdc error buffer
+ fTDCErrorBuffer->Reset();
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t TRM chain B header \t chain=%01d bunchID=%04d",decoderStatus,*rawData,1,fTRMChainHeader->GetBunchID()));
+ //change decode status
+ decoderStatus = decoderStatus | CHAIN_B_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ //reset spider
+ if (fSpider)
+ ResetSpider();
+ break;
+
+ case CHAIN_B_TRAILER:
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != CHAIN_B_TRAILER_STATUS && !fDecoderSummaryData->GetRecoveringError()){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain B trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+ //set TRM chain trailer
+ fTRMChainTrailer = (AliTOFTRMChainTrailer *)rawData;
+ //fill chain summary data
+ FillChainSummaryData(fTRMChainTrailer);
+ //print verbose
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t TRM chain B trailer",decoderStatus,*rawData));
+ //change decode status
+ decoderStatus = decoderStatus & ~CHAIN_B_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ break;
+
+ case ERROR:
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //decode TRM TDC error
+ fTRMTDCError = (AliTOFTRMTDCError *)rawData;
+ //check diagnostic word
+ if (fTRMTDCError->GetTDCID() == 15) {
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t Diagnostic error word",decoderStatus,*rawData));
+ break;
+ }
+ //set error data
+ error.SetErrorFlags(fTRMTDCError->GetErrorFlags());
+ error.SetTDCID(fTRMTDCError->GetTDCID());
+ //fill TDC error buffer
+ fTDCErrorBuffer->Add(error);
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t TDC error",decoderStatus,*rawData));
+ break;
+
+ case FILLER:
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ if (fVerbose)
+ AliInfo(Form(" %02x - 0x%08x \t Filler",decoderStatus,*rawData));
+ break;
+
+ default:
+
+ //try to recover error
+ if (fDecoderSummaryData->GetRecoveringError())
+ continue;
+ //check decode status
+ if ( decoderStatus != CHAIN_A_TDC_HIT_STATUS &&
+ decoderStatus != CHAIN_B_TDC_HIT_STATUS && !fDecoderSummaryData->GetRecoveringError()){
+ if (fLogErrors)
+ AliError(Form(" %02x - 0x%08x [ERROR] Unexpected or unknown word (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID()));
+ fDecoderSummaryData->SetErrorDetected(kTRUE);
+ fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID());
+ errorWarning++;
+ //try to recover error
+ if (fRecoverError){
+ if (errorWarning > fRecoverErrorThr) {
+ if (fVerbose)
+ AliInfo("Trying to recover the error: searching for the next header");
+ fDecoderSummaryData->SetRecoveringError(kTRUE);
+ continue;
+ }
+ else {
+ if (fVerbose)
+ AliInfo("Do not try to recover error yet, go on with decoding process");
+ continue;
+ }
+ }
+ return(fDecoderSummaryData->GetErrorDetected());
+ }
+ //decode status ok
+ errorWarning = 0;
+
+ //switch TRM ACQ
+ switch (fTRMSummaryData->GetACQBits()){
+
+ case PACKING_ENABLED_ACQ:
+ //decode TDC packed/unpacked hit
+ fTDCPackedHit = (AliTOFTDCPackedHit *)rawData;
+ fTDCUnpackedHit = (AliTOFTDCUnpackedHit *)rawData;
+ //set hit data
+ hit.SetChan(fTDCUnpackedHit->GetChan());
+ hit.SetTDCID(fTDCUnpackedHit->GetTDCID());
+ hit.SetEBit(fTDCUnpackedHit->GetEBit());
+ hit.SetPSBits(fTDCUnpackedHit->GetPSBits());
+ //switch PS bits
+ switch (hit.GetPSBits()){
+ //packed hit or overflow hit
+ case PACKED_HIT_PS: case TOT_OVF_HIT_PS:
+ hit.SetHitTime(fTDCPackedHit->GetHitTime());
+ hit.SetTOTWidth(fTDCPackedHit->GetTOTWidth());
+ //add hit
+ fTDCHitBuffer->Add(hit);
+ fTDCPackedHitBuffer->Add(hit);
+ break;
+ //orphane leading
+ case LEADING_HIT_PS:
+ hit.SetHitTime(fTDCUnpackedHit->GetHitTime());
+ hit.SetTOTWidth(0);
+ //add hit
+ fTDCHitBuffer->Add(hit);
+ fTDCPackedHitBuffer->Add(hit);
+ break;
+ //orphane trailing
+ case TRAILING_HIT_PS:
+ hit.SetHitTime(fTDCUnpackedHit->GetHitTime());
+ hit.SetTOTWidth(0);
+ //add hit
+ fTDCHitBuffer->Add(hit);
+ break;
+ }
+ //end switch PS bits
+ //print verbose
+ if (fVerbose)
+ switch (hit.GetPSBits()){
+ case PACKED_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [packed] \t PS=%1d TDC=%1d chan=%1d TOT=%3d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetTOTWidth(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ break;
+ case LEADING_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [orp.lead] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ break;
+ case TRAILING_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [orp.trai] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ break;
+ case TOT_OVF_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [TOT ovfl] \t PS=%1d TDC=%1d chan=%1d TOT=%3d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetTOTWidth(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ break;
+ }
+ break;
+
+ case LEADING_ONLY_ACQ: case TRAILING_ONLY_ACQ:
+ //decode TDC unpacked hit
+ fTDCUnpackedHit = (AliTOFTDCUnpackedHit *)rawData;
+ //set hit data
+ hit.SetChan(fTDCUnpackedHit->GetChan());
+ hit.SetTDCID(fTDCUnpackedHit->GetTDCID());
+ hit.SetEBit(fTDCUnpackedHit->GetEBit());
+ hit.SetPSBits(fTDCUnpackedHit->GetPSBits());
+ hit.SetHitTime(fTDCUnpackedHit->GetHitTime());
+ hit.SetTOTWidth(0);
+ //add hit
+ fTDCHitBuffer->Add(hit);
+ //print verbose
+ if (fVerbose)
+ switch (hit.GetPSBits()){
+ case LEADING_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [leading] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ break;
+ case TRAILING_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [trailing] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ }
+ break;
+
+ case PACKING_DISABLED_ACQ:
+ //decode TDC unpacked hit
+ fTDCUnpackedHit = (AliTOFTDCUnpackedHit *)rawData;
+ //set hit data
+ hit.SetChan(fTDCUnpackedHit->GetChan());
+ hit.SetTDCID(fTDCUnpackedHit->GetTDCID());
+ hit.SetEBit(fTDCUnpackedHit->GetEBit());
+ hit.SetPSBits(fTDCUnpackedHit->GetPSBits());
+ hit.SetHitTime(fTDCUnpackedHit->GetHitTime());
+ hit.SetTOTWidth(0);
+ //add hit
+ fTDCHitBuffer->Add(hit);
+ //print verbose
+ if (fVerbose)
+ switch (hit.GetPSBits()){
+ case LEADING_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [leading] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ break;
+ case TRAILING_HIT_PS:
+ AliInfo(Form(" %02x - 0x%08x \t TDC hit [trailing] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH));
+ } //print verbose
+ //spider
+ if (fSpider)
+ Spider(hit);
+
+ break;
+ }
+ //end switch TRM ACQ
+
+ break;
+
+ }
+
+ }
+ //end equipment data loop
+
+ if (fVerbose)
+ AliInfo("End of data loop");
+
+ //reset spider
+ if (fSpider)
+ ResetSpider();
+
+ /*** V2718 patch ***/
+ if (fV2718Patch){
+ decoderStatus = decoderStatus & ~DRM_BIT;
+ fDecoderSummaryData->SetDecoderStatus(decoderStatus);
+ fDRMSummaryData->SetTrailer(kTRUE);
+ fDRMSummaryData->SetSlotEnableMask(fDRMSummaryData->GetDecoderSlotEnableMask());
+ fDRMSummaryData->SetCBit(1);
+ fDRMSummaryData->SetLocalEventCounter(fTRMSummaryData->GetEventCounter());
+ if (fVerbose)
+ AliInfo("DRM was not present: - V2718 end patch decoding -");
+ }
+ /*** V2718 patch ***/
+
+ if (fVerbose)
+ AliInfo("Decoder is exiting succesfully.");
+
+ return(fDecoderSummaryData->GetErrorDetected());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillDRMSummaryData(AliTOFDRMGlobalHeader *DRMGlobalHeader)
+{
+ fDRMSummaryData->SetHeader(kTRUE);
+ fDRMSummaryData->SetSlotID(DRMGlobalHeader->GetSlotID());
+ fDRMSummaryData->SetEventWords(DRMGlobalHeader->GetEventWords());
+ fDRMSummaryData->SetDRMID(DRMGlobalHeader->GetDRMID());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillDRMSummaryData(AliTOFDRMGlobalTrailer *DRMGlobalTrailer)
+{
+ fDRMSummaryData->SetTrailer(kTRUE);
+ fDRMSummaryData->SetLocalEventCounter(DRMGlobalTrailer->GetLocalEventCounter());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillDRMSummaryData(AliTOFDRMStatusHeader1 *DRMStatusHeader1)
+{
+ fDRMSummaryData->SetPartecipatingSlotID(DRMStatusHeader1->GetPartecipatingSlotID());
+ fDRMSummaryData->SetCBit(DRMStatusHeader1->GetCBit());
+ fDRMSummaryData->SetVersID(DRMStatusHeader1->GetVersID());
+ fDRMSummaryData->SetDRMhSize(DRMStatusHeader1->GetDRMhSize());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillDRMSummaryData(AliTOFDRMStatusHeader2 *DRMStatusHeader2)
+{
+ fDRMSummaryData->SetSlotEnableMask(DRMStatusHeader2->GetSlotEnableMask());
+ fDRMSummaryData->SetFaultID(DRMStatusHeader2->GetFaultID());
+ fDRMSummaryData->SetRTOBit(DRMStatusHeader2->GetRTOBit());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillDRMSummaryData(AliTOFDRMStatusHeader3 *DRMStatusHeader3)
+{
+ fDRMSummaryData->SetL0BCID(DRMStatusHeader3->GetL0BCID());
+ fDRMSummaryData->SetRunTimeInfo(DRMStatusHeader3->GetRunTimeInfo());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillDRMSummaryData(AliTOFDRMStatusHeader4 *DRMStatusHeader4)
+{
+ fDRMSummaryData->SetTemperature(DRMStatusHeader4->GetTemperature());
+ fDRMSummaryData->SetACKBit(DRMStatusHeader4->GetACKBit());
+ fDRMSummaryData->SetSensAD(DRMStatusHeader4->GetSensAD());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillDRMSummaryData(AliTOFDRMEventCRC *DRMEventCRC)
+{
+ fDRMSummaryData->SetEventCRC(DRMEventCRC->GetEventCRC());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillLTMSummaryData(AliTOFLTMGlobalHeader *LTMGlobalHeader)
+{
+ fLTMSummaryData->SetHeader(kTRUE);
+ fLTMSummaryData->SetSlotID(LTMGlobalHeader->GetSlotID());
+ fLTMSummaryData->SetEventWords(LTMGlobalHeader->GetEventWords());
+ fLTMSummaryData->SetCBit(LTMGlobalHeader->GetCBit());
+ fLTMSummaryData->SetFault(LTMGlobalHeader->GetFault());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillLTMSummaryData(AliTOFLTMGlobalTrailer *LTMGlobalTrailer)
+{
+ fLTMSummaryData->SetTrailer(kTRUE);
+ fLTMSummaryData->SetEventCRC(LTMGlobalTrailer->GetEventCRC());
+ fLTMSummaryData->SetEventNumber(LTMGlobalTrailer->GetEventNumber());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillLTMSummaryData(AliTOFLTMPDLData *LTMPDLData, Int_t PDLWord)
+{
+ fLTMSummaryData->SetPDL(4 * PDLWord + 0, LTMPDLData->GetPDLValue1());
+ fLTMSummaryData->SetPDL(4 * PDLWord + 1, LTMPDLData->GetPDLValue2());
+ fLTMSummaryData->SetPDL(4 * PDLWord + 2, LTMPDLData->GetPDLValue3());
+ fLTMSummaryData->SetPDL(4 * PDLWord + 3, LTMPDLData->GetPDLValue4());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillLTMSummaryData(AliTOFLTMADCData *LTMADCData, Int_t ADCWord)
+{
+ fLTMSummaryData->SetADC(3 * ADCWord + 0, LTMADCData->GetADCValue1());
+ fLTMSummaryData->SetADC(3 * ADCWord + 1, LTMADCData->GetADCValue2());
+ fLTMSummaryData->SetADC(3 * ADCWord + 2, LTMADCData->GetADCValue3());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillLTMSummaryData(AliTOFLTMORData *LTMORData, Int_t ORWord)
+{
+ fLTMSummaryData->SetOR(3 * ORWord + 0, LTMORData->GetORValue1());
+ fLTMSummaryData->SetOR(3 * ORWord + 1, LTMORData->GetORValue2());
+ fLTMSummaryData->SetOR(3 * ORWord + 2, LTMORData->GetORValue3());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillTRMSummaryData(AliTOFTRMGlobalHeader *TRMGlobalHeader)
+{
+ fTRMSummaryData->SetHeader(kTRUE);
+ fTRMSummaryData->SetSlotID(TRMGlobalHeader->GetSlotID());
+ fTRMSummaryData->SetEventWords(TRMGlobalHeader->GetEventWords());
+ fTRMSummaryData->SetACQBits(TRMGlobalHeader->GetACQBits());
+ fTRMSummaryData->SetLBit(TRMGlobalHeader->GetLBit());
+ fTRMSummaryData->SetEBit(TRMGlobalHeader->GetEBit());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillTRMSummaryData(AliTOFTRMGlobalTrailer *TRMGlobalTrailer)
+{
+ fTRMSummaryData->SetTrailer(kTRUE);
+ fTRMSummaryData->SetEventCRC(TRMGlobalTrailer->GetEventCRC());
+ fTRMSummaryData->SetEventCounter(TRMGlobalTrailer->GetEventCounter());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillChainSummaryData(AliTOFTRMChainHeader *TRMChainHeader)
+{
+ fChainSummaryData->SetHeader(kTRUE);
+ switch (*(UInt_t *)TRMChainHeader & WORD_TYPE_MASK){
+ case CHAIN_A_HEADER:
+ fChainSummaryData->SetChain(0);
+ break;
+ case CHAIN_B_HEADER:
+ fChainSummaryData->SetChain(1);
+ break;
+ }
+ fChainSummaryData->SetBunchID(TRMChainHeader->GetBunchID());
+ fChainSummaryData->SetPB24Temp(TRMChainHeader->GetPB24Temp());
+ fChainSummaryData->SetPB24ID(TRMChainHeader->GetPB24ID());
+ fChainSummaryData->SetTSBit(TRMChainHeader->GetTSBit());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::FillChainSummaryData(AliTOFTRMChainTrailer *TRMChainTrailer)
+{
+ fChainSummaryData->SetTrailer(kTRUE);
+ fChainSummaryData->SetStatus(TRMChainTrailer->GetStatus());
+ fChainSummaryData->SetEventCounter(TRMChainTrailer->GetEventCounter());
+}
+
+//_________________________________________________________________
+
+void
+AliTOFDecoderV2::ResetSpider()
+{
+ //reset condition
+ if (fVerbose)
+ AliInfo("Reset signal received, empty and reset buffer");
+ for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++){
+ if (fSpiderBufferFull[iChan]) {
+ if (fVerbose)
+ AliInfo(Form("Spider buffer is full for channel %d", iChan));
+ fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[iChan]);
+ }
+ fSpiderBufferFull[iChan] = kFALSE;
+ }
+ fSpiderTDCID = -1;
+ return;
+}
+
+void
+AliTOFDecoderV2::Spider(AliTOFTDCHit &hit){
+
+ if (fVerbose)
+ AliInfo("Hit has been received from decode main routine");
+
+ //check new TDC
+ if (fSpiderTDCID != hit.GetTDCID()){
+ if (fVerbose)
+ AliInfo("Data coming from a new TDC, empty and reset buffer");
+ for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++){
+ if (fSpiderBufferFull[iChan])
+ fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[iChan]);
+ fSpiderBufferFull[iChan] = kFALSE;
+ }
+ fSpiderTDCPackedHitBuffer = fTDCPackedHitBuffer;
+ fSpiderTDCID = hit.GetTDCID();
+ }
+
+ //switch PS bits
+ switch(hit.GetPSBits()){
+ //leading hit
+ case LEADING_HIT_PS:
+ //check buffer status
+ if (fSpiderBufferFull[hit.GetChan()]){ //buffer full
+ fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[hit.GetChan()]); //buffered hit is orphane
+ fSpiderBuffer[hit.GetChan()] = hit; //current hit into buffer
+ if (fVerbose)
+ AliInfo("Leading hit and buffer full, buffered hit is a orphane leading hit");
+ }
+ else{ //buffer empty
+ fSpiderBuffer[hit.GetChan()] = hit; //current hit into buffer
+ fSpiderBufferFull[hit.GetChan()] = kTRUE; //set buffer full
+ }
+ break;
+ //trailing hit
+ case TRAILING_HIT_PS:
+ //check buffer status
+ if (fSpiderBufferFull[hit.GetChan()]){ //buffer full
+ fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[hit.GetChan()] << hit); //pack hits (Leading << Trailing) and save
+ fSpiderBufferFull[hit.GetChan()] = kFALSE; //unset buffer full
+ if (fVerbose)
+ AliInfo("Trailing hit and buffer full, pack leading and trailing hit");
+ }
+ else{ //buffer empty
+ ; //do nothing
+ if (fVerbose)
+ AliInfo("Trailing hit and buffer empty, trow trailing hit away");
+ }
+ break;
+ } //switch PS bits
+
+}
+
+//_________________________________________________________________
+
+Bool_t
+AliTOFDecoderV2::DecodeNext()
+{
+ /* decode next */
+
+ if (!fRawReader || !fRawReader->ReadHeader())
+ return kFALSE;
+
+ const Int_t size = fRawReader->GetDataSize();
+ UChar_t *data = new UChar_t[size];
+ if (fRawReader->ReadNext(data, size) != 1) {
+ delete [] data;
+ return kFALSE;
+ }
+
+ /* decode equipment data */
+ SetEquipmentID(fRawReader->GetEquipmentId());
+ Decode((UInt_t *)data, size / 4);
+
+ delete [] data;
+ return kTRUE;
+}
--- /dev/null
+#ifndef ALITOFDECODERV2_H
+#define ALITOFDECODERV2_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFDecoder.h,v 1.2 2007/05/08 11:55:24 arcelli Exp $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides the basic TOF raw data decoder. //
+// //
+///////////////////////////////////////////////////////////////
+
+//define decoder status and bits
+#define DRM_BIT 0x1
+#define LTM_BIT 0x2
+#define TRM_BIT 0x4
+#define CHAIN_A_BIT 0x8
+#define CHAIN_B_BIT 0x10
+
+#define DRM_HEADER_STATUS 0x0
+#define DRM_TRAILER_STATUS (DRM_BIT)
+#define LTM_HEADER_STATUS (DRM_BIT)
+#define LTM_TRAILER_STATUS (DRM_BIT|LTM_BIT)
+#define TRM_HEADER_STATUS (DRM_BIT)
+#define TRM_TRAILER_STATUS (DRM_BIT|TRM_BIT)
+#define CHAIN_A_HEADER_STATUS (DRM_BIT|TRM_BIT)
+#define CHAIN_A_TRAILER_STATUS (DRM_BIT|TRM_BIT|CHAIN_A_BIT)
+#define CHAIN_B_HEADER_STATUS (DRM_BIT|TRM_BIT)
+#define CHAIN_B_TRAILER_STATUS (DRM_BIT|TRM_BIT|CHAIN_B_BIT)
+#define CHAIN_A_TDC_HIT_STATUS (DRM_BIT|TRM_BIT|CHAIN_A_BIT)
+#define CHAIN_B_TDC_HIT_STATUS (DRM_BIT|TRM_BIT|CHAIN_B_BIT)
+
+//define DRM/LTM fixed number of words
+#define DRM_STATUS_HEADER_WORDS 4
+#define LTM_PDL_DATA_WORDS 12
+#define LTM_ADC_DATA_WORDS 20
+#define LTM_OR_DATA_WORDS 16
+
+//define masks
+#define WORD_TYPE_MASK 0xf0000000
+#define SLOT_ID_MASK 0x0000000f
+
+//define word types
+#define GLOBAL_HEADER 0x40000000
+#define GLOBAL_TRAILER 0x50000000
+#define CHAIN_A_HEADER 0x00000000
+#define CHAIN_A_TRAILER 0x10000000
+#define CHAIN_B_HEADER 0x20000000
+#define CHAIN_B_TRAILER 0x30000000
+#define ERROR 0x60000000
+#define FILLER 0x70000000
+
+//define TRM ACQ status
+#define PACKING_ENABLED_ACQ 0x0
+#define LEADING_ONLY_ACQ 0x1
+#define TRAILING_ONLY_ACQ 0x2
+#define PACKING_DISABLED_ACQ 0x3
+
+//define TDC hit PS status
+#define PACKED_HIT_PS 0x0
+#define LEADING_HIT_PS 0x1
+#define TRAILING_HIT_PS 0x2
+#define TOT_OVF_HIT_PS 0x3
+
+//define mandatory numbers
+#define N_EQUIPMENT 72
+#define N_DDL N_EQUIPMENT
+#define N_TRM 10
+#define N_CHAIN 2
+#define N_TDC 15
+#define N_CHANNEL 8
+#define TRM_FIRST_SLOT_ID 3
+#define TRM_LAST_SLOT_ID 12
+
+#define TIME_BIN_WIDTH 24.4e-3//ns
+#define TOT_BIN_WIDTH 48.8e-3//ns
+#define TIME_TO_TOT_BIN_WIDTH ( TIME_BIN_WIDTH / TOT_BIN_WIDTH )
+#define TOT_TO_TIME_BIN_WIDTH ( TOT_BIN_WIDTH / TIME_BIN_WIDTH )
+
+//define CRC macros to convert 32-bit CRC into DRM/TRM CRC
+#define COMPUTE_DRM_CRC(a) ( ((a & 0x0000ffff) >> 0) ^\
+ ((a & 0xffff0000) >> 16) )
+#define COMPUTE_TRM_CRC(a) ( ((a & 0x00000fff) >> 0) ^\
+ ((a & 0x00fff000) >> 12) ^\
+ ((a & 0xff000000) >> 24) )
+#define COMPUTE_LTM_CRC(a) ( ((a & 0x00000fff) >> 0) ^\
+ ((a & 0x00fff000) >> 12) ^\
+ ((a & 0xff000000) >> 24) )
+
+
+#include "TObject.h"
+#include "AliTOFRawDataFormat.h"
+#include "AliTOFDecoderSummaryData.h"
+#include "AliTOFDRMSummaryData.h"
+#include "AliTOFLTMSummaryData.h"
+#include "AliTOFTRMSummaryData.h"
+#include "AliTOFChainSummaryData.h"
+#include "AliTOFTDCHitBuffer.h"
+#include "AliTOFTDCErrorBuffer.h"
+#include "AliRawReader.h"
+#include "AliRawDataHeader.h"
+
+class AliTOFDecoderV2 : public TObject
+{
+ public:
+ AliTOFDecoderV2(AliRawReader *reader = NULL); //default constructor
+ AliTOFDecoderV2(const AliTOFDecoderV2 &source); //copy constructor
+ AliTOFDecoderV2 &operator = (const AliTOFDecoderV2 &source); //operator =
+ ~AliTOFDecoderV2(); //distructor
+ /* setters */
+ void SetRawReader(AliRawReader *value) {fRawReader = value;}; // set raw reader
+ void SetVerbose(Bool_t Verbose = kTRUE) {fVerbose = Verbose;}; //set verbose level
+ void SetLogErrors(Bool_t Value = kTRUE) {fLogErrors = Value;}; //set log errors
+ void SetV2718Patch(Bool_t V2718Patch = kTRUE) {fV2718Patch = V2718Patch;}; //set V2718 patch (no DRM)
+ void SetRecoverError(Bool_t RecoverError = kTRUE) {fRecoverError = RecoverError;}; //decoder will try to recover decoding errors
+ void SetRecoverErrorThr(Int_t value) {fRecoverErrorThr = value;}; // setter
+ void SetSpider(Bool_t Spider = kTRUE) {fSpider = Spider;}; //set spider
+ void SetRunNumber(Int_t RunNumber) {fRunNumber = RunNumber;}; //set run number
+ void SetEventNumber(UInt_t EventNumber) {fEventNumber = EventNumber;}; //set event number
+ void SetEquipmentID(Int_t EquipmentID) {fEquipmentID = EquipmentID;}; //set equipment ID
+ /* getters */
+ AliTOFDecoderSummaryData *GetDecoderSummaryData() {return fDecoderSummaryData;}; //get decoder summary data
+ /* methods */
+ Bool_t Decode(UInt_t *rawData, UInt_t nWords); //main decode function
+ void Spider(AliTOFTDCHit &hit);
+ void ResetSpider();
+ /* raw reader decoder interface */
+ Bool_t NextEvent() {return fRawReader ? fRawReader->NextEvent() : kFALSE;}; // next event
+ UInt_t GetEventType() {return fRawReader ? fRawReader->GetType() : 0;}; // get event type
+ Bool_t DecodeNext(); // decode next
+ const AliRawDataHeader *GetCDH() const {return fRawReader ? fRawReader->GetDataHeader() : NULL;}; // get CDH
+
+ private:
+ AliRawReader *fRawReader; // raw reader
+ Bool_t fVerbose; //verbose flag
+ Bool_t fLogErrors; //log errors flag
+ Bool_t fV2718Patch; //V2718 patch flag
+ Bool_t fRecoverError; //recover error flag
+ Int_t fRecoverErrorThr; // recover error thr
+ Bool_t fSpider; //spider flag
+ Int_t fRunNumber; //run number
+ UInt_t fEventNumber; //event number
+ Int_t fEquipmentID; //equipment ID
+
+ //summary data pointers
+ AliTOFDecoderSummaryData *fDecoderSummaryData; //decoder summary data
+ AliTOFDRMSummaryData *fDRMSummaryData; //DRM summary data
+ AliTOFLTMSummaryData *fLTMSummaryData; //LTM summary data
+ AliTOFTRMSummaryData *fTRMSummaryData; //TRM summary data
+ AliTOFChainSummaryData *fChainSummaryData; //chain summary data
+
+ //buffer pointers
+ AliTOFTDCHitBuffer *fTDCHitBuffer; //TDC hit buffer
+ AliTOFTDCHitBuffer *fTDCPackedHitBuffer; //TDC packed hit buffer
+ AliTOFTDCErrorBuffer *fTDCErrorBuffer; //TDC error buffer
+
+ //decoding objects
+ AliTOFDRMGlobalHeader *fDRMGlobalHeader; //DRM global header
+ AliTOFDRMGlobalTrailer *fDRMGlobalTrailer; //DRM global trailer
+ AliTOFDRMStatusHeader1 *fDRMStatusHeader1; //DRM status header1
+ AliTOFDRMStatusHeader2 *fDRMStatusHeader2; //DRM status header2
+ AliTOFDRMStatusHeader3 *fDRMStatusHeader3; //DRM status header3
+ AliTOFDRMStatusHeader4 *fDRMStatusHeader4; //DRM status header4
+ AliTOFDRMEventCRC *fDRMEventCRC; //DRM event CRC
+ AliTOFLTMGlobalHeader *fLTMGlobalHeader; //LTM global header
+ AliTOFLTMGlobalTrailer *fLTMGlobalTrailer; //LTM global trailer
+ AliTOFLTMPDLData *fLTMPDLData; //LTM PDL data
+ AliTOFLTMADCData *fLTMADCData; //LTM ADC data
+ AliTOFLTMORData *fLTMORData; //LTM OR data
+ AliTOFTRMGlobalHeader *fTRMGlobalHeader; //TRM global header
+ AliTOFTRMGlobalTrailer *fTRMGlobalTrailer; //TRM global trailer
+ AliTOFTRMChainHeader *fTRMChainHeader; //TRM chain header
+ AliTOFTRMChainTrailer *fTRMChainTrailer; //TRM chain trailer
+ AliTOFTDCPackedHit *fTDCPackedHit; //TDC packed hit
+ AliTOFTDCUnpackedHit *fTDCUnpackedHit; //TDC unpacked hit
+ AliTOFTRMTDCError *fTRMTDCError; //TRM TDC error
+ AliTOFTRMDiagnosticErrorWord1 *fTRMDiagnosticErrorWord1; //TRM diagnostic error word 1
+ AliTOFTRMDiagnosticErrorWord2 *fTRMDiagnosticErrorWord2; //TRM diagnostica error word 2
+
+ /* Spider data members */
+ AliTOFTDCHit fSpiderBuffer[N_CHANNEL];
+ Bool_t fSpiderBufferFull[N_CHANNEL];
+ Int_t fSpiderTDCID;
+ AliTOFTDCHitBuffer *fSpiderTDCPackedHitBuffer;
+
+
+ /* Summary Data Functions */
+ //fill DRM summary data
+ void FillDRMSummaryData(AliTOFDRMGlobalHeader *DRMGlobalHeader); //DRM global header
+ void FillDRMSummaryData(AliTOFDRMGlobalTrailer *DRMGlobalTrailer); //DRM global trailer
+ void FillDRMSummaryData(AliTOFDRMStatusHeader1 *DRMStatusHeader1); //DRM status header 1
+ void FillDRMSummaryData(AliTOFDRMStatusHeader2 *DRMStatusHeader2); //DRM status header 2
+ void FillDRMSummaryData(AliTOFDRMStatusHeader3 *DRMStatusHeader3); //DRM status header 3
+ void FillDRMSummaryData(AliTOFDRMStatusHeader4 *DRMStatusHeader4); //DRM status header 4
+ void FillDRMSummaryData(AliTOFDRMEventCRC *DRMEventCRC); //DRM event CRC
+ //fill LTM summary data
+ void FillLTMSummaryData(AliTOFLTMGlobalHeader *LTMGlobalHeader); //LTM global header
+ void FillLTMSummaryData(AliTOFLTMGlobalTrailer *LTMGlobalTrailer); //LTM global trailer
+ void FillLTMSummaryData(AliTOFLTMPDLData *LTMPDLData, Int_t PDLWord); //LTM PDL data
+ void FillLTMSummaryData(AliTOFLTMADCData *LTMADCData, Int_t ADCWord); //LTM ADC data
+ void FillLTMSummaryData(AliTOFLTMORData *LTMORData, Int_t ORWord); //LTM OR data
+ //fill TRM summary data
+ void FillTRMSummaryData(AliTOFTRMGlobalHeader *TRMGlobalHeader); //TRM global header
+ void FillTRMSummaryData(AliTOFTRMGlobalTrailer *TRMGlobalTrailer); //TRM global trailer
+ //fill chain summary data
+ void FillChainSummaryData(AliTOFTRMChainHeader *TRMChainHeader); //TRM chain header
+ void FillChainSummaryData(AliTOFTRMChainTrailer *TRMChainTrailer); //TRM chain trailer
+
+ ClassDef(AliTOFDecoderV2, 1);
+};
+
+#endif /* ALITOFDECODERV2_H */
Int_t fPulserSection2; // pulser section 2
Int_t fPrePulseEnable; // pre pulse enable
Int_t fSelectMode; // select mode
+ Int_t fBLTMask; // BLT mask
public:
Int_t GetPulserSection2() const {return fPulserSection2;}; // get pulser section 2
Int_t GetPrePulserEnable() const {return fPrePulseEnable;}; // get pre pulse enable
Int_t GetSelectMode() const {return fSelectMode;}; // get select mode
+ Int_t GetBLTMask() const {return fBLTMask;}; // get BLT mask
};
Int_t fOptLinkId; // opt link id
Int_t fVMEAddress; // VME address
Int_t fThreshold; // threshold
+ Int_t fTriggerEnable; // trigger enable
+ Int_t fTriggerMask1; // trigger mask1
+ Int_t fTriggerMask2; // trigger mask2
+#if 0
Int_t fDelayLine0; // delay line 0
Int_t fDelayLine1; // delay line 1
Int_t fDelayLine2; // delay line 2
Int_t fDelayLine5; // delay line 5
Int_t fDelayLine6; // delay line 6
Int_t fDelayLine7; // delay line 7
+#endif
public:
Int_t GetOptLinkId() const {return fOptLinkId;}; // get opt link id
Int_t GetVMEAddress() const {return fVMEAddress;}; // get VME address
Int_t GetThreshold() const {return fThreshold;}; // get threshold
+ Int_t GetTriggerEnable() const {return fTriggerEnable;}; // get trigger enable
+ Int_t GetTriggerMask1() const {return fTriggerMask1;}; // get trigger mask1
+ Int_t GetTriggerMask2() const {return fTriggerMask2;}; // get trigger mask2
+#if 0
Int_t GetDelayLine0() const {return fDelayLine0;}; // get delay line 0
Int_t GetDelayLine1() const {return fDelayLine1;}; // get delay line 1
Int_t GetDelayLine2() const {return fDelayLine2;}; // get delay line 2
Int_t GetDelayLine5() const {return fDelayLine5;}; // get delay line 5
Int_t GetDelayLine6() const {return fDelayLine6;}; // get delay line 6
Int_t GetDelayLine7() const {return fDelayLine7;}; // get delay line 7
+#endif
};
Int_t fVMEAddress; // VME address
Int_t fMatchingWindow; // matching window
Int_t fLatencyWindow; // latency window
+ Int_t fBunchCrossingAdjust; // bunch crossing adjust
Int_t fTriggerLevelConfig; // trigger level config
Int_t fTriggerSubtraction; // trigger subtracion
Int_t fEdgeDetection; // edge detection
Int_t fPackingFlag; // packing flag
+ Int_t fLVStatus; // LV status
Int_t fChainAFlag; // chain A flag
Int_t fChainBFlag; // chain B flag
Int_t fActiveChipA; // active chip A
Int_t GetVMEAddress() const {return fVMEAddress;}; // get VME address
Int_t GetMatchingWindow() const {return fMatchingWindow;}; // get matching window
Int_t GetLatencyWindow() const {return fLatencyWindow;}; // get latency window
+ Int_t GetBunchCrossingAdjust() const {return fBunchCrossingAdjust;}; // get bunch crossing adjust
Int_t GetTriggerLevelConfig() const {return fTriggerLevelConfig;}; // get trigger level config
Int_t GetTriggerSubtraction() const {return fTriggerSubtraction;}; // get trigger subtracion
Int_t GetEdgeDetection() const {return fEdgeDetection;}; // get edge detection
Int_t GetPackingFlag() const {return fPackingFlag;}; // get packing flag
+ Int_t GetLVStatus() const {return fLVStatus;}; // get LV status
Int_t GetChainAFlag() const {return fChainAFlag;}; // get chain A flag
Int_t GetChainBFlag() const {return fChainBFlag;}; // get chain B flag
Int_t GetActiveChipA() const {return fActiveChipA;}; // get active chip A
time_t fDumpTime; // dump time
Int_t fRunNumber; // run number
Int_t fRunType; // run type
+ Int_t fBytes; // bytes
+ Int_t fCTTMTriggerMask[fgkNumberOfCrates]; // CTTM trigger mask
AliTOFCrateConfig fCrateConfig[fgkNumberOfCrates]; // crate config array
public:
time_t GetDumpTime() const {return fDumpTime;}; // get dump time
Int_t GetRunNumber() const {return fRunNumber;}; // get run number
Int_t GetRunType() const {return fRunType;}; // get run type
+ Int_t GetBytes() const {return fBytes;}; // get bytes
+ Int_t GetCTTMTriggerMask(UShort_t iCrate) const {return iCrate < GetNumberOfCrates() ? fCTTMTriggerMask[iCrate] : NULL;}; // get CTTM trigger mask
AliTOFCrateConfig *GetCrateConfig(UShort_t iCrate) {return iCrate < GetNumberOfCrates() ? &fCrateConfig[iCrate] : NULL;}; // get crate config
};
--- /dev/null
+#ifndef ALITOFLTMADCDATA_H
+#define ALITOFLTMADCDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFLTMADCData
+{
+ public:
+ UInt_t GetADCValue1() {return fADCValue1;};
+ UInt_t GetADCValue2() {return fADCValue2;};
+ UInt_t GetADCValue3() {return fADCValue3;};
+ UInt_t GetMBZ() {return fMBZ;};
+ private:
+ UInt_t fADCValue1: 10;
+ UInt_t fADCValue2: 10;
+ UInt_t fADCValue3: 10;
+ UInt_t fMBZ: 2;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFLTMGLOBALHEADER_H
+#define ALITOFLTMGLOBALHEADER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFLTMGlobalHeader
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetEventWords() {return fEventWords;};
+ UInt_t GetCBit() {return fCBit;};
+ UInt_t GetFault() {return fFault;};
+ UInt_t GetUNDEFINED() {return fUNDEFINED;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fEventWords: 13;
+ UInt_t fCBit: 1;
+ UInt_t fFault: 6;
+ UInt_t fUNDEFINED: 4;
+ UInt_t fWordType: 4;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFLTMGLOBALTRAILER_H
+#define ALITOFLTMGLOBALTRAILER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFLTMGlobalTrailer
+{
+ public:
+ UInt_t GetSlotID() {return fSlotID;};
+ UInt_t GetEventCRC() {return fEventCRC;};
+ UInt_t GetEventNumber() {return fEventNumber;};
+ UInt_t GetWordType() {return fWordType;};
+ private:
+ UInt_t fSlotID: 4;
+ UInt_t fEventCRC: 12;
+ UInt_t fEventNumber: 12;
+ UInt_t fWordType: 4;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFLTMORDATA_H
+#define ALITOFLTMORDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFLTMORData
+{
+ public:
+ UInt_t GetORValue1() {return fORValue1;};
+ UInt_t GetORValue2() {return fORValue2;};
+ UInt_t GetORValue3() {return fORValue3;};
+ UInt_t GetMBZ() {return fMBZ;};
+ private:
+ UInt_t fORValue1: 10;
+ UInt_t fORValue2: 10;
+ UInt_t fORValue3: 10;
+ UInt_t fMBZ: 2;
+};
+
+#endif
--- /dev/null
+#ifndef ALITOFLTMPDLDATA_H
+#define ALITOFLTMPDLDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTOFRawDataFormat.h 23881 2008-02-12 16:46:22Z decaro $ */
+
+///////////////////////////////////////////////////////////////
+// //
+// This classes provide the TOF raw data bit fields. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TROOT.h"
+
+class AliTOFLTMPDLData
+{
+ public:
+ UInt_t GetPDLValue1() {return fPDLValue1;};
+ UInt_t GetPDLValue2() {return fPDLValue2;};
+ UInt_t GetPDLValue3() {return fPDLValue3;};
+ UInt_t GetPDLValue4() {return fPDLValue4;};
+ private:
+ UInt_t fPDLValue1: 8;
+ UInt_t fPDLValue2: 8;
+ UInt_t fPDLValue3: 8;
+ UInt_t fPDLValue4: 8;
+};
+
+#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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a summary for LTM data. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFLTMSummaryData.h"
+
+ClassImp(AliTOFLTMSummaryData)
+
+AliTOFLTMSummaryData::AliTOFLTMSummaryData() :
+ TObject(),
+ fHeader(kFALSE),
+ fTrailer(kFALSE),
+ fSlotID(0),
+ fEventWords(0),
+ fCBit(0),
+ fFault(0),
+ fEventCRC(0),
+ fEventNumber(0),
+ fDecoderCRC(0)
+{
+ /* default constructor */
+ for (Int_t iPDL = 0; iPDL < LTM_N_PDL; iPDL++)
+ fPDL[iPDL] = 0;
+ for (Int_t iADC = 0; iADC < LTM_N_ADC; iADC++)
+ fADC[iADC] = 0;
+ for (Int_t iOR = 0; iOR < LTM_N_OR; iOR++)
+ fOR[iOR] = 0;
+}
+
+//_________________________________________________________________
+
+AliTOFLTMSummaryData::AliTOFLTMSummaryData(const AliTOFLTMSummaryData &source) :
+ TObject(),
+ fHeader(source.fHeader),
+ fTrailer(source.fTrailer),
+ fSlotID(source.fSlotID),
+ fEventWords(source.fEventWords),
+ fCBit(source.fCBit),
+ fFault(source.fFault),
+ fEventCRC(source.fEventCRC),
+ fEventNumber(source.fEventNumber),
+ fDecoderCRC(source.fDecoderCRC)
+{
+ /* copy constructor */
+ for (Int_t iPDL = 0; iPDL < LTM_N_PDL; iPDL++)
+ fPDL[iPDL] = source.fPDL[iPDL];
+ for (Int_t iADC = 0; iADC < LTM_N_ADC; iADC++)
+ fADC[iADC] = source.fADC[iADC];
+ for (Int_t iOR = 0; iOR < LTM_N_OR; iOR++)
+ fOR[iOR] = source.fOR[iOR];
+}
+
+//_________________________________________________________________
+
+AliTOFLTMSummaryData &
+AliTOFLTMSummaryData::operator = (const AliTOFLTMSummaryData &source)
+{
+ /* operator = */
+ fHeader = source.fHeader;
+ fTrailer = source.fTrailer;
+ fSlotID = source.fSlotID;
+ fEventWords = source.fEventWords;
+ fCBit = source.fCBit;
+ fFault = source.fFault;
+ for (Int_t iPDL = 0; iPDL < LTM_N_PDL; iPDL++)
+ fPDL[iPDL] = source.fPDL[iPDL];
+ for (Int_t iADC = 0; iADC < LTM_N_ADC; iADC++)
+ fADC[iADC] = source.fADC[iADC];
+ for (Int_t iOR = 0; iOR < LTM_N_OR; iOR++)
+ fOR[iOR] = source.fOR[iOR];
+ fEventCRC = source.fEventCRC;
+ fEventNumber = source.fEventNumber;
+ fDecoderCRC = source.fDecoderCRC;
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFLTMSummaryData::~AliTOFLTMSummaryData()
+{
+ /* default destructor */
+}
+
+//_________________________________________________________________
+
+void
+AliTOFLTMSummaryData::Reset()
+{
+ /* reset function */
+ fHeader = kFALSE;
+ fTrailer = kFALSE;
+ fSlotID = 0;
+ fEventWords = 0;
+ fCBit = 0;
+ fFault = 0;
+ for (Int_t iPDL = 0; iPDL < LTM_N_PDL; iPDL++)
+ fPDL[iPDL] = 0;
+ for (Int_t iADC = 0; iADC < LTM_N_ADC; iADC++)
+ fADC[iADC] = 0;
+ for (Int_t iOR = 0; iOR < LTM_N_OR; iOR++)
+ fOR[iOR] = 0;
+ fEventCRC = 0;
+ fEventNumber = 0;
+ fDecoderCRC = 0;
+}
+
--- /dev/null
+#ifndef ALITOFLTMSUMMARYDATA_H
+#define ALITOFLTMSUMMARYDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a summary for LTM data. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+#define LTM_N_PDL 48
+#define LTM_N_ADC 60
+#define LTM_N_OR 48
+
+class AliTOFLTMSummaryData : public TObject
+{
+ public:
+ AliTOFLTMSummaryData(); //default constructor
+ AliTOFLTMSummaryData(const AliTOFLTMSummaryData &source); //copy contructor
+ AliTOFLTMSummaryData &operator = (const AliTOFLTMSummaryData &source); //operator =
+ virtual ~AliTOFLTMSummaryData(); //destructor
+ /* getters */
+ Bool_t GetHeader() const {return fHeader;}; //get header
+ Bool_t GetTrailer() const {return fTrailer;}; //get trailer
+ Short_t GetSlotID() {return fSlotID;}; //get slot ID
+ Short_t GetEventWords() {return fEventWords;}; //get event words
+ Short_t GetCBit() {return fCBit;}; //get C bit
+ Short_t GetFault() {return fFault;}; //get fault
+ Short_t GetPDL(Int_t i) {return fPDL[i];}; //get PDL
+ Short_t GetADC(Int_t i) {return fADC[i];}; //get ADC
+ Short_t GetOR(Int_t i) {return fOR[i];}; //get OR
+ Short_t GetEventCRC() {return fEventCRC;}; //get event CRC
+ Short_t GetEventNumber() {return fEventNumber;}; //set event number
+ Short_t GetDecoderCRC() {return fDecoderCRC;}; //decoder CRC
+ /* setters */
+ void SetHeader(Bool_t Header) {fHeader = Header;}; //set header
+ void SetTrailer(Bool_t Trailer) {fTrailer = Trailer;}; //set trailer
+ void SetSlotID(Short_t SlotID) {fSlotID = SlotID;}; //set slot ID
+ void SetEventWords(Short_t EventWords) {fEventWords = EventWords;}; //set event words
+ void SetCBit(Short_t CBit) {fCBit = CBit;}; //set C bit
+ void SetFault(Short_t Fault) {fFault = Fault;}; //set fault
+ void SetPDL(Int_t i, Short_t PDL) {fPDL[i] = PDL;}; //set PDL
+ void SetADC(Int_t i, Short_t ADC) {fADC[i] = ADC;}; //set ADC
+ void SetOR(Int_t i, Short_t OR) {fOR[i] = OR;}; //set OR
+ void SetEventCRC(Short_t EventCRC) {fEventCRC = EventCRC;}; //set event CRC
+ void SetEventNumber(Short_t EventNumber) {fEventNumber = EventNumber;}; //set event number
+ void SetDecoderCRC(Short_t DecoderCRC) {fDecoderCRC = DecoderCRC;}; //decoder CRC
+ /* methods */
+ void Reset(); //reset
+ private:
+ Bool_t fHeader; //header
+ Bool_t fTrailer; //trailer
+ Short_t fSlotID; //slot ID
+ Short_t fEventWords; //event words
+ Short_t fCBit; // C bit
+ Short_t fFault; //fault
+ Short_t fPDL[LTM_N_PDL]; //PDL setting
+ Short_t fADC[LTM_N_ADC]; //ADC measurement
+ Short_t fOR[LTM_N_OR]; //OR measurement
+ Short_t fEventCRC; //event CRC
+ Short_t fEventNumber; //event number
+ Short_t fDecoderCRC; //decoder CRC
+
+ ClassDef(AliTOFLTMSummaryData, 1);
+};
+
+#endif /* ALITOFLTMSUMMARYDATA_H */
#include "TF1.h"
#include "TGeoManager.h"
#include "AliGeomManager.h"
+#include "AliTOFReadoutInfo.h"
// TOF preprocessor class.
// It takes data from DCS and passes them to the class AliTOFDataDCS, which
/* get params from OCDB */
AliCDBEntry *cdbe = NULL;
- /* get T0-fill calibration params */
- cdbe = GetFromOCDB("Calib", "T0FillOnlineCalib");
- if (!cdbe) {
- Log("cannot get \"T0FillOnlineCalib\" entry from OCDB");
- return 21;
- }
- AliTOFT0FillOnlineCalib *t0FillOnlineCalibObject = (AliTOFT0FillOnlineCalib *)cdbe->GetObject();
- if (!t0FillOnlineCalibObject) {
- Log("cannot get \"T0FillOnlineCalib\" object from CDB entry");
- return 21;
- }
- Float_t t0FillCalibOffset = t0FillOnlineCalibObject->GetOffset();
- Float_t t0FillCalibCoefficient = t0FillOnlineCalibObject->GetCoefficient();
- Log(Form("got \"T0FillOnlineCalib\" object: offset=%f coeff=%f", t0FillCalibOffset, t0FillCalibCoefficient));
-
/*
* at this stage status object is not on OCDB yet
* since it will be stored later. nevertheless we
timeps = timebin * AliTOFGeometry::TdcBinWidth();
totns = totbin * AliTOFGeometry::ToTBinWidth() * 1.e-3;
/* get calibration correction in ps */
+
+
channelOffline = (AliTOFChannelOffline *)offlineArray->At(index);
if (totns < AliTOFGeometry::SlewTOTMin()) totns = AliTOFGeometry::SlewTOTMin();
if (totns > AliTOFGeometry::SlewTOTMax()) totns = AliTOFGeometry::SlewTOTMax();
}
Float_t maxBinCenter = hT0Fill->GetBinCenter(maxBin);
- /* rough landau fit of the edge */
- TF1 *landau = (TF1 *)gROOT->GetFunction("landau");
- landau->SetParameter(1, maxBinCenter);
+ /* rough fit of the edge */
+ TF1 *gaus = (TF1 *)gROOT->GetFunction("gaus");
+ gaus->SetParameter(1, maxBinCenter);
Float_t fitMin = maxBinCenter - 1000.; /* fit from 1 ns before max */
- Float_t fitMax = maxBinCenter + binWidth; /* fit until a bin width above max */
- hT0Fill->Fit("landau", "q0", "", fitMin, fitMax);
- /* get rough landau mean and sigma to set a better fit range */
- Float_t mean = landau->GetParameter(1);
- Float_t sigma = landau->GetParameter(2);
- /* better landau fit of the edge */
- fitMin = maxBinCenter - 3. * sigma;
- fitMax = mean;
- hT0Fill->Fit("landau", "q0", "", fitMin, fitMax);
+ Float_t fitMax = maxBinCenter + 1000.; /* fit until 1 ns above max */
+ hT0Fill->Fit("gaus", "q0", "", fitMin, fitMax);
+ /* better fit of the edge */
+ Float_t mean, sigma;
+ for (Int_t istep = 0; istep < 10; istep++) {
+ mean = gaus->GetParameter(1);
+ sigma = gaus->GetParameter(2);
+ fitMin = mean - 3. * sigma;
+ fitMax = mean;
+ hT0Fill->Fit("gaus", "q0", "", fitMin, fitMax);
+ }
/* print params */
- mean = landau->GetParameter(1);
- sigma = landau->GetParameter(2);
- Float_t meane = landau->GetParError(1);
- Float_t sigmae = landau->GetParError(2);
+ mean = gaus->GetParameter(1);
+ sigma = gaus->GetParameter(2);
+ Float_t meane = gaus->GetParError(1);
+ Float_t sigmae = gaus->GetParError(2);
Log(Form("edge fit: mean = %f +- %f ps", mean, meane));
Log(Form("edge fit: sigma = %f +- %f ps", sigma, sigmae));
- Float_t edge = mean - 3. * sigma;
- Float_t edgee = TMath::Sqrt(meane * meane + 3. * sigmae * 3. * sigmae);
- Log(Form("edge fit: edge = %f +- %f ps", edge, edgee));
- /* apply calibration to get T0-fill from egde */
- Float_t t0Fill = edge * t0FillCalibCoefficient + t0FillCalibOffset;
- Log(Form("estimated T0-fill: %f ps", t0Fill));
- /* check edge error */
- if (edgee > 300.) {
- Log("edge error is large: store default T0-fill value (0 ps)");
- t0Fill = 0.;
+ /* check error */
+ if (meane > 300.) {
+ Log("error on mean is large: store default T0-fill value (0 ps)");
+ mean = 0.;
+ }
+ if (sigmae > 300.) {
+ Log("error on sigma is large: store default TOFreso value (200 ps)");
+ sigma = 200.;
}
/* create RunParams object */
UInt_t timestamp[1] = {0};
- Float_t t0[1] = {t0Fill};
- Float_t tofReso[1] = {-1.};
+ Float_t t0[1] = {mean};
+ Float_t tofReso[1] = {sigma};
Float_t t0Spread[1] = {-1.};
AliTOFRunParams *runParamsObject = new AliTOFRunParams(1);
runParamsObject->SetTimestamp(timestamp);
}
else Log(Form("channel %d noise status unchanged", ich));
}
- else {
+ else if ((rate + 3. * rate_err) < noiseThr) {
if (fStatus->GetNoiseStatus(ich) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad) {
Log(Form("channel %d noise status changed from Bad to Ok", ich));
fStatus->SetNoiseStatus(ich, AliTOFChannelOnlineStatusArray::kTOFNoiseOk);
//_____________________________________________________________________________
+UInt_t
+AliTOFPreprocessor::ProcessReadout()
+{
+ // Processing data from DAQ to compute reaodut efficiency
+
+ Log("Processing Readout");
+
+ /* get file sources from FXS */
+ TList *fileList = GetFileSources(kDAQ, "READOUT");
+ if (!fileList || fileList->GetEntries() == 0) {
+ Log("cannot get DAQ source file list or empty list");
+ return 22;
+ }
+ Log(Form("got DAQ source file list: %d files", fileList->GetEntries()));
+ fileList->Print();
+
+ /* open input file (only one expected) */
+ TObjString *str = (TObjString *)fileList->At(0);
+ TString filename = GetFile(kDAQ, "READOUT", str->GetName());
+ Log(Form("opening input file: source=%s, filename=%s", str->String().Data(), filename.Data()));
+ TFile *filein = TFile::Open(filename.Data());
+ if (!filein || !filein->IsOpen()) {
+ Log("cannot open input file");
+ return 23;
+ }
+
+ /* get histo from input file */
+ TH1F *hChainEfficiency = (TH1F *)filein->Get("hChainEfficiency");
+ if (!hChainEfficiency) {
+ Log("cannot get \"hChainEfficiency\" histo");
+ return 23;
+ }
+
+ /* fill channel efficiency histo */
+
+ /* temporarly disable warnings */
+ AliLog::EType_t logLevel = (AliLog::EType_t)AliLog::GetGlobalLogLevel();
+ AliLog::SetGlobalLogLevel(AliLog::kError);
+
+ TH1F *hChannelEfficiency = new TH1F("hChannelEfficiency", "Channel readout efficiency;index;efficiency", fNChannels, 0., fNChannels);
+ Int_t chainIndex, det[5], dummy, index;
+ Float_t effi, effi_err;
+ /* loop over DDLs */
+ for (Int_t iddl = 0; iddl < 72; iddl++) {
+ /* loop over TRMs */
+ for (Int_t itrm = 0; itrm < 10; itrm++) {
+ /* loop over chains */
+ for (Int_t ichain = 0; ichain < 2; ichain++) {
+ chainIndex = ichain + 2 * itrm + 20 * iddl;
+ effi = hChainEfficiency->GetBinContent(chainIndex + 1);
+ effi_err = hChainEfficiency->GetBinError(chainIndex + 1);
+ /* loop over TDCs */
+ for (Int_t itdc = 0; itdc < 15; itdc++) {
+ /* loop over channels */
+ for (Int_t ichannel = 0; ichannel < 8; ichannel++) {
+
+ /* get channel index */
+ AliTOFRawStream::EquipmentId2VolumeId(iddl, itrm + 3, ichain, itdc, ichannel, det);
+ dummy = det[4];
+ det[4] = det[3];
+ det[3] = dummy;
+ /* check valid index */
+ if (det[0] < 0 || det[0] > 17 ||
+ det[1] < 0 || det[1] > 5 ||
+ det[2] < 0 || det[2] > 18 ||
+ det[3] < 0 || det[3] > 1 ||
+ det[4] < 0 || det[4] > 47) continue;
+ index = AliTOFGeometry::GetIndex(det);
+
+ /* set channel efficiency */
+ hChannelEfficiency->SetBinContent(index + 1, effi);
+ hChannelEfficiency->SetBinError(index + 1, effi_err);
+
+ }
+ }
+ }
+ }
+ }
+
+ /* re-enable warnings */
+ AliLog::SetGlobalLogLevel(logLevel);
+
+ /* store reference data */
+ if(fStoreRefData){
+ /* setup TOF readout info object */
+ AliTOFReadoutInfo readoutInfo;
+ readoutInfo.SetChainEfficiency((TH1F *)filein->Get("hChainEfficiency"));
+ readoutInfo.SetTRMData((TH1F *)filein->Get("hTRMData"));
+ readoutInfo.SetTRMEmptyEvent((TH1F *)filein->Get("hTRMEmptyEvent"));
+ readoutInfo.SetTRMBadEventCounter((TH1F *)filein->Get("hTRMBadEventCounter"));
+ readoutInfo.SetTRMBadCRC((TH1F *)filein->Get("hTRMBadCRC"));
+ readoutInfo.SetChainData((TH1F *)filein->Get("hChainData"));
+ readoutInfo.SetChainBadStatus((TH1F *)filein->Get("hChainBadStatus"));
+ readoutInfo.SetChainBadEventCounter((TH1F *)filein->Get("hChainBadEventCounter"));
+ readoutInfo.SetTDCError((TH1F *)filein->Get("hTDCError"));
+ readoutInfo.SetTDCErrorFlags((TH2F *)filein->Get("hTDCErrorFlags"));
+
+ AliCDBMetaData metaDataHisto;
+ metaDataHisto.SetBeamPeriod(0);
+ metaDataHisto.SetResponsible("Roberto Preghenella");
+ metaDataHisto.SetComment("readout info data");
+ if (!StoreReferenceData("Calib","ReadoutInfo", &readoutInfo, &metaDataHisto)) {
+ Log("error while storing reference data");
+ filein->Close();
+ return 23;
+ }
+ Log("reference data successfully stored");
+ }
+
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Roberto Preghenella");
+ metaData.SetComment("online ReadoutEfficiency measurement");
+ if (!Store("Calib", "ReadoutEfficiency", hChannelEfficiency, &metaData, 0, kFALSE)) {
+ Log("error while storing ReadoutEfficiency object");
+ delete hChannelEfficiency;
+ filein->Close();
+ return 23;
+ }
+ Log("ReadoutEfficiency object successfully stored");
+
+ delete hChannelEfficiency;
+ filein->Close();
+ return 0;
+}
+
+//_____________________________________________________________________________
+
UInt_t AliTOFPreprocessor::ProcessPulserData()
{
// Processing Pulser Run data for TOF channel status
// Int_t iresultDAQ = ProcessOnlineDelays();
Int_t iresultDAQ = ProcessT0Fill();
Int_t iresultNoiseCalib = ProcessNoiseCalibTrg();
+ Int_t iresultReadout = ProcessReadout();
Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
Int_t iResultHVandLVdps = ProcessHVandLVdps(dcsAliasMap);
- return iresultDAQ+iresultNoiseCalib+iresultDCS+iResultHVandLVdps;
+ return iresultDAQ+iresultNoiseCalib+iresultDCS+iResultHVandLVdps+iresultReadout;
}
// storing
UInt_t ProcessFEEData(); // dummy, for the time being
UInt_t ProcessT0Fill();
UInt_t ProcessNoiseCalibTrg();
+ UInt_t ProcessReadout();
void FillWithCosmicCalibration(AliTOFChannelOnlineArray *cal); // fill with cosmic calibration
void FillWithCableLengthMap(AliTOFChannelOnlineArray *cal); // fill with cable-lenght map
///////////////////////////////////////////////////////////////////////
/*
+ Modified by fbellini on 14/06/2010
+ - Updated plots
+ - use LoadRawDataBuffersV2()
+
Modified by fbellini on 10/05/2010
- Fixed EndOfDetectorCycle() memory corruption bug
TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
- TH1I * h15 = new TH1I("hTOFRawsLTMHits", "LTM hits ; Crate; Counts", 72, 0., 72.);
- TH1I * h16 = new TH1I("hTOFRawsTRMHits035", "TRM hits - crates 0 to 35 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 0., 361.) ;
- TH1I * h17 = new TH1I("hTOFRawsTRMHits3671","TRM hits - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 360., 721.) ;
+ TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
+ TH1F * h16 = new TH1F("hTOFRawsTRMHits035", "TRM hits - crates 0 to 35 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 0., 361.) ;
+ TH1F * h17 = new TH1F("hTOFRawsTRMHits3671","TRM hits - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 360., 721.) ;
- TH1I * h18 = new TH1I("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
+ TH1F * h18 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Counts", 25000, 0. ,610.) ;
TH2F * h20 = new TH2F("hTOFRawTimeVsTRM035", "TOF raws - Hit time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw time [ns]", 361, 0., 361., 250, 0., 610.0) ;
for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
rawReader->Reset();
- tofInput.LoadRawDataBuffers(iDDL);
+ tofInput.LoadRawDataBuffersV2(iDDL);
clonesRawData = (TClonesArray*)tofInput.GetRawData();
for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
AliInfo(Form("Processed %i physics raw events",fProcessedRawEventN));
+ if (fCalibData){
+ //normalize TRM hits plots to the number of enabled channels from OCDB object
+ TH1F * hTrmChannels035 = new TH1F("hTrmchannels035", "Active channels per TRM - crates 0 to 35;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 0., 361.) ;
+ TH1F * hTrmChannels3671 = new TH1F("hTrmChannels3671","Active channels per TRM - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 360., 721.) ;
+
+ for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
+ if (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
+ && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)){
+ Int_t geoId[5];
+ Int_t detId[5];
+ AliTOFGeometry::GetVolumeIndices(ch,geoId);
+ AliTOFRawStream::Geant2EquipmentId(geoId,detId); //detID=(ddl,trm,tdc, chain,channel)
+ if (detId[0]<36) hTrmChannels035->Fill((detId[1]-3)+detId[0]*10);
+ else hTrmChannels3671->Fill((detId[1]-3)+detId[0]*10);
+ }
+ }
+ GetRawsData(16)->Divide(hTrmChannels035);
+ GetRawsData(16)->SetTitle("TRMs average hit number per active channel - crates 0-35");
+ GetRawsData(16)->GetYaxis()->SetTitle("hits/active channels");
+ GetRawsData(17)->Divide(hTrmChannels3671);
+ GetRawsData(17)->SetTitle("TRMs average hit number per active channel - crates 36-71");
+ GetRawsData(17)->GetYaxis()->SetTitle("hits/active channels");
+ }
+
if (fEnableDqmShifterOpt){
// Help make the raw qa histogram easier to interpret for the DQM shifter
// This is still to be optimized...
// //
///////////////////////////////////////////////////////////////
+#include "AliTOFDRMGlobalHeader.h"
+#include "AliTOFDRMGlobalTrailer.h"
+#include "AliTOFDRMStatusHeader1.h"
+#include "AliTOFDRMStatusHeader2.h"
#include "AliTOFDRMStatusHeader3.h"
+#include "AliTOFDRMStatusHeader4.h"
+#include "AliTOFDRMEventCRC.h"
+
+#include "AliTOFLTMGlobalHeader.h"
+#include "AliTOFLTMGlobalTrailer.h"
+#include "AliTOFLTMPDLData.h"
+#include "AliTOFLTMADCData.h"
+#include "AliTOFLTMORData.h"
+
#include "AliTOFTRMGlobalHeader.h"
#include "AliTOFTRMGlobalTrailer.h"
#include "AliTOFTRMChainHeader.h"
#include "AliTOFTRMChainTrailer.h"
+
#include "AliTOFTDCPackedHit.h"
#include "AliTOFTDCUnpackedHit.h"
#include "AliTOFTRMTDCError.h"
#include "AliRawEventHeaderBase.h"
#include "AliRawDataHeader.h"
+#include "AliTOFDecoderV2.h"
+
ClassImp(AliTOFRawStream)
const Int_t AliTOFRawStream::fgkddlBCshift[72] =
fRawReader(rawReader),
fTOFrawData(new TClonesArray("AliTOFrawData",1000)),
fDecoder(new AliTOFDecoder()),
+ fDecoderV2(new AliTOFDecoderV2()),
fDDL(-1),
fTRM(-1),
fTRMchain(-1),
fRawReader(0x0),
fTOFrawData(new TClonesArray("AliTOFrawData",1000)),
fDecoder(new AliTOFDecoder()),
+ fDecoderV2(new AliTOFDecoderV2()),
fDDL(-1),
fTRM(-1),
fTRMchain(-1),
fRawReader(stream.fRawReader),
fTOFrawData(stream.fTOFrawData),
fDecoder(new AliTOFDecoder()),
+ fDecoderV2(new AliTOFDecoderV2()),
fDDL(stream.fDDL),
fTRM(stream.fTRM),
fTRMchain(stream.fTRMchain),
fPackedDigits = 0;
delete fDecoder;
-
+ delete fDecoderV2;
+
fTOFrawData->Clear();
delete fTOFrawData;
if (iPlate==-1) {
/*if (fRawReader)
fRawReader->AddMajorErrorLog(kPlateError,"plate = -1");*/
- printf("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the plate number (%2d %2d %2d)!\n",
- nDDL, nTRM, nTDC);
+ AliWarningGeneral("AliTOFRawStream", Form("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the plate number (%2d %2d %2d)!\n",
+ nDDL, nTRM, nTDC));
}
Int_t iStrip = Equip2VolNstrip(iDDL, nTRM, nTDC);
if (iStrip==-1) {
/*if (fRawReader)
fRawReader->AddMajorErrorLog(kStripError,"strip = -1");*/
- printf("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the strip number (%2d %2d %2d)!\n",
- nDDL, nTRM, nTDC);
+ AliWarningGeneral("AliTOFRawStream", Form("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the strip number (%2d %2d %2d)!\n",
+ nDDL, nTRM, nTDC));
}
Int_t iPadAlongTheStrip = Equip2VolNpad(iDDL, iChain, nTDC, iCH);
if (iPadAlongTheStrip==-1) {
/*if (fRawReader)
fRawReader->AddMajorErrorLog(kPadAlongStripError,"pad = -1");*/
- printf("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the pad number along the strip (%2d %1d %2d %1d)!\n",
- nDDL, iChain, nTDC, iCH);
+ AliWarningGeneral("AliTOFRawStream", Form("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the pad number along the strip (%2d %1d %2d %1d)!\n",
+ nDDL, iChain, nTDC, iCH));
}
Int_t iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
}
//select required DDLs
+ fRawReader->Reset();
fRawReader->Select("TOF", nDDLMin, nDDLMax);
if (verbose)
return kFALSE;
+}
+//-----------------------------------------------------------------------------
+Bool_t AliTOFRawStream::DecodeV2(Int_t verbose = 0) {
+ //
+ // Enhanced decoder method
+ //
+
+ Int_t currentEquipment;
+ Int_t currentDDL;
+ const AliRawDataHeader *currentCDH;
+
+ //pointers
+ UChar_t *data = 0x0;
+
+ // read header
+ if (!fRawReader->ReadHeader()) return kTRUE;
+
+ //get equipment infos
+ currentEquipment = fRawReader->GetEquipmentId();
+ currentDDL = fRawReader->GetDDLID();
+ currentCDH = fRawReader->GetDataHeader();
+ const Int_t kDataSize = fRawReader->GetDataSize();
+ const Int_t kDataWords = kDataSize / 4;
+ data = new UChar_t[kDataSize];
+
+ if (verbose)
+ AliInfo(Form("Found equipment # %d header (DDL # %d): %d bytes (%d words)", currentEquipment, currentDDL, kDataSize, kDataWords));
+
+ if (verbose)
+ AliInfo(Form("Reading equipment #%d (DDL # %d) data...", currentEquipment, currentDDL));
+
+ //read equipment payload
+ if (!fRawReader->ReadNext(data, kDataSize))
+ {
+ fRawReader->AddMajorErrorLog(kDDLdataReading);
+ if (verbose)
+ AliWarning("Error while reading DDL data. Go to next equipment");
+ delete [] data;
+ data = 0x0;
+ return kTRUE;
+ }
+
+ if (verbose)
+ AliInfo(Form("Equipment # %d (DDL # %d) data has been read", currentEquipment, currentDDL));
+
+
+ //set up the decoder
+ fDecoderV2->SetVerbose(verbose);
+
+ //start decoding
+ if (fDecoderV2->Decode((UInt_t *)data, kDataWords) == kTRUE) {
+ fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",currentDDL));
+ AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL));
+ }
+
+ delete [] data;
+
+ if (verbose)
+ AliInfo("All done");
+
+ return kFALSE;
+
}
//---------------------------------------------------------------------------
void
return kFALSE;
}
+//---------------------------------------------------------------------------
+Bool_t
+AliTOFRawStream::LoadRawDataBuffersV2(Int_t indexDDL, Int_t verbose)
+{
+ //
+ // To load the buffers
+ //
+
+ /*
+ * decode raw data and fill output array with TOF hits.
+ * decode algorithm may return with errors due to inconsistent
+ * raw data format detected during decoding process.
+ * decoder algorithm has internal recover procedure to deal with
+ * errors in a safe condition.
+ *
+ * the following conditions will cause total hit rejection from
+ * specific boards where the condition is detected:
+ *
+ * --- within DRM payload (full DRM skipped) ---
+ * - no header/trailer detected
+ *
+ * --- within TRM payload (full TRM skippped) ---
+ * - no header/trailer detected
+ * - empty event inserted
+ * - bad event counter
+ * - bad CRC
+ * - ACQ mode off
+ *
+ * --- within chain payload (full chain skipped) ---
+ * - no header/trailer detected
+ * - bad status
+ * - bad event counter
+ *
+ * --- HPTDC (ful TDC skipped) ---
+ * - error detected
+ *
+ */
+
+ fTOFrawData->Clear();
+ fPackedDigits = 0;
+
+ if (verbose > 0)
+ AliInfo(Form("Decoding raw data for DDL # %d ...", indexDDL));
+
+ //check and fix valid DDL range
+ if (indexDDL < 0){
+ indexDDL = 0;
+ fRawReader->AddMinorErrorLog(kDDLMinError);
+ AliWarning("Wrong DDL range: setting first DDL ID to 0");
+ }
+ if (indexDDL > 71){
+ indexDDL = 71;
+ fRawReader->AddMinorErrorLog(kDDLMaxError);
+ AliWarning("Wrong DDL range: setting last DDL ID to 71");
+ }
+
+ //select required DDLs
+ fRawReader->Reset();
+ fRawReader->Select("TOF", indexDDL, indexDDL);
+
+ /* decode */
+ if (DecodeV2(verbose)) return kTRUE;
+
+ /* read and check CDH info */
+ const AliRawDataHeader *currentCDH = fRawReader->GetDataHeader();
+ Int_t currentMiniEventID = currentCDH->GetMiniEventID();
+ Int_t currentEventID1 = currentCDH->GetEventID1();
+
+ /* read decoder summary data */
+ AliTOFDecoderSummaryData *decodersd;
+ AliTOFDRMSummaryData *drmsd;
+ // AliTOFLTMSummaryData *ltmsd;
+ AliTOFTRMSummaryData *trmsd;
+ AliTOFChainSummaryData *chainsd;
+ AliTOFTDCHitBuffer *hitBuffer;
+ AliTOFTDCHit *hit;
+ AliTOFTDCErrorBuffer *errorBuffer;
+ AliTOFTDCError *error;
+ Bool_t tdcErrorFlag[15];
+ decodersd = fDecoderV2->GetDecoderSummaryData();
+
+ /* check error detected/recovered */
+ if (decodersd->GetErrorDetected()) {
+ AliWarning(Form("Error detected while decoding DDL %d (errorSlotID mask = %04x)", indexDDL, decodersd->GetErrorSlotID()));
+ if (decodersd->GetRecoveringError()) {
+ AliWarning("Couldn't recover from error");
+ }
+ else {
+ AliWarning("Error recovered, anyway something is probably lost");
+ }
+ }
+ /* check DRM header/trailer */
+ drmsd = decodersd->GetDRMSummaryData();
+ if (!drmsd->GetHeader() || !drmsd->GetTrailer()) {
+ AliWarning("DRM header/trailer missing, skip DDL");
+ return kTRUE;
+ }
+ /* check partecipating mask */
+ if (drmsd->GetPartecipatingSlotID() != drmsd->GetDecoderSlotEnableMask()) {
+ AliWarning(Form("DRM slot enable mask differs from decoder slot enable mask (%08x != %08x) in DDL %d", drmsd->GetSlotEnableMask(), drmsd->GetDecoderSlotEnableMask(), indexDDL));
+ for (Int_t ibit = 0; ibit < 11; ibit++)
+ if ((drmsd->GetPartecipatingSlotID() & (0x1 << ibit)) && !(drmsd->GetDecoderSlotEnableMask() & (0x1 << ibit)))
+ AliWarning(Form("readout slot %d data is missing in decoder", ibit + 2));
+ }
+
+ /* get DRM data */
+ Int_t currentL0BCID = drmsd->GetL0BCID();
+
+ /* loop over TRM to get hits */
+ Int_t hitACQ, hitPS, hitSlotID, hitChain, hitTDC, hitChan, hitTimeBin, hitTOTBin, hitDeltaBC, hitL0L1Latency, hitLeading, hitTrailing, hitError;
+ Int_t currentBunchID;
+
+ /* loop over TRMs */
+ for (Int_t itrm = 0; itrm < 10; itrm++) {
+ trmsd = drmsd->GetTRMSummaryData(itrm);
+ /* check header/trailer */
+ if (!trmsd->GetHeader() || !trmsd->GetTrailer()) continue;
+ /* skip if TRM empty event detected */
+ if (trmsd->GetEBit() != 0) continue;
+ /* skip if bad TRM event counter detected */
+ if (trmsd->GetEventCounter() != drmsd->GetLocalEventCounter()) continue;
+ /* skip if bad TRM CRC detected */
+ if (trmsd->GetEventCRC() != trmsd->GetDecoderCRC()) continue;
+
+ /* loop over chains */
+ for (Int_t ichain = 0; ichain < 2; ichain++) {
+ chainsd = trmsd->GetChainSummaryData(ichain);
+ /* check header/trailer */
+ if (!chainsd->GetHeader() || !chainsd->GetTrailer()) continue;
+ /* skip if chain bad status detected */
+ if (chainsd->GetStatus() != 0) continue;
+ /* skip if bad chain event counter detected */
+ if (chainsd->GetEventCounter() != drmsd->GetLocalEventCounter()) continue;
+
+ currentBunchID = chainsd->GetBunchID();
+ hitBuffer = chainsd->GetTDCPackedHitBuffer();
+ errorBuffer = chainsd->GetTDCErrorBuffer();
+
+ /* check TDC errors and set TDC error flag */
+ for (Int_t itdc = 0; itdc < 15; itdc++) tdcErrorFlag[itdc] = kFALSE;
+ for (Int_t ierr = 0; ierr < errorBuffer->GetEntries(); ierr++) {
+ error = errorBuffer->GetError(ierr);
+ tdcErrorFlag[error->GetTDCID()] = kTRUE;
+ }
+
+ /* loop over hits */
+ for (Int_t ihit = 0; ihit < hitBuffer->GetEntries(); ihit++) {
+
+ /* get hit */
+ hit = hitBuffer->GetHit(ihit);
+ /* skip hit if coming from a TDC with error detected */
+ if (tdcErrorFlag[hit->GetTDCID()]) continue;
+
+ /* set info */
+ hitACQ = trmsd->GetACQBits();
+ hitPS = hit->GetPSBits();
+ hitSlotID = trmsd->GetSlotID();
+ hitChain = chainsd->GetChain();
+ hitTDC = hit->GetTDCID();
+ hitChan = hit->GetChan();
+ hitTimeBin = hit->GetHitTime();
+ hitTOTBin = hit->GetTOTWidth();
+ hitDeltaBC = currentBunchID - currentEventID1;
+ hitL0L1Latency = currentMiniEventID - currentL0BCID;
+
+ hitLeading = hitTimeBin;
+ hitTrailing = -1;
+ hitError = -1;
+
+ /* add hit */
+ TClonesArray &arrayTofRawData = *fTOFrawData;
+ new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(hitSlotID, hitChain, hitTDC, hitChan, hitTimeBin, hitTOTBin, hitLeading, hitTrailing, hitPS, hitACQ, hitError, hitDeltaBC, hitL0L1Latency);
+ }
+ }
+ }
+
+ return kFALSE;
+}
+
//---------------------------------------------------------------------------
void AliTOFRawStream::Geant2EquipmentId(Int_t vol[], Int_t eqId[])
{
class AliTOFHitData;
+class AliTOFDecoderV2;
+
/**********************************
* OLD DEFINITIONS
**********************************/
Bool_t DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose);
Bool_t Decode(Int_t verbose);
+ Bool_t DecodeV2(Int_t verbose);
AliTOFDecoder *GetDecoder() const {return fDecoder;};
+ AliTOFDecoderV2 *GetDecoderV2() const {return fDecoderV2;};
void SetV2718Patch(Bool_t V2718Patch = kTRUE) {fDecoder->SetV2718Patch(V2718Patch);};
void SetRawReader(AliRawReader * const rawReader) {fRawReader=rawReader;};
void ResetBuffers();
Bool_t LoadRawDataBuffers(Int_t indexDDL, Int_t verbose = 0);
+ Bool_t LoadRawDataBuffersV2(Int_t indexDDL, Int_t verbose = 0);
static void ApplyBCCorrections(Bool_t Value = kTRUE) {fgApplyBCCorrections = Value;};
Int_t GetEventID() const {return fEventID;}; // getter for the eventID1 (bunch crossing) in the common data header
TClonesArray *fTOFrawData; // pointer to AliTOFrawData TClonesArray
AliTOFDecoder *fDecoder; //pointer to TOF decoder
+ AliTOFDecoderV2 *fDecoderV2; //pointer to TOF decoder
Int_t fDDL; // DDL file number [0;71]
Int_t fTRM; // TRM number [1;12]
--- /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 class defines the TOF object to be stored
+// * in Reference data a run-by-run basis in order to have
+// * info about readout electronics
+// *
+// *
+// *
+// *
+
+#include "AliTOFReadoutInfo.h"
+#include "TH1F.h"
+#include "TH2F.h"
+
+ClassImp(AliTOFReadoutInfo)
+
+//_________________________________________________________
+
+AliTOFReadoutInfo::AliTOFReadoutInfo() :
+ TObject(),
+ fChainEfficiency(NULL),
+ fTRMData(NULL),
+ fTRMEmptyEvent(NULL),
+ fTRMBadEventCounter(NULL),
+ fTRMBadCRC(NULL),
+ fChainData(NULL),
+ fChainBadStatus(NULL),
+ fChainBadEventCounter(NULL),
+ fTDCError(NULL),
+ fTDCErrorFlags(NULL)
+{
+ /*
+ * default constructor
+ */
+}
+
+//_________________________________________________________
+
+AliTOFReadoutInfo::~AliTOFReadoutInfo()
+{
+ /*
+ * default destructor
+ */
+
+}
+
+//_________________________________________________________
+
+AliTOFReadoutInfo::AliTOFReadoutInfo(const AliTOFReadoutInfo &source) :
+ TObject(source),
+ fChainEfficiency(source.fChainEfficiency),
+ fTRMData(source.fTRMData),
+ fTRMEmptyEvent(source.fTRMEmptyEvent),
+ fTRMBadEventCounter(source.fTRMBadEventCounter),
+ fTRMBadCRC(source.fTRMBadCRC),
+ fChainData(source.fChainData),
+ fChainBadStatus(source.fChainBadStatus),
+ fChainBadEventCounter(source.fChainBadEventCounter),
+ fTDCError(source.fTDCError),
+ fTDCErrorFlags(source.fTDCErrorFlags)
+{
+ /*
+ * copy constructor
+ */
+
+}
+
+//_________________________________________________________
+
+AliTOFReadoutInfo &
+AliTOFReadoutInfo::operator=(const AliTOFReadoutInfo &source)
+{
+ /*
+ * operator=
+ */
+
+ if (this == &source) return *this;
+ TObject::operator=(source);
+
+ fChainEfficiency = source.fChainEfficiency;
+ fTRMData = source.fTRMData;
+ fTRMEmptyEvent = source.fTRMEmptyEvent;
+ fTRMBadEventCounter = source.fTRMBadEventCounter;
+ fTRMBadCRC = source.fTRMBadCRC;
+ fChainData = source.fChainData;
+ fChainBadStatus = source.fChainBadStatus;
+ fChainBadEventCounter = source.fChainBadEventCounter;
+ fTDCError = source.fTDCError;
+ fTDCErrorFlags = source.fTDCErrorFlags;
+
+ return *this;
+}
+
--- /dev/null
+#ifndef ALITOFREADOUTINFO_H
+#define ALITOFREADOUTINFO_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+/* $Id$ */
+
+// *
+// *
+// *
+// * this class defines the TOF object to be stored
+// * in Reference data a run-by-run basis in order to have
+// * info about readout electronics
+// *
+// *
+// *
+// *
+
+#include "TObject.h"
+
+class TH1F;
+class TH2F;
+
+class AliTOFReadoutInfo :
+public TObject
+{
+
+ public:
+
+ AliTOFReadoutInfo(); // default constructor
+ virtual ~AliTOFReadoutInfo(); // default destructor
+ AliTOFReadoutInfo(const AliTOFReadoutInfo &source); // copy constructor
+ AliTOFReadoutInfo &operator=(const AliTOFReadoutInfo &source); // operator=
+
+ TH1F *GetChainEfficiency() const {return fChainEfficiency;}; // getter
+ TH1F *GetTRMData() const {return fTRMData;}; // getter
+ TH1F *GetTRMEmptyEvent() const {return fTRMEmptyEvent;}; // getter
+ TH1F *GetTRMBadEventCounter() const {return fTRMBadEventCounter;}; // getter
+ TH1F *GetTRMBadCRC() const {return fTRMBadCRC;}; // getter
+ TH1F *GetChainData() const {return fChainData;}; // getter
+ TH1F *GetChainBadStatus() const {return fChainBadStatus;}; // getter
+ TH1F *GetChainBadEventCounter() const {return fChainBadEventCounter;}; // getter
+ TH1F *GetTDCError() const {return fTDCError;}; // getter
+ TH2F *GetTDCErrorFlags() const {return fTDCErrorFlags;}; // getter
+
+
+ void SetChainEfficiency(TH1F *value) {fChainEfficiency = value;}; // getter
+ void SetTRMData(TH1F *value) {fTRMData = value;}; // getter
+ void SetTRMEmptyEvent(TH1F *value) {fTRMEmptyEvent = value;}; // getter
+ void SetTRMBadEventCounter(TH1F *value) {fTRMBadEventCounter = value;}; // getter
+ void SetTRMBadCRC(TH1F *value) {fTRMBadCRC = value;}; // getter
+ void SetChainData(TH1F *value) {fChainData = value;}; // getter
+ void SetChainBadStatus(TH1F *value) {fChainBadStatus = value;}; // getter
+ void SetChainBadEventCounter(TH1F *value) {fChainBadEventCounter = value;}; // getter
+ void SetTDCError(TH1F *value) {fTDCError = value;}; // getter
+ void SetTDCErrorFlags(TH2F *value) {fTDCErrorFlags = value;}; // getter
+
+
+ private:
+
+ TH1F *fChainEfficiency; // chain efficiency
+ TH1F *fTRMData; // TRM data
+ TH1F *fTRMEmptyEvent; // TRM empty event
+ TH1F *fTRMBadEventCounter; // TRM bad event counter
+ TH1F *fTRMBadCRC; // TRM bad CRC
+ TH1F *fChainData; // chain data
+ TH1F *fChainBadStatus; // chain bad status
+ TH1F *fChainBadEventCounter; // chain bad event counter
+ TH1F *fTDCError; // TDC error
+ TH2F *fTDCErrorFlags; // TDC error flags
+
+ ClassDef(AliTOFReadoutInfo, 1);
+};
+
+#endif /* ALITOFREADOUTINFO_H */
//
//Retrieving the TOF calibration info
- fTOFcalib = new AliTOFcalib();
+ fTOFcalib = new AliTOFcalib();
+ fTOFcalib->Init();
+
+#if 0
fTOFcalib->CreateCalObjects();
if(!fTOFcalib->ReadParOnlineDelayFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
if(!fTOFcalib->ReadCTPLatencyFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
if(!fTOFcalib->ReadT0FillFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
if(!fTOFcalib->ReadRunParamsFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
+#endif
+
}
//_____________________________________________________________________________
//
TString optionString = GetOption();
+
// use V1 cluster finder if selected
if (optionString.Contains("ClusterizerV1")) {
static AliTOFClusterFinderV1 tofClus(fTOFcalib);
// decoder version option
- if (optionString.Contains("DecoderV0"))
+ if (optionString.Contains("DecoderV0")) {
tofClus.SetDecoderVersion(0);
- else
+ }
+ else if (optionString.Contains("DecoderV1")) {
tofClus.SetDecoderVersion(1);
+ }
+ else {
+ tofClus.SetDecoderVersion(2);
+ }
tofClus.Digits2RecPoints(rawReader, clustersTree);
}
static AliTOFClusterFinder tofClus(fTOFcalib);
// decoder version option
- if (optionString.Contains("DecoderV0"))
+ if (optionString.Contains("DecoderV0")) {
tofClus.SetDecoderVersion(0);
- else
+ }
+ else if (optionString.Contains("DecoderV1")) {
tofClus.SetDecoderVersion(1);
+ }
+ else {
+ tofClus.SetDecoderVersion(2);
+ }
tofClus.Digits2RecPoints(rawReader, clustersTree);
}
static AliTOFClusterFinderV1 tofClus(fTOFcalib);
// decoder version option
- if (optionString.Contains("DecoderV0"))
+ if (optionString.Contains("DecoderV0")) {
tofClus.SetDecoderVersion(0);
- else
+ }
+ else if (optionString.Contains("DecoderV1")) {
tofClus.SetDecoderVersion(1);
+ }
+ else {
+ tofClus.SetDecoderVersion(2);
+ }
tofClus.Digits2RecPoints(digitsTree, clustersTree);
}
static AliTOFClusterFinder tofClus(fTOFcalib);
// decoder version option
- if (optionString.Contains("DecoderV0"))
+ if (optionString.Contains("DecoderV0")) {
tofClus.SetDecoderVersion(0);
- else
+ }
+ else if (optionString.Contains("DecoderV1")) {
tofClus.SetDecoderVersion(1);
+ }
+ else {
+ tofClus.SetDecoderVersion(2);
+ }
tofClus.Digits2RecPoints(digitsTree, clustersTree);
}
static AliTOFClusterFinderV1 tofClus(fTOFcalib);
// decoder version option
- if (optionString.Contains("DecoderV0"))
+ if (optionString.Contains("DecoderV0")) {
tofClus.SetDecoderVersion(0);
- else
+ }
+ else if (optionString.Contains("DecoderV1")) {
tofClus.SetDecoderVersion(1);
+ }
+ else {
+ tofClus.SetDecoderVersion(2);
+ }
tofClus.Raw2Digits(reader, digitsTree);
}
static AliTOFClusterFinder tofClus(fTOFcalib);
// decoder version option
- if (optionString.Contains("DecoderV0"))
+ if (optionString.Contains("DecoderV0")) {
tofClus.SetDecoderVersion(0);
- else
+ }
+ else if (optionString.Contains("DecoderV1")) {
tofClus.SetDecoderVersion(1);
+ }
+ else {
+ tofClus.SetDecoderVersion(2);
+ }
tofClus.Raw2Digits(reader, digitsTree);
}
--- /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 class defines the TOF object to be stored
+// * in OCDB in order to have TOF response correction
+// * and actual resolution
+// *
+// *
+// *
+// *
+
+#include "AliTOFResponseParams.h"
+#include "TGraph.h"
+
+ClassImp(AliTOFResponseParams)
+
+//_________________________________________________________
+
+AliTOFResponseParams::AliTOFResponseParams() :
+ TObject()
+{
+ /*
+ * default constructor
+ */
+
+ for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
+ fNPoints[ipart] = 0;
+}
+
+//_________________________________________________________
+
+AliTOFResponseParams::AliTOFResponseParams(Int_t *nPoints) :
+ TObject()
+{
+ /*
+ * default constructor
+ */
+
+ for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
+ fNPoints[ipart] = nPoints[ipart] < fgkMaxPoints ? nPoints[ipart] : fgkMaxPoints;
+}
+
+//_________________________________________________________
+
+AliTOFResponseParams::~AliTOFResponseParams()
+{
+ /*
+ * default destructor
+ */
+
+}
+
+//_________________________________________________________
+
+AliTOFResponseParams::AliTOFResponseParams(const AliTOFResponseParams &source) :
+ TObject(source)
+{
+ /*
+ * copy constructor
+ */
+
+ for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
+ fNPoints[ipart] = source.fNPoints[ipart];
+ for (Int_t ipoint = 0; ipoint < fNPoints[ipart]; ipoint++) {
+ fP[ipart][ipoint] = source.fP[ipart][ipoint];
+ fTExpCorr[ipart][ipoint] = source.fTExpCorr[ipart][ipoint];
+ }
+ }
+
+}
+
+//_________________________________________________________
+
+AliTOFResponseParams &
+AliTOFResponseParams::operator=(const AliTOFResponseParams &source)
+{
+ /*
+ * operator=
+ */
+
+ if (this == &source) return *this;
+ TObject::operator=(source);
+
+ for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
+ fNPoints[ipart] = source.fNPoints[ipart];
+ for (Int_t ipoint = 0; ipoint < fNPoints[ipart]; ipoint++) {
+ fP[ipart][ipoint] = source.fP[ipart][ipoint];
+ fTExpCorr[ipart][ipoint] = source.fTExpCorr[ipart][ipoint];
+ }
+ }
+
+ return *this;
+}
+
+//_________________________________________________________
+
+TGraph *
+AliTOFResponseParams::DrawGraph(Int_t ipart, Option_t* option)
+{
+ /*
+ * draw
+ */
+
+ if (ipart >= AliPID::kSPECIES) return NULL;
+ if (fNPoints[ipart] == 0) return NULL;
+
+ TGraph *graph = new TGraph(fNPoints[ipart], fP[ipart], fTExpCorr[ipart]);
+ graph->Draw(option);
+ return graph;
+}
+
+//_________________________________________________________
+
+Double_t
+AliTOFResponseParams::EvalTExpCorr(Int_t ipart, Double_t p)
+{
+ /*
+ * eval corr
+ */
+
+ if (ipart >= AliPID::kSPECIES) return 0.;
+ if (fNPoints[ipart] == 0) return 0.;
+ if (p < fP[ipart][0]) return fTExpCorr[ipart][0];
+ if (p >= fP[ipart][fNPoints[ipart] - 1]) return fTExpCorr[ipart][fNPoints[ipart] - 1];
+
+ Int_t ipoint;
+ for (ipoint = 0; ipoint < fNPoints[ipart] - 1; ipoint++)
+ if (p >= fP[ipart][ipoint] && p < fP[ipart][ipoint + 1]) break;
+ Double_t coeff = (fTExpCorr[ipart][ipoint + 1] - fTExpCorr[ipart][ipoint]) / (fP[ipart][ipoint + 1] - fP[ipart][ipoint]);
+ Double_t corr = fTExpCorr[ipart][ipoint] + coeff * (p - fP[ipart][ipoint]);
+ return corr;
+}
--- /dev/null
+#ifndef ALITOFRESPONSEPARAMS_H
+#define ALITOFRESPONSEPARAMS_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+/* $Id$ */
+
+// *
+// *
+// *
+// * this class defines the TOF object to be stored
+// * in OCDB in order to have TOF response correction
+// * and actual resolution
+// *
+// *
+// *
+// *
+
+class TGraph;
+
+#include "TObject.h"
+#include "AliPID.h"
+
+class AliTOFResponseParams :
+public TObject
+{
+
+ public:
+
+ AliTOFResponseParams(); // default constructor
+ AliTOFResponseParams(Int_t *nPoints); // standard constructor
+ virtual ~AliTOFResponseParams(); // default destructor
+ AliTOFResponseParams(const AliTOFResponseParams &source); // copy constructor
+ AliTOFResponseParams &operator=(const AliTOFResponseParams &source); // operator=
+
+ Int_t GetNPoints(Int_t ipart) const {return ipart < AliPID::kSPECIES ? fNPoints[ipart] : 0;}; // getter
+ Double_t GetP(Int_t ipart, Int_t ipoint) const {return ipart < AliPID::kSPECIES && ipoint < fNPoints[ipart] ? fP[ipart][ipoint] : 0.;}; // getter
+ Double_t GetTExpCorr(Int_t ipart, Int_t ipoint) const {return ipart < AliPID::kSPECIES && ipoint < fNPoints[ipart] ? fTExpCorr[ipart][ipoint] : 0.;}; // getter
+
+ void SetP(Int_t ipart, Double_t *value) {if (ipart < AliPID::kSPECIES) for (Int_t ipoint = 0; ipoint < fNPoints[ipart]; ipoint++) fP[ipart][ipoint] = value[ipoint];}; // setter
+ void SetTExpCorr(Int_t ipart, Double_t *value) {if (ipart < AliPID::kSPECIES) for (Int_t ipoint = 0; ipoint < fNPoints[ipart]; ipoint++) fTExpCorr[ipart][ipoint] = value[ipoint];}; // setter
+
+ Double_t EvalTExpCorr(Int_t ipart, Double_t p); // eval corr
+ TGraph *DrawGraph(Int_t ipart, Option_t* option = ""); // draw
+
+ private:
+
+ static const Int_t fgkMaxPoints = 20; // max number of points
+ Int_t fNPoints[AliPID::kSPECIES]; // number of points
+ Double_t fP[AliPID::kSPECIES][fgkMaxPoints]; // average momentum (GeV/c)
+ Double_t fTExpCorr[AliPID::kSPECIES][fgkMaxPoints]; // expected time correction (ps)
+
+ ClassDef(AliTOFResponseParams, 1);
+};
+
+#endif /* ALITOFRESPONSEPARAMS_H */
// Use case in an analysis task: //
// //
// Create the object in the task constructor (fTOFmaker is a private var) //
-// fTOFmaker = new AliTOFT0maker(); //
-// fTOFmaker->SetTimeResolution(130.0); // if you want set the TOF res //
+// AliESDpid *extPID=new AliESDpid(); //
+// fTOFmaker = new AliTOFT0maker(extPID); //
+// fTOFmaker->SetTimeResolution(100.0); // if you want set the TOF res //
// 115 ps is the TOF default resolution value //
// //
// Use the RemakePID method in the task::Exec //
#include "AliTOFT0v1.h"
#include "AliTOFT0maker.h"
-#include "AliTOFcalibHisto.h"
#include "AliPID.h"
#include "AliESDpid.h"
#include "AliESDEvent.h"
#include "TFile.h"
#include "TH1F.h"
+#include "AliTOFcalib.h"
+#include "AliTOFRunParams.h"
+#include "TRandom.h"
ClassImp(AliTOFT0maker)
//____________________________________________________________________________
- AliTOFT0maker::AliTOFT0maker():
- fCalib(new AliTOFcalibHisto()),
- fnT0(0),
- fiT0(0),
+AliTOFT0maker::AliTOFT0maker():
+ TObject(),
+ fT0TOF(NULL),
+ fPIDesd(NULL),
+ fExternalPIDFlag(kFALSE),
+ fTOFcalib(NULL),
+ fNoTOFT0(0),
+ fTimeResolution(100),
+ fT0sigma(1000),
+ fHmapChannel(0),
+ fKmask(0),
+ fT0width(150.)
+{
+ // ctr
+ fCalculated[0] = 0;
+ fCalculated[1] = 0;
+ fCalculated[2] = 0;
+ fCalculated[3] = 0;
+
+ fT0TOF = new AliTOFT0v1();
+ if(AliPID::ParticleMass(0) == 0) new AliPID();
+
+ fPIDesd = new AliESDpid();
+
+ fPtCutMin[0] = 0.3;
+ fPtCutMin[1] = 0.5;
+ fPtCutMin[2] = 0.6;
+ fPtCutMin[3] = 0.7;
+ fPtCutMin[4] = 0.8;
+ fPtCutMin[5] = 0.9;
+ fPtCutMin[6] = 1;
+ fPtCutMin[7] = 1.2;
+ fPtCutMin[8] = 1.5;
+ fPtCutMin[9] = 2;
+
+ fPtCutMax[0] = 0.5;
+ fPtCutMax[1] = 0.6;
+ fPtCutMax[2] = 0.7;
+ fPtCutMax[3] = 0.8;
+ fPtCutMax[4] = 0.9;
+ fPtCutMax[5] = 1;
+ fPtCutMax[6] = 1.2;
+ fPtCutMax[7] = 1.5;
+ fPtCutMax[8] = 2;
+ fPtCutMax[9] = 3;
+
+ /* init arrays */
+ for (Int_t i = 0; i < 10; i++) {
+ fT0pt[i] = 0.;
+ fT0ptSigma[i] = 0.;
+ }
+}
+//____________________________________________________________________________
+AliTOFT0maker::AliTOFT0maker(AliESDpid *externalPID, AliTOFcalib *tofCalib):
+ TObject(),
+ fT0TOF(NULL),
+ fPIDesd(externalPID),
+ fExternalPIDFlag(kTRUE),
+ fTOFcalib(tofCalib),
fNoTOFT0(0),
- fESDswitch(0),
- fTimeResolution(115),
+ fTimeResolution(100),
fT0sigma(1000),
fHmapChannel(0),
- fKmask(0)
+ fKmask(0),
+ fT0width(150.)
{
// ctr
fCalculated[0] = 0;
fCalculated[2] = 0;
fCalculated[3] = 0;
- // fCalib->SetCalibParFileName("./AliTOFcalibPar.LHC10b.7000GeV.20100405.root");
- fCalib->LoadCalibPar();
-
+ fT0TOF = new AliTOFT0v1();
if(AliPID::ParticleMass(0) == 0) new AliPID();
- SetESDdata();
+ if(!fPIDesd){
+ fPIDesd = new AliESDpid();
+ fExternalPIDFlag = kFALSE;
+ }
+
+ fPtCutMin[0] = 0.3;
+ fPtCutMin[1] = 0.5;
+ fPtCutMin[2] = 0.6;
+ fPtCutMin[3] = 0.7;
+ fPtCutMin[4] = 0.8;
+ fPtCutMin[5] = 0.9;
+ fPtCutMin[6] = 1;
+ fPtCutMin[7] = 1.2;
+ fPtCutMin[8] = 1.5;
+ fPtCutMin[9] = 2;
+
+ fPtCutMax[0] = 0.5;
+ fPtCutMax[1] = 0.6;
+ fPtCutMax[2] = 0.7;
+ fPtCutMax[3] = 0.8;
+ fPtCutMax[4] = 0.9;
+ fPtCutMax[5] = 1;
+ fPtCutMax[6] = 1.2;
+ fPtCutMax[7] = 1.5;
+ fPtCutMax[8] = 2;
+ fPtCutMax[9] = 3;
+
+ /* init arrays */
+ for (Int_t i = 0; i < 10; i++) {
+ fT0pt[i] = 0.;
+ fT0ptSigma[i] = 0.;
+ }
}
+
+/* copy-constructor and operator= suppressed
+
+
//____________________________________________________________________________
AliTOFT0maker::AliTOFT0maker(const AliTOFT0maker & t) :
- TObject(),
- fCalib(t.fCalib),
- fnT0(t.fnT0),
- fiT0(t.fiT0),
+ TObject(t),
+ fT0TOF(t.fT0TOF),
+ fPIDESD(t.fPIDESD),
fNoTOFT0(t.fNoTOFT0),
- fESDswitch(t.fESDswitch),
fTimeResolution(t.fTimeResolution),
fT0sigma(t.fT0sigma),
fHmapChannel(t.fHmapChannel),
fKmask(t.fKmask)
-{
+ {
// copy ctr
}
if (this == &t)
return *this;
- fCalib = t.fCalib;
- fESDswitch = t.fESDswitch;
+
+ TObject::operator=(t);
fTimeResolution = t.fTimeResolution;
fT0sigma = t.fT0sigma;
return *this;
}
+
+*/
+
//____________________________________________________________________________
AliTOFT0maker::~AliTOFT0maker()
{
// dtor
- if(fCalib) delete fCalib;
+
+ delete fT0TOF;
+ if (!fExternalPIDFlag) delete fPIDesd;
}
//____________________________________________________________________________
-Double_t* AliTOFT0maker::RemakePID(AliESDEvent *esd,Double_t t0time,Double_t t0sigma){
+Double_t* AliTOFT0maker::ComputeT0TOF(AliESDEvent *esd,Double_t t0time,Double_t t0sigma){
//
// Remake TOF PID probabilities
//
- Double_t *t0tof;
+ Double_t t0tof[4];
if(fKmask) ApplyMask(esd);
- AliTOFT0v1* t0maker=new AliTOFT0v1(esd);
-// t0maker->SetCalib(fCalib);
- t0maker->SetTimeResolution(fTimeResolution*1e-12);
-
- if(! fESDswitch){
- TakeTimeRawCorrection(esd);
+ /* get T0 spread from TOFcalib if available otherwise use default value */
+ if (fTOFcalib && esd) {
+ AliTOFRunParams *runParams = fTOFcalib->GetRunParams();
+ if (runParams && runParams->GetTimestamp(0) != 0) {
+ Float_t t0spread = runParams->EvalT0Spread(esd->GetTimeStamp());
+ SetT0FillWidth(t0spread);
+ }
}
- t0tof=t0maker->DefineT0("all");
+ fT0TOF->Init(esd);
+ AliTOFT0v1* t0maker= fT0TOF;
+ t0maker->SetTimeResolution(fTimeResolution*1e-12);
+
+ t0maker->DefineT0("all",1.5,3.0);
+ t0tof[0] = t0maker->GetResult(0);
+ t0tof[1] = t0maker->GetResult(1);
+ t0tof[2] = t0maker->GetResult(2);
+ t0tof[3] = t0maker->GetResult(3);
Float_t lT0Current=0.;
fT0sigma=1000;
// Int_t nrun = esd->GetRunNumber();
- Double_t t0fill = GetT0Fill();
+ Double_t t0fill = 0.;
+
t0time += t0fill;
- Float_t sigmaFill = (t0fill - Int_t(t0fill))*1000;
- if(sigmaFill < 0) sigmaFill += 1000;
+ Float_t sigmaFill = fT0width;
+
+ if(sigmaFill < 20) sigmaFill = 140;
fCalculated[0]=-1000*t0tof[0]; // best t0
fCalculated[1]=1000*t0tof[1]; // sigma best t0
fCalculated[6]=sigmaFill; // sigma t0 fill
fCalculated[7] = t0tof[3]; // n TOF tracks used for T0
- if(fCalculated[1] < sigmaFill){
- if(fnT0 < 10){
- fT0fill[fiT0] = fCalculated[0];
- fT0sigmaTOF[fiT0] = fCalculated[1];
- fiT0++;
- fnT0++;
- }
- else if(TMath::Abs(fCalculated[0] - t0fill) < 500){
- fT0fill[fiT0] = fCalculated[0];
- fT0sigmaTOF[fiT0] = fCalculated[1];
- fiT0++;
- fnT0++;
- }
-
- // printf("%i - %i) %f\n",fiT0,fnT0,t0fill);
- }
- if(fnT0==10) fiT0=0;
-
- if(fiT0 > fgkNmaxT0step-1) fiT0=0;
-
- if(fnT0 < 100){
- t0time -= t0fill;
- sigmaFill=200;
- t0fill=0;
- fCalculated[2] = t0fill; //t0 fill
- }
-
- if(fCalculated[1] < sigmaFill && TMath::Abs(fCalculated[0] - t0fill) < 500){
+ if(fCalculated[1] < sigmaFill && TMath::Abs(fCalculated[0] - t0fill) < 500 && fCalculated[1] < fTimeResolution*1.2){
fT0sigma=fCalculated[1];
lT0Current=fCalculated[0];
}
fCalculated[5] = sigmaFill;
}
- if(fCalculated[1] < 1 || fT0sigma > sigmaFill){
+ if(fCalculated[1] < 1 || fT0sigma > sigmaFill || fCalculated[1] > fTimeResolution* 1.2){
fT0sigma =1000;
fCalculated[4] = t0fill;
fCalculated[5] = sigmaFill;
fCalculated[1] = sigmaFill;
}
+ // T0 pt bin
+ for(Int_t i=0;i<10;i++){
+ t0maker->DefineT0("all",fPtCutMin[i],fPtCutMax[i]);
+ t0tof[0] = t0maker->GetResult(0);
+ t0tof[1] = t0maker->GetResult(1);
+ t0tof[2] = t0maker->GetResult(2);
+ t0tof[3] = t0maker->GetResult(3);
+ fT0pt[i] =-1000*t0tof[0]; // best t0
+ fT0ptSigma[i] =1000*t0tof[1]; // sigma best t0
+
+ if(fT0ptSigma[i] < sigmaFill && fT0ptSigma[i] < fTimeResolution * 1.2 && TMath::Abs(fT0pt[i] - t0fill) < 500){
+ // Ok T0
+ }
+ else{
+ fT0pt[i] = t0fill;
+ fT0ptSigma[i] = sigmaFill;
+ }
+ }
+ //----
+ SetTOFResponse();
-
- RemakeTOFpid(esd,lT0Current);
-
return fCalculated;
}
//____________________________________________________________________________
-void AliTOFT0maker::TakeTimeRawCorrection(AliESDEvent * const esd){
- //
- // Take raw corrections for time measurements
- //
-
- Int_t ntracks = esd->GetNumberOfTracks();
+Double_t *AliTOFT0maker::GetT0p(Float_t p){// [0]=to -- [1] = sigma T0
+ Int_t i=0;
+ while(p > fPtCutMin[i] && i < 10) i++;
+ if(i > 0) i--;
- while (ntracks--) {
- AliESDtrack *t=esd->GetTrack(ntracks);
-
- if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
-
- Double_t time=t->GetTOFsignalRaw();
-
- Double_t tot = t->GetTOFsignalToT();
- Int_t chan = t->GetTOFCalChannel();
- Double_t corr = fCalib->GetFullCorrection(chan,tot) - fCalib->GetCorrection(AliTOFcalibHisto::kTimeSlewingCorr,chan,0);
- time -= corr*1000;
-
- t->SetTOFsignal(time);
-
- }
+ fT0cur[0] = fT0pt[i];
+ fT0cur[1] = fT0ptSigma[i];
+ return fT0cur;
}
//____________________________________________________________________________
-void AliTOFT0maker::RemakeTOFpid(AliESDEvent *esd,Float_t timezero){
- //
- // Recalculate TOF PID probabilities
- //
+void AliTOFT0maker::SetTOFResponse(){
+ fPIDesd->GetTOFResponse().SetTimeResolution(TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution));
+}
+//____________________________________________________________________________
+Float_t AliTOFT0maker::GetExpectedSigma(Float_t mom, Float_t tof, Float_t mass){
+ Double_t *sigmaT0 = GetT0p(mom);
+ fPIDesd->GetTOFResponse().SetTimeResolution(TMath::Sqrt(sigmaT0[1]*sigmaT0[1] + fTimeResolution*fTimeResolution));
+ Float_t sigma = fPIDesd->GetTOFResponse().GetExpectedSigma(mom,tof,mass);
+ fPIDesd->GetTOFResponse().SetTimeResolution(TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution));
- AliESDpid pidESD;
- pidESD.GetTOFResponse().SetTimeResolution(TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution));
- pidESD.MakePID(esd,kFALSE,timezero);
-
+ return sigma;
}
//____________________________________________________________________________
-Double_t AliTOFT0maker::GetT0Fill() const {
+void AliTOFT0maker::ApplyT0TOF(AliESDEvent *esd){
//
- // Return T0 of filling
+ // Recalculate TOF PID probabilities
//
-
- Double_t t0=0.200;
-
- Int_t n=fnT0;
- if(n >10 && n <= 20) n = 10;
- else if(n > 20){
- n -= 10;
- }
+ // subtruct t0 for each track
+ Int_t ntracks = esd->GetNumberOfTracks();
- if(n > fgkNmaxT0step) n = fgkNmaxT0step;
-
- if(n>1){
- Double_t lT0av=0;
- Double_t lT0sigmaav=0;
- Double_t lT0avErr=0;
- for(Int_t i=0;i<n;i++){
- lT0av+=fT0fill[i];
- lT0sigmaav += fT0sigmaTOF[fiT0];
- lT0avErr+=fT0fill[i]*fT0fill[i];
- }
- lT0avErr -= lT0av*lT0av/n;
- lT0av /= n;
- lT0sigmaav /= n;
- lT0avErr = TMath::Sqrt(TMath::Max(lT0avErr/(n-1) - lT0sigmaav*lT0sigmaav,0.00001));
+ while (ntracks--) {
+ AliESDtrack *t=esd->GetTrack(ntracks);
+ if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
+
+ Double_t time=t->GetTOFsignal();
+ Float_t p = t->GetP();
- if(lT0avErr > 300) lT0avErr = 300;
-
- lT0av = Int_t(lT0av) + lT0avErr/1000.;
-
- return lT0av;
+ Double_t *t0=GetT0p(p);
+ time -= t0[0];
+ t->SetTOFsignal(time);
}
-
-
- return t0;
+ //
}
//____________________________________________________________________________
void AliTOFT0maker::LoadChannelMap(char *filename){
}
}
-//____________________________________________________________________________
+Float_t
+AliTOFT0maker::TuneForMC(AliESDEvent *esd){ // return true T0 event
+ //
+ // tune for MC data
+ //
+
+ Float_t TOFtimeResolutionDefault=80;
+
+ Float_t t0 = gRandom->Gaus(0.,fT0width);
+
+ Float_t extraSmearing = 0;
+
+ if(fTimeResolution > TOFtimeResolutionDefault){
+ extraSmearing = TMath::Sqrt(fTimeResolution*fTimeResolution - TOFtimeResolutionDefault*TOFtimeResolutionDefault);
+ }
+
+ // subtruct t0 for each track
+ Int_t ntracks = esd->GetNumberOfTracks();
+
+ while (ntracks--) {
+ AliESDtrack *t=esd->GetTrack(ntracks);
+
+ if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
+
+ /* check if channel is enabled */
+ if (fTOFcalib && !fTOFcalib->IsChannelEnabled(t->GetTOFCalChannel())) {
+ /* reset TOF status */
+ t->ResetStatus(AliESDtrack::kTOFin);
+ t->ResetStatus(AliESDtrack::kTOFout);
+ t->ResetStatus(AliESDtrack::kTOFrefit);
+ t->ResetStatus(AliESDtrack::kTOFpid);
+ }
+
+ Double_t time=t->GetTOFsignal();
+
+ time += t0;
+
+ if(extraSmearing>0){
+ Float_t smearing = gRandom->Gaus(0.,extraSmearing);
+ time += smearing;
+ }
+
+ t->SetTOFsignal(time);
+ }
+ //
+ return t0;
+}
class TH1F;
class AliESDEvent;
-class AliTOFcalibHisto;
+class AliESDpid;
class AliTOFT0v1;
+class AliTOFcalib;
class AliTOFT0maker : public TObject {
public:
- AliTOFT0maker() ;
+ AliTOFT0maker() ; // default constructor
+ AliTOFT0maker(AliESDpid *externalPID, AliTOFcalib *tofCalib); // overloaded constructor
virtual ~AliTOFT0maker() ; // dtor
- AliTOFT0maker(const AliTOFT0maker & t);
- AliTOFT0maker & operator=(const AliTOFT0maker & t);
- void SetESDdata(Bool_t val=kTRUE){fESDswitch=val;};
-
// return (fCalculated[0]=event time -- fCalculated[1]=sigma event time in ps -- fCalculated[2]=mean event time for each fill -- fCalculated[3]=number of tracks at the TOF level) if you can subtruct the event time; return NULL if there is no event time
- Double_t *RemakePID(AliESDEvent *esd,Double_t t0time=0.,Double_t t0sigma=1000.); // t0time and t0sigma in ps
+ Double_t *ComputeT0TOF(AliESDEvent *esd,Double_t t0time=0.,Double_t t0sigma=1000.); // t0time and t0sigma in ps
+ void ApplyT0TOF(AliESDEvent *esd);
+ Float_t GetExpectedSigma(Float_t mom, Float_t tof, Float_t mass);
+ Double_t *GetT0p(Float_t p);
- void SetTimeResolution(Double_t timeresolution){fTimeResolution=timeresolution;};// TOF timeresolution in [s] e.g. for 120 ps -> 1.2e-10
- Double_t GetTimeResolution() const {return fTimeResolution;}
+ void SetTimeResolution(Double_t timeresolution){fTimeResolution=timeresolution;};// TOF timeresolution in [ps]
+ Double_t GetTimeResolution() const {return fTimeResolution;} // Get TOF Time Resolution
+ void SetT0FillWidth(Float_t width){fT0width = width;}; // in ps
void LoadChannelMap(char *filename="$ALICE_ROOT/TOF/enableMap.104892.root"); //load the enable channel map
- void ApplyMask(AliESDEvent * const esd);
+ void ApplyMask(AliESDEvent * const esd); // Apply the channel mask
void SetNoTOFT0(Bool_t status=kTRUE){fNoTOFT0=status;}; // disable the TOF T0 info
- void SetMaskOffChannel(Bool_t status=kTRUE){fKmask=status;}; // swith for the map off channel
-
+ void SetMaskOffChannel(Bool_t status=kTRUE){fKmask=status;}; // switch for the map off channel
+
+ Float_t TuneForMC(AliESDEvent *esd); // set enabled channeld, add a smeared t0, add a TOF smearing, return true(smeared) T0 event
+
+
private:
- void TakeTimeRawCorrection(AliESDEvent * const esd);
- void RemakeTOFpid(AliESDEvent *esd,Float_t timezero);
- Double_t GetT0Fill() const;
-
- AliTOFcalibHisto *fCalib; // TOF calibration object pointer
-
- Int_t fnT0; // total number of T0-TOF
- Int_t fiT0; // last T0-TOF used for T0 fill
- Double_t fT0fill[1000]; // array for dynamical t0 fill calculation
- Double_t fT0sigmaTOF[1000]; // array for dynamical t0 fill resolution
+
+ AliTOFT0maker(const AliTOFT0maker &);
+ AliTOFT0maker & operator=(const AliTOFT0maker &);
+
+ void SetTOFResponse();
+
+ AliTOFT0v1 *fT0TOF; // T0-TOF
+ AliESDpid *fPIDesd; // PID esd
+ Bool_t fExternalPIDFlag; // external PID flag
+ AliTOFcalib *fTOFcalib; // TOF calibration
+
+ Double_t fT0pt[10],fT0ptSigma[10]; // T0 and T0sigma in p-bins
Bool_t fNoTOFT0; // swithc to avoid T0-TOF is used
- Bool_t fESDswitch; // if you want take the ESD time instead of the raw + time slewing correction
-
+
+ Float_t fPtCutMin[10]; // min values for p bins
+ Float_t fPtCutMax[10]; // max values for p bins
+ Double_t fT0cur[2]; // current T0 and T0 sigma
+
Double_t fCalculated[8]; // contains the parameters with the event time
Double_t fTimeResolution; // global time resolution used to calculate T0
TH1F *fHmapChannel; // histo with the channel map
Bool_t fKmask; // switch if you want apply a channel filter
- static const Int_t fgkNmaxT0step = 500; //number of steps in the t0 fill calculation
+ Float_t fT0width; // T0 FILL width
ClassDef(AliTOFT0maker,2); // Calculate the time zero using TOF detector */
};
-#endif // ALITOFT0MAKER_H
+#endif // ALITOFT0MAKERANA_H
//____________________________________________________________________________
AliTOFT0v1::AliTOFT0v1():
+ TObject(),
fLowerMomBound(0.5),
- fUpperMomBound(1.5),
+ fUpperMomBound(3),
fTimeResolution(0.80e-10),
fTimeCorr(0.),
fEvent(0x0)
//
// default constructor
//
-
- fT0SigmaT0def[0]=-999.;
- fT0SigmaT0def[1]=999.;
- fT0SigmaT0def[2]=-999.;
- fT0SigmaT0def[3]=-999.;
+ Init(NULL);
+
}
//____________________________________________________________________________
AliTOFT0v1::AliTOFT0v1(AliESDEvent* event):
+ TObject(),
fLowerMomBound(0.5),
- fUpperMomBound(1.5),
+ fUpperMomBound(3.0),
fTimeResolution(0.80e-10),
fTimeCorr(0.),
fEvent(event)
// real constructor
//
- fT0SigmaT0def[0]=-999.;
- fT0SigmaT0def[1]= 999.;
- fT0SigmaT0def[2]=-999.;
- fT0SigmaT0def[3]=-999.;
+ Init(event);
}
+/* copy-constructor and operator= suppresed
+
//____________________________________________________________________________
AliTOFT0v1::AliTOFT0v1(const AliTOFT0v1 & tzero):
TObject(),
return *this;
}
+
+*/
//____________________________________________________________________________
AliTOFT0v1::~AliTOFT0v1()
{
fEvent=NULL;
}
+//____________________________________________________________________________
+
+void
+AliTOFT0v1::Init(AliESDEvent *event)
+{
+
+ /*
+ * init
+ */
+
+ fEvent = event;
+ fT0SigmaT0def[0]=0.;
+ fT0SigmaT0def[1]=0.6;
+ fT0SigmaT0def[2]=0.;
+ fT0SigmaT0def[3]=0.;
+
+}
+
//____________________________________________________________________________
void AliTOFT0v1::SetTimeResolution(Double_t timeresolution){
// Set the TOF time resolution
{
// Caluclate the Event Time using the ESD TOF time
+ fT0SigmaT0def[0]=0.;
+ fT0SigmaT0def[1]=0.600;
+ fT0SigmaT0def[2]=0.;
+ fT0SigmaT0def[3]=0.;
+
Float_t timeresolutioninns=fTimeResolution*(1.e+9); // convert in [ns]
const Int_t nmaxtracksinset=10;
// cout << "Memorandum: 0 means PION | 1 means KAON | 2 means PROTON" << endl;
// }
-
Int_t nsets=0;
Int_t nUsedTracks=0;
Int_t ngoodsetsSel= 0;
}
fT0SigmaT0def[0]=t0def;
- fT0SigmaT0def[1]=TMath::Sqrt(deltat0def*deltat0def);//*ngoodtrktrulyused/(ngoodtrktrulyused-1));
+ fT0SigmaT0def[1]=TMath::Sqrt(deltat0def*deltat0def*ngoodtrktrulyused/(ngoodtrktrulyused-1));
fT0SigmaT0def[2]=ngoodtrkt0;
fT0SigmaT0def[3]=ngoodtrktrulyused;
}
// cout << "AliTOFT0v1:" << endl ;
//}
+ if(fT0SigmaT0def[1] < 0.01) fT0SigmaT0def[1] = 0.6;
+
+ return fT0SigmaT0def;
+ }
+//__________________________________________________________________
+Double_t * AliTOFT0v1::DefineT0(Option_t *option,Float_t pMinCut,Float_t pMaxCut)
+{
+ // Caluclate the Event Time using the ESD TOF time
+
+ fT0SigmaT0def[0]=0.;
+ fT0SigmaT0def[1]=0.600;
+ fT0SigmaT0def[2]=0.;
+ fT0SigmaT0def[3]=0.;
+
+ Float_t timeresolutioninns=fTimeResolution*(1.e+9); // convert in [ns]
+
+ const Int_t nmaxtracksinset=10;
+// if(strstr(option,"all")){
+// cout << "Selecting primary tracks with momentum between " << fLowerMomBound << " GeV/c and " << fUpperMomBound << " GeV/c" << endl;
+// cout << "Memorandum: 0 means PION | 1 means KAON | 2 means PROTON" << endl;
+// }
+
+
+ Int_t nsets=0;
+ Int_t nUsedTracks=0;
+ Int_t ngoodsetsSel= 0;
+ Float_t t0bestSel[300];
+ Float_t eT0bestSel[300];
+ Float_t chiSquarebestSel[300];
+ Float_t confLevelbestSel[300];
+ Float_t t0bestallSel=0.;
+ Float_t eT0bestallSel=0.;
+ Float_t sumWt0bestallSel=0.;
+ Float_t eMeanTzeroPi=0.;
+ Float_t meantzeropi=0.;
+ Float_t sumAllweightspi=0.;
+ Double_t t0def=-999;
+ Double_t deltat0def=999;
+ Int_t ngoodtrktrulyused=0;
+ Int_t ntracksinsetmyCut = 0;
+
+ Int_t ntrk=fEvent->GetNumberOfTracks();
+
+ AliESDtrack **tracks=new AliESDtrack*[ntrk];
+ Int_t ngoodtrk=0;
+ Int_t ngoodtrkt0 =0;
+ Float_t mintime =1E6;
+
+ // First Track loop, Selection of good tracks
+
+ for (Int_t itrk=0; itrk<ntrk; itrk++) {
+ AliESDtrack *t=fEvent->GetTrack(itrk);
+ Double_t momOld=t->GetP();
+ Double_t mom=momOld-0.0036*momOld;
+ if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue;
+ if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
+ Double_t time=t->GetTOFsignal();
+
+ time*=1.E-3; // tof given in nanoseconds
+ if (!(mom<=fUpperMomBound && mom>=fLowerMomBound))continue;
+
+ if (!AcceptTrack(t)) continue;
+
+ if(t->GetP() < fLowerMomBound || t->GetIntegratedLength() < 350 || t->GetTOFsignalToT() < 0.000000001)continue; //skip decays
+ if(t->GetP() > pMinCut && t->GetP() < pMaxCut) continue;
+ if(time <= mintime) mintime=time;
+ tracks[ngoodtrk]=t;
+ ngoodtrk++;
+ }
+
+
+// cout << " N. of ESD tracks : " << ntrk << endl;
+// cout << " N. of preselected tracks : " << ngoodtrk << endl;
+// cout << " Minimum tof time in set (in ns) : " << mintime << endl;
+
+ AliESDtrack **gtracks=new AliESDtrack*[ngoodtrk];
+
+ for (Int_t jtrk=0; jtrk< ngoodtrk; jtrk++) {
+ AliESDtrack *t=tracks[jtrk];
+ Double_t time=t->GetTOFsignal();
+
+ if((time-mintime*1.E3)<50.E3){ // For pp and per
+ gtracks[ngoodtrkt0]=t;
+ ngoodtrkt0++;
+ }
+ }
+
+
+ Int_t nseteq = (ngoodtrkt0-1)/nmaxtracksinset + 1;
+ Int_t nmaxtracksinsetCurrent=ngoodtrkt0/nseteq;
+ if(nmaxtracksinsetCurrent*nseteq < ngoodtrkt0) nmaxtracksinsetCurrent++;
+
+ if(ngoodtrkt0<2){
+// cout << "less than 2 tracks, skip event " << endl;
+ t0def=-999;
+ deltat0def=0.600;
+ fT0SigmaT0def[0]=t0def;
+ fT0SigmaT0def[1]=deltat0def;
+ fT0SigmaT0def[2]=ngoodtrkt0;
+ fT0SigmaT0def[3]=ngoodtrkt0;
+ //goto finish;
+ }
+ if(ngoodtrkt0>=2){
+ // Decide how many tracks in set
+ Int_t ntracksinset = std::min(ngoodtrkt0,nmaxtracksinsetCurrent);
+ Int_t nset=1;
+
+ if(ngoodtrkt0>nmaxtracksinsetCurrent) {nset= (Int_t)(ngoodtrkt0/ntracksinset)+1;}
+
+ // Loop over selected sets
+
+ if(nset>=1){
+ for (Int_t i=0; i< nset; i++) {
+
+ Float_t t0best=999.;
+ Float_t eT0best=999.;
+ Float_t chisquarebest=99999.;
+ Int_t npionbest=0;
+
+ Int_t ntracksinsetmy=0;
+ AliESDtrack **tracksT0=new AliESDtrack*[ntracksinset];
+ for (Int_t itrk=0; itrk<ntracksinset; itrk++) {
+ Int_t index = itrk+i*ntracksinset;
+ if(index < ngoodtrkt0){
+ AliESDtrack *t=gtracks[index];
+ tracksT0[itrk]=t;
+ ntracksinsetmy++;
+ }
+ }
+
+ // Analyse it
+
+ Int_t assparticle[nmaxtracksinset];
+ Float_t exptof[nmaxtracksinset][3];
+ Float_t timeofflight[nmaxtracksinset];
+ Float_t momentum[nmaxtracksinset];
+ Float_t timezero[nmaxtracksinset];
+ Float_t weightedtimezero[nmaxtracksinset];
+ Float_t beta[nmaxtracksinset];
+ Float_t texp[nmaxtracksinset];
+ Float_t dtexp[nmaxtracksinset];
+ Float_t sqMomError[nmaxtracksinset];
+ Float_t sqTrackError[nmaxtracksinset];
+ Float_t massarray[3]={0.13957,0.493677,0.9382723};
+ Float_t tracktoflen[nmaxtracksinset];
+ Float_t besttimezero[nmaxtracksinset];
+ Float_t besttexp[nmaxtracksinset];
+ Float_t besttimeofflight[nmaxtracksinset];
+ Float_t bestmomentum[nmaxtracksinset];
+ Float_t bestchisquare[nmaxtracksinset];
+ Float_t bestweightedtimezero[nmaxtracksinset];
+ Float_t bestsqTrackError[nmaxtracksinset];
+ Int_t imass[nmaxtracksinset];
+
+ for (Int_t j=0; j<ntracksinset; j++) {
+ assparticle[j] = 3;
+ timeofflight[j] = 0;
+ momentum[j] = 0;
+ timezero[j] = 0;
+ weightedtimezero[j] = 0;
+ beta[j] = 0;
+ texp[j] = 0;
+ dtexp[j] = 0;
+ sqMomError[j] = 0;
+ sqTrackError[j] = 0;
+ tracktoflen[j] = 0;
+ besttimezero[j] = 0;
+ besttexp[j] = 0;
+ besttimeofflight[j] = 0;
+ bestmomentum[j] = 0;
+ bestchisquare[j] = 0;
+ bestweightedtimezero[j] = 0;
+ bestsqTrackError[j] = 0;
+ imass[j] = 1;
+ }
+
+ for (Int_t j=0; j<ntracksinsetmy; j++) {
+ AliESDtrack *t=tracksT0[j];
+ Double_t momOld=t->GetP();
+ Double_t mom=momOld-0.0036*momOld;
+ Double_t time=t->GetTOFsignal();
+
+ time*=1.E-3; // tof given in nanoseconds
+ Double_t exptime[10]; t->GetIntegratedTimes(exptime);
+ Double_t toflen=t->GetIntegratedLength();
+ toflen=toflen/100.; // toflen given in m
+
+ timeofflight[j]=time;
+ tracktoflen[j]=toflen;
+ exptof[j][0]=exptime[2]*1.E-3+fTimeCorr;// in ns
+ exptof[j][1]=exptime[3]*1.E-3+fTimeCorr;
+ exptof[j][2]=exptime[4]*1.E-3+fTimeCorr;
+ momentum[j]=mom;
+ assparticle[j]=3;
+
+ } //end for (Int_t j=0; j<ntracksinsetmy; j++) {
+
+ for (Int_t itz=0; itz<ntracksinsetmy;itz++) {
+ beta[itz]=momentum[itz]/sqrt(massarray[0]*massarray[0]
+ +momentum[itz]*momentum[itz]);
+ sqMomError[itz]= ((1.-beta[itz]*beta[itz])*0.01)*((1.-beta[itz]*beta[itz])*0.01)*(tracktoflen[itz]/(0.299792*beta[itz]))*(tracktoflen[itz]/(0.299792*beta[itz]));
+ sqTrackError[itz]=(timeresolutioninns*timeresolutioninns+sqMomError[itz]); //in ns
+ timezero[itz]=exptof[itz][0]-timeofflight[itz];// in ns
+ weightedtimezero[itz]=timezero[itz]/sqTrackError[itz];
+ sumAllweightspi+=1./sqTrackError[itz];
+ meantzeropi+=weightedtimezero[itz];
+ } // end loop for (Int_t itz=0; itz< ntracksinset;itz++)
+
+
+ // Then, Combinatorial Algorithm
+
+ if(ntracksinsetmy<2 )break;
+
+ for (Int_t j=0; j<ntracksinsetmy; j++) {
+ imass[j] = 3;
+ }
+
+ Int_t ncombinatorial = Int_t(TMath::Power(3,ntracksinsetmy));
+
+ // Loop on mass hypotheses
+ for (Int_t k=0; k < ncombinatorial;k++) {
+ for (Int_t j=0; j<ntracksinsetmy; j++) {
+ imass[j] = (k % Int_t(TMath::Power(3,ntracksinsetmy-j)))/Int_t(TMath::Power(3,ntracksinsetmy-j-1));
+ texp[j]=exptof[j][imass[j]];
+ dtexp[j]=GetMomError(imass[j], momentum[j], texp[j]);
+ }
+ Float_t sumAllweights=0.;
+ Float_t meantzero=0.;
+ Float_t eMeanTzero=0.;
+
+ for (Int_t itz=0; itz<ntracksinsetmy;itz++) {
+ sqTrackError[itz]=
+ (timeresolutioninns*
+ timeresolutioninns
+ +dtexp[itz]*dtexp[itz]*1E-6); //in ns2
+
+ timezero[itz]=texp[itz]-timeofflight[itz];// in ns
+
+ weightedtimezero[itz]=timezero[itz]/sqTrackError[itz];
+ sumAllweights+=1./sqTrackError[itz];
+ meantzero+=weightedtimezero[itz];
+
+ } // end loop for (Int_t itz=0; itz<15;itz++)
+
+ meantzero=meantzero/sumAllweights; // it is given in [ns]
+ eMeanTzero=sqrt(1./sumAllweights); // it is given in [ns]
+
+ // calculate chisquare
+
+ Float_t chisquare=0.;
+ for (Int_t icsq=0; icsq<ntracksinsetmy;icsq++) {
+ chisquare+=(timezero[icsq]-meantzero)*(timezero[icsq]-meantzero)/sqTrackError[icsq];
+
+ } // end loop for (Int_t icsq=0; icsq<15;icsq++)
+
+ if(chisquare<=chisquarebest){
+ for(Int_t iqsq = 0; iqsq<ntracksinsetmy; iqsq++) {
+
+ bestsqTrackError[iqsq]=sqTrackError[iqsq];
+ besttimezero[iqsq]=timezero[iqsq];
+ bestmomentum[iqsq]=momentum[iqsq];
+ besttimeofflight[iqsq]=timeofflight[iqsq];
+ besttexp[iqsq]=texp[iqsq];
+ bestweightedtimezero[iqsq]=weightedtimezero[iqsq];
+ bestchisquare[iqsq]=(timezero[iqsq]-meantzero)*(timezero[iqsq]-meantzero)/sqTrackError[iqsq];
+ }
+
+ Int_t npion=0;
+ for (Int_t j=0; j<ntracksinsetmy; j++) {
+ assparticle[j]=imass[j];
+ if(imass[j] == 0) npion++;
+ }
+ npionbest=npion;
+ chisquarebest=chisquare;
+ t0best=meantzero;
+ eT0best=eMeanTzero;
+ } // close if(dummychisquare<=chisquare)
+
+ }
+
+ Double_t chi2cut[nmaxtracksinset];
+ chi2cut[0] = 0;
+ chi2cut[1] = 6.6; // corresponding to a C.L. of 0.01
+ for (Int_t j=2; j<ntracksinset; j++) {
+ chi2cut[j] = chi2cut[1] * TMath::Sqrt(j*1.);
+ }
+
+ Double_t chi2singlecut = chi2cut[ntracksinsetmy-1]/ntracksinsetmy + TMath::Abs(chisquarebest-chi2cut[ntracksinsetmy-1])/ntracksinsetmy;
+
+// printf("tracks removed with a chi2 > %f (chi2total = %f w.r.t. the limit of %f)\n",chi2singlecut,chisquarebest,chi2cut[ntracksinsetmy-1]);
+
+ Bool_t kRedoT0 = kFALSE;
+ ntracksinsetmyCut = ntracksinsetmy;
+ Bool_t usetrack[nmaxtracksinset];
+ for (Int_t icsq=0; icsq<ntracksinsetmy;icsq++) {
+ usetrack[icsq] = kTRUE;
+ if((bestchisquare[icsq] > chisquarebest*0.5 && ntracksinsetmy > 2) || (bestchisquare[icsq] > chi2singlecut)){
+ kRedoT0 = kTRUE;
+ ntracksinsetmyCut--;
+ usetrack[icsq] = kFALSE;
+ }
+ } // end loop for (Int_t icsq=0; icsq<15;icsq++)
+
+ // printf("ntrackinsetmy = %i - %i\n",ntracksinsetmy,ntracksinsetmyCut);
+
+ // Loop on mass hypotheses Redo
+ if(kRedoT0 && ntracksinsetmyCut > 1){
+ // printf("Redo T0\n");
+ for (Int_t k=0; k < ncombinatorial;k++) {
+ for (Int_t j=0; j<ntracksinsetmy; j++) {
+ imass[j] = (k % Int_t(TMath::Power(3,ntracksinsetmy-j))) / Int_t(TMath::Power(3,ntracksinsetmy-j-1));
+ texp[j]=exptof[j][imass[j]];
+ dtexp[j]=GetMomError(imass[j], momentum[j], texp[j]);
+ }
+
+ Float_t sumAllweights=0.;
+ Float_t meantzero=0.;
+ Float_t eMeanTzero=0.;
+
+ for (Int_t itz=0; itz<ntracksinsetmy;itz++) {
+ if(! usetrack[itz]) continue;
+ sqTrackError[itz]=
+ (timeresolutioninns*
+ timeresolutioninns
+ +dtexp[itz]*dtexp[itz]*1E-6); //in ns2
+
+ timezero[itz]=texp[itz]-timeofflight[itz];// in ns
+
+ weightedtimezero[itz]=timezero[itz]/sqTrackError[itz];
+ sumAllweights+=1./sqTrackError[itz];
+ meantzero+=weightedtimezero[itz];
+
+ } // end loop for (Int_t itz=0; itz<15;itz++)
+
+ meantzero=meantzero/sumAllweights; // it is given in [ns]
+ eMeanTzero=sqrt(1./sumAllweights); // it is given in [ns]
+
+ // calculate chisquare
+
+ Float_t chisquare=0.;
+ for (Int_t icsq=0; icsq<ntracksinsetmy;icsq++) {
+ if(! usetrack[icsq]) continue;
+ chisquare+=(timezero[icsq]-meantzero)*(timezero[icsq]-meantzero)/sqTrackError[icsq];
+
+ } // end loop for (Int_t icsq=0; icsq<15;icsq++)
+
+ Int_t npion=0;
+ for (Int_t j=0; j<ntracksinsetmy; j++) {
+ assparticle[j]=imass[j];
+ if(imass[j] == 0) npion++;
+ }
+
+ if(chisquare<=chisquarebest){
+ for(Int_t iqsq = 0; iqsq<ntracksinsetmy; iqsq++) {
+ if(! usetrack[iqsq]) continue;
+ bestsqTrackError[iqsq]=sqTrackError[iqsq];
+ besttimezero[iqsq]=timezero[iqsq];
+ bestmomentum[iqsq]=momentum[iqsq];
+ besttimeofflight[iqsq]=timeofflight[iqsq];
+ besttexp[iqsq]=texp[iqsq];
+ bestweightedtimezero[iqsq]=weightedtimezero[iqsq];
+ bestchisquare[iqsq]=(timezero[iqsq]-meantzero)*(timezero[iqsq]-meantzero)/sqTrackError[iqsq];
+ }
+
+ npionbest=npion;
+ chisquarebest=chisquare;
+ t0best=meantzero;
+ eT0best=eMeanTzero;
+ } // close if(dummychisquare<=chisquare)
+
+ }
+ }
+
+ // filling histos
+ Float_t confLevel=999;
+
+ // Sets with decent chisquares
+
+ if(chisquarebest<999.){
+ Double_t dblechisquare=(Double_t)chisquarebest;
+ confLevel=(Float_t)TMath::Prob(dblechisquare,ntracksinsetmyCut-1);
+// cout << " Set Number " << nsets << endl;
+// cout << "Best Assignment, selection " << assparticle[0] <<
+// assparticle[1] << assparticle[2] <<
+// assparticle[3] << assparticle[4] <<
+// assparticle[5] << endl;
+// cout << " Chisquare of the set "<< chisquarebest <<endl;
+// cout << " C.L. of the set "<< confLevel <<endl;
+// cout << " T0 for this set (in ns) " << t0best << endl;
+
+ for(Int_t icsq=0; icsq<ntracksinsetmy;icsq++){
+
+ if(! usetrack[icsq]) continue;
+
+// cout << "Track # " << icsq << " T0 offsets = "
+// << besttimezero[icsq]-t0best <<
+// " track error = " << bestsqTrackError[icsq]
+// << " Chisquare = " << bestchisquare[icsq]
+// << " Momentum = " << bestmomentum[icsq]
+// << " TOF = " << besttimeofflight[icsq]
+// << " TOF tracking = " << besttexp[icsq]
+// << " is used = " << usetrack[icsq] << endl;
+ }
+
+ // Pick up only those with C.L. >1%
+ // if(confLevel>0.01 && ngoodsetsSel<200){
+ if(confLevel>0.01 && ngoodsetsSel<200){
+ chiSquarebestSel[ngoodsetsSel]=chisquarebest;
+ confLevelbestSel[ngoodsetsSel]=confLevel;
+ t0bestSel[ngoodsetsSel]=t0best/eT0best/eT0best;
+ eT0bestSel[ngoodsetsSel]=1./eT0best/eT0best;
+ t0bestallSel += t0best/eT0best/eT0best;
+ sumWt0bestallSel += 1./eT0best/eT0best;
+ ngoodsetsSel++;
+ ngoodtrktrulyused+=ntracksinsetmyCut;
+ }
+ else{
+ // printf("conflevel = %f -- ngoodsetsSel = %i -- ntrackset = %i\n",confLevel,ngoodsetsSel,ntracksinsetmy);
+ }
+ }
+ delete[] tracksT0;
+ nsets++;
+
+ } // end for the current set
+
+ nUsedTracks = ngoodtrkt0;
+ if(strstr(option,"all")){
+ if(sumAllweightspi>0.){
+ meantzeropi=meantzeropi/sumAllweightspi; // it is given in [ns]
+ eMeanTzeroPi=sqrt(1./sumAllweightspi); // it is given in [ns]
+ }
+
+ if(sumWt0bestallSel>0){
+ t0bestallSel = t0bestallSel/sumWt0bestallSel;
+ eT0bestallSel = sqrt(1./sumWt0bestallSel);
+
+ }// end of if(sumWt0bestallSel>0){
+
+// cout << "T0 all " << t0bestallSel << " +/- " << eT0bestallSel << "Number of tracks used: "<<ngoodtrktrulyused<<endl;
+ }
+
+ t0def=t0bestallSel;
+ deltat0def=eT0bestallSel;
+ if ((TMath::Abs(t0bestallSel) < 0.001)&&(TMath::Abs(eT0bestallSel)<0.001)){
+ t0def=-999; deltat0def=0.600;
+ }
+
+ fT0SigmaT0def[0]=t0def;
+ fT0SigmaT0def[1]=TMath::Sqrt(deltat0def*deltat0def*ngoodtrktrulyused/(ngoodtrktrulyused-1));
+ fT0SigmaT0def[2]=ngoodtrkt0;
+ fT0SigmaT0def[3]=ngoodtrktrulyused;
+ }
+ }
+
+ // if(strstr(option,"tim") || strstr(option,"all")){
+ // cout << "AliTOFT0v1:" << endl ;
+ //}
+
+ if(fT0SigmaT0def[1] < 0.01) fT0SigmaT0def[1] = 0.6;
+
return fT0SigmaT0def;
}
//__________________________________________________________________
};
Double_t mass=kMasses[index+2];
- Double_t dpp=0.01; //mean relative pt resolution;
- if(mom > 1) dpp = 0.01*mom;
+ Double_t dpp=0.02; //mean relative pt resolution;
+ // if(mom > 1) dpp = 0.02*mom;
Double_t sigma=dpp*texp*1E3/(1.+ mom*mom/(mass*mass));
sigma =TMath::Sqrt(sigma*sigma);
#include "TObject.h"
class AliESDtrack;
-/* class AliTOFcalibHisto; */
class AliESDEvent;
class AliTOFT0v1: public TObject {
public:
- AliTOFT0v1() ;
- AliTOFT0v1(const AliTOFT0v1 & tzero);
- AliTOFT0v1 & operator=(const AliTOFT0v1 & tzero) ;
- AliTOFT0v1(AliESDEvent *event);
+ AliTOFT0v1() ; // default constructor
+ AliTOFT0v1(AliESDEvent *event); // overloaded constructor
virtual ~AliTOFT0v1() ; // dtor
- // void SetCalib(AliTOFcalibHisto * const calib){fCalib = calib;};
-
Double_t* DefineT0(Option_t *option);
+ Double_t* DefineT0(Option_t *option,Float_t pMinCut,Float_t pMaxCut=1.5);
void SetTimeResolution(Double_t timeresolution);// timeresolution in [s] e.g. for 120 ps -> 1.2e-10
void SetMomBounds(Float_t pLow, Float_t pUp) { fLowerMomBound=pLow; fUpperMomBound=pUp;} // momenta are expressed in [GeV/c]
void SetTimeCorr(Float_t timecorr) {fTimeCorr=timecorr;} //in ns!!!
Float_t GetMomError(Int_t index, Float_t mom, Float_t texp) const;
+ Double_t GetResult(Int_t i){if(i < 4) return fT0SigmaT0def[i]; else return -1.;};
/* void Print(Option_t* option) const ; */
+ void Init(AliESDEvent *event); // init
+
private:
+ AliTOFT0v1(const AliTOFT0v1 &);
+ AliTOFT0v1 & operator=(const AliTOFT0v1 &) ;
+
Bool_t AcceptTrack(AliESDtrack *track); /* accept track */
Float_t GetSigmaToVertex(AliESDtrack *track) const; /* get sigma to vertex */
Double_t fTimeResolution; // global time resolution used to calculate T0
Float_t fTimeCorr; // global time resolution used to calculate T0
AliESDEvent* fEvent; //evento per il quale si vuole calcolare il T0
-/* AliTOFcalibHisto *fCalib; // pointer to the class with the TOF time corrections */
-
Double_t fT0SigmaT0def[4]; // array with the event information ([0]=event time -- [1] = sigma -- [2] = tracks on the TOF -- [3] = tracks used for the event time)
ClassDef(AliTOFT0v1,2); // Calculate the time zero using TOF detector */
--- /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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a definition for TDC errors. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFTDCError.h"
+
+ClassImp(AliTOFTDCError)
+
+AliTOFTDCError::AliTOFTDCError() :
+ TObject(),
+ fErrorFlags(0),
+ fTDCID(0)
+{
+ /* default constructor */
+}
+
+//_________________________________________________________________
+
+AliTOFTDCError::AliTOFTDCError(const AliTOFTDCError &source) :
+ TObject(),
+ fErrorFlags(source.fErrorFlags),
+ fTDCID(source.fTDCID)
+{
+ /* copy contructor */
+}
+
+//_________________________________________________________________
+
+AliTOFTDCError &
+AliTOFTDCError::operator = (const AliTOFTDCError &source)
+{
+ /* operator = */
+ fErrorFlags = source.fErrorFlags;
+ fTDCID = source.fTDCID;
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFTDCError::~AliTOFTDCError()
+{
+ /* default destructor */
+}
--- /dev/null
+#ifndef ALITOFTDCERROR_H
+#define ALITOFTDCERROR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a definition for TDC errors. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+class AliTOFTDCError : public TObject
+{
+ public:
+ AliTOFTDCError(); //default constructor
+ AliTOFTDCError(const AliTOFTDCError &source); //copy constructor
+ AliTOFTDCError &operator = (const AliTOFTDCError &source); //operator =
+ virtual ~AliTOFTDCError(); //destructor
+ /* getters */
+ UShort_t GetErrorFlags() {return fErrorFlags;}; //get error flags
+ UShort_t GetTDCID() {return fTDCID;}; //get TDC ID
+ /* setters */
+ void SetErrorFlags(UShort_t ErrorFlags) {fErrorFlags = ErrorFlags;}; //set error flags
+ void SetTDCID(UShort_t TDCID) {fTDCID = TDCID;};
+ private:
+ UShort_t fErrorFlags; //error flags
+ UShort_t fTDCID; //TDC ID
+
+ ClassDef(AliTOFTDCError, 1);
+};
+
+#endif /* ALITOFTDCERROR_H */
--- /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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a buffer for TDC errors. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFTDCErrorBuffer.h"
+#include "AliLog.h"
+
+ClassImp(AliTOFTDCErrorBuffer)
+
+AliTOFTDCErrorBuffer::AliTOFTDCErrorBuffer() :
+ TObject(),
+ fBuffer("AliTOFTDCError")
+{
+ /* default constructor */
+ fBuffer.SetOwner(kTRUE);
+}
+
+//_________________________________________________________________
+
+AliTOFTDCErrorBuffer::~AliTOFTDCErrorBuffer()
+{
+ /* destructor */
+}
+
+//_________________________________________________________________
+
+void
+AliTOFTDCErrorBuffer::Add(const AliTOFTDCError &Error)
+{
+ /* add function */
+
+ new (fBuffer[GetEntries()]) AliTOFTDCError(Error);
+}
--- /dev/null
+#ifndef ALITOFTDCERRORBUFFER_H
+#define ALITOFTDCERRORBUFFER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a buffer for TDC errors. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "AliTOFTDCError.h"
+#include "TClonesArray.h"
+
+class AliTOFTDCErrorBuffer :
+public TObject
+{
+ public:
+ AliTOFTDCErrorBuffer(); //default constructor
+ AliTOFTDCErrorBuffer(const AliTOFTDCErrorBuffer &source) : TObject(source), fBuffer(source.fBuffer) {}; //copy contructor
+ AliTOFTDCErrorBuffer &operator = (const AliTOFTDCErrorBuffer &source) {
+ if (&source != this) {
+ TObject::operator=(source);
+ fBuffer = source.fBuffer;
+ }
+ return *this;
+ }; //operator =
+ virtual ~AliTOFTDCErrorBuffer(); //destructor
+
+ void Reset() {fBuffer.Clear();}; // reset
+ void Add(const AliTOFTDCError &Error); //add hit
+ TClonesArray *GetBuffer() {return &fBuffer;}; //get buffer
+ Int_t GetEntries() const {return fBuffer.GetEntries();}; //get entries
+ AliTOFTDCError *GetError(Int_t Error) const {return (Error < GetEntries() ? (AliTOFTDCError *)fBuffer.At(Error) : 0x0);}; //get error
+
+ private:
+
+ TClonesArray fBuffer; // buffer
+
+ ClassDef(AliTOFTDCErrorBuffer, 1);
+};
+
+#endif /* ALITOFTDCERRORBUFFER_H */
--- /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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a definition for TDC hits. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFTDCHit.h"
+#define TIME_BIN_WIDTH 24.4e-3//ns
+#define TOT_BIN_WIDTH 48.8e-3//ns
+#define TIME_TO_TOT_BIN_WIDTH ( TIME_BIN_WIDTH / TOT_BIN_WIDTH )
+#define TOT_TO_TIME_BIN_WIDTH ( TOT_BIN_WIDTH / TIME_BIN_WIDTH )
+
+ClassImp(AliTOFTDCHit)
+
+AliTOFTDCHit::AliTOFTDCHit() :
+ TObject(),
+ fHitTime(0),
+ fTOTWidth(0),
+ fChan(0),
+ fTDCID(0),
+ fEBit(0),
+ fPSBits(0)
+{
+ /* default constructor */
+}
+
+//_________________________________________________________________
+
+AliTOFTDCHit::AliTOFTDCHit(const AliTOFTDCHit &source) :
+ TObject(),
+ fHitTime(source.fHitTime),
+ fTOTWidth(source.fTOTWidth),
+ fChan(source.fChan),
+ fTDCID(source.fTDCID),
+ fEBit(source.fEBit),
+ fPSBits(source.fPSBits)
+{
+ /* copy constructor */
+}
+
+//_________________________________________________________________
+
+AliTOFTDCHit &
+AliTOFTDCHit::operator = (const AliTOFTDCHit &source)
+{
+ /* operator = */
+ fHitTime = source.fHitTime;
+ fTOTWidth = source.fTOTWidth;
+ fChan = source.fChan;
+ fTDCID = source.fTDCID;
+ fEBit = source.fEBit;
+ fPSBits = source.fPSBits;
+ return *this;
+}
+
+#if 0
+//_________________________________________________________________
+
+AliTOFTDCHit &
+AliTOFTDCHit::operator - (const AliTOFTDCHit &source)
+{
+ /* operator - */
+ fHitTime = fHitTime - source.fHitTime;
+ return *this;
+}
+#endif
+
+//_________________________________________________________________
+
+AliTOFTDCHit &
+AliTOFTDCHit::operator -= (const AliTOFTDCHit &source)
+{
+ /* operator -= */
+ fHitTime -= source.fHitTime;
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFTDCHit &
+AliTOFTDCHit::operator << (const AliTOFTDCHit &source)
+{
+ /* operator << */
+ /* build packed hit */
+ fTOTWidth = source.fHitTime - fHitTime; /* compute TOT width */
+ fTOTWidth = (UShort_t)(fTOTWidth * TIME_TO_TOT_BIN_WIDTH); /* convert into 48.8 ps bins */
+ fEBit = fEBit | source.fEBit; /* set E bit as or */
+ fPSBits = 0; /* set PB bits as packed hit */
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFTDCHit::~AliTOFTDCHit()
+{
+ /* destructor */
+}
--- /dev/null
+#ifndef ALITOFTDCHIT_H
+#define ALITOFTDCHIT_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a definition for TDC hits. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "AliTOFRawDataFormat.h"
+
+class AliTOFTDCHit : public TObject
+{
+ public:
+ AliTOFTDCHit(); //default constructor
+ AliTOFTDCHit(const AliTOFTDCHit &source); //copy contructor
+ AliTOFTDCHit &operator = (const AliTOFTDCHit &source); //operator =
+ // AliTOFTDCHit &operator - (const AliTOFTDCHit &source); //operator -
+ AliTOFTDCHit &operator -= (const AliTOFTDCHit &source); //operator -=
+ AliTOFTDCHit &operator << (const AliTOFTDCHit &source); //operator <<
+ virtual ~AliTOFTDCHit(); //destructor
+ /* getters */
+ UInt_t GetHitTime() const {return fHitTime;}; //get hit time
+ UShort_t GetTOTWidth() const {return fTOTWidth;}; //get TOT width
+ UShort_t GetChan() const {return fChan;}; //get channel
+ UShort_t GetTDCID() const {return fTDCID;}; //get TDC ID
+ UShort_t GetEBit() const {return fEBit;}; //get E bit
+ UShort_t GetPSBits() const {return fPSBits;}; //get PS bits
+ /* setters */
+ void SetHitTime(UInt_t HitTime) {fHitTime = HitTime;}; //set hit time
+ void SetTOTWidth(UShort_t TOTWidth) {fTOTWidth = TOTWidth;}; //set TOT width
+ void SetChan(UShort_t Chan) {fChan = Chan;}; //set channel
+ void SetTDCID(UShort_t TDCID) {fTDCID = TDCID;}; //set TDC ID
+ void SetEBit(UShort_t EBit) {fEBit = EBit;};
+ void SetPSBits(UShort_t PSBits) {fPSBits = PSBits;}; //set PS bits
+ private:
+ UInt_t fHitTime; //hit time [24.4 ps]
+ UShort_t fTOTWidth; //TOT width [48.8 ps]
+ UShort_t fChan; //channel
+ UShort_t fTDCID; //TDC ID
+ UShort_t fEBit; //E bit
+ UShort_t fPSBits; //PS bits
+
+ ClassDef(AliTOFTDCHit, 1);
+};
+
+#endif /* ALITOFTDCHIT_H */
--- /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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a buffer for TDC hits. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFTDCHitBuffer.h"
+#include "AliLog.h"
+
+ClassImp(AliTOFTDCHitBuffer)
+
+AliTOFTDCHitBuffer::AliTOFTDCHitBuffer() :
+ TObject(),
+ fBuffer("AliTOFTDCHit")
+{
+ /* default constructor */
+ fBuffer.SetOwner(kTRUE);
+}
+
+//_________________________________________________________________
+
+AliTOFTDCHitBuffer::~AliTOFTDCHitBuffer()
+{
+ /* destructr */
+}
+
+//_________________________________________________________________
+
+void
+AliTOFTDCHitBuffer::Add(const AliTOFTDCHit &Hit)
+{
+ /* add function */
+
+ new (fBuffer[GetEntries()]) AliTOFTDCHit(Hit);
+}
--- /dev/null
+#ifndef ALITOFTDCHITBUFFER_H
+#define ALITOFTDCHITBUFFER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a buffer for TDC hits. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "AliTOFTDCHit.h"
+#include "TClonesArray.h"
+
+class AliTOFTDCHitBuffer :
+public TObject
+{
+ public:
+ AliTOFTDCHitBuffer(); //default constructor
+ AliTOFTDCHitBuffer(const AliTOFTDCHitBuffer &source) : TObject(source), fBuffer(source.fBuffer) {}; //copy constructor
+ AliTOFTDCHitBuffer &operator = (const AliTOFTDCHitBuffer &source) {
+ if (&source != this) {
+ TObject::operator=(source);
+ fBuffer = source.fBuffer;
+ }
+ return *this;
+ }; //operator =
+ virtual ~AliTOFTDCHitBuffer(); //destructor
+
+ void Reset() {fBuffer.Clear();}; // reset
+ void Add(const AliTOFTDCHit &Hit); //add hit
+ TClonesArray *GetBuffer() {return &fBuffer;}; //get buffer
+ Int_t GetEntries() const {return fBuffer.GetEntries();}; //get entries
+ AliTOFTDCHit *GetHit(Int_t Hit) const {return (Hit < GetEntries() ? (AliTOFTDCHit *)fBuffer.At(Hit) : 0x0);}; //get hit
+
+ private:
+
+ TClonesArray fBuffer; // buffer
+
+ ClassDef(AliTOFTDCHitBuffer, 1);
+};
+
+#endif /* ALITOFTDCHITBUFFER_H */
UInt_t GetEventWords() {return fEventWords;};
UInt_t GetACQBits() {return fACQBits;};
UInt_t GetLBit() {return fLBit;};
+ UInt_t GetEBit() {return fEBit;};
UInt_t GetMBZ() {return fMBZ;};
UInt_t GetWordType() {return fWordType;};
private:
- UInt_t fSlotID: 4; // TRM number
- UInt_t fEventWords: 13; // event word
- UInt_t fACQBits: 2; // ACQ bits
- UInt_t fLBit: 1; // L bit
- UInt_t fMBZ: 8; // must-be-zero bits
- UInt_t fWordType: 4; // word type
+ UInt_t fSlotID: 4;
+ UInt_t fEventWords: 13;
+ UInt_t fACQBits: 2;
+ UInt_t fLBit: 1;
+ UInt_t fEBit: 1;
+ UInt_t fMBZ: 7;
+ UInt_t fWordType: 4;
};
#endif /* ALITOFTRMGLOBALHEADER_H */
--- /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. *
+***************************************************************************/
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+
+//////////////////////////////////////////////////////////////////////
+// //
+// //
+// This class provides a summary for TRM data. //
+// //
+// //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFTRMSummaryData.h"
+
+ClassImp(AliTOFTRMSummaryData)
+
+AliTOFTRMSummaryData::AliTOFTRMSummaryData() :
+ TObject(),
+ fHeader(kFALSE),
+ fTrailer(kFALSE),
+ fSlotID(0),
+ fEventWords(0),
+ fACQBits(0),
+ fLBit(0),
+ fEBit(0),
+ fEventCRC(0),
+ fEventCounter(0),
+ fDecoderCRC(0)
+{
+ /* default constructor */
+ for (Int_t iChain = 0; iChain < N_CHAIN; iChain++)
+ fChainSummaryData[iChain] = new AliTOFChainSummaryData();
+}
+
+//_________________________________________________________________
+
+AliTOFTRMSummaryData::AliTOFTRMSummaryData(const AliTOFTRMSummaryData &source) :
+ TObject(),
+ fHeader(source.fHeader),
+ fTrailer(source.fTrailer),
+ fSlotID(source.fSlotID),
+ fEventWords(source.fEventWords),
+ fACQBits(source.fACQBits),
+ fLBit(source.fLBit),
+ fEBit(source.fEBit),
+ fEventCRC(source.fEventCRC),
+ fEventCounter(source.fEventCounter),
+ fDecoderCRC(source.fDecoderCRC)
+{
+ /* copy constructor */
+ for (Int_t iChain = 0; iChain < N_CHAIN; iChain++)
+ fChainSummaryData[iChain] = new AliTOFChainSummaryData(*source.fChainSummaryData[iChain]);
+}
+
+//_________________________________________________________________
+
+AliTOFTRMSummaryData &
+AliTOFTRMSummaryData::operator = (const AliTOFTRMSummaryData &source)
+{
+ /* operator = */
+ fHeader = source.fHeader;
+ fTrailer = source.fTrailer;
+ fSlotID = source.fSlotID;
+ fEventWords = source.fEventWords;
+ fACQBits = source.fACQBits;
+ fLBit = source.fLBit;
+ fEBit = source.fEBit;
+ fEventCRC = source.fEventCRC;
+ fEventCounter = source.fEventCounter;
+ fDecoderCRC = source.fDecoderCRC;
+ for (Int_t iChain = 0; iChain < N_CHAIN; iChain++)
+ *fChainSummaryData[iChain] = *source.fChainSummaryData[iChain];
+ return *this;
+}
+
+//_________________________________________________________________
+
+AliTOFTRMSummaryData::~AliTOFTRMSummaryData()
+{
+ /* default destructor */
+ for (Int_t iChain = 0; iChain < N_CHAIN; iChain++)
+ delete fChainSummaryData[iChain];
+}
+
+//_________________________________________________________________
+
+void
+AliTOFTRMSummaryData::Reset()
+{
+ /* reset function */
+ fHeader = kFALSE;
+ fTrailer = kFALSE;
+ fSlotID = 0;
+ fEventWords = 0;
+ fACQBits = 0;
+ fLBit = 0;
+ fEBit = 0;
+ fEventCRC = 0;
+ fEventCounter = 0;
+ fDecoderCRC = 0;
+ for (Int_t iChain = 0; iChain < N_CHAIN; iChain++)
+ fChainSummaryData[iChain]->Reset();
+}
+
--- /dev/null
+#ifndef ALITOFTRMSUMMARYDATA_H
+#define ALITOFTRMSUMMARYDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ author: Roberto Preghenella (R+), preghenella@bo.infn.it
+*/
+
+///////////////////////////////////////////////////////////////
+// //
+// This class provides a summary for TRM data. //
+// //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "AliTOFChainSummaryData.h"
+
+#define N_CHAIN 2
+class AliTOFTRMSummaryData : public TObject
+{
+ public:
+ AliTOFTRMSummaryData(); //default contructor
+ AliTOFTRMSummaryData(const AliTOFTRMSummaryData &source); //copy contructor
+ AliTOFTRMSummaryData &operator = (const AliTOFTRMSummaryData &source); //operator =
+ virtual ~AliTOFTRMSummaryData(); //destructor
+ /* getters */
+ Bool_t GetHeader() const {return fHeader;}; //get header
+ Bool_t GetTrailer() const {return fTrailer;}; //get trailer
+ UShort_t GetSlotID() const {return fSlotID;}; //get slot ID
+ UShort_t GetEventWords() const {return fEventWords;}; //get event words
+ UShort_t GetACQBits() const {return fACQBits;}; //get ACQ bits
+ UShort_t GetLBit() const {return fLBit;}; //get L bit
+ UShort_t GetEBit() const {return fEBit;}; //get E bit
+ UShort_t GetEventCRC() const {return fEventCRC;}; //get event CRC
+ UShort_t GetEventCounter() const {return fEventCounter;}; //get event counter
+ UShort_t GetDecoderCRC() const {return fDecoderCRC;}; //get decoder CRC
+ AliTOFChainSummaryData *GetChainSummaryData(Int_t Chain) const {return Chain < N_CHAIN ? fChainSummaryData[Chain] : 0x0;}; //get chain summary data
+ /* setters */
+ void SetHeader(Bool_t Header) {fHeader = Header;}; //set header
+ void SetTrailer(Bool_t Trailer) {fTrailer = Trailer;}; //set trailer
+ void SetSlotID(UShort_t SlotID) {fSlotID = SlotID;}; //set slot ID
+ void SetEventWords(UShort_t EventWords) {fEventWords = EventWords;}; //set event words
+ void SetACQBits(UShort_t ACQBits) {fACQBits = ACQBits;}; //set ACQ bits
+ void SetLBit(UShort_t LBit) {fLBit = LBit;}; //set L bit
+ void SetEBit(UShort_t EBit) {fEBit = EBit;}; //set E bit
+ void SetEventCRC(UShort_t EventCRC) {fEventCRC = EventCRC;}; //set event CRC
+ void SetEventCounter(UShort_t EventCounter) {fEventCounter = EventCounter;}; //set event counter
+ void SetDecoderCRC(UShort_t DecoderCRC) {fDecoderCRC = DecoderCRC;}; //set decoder CRC
+ /* methods */
+ void Reset(); //reset
+ private:
+ Bool_t fHeader; //header detected
+ Bool_t fTrailer; //trailer detected
+ UShort_t fSlotID; //slot ID [3-12]
+ UShort_t fEventWords; //number of TRM words
+ UShort_t fACQBits; //HPTDC aquisition mode [0-3]
+ UShort_t fLBit; //SEU detected inside LUT tables
+ UShort_t fEBit; //empty event inserted while fixing SEU
+ UShort_t fEventCRC; //TRM computed CRC
+ UShort_t fEventCounter; //event counter
+ UShort_t fDecoderCRC; //decoder computed CRC
+ AliTOFChainSummaryData *fChainSummaryData[N_CHAIN]; //chain summary data
+
+ ClassDef(AliTOFTRMSummaryData, 1);
+};
+
+#endif /* ALITOFTRMSUMMARYDATA_H */
#include "AliTOFCTPLatency.h"
#include "AliTOFT0Fill.h"
#include "AliTOFRunParams.h"
+#include "AliTOFResponseParams.h"
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
class TROOT;
class TStyle;
fDeltaBCOffset(NULL),
fCTPLatency(NULL),
fT0Fill(NULL),
- fRunParams(NULL)
+ fRunParams(NULL),
+ fResponseParams(NULL),
+ fInitFlag(kFALSE),
+ fRemoveMeanT0(kTRUE),
+ fCorrectTExp(kFALSE)
{
//TOF Calibration Class ctor
fNChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
fDeltaBCOffset(NULL),
fCTPLatency(NULL),
fT0Fill(NULL),
- fRunParams(NULL)
+ fRunParams(NULL),
+ fResponseParams(NULL),
+ fInitFlag(calib.fInitFlag),
+ fRemoveMeanT0(calib.fRemoveMeanT0),
+ fCorrectTExp(calib.fCorrectTExp)
{
//TOF Calibration Class copy ctor
for (Int_t iarray = 0; iarray<fNChannels; iarray++){
if (calib.fCTPLatency) fCTPLatency = new AliTOFCTPLatency(*calib.fCTPLatency);
if (calib.fT0Fill) fT0Fill = new AliTOFT0Fill(*calib.fT0Fill);
if (calib.fRunParams) fRunParams = new AliTOFRunParams(*calib.fRunParams);
+ if (calib.fResponseParams) fResponseParams = new AliTOFResponseParams(*calib.fResponseParams);
}
//____________________________________________________________________________
if (fRunParams) *fRunParams = *calib.fRunParams;
else fRunParams = new AliTOFRunParams(*calib.fRunParams);
}
+ if (calib.fResponseParams) {
+ if (fResponseParams) *fResponseParams = *calib.fResponseParams;
+ else fResponseParams = new AliTOFResponseParams(*calib.fResponseParams);
+ }
+ fInitFlag = calib.fInitFlag;
+ fRemoveMeanT0 = calib.fRemoveMeanT0;
+ fCorrectTExp = calib.fCorrectTExp;
return *this;
}
return kTRUE;
}
+//----------------------------------------------------------------------------
+
+Bool_t
+AliTOFcalib::Init(Int_t run)
+{
+ /*
+ * init
+ */
+
+ if (fInitFlag) {
+ AliWarning("the class was already initialized, re-initialize it");
+ fInitFlag = kFALSE;
+ }
+
+ /* read channel status array */
+ if (!ReadParOnlineStatusFromCDB("TOF/Calib", run)) {
+ AliError("cannot get \"Status\" object from OCDB");
+ return kFALSE;
+ }
+ /* get par offline array */
+ if (!ReadParOfflineFromCDB("TOF/Calib", run)) {
+ AliError("cannot get \"ParOffline\" object from OCDB");
+ return kFALSE;
+ }
+ /* get deltaBC offset obj */
+ if (!ReadDeltaBCOffsetFromCDB("TOF/Calib", run)) {
+ AliError("cannot get \"DeltaBCOffset\" object from OCDB");
+ return kFALSE;
+ }
+ /* get CTP latency obj */
+ if (!ReadCTPLatencyFromCDB("TOF/Calib", run)) {
+ AliError("cannot get \"CTPLatency\" object from OCDB");
+ return kFALSE;
+ }
+ /* get run params obj */
+ if (!ReadRunParamsFromCDB("TOF/Calib", run)) {
+ AliError("cannot get \"RunParams\" object from OCDB");
+ return kFALSE;
+ }
+ /* get response params */
+ if (fCorrectTExp) {
+ TFile *responseFile = TFile::Open("$ALICE_ROOT/TOF/data/AliTOFresponsePar.root");
+ if (!responseFile || !responseFile->IsOpen()) {
+ AliError("cannot open \"ResponseParams\" local file");
+ return kFALSE;
+ }
+ fResponseParams = (AliTOFResponseParams *)responseFile->Get("ResponseParams");
+ if (!fResponseParams) {
+ AliError("cannot get \"ResponseParams\" object from local file");
+ return kFALSE;
+ }
+ responseFile->Close();
+ }
+
+ /* all done */
+ fInitFlag = kTRUE;
+ return kTRUE;
+
+}
+
+//----------------------------------------------------------------------------
+
+Double_t
+AliTOFcalib::GetTimeCorrection(Int_t index, Double_t tot, Int_t deltaBC, Int_t l0l1, UInt_t timestamp)
+{
+ /*
+ * get time correction
+ */
+
+ if (!fInitFlag) {
+ AliError("class not yet initialized. Initialize it before.");
+ return 0.;
+ }
+
+ /* get calibration params */
+ AliTOFChannelOffline *parOffline = (AliTOFChannelOffline *)fTOFCalOffline->At(index);
+ Int_t deltaBCOffset = fDeltaBCOffset->GetDeltaBCOffset();
+ Float_t ctpLatency = fCTPLatency->GetCTPLatency();
+ Float_t tdcLatencyWindow = fStatus->GetLatencyWindow(index) * 1.e3;
+ Float_t timezero = fRunParams->EvalT0(timestamp);
+ /* check whether to remove mean T0.
+ * useful when one wants to compute mean T0 */
+ if (!fRemoveMeanT0) timezero = 0.;
+
+ /* compute correction */
+ Double_t corr = 0.;
+ /* deltaBC correction */
+ deltaBC = deltaBCOffset; /* inhibit deltaBC correction for the time being */
+ corr += (deltaBC - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth();
+ /* L0-L1 latency correction */
+ corr -= l0l1 * AliTOFGeometry::BunchCrossingBinWidth();
+ /* CTP latency correction */
+ corr -= ctpLatency;
+ /* TDC latency window correction */
+ corr += tdcLatencyWindow;
+ /* time-zero correction */
+ corr += timezero;
+ /* time calibration correction */
+ if (tot < AliTOFGeometry::SlewTOTMin())
+ tot = AliTOFGeometry::SlewTOTMin();
+ if (tot > AliTOFGeometry::SlewTOTMax())
+ tot = AliTOFGeometry::SlewTOTMax();
+ for (Int_t islew = 0; islew < 6; islew++)
+ corr += parOffline->GetSlewPar(islew) * TMath::Power(tot, islew) * 1.e3;
+
+ /* return correction */
+ return corr;
+}
+
+//----------------------------------------------------------------------------
+
+void
+AliTOFcalib::CalibrateESD(AliESDEvent *event)
+{
+ /*
+ * calibrate ESD
+ */
+
+ if (!fInitFlag) {
+ AliError("class not yet initialized. Initialize it before.");
+ return;
+ }
+
+ /* loop over tracks */
+ AliESDtrack *track = NULL;
+ Int_t index, l0l1, deltaBC;
+ Double_t time, tot, corr, texp[AliPID::kSPECIES];
+ UInt_t timestamp = event->GetTimeStamp();
+ for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {
+
+ /* get track */
+ track = event->GetTrack(itrk);
+ if (!track || !(track->GetStatus() & AliESDtrack::kTOFout)) continue;
+
+ /* get info */
+ index = track->GetTOFCalChannel();
+ time = track->GetTOFsignalRaw();
+ tot = track->GetTOFsignalToT();
+ l0l1 = track->GetTOFL0L1();
+ deltaBC = track->GetTOFDeltaBC();
+
+ /* get correction */
+ corr = GetTimeCorrection(index, tot, deltaBC, l0l1, timestamp);
+
+ /* apply correction */
+ time -= corr;
+
+ /* set new TOF signal */
+ track->SetTOFsignal(time);
+
+ /* correct expected time */
+ if (fCorrectTExp) {
+ /* get integrated times */
+ track->GetIntegratedTimes(texp);
+ /* loop over particle types and correct expected time */
+ for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
+ texp[ipart] += fResponseParams->EvalTExpCorr(ipart, track->P());
+ /* set integrated times */
+ track->SetIntegratedTimes(texp);
+ }
+
+ }
+
+}
+
+//----------------------------------------------------------------------------
+
+Bool_t
+AliTOFcalib::IsChannelEnabled(Int_t index)
+{
+ /*
+ * is channel enabled
+ */
+
+ if (!fInitFlag) {
+ AliError("class not yet initialized. Initialize it before.");
+ return kTRUE;
+ }
+
+ /* check bad status */
+ if (fStatus->GetPulserStatus(index) == AliTOFChannelOnlineStatusArray::kTOFPulserBad) return kFALSE;
+ if (fStatus->GetNoiseStatus(index) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad) return kFALSE;
+ if (fStatus->GetHWStatus(index) == AliTOFChannelOnlineStatusArray::kTOFHWBad) return kFALSE;
+
+ /* good status */
+ return kTRUE;
+
+}
class AliTOFCTPLatency;
class AliTOFT0Fill;
class AliTOFRunParams;
+class AliTOFResponseParams;
+class AliESDEvent;
class AliTOFcalib:public TTask{
public:
AliTOFCTPLatency *GetCTPLatency() const {return fCTPLatency;};
AliTOFT0Fill *GetT0Fill() const {return fT0Fill;};
AliTOFRunParams *GetRunParams() const {return fRunParams;};
+ AliTOFResponseParams *GetResponseParams() const {return fResponseParams;};
// Methods to retrieve/write parameters from/on CDB
// writing
Bool_t ReadT0FillFromCDB(const Char_t *sel, Int_t nrun);
Bool_t ReadRunParamsFromCDB(const Char_t *sel, Int_t nrun);
+ Bool_t Init(Int_t run = -1); // init
+ Double_t GetTimeCorrection(Int_t index, Double_t tot, Int_t deltaBC, Int_t l0l1, UInt_t timestamp); // get time correction
+ void CalibrateESD(AliESDEvent *event); // calibrate ESD
+ void SetRemoveMeanT0(Bool_t value) {fRemoveMeanT0 = value;}; // setter
+ void SetCorrectTExp(Bool_t value) {fCorrectTExp = value;}; // setter
+ Bool_t IsChannelEnabled(Int_t index); // is channel enabled
+
private:
Int_t fNChannels; // number of TOF channels
AliTOFCTPLatency *fCTPLatency; // CTP latency
AliTOFT0Fill *fT0Fill; // T0 fill
AliTOFRunParams *fRunParams; // run params
+ AliTOFResponseParams *fResponseParams; // run params
+
+ Bool_t fInitFlag; // init flag
+ Bool_t fRemoveMeanT0; // remove mean T0
+ Bool_t fCorrectTExp; // correct expected time
- ClassDef(AliTOFcalib,9);
+ ClassDef(AliTOFcalib,10);
};
#endif // AliTOFcalib_H
// processing files. for the time being, the files are local.
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "HITS", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Hits.root");
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "CALIB", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Calib.root");
+ shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "READOUT", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Readout.root");
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "DELAYS", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Total.root");
shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "RUNLevel", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Partial.root");
shuttle->AddInputFile(AliTestShuttle::kDCS, "TOF", "TofFeeLightMap", "", "$ALICE_ROOT/TOF/ShuttleInput/TOFFEElight.20090616.102605.8000");
#pragma link C++ class AliTOFCTPLatency+;
#pragma link C++ class AliTOFT0Fill+;
#pragma link C++ class AliTOFRunParams+;
+#pragma link C++ class AliTOFResponseParams+;
#pragma link C++ class AliTOFT0FillOnlineCalib+;
#pragma link C++ class AliTOFDCSmaps+;
#pragma link C++ class AliTOFLvHvDataPoints+;
+#pragma link C++ class AliTOFChainSummaryData+;
+#pragma link C++ class AliTOFDRMSummaryData+;
+#pragma link C++ class AliTOFDecoderSummaryData+;
+#pragma link C++ class AliTOFLTMSummaryData+;
+#pragma link C++ class AliTOFTRMSummaryData+;
+#pragma link C++ class AliTOFDecoderV2+;
+#pragma link C++ class AliTOFTDCError+;
+#pragma link C++ class AliTOFTDCErrorBuffer+;
+#pragma link C++ class AliTOFTDCHit+;
+#pragma link C++ class AliTOFTDCHitBuffer+;
+
+#pragma link C++ class AliTOFReadoutInfo+;
+
#endif
--- /dev/null
+/*
+
+TOF DA for online calibration
+
+Contact: Chiara.Zampolli@bo.infn.it
+ Roberto.Preghenella@bo.infn.it
+
+Run Type: PHYSICS
+DA Type: MON
+Number of events needed:
+Input Files: no input
+Output Files: TOFdaCalib.root
+Event types used: CALIBRATION_EVENT
+
+*/
+
+#define FILE_CALIB "TOFdaCalib.root"
+
+// DATE
+#include "event.h"
+#include "monitor.h"
+#include "daqDA.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+//ROOT
+#include "TROOT.h"
+#include "TFile.h"
+#include "TH1F.h"
+#include "TPluginManager.h"
+
+//AliRoot
+#include "AliLog.h"
+#include "AliTOFRawStream.h"
+#include "AliRawReaderDate.h"
+#include "AliRawReader.h"
+#include "AliDAQ.h"
+#include "AliTOFGeometry.h"
+#include "AliTOFDecoderV2.h"
+#include "AliTOFDecoderSummaryData.h"
+#include "AliTOFDRMSummaryData.h"
+#include "AliTOFTRMSummaryData.h"
+#include "AliTOFChainSummaryData.h"
+#include "AliTOFTDCHitBuffer.h"
+#include "AliTOFTDCHit.h"
+
+/* Main routine
+ Arguments:
+ 1- monitoring data source
+*/
+int
+main(int argc, char **argv)
+{
+
+ /* magic line from Rene */
+ gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+ "*",
+ "TStreamerInfo",
+ "RIO",
+ "TStreamerInfo()");
+
+
+ /* log start of process */
+ printf("TOF DA started\n");
+
+ /* check that we got some arguments = list of files */
+ if (argc!=2) {
+ printf("Wrong number of arguments\n");
+ return -1;
+ }
+
+
+ /*
+ * INIT
+ */
+
+ /* constants */
+ const Int_t nChannels = 157248;
+ /* counters and flags */
+ Int_t nCalibEvents;
+ /* variables */
+ Int_t ddl, slot, trm, chain, tdc, channel, index, det[5], dummy;
+ /* TOF raw data handling */
+ AliTOFRawStream *rawStream = new AliTOFRawStream();
+ AliTOFDecoderV2 *decoder = rawStream->GetDecoderV2();
+ AliTOFDecoderSummaryData *decodersd;
+ AliTOFDRMSummaryData *drmsd;
+ AliTOFTRMSummaryData *trmsd;
+ AliTOFChainSummaryData *chainsd;
+ AliTOFTDCHitBuffer *hitBuffer;
+ AliTOFTDCHit *hit;
+ UChar_t *data = 0x0;
+ Int_t dataSize;
+ Int_t dataWords;
+ Int_t currentDDL;
+
+ /* init counters and flags */
+ nCalibEvents = 0;
+
+ /* open CALIB output file */
+ TFile *fileOutCalib = new TFile(FILE_CALIB, "RECREATE");
+ /* create calib hit histo */
+ TH1F *hCalibHit = new TH1F("hCalibHit", "Calibration events;index;N_{hits}/N_{events}", nChannels, 0., nChannels);
+
+ /*
+ * ONLINE MONITOR
+ */
+
+ AliLog::SetGlobalLogLevel(AliLog::kFatal);
+ struct eventHeaderStruct *event;
+ int ret;
+ /* define monitoring table */
+ char *monTable[5] = {
+ "ALL", "no",
+ "CAL", "yes",
+ NULL
+ };
+ ret = monitorDeclareTable(monTable);
+ if (ret != 0) {
+ printf("monitorDeclareTable() failed: %s\n", monitorDecodeError(ret));
+ return -1;
+ }
+ /* define data source : this is argument 1 */
+ ret = monitorSetDataSource(argv[1]);
+ if (ret != 0) {
+ printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(ret));
+ return -1;
+ }
+ /* declare monitoring program */
+ ret = monitorDeclareMp("TOFdaCalib");
+ if (ret != 0) {
+ printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(ret));
+ return -1;
+ }
+ /* define wait event timeout - 1s max */
+ monitorSetNowait();
+ monitorSetNoWaitNetworkTimeout(1000);
+
+ /* loop over events */
+ while (1) {
+
+ /* check shutdown condition */
+ if (daqDA_checkShutdown()) break;
+
+ /*
+ * GET EVENT
+ */
+
+ /* get next event (blocking call until timeout) */
+ ret = monitorGetEventDynamic((void **)&event);
+ if (ret == MON_ERR_EOF) {
+ printf ("End of File detected\n");
+ break; /* end of monitoring file has been reached */
+ }
+ if (ret != 0) {
+ printf("monitorGetEventDynamic() failed (ret=%d errno=%d): %s\n", ret, errno, monitorDecodeError(ret));
+ break;
+ }
+ /* retry if got no event */
+ if (event==NULL) continue;
+ /* check TOF in partecipating detectors */
+ if (!TEST_DETECTOR_IN_PATTERN(event->eventDetectorPattern, EVENT_DETECTOR_TOF)) {
+ free(event);
+ continue;
+ }
+ /* check event type */
+ if (event->eventType != CALIBRATION_EVENT) {
+ printf("not a calibration event: %d\n", event->eventType);
+ free(event);
+ continue;
+ }
+ /* increment number of calib events */
+ nCalibEvents++;
+
+ /*
+ * DECODE EVENT
+ */
+
+ /* create and setup raw reader */
+ AliRawReader *rawReader = new AliRawReaderDate((void *)event);
+ rawReader->Reset();
+ rawReader->Select("TOF", 0, AliDAQ::NumberOfDdls("TOF") - 1);
+ /* setup raw stream */
+ rawStream->SetRawReader(rawReader);
+
+ /* loop over DDLs - rawReader->ReadHeader() */
+ while (rawReader->ReadHeader()) {
+
+ /* read equipment data */
+ dataSize = rawReader->GetDataSize();
+ data = new UChar_t[dataSize];
+ if (!rawReader->ReadNext(data, dataSize)){
+ delete [] data;
+ continue;
+ }
+
+ /* decode data */
+ dataWords = dataSize / 4;
+ decoder->Decode((UInt_t *)data, dataWords);
+ delete [] data;
+
+ /* read equipment info */
+ currentDDL = rawReader->GetDDLID();
+ /* read decoder summary data */
+ decodersd = decoder->GetDecoderSummaryData();
+ /* check DRM header/trailer */
+ drmsd = decodersd->GetDRMSummaryData();
+ if (!drmsd->GetHeader() || !drmsd->GetTrailer()) continue;
+ /* loop over TRM to get hits */
+ for (Int_t itrm = 0; itrm < 10; itrm++) {
+ trmsd = drmsd->GetTRMSummaryData(itrm);
+ /* check header/trailer */
+ if (!trmsd->GetHeader() || !trmsd->GetTrailer()) continue;
+ /* loop over chains */
+ for (Int_t ichain = 0; ichain < 2; ichain++) {
+ chainsd = trmsd->GetChainSummaryData(ichain);
+ /* check header/trailer */
+ if (!chainsd->GetHeader() || !chainsd->GetTrailer()) continue;
+ hitBuffer = chainsd->GetTDCPackedHitBuffer();
+
+ /*
+ * HIT MANIPULATION
+ */
+
+ /* loop over hits in buffer */
+ for (Int_t ihit = 0; ihit < hitBuffer->GetEntries(); ihit++) {
+
+ /* get hit */
+ hit = hitBuffer->GetHit(ihit);
+
+ /* get channel info */
+ ddl = currentDDL;
+ slot = trmsd->GetSlotID();
+ trm = slot - 3;
+ chain = chainsd->GetChain();
+ tdc = hit->GetTDCID();
+ channel = hit->GetChan();
+ /* get index */
+ rawStream->EquipmentId2VolumeId(ddl, slot, chain, tdc, channel, det);
+ dummy = det[4];
+ det[4] = det[3];
+ det[3] = dummy;
+ /* check valid index */
+ if (det[0] < 0 || det[0] > 17 ||
+ det[1] < 0 || det[1] > 5 ||
+ det[2] < 0 || det[2] > 18 ||
+ det[3] < 0 || det[3] > 1 ||
+ det[4] < 0 || det[4] > 47) continue;
+ index = AliTOFGeometry::GetIndex(det);
+
+ /* fill calib hit histo */
+ hCalibHit->Fill(index);
+
+ } /* end of loop over hits in buffer */
+ } /* end of loop over chains */
+ } /* end of loop over TRMs */
+ } /* end of loop over DDLs - rawReader->ReadHeader() */
+
+ /* delete raw reader */
+ delete rawReader;
+ /* free event */
+ free(event);
+
+ } /* end of loop over events */
+
+ /* scale calib hit histo by number of calib events */
+ printf("found %d calibration events\n", nCalibEvents);
+ hCalibHit->Sumw2();
+ if (nCalibEvents > 0)
+ hCalibHit->Scale(1. / nCalibEvents);
+
+ /* write calib hit histo on CALIB file */
+ fileOutCalib->cd();
+ hCalibHit->Write();
+ fileOutCalib->Close();
+ /* export file to FXS */
+ if (daqDA_FES_storeFile(FILE_CALIB, "CALIB"))
+ return -2;
+
+ return 0;
+}
--- /dev/null
+/*
+
+TOF DA for online calibration
+
+Contact: Chiara.Zampolli@bo.infn.it
+ Roberto.Preghenella@bo.infn.it
+
+Run Type: PHYSICS
+DA Type: MON
+Number of events needed:
+Input Files: no input
+Output Files: TOFdaHits.root TOFdaReadout.root
+Event types used: PHYSICS_EVENT
+
+*/
+
+#define FILE_HITS "TOFdaHits.root"
+#define FILE_READOUT "TOFdaReadout.root"
+
+#define READOUT_INFO_HISTO 1
+
+// DATE
+#include "event.h"
+#include "monitor.h"
+#include "daqDA.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+//AliRoot
+#include "TROOT.h"
+#include "AliTOFRawStream.h"
+#include "AliRawReaderDate.h"
+#include "AliRawReader.h"
+#include "AliDAQ.h"
+#include "AliTOFHitData.h"
+#include "AliTOFHitDataBuffer.h"
+#include "AliTOFDaConfigHandler.h"
+#include "AliTOFHitField.h"
+#include "AliLog.h"
+#include "AliTOFGeometry.h"
+#include "AliTOFDecoderV2.h"
+#include "AliTOFDecoderSummaryData.h"
+#include "AliTOFDRMSummaryData.h"
+#include "AliTOFTRMSummaryData.h"
+#include "AliTOFChainSummaryData.h"
+#include "AliTOFTDCHitBuffer.h"
+#include "AliTOFTDCHit.h"
+#include "AliTOFTDCErrorBuffer.h"
+#include "AliTOFTDCError.h"
+
+//ROOT
+#include "TFile.h"
+#include "TKey.h"
+#include "TH2S.h"
+#include "TObject.h"
+#include "TMath.h"
+#include "TSystem.h"
+#include "TROOT.h"
+#include "TPluginManager.h"
+#include "TSAXParser.h"
+#include "TTree.h"
+
+/* Main routine
+ Arguments:
+ 1- monitoring data source
+*/
+int
+main(int argc, char **argv)
+{
+
+ /* magic line from Rene */
+ gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+ "*",
+ "TStreamerInfo",
+ "RIO",
+ "TStreamerInfo()");
+
+
+ /* log start of process */
+ printf("TOF DA started\n");
+
+ /* check that we got some arguments = list of files */
+ if (argc!=2) {
+ printf("Wrong number of arguments\n");
+ return -1;
+ }
+
+ /*
+ * CONFIG
+ */
+
+ /* retrieve config file */
+ int getConfigFile = daqDA_DB_getFile("TOFPhysicsConfig.xml","TOFPhysicsConfig.xml");
+ if (getConfigFile != 0){
+ printf("Failed to retrieve config file from DB! returning...\n");
+ return -1;
+ }
+ /* parse config file */
+ AliTOFDaConfigHandler* tofHandler = new AliTOFDaConfigHandler();
+ TSAXParser *parser = new TSAXParser();
+ parser->ConnectToHandler("AliTOFDaConfigHandler", tofHandler);
+ if (parser->ParseFile("./TOFPhysicsConfig.xml") != 0) {
+ printf("Failed parsing config file! retunring... \n");
+ return -1;
+ }
+ /* setup config params */
+ Int_t meanMultiplicity = tofHandler->GetMeanMultiplicity(); /* average expected TOF multiplicity */
+ Int_t maxHits = tofHandler->GetMaxHits(); /* max number of hits to be collected */
+ printf("current settings:\n");
+ printf(" - meanMultiplicity = %d\n", meanMultiplicity);
+ printf(" - maxHits = %d\n", maxHits);
+ /* constants */
+ const Int_t nChannels = 157248;
+ Int_t noiseCheckTrigger = 10; /* first noise check after 10 events */
+ Float_t meanChannelRate = (Float_t)meanMultiplicity / (Float_t)nChannels; /* average expected channel rate (hits/event) */
+ Float_t noiseThreshold = 10. * meanChannelRate; /* noise threshold (hits/event) */
+ Int_t minNoiseHits = 10; /* min number of channel hits to check noise */
+ /* counters and flags */
+ Int_t nPhysicsEvents, nCollectedPhysicsEvents, totHits;
+ Int_t nChHits[nChannels];
+ Bool_t inhibitCollection;
+ Bool_t noiseFlag[nChannels];
+ /* variables */
+ Int_t ddl, slot, trm, chain, tdc, channel, index, timebin, totbin, deltaBC, l0l1latency, det[5], dummy;
+ Float_t noiseHitThreshold;
+
+ /*
+ * INIT
+ */
+
+ /* init counters and flags */
+ nPhysicsEvents = 0;
+ nCollectedPhysicsEvents = 0;
+ totHits = 0;
+ inhibitCollection = kFALSE;
+ for (Int_t ich = 0; ich < nChannels; ich++) {
+ nChHits[ich] = 0;
+ noiseFlag[ich] = kFALSE;
+ }
+
+ /* TOF raw data handling */
+ AliTOFRawStream *rawStream = new AliTOFRawStream();
+ AliTOFDecoderV2 *decoder = rawStream->GetDecoderV2();
+ AliTOFDecoderSummaryData *decodersd;
+ AliTOFDRMSummaryData *drmsd;
+ // AliTOFLTMSummaryData *ltmsd;
+ AliTOFTRMSummaryData *trmsd;
+ AliTOFChainSummaryData *chainsd;
+ AliTOFTDCHitBuffer *hitBuffer;
+ AliTOFTDCHit *hit;
+ AliTOFTDCErrorBuffer *errorBuffer;
+ AliTOFTDCError *error;
+ UShort_t errorFlags;
+ UChar_t *data = 0x0;
+ Int_t dataSize;
+ Int_t dataWords;
+ Int_t currentDDL;
+ const AliRawDataHeader *currentCDH;
+ Int_t currentMiniEventID;
+ Int_t currentEventID1;
+ Int_t currentL0BCID ;
+ Int_t currentBunchID;
+ Bool_t skipTRM, skipChain;
+ Int_t trmIndex, chainIndex, tdcIndex;
+ Double_t chainEff;
+
+ /* open HITS output file */
+ TFile *fileOutHits = new TFile(FILE_HITS, "RECREATE");
+ /* create hit field data structure */
+ AliTOFHitField *hitField = new AliTOFHitField();
+ /* create temporary tree */
+ TTree *tempTree = new TTree("tempTree", "temporary tree");
+ tempTree->Branch("hit", "AliTOFHitField", &hitField);
+ /* create output tree */
+ TTree *outTree = new TTree("hitTree", "hit tree");
+ outTree->Branch("hit", "AliTOFHitField", &hitField);
+
+ /* open READOUT output file */
+ TFile *fileOutReadout = new TFile(FILE_READOUT, "RECREATE");
+ /* create chain readout efficiency histo */
+ TH1F *hChainEfficiency = new TH1F("hChainEfficiency", "Chain efficiency;chain;efficiency", 1440, 0., 1440.);
+
+#if READOUT_INFO_HISTO
+ /* create TRM data histo */
+ TH1F *hTRMData = new TH1F("hTRMData", "TRM data;TRM;frequency", 720, 0., 720.);
+ /* create TRM empty event frequency histo */
+ TH1F *hTRMEmptyEvent = new TH1F("hTRMEmptyEvent", "TRM empty event error;TRM;frequency", 720, 0., 720.);
+ /* create TRM bad event counter frequency histo */
+ TH1F *hTRMBadEventCounter = new TH1F("hTRMBadEventCounter", "TRM bad event counter;TRM;frequency", 720, 0., 720.);
+ /* create TRM bad CRC frequency histo */
+ TH1F *hTRMBadCRC = new TH1F("hTRMBadCRC", "TRM bad CRC;TRM;frequency", 720, 0., 720.);
+
+ /* create chain data histo */
+ TH1F *hChainData = new TH1F("hChainData", "Chain data;chain;frequency", 1440, 0., 1440.);
+ /* create chain bad status frequency histo */
+ TH1F *hChainBadStatus = new TH1F("hChainBadStatus", "Chain bad status;chain;frequency", 1440, 0., 1440.);
+ /* create chain bad event counter frequency histo */
+ TH1F *hChainBadEventCounter = new TH1F("hChainBadEventCounter", "Chain bad event counter;chain;status;frequency", 1440, 0., 1440.);
+
+ /* create TDC error frequency histo */
+ TH1F *hTDCError = new TH1F("hTDCError", "TDC error;TDC;frequency", 21600, 0., 21600.);
+ /* create TDC error flags frequency histo */
+ TH2F *hTDCErrorFlags = new TH2F("hTDCErrorFlags", "TDC error flags;TDC;error flag;frequency", 21600, 0., 21600., 15, 0., 15);
+#endif
+
+
+ /*
+ * ONLINE MONITOR
+ */
+
+ AliLog::SetGlobalLogLevel(AliLog::kFatal);
+ struct eventHeaderStruct *event;
+ int ret;
+ /* define monitoring table */
+ char *monTable[5] = {
+ "ALL", "no",
+ "PHY", "yes",
+ NULL
+ };
+ ret = monitorDeclareTable(monTable);
+ if (ret != 0) {
+ printf("monitorDeclareTable() failed: %s\n", monitorDecodeError(ret));
+ return -1;
+ }
+ /* define data source : this is argument 1 */
+ ret = monitorSetDataSource(argv[1]);
+ if (ret != 0) {
+ printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(ret));
+ return -1;
+ }
+ /* declare monitoring program */
+ ret = monitorDeclareMp("TOFdaPhysics");
+ if (ret != 0) {
+ printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(ret));
+ return -1;
+ }
+ /* define wait event timeout - 1s max */
+ monitorSetNowait();
+ monitorSetNoWaitNetworkTimeout(1000);
+
+ /* variables */
+
+ /* loop over events */
+ while (1) {
+
+ /* check shutdown condition */
+ if (daqDA_checkShutdown()) break;
+
+ /*
+ * NOISE CHECK
+ */
+
+ /* check inhibit collection */
+ if (!inhibitCollection) {
+ /* check number of events and check noise */
+ if (nCollectedPhysicsEvents >= noiseCheckTrigger || totHits >= maxHits) {
+ noiseHitThreshold = noiseThreshold * nCollectedPhysicsEvents;
+ printf("noise check triggered after %d events: threshold is %f hits\n", nCollectedPhysicsEvents, noiseHitThreshold);
+ /* loop over all channels */
+ for (Int_t ich = 0; ich < nChannels; ich++) {
+ /* check */
+ if (nChHits[ich] < minNoiseHits || noiseFlag[ich] || nChHits[ich] < noiseHitThreshold) continue;
+ printf("channel %d tagged as noisy (%d hits): disabled\n", ich, nChHits[ich]);
+ noiseFlag[ich] = kTRUE;
+ totHits -= nChHits[ich];
+ } /* end of loop over all channels */
+ /* set new noise check trigger value */
+ noiseCheckTrigger *= 10;
+ } /* end of noise check */
+
+ /* inhibit hit collection when maximum number of hits exceeded */
+ if (totHits >= maxHits) {
+ printf("maximum number of hits exceeded (%d): inhibit hit collection\n", maxHits);
+ inhibitCollection = kTRUE;
+ }
+ }
+
+ /*
+ * GET EVENT
+ */
+
+ /* get next event (blocking call until timeout) */
+ ret = monitorGetEventDynamic((void **)&event);
+ if (ret == MON_ERR_EOF) {
+ printf ("End of File detected\n");
+ break; /* end of monitoring file has been reached */
+ }
+ if (ret != 0) {
+ printf("monitorGetEventDynamic() failed (ret=%d errno=%d): %s\n", ret, errno, monitorDecodeError(ret));
+ break;
+ }
+ /* retry if got no event */
+ if (event==NULL) continue;
+ /* check TOF in partecipating detectors */
+ if (!TEST_DETECTOR_IN_PATTERN(event->eventDetectorPattern, EVENT_DETECTOR_TOF)) {
+ free(event);
+ continue;
+ }
+ /* check event type */
+ if (event->eventType != PHYSICS_EVENT) {
+ printf("not a physics event: %d\n", event->eventType);
+ free(event);
+ continue;
+ }
+ /* increment number of physics events */
+ nPhysicsEvents++;
+ if (!inhibitCollection) nCollectedPhysicsEvents++;
+
+ /*
+ * DECODE EVENT
+ */
+
+ /* create and setup raw reader */
+ AliRawReader *rawReader = new AliRawReaderDate((void *)event);
+ rawReader->Reset();
+ rawReader->Select("TOF", 0, AliDAQ::NumberOfDdls("TOF") - 1);
+ /* setup raw stream */
+ rawStream->SetRawReader(rawReader);
+
+ /* loop over DDLs - rawReader->ReadHeader() */
+ while (rawReader->ReadHeader()) {
+
+ /* read equipment data */
+ dataSize = rawReader->GetDataSize();
+ data = new UChar_t[dataSize];
+ if (!rawReader->ReadNext(data, dataSize)){
+ delete [] data;
+ continue;
+ }
+
+ /* decode data */
+ dataWords = dataSize / 4;
+ decoder->Decode((UInt_t *)data, dataWords);
+ delete [] data;
+
+ /* read equipment info */
+ currentDDL = rawReader->GetDDLID();
+ currentCDH = rawReader->GetDataHeader();
+ currentMiniEventID = currentCDH->GetMiniEventID();
+ currentEventID1 = currentCDH->GetEventID1();
+
+ /* read decoder summary data */
+ decodersd = decoder->GetDecoderSummaryData();
+
+ /* check DRM header/trailer */
+ drmsd = decodersd->GetDRMSummaryData();
+ if (!drmsd->GetHeader() || !drmsd->GetTrailer()) continue;
+
+ /* get DRM data */
+ currentL0BCID = drmsd->GetL0BCID();
+
+ /* loop over TRM to get hits */
+ for (Int_t itrm = 0; itrm < 10; itrm++) {
+ trmsd = drmsd->GetTRMSummaryData(itrm);
+ trmIndex = itrm + 10 * currentDDL;
+ skipTRM = kFALSE;
+
+ /* check header/trailer */
+ if (!trmsd->GetHeader() || !trmsd->GetTrailer()) continue;
+
+#if READOUT_INFO_HISTO
+ /* fill TRM data */
+ hTRMData->Fill(trmIndex);
+ /* fill TRM empty event */
+ if (trmsd->GetEBit() != 0) {
+ hTRMEmptyEvent->Fill(trmIndex);
+ skipTRM = kTRUE;
+ }
+ /* fill TRM bad event counter */
+ if (trmsd->GetEventCounter() != drmsd->GetLocalEventCounter()) {
+ hTRMBadEventCounter->Fill(trmIndex);
+ skipTRM = kTRUE;
+ }
+ /* fill TRM bad CRC */
+ if (trmsd->GetEventCRC() != trmsd->GetDecoderCRC()) {
+ hTRMBadCRC->Fill(trmIndex);
+ skipTRM = kTRUE;
+ }
+#else
+ /* check bad condition and skip TRM */
+ if ( trmsd->GetEBit() != 0 ||
+ trmsd->GetEventCounter() != drmsd->GetLocalEventCounter() ||
+ trmsd->GetEventCRC() != trmsd->GetDecoderCRC() ) continue;
+#endif
+
+ /* loop over chains */
+ for (Int_t ichain = 0; ichain < 2; ichain++) {
+ chainsd = trmsd->GetChainSummaryData(ichain);
+ chainIndex = ichain + 2 * itrm + 20 * currentDDL;
+ skipChain = kFALSE;
+
+ /* check header/trailer */
+ if (!chainsd->GetHeader() || !chainsd->GetTrailer()) continue;
+ currentBunchID = chainsd->GetBunchID();
+ hitBuffer = chainsd->GetTDCPackedHitBuffer();
+ errorBuffer = chainsd->GetTDCErrorBuffer();
+
+#if READOUT_INFO_HISTO
+ /* fill chain data */
+ hChainData->Fill(chainIndex);
+ /* check chain bad status */
+ if (chainsd->GetStatus() != 0) {
+ hChainBadStatus->Fill(chainIndex);
+ skipChain = kTRUE;
+ }
+ /* check chain bad event counter */
+ if (chainsd->GetEventCounter() != drmsd->GetLocalEventCounter()) {
+ hChainBadEventCounter->Fill(chainIndex);
+ skipChain = kTRUE;
+ }
+ /* fill TDC error frequency histo */
+ for (Int_t ierr = 0; ierr < errorBuffer->GetEntries(); ierr++) {
+ error = errorBuffer->GetError(ierr);
+ tdc = error->GetTDCID();
+ tdcIndex = tdc + 15 * ichain + 30 * itrm + 300 * currentDDL;
+ hTDCError->Fill(tdcIndex);
+ errorFlags = error->GetErrorFlags();
+ for (Int_t ierflg = 0; ierflg < 15; ierflg++)
+ if (errorFlags & (1 << ierflg))
+ hTDCErrorFlags->Fill(tdcIndex, ierflg);
+ }
+#else
+ /* check bad condition and skip chain */
+ if ( chainsd->GetStatus() != 0 ||
+ chainsd->GetEventCounter() != drmsd->GetLocalEventCounter() ) continue;
+#endif
+
+ /*
+ * CHAIN READOUT EFFICIENCY
+ */
+
+ /* compute number of available channels removing TDCs in error */
+ chainEff = (120. - 8. * errorBuffer->GetEntries()) / 120.;
+ /* fill chain readout efficiency histo */
+ if (!skipTRM && !skipChain)
+ hChainEfficiency->Fill(chainIndex, chainEff);
+
+ /*
+ * HIT MANIPULATION
+ */
+
+ /* check inhibit collection */
+ if (inhibitCollection) continue;
+
+ /* loop over hits in buffer */
+ for (Int_t ihit = 0; ihit < hitBuffer->GetEntries(); ihit++) {
+
+ /* get hit */
+ hit = hitBuffer->GetHit(ihit);
+
+ /* get channel info */
+ ddl = currentDDL;
+ slot = trmsd->GetSlotID();
+ trm = slot - 3;
+ chain = chainsd->GetChain();
+ tdc = hit->GetTDCID();
+ channel = hit->GetChan();
+ /* get index */
+ rawStream->EquipmentId2VolumeId(ddl, slot, chain, tdc, channel, det);
+ dummy = det[4];
+ det[4] = det[3];
+ det[3] = dummy;
+ /* check valid index */
+ if (det[0] < 0 || det[0] > 17 ||
+ det[1] < 0 || det[1] > 5 ||
+ det[2] < 0 || det[2] > 18 ||
+ det[3] < 0 || det[3] > 1 ||
+ det[4] < 0 || det[4] > 47) continue;
+ index = AliTOFGeometry::GetIndex(det);
+
+ /* check noise flag */
+ if (noiseFlag[index]) continue;
+ /* increment number of channel hits and total hits */
+ nChHits[index]++;
+ totHits++;
+ /* get signal info */
+ timebin = hit->GetHitTime();
+ totbin = hit->GetTOTWidth();
+ deltaBC = currentBunchID - currentEventID1;
+ l0l1latency = currentMiniEventID - currentL0BCID;
+ /* set hit field data */
+ hitField->SetIndex(index);
+ hitField->SetTimeBin(timebin);
+ hitField->SetTOTBin(totbin);
+ hitField->SetDeltaBC(deltaBC);
+ hitField->SetL0L1Latency(l0l1latency);
+ /* fill temp tree */
+ tempTree->Fill();
+
+ } /* end of loop over hits in buffer */
+ } /* end of loop over chains */
+ } /* end of loop over TRMs */
+ } /* end of loop over DDLs - rawReader->ReadHeader() */
+
+ /* delete raw reader */
+ delete rawReader;
+ /* free event */
+ free(event);
+
+ } /* end of loop over events */
+
+ /* final noise check */
+ noiseHitThreshold = noiseThreshold * nCollectedPhysicsEvents;
+ printf("final noise check after collectiong %d events: threshold is %f hits\n", nCollectedPhysicsEvents, noiseHitThreshold);
+ /* loop over all channels */
+ for (Int_t ich = 0; ich < nChannels; ich++) {
+ /* check */
+ if (nChHits[ich] < minNoiseHits || noiseFlag[ich] || nChHits[ich] < noiseHitThreshold) continue;
+ printf("channel %d tagged as noisy (%d hits): disabled\n", ich, nChHits[ich]);
+ noiseFlag[ich] = kTRUE;
+ totHits -= nChHits[ich];
+ } /* end of loop over all channels */
+
+ /* copy hits into output tree from temp tree */
+ printf("copy hits from temporary tree into output tree\n");
+ printf("temporary tree contains %d hits\n", (Int_t)tempTree->GetEntries());
+ for (Int_t ihit = 0; ihit < tempTree->GetEntries(); ihit++) {
+ /* get entry */
+ tempTree->GetEntry(ihit);
+ /* check noise flag */
+ if (noiseFlag[hitField->GetIndex()]) continue;
+ /* fill output tree */
+ outTree->Fill();
+ } /* end of copy hits into output tree from temp tree */
+ printf("output tree contains %d hits\n", (Int_t)outTree->GetEntries());
+
+ /* write output tree on HITS file */
+ fileOutHits->cd();
+ outTree->Write();
+ fileOutHits->Close();
+ /* export file to FXS */
+ if (daqDA_FES_storeFile(FILE_HITS, "HITS"))
+ return -2;
+
+#if READOUT_INFO_HISTO
+ hTRMData->Sumw2();
+ hTRMEmptyEvent->Sumw2();
+ hTRMBadEventCounter->Sumw2();
+ hTRMBadCRC->Sumw2();
+
+ hChainData->Sumw2();
+ hChainBadStatus->Sumw2();
+ hChainBadEventCounter->Sumw2();
+
+ hTDCError->Sumw2();
+ hTDCErrorFlags->Sumw2();
+
+ /* divide histos */
+ if (nPhysicsEvents > 0) {
+ hTRMEmptyEvent->Divide(hTRMData);
+ hTRMBadEventCounter->Divide(hTRMData);
+ hTRMBadCRC->Divide(hTRMData);
+ hTRMData->Scale(1. / nPhysicsEvents);
+
+ hChainBadStatus->Divide(hChainData);
+ hChainBadEventCounter->Divide(hChainData);
+ hChainData->Scale(1. / nPhysicsEvents);
+
+ hTDCError->Scale(1. / nPhysicsEvents);
+ hTDCErrorFlags->Scale(1. / nPhysicsEvents);
+ }
+#endif
+
+ /* scale chain efficiency by number of physics events */
+ printf("found %d physics events\n", nPhysicsEvents);
+ hChainEfficiency->Sumw2();
+ if (nPhysicsEvents > 0) hChainEfficiency->Scale(1. / (nPhysicsEvents));
+
+ /* write efficiency histo on READOUT file */
+ fileOutReadout->cd();
+#if READOUT_INFO_HISTO
+ hTRMData->Write();
+ hTRMEmptyEvent->Write();
+ hTRMBadEventCounter->Write();
+ hTRMBadCRC->Write();
+
+ hChainData->Write();
+ hChainBadStatus->Write();
+ hChainBadEventCounter->Write();
+
+ hTDCError->Write();
+ hTDCErrorFlags->Write();
+#endif
+ hChainEfficiency->Write();
+ fileOutReadout->Close();
+ /* export file to FXS */
+ if (daqDA_FES_storeFile(FILE_READOUT, "READOUT"))
+ return -2;
+
+ return 0;
+}
--- /dev/null
+testPID(const Char_t *filename, Bool_t calibrateESD = kTRUE, Bool_t correctTExp = kTRUE, Bool_t useT0TOF = kTRUE, Double_t timeResolution = 100., Bool_t tuneTOFMC = kFALSE)
+{
+ /* PID analysis */
+
+ /* check MC flag */
+ if (tuneTOFMC) calibrateESD = kFALSE;
+
+ /* init ESD */
+ TFile *filein = TFile::Open(filename);
+ TTree *treein = (TTree *)filein->Get("esdTree");
+ AliESDEvent *event = new AliESDEvent();
+ event->ReadFromTree(treein);
+ /* init OCDB */
+ treein->GetEvent(0);
+ Int_t run = event->GetRunNumber();
+ AliCDBManager *cdb = AliCDBManager::Instance();
+ cdb->SetDefaultStorage("raw://");
+ cdb->SetRun(run);
+ /* init TOF calibration */
+ AliTOFcalib *tofCalib = new AliTOFcalib();
+ if (correctTExp)
+ tofCalib->SetCorrectTExp(kTRUE);
+ tofCalib->Init();
+ /* init TOF T0-maker */
+ AliESDpid *fPIDesd = new AliESDpid();
+ AliTOFT0maker *t0maker = new AliTOFT0maker(fPIDesd, tofCalib);
+ t0maker->SetTimeResolution(timeResolution);
+
+ /* pid histos */
+ TH2F *hTOFpid[AliPID::kSPECIES];
+ TH2F *hTOFpidSigma[AliPID::kSPECIES];
+ for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
+ hTOFpid[ipart] = new TH2F(Form("hTOFpid_%s", AliPID::ParticleName(ipart)), Form("%s-ID;p (GeV/c);t - t^{%s}_{exp} (ps)", AliPID::ParticleName(ipart), AliPID::ParticleLatexName(ipart)), 200, 0., 10., 2000, -24400., 24400.);
+ hTOFpidSigma[ipart] = new TH2F(Form("hTOFpidSigma_%s", AliPID::ParticleName(ipart)), Form("%s-ID;p (GeV/c);(t - t^{%s}_{exp}) / #sigma^{%s}_{exp} (ps)", AliPID::ParticleName(ipart), AliPID::ParticleLatexName(ipart), AliPID::ParticleLatexName(ipart)), 200, 0., 10., 2000, -10., 10.);
+ }
+
+ AliESDtrack *track;
+ Double_t p, time, timei[AliPID::kSPECIES], sigma[AliPID::kSPECIES];
+ /* loop over events */
+ for (Int_t iev = 0; iev < treein->GetEntries(); iev++) {
+
+ /* get event */
+ treein->GetEvent(iev);
+
+ /* calibrate ESD */
+ if (calibrateESD)
+ tofCalib->CalibrateESD(event);
+
+ /* tune TOF if requested for MC */
+ if (tuneTOFMC) {
+ t0maker->TuneForMC(event);
+ }
+
+ /* compute and apply T0-TOF */
+ if (useT0TOF) {
+ t0maker->ComputeT0TOF(event);
+ t0maker->ApplyT0TOF(event);
+ fPIDesd->MakePID(event,kFALSE,0.);
+ }
+
+ /* loop over tracks */
+ for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {
+ track = event->GetTrack(itrk);
+ /* check TOF match */
+ if (!track ||
+ !(track->GetStatus() & AliESDtrack::kTOFout) ||
+ !(track->GetStatus() & AliESDtrack::kTIME)) continue;
+
+ /* get track momentum */
+ p = track->P();
+ /* get TOF time */
+ time = track->GetTOFsignal();
+ /* get expected times */
+ track->GetIntegratedTimes(timei);
+
+ /* fill PID histos */
+ for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++){
+ sigma[ipart] = t0maker->GetExpectedSigma(p, timei[ipart], AliPID::ParticleMass(ipart));
+ hTOFpid[ipart]->Fill(p, (time - timei[ipart]));
+ hTOFpidSigma[ipart]->Fill(p, (time - timei[ipart]) / sigma[ipart]);
+ }
+ }
+ }
+
+ /* write output */
+ TFile *fileout = TFile::Open("testPID.root", "RECREATE");
+ for (Int_t ipart = 0; ipart < 5; ipart++){
+ hTOFpid[ipart]->Write();
+ hTOFpidSigma[ipart]->Write();
+ }
+ fileout->Close();
+}
AliTOFCTPLatency.cxx \
AliTOFT0Fill.cxx \
AliTOFRunParams.cxx \
+ AliTOFResponseParams.cxx \
AliTOFT0FillOnlineCalib.cxx \
AliTOFLvHvDataPoints.cxx \
- AliTOFDCSmaps.cxx
+ AliTOFDCSmaps.cxx\
+ AliTOFChainSummaryData.cxx\
+ AliTOFDRMSummaryData.cxx\
+ AliTOFDecoderSummaryData.cxx\
+ AliTOFLTMSummaryData.cxx\
+ AliTOFTRMSummaryData.cxx\
+ AliTOFDecoderV2.cxx\
+ AliTOFTDCError.cxx\
+ AliTOFTDCErrorBuffer.cxx\
+ AliTOFTDCHit.cxx\
+ AliTOFTDCHitBuffer.cxx\
+ AliTOFReadoutInfo.cxx
HDRS:= $(SRCS:.cxx=.h)