From 0ffacf98634da4e10ec990b177348f20e3ab2114 Mon Sep 17 00:00:00 2001 From: marian Date: Thu, 13 Dec 2007 17:24:41 +0000 Subject: [PATCH] Adding QA makers for digits (Marian) --- TPC/AliTPCdataQA.cxx | 291 +++++++++++++++++++++++++++++++++++++++++++ TPC/AliTPCdataQA.h | 93 ++++++++++++++ TPC/TPCbaseLinkDef.h | 1 + TPC/libTPCbase.pkg | 3 +- 4 files changed, 387 insertions(+), 1 deletion(-) create mode 100644 TPC/AliTPCdataQA.cxx create mode 100644 TPC/AliTPCdataQA.h diff --git a/TPC/AliTPCdataQA.cxx b/TPC/AliTPCdataQA.cxx new file mode 100644 index 00000000000..c7c436c7371 --- /dev/null +++ b/TPC/AliTPCdataQA.cxx @@ -0,0 +1,291 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + + +//Root includes +#include +#include +#include +#include +#include +#include +#include +#include +//AliRoot includes +#include "AliRawReader.h" +#include "AliRawReaderRoot.h" +#include "AliRawReaderDate.h" +#include "AliTPCRawStream.h" +#include "AliTPCCalROC.h" +#include "AliTPCROC.h" +#include "AliMathBase.h" +#include "TTreeStream.h" +#include "AliTPCRawStreamFast.h" + +//date +#include "event.h" +#include "AliTPCCalPad.h" + +//header file +#include "AliTPCdataQA.h" + + + +ClassImp(AliTPCdataQA) + +AliTPCdataQA::AliTPCdataQA() : /*FOLD00*/ + TObject(), + fFirstTimeBin(60), + fLastTimeBin(1000), + fAdcMin(1), + fAdcMax(100), + fOldRCUformat(kTRUE), + fROC(AliTPCROC::Instance()), + fMapping(NULL), + fMaxCharge(0), + fOverThreshold0(0), + fOverThreshold5(0), + fOverThreshold10(0), + fOverThreshold20(0), + fOverThreshold30(0), + fEventCounter(0) +{ + // + // default constructor + // +} + + +//_____________________________________________________________________ +AliTPCdataQA::AliTPCdataQA(const AliTPCdataQA &ped) : /*FOLD00*/ + TObject(ped), + fFirstTimeBin(ped.GetFirstTimeBin()), + fLastTimeBin(ped.GetLastTimeBin()), + fAdcMin(ped.GetAdcMin()), + fAdcMax(ped.GetAdcMax()), + fOldRCUformat(ped.fOldRCUformat), + fROC(AliTPCROC::Instance()), + fMapping(NULL) +{ + // + // copy constructor + // + +} + + +//_____________________________________________________________________ +AliTPCdataQA& AliTPCdataQA::operator = (const AliTPCdataQA &source) +{ + // + // assignment operator + // + if (&source == this) return *this; + new (this) AliTPCdataQA(source); + + return *this; +} + + +//_____________________________________________________________________ +AliTPCdataQA::~AliTPCdataQA() /*FOLD00*/ +{ + // + // destructor + // + + // do not delete fMapping, because we do not own it. + +} + + + + +//_____________________________________________________________________ +Bool_t AliTPCdataQA::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast) +{ + // + // Event Processing loop - AliTPCRawStream + // + Bool_t withInput = kFALSE; + + while ( rawStreamFast->NextDDL() ){ + while ( rawStreamFast->NextChannel() ){ + Int_t isector = rawStreamFast->GetSector(); // current sector + Int_t iRow = rawStreamFast->GetRow(); // current row + Int_t iPad = rawStreamFast->GetPad(); // current pad + Int_t startTbin = (Int_t)rawStreamFast->GetStartTimeBin(); + Int_t endTbin = (Int_t)rawStreamFast->GetEndTimeBin(); + + while ( rawStreamFast->NextBunch() ){ + for (Int_t iTimeBin = startTbin; iTimeBin < endTbin; iTimeBin++){ + Float_t signal=(Float_t)rawStreamFast->GetSignals()[iTimeBin-startTbin]; + Update(isector,iRow,iPad,iTimeBin+1,signal); + withInput = kTRUE; + } + } + } + } + + return withInput; +} +//_____________________________________________________________________ +Bool_t AliTPCdataQA::ProcessEventFast(AliRawReader *rawReader) +{ + // + // Event processing loop - AliRawReader + // + AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping); + Bool_t res=ProcessEventFast(rawStreamFast); + delete rawStreamFast; + return res; +} + +//_____________________________________________________________________ +Bool_t AliTPCdataQA::ProcessEvent(AliTPCRawStream *rawStream) +{ + // + // Event Processing loop - AliTPCRawStream + // + + rawStream->SetOldRCUFormat(fOldRCUformat); + + Bool_t withInput = kFALSE; + + while (rawStream->Next()) { + + Int_t iSector = rawStream->GetSector(); // current ROC + Int_t iRow = rawStream->GetRow(); // current row + Int_t iPad = rawStream->GetPad(); // current pad + Int_t iTimeBin = rawStream->GetTime(); // current time bin + Float_t signal = rawStream->GetSignal(); // current ADC signal + + Update(iSector,iRow,iPad,iTimeBin,signal); + withInput = kTRUE; + } + + return withInput; +} + + +//_____________________________________________________________________ +Bool_t AliTPCdataQA::ProcessEvent(AliRawReader *rawReader) +{ + // + // Event processing loop - AliRawReader + // + + // if fMapping is NULL the rawstream will crate its own mapping + AliTPCRawStream rawStream(rawReader, (AliAltroMapping**)fMapping); + rawReader->Select("TPC"); + return ProcessEvent(&rawStream); +} + + +//_____________________________________________________________________ +Bool_t AliTPCdataQA::ProcessEvent(eventHeaderStruct *event) +{ + // + // process date event + // + + AliRawReader *rawReader = new AliRawReaderDate((void*)event); + Bool_t result=ProcessEvent(rawReader); + delete rawReader; + return result; +} + + + +//_____________________________________________________________________ +void AliTPCdataQA::DumpToFile(const Char_t *filename, const Char_t *dir, Bool_t append) /*FOLD00*/ +{ + // + // Write class to file + // + + TString sDir(dir); + TString option; + + if ( append ) + option = "update"; + else + option = "recreate"; + + TDirectory *backup = gDirectory; + TFile f(filename,option.Data()); + f.cd(); + if ( !sDir.IsNull() ){ + f.mkdir(sDir.Data()); + f.cd(sDir); + } + this->Write(); + f.Close(); + + if ( backup ) backup->cd(); +} + + +//_____________________________________________________________________ +Int_t AliTPCdataQA::Update(const Int_t icsector, /*FOLD00*/ + const Int_t icRow, + const Int_t icPad, + const Int_t icTimeBin, + const Float_t csignal) +{ + // + // Signal filling method + // + if (icTimeBinfLastTimeBin) return 0; + if (!fMaxCharge) fMaxCharge = new AliTPCCalPad("MaxCharge","MaxCharge"); + if (!fOverThreshold0) fOverThreshold0 = new AliTPCCalPad("OverThreshold0","OverThreshold0"); + if (!fOverThreshold5) fOverThreshold5 = new AliTPCCalPad("OverThreshold5","OverThreshold5"); + if (!fOverThreshold10) fOverThreshold10 = new AliTPCCalPad("OverThreshold10","OverThreshold10"); + if (!fOverThreshold20) fOverThreshold20 = new AliTPCCalPad("OverThreshold20","OverThreshold20"); + if (!fOverThreshold30) fOverThreshold30 = new AliTPCCalPad("OverThreshold30","OverThreshold30"); + // + if (csignal>fMaxCharge->GetCalROC(icsector)->GetValue(icRow, icPad)){ + fMaxCharge->GetCalROC(icsector)->SetValue(icRow, icPad,csignal); + } + + // + if (csignal>0){ + Int_t count = fOverThreshold0->GetCalROC(icsector)->GetValue(icRow, icPad); + fOverThreshold0->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); + }; + // + if (csignal>5){ + Int_t count = fOverThreshold5->GetCalROC(icsector)->GetValue(icRow, icPad); + fOverThreshold5->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); + }; + if (csignal>10){ + Int_t count = fOverThreshold10->GetCalROC(icsector)->GetValue(icRow, icPad); + fOverThreshold10->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); + }; + if (csignal>20){ + Int_t count = fOverThreshold20->GetCalROC(icsector)->GetValue(icRow, icPad); + fOverThreshold20->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); + }; + if (csignal>30){ + Int_t count = fOverThreshold30->GetCalROC(icsector)->GetValue(icRow, icPad); + fOverThreshold30->GetCalROC(icsector)->SetValue(icRow, icPad,count+1); + }; + + return 0; +} diff --git a/TPC/AliTPCdataQA.h b/TPC/AliTPCdataQA.h new file mode 100644 index 00000000000..d0ca826e72a --- /dev/null +++ b/TPC/AliTPCdataQA.h @@ -0,0 +1,93 @@ +#ifndef ALITPCDATAQA_H +#define ALITPCDATAQA_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + + +#include +#include + +class TArrayF; +class TH2F; +class TTreeSRedirector; +class AliTPCROC; +class AliTPCCalROC; +class AliTPCRawStream; +class AliTPCRawStreamFast; +class AliRawReader; +class AliTPCAltroMapping; +class AliTPCCalPad; +struct eventHeaderStruct; + +class AliTPCdataQA : public TObject { + +public: + AliTPCdataQA(); + AliTPCdataQA(const AliTPCdataQA &ped); + virtual ~AliTPCdataQA(); + + AliTPCdataQA& operator = (const AliTPCdataQA &source); + void DumpToFile(const Char_t *filename, const Char_t *dir="", const Bool_t append=kFALSE); + // + Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast); + Bool_t ProcessEventFast(AliRawReader *rawReader); + Bool_t ProcessEvent(AliTPCRawStream *rawStream); + Bool_t ProcessEvent(AliRawReader *rawReader); + Bool_t ProcessEvent(eventHeaderStruct *event); + + Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad, + const Int_t iTimeBin, const Float_t signal); + void Analyse(); + // + // + AliTPCCalPad *GetMaxCharge(){ return fMaxCharge;} + AliTPCCalPad *GetOverThreshold0(){ return fOverThreshold0;} + AliTPCCalPad *GetOverThreshold5(){ return fOverThreshold5;} + AliTPCCalPad *GetOverThreshold10(){ return fOverThreshold10;} + AliTPCCalPad *GetOverThreshold20(){ return fOverThreshold20;} + AliTPCCalPad *GetOverThreshold30(){ return fOverThreshold30;} + + // + AliTPCAltroMapping **GetAltroMapping() { return fMapping; }; + void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; }; + // + // + Int_t GetFirstTimeBin() const { return fFirstTimeBin; } + Int_t GetLastTimeBin() const { return fLastTimeBin; } + Int_t GetAdcMin() const { return fAdcMin; } + Int_t GetAdcMax() const { return fAdcMax; } + void SetRangeTime(Int_t tMin, Int_t tMax){ fFirstTimeBin=tMin; fLastTimeBin=tMax; } // Set time bin range that is used for the pedestal calibration + void SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; } // Set adc range for the pedestal calibration + + void SetOldRCUformat(Bool_t format=kTRUE) { fOldRCUformat = format; } + + +private: + + Int_t fFirstTimeBin; // First Time bin needed for analysis + Int_t fLastTimeBin; // Last Time bin needed for analysis + Int_t fAdcMin; // min adc channel of pedestal value + Int_t fAdcMax; // max adc channel of pedestal value + Bool_t fOldRCUformat; //! Should we use the old RCU format for data reading + + AliTPCROC *fROC; //! ROC information + AliTPCAltroMapping **fMapping; //! Altro Mapping object + // + // + AliTPCCalPad * fMaxCharge; // max charge + AliTPCCalPad * fOverThreshold0; // number of digits over threshold + AliTPCCalPad * fOverThreshold5; // number of digits over threshold + AliTPCCalPad * fOverThreshold10; // number of digits over threshold + AliTPCCalPad * fOverThreshold20; // number of digits over threshold + AliTPCCalPad * fOverThreshold30; // number of digits over threshold + Int_t fEventCounter; // event Counter + +public: + ClassDef(AliTPCdataQA, 1) // Implementation of the TPC pedestal and noise calibration +}; + + + +#endif + diff --git a/TPC/TPCbaseLinkDef.h b/TPC/TPCbaseLinkDef.h index f4c5a56a647..40e0026448a 100644 --- a/TPC/TPCbaseLinkDef.h +++ b/TPC/TPCbaseLinkDef.h @@ -64,5 +64,6 @@ #pragma link C++ class AliTPCTransform+; #pragma link C++ class AliTPCAlign; +#pragma link C++ class AliTPCdataQA; #endif diff --git a/TPC/libTPCbase.pkg b/TPC/libTPCbase.pkg index 273ad5dd28e..f80f49ef76d 100644 --- a/TPC/libTPCbase.pkg +++ b/TPC/libTPCbase.pkg @@ -15,7 +15,8 @@ SRCS:= AliSegmentID.cxx AliSegmentArray.cxx AliDigits.cxx AliH2F.cxx \ AliTPCGenDBTemp.cxx AliTPCGenDBConf.cxx \ AliTPCExB.cxx AliTPCExBExact.cxx AliTPCExBFirst.cxx \ AliTPCTempMap.cxx AliTPCCalibVdrift.cxx \ - AliTransform.cxx AliTPCTransform.cxx AliTPCAlign.cxx + AliTransform.cxx AliTPCTransform.cxx AliTPCAlign.cxx \ + AliTPCdataQA.cxx -- 2.39.3