Classes for QAChecker and Trending
authormbroz <Michal.Broz@cern.ch>
Wed, 17 Dec 2014 20:00:40 +0000 (21:00 +0100)
committermbroz <Michal.Broz@cern.ch>
Wed, 17 Dec 2014 20:00:40 +0000 (21:00 +0100)
AD/ADbase/CMakeLists.txt
AD/ADrec/ADrecLinkDef.h
AD/ADrec/AliADQAChecker.cxx [new file with mode: 0644]
AD/ADrec/AliADQAChecker.h [new file with mode: 0644]
AD/ADrec/AliADQADataMakerRec.cxx
AD/ADrec/AliADTrending.cxx [new file with mode: 0644]
AD/ADrec/AliADTrending.h [new file with mode: 0644]
AD/ADrec/CMakeLists.txt

index 9de193f..4c3a29f 100644 (file)
@@ -70,4 +70,4 @@ install(TARGETS ${MODULE}
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
 
-install(FILES ${HDRS} DESTINATION include)
\ No newline at end of file
+install(FILES ${HDRS} DESTINATION include)
index d2b8f9c..60a6723 100644 (file)
@@ -11,5 +11,7 @@
 #pragma link C++ class  AliADRecoParam+;
 #pragma link C++ class  AliADRawStream+;
 #pragma link C++ class  AliADQADataMakerRec+;
+#pragma link C++ class  AliADTrending+;
+#pragma link C++ class  AliADQAChecker+;
 
 #endif
diff --git a/AD/ADrec/AliADQAChecker.cxx b/AD/ADrec/AliADQAChecker.cxx
new file mode 100644 (file)
index 0000000..7afe345
--- /dev/null
@@ -0,0 +1,147 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+/*
+  Checks the quality assurance. Under construction. 
+  By comparing with reference data
+
+*/
+
+// --- ROOT system ---
+#include <TClass.h>
+#include <TH1F.h> 
+#include <TH1I.h> 
+#include <TIterator.h> 
+#include <TKey.h> 
+#include <TFile.h> 
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+#include "AliLog.h"
+#include "AliQAv1.h"
+#include "AliQAChecker.h"
+#include "AliADQAChecker.h"
+#include "AliADQADataMakerRec.h"
+
+ClassImp(AliADQAChecker)
+
+//__________________________________________________________________
+AliADQAChecker::AliADQAChecker() : AliQACheckerBase("AD","AD Quality Assurance Data Checker"),
+  fLowEventCut(1000),
+  fORvsANDCut(0.2),
+  fBGvsBBCut(0.2)
+{
+  // Default constructor
+  // Nothing else here
+}
+
+//__________________________________________________________________
+void AliADQAChecker::Check(Double_t * check, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
+{
+  // Main check function: Depending on the TASK, different checks will be applied
+  // Check for missing channels and check on the trigger type for raw data
+  // Check for missing disk or rings for esd (to be redone)
+
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+    check[specie] = 1.0;
+    // no check on cosmic or calibration events
+    if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic || AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib)
+      continue;
+    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
+      continue;
+    if (index == AliQAv1::kRAW) {
+      check[specie] =  CheckRaws(list[specie]);
+    } else if (index == AliQAv1::kESD) {
+      // Check for one disk missing (FATAL) or one ring missing (ERROR) in ESDs (to be redone)
+      check[specie] =  CheckEsds(list[specie]);
+    } 
+  }
+}
+
+//_________________________________________________________________
+Double_t AliADQAChecker::CheckRaws(TObjArray * list) const
+{
+
+  //  Check on the QA histograms on the raw-data input list:
+  //  Two things are checked: the presence of data in all channels and
+  //  the ratio between different trigger types
+
+  Double_t test = 1.0;
+  if (list->GetEntries() == 0){  
+    AliWarning("There are no histograms to be checked");
+  } 
+  return test ; 
+}  
+
+//_________________________________________________________________
+Double_t AliADQAChecker::CheckEsds(TObjArray * list) const
+{
+  
+//  check the ESDs for missing disk or ring
+//  printf(" Number of entries in ESD list = %d\n", list->GetEntries()); 
+//  list->Print();
+
+  Double_t test     = 1.0;     // initialisation to OK
+
+  return test ; 
+} 
+
+//______________________________________________________________________________
+void AliADQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) 
+{
+  // intialises QA and QA checker settings
+  AliQAv1::Instance(det) ; 
+  Float_t * hiValue = new Float_t[AliQAv1::kNBIT] ; 
+  Float_t * lowValue = new Float_t[AliQAv1::kNBIT] ;
+  lowValue[AliQAv1::kINFO]      = 0.5   ; 
+  hiValue[AliQAv1::kINFO]       = 1.0 ; 
+  lowValue[AliQAv1::kWARNING]   = 0.2 ; 
+  hiValue[AliQAv1::kWARNING]    = 0.5 ; 
+  lowValue[AliQAv1::kERROR]     = 0.0   ; 
+  hiValue[AliQAv1::kERROR]      = 0.2 ; 
+  lowValue[AliQAv1::kFATAL]     = -1.0   ; 
+  hiValue[AliQAv1::kFATAL]      = 0.0 ; 
+  SetHiLo(hiValue, lowValue) ; 
+  delete [] hiValue;
+  delete [] lowValue;
+}
+
+//______________________________________________________________________________
+void AliADQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
+{
+// sets the QA word according to return value of the Check
+  AliQAv1 * qa = AliQAv1::Instance(index);
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+    qa->UnSet(AliQAv1::kFATAL, specie);
+    qa->UnSet(AliQAv1::kWARNING, specie);
+    qa->UnSet(AliQAv1::kERROR, specie);
+    qa->UnSet(AliQAv1::kINFO, specie);
+    if ( ! value ) { // No checker is implemented, set all QA to Fatal
+      qa->Set(AliQAv1::kFATAL, specie) ; 
+    } else {
+      if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] ) 
+        qa->Set(AliQAv1::kFATAL, specie) ; 
+      else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR]  )
+        qa->Set(AliQAv1::kERROR, specie) ; 
+      else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING]  )
+        qa->Set(AliQAv1::kWARNING, specie) ;
+      else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] ) 
+        qa->Set(AliQAv1::kINFO, specie) ;      
+    }
+  }
+}
+  
diff --git a/AD/ADrec/AliADQAChecker.h b/AD/ADrec/AliADQAChecker.h
new file mode 100644 (file)
index 0000000..375c85a
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef ALIADQACHECKER_H
+#define ALIADQACHECKER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+/*
+  Checks the quality of the data
+  by comparing with reference data
+  which should be loaded from QA ref DB
+*/
+
+// --- ROOT system ---
+class TFile ; 
+class TH1F ; 
+class TH1I ; 
+class TObjArray ; 
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+#include "AliQACheckerBase.h"
+
+class AliADLoader ; 
+
+class AliADQAChecker: public AliQACheckerBase {
+
+public:
+  AliADQAChecker();
+  virtual ~AliADQAChecker() {;} // destructor
+  
+  virtual void   Init(const AliQAv1::DETECTORINDEX_t det);
+
+  void SetLowEventCut(Int_t nEvents) {fLowEventCut = nEvents;}
+  void SetORvsANDCut(Double_t cut) {fORvsANDCut = cut;}
+  void SetBGvsBBCut(Double_t cut) {fBGvsBBCut = cut;}
+
+protected:  
+  virtual void Check( Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * recoParam);
+  Double_t CheckRaws(TObjArray * list) const ;
+  Double_t CheckEsds(TObjArray * list) const;
+  
+  virtual void SetQA(AliQAv1::ALITASK_t index, Double_t * value) const ;
+  
+private:
+  AliADQAChecker(const AliADQAChecker& qac); // cpy ctor   
+  AliADQAChecker &operator=(const AliADQAChecker& qac); // assignment operator
+
+  Int_t    fLowEventCut; // Minimum number of events required by the QA checker
+  Double_t fORvsANDCut; // AD OR vs AD AND counters cut
+  Double_t fBGvsBBCut; // AD beam-gas vs beam-beam counters cut
+  
+  ClassDef(AliADQAChecker,1)  // description 
+
+};
+
+#endif // AliADQAChecker_H
index 1c13f9d..b406d7f 100644 (file)
@@ -46,7 +46,7 @@
 #include "AliADdigit.h"
 #include "AliADConst.h"
 #include "AliADReconstructor.h"
-//#include "AliADTrending.h"
+#include "AliADTrending.h"
 #include "AliADCalibData.h"
 #include "AliCTPTimeParams.h"
 #include "event.h"
@@ -355,7 +355,7 @@ void AliADQADataMakerRec::InitRaws()
 
   for(Int_t iInt=0;iInt<kNintegrator;iInt++){
        h2d = new TH2F(Form("H2D_ChargeVsClock_Int%d",iInt), Form("Charge Versus LHC-Clock (Int%d);Channel;LHCClock;Charge [ADC counts]",iInt),kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
-       Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
+       Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), !expert, image, saveCorr); iHisto++;
        }
   
   h2d = new TH2F("H2D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax,22,-0.5,21.5);
diff --git a/AD/ADrec/AliADTrending.cxx b/AD/ADrec/AliADTrending.cxx
new file mode 100644 (file)
index 0000000..82fa3a6
--- /dev/null
@@ -0,0 +1,147 @@
+/**************************************************************************
+ * 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 AliADTrending
+// ---------------------------
+// 
+//  class used in QA to publish variables evolution versus time in AMORE. 
+//  These histo are the one which will be looked at by QA Shifter
+// 
+#include "TGraph.h"
+#include "TMultiGraph.h"
+#include "TLegend.h"
+#include "TString.h"
+
+#include "AliLog.h"
+#include "AliADTrending.h"
+
+ClassImp(AliADTrending)
+
+//_____________________________________________________________________________
+AliADTrending::AliADTrending() : TH1(), fNEntries(0), fMultiGraphs(NULL)
+{
+       // Default constructor
+       for(int i=0; i<4;i++) fGraphs[i] = NULL;
+       for (int i = 0; i < kDataSize; i++) {
+               fTime[i] = 0;
+               for (int j = 0; j < 8; j++) {
+                 fData[j][i] = 0;
+               }
+       }
+}
+//_____________________________________________________________________________
+AliADTrending::AliADTrending(const char* name, const char* title) : TH1(), fNEntries(0), fMultiGraphs(NULL)
+{
+       SetName(name);
+       SetTitle(title);
+       for(int i=0; i<4;i++) fGraphs[i] = NULL;
+       for (int i = 0; i < kDataSize; i++) {
+               fTime[i] = 0;
+               for (int j = 0; j < 4; j++) {
+                 fData[j][i] = 0;
+               }
+       }
+}
+//_____________________________________________________________________________
+AliADTrending::AliADTrending(const AliADTrending &trend) : 
+       TH1(), fNEntries(trend.fNEntries), fMultiGraphs(NULL)
+{
+       // Copy constructor
+       for(int i=0; i<4;i++) fGraphs[i] = NULL;
+       SetName(trend.GetName());
+       SetTitle(trend.GetTitle());
+       for (int i = 0; i < kDataSize; i++) {
+               fTime[i] = trend.fTime[i];
+               for (int j = 0; j < 4; j++) {
+                       fData[j][i] = trend.fData[j][i];
+               }
+       }
+}
+
+//_____________________________________________________________________________
+AliADTrending::~AliADTrending(){
+  for (Int_t i=0; i<4; ++i) delete fGraphs[i];
+  delete fMultiGraphs;
+}
+// -----------------------------------------------------------------                   
+void AliADTrending::AddEntry(Double_t * data, UInt_t time)
+{
+
+       if(fNEntries<kDataSize){
+               for (int i = 0; i < 4; i++)
+               {
+                       fData[i][fNEntries] = data[i];
+                       fTime[fNEntries] = (double) time;
+               }
+               fNEntries++;    
+       }else{
+
+               for (int i = 0; i < kDataSize-1; i++){
+                       fTime[i] = fTime[i+1];
+                       for (int ich = 0; ich < 4; ich++){              
+                               fData[ich][i] = fData[ich][i+1];
+                       }       
+               }
+               for (int i = 0; i < 4; i++)
+               {
+                       fData[i][fNEntries-1] = data[i];
+                       fTime[fNEntries-1] = (double) time;
+               }
+               
+       }
+//     printf("sizeof UInt_t Double_t %d %d\n",sizeof(UInt_t),sizeof(Double_t));
+//     printf("Add Entry %d @ %f : %f %f %f %f %f %f %f %f \n",fNEntries,fTime[fNEntries-1], 
+//             data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
+}                      
+// -----------------------------------------------------------------                   
+void AliADTrending::PrintEntry(UInt_t entry)
+{
+
+       if(entry>=fNEntries){
+               AliError(Form("maximum entry is %d\n",fNEntries-1));
+       }else{
+               AliInfo(Form("Entry %d @ %f : %f %f %f %f %f %f %f %f \n",entry, fTime[entry],
+                       fData[0][entry],fData[1][entry],fData[2][entry],fData[3][entry],fData[4][entry],fData[5][entry],fData[6][entry],fData[7][entry]));
+
+       }
+}                      
+
+// -----------------------------------------------------------------                   
+void AliADTrending::Draw(Option_t *option){
+    TString opt = option;      
+       fMultiGraphs = new TMultiGraph();
+       fMultiGraphs->SetTitle(GetTitle());
+       
+       for(int i=0;i<4;i++) {
+               fGraphs[i] = new TGraph(GetNEntries(), GetTime(), GetChannel(i));
+               fGraphs[i]->SetLineWidth(2);
+               //fGraphs[i]->SetLineColor(i<4 ? i+1 : i -3);
+               //fGraphs[i]->SetLineStyle(i<4 ? 1 : 2);
+               fMultiGraphs->Add(fGraphs[i]);
+       }
+
+       fMultiGraphs->Draw("AL");
+       fMultiGraphs->GetXaxis()->SetTimeDisplay(1);
+       fMultiGraphs->GetXaxis()->SetNdivisions(505,kFALSE);
+       fMultiGraphs->Draw("AL");
+       TLegend * legend = new TLegend(0.7,0.65,0.86,0.88);
+       legend->AddEntry(fGraphs[0],"ADA - Layer0","l");
+       legend->AddEntry(fGraphs[1],"ADA - Layer1","l");
+       legend->AddEntry(fGraphs[2],"ADC - Layer0","l");
+       legend->AddEntry(fGraphs[3],"ADC - Layer1","l");
+
+       legend->Draw();
+}
diff --git a/AD/ADrec/AliADTrending.h b/AD/ADrec/AliADTrending.h
new file mode 100644 (file)
index 0000000..7c8df1b
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef ALIADTRENDING_H
+#define ALIADTRENDING_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * See cxx source for full Copyright notice                               
+ */
+
+
+// 
+// Class AliADTrending
+// ---------------------------
+// 
+//  class used in QA to publish variables evolution versus time in AMORE. 
+//  These histo are the one which will be looked at by QA Shifter
+// 
+
+
+#include <TH1.h>
+
+class TGraph;
+class TMultiGraph;
+
+class AliADTrending  : public TH1 {
+public:
+       AliADTrending();
+       AliADTrending(const char* name, const char* title);
+       virtual ~AliADTrending();
+       AliADTrending(const AliADTrending &trend);
+               
+       Double_t * GetTime(){return fTime;};
+       Double_t * GetChannel(Int_t i){return fData[i];};
+       Double_t  GetLastTime(){return fTime[fNEntries-1];};
+       Double_t  GetLastChannel(Int_t i){return fData[i][fNEntries];};
+       UInt_t GetNEntries(){return fNEntries;};
+       void AddEntry(Double_t * data, UInt_t time);
+       void PrintEntry(UInt_t entry);  
+       virtual void Draw(Option_t  *option="");
+
+private:
+       
+       AliADTrending& operator= (const AliADTrending & /*trend*/); // Not implemented
+       enum{kDataSize = 500};
+       Double_t fData[4][kDataSize];
+       Double_t fTime[kDataSize];
+       UInt_t fNEntries;
+       TMultiGraph *fMultiGraphs;
+       TGraph * fGraphs[4];
+       
+       ClassDef( AliADTrending, 2 )  
+       
+};
+
+#endif // ALIADTRENDING_H
+
index 2a62186..5908014 100644 (file)
@@ -37,6 +37,8 @@ set(SRCS
     AliADRecoParam.cxx
     AliADRawStream.cxx
     AliADQADataMakerRec.cxx
+    AliADTrending.cxx
+    AliADQAChecker.cxx
    )
 
 # Headers from sources
@@ -71,4 +73,4 @@ install(TARGETS ${MODULE}
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
 
-install(FILES ${HDRS} DESTINATION include)
\ No newline at end of file
+install(FILES ${HDRS} DESTINATION include)