--- /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. *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Class to process a tree and create alarms based on thresholds //
+// origin: jens wiechula: jens.wiechula@cern.ch //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <TObjArray.h>
+#include <TString.h>
+#include <TObjString.h>
+#include <TTree.h>
+#include <TGraph.h>
+#include <TFrame.h>
+#include <TIterator.h>
+#include <TPad.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TStopwatch.h>
+
+#include <AliLog.h>
+
+#include "AliTPCCalibQAChecker.h"
+
+using namespace std;
+
+AliTPCCalibQAChecker::AliTPCCalibQAChecker() :
+ TNamed("AliTPCCalibQAChecker","AliTPCCalibQAChecker"),
+ fTreePtr(0x0),
+ fHistPtr(0x0),
+ fGraphPtr(0x0),
+ fNumberPtr(0x0),
+ fHist(0x0),
+ fIterSubCheckers(0x0),
+ fArrSubCheckers(0x0),
+ fArrAlarmDescriptions(0x0),
+ fStrDrawRep(""),
+ fStrDrawRepOpt(""),
+ fStrDraw(""),
+ fStrDrawOpt(""),
+ fStrCuts(""),
+ fAlarmType(kMean),
+ fQualityLevel(kINFO),
+ fHistRep(0x0)
+{
+ //
+ // Default ctor
+ //
+ ResetAlarmThresholds();
+}
+//_________________________________________________________________________
+AliTPCCalibQAChecker::AliTPCCalibQAChecker(const char* name, const char *title) :
+ TNamed(name,title),
+ fTreePtr(0x0),
+ fHistPtr(0x0),
+ fGraphPtr(0x0),
+ fNumberPtr(0x0),
+ fHist(0x0),
+ fIterSubCheckers(0x0),
+ fArrSubCheckers(0x0),
+ fArrAlarmDescriptions(0x0),
+ fStrDrawRep(""),
+ fStrDrawRepOpt(""),
+ fStrDraw(""),
+ fStrDrawOpt(""),
+ fStrCuts(""),
+ fAlarmType(kMean),
+ fQualityLevel(kINFO),
+ fHistRep(0x0)
+{
+ //
+ // TNamed ctor
+ //
+ ResetAlarmThresholds();
+}
+//_________________________________________________________________________
+AliTPCCalibQAChecker::~AliTPCCalibQAChecker()
+{
+ //
+ // Default ctor
+ //
+ if (fHistRep) delete fHistRep;
+ if (fIterSubCheckers) delete fIterSubCheckers;
+ if (fArrAlarmDescriptions) delete fArrAlarmDescriptions;
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::AddSubChecker(AliTPCCalibQAChecker *alarm)
+{
+ //
+ // add a sub checker to this checker
+ //
+ if (!alarm) return;
+ if (!fArrSubCheckers) {
+ fArrSubCheckers=new TObjArray;
+ fArrSubCheckers->SetOwner();
+ }
+ fArrSubCheckers->Add(alarm);
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::Process()
+{
+ //
+ // Process the alarm thresholds, decide the alarm level, create the representation histogram
+ //
+
+ //reset quality level
+ fQualityLevel=kINFO;
+
+ TStopwatch s;
+ s.Start();
+ //decide which type of checker to use
+ if (fArrSubCheckers && fArrSubCheckers->GetEntries()>0) ProcessSub();
+ else if (fTreePtr && *fTreePtr) ProcessTree();
+ else if (fHistPtr && *fHistPtr) ProcessHist();
+ else if (fGraphPtr && *fGraphPtr) ProcessGraph();
+ else if (fNumberPtr) ProcessNumber();
+ s.Stop();
+ AliInfo(Form("Processing Time (%s): %fs",GetName(),s.RealTime()));
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessSub()
+{
+ //
+ // sub checker type checker
+ //
+ QualityFlag_t quality=kINFO;
+ if (fArrSubCheckers && fArrSubCheckers->GetEntries()>0){
+ TIter next(fArrSubCheckers);
+ TObject *o=0x0;
+ while ( (o=next()) ) {
+ AliTPCCalibQAChecker *al=(AliTPCCalibQAChecker*)o;
+ al->Process();
+ QualityFlag_t subQuality=al->GetQuality();
+ if (subQuality>quality) quality=subQuality;
+ }
+ }
+ fQualityLevel=quality;
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessTree()
+{
+ //
+ // process tree type checker
+ //
+
+ //Create Representation Histogram
+ CreateRepresentationHist();
+ //
+// if (!fTree) return;
+ //chek for the quality
+
+ switch (fAlarmType){
+ case kNentries:
+ ProcessEntries();
+ break;
+ case kMean:
+ case kBinAny:
+ case kBinAll:
+ CreateAlarmHist();
+ ProcessHist();
+ ResetAlarmHist();
+ break;
+ }
+
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessHist()
+{
+ //
+ // process histogram type checker
+ //
+
+ if (!(fHistPtr && *fHistPtr)) return;
+
+ switch (fAlarmType){
+ case kNentries:
+ case kMean:
+ ProcessMean();
+ break;
+ case kBinAny:
+ case kBinAll:
+ ProcessBin();
+ break;
+ }
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessGraph()
+{
+ //
+ // process graph type checker
+ //
+ if (!(fGraphPtr && *fGraphPtr)) return;
+ Int_t npoints=(*fGraphPtr)->GetN();
+ fQualityLevel=GetQuality(npoints,(*fGraphPtr)->GetY());
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessNumber()
+{
+ //
+ // process number type checker
+ //
+ if (!fNumberPtr) return;
+ fQualityLevel=GetQuality(*fNumberPtr);
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessEntries()
+{
+ //
+ // Processing function which analyses the number of affected rows of a tree draw
+ //
+ TString draw=fStrDraw;
+ if (draw.IsNull()) return;
+
+ TString cuts=fStrCuts;
+
+ TString opt=fStrDrawOpt;
+ opt+="goff";
+
+ //draw and get the histogram
+ Int_t res=(*fTreePtr)->Draw(draw.Data(),cuts.Data(),opt.Data());
+ fQualityLevel=GetQuality(res);
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessMean()
+{
+ //
+ // Processing function which analyses the mean of the resulting histogram
+ //
+
+ TH1* h=(*fHistPtr);
+ Double_t value=h->GetMean();
+ if (fAlarmType==kNentries) value=h->GetEntries();
+ fQualityLevel=GetQuality(value);
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ProcessBin()
+{
+ //
+ // Process a histogram bin by bin and check for thresholds
+ //
+
+ //bin quality counters
+ Int_t nquality[kNQualityFlags];
+ for (Int_t iquality=(Int_t)kINFO; iquality<kNQualityFlags; ++iquality) nquality[iquality]=0;
+
+ TH1 *h=(*fHistPtr);
+
+ Int_t nbinsX=h->GetNbinsX();
+ Int_t nbinsY=h->GetNbinsY();
+ Int_t nbinsZ=h->GetNbinsZ();
+ Int_t nbinsTotal=nbinsX*nbinsY*nbinsZ;
+
+ //loop over all bins
+ for (Int_t ibinZ=1;ibinZ<nbinsZ+1;++ibinZ){
+ for (Int_t ibinY=1;ibinY<nbinsY+1;++ibinY){
+ for (Int_t ibinX=1;ibinX<nbinsX+1;++ibinX){
+ Double_t value = (*fHistPtr)->GetBinContent(ibinX, ibinY, ibinZ);
+ QualityFlag_t quality=GetQuality(value);
+ nquality[quality]++;
+ }
+ }
+ }
+
+ //loop over Quality levels and set quality
+ for (Int_t iquality=(Int_t)kINFO; iquality<kNQualityFlags; ++iquality){
+ if (fAlarmType==kBinAny){
+ if (nquality[iquality]) fQualityLevel=(QualityFlag_t)iquality;
+ } else if (fAlarmType==kBinAll){
+ if (nquality[iquality]==nbinsTotal) fQualityLevel=(QualityFlag_t)iquality;
+ }
+ }
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::CreateRepresentationHist()
+{
+ //
+ // Create the representation histogram which will be shown in the draw function
+ //
+ ResetRepresentationHist();
+
+ TString draw=fStrDrawRep;
+ if (draw.IsNull()) {
+ draw=fStrDraw;
+ fStrDrawRepOpt=fStrDrawOpt;
+ } else {
+ draw.ReplaceAll("%alarm%",fStrDraw.Data());
+ }
+ if (draw.IsNull()) return;
+
+ TString cuts=fStrCuts;
+
+ TString opt=fStrDrawRepOpt;
+ opt+="goff";
+
+ Int_t res=(*fTreePtr)->Draw(draw.Data(),cuts.Data(),opt.Data());
+ TH1 *hist=(*fTreePtr)->GetHistogram();
+ if (res<0 || !hist){
+ AliError(Form("Could not create representation histogram of alarm '%s'",GetName()));
+ return;
+ }
+ fHistRep=(TH1*)hist->Clone();
+ fHistRep->SetDirectory(0);
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::CreateAlarmHist()
+{
+ //
+ // create alarm histogram from the tree
+ //
+
+ TString draw=fStrDraw;
+ if (draw.IsNull()) return;
+
+ TString cuts=fStrCuts;
+
+ TString opt=fStrDrawOpt;
+ opt+="goff";
+
+ //draw and get the histogram
+ Int_t res=(*fTreePtr)->Draw(draw.Data(),cuts.Data(),opt.Data());
+ fHist=(*fTreePtr)->GetHistogram();
+ if (res<0 || !fHist){
+ AliError(Form("Could not create alarm histogram of alarm '%s'",GetName()));
+ return;
+ }
+ fHist->SetDirectory(0);
+ fHistPtr=&fHist;
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ResetAlarmHist()
+{
+ //
+ // delete the alarm histogram and reset the pointer
+ //
+ if (fHistPtr){
+ if (*fHistPtr) delete *fHistPtr;
+ fHistPtr=0x0;
+ }
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::Draw(Option_t *option)
+{
+ //
+ // object draw function
+ // by default the pad backgound color is set to the quality level color
+ // use 'nobc' to change this
+ //
+
+ if (!fHistRep) return;
+
+ Bool_t withBackColor=kTRUE;
+
+ TString opt=option;
+ opt.ToLower();
+
+ if (opt.Contains("nobc")) withBackColor=kFALSE;
+ opt.ReplaceAll("nobc","");
+
+ if (opt.IsNull()) opt=fStrDrawRepOpt;
+ opt.ToLower();
+
+ opt.ReplaceAll("prof","");
+
+ fHistRep->Draw(opt.Data());
+
+ if (gPad){
+ gPad->Modified();
+ if (withBackColor) gPad->SetFillColor(GetQualityColor());
+ TFrame* frame=(TFrame*)gPad->GetPrimitive("TFrame");
+ if (frame) frame->SetFillColor(kWhite);
+ }
+
+ gPad->Modified();
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::Print(Option_t *option) const
+{
+ //
+ // print the quality status. If we have sub checkers print recursively
+ //
+ TString sOpt(option);
+ cout << sOpt << GetName() << ": " << GetQualityName() << endl;
+ if (fArrSubCheckers && fArrSubCheckers->GetEntries()>0){
+ sOpt.ReplaceAll("+-"," ");
+ sOpt+="+-";
+ TIter next(fArrSubCheckers);
+ TObject *o=0x0;
+ while ( (o=next()) ) o->Print(sOpt.Data());
+ }
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::SetAlarmThreshold(const Double_t min, const Double_t max, const QualityFlag_t quality)
+{
+ //
+ //set the alarm thresholds for a specific quality level
+ //
+ if ((Int_t)quality<(Int_t)kINFO||(Int_t)quality>=kNQualityFlags) return;
+ fThresMin[quality]=min;
+ fThresMax[quality]=max;
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ResetAlarmThreshold(const QualityFlag_t quality)
+{
+ //
+ //set the alarm thresholds for a specific quality level
+ //
+ if ((Int_t)quality<(Int_t)kINFO||(Int_t)quality>=kNQualityFlags) return;
+ fThresMin[quality]=0;
+ fThresMax[quality]=0;
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::ResetAlarmThresholds()
+{
+ //
+ //reset all the alarm thresholds
+ //
+ for (Int_t i=0;i<kNQualityFlags;++i){
+ fThresMin[i]=0;
+ fThresMax[i]=0;
+ }
+}
+//_________________________________________________________________________
+void AliTPCCalibQAChecker::SetQualityDescription(const char* text, const QualityFlag_t quality)
+{
+ //
+ // set an description for the quality level
+ // %min and %max will be replaced by the min and max values of the alarm, when the quality
+ // description is queried (see QualityDescription)
+ //
+
+ if (quality<kINFO||quality>kFATAL) return;
+ if (! fArrAlarmDescriptions ) fArrAlarmDescriptions=new TObjArray(kNQualityFlags);
+ TObjString *s=(TObjString*)fArrAlarmDescriptions->At(quality);
+ if (!s) fArrAlarmDescriptions->AddAt(s=new TObjString,quality);
+ s->SetString(text);
+}
+
+//_________________________________________________________________________
+const AliTPCCalibQAChecker* AliTPCCalibQAChecker::GetSubChecker(const char* name, Bool_t recursive) const
+{
+ //
+ //
+ //
+ TString sname(name);
+ if (sname==GetName()) return this;
+ if (!fArrSubCheckers || !fArrSubCheckers->GetEntries()) return 0x0;
+ const AliTPCCalibQAChecker *al=0x0;
+ if (recursive){
+ TIter next(fArrSubCheckers);
+ TObject *o=0x0;
+ while ( (o=next()) ){
+ AliTPCCalibQAChecker *sal=(AliTPCCalibQAChecker*)o;
+ al=sal->GetSubChecker(name);
+ if (al) break;
+ }
+ }else{
+ al=dynamic_cast<AliTPCCalibQAChecker*>(fArrSubCheckers->FindObject(name));
+ }
+ return al;
+}
+//_________________________________________________________________________
+Int_t AliTPCCalibQAChecker::GetNumberOfSubCheckers(Bool_t recursive) const
+{
+ //
+ // get the number of sub checkers
+ // if recursive get total number of non subchecker type sub checkers
+ //
+ Int_t nsub=0;
+ if (recursive){
+ if (!fArrSubCheckers) return 1;
+ if (!fArrSubCheckers->GetEntries()) return 0;
+ TIter next(fArrSubCheckers);
+ TObject *o=0x0;
+ while ( (o=next()) ){
+ AliTPCCalibQAChecker *al=(AliTPCCalibQAChecker*)o;
+ nsub+=al->GetNumberOfSubCheckers();
+ }
+ } else {
+ if (fArrSubCheckers) nsub=fArrSubCheckers->GetEntries();
+ }
+ return nsub;
+}
+//_________________________________________________________________________
+AliTPCCalibQAChecker* AliTPCCalibQAChecker::NextSubChecker()
+{
+ //
+ // loop over sub checkers
+ // if recursive, recursively return the pointers of non subchecker type sub checkers
+ //
+ if (!fArrSubCheckers && !fArrSubCheckers->GetEntries()) return 0;
+ if (!fIterSubCheckers) fIterSubCheckers=fArrSubCheckers->MakeIterator();
+ AliTPCCalibQAChecker *al=(AliTPCCalibQAChecker*)fIterSubCheckers->Next();
+ if (!al){
+ delete fIterSubCheckers;
+ fIterSubCheckers=0x0;
+ }
+// if (recursive && al->GetNumberOfSubCheckers(kFALSE)) al=al->NextSubChecker();
+ return al;
+}
+//_________________________________________________________________________
+const char* AliTPCCalibQAChecker::QualityName(const AliTPCCalibQAChecker::QualityFlag_t quality)
+{
+ //
+ // get quality name for quality
+ //
+ switch (quality){
+ case kINFO:
+ return "Info";
+ break;
+ case kWARNING:
+ return "Warning";
+ break;
+ case kERROR:
+ return "Error";
+ break;
+ case kFATAL:
+ return "Fatal";
+ break;
+ default:
+ return "";
+ }
+}
+//_________________________________________________________________________
+Color_t AliTPCCalibQAChecker::QualityColor(const AliTPCCalibQAChecker::QualityFlag_t quality)
+{
+ //
+ // get quality color for quality
+ //
+ Color_t info = kSpring-8;
+ Color_t warning = kOrange;
+ Color_t error = kRed;
+ Color_t fatal = kRed+2;
+ Color_t none = kWhite;
+
+ switch(quality) {
+ case kINFO :
+ return info;
+ break;
+ case kWARNING :
+ return warning;
+ break;
+ case kERROR :
+ return error;
+ break;
+ case kFATAL :
+ return fatal;
+ break;
+ default:
+ return none;
+ }
+ return none;
+
+}
+//_________________________________________________________________________
+const char* AliTPCCalibQAChecker::QualityDescription(const QualityFlag_t quality) const
+{
+ //
+ // return description for quality
+ //
+ if (!fArrAlarmDescriptions || !fArrAlarmDescriptions->At(quality)) return "";
+ TString s(fArrAlarmDescriptions->At(quality)->GetName());
+ TString min, max;
+ min+=fThresMin[quality];
+ max+=fThresMax[quality];
+ s.ReplaceAll("%min",min);
+ s.ReplaceAll("%max",max);
+ return s.Data();
+}
+//_________________________________________________________________________
+Int_t AliTPCCalibQAChecker::DrawInPad(TPad *pad, Int_t sub)
+{
+ //
+ //
+ //
+
+ if (fArrSubCheckers){
+ if (fArrSubCheckers->GetEntries()>0){
+ TIter next(fArrSubCheckers);
+ TObject *o=0x0;
+ while ( (o=next()) ) {
+ AliTPCCalibQAChecker *al=(AliTPCCalibQAChecker*)o;
+ sub=al->DrawInPad(pad,sub);
+ }
+ }
+ } else {
+ pad->cd(sub);
+ ++sub;
+ Draw();
+ }
+ return sub;
+}
--- /dev/null
+#ifndef AliTPCCalibQAChecker_H
+#define AliTPCCalibQAChecker_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+#include <TNamed.h>
+#include <TString.h>
+#include <TH1.h>
+
+class TTree;
+class TIter;
+class TGraph;
+class TObjArray;
+class TPad;
+
+class AliTPCCalibQAChecker : public TNamed {
+public:
+ enum { kNQualityFlags=5 };
+ enum QualityFlag_t { kNULLFLAG=-1, kINFO, kWARNING, kERROR, kFATAL, kNFLAG };
+ enum AlarmType_t { kMean=0, kBinAny, kBinAll, kNentries};
+
+ AliTPCCalibQAChecker();
+ AliTPCCalibQAChecker(const char* name, const char *title);
+// AliTPCCalibQAChecker(const char* name, const char *title);
+
+ virtual ~AliTPCCalibQAChecker();
+
+ void Process();
+
+ void SetTreeChecker(TTree* &tree) {fTreePtr=&tree;}
+ void SetHistChecker(TH1* &hist) {fHistPtr=&hist;}
+ void SetGraphChecker(TGraph* &graph) {fGraphPtr=&graph;}
+ void SetNumberChecker(Double_t &number) {fNumberPtr=&number;}
+
+ const AliTPCCalibQAChecker* GetSubChecker(const char* name, Bool_t recursive=kTRUE) const;
+ AliTPCCalibQAChecker* NextSubChecker();
+ Int_t GetNumberOfSubCheckers(Bool_t recursive=kTRUE) const;
+ Bool_t HasSubCheckers() const {return GetNumberOfSubCheckers(kFALSE)>0;}
+
+ void AddSubChecker(AliTPCCalibQAChecker *alarm);
+
+ //getters
+ void GetAlarmThreshold(Double_t &min, Double_t &max, QualityFlag_t quality=kERROR) const {min=fThresMin[quality]; max=fThresMax[quality];}
+ //
+ const char* GetDrawString() { return fStrDraw.Data(); }
+ const char* GetCutsString() { return fStrCuts.Data(); }
+ const char* GetDrawOptString() {return fStrDrawOpt.Data(); }
+
+ //tree related
+ void SetDrawRepresentation(const char *draw, const char* drawOpt="") {fStrDrawRep=draw; fStrDrawRepOpt=drawOpt;}
+ void SetDrawAlarm(const char *draw, const char* drawOpt="") {fStrDraw=draw; fStrDrawOpt=drawOpt;}
+ void SetCutString(const char *cutString ) {fStrCuts=cutString;}
+
+ //general thresholds for the different qualities
+ void SetAlarmThreshold(const Double_t min, const Double_t max, const QualityFlag_t quality=kERROR);
+ void ResetAlarmThreshold(const QualityFlag_t quality);
+ void ResetAlarmThresholds();
+
+ //descriptions
+ void SetQualityDescription(const char* text, const QualityFlag_t quality=kERROR);
+
+ //alarm type
+ void SetAlarmType(AlarmType_t type) {fAlarmType=type;}
+
+
+ QualityFlag_t GetQuality() const {return fQualityLevel;}
+ Color_t GetQualityColor() const {return AliTPCCalibQAChecker::QualityColor(fQualityLevel);}
+ const char* GetQualityName() const {return AliTPCCalibQAChecker::QualityName(fQualityLevel);}
+ const char* GetQualityDescription() const { return QualityDescription(fQualityLevel);}
+
+ static const char* QualityName(const AliTPCCalibQAChecker::QualityFlag_t quality);
+ static Color_t QualityColor(const AliTPCCalibQAChecker::QualityFlag_t quality);
+ const char* QualityDescription(const QualityFlag_t quality) const;
+
+ virtual void Draw(Option_t *option="");
+ virtual void Print(Option_t *option="") const;
+
+// private:
+ //alarm decision variables
+ TTree **fTreePtr; //! Pointer to the Tree pointer
+ TH1 **fHistPtr; //! Pointer to the hist pointer
+ TGraph **fGraphPtr; //! Pointer to the graph pointer
+ Double_t *fNumberPtr; //! Pointer to number
+ TH1 *fHist; //! Hist pointer for tree processing
+
+ TIterator *fIterSubCheckers; //! iterator over sub checkers
+
+ TObjArray *fArrSubCheckers; //array with checkers to process
+ TObjArray *fArrAlarmDescriptions; //array with alarm descriptions
+
+ TString fStrDrawRep; //draw string for representation histogram to visualise
+ TString fStrDrawRepOpt; //draw option for representation histogram
+
+ TString fStrDraw; //draw string for alarm histogram
+ TString fStrDrawOpt; //draw option for alarm histogram
+
+ TString fStrCuts; //cut string
+
+ AlarmType_t fAlarmType; //type of the alarm
+ QualityFlag_t fQualityLevel; //quality level
+
+ TH1* fHistRep; //visualised histogram
+
+ Double_t fThresMin[kNQualityFlags];//minimum thresholds
+ Double_t fThresMax[kNQualityFlags];//maximum thresholds
+
+ void CreateRepresentationHist();
+ void ResetRepresentationHist() {if (fHistRep) {delete fHistRep; fHistRep=0x0;}}
+ //general processing
+ void ProcessTree();
+ void ProcessHist();
+ void ProcessGraph();
+ void ProcessNumber();
+ void ProcessSub();
+ //special processing
+ void ProcessEntries();
+ void ProcessMean();
+ void ProcessBin();
+ //
+ void CreateAlarmHist();
+ void ResetAlarmHist();
+ //
+ Int_t DrawInPad(TPad *pad, Int_t sub=1);
+ AliTPCCalibQAChecker(const AliTPCCalibQAChecker &cfg);
+ AliTPCCalibQAChecker& operator = (const AliTPCCalibQAChecker &cfg);
+
+ QualityFlag_t GetQuality(Double_t value) const;
+ QualityFlag_t GetQuality(Int_t n, Double_t *arr) const;
+
+ ClassDef(AliTPCCalibQAChecker,1);
+};
+
+//
+//inline functions
+//
+
+//_________________________________________________________________________
+inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Double_t value) const
+{
+ //
+ // check quality of a value
+ //
+
+ QualityFlag_t quality=kINFO;
+ //loop over Quality levels
+ for (Int_t i=(Int_t)kINFO; i<kNQualityFlags; ++i){
+ if (fThresMin[i]>=fThresMax[i]) continue;
+ if (value<fThresMin[i]||value>fThresMax[i]) quality=(QualityFlag_t)i;
+ }
+ return quality;
+}
+//_________________________________________________________________________
+inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Int_t n, Double_t *arr) const
+{
+ //
+ // check quality of an array
+ //
+
+ QualityFlag_t quality=kINFO;
+ //loop over Quality levels
+ for (Int_t i=(Int_t)kINFO; i<kNQualityFlags; ++i){
+ if (fThresMin[i]>=fThresMax[i]) continue;
+ for (Int_t ientry=0; ientry<n; ++ientry){
+ Double_t value=arr[ientry];
+ if (value<fThresMin[i]||value>fThresMax[i]) quality=(QualityFlag_t)i;
+ }
+ }
+ return quality;
+}
+
+#endif
class TROOTt;
class AliTPCCalibViewer;
class AliTPCPreprocessorOnline;
+class TGTextEntry;
// class TGListBox;
TString* GetSectorString(); // create the sector string out of selection
AliTPCCalibViewer* GetViewer() {return fViewer;} // returns the internal AliTPCCalibViewer object, which does the work
static TObjArray* ShowGUI(const char* fileName = 0); // initialize and show GUI for presentation, standalone
-
+ //
+ TGTextEntry* GetDrawEntry() {return fComboCustom->GetTextEntry();}
+ TGTextEntry* GetCutsEntry() {return fComboAddCuts->GetTextEntry();}
+ TGTextEntry* GetDrawOptEntry() {return fComboAddDrawOpt->GetTextEntry();}
+ TGTextEntry* GetFitEntry() {return fComboCustomFit->GetTextEntry();}
+ //
void HandleButtonsGeneral(Int_t id = -1); // handles mutual radio button exclusions for general Tab
void HandleButtons1D(Int_t id = -1); // handles mutual radio button exclusions for 1D Tab
void HandleButtonsStat(Int_t id = -1); // handles statistic check boxes
--- /dev/null
+
+#include <TGClient.h>
+#include <TGSplitter.h>
+#include <TGListTree.h>
+#include <TGTextEntry.h>
+#include <TGFrame.h>
+#include <TGLabel.h>
+#include <TRootEmbeddedCanvas.h>
+#include <TCanvas.h>
+#include <TPad.h>
+#include <TVirtualPad.h>
+
+#include "AliLog.h"
+#include "AliTPCCalibQAChecker.h"
+#include "AliTPCCalibViewerGUI.h"
+#include "AliTPCCalibViewerGUItime.h"
+
+#include "AliTPCCalibViewerGUIAlarms.h"
+
+
+ClassImp(AliTPCCalibViewerGUIAlarms)
+
+AliTPCCalibViewerGUIAlarms::AliTPCCalibViewerGUIAlarms(const TGWindow *p, UInt_t w, UInt_t h) :
+ TGCompositeFrame(p,w,h),
+ fCalibChecker(0x0),
+ fAlarmTree(0x0),
+ fMainCanvas(0x0),
+ fTreeCanvas(0x0),
+ fAlarmText(0x0),
+ fCalibViewerGUI(0x0),
+ fCalibViewerGUItime(0x0)
+{
+ //
+ //
+ //
+ DrawGUI(p,w,h);
+}
+//______________________________________________________________________________
+AliTPCCalibViewerGUIAlarms::~AliTPCCalibViewerGUIAlarms()
+{
+ //
+ //
+ //
+// gClient->FreePicture("interrupt.xpm");
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h)
+{
+ //
+ // draw the GUI
+ //
+
+ //GUI elements
+ SetCleanup(kDeepCleanup);
+
+ // *****************************************************************************
+ // ************************* content of this MainFrame *************************
+ // *****************************************************************************
+ // top level container with horizontal layout
+
+ TGCompositeFrame *contLCR = new TGCompositeFrame(this, w, h, kHorizontalFrame | kFixedWidth | kFixedHeight);
+ AddFrame(contLCR, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
+
+ // ***********************************************************************
+ // ************************* content of contLCR *************************
+ // ***********************************************************************
+ // left container
+ TGCompositeFrame *contLeft = new TGCompositeFrame(contLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
+ contLCR->AddFrame(contLeft, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 3, 3, 3));
+
+ // left vertical splitter
+ TGVSplitter *splitLeft = new TGVSplitter(contLCR);
+ splitLeft->SetFrame(contLeft, kTRUE);
+ contLCR->AddFrame(splitLeft, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
+
+ // right container
+ TGCompositeFrame *contRight = new TGCompositeFrame(contLCR, 150, 200, kVerticalFrame | kFixedWidth | kFitHeight);
+ contLCR->AddFrame(contRight, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandY, 3, 5, 3, 3));
+
+ // center container
+ TGCompositeFrame *contCenter = new TGCompositeFrame(contLCR, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
+ contLCR->AddFrame(contCenter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
+
+ // right vertical splitter
+ TGVSplitter *splitRight = new TGVSplitter(contLCR);
+ splitRight->SetFrame(contRight, kFALSE);
+ contLCR->AddFrame(splitRight, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0));
+
+ // ***********************************************************************
+ // ******************* left container ************************
+ // ***********************************************************************
+
+ //Alarm list view
+ TGCanvas *treeCanvas = new TGCanvas(contLeft, 200, 200);
+ fAlarmTree = new TGListTree(treeCanvas, kHorizontalFrame);
+ contLeft->AddFrame(treeCanvas,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY | kLHintsTop));
+ fAlarmTree->Connect("DoubleClicked(TGListTreeItem*,Int_t)","AliTPCCalibViewerGUIAlarms",this,
+ "OnDoubleClick(TGListTreeItem*,Int_t)");
+ fAlarmTree->Connect("Clicked(TGListTreeItem*,Int_t)","AliTPCCalibViewerGUIAlarms",this,
+ "OnClick(TGListTreeItem*,Int_t)");
+ fAlarmTree->SetColorMode(TGListTree::kColorBox);
+
+ // ***********************************************************************
+ // ******************* center container ************************
+ // ***********************************************************************
+
+ // top container
+ TGCompositeFrame *contCenterTop = new TGCompositeFrame(contCenter, 200, 200, kVerticalFrame | kFixedWidth | kFitHeight);
+ contCenter->AddFrame(contCenterTop, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
+
+ // bottom container
+ TGCompositeFrame *contCenterBottom = new TGCompositeFrame(contCenter, 200, 100, kVerticalFrame | kFixedWidth | kFixedHeight);
+ contCenter->AddFrame(contCenterBottom, new TGLayoutHints( kLHintsExpandX, 0, 0, 0, 0));
+
+ //--------------
+ // canvas on top
+ TRootEmbeddedCanvas *cEmbed = new TRootEmbeddedCanvas("Main_Canvas", contCenterTop, 200, 200, kFitWidth | kFitHeight);
+ contCenterTop->AddFrame(cEmbed, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
+// cEmbed->GetCanvas()->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "AliTPCCalibViewerGUIAlarms", this, "MouseMove(Int_t, Int_t, Int_t, TObject*)");
+ cEmbed->GetCanvas()->SetToolTipText("Alarm histograms are displayed in this region.");
+ fMainCanvas=cEmbed->GetCanvas();
+ //--------------
+ // alarm text on bottom
+ // canvas
+ TGCanvas *textCanvas = new TGCanvas(contCenterBottom, 200, 200);
+ fAlarmText = new TGLabel(textCanvas->GetViewPort(),"Alarm descriptions can be found here");
+ textCanvas->SetContainer(fAlarmText);
+ contCenterBottom->AddFrame(textCanvas,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY | kLHintsTop));
+
+// textCanvas->AddFrame(fAlarmText,new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
+
+
+ // ***********************************************************************
+ // ******************* right container ************************
+ // ***********************************************************************
+
+ TGGroupFrame *grpInfo = new TGGroupFrame(contRight, "Alarm Info", kVerticalFrame | kFitWidth | kFitHeight);
+ contRight->AddFrame(grpInfo, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+
+
+ SetWindowName("AliTPCCalibViewer GUI - Alarms");
+ MapSubwindows();
+ Resize(GetDefaultSize());
+ MapWindow();
+
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::AddSubItems(AliTPCCalibQAChecker *checker, TGListTreeItem *item)
+{
+ //
+ //
+ //
+ TGListTreeItem *newitem=fAlarmTree->AddItem(item,checker->GetName(),(void*)checker);
+ newitem->SetColor(checker->GetQualityColor());
+ newitem->SetTipText(checker->GetTitle());
+ if (checker->HasSubCheckers()) {
+ AliTPCCalibQAChecker *ch=0x0;
+ while ( (ch=checker->NextSubChecker()) ) AddSubItems(ch,newitem);
+ } else {
+ newitem->SetPictures(gClient->GetPicture("interrupt.xpm"),gClient->GetPicture("interrupt.xpm"));
+ }
+
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::InitBrowser()
+{
+ //
+ //
+ //
+ if (!fAlarmTree){
+ AliError("Alarms not set!");
+ return;
+ }
+ AddSubItems(fCalibChecker,0);
+ fAlarmTree->ClearViewPort();
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::UpdateSubItem(TGListTreeItem *item)
+{
+ //
+ //
+ //
+
+ printf("name: %s\n", item->GetText());
+ AliTPCCalibQAChecker *checker=dynamic_cast<AliTPCCalibQAChecker*>((TObject*)item->GetUserData());
+ if (checker){
+ item->SetColor(checker->GetQualityColor());
+ } else {
+ item->ClearColor();
+ }
+ TGListTreeItem *nextItem=0x0;
+ if ( (nextItem=item->GetFirstChild()) ) UpdateSubItem(nextItem);
+ if ( (nextItem=item->GetNextSibling()) ) UpdateSubItem(nextItem);
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::UpdateBrowser()
+{
+ //
+ //
+ //
+ UpdateSubItem(fAlarmTree->GetFirstItem());
+ fAlarmTree->ClearViewPort();
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::OnDoubleClick(TGListTreeItem* item, Int_t id)
+{
+ //
+ //
+ //
+// printf("DoubleClicked");
+ if (!fCalibViewerGUI && !fCalibViewerGUItime) return;
+ TGTextEntry *draw=0x0;
+ TGTextEntry *cuts=0x0;
+ TGTextEntry *opt=0x0;
+ if (fCalibViewerGUI){
+ draw=fCalibViewerGUI->GetDrawEntry();
+ cuts=fCalibViewerGUI->GetCutsEntry();
+ opt=fCalibViewerGUI->GetDrawOptEntry();
+ } else if (fCalibViewerGUItime){
+ draw=fCalibViewerGUItime->GetDrawEntry();
+ cuts=fCalibViewerGUItime->GetCutsEntry();
+ opt=fCalibViewerGUItime->GetDrawOptEntry();
+ }
+ draw->SetText(((AliTPCCalibQAChecker*)item->GetUserData())->GetDrawString());
+ cuts->SetText(((AliTPCCalibQAChecker*)item->GetUserData())->GetCutsString());
+ opt->SetText(((AliTPCCalibQAChecker*)item->GetUserData())->GetDrawOptString());
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUIAlarms::OnClick(TGListTreeItem* item, Int_t id)
+{
+ //
+ //
+ //
+// printf("Clicked");
+
+ TVirtualPad *pad=gPad;
+ fMainCanvas->cd();
+ fMainCanvas->Clear();
+ AliTPCCalibQAChecker *checker=(AliTPCCalibQAChecker*)item->GetUserData();
+ checker->Draw("nobc");
+ TString text(checker->GetQualityDescription());
+ if (text.IsNull()) fAlarmText->SetText("No description available!");
+ else fAlarmText->SetText(text.Data());
+ gPad->Modified();
+ gPad->Update();
+ if (pad) pad->cd();
+
+}
+//______________________________________________________________________________
+AliTPCCalibViewerGUIAlarms* AliTPCCalibViewerGUIAlarms::Show()
+{
+ //
+ //
+ //
+ TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
+ frmMain->SetWindowName("AliTPCCalibViewer GUI");
+ frmMain->SetCleanup(kDeepCleanup);
+
+ AliTPCCalibViewerGUIAlarms* calibViewer1 = new AliTPCCalibViewerGUIAlarms(frmMain, 1000, 600);
+ frmMain->AddFrame(calibViewer1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
+
+ frmMain->MapSubwindows();
+ frmMain->Resize();
+ frmMain->MapWindow();
+
+ return calibViewer1;
+}
+//______________________________________________________________________________
+
--- /dev/null
+
+
+#ifndef AliTPCCalibViewerGUIAlarms_H
+#define AliTPCCalibViewerGUIAlarms_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTPCCalibViewerGUIAlarms.h,v */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// GUI for displaying Alarms of type AliTPCCalibQAChecker //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TGFrame.h>
+
+class TGListTree;
+class TGListTreeItem;
+class TCanvas;
+class TGLabel;
+
+class AliTPCCalibQAChecker;
+class AliTPCCalibViewerGUI;
+class AliTPCCalibViewerGUItime;
+
+class AliTPCCalibViewerGUIAlarms : public TGCompositeFrame {
+public:
+ AliTPCCalibViewerGUIAlarms(const TGWindow *p, UInt_t w, UInt_t h);
+
+ virtual ~AliTPCCalibViewerGUIAlarms();
+
+ void SetCalibChecker(AliTPCCalibQAChecker *checker) {fCalibChecker=checker;}
+ void SetCalibViewerGUI(AliTPCCalibViewerGUI *gui) {fCalibViewerGUI=gui;}
+ void SetCalibViewerGUItime(AliTPCCalibViewerGUItime *gui) {fCalibViewerGUItime=gui;}
+
+ void InitBrowser();
+
+ void UpdateBrowser();
+
+ static AliTPCCalibViewerGUIAlarms* Show();
+
+ void OnDoubleClick(TGListTreeItem* item, Int_t id);
+ void OnClick(TGListTreeItem* item, Int_t id);
+
+// protected:
+ AliTPCCalibQAChecker *fCalibChecker; //Calibration checker
+ TGListTree *fAlarmTree; //tree representation of alarms
+ TCanvas *fMainCanvas; //canvas for alarm histogram displaying
+ TGCanvas *fTreeCanvas; //tree canvas
+ TGLabel *fAlarmText; //alarm information
+ //
+ AliTPCCalibViewerGUI *fCalibViewerGUI; //! pointer to gui
+ AliTPCCalibViewerGUItime *fCalibViewerGUItime; //! pointer to gui time
+ //
+ void DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h);
+ void AddSubItems(AliTPCCalibQAChecker *fChecker, TGListTreeItem *item);
+ void UpdateSubItem(TGListTreeItem *item);
+
+private:
+ AliTPCCalibViewerGUIAlarms(const AliTPCCalibViewerGUIAlarms &v);
+ AliTPCCalibViewerGUIAlarms &operator = (const AliTPCCalibViewerGUIAlarms &v); // assignment operator
+
+
+ ClassDef(AliTPCCalibViewerGUIAlarms,0);
+};
+
+#endif
+
+
#include "AliTPCCalibViewerGUI.h"
#include "AliTPCCalibViewer.h"
#include "AliTPCcalibDB.h"
+#include "AliTPCcalibDButil.h"
#include "AliTPCConfigParser.h"
#include "AliTPCCalibViewerGUItime.h"
if (!active){
TString s=branchName;
if (branchName.EndsWith(".")) s+="*";
- fTree->SetBranchStatus(s.Data(),0);
+// fTree->SetBranchStatus(s.Data(),0);
continue;
}
// fListVariables->AddEntry(SubstituteUnderscores(branchTitle.Data()),id);
// retrieve file from this directory if it already exists
//
+ //
+ //Create and set GUI tree
+ //
//try to find file for run in fOutputCacheDir
TString fileName=fOutputCacheDir;
if (!fileName.EndsWith("/")) fileName+="/";
fileName+=Form("guiTreeRun_%d.root",run);
Bool_t load=kTRUE;
- TFile f(fileName.Data());
- if (!f.IsOpen()){
+ if (gSystem->AccessPathName(fileName.Data())){
load=AliTPCcalibDB::CreateGUITree(run,fileName.Data());
if (!load){
fCalibViewerGUI->Reset();
return;
}
}
- f.Close();
fCalibViewerGUI->Initialize(fileName.Data());
if (fCalibViewerGUItab) fCalibViewerGUItab->SetText(new TGString(Form("Detail - %05d",run)));
+
+ //
+ //Create and set Reference GUI tree
+ //
+ AliTPCcalibDButil util;
+ util.SetReferenceRun(run);
+ fileName=fOutputCacheDir;
+ if (!fileName.EndsWith("/")) fileName+="/";
+ fileName+=util.GetGUIRefTreeDefaultName();
+ //only update if file does not exist
+ if (gSystem->AccessPathName(fileName.Data())){
+ util.UpdateRefDataFromOCDB();
+ util.CreateGUIRefTree(fileName.Data());
+ }
+
+ fCalibViewerGUI->GetViewer()->AddReferenceTree(fileName.Data(),"calPads","Ref");
+
+ //
+ // Process additional reference trees
+ //
TIter nextRefTree(fMapRefTrees);
TObject *o=0x0;
+ //Set static reference data
while ( (o=nextRefTree()) ){
fCalibViewerGUI->GetViewer()->AddReferenceTree(fMapRefTrees->GetValue(o)->GetName(),"calPads",o->GetName());
}
#include "TGFrame.h"
#endif
-// #include <TGButton.h>
-// #include <TGListBox.h>
-// #include <TGComboBox.h>
-// #include <TGNumberEntry.h>
-// #include <TRootEmbeddedCanvas.h>
-// #include <TGSplitter.h>
-// #include <TGButtonGroup.h>
-// #include <TGLabel.h>
-// #include <TGTab.h>
+#include <TGComboBox.h>
#include <TString.h>
#include <TVectorT.h>
class TGRadioButton;
class TGGroupFrame;
class TGLabel;
-class TGComboBox;
class TGTabElement;
+class TGTextEntry;
class TFile;
class TTree;
const char* GetCustomDrawString() const {return fComboCustomDraw->GetTextEntry()?fComboCustomDraw->GetTextEntry()->GetText():"";}
void GetCutString(TString &cutStr);
TChain* GetChain() const {return fTree;}
+ //
+ TGTextEntry* GetDrawEntry() {return fComboCustomDraw->GetTextEntry();}
+ TGTextEntry* GetCutsEntry() {return fComboCustomCuts->GetTextEntry();}
+ TGTextEntry* GetDrawOptEntry() {return fComboAddDrawOpt->GetTextEntry();}
//Slots
void DoDraw();
void DoDumpRuns();
#include "AliTPCMonitorMappingHandler.h"
#include "AliTPCMonitorFFT.h"
#include "AliRawReader.h"
+#include "AliRawReaderRoot.h"
#include "AliRawEventHeaderBase.h"
#include "AliAltroRawStreamV3.h"
#include "TH2F.h"
while(skip && GetProcNextEvent())
{
if(fVerb) cout << "AliTPCMonitor::ReadDataNew get event " << endl;
- if(!fRawReader->NextEvent()) { AliError("Could not get next Event"); return 11 ;}
+ if(fRawReader->IsA()==AliRawReaderRoot::Class()){
+ printf("Root, NextEvent: %d\n",GetEventID());
+ if (!fRawReader->GotoEvent(GetEventID())){AliError("Could not get next Event"); return 11 ;}
+ } else if(!fRawReader->NextEvent()) { AliError("Could not get next Event"); return 11 ;}
// skip all events but physics, calibration and software trigger events!
UInt_t eventType=fRawReader->GetType();
if ( !(eventType==AliRawEventHeaderBase::kPhysicsEvent ||
#include <AliCDBManager.h>
#include <AliCDBEntry.h>
+#include <AliCDBId.h>
#include <AliLog.h>
#include <AliMagF.h>
#include <AliSplineFit.h>
#include "AliTPCcalibDB.h"
+#include "AliTPCdataQA.h"
#include "AliTPCcalibDButil.h"
#include "AliTPCAltroMapping.h"
#include "AliTPCExB.h"
fPadNoise(0),
fPedestals(0),
fCalibRaw(0),
+ fDataQA(0),
fALTROConfigData(0),
fPulserData(0),
fCEData(0),
fPadNoise(0),
fPedestals(0),
fCalibRaw(0),
+ fDataQA(0),
fALTROConfigData(0),
fPulserData(0),
fCEData(0),
TObjArray *arr=(TObjArray*)(entry->GetObject());
if (arr) fCalibRaw=(AliTPCCalibRaw*)arr->At(0);
}
+ //QA calibration data
+ entry = GetCDBEntry("TPC/Calib/QA");
+ if (entry){
+ entry->SetOwner(kTRUE);
+ fDataQA=dynamic_cast<AliTPCdataQA*>(entry->GetObject());
+ }
entry = GetCDBEntry("TPC/Calib/Mapping");
if (entry){
AliTPCcalibDB *db=AliTPCcalibDB::Instance();
// retrieve cal pad objects
db->SetRun(run);
+ db->CreateGUITree(filename);
+}
+
+Bool_t AliTPCcalibDB::CreateGUITree(const char* filename){
+ //
+ //
+ //
+ if (!AliCDBManager::Instance()->GetDefaultStorage()){
+ AliError("Default Storage not set. Cannot create calibration Tree!");
+ return kFALSE;
+ }
+
AliTPCPreprocessorOnline prep;
//noise and pedestals
- prep.AddComponent(db->GetPedestals());
- prep.AddComponent(db->GetPadNoise());
+ if (GetPedestals()) prep.AddComponent(new AliTPCCalPad(*(GetPedestals())));
+ if (GetPadNoise() ) prep.AddComponent(new AliTPCCalPad(*(GetPadNoise())));
//pulser data
- prep.AddComponent(db->GetPulserTmean());
- prep.AddComponent(db->GetPulserTrms());
- prep.AddComponent(db->GetPulserQmean());
+ if (GetPulserTmean()) prep.AddComponent(new AliTPCCalPad(*(GetPulserTmean())));
+ if (GetPulserTrms() ) prep.AddComponent(new AliTPCCalPad(*(GetPulserTrms())));
+ if (GetPulserQmean()) prep.AddComponent(new AliTPCCalPad(*(GetPulserQmean())));
//CE data
- prep.AddComponent(db->GetCETmean());
- prep.AddComponent(db->GetCETrms());
- prep.AddComponent(db->GetCEQmean());
+ if (GetCETmean()) prep.AddComponent(new AliTPCCalPad(*(GetCETmean())));
+ if (GetCETrms() ) prep.AddComponent(new AliTPCCalPad(*(GetCETrms())));
+ if (GetCEQmean()) prep.AddComponent(new AliTPCCalPad(*(GetCEQmean())));
//Altro data
- prep.AddComponent(db->GetALTROAcqStart() );
- prep.AddComponent(db->GetALTROZsThr() );
- prep.AddComponent(db->GetALTROFPED() );
- prep.AddComponent(db->GetALTROAcqStop() );
- prep.AddComponent(db->GetALTROMasked() );
+ if (GetALTROAcqStart() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROAcqStart() )));
+ if (GetALTROZsThr() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROZsThr() )));
+ if (GetALTROFPED() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROFPED() )));
+ if (GetALTROAcqStop() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROAcqStop() )));
+ if (GetALTROMasked() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROMasked() )));
+ //QA
+ AliTPCdataQA *dataQA=GetDataQA();
+ if (dataQA) {
+ if (dataQA->GetNLocalMaxima())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNLocalMaxima())));
+ if (dataQA->GetMaxCharge())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMaxCharge())));
+ if (dataQA->GetMeanCharge())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMeanCharge())));
+ if (dataQA->GetNoThreshold())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNoThreshold())));
+ if (dataQA->GetNTimeBins())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNTimeBins())));
+ if (dataQA->GetNPads())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNPads())));
+ if (dataQA->GetTimePosition())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetTimePosition())));
+ }
+
//
TString file(filename);
- if (file.IsNull()) file=Form("guiTreeRun_%d.root",run);
+ if (file.IsNull()) file=Form("guiTreeRun_%d.root",fRun);
prep.DumpToFile(file.Data());
return kTRUE;
}
}
return -result/250.; //normalized before
}
+
class AliTPCCalibVdrift;
class AliGRPObject;
class AliTPCCalibRaw;
+class AliTPCdataQA;
class TMap;
class AliMagF;
class AliTPCcalibDButil;
static Float_t GetCEchargeTime(Int_t run, Int_t sector, Double_t timeStamp=-1., Int_t *entries=0);
//Raw calibration
AliTPCCalibRaw* GetCalibRaw() const {return fCalibRaw;}
+ //QA object
+ AliTPCdataQA* GetDataQA() const {return fDataQA;}
//
AliTPCSensorTempArray* GetTemperature() {return fTemperature;}
AliTPCParam* GetParameters(){return fParam;}
AliGRPObject * MakeGRPObjectFromMap(TMap *map);
//Create a tree suited for diplaying with the AliTPCCalibViewerGUI
+ Bool_t CreateGUITree(const char* filename="");
static Bool_t CreateGUITree(Int_t run, const char* filename="");
static Bool_t CreateRefFile(Int_t run, const char* filename="");
//
AliTPCCalPad* fPadNoise; // Noise calibration entry
AliTPCCalPad* fPedestals; // Pedestal calibration entry
AliTPCCalibRaw *fCalibRaw; // raw data calibration entry
+ AliTPCdataQA *fDataQA; // qa object
TObjArray *fALTROConfigData; // ALTRO configuration data
TObjArray *fPulserData; // Calibration Pulser data
TObjArray *fCEData; // CE data
//
+ //
+ //
+ //
AliTPCSensorTempArray* fTemperature; // Temperature calibration entry
AliTPCAltroMapping **fMapping; // Altro mapping
//
TObjArray fTemperatureArray; //! array of temperature sensors - per run
TObjArray fVdriftArray; //! array of v drift interfaces
TObjArray fDriftCorrectionArray; //! array of drift correction
-
TArrayI fRunList; //! run list - indicates try to get the run param
//
#include <TGraph.h>
#include <TFile.h>
#include <TDirectory.h>
+#include <TMap.h>
+#include <TGraphErrors.h>
#include <AliCDBStorage.h>
#include <AliDCSSensorArray.h>
#include <AliTPCSensorTempArray.h>
#include <AliDCSSensor.h>
+#include <AliLog.h>
+#include <AliCDBEntry.h>
+#include <AliCDBManager.h>
+#include <AliCDBId.h>
#include "AliTPCcalibDB.h"
#include "AliTPCCalPad.h"
#include "AliTPCCalROC.h"
#include "AliTPCmapper.h"
#include "AliTPCParam.h"
#include "AliTPCCalibRaw.h"
-#include "TGraphErrors.h"
+#include "AliTPCPreprocessorOnline.h"
+#include "AliTPCdataQA.h"
#include "AliLog.h"
#include "AliTPCcalibDButil.h"
-#include "AliTPCPreprocessorOnline.h"
#include "AliTPCCalibVdrift.h"
#include "AliMathBase.h"
fCEQmean(0x0),
fALTROMasked(0x0),
fCalibRaw(0x0),
+ fDataQA(0x0),
+ fRefMap(0x0),
+ fCurrentRefMap(0x0),
+ fRefValidity(""),
fRefPadNoise(0x0),
fRefPedestals(0x0),
+ fRefPedestalMasked(0x0),
fRefPulserTmean(0x0),
fRefPulserTrms(0x0),
fRefPulserQmean(0x0),
fRefPulserOutlier(new AliTPCCalPad("RefPulserOutliers","RefPulserOutliers")),
+ fRefPulserMasked(0x0),
fRefCETmean(0x0),
fRefCETrms(0x0),
fRefCEQmean(0x0),
+ fRefCEMasked(0x0),
+ fRefALTROFPED(0x0),
+ fRefALTROZsThr(0x0),
+ fRefALTROAcqStart(0x0),
+ fRefALTROAcqStop(0x0),
fRefALTROMasked(0x0),
fRefCalibRaw(0x0),
+ fRefDataQA(0x0),
fGoofieArray(0x0),
fMapper(new AliTPCmapper(0x0)),
fNpulserOutliers(-1),
delete fMapper;
if (fRefPadNoise) delete fRefPadNoise;
if (fRefPedestals) delete fRefPedestals;
+ if (fRefPedestalMasked) delete fRefPedestalMasked;
if (fRefPulserTmean) delete fRefPulserTmean;
if (fRefPulserTrms) delete fRefPulserTrms;
if (fRefPulserQmean) delete fRefPulserQmean;
+ if (fRefPulserMasked) delete fRefPulserMasked;
if (fRefCETmean) delete fRefCETmean;
if (fRefCETrms) delete fRefCETrms;
if (fRefCEQmean) delete fRefCEQmean;
+ if (fRefCEMasked) delete fRefCEMasked;
+ if (fRefALTROFPED) delete fRefALTROFPED;
+ if (fRefALTROZsThr) delete fRefALTROZsThr;
+ if (fRefALTROAcqStart) delete fRefALTROAcqStart;
+ if (fRefALTROAcqStop) delete fRefALTROAcqStop;
if (fRefALTROMasked) delete fRefALTROMasked;
if (fRefCalibRaw) delete fRefCalibRaw;
-
+ if (fCurrentRefMap) delete fCurrentRefMap;
}
//_____________________________________________________________________________________
void AliTPCcalibDButil::UpdateFromCalibDB()
fALTROMasked=fCalibDB->GetALTROMasked();
fGoofieArray=fCalibDB->GetGoofieSensors(fCalibDB->GetRun());
fCalibRaw=fCalibDB->GetCalibRaw();
+ fDataQA=fCalibDB->GetDataQA();
UpdatePulserOutlierMap();
+ SetReferenceRun();
+ UpdateRefDataFromOCDB();
}
//_____________________________________________________________________________________
void AliTPCcalibDButil::ProcessCEdata(const char* fitFormula, TVectorD &fitResultsA, TVectorD &fitResultsC,
f.Close();
currDir->cd();
}
+//_____________________________________________________________________________________
+void AliTPCcalibDButil::UpdateRefDataFromOCDB()
+{
+ //
+ // set reference data from OCDB Reference map
+ //
+ if (!fRefMap) {
+ AliWarning("Referenc map not set!");
+ return;
+ }
+
+ TString cdbPath;
+ AliCDBEntry* entry = 0x0;
+ Bool_t hasAnyChanged=kFALSE;
+
+ //pedestals
+ cdbPath="TPC/Calib/Pedestals";
+ if (HasRefChanged(cdbPath.Data())){
+ hasAnyChanged=kTRUE;
+ //delete old entries
+ if (fRefPedestals) delete fRefPedestals;
+ if (fRefPedestalMasked) delete fRefPedestalMasked;
+ fRefPedestals=fRefPedestalMasked=0x0;
+ //get new entries
+ entry=GetRefEntry(cdbPath.Data());
+ if (entry){
+ entry->SetOwner(kTRUE);
+ fRefPedestals=GetRefCalPad(entry);
+ delete entry;
+ fRefPedestalMasked=GetAltroMasked(cdbPath, "MaskedPedestals");
+ }
+ }
+ //noise
+ cdbPath="TPC/Calib/PadNoise";
+ if (HasRefChanged(cdbPath.Data())){
+ hasAnyChanged=kTRUE;
+ //delete old entry
+ if (fRefPadNoise) delete fRefPadNoise;
+ fRefPadNoise=0x0;
+ //get new entry
+ entry=GetRefEntry(cdbPath.Data());
+ if (entry){
+ entry->SetOwner(kTRUE);
+ fRefPadNoise=GetRefCalPad(entry);
+ delete entry;
+ }
+ }
+
+ //pulser
+ cdbPath="TPC/Calib/Pulser";
+ if (HasRefChanged(cdbPath.Data())){
+ hasAnyChanged=kTRUE;
+ //delete old entries
+ if (fRefPulserTmean) delete fRefPulserTmean;
+ if (fRefPulserTrms) delete fRefPulserTrms;
+ if (fRefPulserQmean) delete fRefPulserQmean;
+ if (fRefPulserMasked) delete fRefPulserMasked;
+ fRefPulserTmean=fRefPulserTrms=fRefPulserQmean=fRefPulserMasked=0x0;
+ //get new entries
+ entry=GetRefEntry(cdbPath.Data());
+ if (entry){
+ entry->SetOwner(kTRUE);
+ fRefPulserTmean=GetRefCalPad(entry,"PulserTmean");
+ fRefPulserTrms=GetRefCalPad(entry,"PulserTrms");
+ fRefPulserQmean=GetRefCalPad(entry,"PulserQmean");
+ delete entry;
+ fRefPulserMasked=GetAltroMasked(cdbPath, "MaskedPulser");
+ }
+ }
+ //ce
+ cdbPath="TPC/Calib/CE";
+ if (HasRefChanged(cdbPath.Data())){
+ hasAnyChanged=kTRUE;
+ //delete old entries
+ if (fRefCETmean) delete fRefCETmean;
+ if (fRefCETrms) delete fRefCETrms;
+ if (fRefCEQmean) delete fRefCEQmean;
+ if (fRefCEMasked) delete fRefCEMasked;
+ fRefCETmean=fRefCETrms=fRefCEQmean=fRefCEMasked=0x0;
+ //get new entries
+ entry=GetRefEntry(cdbPath.Data());
+ if (entry){
+ entry->SetOwner(kTRUE);
+ fRefCETmean=GetRefCalPad(entry,"CETmean");
+ fRefCETrms=GetRefCalPad(entry,"CETrms");
+ fRefCEQmean=GetRefCalPad(entry,"CEQmean");
+ delete entry;
+ fRefCEMasked=GetAltroMasked(cdbPath, "MaskedCE");
+ }
+ }
+
+ //altro data
+ cdbPath="TPC/Calib/AltroConfig";
+ if (HasRefChanged(cdbPath.Data())){
+ hasAnyChanged=kTRUE;
+ //delete old entries
+ if (fRefALTROFPED) delete fRefALTROFPED;
+ if (fRefALTROZsThr) delete fRefALTROZsThr;
+ if (fRefALTROAcqStart) delete fRefALTROAcqStart;
+ if (fRefALTROAcqStop) delete fRefALTROAcqStop;
+ if (fRefALTROMasked) delete fRefALTROMasked;
+ fRefALTROFPED=fRefALTROZsThr=fRefALTROAcqStart=fRefALTROAcqStop=fRefALTROMasked=0x0;
+ //get new entries
+ entry=GetRefEntry(cdbPath.Data());
+ if (entry){
+ entry->SetOwner(kTRUE);
+ fRefALTROFPED=GetRefCalPad(entry,"FPED");
+ fRefALTROZsThr=GetRefCalPad(entry,"ZsThr");
+ fRefALTROAcqStart=GetRefCalPad(entry,"AcqStart");
+ fRefALTROAcqStop=GetRefCalPad(entry,"AcqStop");
+ fRefALTROMasked=GetRefCalPad(entry,"Masked");
+ delete entry;
+ }
+ }
+
+ //raw data
+ /*
+ cdbPath="TPC/Calib/Raw";
+ if (HasRefChanged(cdbPath.Data())){
+ hasAnyChanged=kTRUE;
+ //delete old entry
+ if (fRefCalibRaw) delete fRefCalibRaw;
+ //get new entry
+ entry=GetRefEntry(cdbPath.Data());
+ if (entry){
+ entry->SetOwner(kTRUE);
+ TObjArray *arr=(TObjArray*)entry->GetObject();
+ if (!arr){
+ AliError(Form("Could not get object from entry '%s'\nPlese check!!!",entry->GetId().GetPath().Data()));
+ } else {
+ fRefCalibRaw=(AliTPCCalibRaw*)arr->At(0)->Clone();
+ }
+ }
+ }
+ */
-
+ //data qa
+ cdbPath="TPC/Calib/QA";
+ if (HasRefChanged(cdbPath.Data())){
+ hasAnyChanged=kTRUE;
+ //delete old entry
+ if (fRefDataQA) delete fRefDataQA;
+ //get new entry
+ entry=GetRefEntry(cdbPath.Data());
+ if (entry){
+ entry->SetOwner(kTRUE);
+ fDataQA=dynamic_cast<AliTPCdataQA*>(entry->GetObject());
+ if (!fDataQA){
+ AliError(Form("Could not get object from entry '%s'\nPlese check!!!",entry->GetId().GetPath().Data()));
+ } else {
+ fRefDataQA=(AliTPCdataQA*)fDataQA->Clone();
+ }
+ delete entry;
+ }
+ }
+
+
+//update current reference maps
+ if (hasAnyChanged){
+ if (fCurrentRefMap) delete fCurrentRefMap;
+ fCurrentRefMap=(TMap*)fRefMap->Clone();
+ }
+}
+//_____________________________________________________________________________________
+AliTPCCalPad* AliTPCcalibDButil::GetRefCalPad(AliCDBEntry *entry, const char* objName)
+{
+ //
+ // TObjArray object type case
+ // find 'objName' in 'arr' cast is to a calPad and store it in 'pad'
+ //
+ AliTPCCalPad *pad=0x0;
+ TObjArray *arr=(TObjArray*)entry->GetObject();
+ if (!arr){
+ AliError(Form("Could not get object from entry '%s'\nPlese check!!!",entry->GetId().GetPath().Data()));
+ return pad;
+ }
+ pad=(AliTPCCalPad*)arr->FindObject(objName);
+ if (!pad) {
+ AliError(Form("Could not get '%s' from TObjArray in entry '%s'\nPlese check!!!",objName,entry->GetId().GetPath().Data()));
+ return pad;
+ }
+ return (AliTPCCalPad*)pad->Clone();
+}
+//_____________________________________________________________________________________
+AliTPCCalPad* AliTPCcalibDButil::GetRefCalPad(AliCDBEntry *entry)
+{
+ //
+ // AliTPCCalPad object type case
+ // cast object to a calPad and store it in 'pad'
+ //
+ AliTPCCalPad *pad=(AliTPCCalPad*)entry->GetObject();
+ if (!pad) {
+ AliError(Form("Could not get object from entry '%s'\nPlese check!!!",entry->GetId().GetPath().Data()));
+ return 0x0;
+ }
+ pad=(AliTPCCalPad*)pad->Clone();
+ return pad;
+}
+//_____________________________________________________________________________________
+AliTPCCalPad* AliTPCcalibDButil::GetAltroMasked(const char* cdbPath, const char* name)
+{
+ //
+ // set altro masked channel map for 'cdbPath'
+ //
+ AliTPCCalPad* pad=0x0;
+ const Int_t run=GetReferenceRun(cdbPath);
+ if (run<0) {
+ AliError(Form("Could not get reference run number for object '%s'\nPlese check availability!!!",cdbPath));
+ return pad;
+ }
+ AliCDBEntry *entry=AliCDBManager::Instance()->Get("TPC/Calib/AltroConfig", run);
+ if (!entry) {
+ AliError(Form("Could not get reference object '%s'\nPlese check availability!!!",cdbPath));
+ return pad;
+ }
+ pad=GetRefCalPad(entry,"Masked");
+ if (pad) pad->SetNameTitle(name,name);
+ entry->SetOwner(kTRUE);
+ delete entry;
+ return pad;
+}
+//_____________________________________________________________________________________
+void AliTPCcalibDButil::SetReferenceRun(Int_t run){
+ //
+ // Get Reference map
+ //
+ if (run<0) run=fCalibDB->GetRun();
+ TString cdbPath="TPC/Calib/Ref";
+ AliCDBEntry *entry=AliCDBManager::Instance()->Get(cdbPath.Data(), run);
+ if (!entry) {
+ AliError(Form("Could not get reference object '%s'\nPlese check availability!!!",cdbPath.Data()));
+ fRefMap=0;
+ return;
+ }
+ entry->SetOwner(kTRUE);
+ fRefMap=(TMap*)(entry->GetObject());
+ AliCDBId &id=entry->GetId();
+ fRefValidity.Form("%d_%d_v%d_s%d",id.GetFirstRun(),id.GetLastRun(),id.GetVersion(),id.GetSubVersion());
+}
+//_____________________________________________________________________________________
+Bool_t AliTPCcalibDButil::HasRefChanged(const char *cdbPath)
+{
+ //
+ // check whether a reference cdb entry has changed
+ //
+ if (!fCurrentRefMap) return kTRUE;
+ if (GetReferenceRun(cdbPath)!=GetCurrentReferenceRun(cdbPath)) return kTRUE;
+ return kFALSE;
+}
+//_____________________________________________________________________________________
+AliCDBEntry* AliTPCcalibDButil::GetRefEntry(const char* cdbPath)
+{
+ //
+ // get the reference AliCDBEntry for 'cdbPath'
+ //
+ const Int_t run=GetReferenceRun(cdbPath);
+ if (run<0) {
+ AliError(Form("Could not get reference run number for object '%s'\nPlese check availability!!!",cdbPath));
+ return 0;
+ }
+ AliCDBEntry *entry=AliCDBManager::Instance()->Get(cdbPath, run);
+ if (!entry) {
+ AliError(Form("Could not get reference object '%s'\nPlese check availability!!!",cdbPath));
+ return 0;
+ }
+ return entry;
+}
+//_____________________________________________________________________________________
+const Int_t AliTPCcalibDButil::GetCurrentReferenceRun(const char* type){
+ //
+ // Get reference run number for the specified OCDB path
+ //
+ if (!fCurrentRefMap) return -2;
+ TObjString *str=dynamic_cast<TObjString*>(fCurrentRefMap->GetValue(type));
+ if (!str) return -2;
+ return str->GetString().Atoi();
+}
+//_____________________________________________________________________________________
+const Int_t AliTPCcalibDButil::GetReferenceRun(const char* type) const{
+ //
+ // Get reference run number for the specified OCDB path
+ //
+ if (!fRefMap) return -1;
+ TObjString *str=dynamic_cast<TObjString*>(fRefMap->GetValue(type));
+ if (!str) return -1;
+ return str->GetString().Atoi();
+}
+//_____________________________________________________________________________________
AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPCCalPad *ceOut, Float_t minSignal, Float_t cutTrmsMin, Float_t cutTrmsMax, Float_t cutMaxDistT){
//
// Author: marian.ivanov@cern.ch
}
+const char* AliTPCcalibDButil::GetGUIRefTreeDefaultName()
+{
+ //
+ // Create a default name for the gui file
+ //
+
+ return Form("guiRefTreeRun%s.root",GetRefValidity());
+}
+
+Bool_t AliTPCcalibDButil::CreateGUIRefTree(const char* filename)
+{
+ //
+ // Create a gui reference tree
+ // if dirname and filename are empty default values will be used
+ // this is the recommended way of using this function
+ // it allows to check whether a file with the given run validity alredy exists
+ //
+ if (!AliCDBManager::Instance()->GetDefaultStorage()){
+ AliError("Default Storage not set. Cannot create reference calibration Tree!");
+ return kFALSE;
+ }
+
+ TString file=filename;
+ if (file.IsNull()) file=GetGUIRefTreeDefaultName();
+
+ AliTPCPreprocessorOnline prep;
+ //noise and pedestals
+ if (fRefPedestals) prep.AddComponent(new AliTPCCalPad(*(fRefPedestals)));
+ if (fRefPadNoise ) prep.AddComponent(new AliTPCCalPad(*(fRefPadNoise)));
+ if (fRefPedestalMasked) prep.AddComponent(new AliTPCCalPad(*fRefPedestalMasked));
+ //pulser data
+ if (fRefPulserTmean) prep.AddComponent(new AliTPCCalPad(*(fRefPulserTmean)));
+ if (fRefPulserTrms ) prep.AddComponent(new AliTPCCalPad(*(fRefPulserTrms)));
+ if (fRefPulserQmean) prep.AddComponent(new AliTPCCalPad(*(fRefPulserQmean)));
+ if (fRefPulserMasked) prep.AddComponent(new AliTPCCalPad(*fRefPulserMasked));
+ //CE data
+ if (fRefCETmean) prep.AddComponent(new AliTPCCalPad(*(fRefCETmean)));
+ if (fRefCETrms ) prep.AddComponent(new AliTPCCalPad(*(fRefCETrms)));
+ if (fRefCEQmean) prep.AddComponent(new AliTPCCalPad(*(fRefCEQmean)));
+ if (fRefCEMasked) prep.AddComponent(new AliTPCCalPad(*fRefCEMasked));
+ //Altro data
+ if (fRefALTROAcqStart ) prep.AddComponent(new AliTPCCalPad(*(fRefALTROAcqStart )));
+ if (fRefALTROZsThr ) prep.AddComponent(new AliTPCCalPad(*(fRefALTROZsThr )));
+ if (fRefALTROFPED ) prep.AddComponent(new AliTPCCalPad(*(fRefALTROFPED )));
+ if (fRefALTROAcqStop ) prep.AddComponent(new AliTPCCalPad(*(fRefALTROAcqStop )));
+ if (fRefALTROMasked ) prep.AddComponent(new AliTPCCalPad(*(fRefALTROMasked )));
+ //QA
+ AliTPCdataQA *dataQA=fRefDataQA;
+ if (dataQA) {
+ if (dataQA->GetNLocalMaxima())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNLocalMaxima())));
+ if (dataQA->GetMaxCharge())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMaxCharge())));
+ if (dataQA->GetMeanCharge())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMeanCharge())));
+ if (dataQA->GetNoThreshold())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNoThreshold())));
+ if (dataQA->GetNTimeBins())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNTimeBins())));
+ if (dataQA->GetNPads())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNPads())));
+ if (dataQA->GetTimePosition())
+ prep.AddComponent(new AliTPCCalPad(*(dataQA->GetTimePosition())));
+ }
+ prep.DumpToFile(file.Data());
+ return kTRUE;
+}
+
Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracks(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT, Int_t side){
//
// Get the correction of the drift velocity using the laser tracks calbration
}
-
-
-
-
#include <TObject.h>
#include <TArrayI.h>
+class TGraph;
+class TMap;
class AliDCSSensorArray;
class AliTPCcalibDB;
class AliTPCCalPad;
class AliTPCmapper;
class AliTPCCalibRaw;
-class TGraph;
+class AliCDBEntry;
+class AliTPCdataQA;
class TGraphErrors;
class TTreeSRedirector;
void ProcessPulser(TVectorD &vMeanTime);
void ProcessALTROConfig(Int_t &nMasked);
void ProcessGoofie(TVectorD & vecEntries, TVectorD & vecMedian, TVectorD &vecMean, TVectorD &vecRMS);
+
//processing functions using reference data
void ProcessPedestalVariations(TVectorF &pedestalDeviations);
void ProcessNoiseVariations(TVectorF &noiseDeviations);
void ProcessPulserVariations(TVectorF &pulserQdeviations, Float_t &varQMean, Int_t &npadsOutOneTB, Int_t &npadsOffAdd);
+
//getter preprocess information
Int_t GetNPulserOutliers() const {return fNpulserOutliers;}
Float_t GetMeanAltro(const AliTPCCalROC *roc, const Int_t row, const Int_t pad, AliTPCCalROC *rocOut=0x0);
AliTPCCalPad *GetPulserOutlierMap() const {return fPulserOutlier;}
+
+ //getters ref data
+ TMap *GetReferenceMap() const {return fRefMap;}
+ const Int_t GetReferenceRun(const char* type) const;
+ const char* GetRefValidity() const {return fRefValidity.Data();}
+
+ AliTPCCalPad* GetRefPadNoise() const {return fRefPadNoise;}
+ AliTPCCalPad* GetRefPedestals() const {return fRefPedestals;}
+ AliTPCCalPad* GetRefPedestalMasked() const {return fRefPedestalMasked;}
+ AliTPCCalPad* GetRefPulserTmean() const {return fRefPulserTmean;}
+ AliTPCCalPad* GetRefPulserTrms() const {return fRefPulserTrms;}
+ AliTPCCalPad* GetRefPulserQmean() const {return fRefPulserQmean;}
+ AliTPCCalPad* GetRefPulserOutlier() const {return fRefPulserOutlier;}
+ AliTPCCalPad* GetRefPulserMasked() const {return fRefPulserMasked;}
+ AliTPCCalPad* GetRefCETmean() const {return fRefCETmean;}
+ AliTPCCalPad* GetRefCETrms() const {return fRefCETrms;}
+ AliTPCCalPad* GetRefCEQmean() const {return fRefCEQmean;}
+ AliTPCCalPad* GetRefCEMasked() const {return fRefCEMasked;}
+ AliTPCCalPad* GetRefALTROFPED() const {return fRefALTROFPED;}
+ AliTPCCalPad* GetRefALTROZsThr() const {return fRefALTROZsThr;}
+ AliTPCCalPad* GetRefALTROAcqStart() const {return fRefALTROAcqStart;}
+ AliTPCCalPad* GetRefALTROAcqStop() const {return fRefALTROAcqStop;}
+ AliTPCCalPad* GetRefALTROMasked() const {return fRefALTROMasked;}
+
+
//setters for pad by pad information
void SetPulserData(AliTPCCalPad *tmean, AliTPCCalPad *trms=0x0, AliTPCCalPad *qmean=0x0)
{fPulserTmean=tmean; fPulserTrms=trms; fPulserQmean=qmean;}
void SetALTROData(AliTPCCalPad *masked)
{fALTROMasked=masked;}
void SetGoofieArray(AliDCSSensorArray *arr) {fGoofieArray=arr;}
+
//setters for pad by pad information
void SetRefFile(const char* filename);
+ void SetReferenceRun(Int_t run=-1);
+ void UpdateRefDataFromOCDB();
void SetRefPulserData(AliTPCCalPad *tmean, AliTPCCalPad *trms=0x0, AliTPCCalPad *qmean=0x0)
{fRefPulserTmean=tmean; fRefPulserTrms=trms; fRefPulserQmean=qmean;}
void SetRefCEData(AliTPCCalPad *tmean, AliTPCCalPad *trms=0x0, AliTPCCalPad *qmean=0x0)
void UpdateRefPulserOutlierMap();
void PulserOutlierMap(AliTPCCalPad *pulOut, const AliTPCCalPad *pulT, const AliTPCCalPad *pulQ);
+ const char* GetGUIRefTreeDefaultName();
+
+ Bool_t CreateGUIRefTree(const char* filename="");
//
// graph tools
//
AliTPCCalPad *fALTROMasked; //ALTRO masked channels information
//
AliTPCCalibRaw *fCalibRaw; //raw calibration object
+ //
+ AliTPCdataQA *fDataQA; //data qa
//reference data
+ TMap *fRefMap; // latest map to reference information
+ TMap *fCurrentRefMap; // reference data map of entries currently loaded
+ TString fRefValidity; // validity range of reference data
+ //
AliTPCCalPad *fRefPadNoise; //Reference noise information
AliTPCCalPad *fRefPedestals; //Reference pedestal information
+ AliTPCCalPad *fRefPedestalMasked; //Reference masked channels in pedestal run
AliTPCCalPad *fRefPulserTmean; //Reference pulser mean time information
AliTPCCalPad *fRefPulserTrms; //Reference pulser rms time information
AliTPCCalPad *fRefPulserQmean; //Reference pulser mean q information
AliTPCCalPad *fRefPulserOutlier; //Reference pulser outlier map
+ AliTPCCalPad *fRefPulserMasked; //Reference masked channels in pulser run
AliTPCCalPad *fRefCETmean; //Reference central electrode mean time information
AliTPCCalPad *fRefCETrms; //Reference central electrode rms time information
AliTPCCalPad *fRefCEQmean; //Reference central electrode mean q information
+ AliTPCCalPad *fRefCEMasked; //Reference masked channels in laser run
+ AliTPCCalPad *fRefALTROFPED; //Reference fixed pedestal value
+ AliTPCCalPad *fRefALTROZsThr; //Reference zero suppression threshol
+ AliTPCCalPad *fRefALTROAcqStart; //Reference accquistion start time bin
+ AliTPCCalPad *fRefALTROAcqStop; //Reference accquistion stop time bin
AliTPCCalPad *fRefALTROMasked; //Reference ALTRO masked channels information
//
AliTPCCalibRaw *fRefCalibRaw; //Reference raw calibration object
-
+ //
+ AliTPCdataQA *fRefDataQA; //Reference data QA
//
AliDCSSensorArray* fGoofieArray; //Goofie Data
//
AliTPCcalibDButil (const AliTPCcalibDButil& );
AliTPCcalibDButil& operator= (const AliTPCcalibDButil& );
-
+ AliTPCCalPad* GetRefCalPad(AliCDBEntry *entry, const char* objName);
+ AliTPCCalPad* GetRefCalPad(AliCDBEntry *entry);
+ AliTPCCalPad* GetAltroMasked(const char* cdbPath, const char* name);
+ Bool_t HasRefChanged(const char *cdbPath);
+ const Int_t GetCurrentReferenceRun(const char* type);
+ AliCDBEntry* GetRefEntry(const char* cdbPath);
+
ClassDef(AliTPCcalibDButil,0)
};
AliTPCCalibRawBase.cxx AliTPCCalibPedestal.cxx AliTPCCalibPulser.cxx AliTPCCalibCE.cxx \
AliTPCCalibRaw.cxx \
AliTPCPreprocessor.cxx AliTPCPreprocessorOnline.cxx \
- AliTPCCalibViewer.cxx AliTPCCalibViewerGUI.cxx AliTPCCalibViewerGUItime.cxx \
+ AliTPCCalibViewer.cxx AliTPCCalibViewerGUI.cxx AliTPCCalibViewerGUItime.cxx \
+ AliTPCCalibViewerGUIAlarms.cxx AliTPCCalibQAChecker.cxx \
AliTPCGenDBTemp.cxx AliTPCGenDBConf.cxx \
AliTPCExB.cxx AliTPCExBExact.cxx AliTPCExBFirst.cxx \
AliTPCTempMap.cxx AliTPCCalibVdrift.cxx \