Introduce smaller AliTRDCalDCSFEEv2 object (Frederick)
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Nov 2010 11:00:39 +0000 (11:00 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Nov 2010 11:00:39 +0000 (11:00 +0000)
16 files changed:
OCDB/TRD/Calib/DCSv2/Run0_999999999_v0_s0.root [new file with mode: 0644]
TRD/AliTRDCalibChamberStatus.cxx
TRD/AliTRDCalibChamberStatus.h
TRD/AliTRDCalibViewer.cxx
TRD/AliTRDPreprocessor.cxx
TRD/AliTRDPreprocessor.h
TRD/AliTRDSaxHandler.cxx
TRD/AliTRDSaxHandler.h
TRD/AliTRDcalibDB.cxx
TRD/CMakelibTRDbase.pkg
TRD/Cal/AliTRDCalDCSFEEv2.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalDCSFEEv2.h [new file with mode: 0644]
TRD/Macros/AliTRDcheckConfigv2.C [new file with mode: 0644]
TRD/Macros/DumpOCDBtoTreev2.C [new file with mode: 0644]
TRD/TRDbaseLinkDef.h
TRD/libTRDbase.pkg

diff --git a/OCDB/TRD/Calib/DCSv2/Run0_999999999_v0_s0.root b/OCDB/TRD/Calib/DCSv2/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..f8b2710
Binary files /dev/null and b/OCDB/TRD/Calib/DCSv2/Run0_999999999_v0_s0.root differ
index b77db40..08ccbf5 100644 (file)
@@ -17,7 +17,7 @@
 //                                                                        //
 // AliTRDCalibChamberStatus: to determine which half chambers are off     //
 // Produce a AliTRDCalChamberStatus calibration object                    //
-// Check with the AliTRDCalDCSFEE info                                    //
+// Check with the AliTRDCalDCSFEEv2 info                                  //
 //                                                                        //
 //                                                                        //
 // Authors:                                                               //
@@ -49,8 +49,8 @@
 #include "AliTRDSignalIndex.h"
 #include "AliTRDpadPlane.h"
 #include "./Cal/AliTRDCalChamberStatus.h"
-#include "./Cal/AliTRDCalDCS.h"
-#include "./Cal/AliTRDCalDCSFEE.h"
+#include "./Cal/AliTRDCalDCSv2.h"
+#include "./Cal/AliTRDCalDCSFEEv2.h"
 
 #include "AliTRDrawStream.h"
 
@@ -431,14 +431,14 @@ void AliTRDCalibChamberStatus::AnalyseHisto() /*FOLD00*/
 
 }
 //_____________________________________________________________________
-void AliTRDCalibChamberStatus::CheckEORStatus(AliTRDCalDCS *calDCS) /*FOLD00*/
+void AliTRDCalibChamberStatus::CheckEORStatus(AliTRDCalDCSv2 *calDCS) /*FOLD00*/
 {
   //
-  //  Correct the AliTRDCalChamberStatus according to the AliTRDCalDCS
+  //  Correct the AliTRDCalChamberStatus according to the AliTRDCalDCSv2
   //  Using globale state of the HalfChamberMerger (HCM)
   //
   for(Int_t det = 0; det < 540; det++) {
-    AliTRDCalDCSFEE* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
+    AliTRDCalDCSFEEv2* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
 
     if(!calDCSFEEEOR) continue;
     
@@ -603,7 +603,7 @@ TH2D* AliTRDCalibChamberStatus::PlotSparseI(Int_t sm,Int_t side)
 
 }
 //_____________________________________________________________________
-TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, Int_t sm, Int_t pl) /*FOLD00*/
+TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(AliTRDCalDCSv2 *calDCS, Int_t sm, Int_t pl) /*FOLD00*/
 {
   //
   //  Plot globale state of the HalfChamberMerger (HCM)
@@ -629,7 +629,7 @@ TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, I
   for (Int_t k = 0; k < nstack; k++){
     Int_t det = offsetsmpl+k*6;
     Int_t stac = AliTRDgeometry::GetStack(det);
-    AliTRDCalDCSFEE* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
+    AliTRDCalDCSFEEv2* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
     if(!calDCSFEEEOR) { continue;}
     for (Int_t icol=0; icol<ncols; icol++){
       Int_t nrows = 16;
@@ -682,7 +682,7 @@ TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, I
 
 }
 //_____________________________________________________________________________
-TCanvas* AliTRDCalibChamberStatus::PlotHistos2DSmEORStatus(AliTRDCalDCS *calDCS, Int_t sm, const Char_t *name)
+TCanvas* AliTRDCalibChamberStatus::PlotHistos2DSmEORStatus(AliTRDCalDCSv2 *calDCS, Int_t sm, const Char_t *name)
 {
   //
   // Make 2D graph
index 534f8eb..da8632a 100644 (file)
@@ -21,7 +21,7 @@ class AliRawReader;
 
 class AliTRDCalChamberStatus;
 class AliRawReader;
-class AliTRDCalDCS;
+class AliTRDCalDCSv2;
 
 
 struct eventHeaderStruct;
@@ -40,7 +40,7 @@ public:
     
   void Init();
   void AnalyseHisto();
-  void CheckEORStatus(AliTRDCalDCS *calDCS);
+  void CheckEORStatus(AliTRDCalDCSv2 *calDCS);
 
   void Add(AliTRDCalibChamberStatus *calibChamberStatus);
 
@@ -62,8 +62,8 @@ public:
 
   // Plot
   TH2D *PlotSparseI(Int_t sm, Int_t side);    // Plot fStatus for sm 
-  TH2F *MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, Int_t sm, Int_t pl);
-  TCanvas *PlotHistos2DSmEORStatus(AliTRDCalDCS *calDCS,Int_t sm, const Char_t *name);
+  TH2F *MakeHisto2DSmPlEORStatus(AliTRDCalDCSv2 *calDCS, Int_t sm, Int_t pl);
+  TCanvas *PlotHistos2DSmEORStatus(AliTRDCalDCSv2 *calDCS,Int_t sm, const Char_t *name);
 
   // Debug
   void     SetDebugLevel(Short_t level)  { fDebugLevel = level;   }
index c1eba0b..0ded89f 100644 (file)
@@ -57,8 +57,8 @@
 #include "AliTRDCalChamberStatus.h"
 #include "AliTRDCalSingleChamberStatus.h"
 #include "AliTRDCalPadStatus.h"
-#include "AliTRDCalDCS.h"
-#include "AliTRDCalDCSFEE.h"
+#include "AliTRDCalDCSv2.h"
+#include "AliTRDCalDCSFEEv2.h"
 #include "AliTRDcalibDB.h"
 #include "AliCDBManager.h"
 #include "AliCDBStorage.h"
@@ -920,17 +920,17 @@ Bool_t AliTRDCalibViewer::DumpOCDBtoTreeDetails(const Char_t* runListFilename,
     // DCS FEE information
     TObjArray *dcsArray = 0;
     if(getDCS) {
-      entry = manager->Get("TRD/Calib/DCS");
+      entry = manager->Get("TRD/Calib/DCSv2");
       if(entry) {
         entry->SetOwner(kTRUE);
         dcsArray = (TObjArray*)entry->GetObject();
       }
     }
-    AliTRDCalDCS *dcsSOR = 0;
-    AliTRDCalDCS *dcsEOR = 0;
+    AliTRDCalDCSv2 *dcsSOR = 0;
+    AliTRDCalDCSv2 *dcsEOR = 0;
     if(getDCS && dcsArray) {
-      dcsSOR = (AliTRDCalDCS*)dcsArray->At(0);
-      dcsEOR = (AliTRDCalDCS*)dcsArray->At(1);
+      dcsSOR = (AliTRDCalDCSv2*)dcsArray->At(0);
+      dcsEOR = (AliTRDCalDCSv2*)dcsArray->At(1);
     }
 
     // Alignment information
@@ -1042,8 +1042,8 @@ Bool_t AliTRDCalibViewer::DumpOCDBtoTreeDetails(const Char_t* runListFilename,
           }   // end if(getCalibs)
 
          // get the dcs information
-         AliTRDCalDCSFEE *dcsfeeSOR = 0;
-         AliTRDCalDCSFEE *dcsfeeEOR = 0;
+         AliTRDCalDCSFEEv2 *dcsfeeSOR = 0;
+         AliTRDCalDCSFEEv2 *dcsfeeEOR = 0;
           if(getDCS) {
            if(dcsSOR) dcsfeeSOR = dcsSOR->GetCalDCSFEEObj(chamberNo);
            if(dcsEOR) dcsfeeEOR = dcsEOR->GetCalDCSFEEObj(chamberNo);
index 8170ffe..5ce56f2 100644 (file)
@@ -55,7 +55,7 @@
 #include "AliTRDCalibChamberStatus.h"
 #include "Cal/AliTRDCalPad.h"
 #include "Cal/AliTRDCalPadStatus.h"
-#include "Cal/AliTRDCalDCS.h"
+#include "Cal/AliTRDCalDCSv2.h"
 #include "Cal/AliTRDCalSingleChamberStatus.h"
 #include "Cal/AliTRDCalChamberStatus.h"
 #include "Cal/AliTRDCalROC.h"
@@ -377,7 +377,7 @@ Bool_t AliTRDPreprocessor::ExtractHalfChamberStatusDAQ()
   if(calPed) {
     //calPed->AnalyseHisto();   // check number of events, create calHalfChamberStatus (done on DAQ)
     if(fCalDCSObjEOR) {
-      calPed->CheckEORStatus((AliTRDCalDCS *)fCalDCSObjEOR);
+      calPed->CheckEORStatus((AliTRDCalDCSv2 *)fCalDCSObjEOR);
     }
     calHalfChamberStatus=(AliTRDCalChamberStatus *)calPed->GetCalChamberStatus();
   }
@@ -1177,7 +1177,7 @@ UInt_t AliTRDPreprocessor::ProcessDCSConfigData()
   // get the calibration object storing the data from the handler
   if (fileExistS) {
     if(fCalDCSObjSOR) delete fCalDCSObjSOR;
-    fCalDCSObjSOR = (AliTRDCalDCS *) saxHandlerS.GetCalDCSObj()->Clone();
+    fCalDCSObjSOR = (AliTRDCalDCSv2 *) saxHandlerS.GetCalDCSObj()->Clone();
     fCalDCSObjSOR->EvaluateGlobalParameters();
     fCalDCSObjSOR->SetRunType(GetRunType());
     fCalDCSObjSOR->SetStartTime(GetStartTimeDCSQuery());
@@ -1188,7 +1188,7 @@ UInt_t AliTRDPreprocessor::ProcessDCSConfigData()
 
   if (fileExistE) {
     if(fCalDCSObjEOR) delete fCalDCSObjEOR;
-    fCalDCSObjEOR = (AliTRDCalDCS *) saxHandlerE.GetCalDCSObj()->Clone();
+    fCalDCSObjEOR = (AliTRDCalDCSv2 *) saxHandlerE.GetCalDCSObj()->Clone();
     fCalDCSObjEOR->EvaluateGlobalParameters();
     fCalDCSObjEOR->SetRunType(GetRunType());
     fCalDCSObjEOR->SetStartTime(GetStartTimeDCSQuery());
@@ -1204,8 +1204,8 @@ UInt_t AliTRDPreprocessor::ProcessDCSConfigData()
   AliCDBMetaData metaData1;
   metaData1.SetBeamPeriod(0);
   metaData1.SetResponsible("Frederick Kramer");
-  metaData1.SetComment("DCS configuration data in two AliTRDCalDCS objects in one TObjArray (0:SOR, 1:EOR).");
-  if (!Store("Calib", "DCS", calObjArray, &metaData1, 0, kTRUE)) {
+  metaData1.SetComment("DCS configuration data in two AliTRDCalDCSv2 objects in one TObjArray (0:SOR, 1:EOR).");
+  if (!Store("Calib", "DCSv2", calObjArray, &metaData1, 0, kTRUE)) {
     Log("problems while storing DCS config data object");
     return 16;
   } else {
index 1c51fe7..de3df32 100644 (file)
@@ -15,7 +15,7 @@
 #include "AliPreprocessor.h"
 
 class TMap;
-class AliTRDCalDCS;
+class AliTRDCalDCSv2;
 class AliTRDCalROC;
 class AliTRDCalSingleChamberStatus;
 
@@ -44,8 +44,8 @@ class AliTRDPreprocessor : public AliPreprocessor
 
  private:
          
-         AliTRDCalDCS* fCalDCSObjSOR;    // 
-         AliTRDCalDCS* fCalDCSObjEOR;    // 
+         AliTRDCalDCSv2* fCalDCSObjSOR;    // 
+         AliTRDCalDCSv2* fCalDCSObjEOR;    // 
 
          Bool_t  fVdriftHLT;             // HLT Vdrift
          UInt_t  ProcessDCSConfigData(); // process DCS configuration
@@ -56,7 +56,7 @@ class AliTRDPreprocessor : public AliPreprocessor
          void   SetDefaultNoise(AliTRDCalROC &calROCNoise, Bool_t second);
          void   SetNoise(AliTRDCalROC &calROCNoise, AliTRDCalROC *calROCNoisePrevious, Bool_t second);
 
-         ClassDef(AliTRDPreprocessor,1)          // The SHUTTLE preprocessor for TRD
+         ClassDef(AliTRDPreprocessor,2)          // The SHUTTLE preprocessor for TRD
 
 };
 #endif
index 38621eb..488ce8f 100644 (file)
@@ -36,8 +36,8 @@
 #include <TObjArray.h>\r
 #include "AliTRDSaxHandler.h"\r
 #include "AliTRDgeometry.h"\r
-#include "Cal/AliTRDCalDCS.h"\r
-#include "Cal/AliTRDCalDCSFEE.h"\r
+#include "Cal/AliTRDCalDCSv2.h"\r
+#include "Cal/AliTRDCalDCSFEEv2.h"\r
 #include "Cal/AliTRDCalDCSGTU.h"\r
 \r
 ClassImp(AliTRDSaxHandler)\r
@@ -61,7 +61,7 @@ AliTRDSaxHandler::AliTRDSaxHandler()
   ,fDCSFEEObj(0)\r
   ,fDCSPTRObj(0)\r
   ,fDCSGTUObj(0)\r
-  ,fCalDCSObj(new AliTRDCalDCS())\r
+  ,fCalDCSObj(new AliTRDCalDCSv2())\r
   ,fLevel1Tag(-2)\r
   ,fLevel2Tag(-2)\r
   ,fInsideBoardInfo(false)\r
@@ -138,7 +138,7 @@ AliTRDSaxHandler::~AliTRDSaxHandler()
 }\r
 \r
 //_____________________________________________________________________________\r
-AliTRDCalDCS* AliTRDSaxHandler::GetCalDCSObj()\r
+AliTRDCalDCSv2* AliTRDSaxHandler::GetCalDCSObj()\r
 {\r
   // put the arrays in the global calibration object and return this\r
   fCalDCSObj->SetFEEArr(fFEEArr);\r
@@ -324,7 +324,7 @@ void AliTRDSaxHandler::OnStartElement(const char *name, const TList *attributes)
   // if there is a new DCS element put it in the correct array\r
   if (CompareString(tagName, "DCS")) {\r
     if (fSystem == kInsideFEE) {\r
-      fDCSFEEObj = new AliTRDCalDCSFEE(name,dcsTitle);\r
+      fDCSFEEObj = new AliTRDCalDCSFEEv2();\r
       fDCSFEEObj->SetDCSid(dcsId);\r
     }\r
     if (fSystem == kInsidePTR) {\r
index a9653c2..deef062 100644 (file)
@@ -22,8 +22,8 @@
 #include "Cal/AliTRDCalDCSGTUTmu.h" 
 
 class TObjArray;
-class AliTRDCalDCS;
-class AliTRDCalDCSFEE;
+class AliTRDCalDCSv2;
+class AliTRDCalDCSFEEv2;
 class AliTRDCalDCSPTR;
 class AliTRDCalDCSGTU;
 
@@ -52,57 +52,56 @@ public:
   virtual ~AliTRDSaxHandler();
   AliTRDSaxHandler &operator=(const AliTRDSaxHandler &sh);
 
-  TObjArray*    GetDCSFEEDataArray() const { return fFEEArr;        }
-  TObjArray*    GetDCSPTRDataArray() const { return fPTRArr;        }
-  AliTRDCalDCS* GetCalDCSObj(); // to be called by the preprocessor
+  TObjArray*         GetDCSFEEDataArray() const { return fFEEArr;        }
+  TObjArray*         GetDCSPTRDataArray() const { return fPTRArr;        }
+  AliTRDCalDCSv2*    GetCalDCSObj(); // to be called by the preprocessor
 
-  Int_t         GetHandlerStatus() const { return fHandlerStatus; }
+  Int_t              GetHandlerStatus() const { return fHandlerStatus; }
 
   // functions for all possible events
-  void          OnStartDocument() const;
-  void          OnEndDocument() const;
-  void          OnStartElement(const char *name, const TList *attributes);
-  void          OnEndElement(const char *name);
-  void          OnCharacters(const char *name);
-  void          OnComment(const char *name) const;
-  void          OnWarning(const char *name);
-  void          OnError(const char *name);
-  void          OnFatalError(const char *name);
-  void          OnCdataBlock(const char *name, Int_t len) const;
+  void               OnStartDocument() const;
+  void               OnEndDocument() const;
+  void               OnStartElement(const char *name, const TList *attributes);
+  void               OnEndElement(const char *name);
+  void               OnCharacters(const char *name);
+  void               OnComment(const char *name) const;
+  void               OnWarning(const char *name);
+  void               OnError(const char *name);
+  void               OnFatalError(const char *name);
+  void               OnCdataBlock(const char *name, Int_t len) const;
 
  private:
 
-  bool           CompareString(TString str, const char *str2); 
-
-  Int_t            fHandlerStatus;      // 0: everything OK, >0: error
-  Int_t            fNDCSPTR;            // number of current PTR unit (to be abandonned soon)
-  Int_t            fNDCSGTU;            // number of current GTU unit (to be abandonned soon)
-  TObjArray*       fFEEArr;             // array of AliTRDCalDCSFEE objects
-  TObjArray*       fPTRArr;             // array of AliTRDCalDCSPTR objects
-//   TObjArray*       fGTUArr;        // array of AliTRDCalDCSGTU objects
-  Int_t            fSystem;             // current system (FEE/PTR/GTU) (while parsing)
-  Int_t            fInsideRstate;       // if we are inside rstate (while parsing)
-  Int_t            fCurrentSM;          // current supermodule (while parsing)
-  Int_t            fCurrentStack;       // current stack (while parsing)
-  Int_t            fCurrentROB;         // current ROB (while parsing)
-  Int_t            fCurrentMCM;         // current MCM (while parsing)
-  Int_t            fCurrentADC;         // current ADC (while parsing)
-  TString          fContent;            // content of the xml element (text)
-  AliTRDCalDCSFEE* fDCSFEEObj;          // the calib object for one FEE DCS board
-  AliTRDCalDCSPTR* fDCSPTRObj;          // the calib object for one PTR DCS board
-  AliTRDCalDCSGTU* fDCSGTUObj;          // the calib object for one GTU DCS board
-  AliTRDCalDCS*    fCalDCSObj;          // the complete calib obj containing all info
-  Int_t            fLevel1Tag;          // 1st level in XML (while parsing)
-  Int_t            fLevel2Tag;          // 2nd level in XML (while parsing)
-  Bool_t           fInsideBoardInfo;    // if we are inside BoardInfo (while parsing)
+  bool               CompareString(TString str, const char *str2); 
+
+  Int_t              fHandlerStatus;      // 0: everything OK, >0: error
+  Int_t              fNDCSPTR;            // number of current PTR unit (to be abandonned soon)
+  Int_t              fNDCSGTU;            // number of current GTU unit (to be abandonned soon)
+  TObjArray*         fFEEArr;             // array of AliTRDCalDCSFEEv2 objects
+  TObjArray*         fPTRArr;             // array of AliTRDCalDCSPTR objects
+  //   TObjArray*       fGTUArr;        // array of AliTRDCalDCSGTU objects
+  Int_t              fSystem;             // current system (FEE/PTR/GTU) (while parsing)
+  Int_t              fInsideRstate;       // if we are inside rstate (while parsing)
+  Int_t              fCurrentSM;          // current supermodule (while parsing)
+  Int_t              fCurrentStack;       // current stack (while parsing)
+  Int_t              fCurrentROB;         // current ROB (while parsing)
+  Int_t              fCurrentMCM;         // current MCM (while parsing)
+  Int_t              fCurrentADC;         // current ADC (while parsing)
+  TString            fContent;            // content of the xml element (text)
+  AliTRDCalDCSFEEv2* fDCSFEEObj;          // the calib object for one FEE DCS board
+  AliTRDCalDCSPTR*   fDCSPTRObj;          // the calib object for one PTR DCS board
+  AliTRDCalDCSGTU*   fDCSGTUObj;          // the calib object for one GTU DCS board
+  AliTRDCalDCSv2*    fCalDCSObj;          // the complete calib obj containing all info
+  Int_t              fLevel1Tag;          // 1st level in XML (while parsing)
+  Int_t              fLevel2Tag;          // 2nd level in XML (while parsing)
+  Bool_t             fInsideBoardInfo;    // if we are inside BoardInfo (while parsing)
 
   AliTRDCalDCSGTUTmu*       fTmu;       // GTU calibration data: pattern generator
   AliTRDCalDCSGTUCtpOpc*    fCtpOpc;    // GTU calibration data: OPC
   AliTRDCalDCSGTUSegment*   fSegment;   // GTU calibration data: SMU tracklets/tracks/triggers
   AliTRDCalDCSGTUBoardInfo* fBoardInfo; // GTU calibration data: hard-/software and type
-  
 
-  ClassDef(AliTRDSaxHandler,2);         // The XML file handler for the preprocessor
+  ClassDef(AliTRDSaxHandler,3);         // The XML file handler for the preprocessor
 };
 #endif
 
index 2cfdea2..220d688 100644 (file)
@@ -41,6 +41,7 @@
 #include "Cal/AliTRDCalPad.h"
 #include "Cal/AliTRDCalDet.h"
 #include "Cal/AliTRDCalDCS.h"
+#include "Cal/AliTRDCalDCSv2.h"
 #include "Cal/AliTRDCalPID.h"
 #include "Cal/AliTRDCalMonitoring.h"
 #include "Cal/AliTRDCalChamberStatus.h"
@@ -248,7 +249,10 @@ const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
       return CacheCDBEntry(kIDFEE               ,"TRD/Calib/FEE"); 
       break;
     case kIDDCS :
-      return CacheCDBEntry(kIDDCS               ,"TRD/Calib/DCS");
+      if (GetCDBEntry("TRD/Calib/DCSv2"))
+       return CacheCDBEntry(kIDDCS             ,"TRD/Calib/DCSv2");
+      else
+       return CacheCDBEntry(kIDDCS             ,"TRD/Calib/DCS");
       break;
     case kIDPIDNN : 
       return CacheCDBEntry(kIDPIDNN             ,"TRD/Calib/PIDNN");
@@ -756,23 +760,45 @@ Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
     return nUndef;
   }
 
-  const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0));
-  const AliTRDCalDCS *calDCSeor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1));
+  if (GetCDBEntry("TRD/Calib/DCSv2")) {
+    // if there is a DCSv2 object
+    const AliTRDCalDCSv2 *calDCSsorv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(0));
+    const AliTRDCalDCSv2 *calDCSeorv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(1));
 
-  if (!calDCSsor) {
-    // the SOR file is mandatory
-    AliError("NO SOR AliTRDCalDCS object found in CDB file!");
-    return nUndef;
+    if (!calDCSsorv2) {
+      // the SOR file is mandatory
+      AliError("NO SOR AliTRDCalDCSv2 object found in CDB file!");
+      return nUndef;
+    }
+
+    if (!calDCSeorv2) {
+      // this can happen if the run is shorter than a couple of seconds.
+      AliWarning("NO EOR AliTRDCalDCSv2 object found in CDB file.");
     }
 
-  if (!calDCSeor) {
-    // this can happen if the run is shorter than a couple of seconds.
-    AliWarning("NO EOR AliTRDCalDCS object found in CDB file.");
+    // get the numbers
+    nTbSor = calDCSsorv2->GetGlobalNumberOfTimeBins();
+    if (calDCSeorv2) nTbEor = calDCSeorv2->GetGlobalNumberOfTimeBins();
+  } else {
+    // if there is a DCS object
+    const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0));
+    const AliTRDCalDCS *calDCSeor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1));
+
+    if (!calDCSsor) {
+      // the SOR file is mandatory
+      AliError("NO SOR AliTRDCalDCS object found in CDB file!");
+      return nUndef;
     }
 
-  // get the numbers
-  nTbSor = calDCSsor->GetGlobalNumberOfTimeBins();
-  if (calDCSeor) nTbEor = calDCSeor->GetGlobalNumberOfTimeBins();
+    if (!calDCSeor) {
+      // this can happen if the run is shorter than a couple of seconds.
+      AliWarning("NO EOR AliTRDCalDCS object found in CDB file.");
+    }
+
+    // get the numbers
+    nTbSor = calDCSsor->GetGlobalNumberOfTimeBins();
+    if (calDCSeor) nTbEor = calDCSeor->GetGlobalNumberOfTimeBins();
+  }
 
   // if they're the same return the value
   // -2 means mixed, -1: no data, >= 0: good number of time bins
@@ -804,13 +830,23 @@ void AliTRDcalibDB::GetFilterType(TString &filterType)
     filterType = "";
     return;
   }
-  const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
-  
-  if(!calDCS){
-    filterType = "";
-    return;
-  } 
-  filterType = calDCS->GetGlobalFilterType();
+  if (GetCDBEntry("TRD/Calib/DCSv2")) {
+    const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(0)); // Take SOR
+
+    if(!calDCSv2){
+      filterType = "";
+      return;
+    } 
+    filterType = calDCSv2->GetGlobalFilterType();
+  } else {
+    const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0)); // Take SOR
+
+    if(!calDCS){
+      filterType = "";
+      return;
+    } 
+    filterType = calDCS->GetGlobalFilterType();
+  }
 }
 
 //_____________________________________________________________________________
@@ -823,13 +859,24 @@ void AliTRDcalibDB::GetGlobalConfiguration(TString &config){
     config = "";
     return;
   }
-  const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
-  
-  if(!calDCS){
-    config = "";
-    return;
-  } 
-  config = calDCS->GetGlobalConfigName();
+
+  if (GetCDBEntry("TRD/Calib/DCSv2")) {
+    const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(0)); // Take SOR
+
+    if(!calDCSv2){
+      config = "";
+      return;
+    } 
+    config = calDCSv2->GetGlobalConfigName();
+  } else {
+    const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0)); // Take SOR
+
+    if(!calDCS){
+      config = "";
+      return;
+    } 
+    config = calDCS->GetGlobalConfigName();
+  }
 }
 
 //_____________________________________________________________________________
index 55c5ce4..472933e 100644 (file)
@@ -25,7 +25,7 @@
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS  AliTRDarraySignal.cxx AliTRDarrayDictionary.cxx AliTRDarrayADC.cxx AliTRDSignalIndex.cxx AliTRDgeometry.cxx AliTRDdigit.cxx AliTRDdigitsManager.cxx AliTRDdigitsParam.cxx AliTRDrawData.cxx AliTRDpadPlane.cxx AliTRDrawStreamOld.cxx AliTRDrawStreamBase.cxx AliTRDrawStream.cxx AliTRDCommonParam.cxx AliTRDfeeParam.cxx AliTRDgtuParam.cxx AliTRDcalibDB.cxx Cal/AliTRDCalROC.cxx Cal/AliTRDCalPad.cxx Cal/AliTRDCalDet.cxx Cal/AliTRDCalDCS.cxx Cal/AliTRDCalDCSFEE.cxx Cal/AliTRDCalDCSPTR.cxx Cal/AliTRDCalDCSGTUBoardInfo.cxx Cal/AliTRDCalDCSGTUCtpOpc.cxx Cal/AliTRDCalDCSGTUSegment.cxx Cal/AliTRDCalDCSGTUTgu.cxx Cal/AliTRDCalDCSGTUTmu.cxx Cal/AliTRDCalDCSGTU.cxx Cal/AliTRDCalMonitoring.cxx Cal/AliTRDCalChamberStatus.cxx Cal/AliTRDCalPadStatus.cxx Cal/AliTRDCalSingleChamberStatus.cxx Cal/AliTRDCalPID.cxx AliTRDCalibraFit.cxx AliTRDCalibraMode.cxx AliTRDCalibraVector.cxx AliTRDCalibraVdriftLinearFit.cxx AliTRDCalibPadStatus.cxx AliTRDCalibChamberStatus.cxx AliTRDCalibViewer.cxx AliTRDCalibViewerGUI.cxx AliTRDEntriesInfo.cxx AliTRDPhInfo.cxx AliTRDPrfInfo.cxx AliTRDUshortInfo.cxx AliTRDQAChecker.cxx AliTRDPreprocessor.cxx AliTRDSaxHandler.cxx AliTRDDataDCS.cxx AliTRDSensor.cxx AliTRDSensorArray.cxx AliTRDalignment.cxx AliTRDtrapConfig.cxx AliTRDmcmSim.cxx AliTRDtrapConfigHandler.cxx AliTRDtrackGTU.cxx AliTRDtrackletBase.cxx AliTRDtrackletGTU.cxx AliTRDtrackletMCM.cxx AliTRDtrackletWord.cxx AliTRDgtuSim.cxx AliTRDgtuTMU.cxx AliTRDhit.cxx AliTRDrecoParam.cxx AliTRDSimParam.cxx)
+set ( SRCS  AliTRDarraySignal.cxx AliTRDarrayDictionary.cxx AliTRDarrayADC.cxx AliTRDSignalIndex.cxx AliTRDgeometry.cxx AliTRDdigit.cxx AliTRDdigitsManager.cxx AliTRDdigitsParam.cxx AliTRDrawData.cxx AliTRDpadPlane.cxx AliTRDrawStreamOld.cxx AliTRDrawStreamBase.cxx AliTRDrawStream.cxx AliTRDCommonParam.cxx AliTRDfeeParam.cxx AliTRDgtuParam.cxx AliTRDcalibDB.cxx Cal/AliTRDCalROC.cxx Cal/AliTRDCalPad.cxx Cal/AliTRDCalDet.cxx Cal/AliTRDCalDCS.cxx Cal/AliTRDCalDCSFEE.cxx Cal/AliTRDCalDCSv2.cxx Cal/AliTRDCalDCSFEEv2.cxx Cal/AliTRDCalDCSPTR.cxx Cal/AliTRDCalDCSGTUBoardInfo.cxx Cal/AliTRDCalDCSGTUCtpOpc.cxx Cal/AliTRDCalDCSGTUSegment.cxx Cal/AliTRDCalDCSGTUTgu.cxx Cal/AliTRDCalDCSGTUTmu.cxx Cal/AliTRDCalDCSGTU.cxx Cal/AliTRDCalMonitoring.cxx Cal/AliTRDCalChamberStatus.cxx Cal/AliTRDCalPadStatus.cxx Cal/AliTRDCalSingleChamberStatus.cxx Cal/AliTRDCalPID.cxx AliTRDCalibraFit.cxx AliTRDCalibraMode.cxx AliTRDCalibraVector.cxx AliTRDCalibraVdriftLinearFit.cxx AliTRDCalibPadStatus.cxx AliTRDCalibChamberStatus.cxx AliTRDCalibViewer.cxx AliTRDCalibViewerGUI.cxx AliTRDEntriesInfo.cxx AliTRDPhInfo.cxx AliTRDPrfInfo.cxx AliTRDUshortInfo.cxx AliTRDQAChecker.cxx AliTRDPreprocessor.cxx AliTRDSaxHandler.cxx AliTRDDataDCS.cxx AliTRDSensor.cxx AliTRDSensorArray.cxx AliTRDalignment.cxx AliTRDtrapConfig.cxx AliTRDmcmSim.cxx AliTRDtrapConfigHandler.cxx AliTRDtrackGTU.cxx AliTRDtrackletBase.cxx AliTRDtrackletGTU.cxx AliTRDtrackletMCM.cxx AliTRDtrackletWord.cxx AliTRDgtuSim.cxx AliTRDgtuTMU.cxx AliTRDhit.cxx AliTRDrecoParam.cxx AliTRDSimParam.cxx)
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
diff --git a/TRD/Cal/AliTRDCalDCSFEEv2.cxx b/TRD/Cal/AliTRDCalDCSFEEv2.cxx
new file mode 100644 (file)
index 0000000..2416718
--- /dev/null
@@ -0,0 +1,147 @@
+/**************************************************************************\r
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+ *                                                                        *\r
+ * Author: The ALICE Off-line Project.                                    *\r
+ * Contributors are mentioned in the code where appropriate.              *\r
+ *                                                                        *\r
+ * Permission to use, copy, modify and distribute this software and its   *\r
+ * documentation strictly for non-commercial purposes is hereby granted   *\r
+ * without fee, provided that the above copyright notice appears in all   *\r
+ * copies and that both the copyright notice and this permission notice   *\r
+ * appear in the supporting documentation. The authors make no claims     *\r
+ * about the suitability of this software for any purpose. It is          *\r
+ * provided "as is" without express or implied warranty.                  *\r
+ **************************************************************************/\r
+\r
+/* $Id: AliTRDCalDCSFEEv2.cxx 18952 2007-06-08 11:36:12Z cblume $ */\r
+\r
+///////////////////////////////////////////////////////////////////////////////\r
+//                                                                           //\r
+//  TRD calibration class for TRD DCS FEE configuration parameters           //\r
+//                                                                           //\r
+///////////////////////////////////////////////////////////////////////////////\r
+\r
+// fStatusBit:\r
+// 0: no errors for that ROC\r
+// 1: ROC sent invalid or corrupted data. \r
+// 2: ROC was not in state CONFIGURED or STANDBY_INIT (most probably it was in STANDBY)\r
+// 3: No new data received from that ROC.\r
+// 4: DCS id from XML attributes <DCS> and <ack> and the one calculated from SM, S, L do not match\r
+// 5: ROC has not responded at all, most probably it was off.\r
+\r
+#include "AliTRDCalDCSFEEv2.h"\r
+\r
+ClassImp(AliTRDCalDCSFEEv2)\r
+  \r
+//_____________________________________________________________________________\r
+AliTRDCalDCSFEEv2::AliTRDCalDCSFEEv2()\r
+  :TObject()\r
+  ,fStatusBit(0)\r
+  ,fSM(-1)\r
+  ,fStack(-1)\r
+  ,fLayer(-1)\r
+  ,fGainTableRocSerial(0)\r
+  ,fDCSID(-1)\r
+  ,fNumberOfTimeBins(-1)\r
+  ,fConfigTag(-1)\r
+  ,fSingleHitThres(-1)\r
+  ,fThrPdClsThres(-1)\r
+  ,fSelNoZS(-1)\r
+  ,fTCFilterWeight(-1)\r
+  ,fTCFilterShortDecPar(-1)\r
+  ,fTCFilterLongDecPar(-1)\r
+  ,fFastStatNoise(-1)\r
+  ,fGainTableRocType("")\r
+  ,fFilterType("")\r
+  ,fReadoutParam("")\r
+  ,fTestPattern("")\r
+  ,fTrackletMode("")\r
+  ,fTrackletDef("")\r
+  ,fTriggerSetup("")\r
+  ,fAddOptions("") \r
+  ,fConfigName("")\r
+  ,fConfigVersion("")\r
+  ,fGainTableName("")\r
+  ,fGainTableDesc("")\r
+{\r
+  //\r
+  // AliTRDCalDCSFEEv2 default constructor\r
+  //\r
+  for(Int_t i=0; i<(Int_t)fgkROB; i++) {\r
+    for(Int_t j=0; j<(Int_t)fgkMCM; j++) {\r
+      fRStateGSM[i][j]  = -1;\r
+      fRStateNI[i][j]   = -1;\r
+      fRStateEV[i][j]   = -1;\r
+      fRStatePTRG[i][j] = -1;\r
+      fGainTableAdcdac[i][j] = -1;\r
+      for(Int_t k=0; k<(Int_t)fgkADC; k++) {\r
+       fGainTableFgfn[i][j][k] = -1;\r
+       fGainTableFgan[i][j][k] = -1;\r
+      }\r
+    }\r
+  }\r
+}\r
+\r
+\r
+//_____________________________________________________________________________\r
+AliTRDCalDCSFEEv2::AliTRDCalDCSFEEv2(const AliTRDCalDCSFEEv2 &c)\r
+  :TObject(c)\r
+  ,fStatusBit(c.fStatusBit)\r
+  ,fSM(c.fSM)\r
+  ,fStack(c.fStack)\r
+  ,fLayer(c.fLayer)\r
+  ,fGainTableRocSerial(c.fGainTableRocSerial)\r
+  ,fDCSID(c.fDCSID)\r
+  ,fNumberOfTimeBins(c.fNumberOfTimeBins)\r
+  ,fConfigTag(c.fConfigTag)\r
+  ,fSingleHitThres(c.fSingleHitThres)\r
+  ,fThrPdClsThres(c.fThrPdClsThres)\r
+  ,fSelNoZS(c.fSelNoZS)\r
+  ,fTCFilterWeight(c.fTCFilterWeight)\r
+  ,fTCFilterShortDecPar(c.fTCFilterShortDecPar)\r
+  ,fTCFilterLongDecPar(c.fTCFilterLongDecPar)\r
+  ,fFastStatNoise(c.fFastStatNoise)\r
+  ,fGainTableRocType(c.fGainTableRocType)\r
+  ,fFilterType(c.fFilterType)\r
+  ,fReadoutParam(c.fReadoutParam)\r
+  ,fTestPattern(c.fTestPattern)\r
+  ,fTrackletMode(c.fTrackletMode)\r
+  ,fTrackletDef(c.fTrackletDef)\r
+  ,fTriggerSetup(c.fTriggerSetup)\r
+  ,fAddOptions(c.fAddOptions) \r
+  ,fConfigName(c.fConfigName)\r
+  ,fConfigVersion(c.fConfigVersion)\r
+  ,fGainTableName(c.fGainTableName)\r
+  ,fGainTableDesc(c.fGainTableDesc)\r
+{\r
+  //\r
+  // AliTRDCalDCSFEEv2 copy constructor\r
+  //\r
+  for(Int_t i=0; i<(Int_t)fgkROB; i++) {\r
+    for(Int_t j=0; j<(Int_t)fgkMCM; j++) {\r
+      fRStateGSM[i][j]  = c.fRStateGSM[i][j];\r
+      fRStateNI[i][j]   = c.fRStateNI[i][j];\r
+      fRStateEV[i][j]   = c.fRStateEV[i][j];\r
+      fRStatePTRG[i][j] = c.fRStatePTRG[i][j];\r
+      fGainTableAdcdac[i][j] = c.fGainTableAdcdac[i][j];\r
+      for(Int_t k=0; k<(Int_t)fgkADC; k++) {\r
+       fGainTableFgfn[i][j][k] = c.fGainTableFgfn[i][j][k];\r
+       fGainTableFgan[i][j][k] = c.fGainTableFgan[i][j][k];\r
+      }\r
+    }\r
+  }\r
+}\r
+\r
+\r
+//_____________________________________________________________________________\r
+AliTRDCalDCSFEEv2 &AliTRDCalDCSFEEv2::operator=(const AliTRDCalDCSFEEv2 &c)\r
+{\r
+  //\r
+  // Assignment operator\r
+  //\r
+  if (&c == this) return *this;\r
+\r
+  new (this) AliTRDCalDCSFEEv2(c);\r
+  return *this;\r
+}\r
+\r
diff --git a/TRD/Cal/AliTRDCalDCSFEEv2.h b/TRD/Cal/AliTRDCalDCSFEEv2.h
new file mode 100644 (file)
index 0000000..883d4e2
--- /dev/null
@@ -0,0 +1,141 @@
+#ifndef ALITRDCALDCSFEEV2_H\r
+#define ALITRDCALDCSFEEV2_H\r
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/* $Id: AliTRDCalDCSFEEv2.h 18952 2007-06-08 11:36:12Z cblume $ */\r
+\r
+///////////////////////////////////////////////////////////////////////////////\r
+//                                                                           //\r
+//  TRD calibration class for FEE configuration parameters                   //\r
+//                                                                           //\r
+///////////////////////////////////////////////////////////////////////////////\r
+\r
+#include "TObject.h"\r
+#include "TString.h"\r
+\r
+//class TString;\r
+\r
+class AliTRDCalDCSFEEv2 : public TObject {\r
+\r
+ public:\r
+\r
+  AliTRDCalDCSFEEv2();\r
+  AliTRDCalDCSFEEv2(const AliTRDCalDCSFEEv2 &c);\r
+  virtual ~AliTRDCalDCSFEEv2() { };\r
+  AliTRDCalDCSFEEv2 &operator=(const AliTRDCalDCSFEEv2 &c);\r
+\r
+  void    SetStatusBit(Int_t stbit)                  { fStatusBit           = (Char_t)stbit;        }\r
+  void    SetDCSid(Int_t dcsid)                      { fDCSID               = (Char_t)dcsid;        }\r
+  void    SetSM(Int_t smid)                          { fSM                  = (Char_t)smid;         }\r
+  void    SetStack(Int_t stid)                       { fStack               = (Char_t)stid;         }\r
+  void    SetLayer(Int_t lyid)                       { fLayer               = (Char_t)lyid;         }\r
+  void    SetNumberOfTimeBins(Int_t value)           { fNumberOfTimeBins    = (UShort_t)value;      }\r
+  void    SetConfigTag(Int_t cfgt)                   { fConfigTag           = (UShort_t)cfgt;       }\r
+  void    SetSingleHitThres(Int_t sht)               { fSingleHitThres      = (Short_t)sht;         }\r
+  void    SetThreePadClustThres(Int_t tpct)          { fThrPdClsThres       = (Short_t)tpct;        }\r
+  void    SetSelectiveNoZS(Int_t snzs)               { fSelNoZS             = (Short_t)snzs;        }\r
+  void    SetFastStatNoise(Int_t fstn)               { fFastStatNoise       = (Short_t)fstn;        }\r
+  void    SetTCFilterWeight(Int_t tcfw)              { fTCFilterWeight      = (Short_t)tcfw;        }\r
+  void    SetTCFilterShortDecPar(Int_t sdp)          { fTCFilterShortDecPar = (Short_t)sdp;         }\r
+  void    SetTCFilterLongDecPar(Int_t ldp)           { fTCFilterLongDecPar  = (Short_t)ldp;         }\r
+  void    SetGainTableRocSerial(Int_t gts)           { fGainTableRocSerial  = (UChar_t)gts;         }\r
+  void    SetFilterType(TString fity)                { fFilterType          = fity;                 }\r
+  void    SetReadoutParam(TString rpar)              { fReadoutParam        = rpar;                 }\r
+  void    SetTestPattern(TString tpat)               { fTestPattern         = tpat;                 }\r
+  void    SetTrackletMode(TString tmde)              { fTrackletMode        = tmde;                 }\r
+  void    SetTrackletDef(TString tdef)               { fTrackletDef         = tdef;                 }\r
+  void    SetTriggerSetup(TString trse)              { fTriggerSetup        = trse;                 }\r
+  void    SetAddOptions(TString adop)                { fAddOptions          = adop;                 }\r
+  void    SetConfigName(TString cfgn)                { fConfigName          = cfgn;                 }\r
+  void    SetConfigVersion(TString cfgv)             { fConfigVersion       = cfgv;                 }\r
+  void    SetGainTableName(TString gt)               { fGainTableName       = gt;                   }\r
+  void    SetGainTableDesc(TString gd)               { fGainTableDesc       = gd;                   }\r
+  void    SetGainTableRocType(TString gr)            { fGainTableRocType    = gr;                   }\r
+  void    SetMCMGlobalState(Int_t r,Int_t m,Int_t g) { fRStateGSM[r][m]     = g;                    }\r
+  void    SetMCMStateNI(Int_t r,Int_t m,Int_t v)     { fRStateNI[r][m]      = v;                    }\r
+  void    SetMCMEventCnt(Int_t r,Int_t m,Int_t v)    { fRStateEV[r][m]      = v;                    }\r
+  void    SetMCMPtCnt(Int_t r,Int_t m,Int_t v)       { fRStatePTRG[r][m]    = v;                    }\r
+  void    SetGainTableAdcdac(Int_t r,Int_t m,Int_t v){ fGainTableAdcdac[r][m]         = (Char_t)v;  }\r
+  void    SetGainTableFgfn(Int_t r,Int_t m,Int_t a,Int_t v) { fGainTableFgfn[r][m][a] = (Short_t)v; }\r
+  void    SetGainTableFgan(Int_t r,Int_t m,Int_t a,Int_t v) { fGainTableFgan[r][m][a] = (Char_t)v;  }\r
+\r
+  Int_t   GetStatusBit() const                       { return (Int_t)fStatusBit;                    }\r
+  Int_t   GetDCSid() const                           { return (Int_t)fDCSID;                        }\r
+  Int_t   GetSM() const                              { return (Int_t)fSM;                           }\r
+  Int_t   GetStack() const                           { return (Int_t)fStack;                        }\r
+  Int_t   GetLayer() const                           { return (Int_t)fLayer;                        }\r
+  Int_t   GetNumberOfTimeBins() const                { return (Int_t)fNumberOfTimeBins;             }\r
+  Int_t   GetConfigTag() const                       { return (Int_t)fConfigTag;                    }\r
+  Int_t   GetSingleHitThres() const                  { return (Int_t)fSingleHitThres;               }\r
+  Int_t   GetThreePadClustThres() const              { return (Int_t)fThrPdClsThres;                }\r
+  Int_t   GetSelectiveNoZS() const                   { return (Int_t)fSelNoZS;                      }\r
+  Int_t   GetTCFilterWeight() const                  { return (Int_t)fTCFilterWeight;               }\r
+  Int_t   GetTCFilterShortDecPar() const             { return (Int_t)fTCFilterShortDecPar;          }\r
+  Int_t   GetTCFilterLongDecPar() const              { return (Int_t)fTCFilterLongDecPar;           }\r
+  Int_t   GetFastStatNoise() const                   { return (Int_t)fFastStatNoise;                }\r
+  Int_t   GetGainTableRocSerial() const              { return (Int_t)fGainTableRocSerial;           }\r
+  TString GetFilterType() const                      { return fFilterType;                          }\r
+  TString GetReadoutParam() const                    { return fReadoutParam;                        }\r
+  TString GetTestPattern() const                     { return fTestPattern;                         }\r
+  TString GetTrackletMode() const                    { return fTrackletMode;                        }\r
+  TString GetTrackletDef() const                     { return fTrackletDef;                         }\r
+  TString GetTriggerSetup() const                    { return fTriggerSetup;                        }\r
+  TString GetAddOptions() const                      { return fAddOptions;                          }\r
+  TString GetConfigName() const                      { return fConfigName;                          }\r
+  TString GetConfigVersion() const                   { return fConfigVersion;                       }\r
+  TString GetGainTableName() const                   { return fGainTableName;                       }\r
+  TString GetGainTableDesc() const                   { return fGainTableDesc;                       }\r
+  TString GetGainTableRocType() const                { return fGainTableRocType;                    }\r
+  Int_t   GetMCMGlobalState(Int_t r,Int_t m) const   { return (UChar_t)fRStateGSM[r][m];            }\r
+  Int_t   GetMCMStateNI(Int_t r,Int_t m) const       { return (UChar_t)fRStateNI[r][m];             }\r
+  Int_t   GetMCMEventCnt(Int_t r,Int_t m) const      { return fRStateEV[r][m];                      }\r
+  Int_t   GetMCMPtCnt(Int_t r,Int_t m) const         { return fRStatePTRG[r][m];                    }\r
+  Int_t   GetGainTableAdcdac(Int_t r,Int_t m) const  { return (Int_t)fGainTableAdcdac[r][m];        }\r
+  Int_t   GetGainTableFgfn(Int_t r,Int_t m,Int_t a) const  { return (Int_t)fGainTableFgfn[r][m][a]; }\r
+  Int_t   GetGainTableFgan(Int_t r,Int_t m,Int_t a) const  { return (Int_t)fGainTableFgan[r][m][a]; }\r
+\r
+ protected:\r
+\r
+  static const Char_t fgkROB = 8;       // Number of readout boards\r
+  static const Char_t fgkMCM = 18;      // Number of MCMs\r
+  static const Char_t fgkADC = 21;      // Number of ADC channels\r
+  \r
+  Char_t   fStatusBit;                  // 0 if everything is OK, otherwise !=0 (see impl. file)\r
+  Char_t   fSM;                         // the number of the supermode 0..17\r
+  Char_t   fStack;                      // the number of the stack 0..4\r
+  Char_t   fLayer;                      // the number of the layer 0..5\r
+  Char_t   fGainTableFgan[(Int_t)fgkROB][(Int_t)fgkMCM][(Int_t)fgkADC]; // array of gain table fgan values\r
+  Char_t   fGainTableAdcdac[(Int_t)fgkROB][(Int_t)fgkMCM]; // array of gain table adcdac values\r
+  UChar_t  fRStateGSM[(Int_t)fgkROB][(Int_t)fgkMCM];  // array of the global states of the MCMs\r
+  UChar_t  fRStateNI[(Int_t)fgkROB][(Int_t)fgkMCM];   // array of the network interface states of the MCMs\r
+  UChar_t  fGainTableRocSerial;         // the roc serial of the chamber from the gain table\r
+  UShort_t fDCSID;                      // ID of the DCS-Board\r
+  UShort_t fNumberOfTimeBins;           // Number of timebins  \r
+  UShort_t fConfigTag;                  // Configuration tag\r
+  Short_t  fSingleHitThres;             // threshold of single hits (arg of readout param)\r
+  Short_t  fThrPdClsThres;              // threshold of 3-pad clusters (arg of readout param)\r
+  Short_t  fSelNoZS;                    // write every fSelNoZS'th event without ZS\r
+  Short_t  fTCFilterWeight;             // tail cancellation filter weight\r
+  Short_t  fTCFilterShortDecPar;        // tail cancellation filter short decay parameter\r
+  Short_t  fTCFilterLongDecPar;         // tail cancellation filter long decay parameter\r
+  Short_t  fFastStatNoise;              // collect statistics for fast noise mode\r
+  Short_t  fGainTableFgfn[(Int_t)fgkROB][(Int_t)fgkMCM][(Int_t)fgkADC]; // array of gain table fgfn values\r
+  Int_t    fRStateEV[(Int_t)fgkROB][(Int_t)fgkMCM];   // array of the event counters of the MCMs\r
+  Int_t    fRStatePTRG[(Int_t)fgkROB][(Int_t)fgkMCM]; // array of the pretrigger counters of the MCMs\r
+  TString  fGainTableRocType;           // the roc type from the gain table\r
+  TString  fFilterType;                 // filter type (p, pgt, nf)\r
+  TString  fReadoutParam;               // readout parameter (zs, nozs, testpattern)\r
+  TString  fTestPattern;                // value of testpattern (for readout param)\r
+  TString  fTrackletMode;               // tracklet mode (trk, csmtrk, notrk)\r
+  TString  fTrackletDef;                // definition for tracklet mode trk\r
+  TString  fTriggerSetup;               // trigger setup (ptrg, autotrg, autol0)\r
+  TString  fAddOptions;                 // additional options (nopm, nion)\r
+  TString  fConfigName;                 // Configuration name\r
+  TString  fConfigVersion;              // Configuration version\r
+  TString  fGainTableName;              // the name of the gain table\r
+  TString  fGainTableDesc;              // the description of the gain table\r
+\r
+  ClassDef(AliTRDCalDCSFEEv2,1)          // TRD calibration class for TRD FEE parameters\r
+};\r
+#endif\r
diff --git a/TRD/Macros/AliTRDcheckConfigv2.C b/TRD/Macros/AliTRDcheckConfigv2.C
new file mode 100644 (file)
index 0000000..92e6efd
--- /dev/null
@@ -0,0 +1,359 @@
+//===================================================================================
+// This is a macro to analyze TRD/Calib/DCSv2 OCDB objects either
+// from the grid for a given run number or from a local object.
+// If you want to analyze data from the grid, please don't forget to
+// have a valid alien token initialized and the file /tmp/gclient_env_$UID source'd.
+//
+// Arguments:
+// The first argument is the runnumber (this is ignored in case of a local file),
+// the second is a string that needs to contain either "grid" or "local". Further
+// you can add either verbose or quiet to that string. If you don't, you'll be asked
+// for all stuff individually wether you want to see it or not
+// the thrid argument is the number of the ROC you (eventually) want to dump its data
+// member of.
+// The fourth one is the path and name of the local file you might want to look at.
+//
+// So the simplest way to use this macro is if you want to check the output of a given
+// run from the OCDB:
+// .x AliTRDcheckConfigv2.C(60111)
+//
+// An example for quickly checking a local file:
+// .x AliTRDcheckConfigv2.C(0, "local quiet", 533, "$ALICE_ROOT/TRD/Calib/DCSv2/Run0_999999999_v0_s0.root")
+//
+// Please contact Frederick Kramer in case of problems
+//===================================================================================
+
+// This is the path one needs to change if the year is no longer 2009 
+// and the runnumber cannot be found
+//TString alienOcdbPath("alien://folder=/alice/data/2009/OCDB/");
+TString alienOcdbPath("alien://folder=/alice/data/2010/OCDB/");
+
+// Do not make changes below here unless you know what your doing
+
+const Int_t nROC = 540;
+const Int_t nROB = 8;
+const Int_t nMCM = 18;
+const Int_t cArraySize = 1000;
+
+Bool_t errors = false;
+
+Int_t AnalyzeArray(Int_t states[cArraySize], Int_t occur[cArraySize]) {
+  long long srtIndx[cArraySize] = 0;
+  
+  TMath::Sort(cArraySize, occur, srtIndx);
+
+  Int_t totalSum = 0, subSum = 0, iIndex = 0;
+  for (Int_t i=0; i<cArraySize; i++) totalSum += occur[i];
+  
+  cout << "    The majority ("<< occur[srtIndx[0]] << " of " 
+       << totalSum <<") is: " << states[srtIndx[0]] << endl;
+  subSum = occur[srtIndx[0]];
+  while (totalSum != subSum) {
+    if (++iIndex > 999) {
+      cout << "E : out of bounds." << endl;
+      break;
+    }
+    Printf("    Next: %7d (%d)", states[srtIndx[iIndex]], occur[srtIndx[iIndex]]);
+    subSum += occur[srtIndx[iIndex]];
+  }
+  return states[srtIndx[0]];
+}
+
+
+
+void FillItemInArray(Int_t states[cArraySize], Int_t occur[cArraySize], Int_t item, Bool_t allowNeg) {
+  for (Int_t iArrPos=0; iArrPos<cArraySize; iArrPos++) {
+    // if allowNeg is set then we change the number indicating that the item ws not set from -1 to -100
+    // so that small negitive numbers can be sorted too
+    if ((allowNeg && item == -100000) || (!allowNeg && item == -1)) break; // value not set
+    if (states[iArrPos] == item) {
+      occur[iArrPos]++;
+      break;
+    } else if (occur[iArrPos] == 0) {
+      states[iArrPos] = item;
+      occur[iArrPos]++;
+      break;
+    }
+  }
+}
+
+void GetMajoritys(AliTRDCalDCSv2* calDCSObj) {
+  
+  Int_t gsmStates[cArraySize] = {0}, gsmOccur[cArraySize] = {0};
+  Int_t nimStates[cArraySize] = {0}, nimOccur[cArraySize] = {0};
+  Int_t nevStates[cArraySize] = {0}, nevOccur[cArraySize] = {0};
+  Int_t nptStates[cArraySize] = {0}, nptOccur[cArraySize] = {0};
+  
+  for (Int_t i=0; i<cArraySize; i++) {
+    gsmStates[i] = 0; gsmOccur[i]  = 0;
+    nimStates[i] = 0; nimOccur[i]  = 0;
+    nevStates[i] = 0; nevOccur[i]  = 0;
+    nptStates[i] = 0; nptOccur[i]  = 0;  
+  }
+  
+  for (Int_t i=0; i<nROC && i<calDCSObj->GetFEEArr()->GetSize(); i++) {
+    AliTRDCalDCSFEEv2 *idcsfee = calDCSObj->GetCalDCSFEEObj(i);
+    if ((idcsfee == NULL) || (idcsfee->GetStatusBit() != 0)) continue;
+    for (Int_t j=0; j<nROB; j++) {
+      for (Int_t k=0; k<nMCM; k++) {
+       Int_t igsm = idcsfee->GetMCMGlobalState(j,k);
+       Int_t inim = idcsfee->GetMCMStateNI(j,k);
+       Int_t inev = idcsfee->GetMCMEventCnt(j,k);
+       Int_t inpt = idcsfee->GetMCMPtCnt(j,k);
+       
+       FillItemInArray(gsmStates, gsmOccur, igsm, false); 
+       FillItemInArray(nimStates, nimOccur, inim, false); 
+       FillItemInArray(nevStates, nevOccur, inev, false); 
+       FillItemInArray(nptStates, nptOccur, inpt, false); 
+      }
+    }
+  }
+  
+  cout << "I : Global MCM state statistics:" << endl;
+  AnalyzeArray(gsmStates, gsmOccur);
+  cout << "I : Network interface state statistics:" << endl;
+  AnalyzeArray(nimStates, nimOccur);
+  cout << "I : MCM Event counter reading statistics:" << endl;
+  AnalyzeArray(nevStates, nevOccur);
+  cout << "I : MCM PreTrigger counter reading statistics:" << endl;
+  AnalyzeArray(nptStates, nptOccur);
+  
+  return;
+}
+
+
+
+void GetMajorityDifferences(AliTRDCalDCSv2* calDCSObj, AliTRDCalDCSv2* calDCSObj2) {
+  
+  Int_t gsmStates[cArraySize] = {0}, gsmOccur[cArraySize] = {0};
+  Int_t nimStates[cArraySize] = {0}, nimOccur[cArraySize] = {0};
+  Int_t nevStates[cArraySize] = {0}, nevOccur[cArraySize] = {0};
+  Int_t nptStates[cArraySize] = {0}, nptOccur[cArraySize] = {0};
+  
+  for (Int_t i=0; i<cArraySize; i++) {
+    gsmStates[i] = 0; gsmOccur[i]  = 0;
+    nimStates[i] = 0; nimOccur[i]  = 0;
+    nevStates[i] = 0; nevOccur[i]  = 0;
+    nptStates[i] = 0; nptOccur[i]  = 0;  
+  }
+  
+  for (Int_t i=0; i<nROC && i<calDCSObj->GetFEEArr()->GetSize() && i<calDCSObj2->GetFEEArr()->GetSize(); i++) {
+    AliTRDCalDCSFEEv2 *idcsfee = calDCSObj->GetCalDCSFEEObj(i);
+    AliTRDCalDCSFEEv2 *idcsfee2 = calDCSObj2->GetCalDCSFEEObj(i);
+    if ((idcsfee == NULL) || (idcsfee2 == NULL) || 
+      (idcsfee->GetStatusBit() != 0) /*|| (idcsfee2->GetStatusBit() != 0)*/) continue;
+    for (Int_t j=0; j<nROB; j++) {
+      for (Int_t k=0; k<nMCM; k++) {
+       Int_t igsm = idcsfee->GetMCMGlobalState(j,k) - idcsfee2->GetMCMGlobalState(j,k);
+       Int_t inim = idcsfee->GetMCMStateNI(j,k)     - idcsfee2->GetMCMStateNI(j,k);
+       Int_t inev = idcsfee2->GetMCMEventCnt(j,k)   - idcsfee->GetMCMEventCnt(j,k);
+       Int_t inpt = idcsfee2->GetMCMPtCnt(j,k)      - idcsfee->GetMCMPtCnt(j,k);
+       
+       // if they were set to -1, it means they were not actauuly set
+       // change -1 to -100 to mean they werent set since the above 
+       // can give negitives
+       if (idcsfee->GetMCMGlobalState(j,k) == -1 && igsm == 0) igsm =-100000;
+       if (idcsfee->GetMCMStateNI(j,k) == -1 && inim == 0)     inim =-100000;
+       if (idcsfee->GetMCMEventCnt(j,k) == -1 && inev == 0)    inev =-100000;
+       if (idcsfee->GetMCMPtCnt(j,k) == -1 && inpt == 0)       inpt =-100000;
+       
+       FillItemInArray(gsmStates, gsmOccur, igsm, true); 
+       FillItemInArray(nimStates, nimOccur, inim, true); 
+       FillItemInArray(nevStates, nevOccur, inev, true); 
+       FillItemInArray(nptStates, nptOccur, inpt, true); 
+      }
+    }
+  }
+  
+  cout << "I : Global MCM state difference statistics:" << endl;
+  AnalyzeArray(gsmStates, gsmOccur);
+  cout << "I : Network interface state difference statistics:" << endl;
+  AnalyzeArray(nimStates, nimOccur);
+  cout << "I : MCM Event counter difference statistics:" << endl;
+  if (AnalyzeArray(nevStates, nevOccur) < 1) {
+    cout << "E : There should have been some events recorded, but there weren't" << endl;
+    errors = true;
+  }
+  cout << "I : MCM PreTrigger counter difference statistics:" << endl;
+  if (AnalyzeArray(nptStates, nptOccur) < 1) {
+    cout << "E : There should have been some events recorded, but there weren't" << endl;
+    errors = true;
+  }
+  
+  return;
+}
+
+
+void AliTRDcheckConfigv2(Int_t runNr=0, char *pathfile="nopathgiven"){
+
+  AliCDBEntry *entry=0;
+  TString pathfilets(pathfile);
+
+  // get the source
+  if(pathfilets.Contains("nopathgiven")) {
+    cout << "I : Accessing grid storage for run number " << runNr << endl;
+    cout << "I : Get CDBManager instance." << endl;
+    AliCDBManager *man = AliCDBManager::Instance();
+    cout << "I : SetDefaultStorage." << endl;
+    man->SetDefaultStorage(alienOcdbPath);
+    cout << "I : Get OCDB Entry." << endl;
+    entry = man->Get("TRD/Calib/DCSv2", runNr);
+    if (entry == NULL) {
+      cout << endl << "ERROR: Unable to get the AliTRDCalDCSv2 object from the OCDB for run number " << runNr << endl << endl;
+      cout << "If the run number is correct, it could be that the year is no longer 2009 and" << endl;
+      cout << "the path where the objects is stored has changed, check the top of this macro " << endl;
+      cout << "to change the path." << endl;
+      return;
+    }
+  } else {
+    cout << "I : Accessing local storage" << endl;
+    TFile *f = new TFile(pathfile);
+    if(f != NULL) {
+      entry = (AliCDBEntry*) f->Get("AliCDBEntry");
+    }
+    else {
+      cout << "E : Cannot open file" << endl;
+      return;
+    }
+  }
+  
+  TObject *objectCDB = (TObject*)entry->GetObject();
+  if (objectCDB->IsA()->InheritsFrom("TObjArray")) {
+    TObjArray *objArrayCDB = (TObjArray*)entry->GetObject();
+  }
+  
+  // the CalDCS object
+  AliTRDCalDCSv2 *caldcs;
+  AliTRDCalDCSv2 *caldcs2;
+
+  Bool_t sorandeor = true;
+
+  caldcs  = (AliTRDCalDCSv2*) objArrayCDB->At(0);
+  caldcs2 = (AliTRDCalDCSv2*) objArrayCDB->At(1);
+
+  if (caldcs == NULL && caldcs2 == NULL) {
+    cout << "E : Niether the start or end of run files were in the root file.";
+    return;
+  } else if (caldcs != NULL && caldcs2 == NULL) {
+    cout << "E : The EOR file was not in the root file.";
+    errors = true;
+    sorandeor = false;
+  } else if (caldcs == NULL && caldcs2 != NULL) {
+    cout << "E : The SOR file was not in the root file.";
+    errors = true;
+    sorandeor = false;
+    caldcs = caldcs2;
+  }
+
+  cout << endl << "============ Non responding ROC Summary: ============" << endl;
+  TString bitfivestr = " ROCs with status bit 5. These havn't responded to communication\nattempts over DIM. Most probably they just were off this is ok.\n    DCS IDs: ";
+  Int_t lengthfive = bitfivestr.Length();
+  TString bitfourstr = " ROCs with status bit 4! BAD! This might be due to a communication problem between fxsproxy and the feeserver(s) \n    DCS IDs: ";
+  Int_t lengthfour = bitfourstr.Length();
+  TString bitthreestr = " ROCs with status bit 3! BAD! data from fee server was old or corrupt.\n    DCS IDs: ";
+  Int_t lengththree = bitthreestr.Length();
+  TString bittwostr = " ROCs with status bit 2. These have been in states in which they cannot be read out, e.g. Standby.\n    DCS IDs: ";
+  Int_t lengthtwo = bittwostr.Length();
+  TString bitonestr = " ROCs with status bit 1! BAD! This means the chamber(s) didn't respont even though is should have been in a good state.\n    DCS IDs: ";
+  Int_t lengthone = bitonestr.Length();
+
+  Int_t nSB1=0, nSB2=0, nSB3=0, nSB4=0, nSB5=0, nTot=0;
+  for (Int_t i=0; i<nROC && i<caldcs->GetFEEArr()->GetSize(); i++) {
+    AliTRDCalDCSFEEv2 *idcsfee;
+    idcsfee = caldcs->GetCalDCSFEEObj(i);
+    if (idcsfee != NULL) {
+      Int_t sb = idcsfee->GetStatusBit();
+      if (sb == 5) { bitfivestr  += i; bitfivestr  += "  "; nSB5++; }
+      if (sb == 4) { bitfourstr  += i; bitfourstr  += "  "; nSB4++; errors = true; }
+      if (sb == 3) { bitthreestr += i; bitthreestr += "  "; nSB3++; errors = true; }
+      if (sb == 2) { bittwostr   += i; bittwostr   += "  "; nSB2++; }
+      if (sb == 1) { bitonestr   += i; bitonestr   += "  "; nSB1++; errors = true; }
+      nTot += 1;
+    }
+  }
+
+  if (lengthfive < bitfivestr.Length()) cout << nSB5 << bitfivestr.Data() << endl << endl;
+  if (lengthfour < bitfourstr.Length()) cout << nSB4 << bitfourstr.Data() << endl << endl;
+  if (lengththree < bitthreestr.Length()) cout << nSB3 << bitthreestr.Data() << endl << endl;
+  if (lengthtwo < bittwostr.Length()) cout << nSB2 << bittwostr.Data() << endl << endl;
+  if (lengthone < bitonestr.Length()) cout << nSB1 << bitonestr.Data() << endl << endl;
+  
+  cout << "The remaining " << nTot-(nSB1+nSB2+nSB3+nSB4+nSB5) << " ROCs responded correctly in the start of run."<<endl;
+
+  Int_t nChanged=0, nTot=0;
+  for (Int_t i=0; i<nROC && i<caldcs->GetFEEArr()->GetSize(); i++) {
+    AliTRDCalDCSFEEv2 *idcsfee;
+    idcsfee = caldcs->GetCalDCSFEEObj(i);
+    idcsfee2 = caldcs2->GetCalDCSFEEObj(i);
+    if (idcsfee != NULL && idcsfee2 != NULL) {
+      Int_t sbd = idcsfee->GetStatusBit() - idcsfee2->GetStatusBit();
+      if (sbd != 0) { 
+       cout << "ROC " << i << " changed from state " << idcsfee->GetStatusBit() << " at start of the run to "  << idcsfee2->GetStatusBit() << " at the end of the run." << endl;
+       nChanged++; 
+      }
+      nTot += 1;
+    }
+  }
+  
+  if (nChanged == 0) {
+    cout << "No ROCs changed state between the start and end of the run" << endl;
+  } else {
+    cout << "E : " << nChanged << " out of " << nTot << " ROCs changed state during the run" << endl;
+    errors = true; 
+  }
+
+  cout << endl << "============ Statistics from RSTATE: ============" << endl;
+  cout<<"I : The majority entry is given as well as all other values," << endl;
+  cout<<"    sorted according to their occurrence." << endl << endl;
+  GetMajoritys(caldcs);
+  if (sorandeor) GetMajorityDifferences(caldcs,caldcs2);
+
+  cout << endl << "============ Global Configuraton: ============" << endl;
+  cout<<"I : Anything not listed is not set, mixed numbers are indicated with a" << endl;
+  cout<<"    value of -2 and strings are set to 'mixed' if they're mixed." << endl << endl;
+  if (caldcs->GetGlobalNumberOfTimeBins() != -1)
+    cout<<"Global number of time bins.........................: "<<caldcs->GetGlobalNumberOfTimeBins() << endl;
+  if (caldcs->GetGlobalConfigTag() != -1)
+    cout<<"Global configuration tag...........................: "<<caldcs->GetGlobalConfigTag() << endl;
+  if (caldcs->GetGlobalSingleHitThres() != -1)
+    cout<<"Global single hit threshold........................: "<<caldcs->GetGlobalSingleHitThres() << endl;
+  if (caldcs->GetGlobalThreePadClustThres() != -1)
+    cout<<"Global three pad cluster threshold.................: "<<caldcs->GetGlobalThreePadClustThres()<<endl;
+  if (caldcs->GetGlobalSelectiveNoZS() != -1)
+    cout<<"Global selective ZS (every i'th event).............: "<<caldcs->GetGlobalSelectiveNoZS() << endl;
+  if (caldcs->GetGlobalTCFilterWeight() != -1)
+    cout<<"Global tail cancellation filter weight.............: "<<caldcs->GetGlobalTCFilterWeight() << endl;
+  if (caldcs->GetGlobalTCFilterShortDecPar() != -1)
+    cout<<"Global tail cancellat. filter short decay parameter: "<<caldcs->GetGlobalTCFilterShortDecPar()<<endl;
+  if (caldcs->GetGlobalTCFilterLongDecPar() != -1)
+    cout<<"Global tail cancellation filt. long decay parameter: "<<caldcs->GetGlobalTCFilterLongDecPar()<<endl;
+  if (caldcs->GetGlobalModeFastStatNoise() != -1)
+    cout<<"Global fast statistics mode?.......................: "<<caldcs->GetGlobalModeFastStatNoise() << endl;
+  if (caldcs->GetGlobalConfigVersion() != "")
+    cout<<"Global configuration tag version...................: "<<caldcs->GetGlobalConfigVersion() << endl;
+  if (caldcs->GetGlobalConfigName() != "")
+    cout<<"Global configuration tag name......................: "<<caldcs->GetGlobalConfigName() << endl;
+  if (caldcs->GetGlobalFilterType() != "")
+    cout<<"Global filter type.................................: "<<caldcs->GetGlobalFilterType() << endl;
+  if (caldcs->GetGlobalReadoutParam() != "")
+    cout<<"Global readout parameter...........................: "<<caldcs->GetGlobalReadoutParam() << endl;
+  if (caldcs->GetGlobalTestPattern() != "")
+    cout<<"Global test pattern................................: "<<caldcs->GetGlobalTestPattern() << endl;
+  if (caldcs->GetGlobalTrackletMode() != "")
+    cout<<"Global tracklet mode...............................: "<<caldcs->GetGlobalTrackletMode() << endl;
+  if (caldcs->GetGlobalTrackletDef() != "")
+    cout<<"Global tracklet definition.........................: "<<caldcs->GetGlobalTrackletDef() << endl;
+  if (caldcs->GetGlobalTriggerSetup() != "")
+    cout<<"Global trigger setup...............................: "<<caldcs->GetGlobalTriggerSetup() << endl;
+  if (caldcs->GetGlobalAddOptions() != "")
+    cout<<"Global additional options..........................: "<<caldcs->GetGlobalAddOptions() << endl;
+  
+  cout << endl << "============ Error Summary: ============" << endl;
+  if (errors) {
+    cout<<"    I noticed some errors, please see above for the specifics." << endl;
+  } else {
+    cout<<"    I didn't notice any errors, but that doesn't mean there weren't any!" << endl;
+  }
+  
+
+}
diff --git a/TRD/Macros/DumpOCDBtoTreev2.C b/TRD/Macros/DumpOCDBtoTreev2.C
new file mode 100644 (file)
index 0000000..ea8b7a8
--- /dev/null
@@ -0,0 +1,1005 @@
+  ////////////////////////////////////////////
+  // Author: Ionut Cristian Arsene          //
+  // email:  iarsene@mail.cern.ch           //
+  ////////////////////////////////////////////
+  // Use this macro to create ROOT trees with time dependent information from the TRD OCDB
+  //
+  // Usage:
+  //
+  // void DumpOCDBtoTreev2(const Char_t* outFilename,
+  //                  const Char_t* runListFilename,
+  //                  Int_t firstRun = -1, Int_t lastRun = -1,
+  //                  const Char_t* storageURI = "alien://folder=/alice/data/2010/OCDB/",
+  //                  Bool_t getHVInfo = kTRUE,
+  //                  Bool_t getCalibrationInfo = kFALSE,
+  //                     Bool_t getGasInfo = kFALSE,
+  //                  Bool_t getStatusInfo = kFALSE,
+  //                  Bool_t getGoofieInfo = kFALSE,
+  //                  Bool_t getDCSInfo = kFALSE,
+  //                  Bool_t getGRPInfo = kTRUE)
+  //
+  //    * runListFilename   - name of an ascii file containing run numbers
+  //    * outFilename       - name of the root file where the TRD OCDB information tree to be stored
+  //    * firstRun, lastRun - lowest and highest run numbers (from the ascii file) to be dumped
+  //                          if these numbers are not specified (-1) all run numbers in the input ascii file will
+  //                          be used. If the run list file is not specified then all runs in this interval
+  //                          will be queried
+  //    * getHVInfo         - flag to switch on/off HV information (HV anode and drift currents/voltages)
+  //    * getCalibrationInfo- flag to switch on/off calibration information (gain, pedestal, T0, vdrift, pad status)
+  //    * getGasInfo        - flag to switch on/off gas related information (gas composition, overpressure, temperature)
+  //    * getStatusInfo     - flag to switch on/off status information (trd_chamberStatus)
+  //    * getGoofieInfo     - flag to switch on/off goofie information (gain, HV, pressure, temperature, drift velocity,
+  //                          gas composition)
+  //    * getDCSInfo        - flag to switch on/off DCS information
+  //    * getGRPInfo        - flag to switch on/off GRP information --> there will be no time information in the output tree
+  //    * storageURI           - path of the OCDB database (if it is on alien, be sure to have a valid/active token)
+
+
+  #include <iostream>
+  #include <fstream>
+  #include <string>
+  #include <exception>
+  #include "TError.h"
+  #include "TVectorD.h"
+  #include "TTreeStream.h"
+  #include "TObjString.h"
+  #include "TTimeStamp.h"
+  #include "TH1.h"
+  #include "TMath.h"
+  #include "TObjArray.h"
+  #include "TFile.h"
+  #include "TSystem.h"
+  #include "TGrid.h"
+  #include "AliCDBManager.h"
+  #include "AliCDBStorage.h"
+  #include "AliCDBEntry.h"
+  #include "AliTRDcalibDB.h"
+  #include "AliGRPObject.h"
+  #include "AliDCSSensor.h"
+  #include "AliTRDSensorArray.h"
+  #include "AliTRDCalDet.h"
+  #include "AliTRDCalPad.h"
+  #include "AliTRDCalROC.h"
+  #include "AliTRDCalPadStatus.h"
+  #include "AliTRDCalChamberStatus.h"
+  #include "AliTRDCalSingleChamberStatus.h"
+  #include "AliTRDCalDCSv2.h"
+  #include "AliTRDCalDCSFEEv2.h"
+  using namespace std;
+
+  // global variables
+  // histograms used for extracting the mean and RMS of calibration parameters
+  TH1F *gRunWiseHisto;
+  TH1F *gSuperModuleWiseHisto;
+  TH1F *gChamberWiseHisto;
+
+  // global constants
+  const Int_t gkSuperModuleStatus[18] = {1, 1, 0, 0, 0, 0, 0, 1, 1,   // (1-installed)
+                1, 1, 0, 0, 0, 0, 0, 0, 1};
+  AliCDBStorage *storage = NULL;
+  AliCDBManager *manager = NULL;
+  Int_t currRun(0);
+  void MakeRunListFromOCDB(const Char_t* directory, const Char_t* outfile, Bool_t fromAlien=kFALSE);
+  void ProcessTRDSensorArray(AliTRDSensorArray*, TTimeStamp, TVectorD&);
+  void ProcessTRDCalibArray(AliTRDCalDet*, AliTRDCalPad*, TString, Double_t&, Double_t&,
+        TVectorD&, TVectorD&, TVectorD&, TVectorD&);
+  void ProcessTRDstatus(AliTRDCalChamberStatus*, AliTRDCalPadStatus*, Float_t&, TVectorD&, TVectorD&);
+  void ProcessTRDCalDCSFEE(AliTRDCalDCSv2*, AliTRDCalDCSv2*, Int_t&, Int_t&, Int_t&, Int_t&, Int_t&, Int_t&, Bool_t&,
+        TVectorD&, TVectorD&);
+  AliCDBEntry* GetCDBentry(const Char_t *path, Bool_t owner=kTRUE);
+  //__________________________________________________________________________________________
+  void DumpOCDBtoTreev2(const Char_t* outFilename,
+        const Char_t* runListFilename,
+        Int_t firstRun = -1, Int_t lastRun = -1,
+        const Char_t* storageURI = "alien://folder=/alice/data/2010/OCDB/",
+        Bool_t getHVInfo = kTRUE,
+        Bool_t getCalibrationInfo = kFALSE,
+                    Bool_t getGasInfo = kFALSE,
+        Bool_t getStatusInfo = kFALSE,
+        Bool_t getGoofieInfo = kFALSE,
+        Bool_t getDCSInfo = kFALSE,
+        Bool_t getGRPInfo = kTRUE) {
+  //
+  // Main function to steer the extraction of TRD OCDB information
+  //
+
+
+  TTimeStamp jobStartTime;
+  // if the storage is on alien than we need to do some extra stuff
+  TString storageString(storageURI);
+  if(storageString.Contains("alien://")) {
+    TGrid::Connect("alien://");
+  }
+  // initialize the OCDB manager
+  manager = AliCDBManager::Instance();
+  manager->SetDefaultStorage(storageURI);
+  manager->SetCacheFlag(kTRUE);
+  storage = manager->GetDefaultStorage();
+  AliCDBEntry *entry = NULL;
+
+  // initialize the tree
+  TTreeSRedirector *treeStreamer = new TTreeSRedirector(outFilename);
+
+  // initialize the histograms used for extracting the mean and RMS
+  gRunWiseHisto = new TH1F("runHisto", "runHisto", 200, -10.0, 10.0);
+  gSuperModuleWiseHisto = new TH1F("smHisto", "smHisto", 200, -10.0, 10.0);
+  gChamberWiseHisto = new TH1F("chamberHisto", "chamberHisto", 200, -10.0, 10.0);
+
+  // open the ascii file with run numbers
+  ifstream in;
+  if(runListFilename[0]!='\0')
+    in.open(runListFilename);
+
+  // if a run list file was not specified then use the run range
+  if(runListFilename[0]=='\0' && firstRun!=-1 && lastRun!=-1)
+    currRun = firstRun-1;
+
+  TVectorD runs;
+  TVectorD rejectedRuns;
+  TTimeStamp loopStartTime;
+
+  // loop over runs
+  while(1) {
+    // check if we still have run numbers in the file or provided range
+    if(runListFilename[0]=='\0' && firstRun!=-1 && lastRun!=-1) {
+      currRun++;
+      if(currRun>lastRun) break;
+    }
+    if(runListFilename[0]!='\0') {
+      if(in.eof()) break;
+      if(!(in>>currRun)) continue;
+      if(currRun < (firstRun==-1 ? 0 : firstRun) ||
+          currRun > (lastRun==-1 ? 999999999 : lastRun)) continue;
+    }
+
+    printf("\n\tRUN[%d]\n", currRun);
+    // check if the run was processed already
+    Bool_t runProcessed = kFALSE;
+    for(Int_t iRun=0; iRun<runs.GetNoElements(); iRun++) {
+      if(runs[iRun]==currRun) runProcessed = kTRUE;
+    }
+    if(runProcessed) {
+      cout << "Run processed already" << endl;
+      continue;
+    }
+    manager->SetRun(currRun);
+
+    // Get the GRP data. Only runs with a corresponding GRP entry in the OCDB
+    // will be processed.
+    time_t startTime = 0;
+    time_t endTime = 0;
+    TObjString runType("UNKNOWN");
+    AliDCSSensor *cavern_pressure = 0x0;
+    AliDCSSensor *surface_pressure = 0x0;
+    UInt_t detectorMask = 0;
+    if(getGRPInfo){
+      if(!(entry = GetCDBentry("GRP/GRP/Data", 0))) {
+        rejectedRuns.ResizeTo(rejectedRuns.GetNoElements()+1);
+        rejectedRuns[rejectedRuns.GetNoElements()-1] = currRun;
+        continue;
+      }
+    }
+    AliGRPObject* grpObject = dynamic_cast<AliGRPObject*>(entry->GetObject());
+    if(grpObject) {
+      startTime = grpObject->GetTimeStart();
+      endTime = grpObject->GetTimeEnd();
+      runType = grpObject->GetRunType().Data();
+      cavern_pressure = grpObject->GetCavernAtmosPressure();
+      surface_pressure = grpObject->GetSurfaceAtmosPressure();
+      detectorMask = grpObject->GetDetectorMask();
+      TTimeStamp start(grpObject->GetTimeStart());
+      TTimeStamp end(grpObject->GetTimeEnd());
+      cout << "   Start time: " << start.GetDate()/10000 << "/"
+      << (start.GetDate()/100)-(start.GetDate()/10000)*100 << "/"
+      << start.GetDate()%100 << "   "
+      << start.GetTime()/10000 << ":"
+      << (start.GetTime()/100)-(start.GetTime()/10000)*100 << ":"
+      << start.GetTime()%100 << endl;
+      cout << "   End time: " << end.GetDate()/10000 << "/"
+      << (end.GetDate()/100)-(end.GetDate()/10000)*100 << "/"
+      << end.GetDate()%100 << "   "
+      << end.GetTime()/10000 << ":"
+      << (end.GetTime()/100)-(end.GetTime()/10000)*100 << ":"
+      << end.GetTime()%100 << endl;
+      cout << "   Run type = " << grpObject->GetRunType().Data() << endl;
+    } else {
+      if(getGRPInfo) {
+        cout << "No GRP info available --> skiping this run!" << endl;
+        // add the run number to the list of rejected runs
+        rejectedRuns.ResizeTo(rejectedRuns.GetNoElements()+1);
+        rejectedRuns[rejectedRuns.GetNoElements()-1] = currRun;
+        continue;
+      }
+    }
+
+    // remove runs with zero time duration
+    if(getGRPInfo && startTime==endTime) {
+      if(grpObject) delete grpObject;
+      // add the run number to the list of rejected runs
+      rejectedRuns.ResizeTo(rejectedRuns.GetNoElements()+1);
+      rejectedRuns[rejectedRuns.GetNoElements()-1] = currRun;
+      continue;
+    }
+
+    // time step for time dependent information (change this if you need something else)
+    UInt_t dTime = TMath::Max((endTime-startTime)/20, Long_t(5*60));
+
+    // get monitoring information
+    AliTRDSensorArray *anodeISensors = 0;
+    AliTRDSensorArray *anodeUSensors = 0;
+    AliTRDSensorArray *driftISensors = 0;
+    AliTRDSensorArray *driftUSensors = 0;
+    AliTRDSensorArray *temperatureSensors = 0;
+    AliTRDSensorArray *chamberStatusSensors = 0;
+    AliTRDSensorArray *overpressureSensors = 0;
+    AliTRDSensorArray *gasCO2Sensors = 0;
+    AliTRDSensorArray *gasH2OSensors = 0;
+    AliTRDSensorArray *gasO2Sensors = 0;
+    //  AliTRDSensorArray *adcClkPhaseSensors = 0;
+
+    if(getHVInfo) {
+      // anode hv currents (per chamber)
+      if((entry = GetCDBentry("TRD/Calib/trd_hvAnodeImon"))) anodeISensors = (AliTRDSensorArray*)entry->GetObject();
+      // anode hv voltages (per chamber)
+      if((entry = GetCDBentry("TRD/Calib/trd_hvAnodeUmon"))) anodeUSensors = (AliTRDSensorArray*)entry->GetObject();
+      // drift hv currents (per chamber)
+      if((entry = GetCDBentry("TRD/Calib/trd_hvDriftImon"))) driftISensors = (AliTRDSensorArray*)entry->GetObject();
+      // drift hv voltages (per chamber)
+      if((entry = GetCDBentry("TRD/Calib/trd_hvDriftUmon"))) driftUSensors = (AliTRDSensorArray*)entry->GetObject();
+    }  // end if(getHVInfo)
+
+    if(getStatusInfo) {
+      // chamber status (from sensors)
+      if((entry = GetCDBentry("TRD/Calib/trd_chamberStatus"))) chamberStatusSensors = (AliTRDSensorArray*)entry->GetObject();
+    }   // end if(getStatusInfo)
+
+    if(getGasInfo) {
+      // temperatures from chamber sensors (per chamber)
+      if((entry = GetCDBentry("TRD/Calib/trd_envTemp"))) temperatureSensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // gas overpressure (per whole TRD)
+      if((entry = GetCDBentry("TRD/Calib/trd_gasOverpressure"))) overpressureSensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // gas CO2 fraction (whole TRD)
+      if((entry = GetCDBentry("TRD/Calib/trd_gasCO2"))) gasCO2Sensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // gas H2O fraction (whole TRD)
+      if((entry = GetCDBentry("TRD/Calib/trd_gasH2O"))) gasH2OSensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // gas O2 fraction (whole TRD)
+      if((entry = GetCDBentry("TRD/Calib/trd_gasO2"))) gasO2Sensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // ADC Clk phase (whole TRD)
+  /*
+      entry = manager->Get("TRD/Calib/trd_adcClkPhase");
+      if(entry) {
+  entry->SetOwner(kTRUE);
+  adcClkPhaseSensors = (AliTRDSensorArray*)entry->GetObject();
+      }
+  */
+    }  // end if getGasInfo
+
+
+    // get calibration information
+    // process gains
+    AliTRDCalDet *chamberGainFactor = 0;
+    AliTRDCalPad *padGainFactor = 0;
+    Double_t runMeanGain=0.0, runRMSGain=0.0;
+    TVectorD chamberMeanGain(AliTRDcalibDB::kNdet);
+    TVectorD chamberRMSGain(AliTRDcalibDB::kNdet);
+    TVectorD smMeanGain(AliTRDcalibDB::kNsector);
+    TVectorD smRMSGain(AliTRDcalibDB::kNsector);
+    TString parName("Gain");
+    if(getCalibrationInfo) {
+      if((entry = GetCDBentry("TRD/Calib/ChamberGainFactor", 0))) chamberGainFactor = (AliTRDCalDet*)entry->GetObject();
+
+      if((entry = GetCDBentry("TRD/Calib/LocalGainFactor", 0))) padGainFactor = (AliTRDCalPad*)entry->GetObject();
+
+      ProcessTRDCalibArray(chamberGainFactor, padGainFactor,
+          parName,
+          runMeanGain, runRMSGain,
+          chamberMeanGain, chamberRMSGain,
+          smMeanGain, smRMSGain);
+    }
+
+    // process pedestals
+    AliTRDCalDet *chamberNoise = 0;
+    AliTRDCalPad *padNoise = 0;
+    Double_t runMeanNoise=0.0, runRMSNoise=0.0;
+    TVectorD chamberMeanNoise(AliTRDcalibDB::kNdet);
+    TVectorD chamberRMSNoise(AliTRDcalibDB::kNdet);
+    TVectorD smMeanNoise(AliTRDcalibDB::kNsector);
+    TVectorD smRMSNoise(AliTRDcalibDB::kNsector);
+    parName = "Noise";
+    if(getCalibrationInfo) {
+      if((entry = GetCDBentry("TRD/Calib/DetNoise", 0))) chamberNoise = (AliTRDCalDet*)entry->GetObject();
+
+      if((entry = GetCDBentry("TRD/Calib/PadNoise", 0))) padNoise = (AliTRDCalPad*)entry->GetObject();
+
+      ProcessTRDCalibArray(chamberNoise, padNoise,
+          parName,
+          runMeanNoise, runRMSNoise,
+          chamberMeanNoise, chamberRMSNoise,
+          smMeanNoise, smRMSNoise);
+    }
+
+    // process drift velocity
+    AliTRDCalDet *chamberVdrift = 0;
+    AliTRDCalPad *padVdrift = 0;
+    Double_t runMeanVdrift=0.0, runRMSVdrift=0.0;
+    TVectorD chamberMeanVdrift(AliTRDcalibDB::kNdet);
+    TVectorD chamberRMSVdrift(AliTRDcalibDB::kNdet);
+    TVectorD smMeanVdrift(AliTRDcalibDB::kNsector);
+    TVectorD smRMSVdrift(AliTRDcalibDB::kNsector);
+    parName = "Vdrift";
+    if(getCalibrationInfo) {
+      if((entry = GetCDBentry("TRD/Calib/ChamberVdrift", 0))) chamberVdrift = (AliTRDCalDet*)entry->GetObject();
+
+      if((entry = GetCDBentry("TRD/Calib/LocalVdrift", 0))) padVdrift = (AliTRDCalPad*)entry->GetObject();
+
+      ProcessTRDCalibArray(chamberVdrift, padVdrift,
+          parName,
+          runMeanVdrift, runRMSVdrift,
+          chamberMeanVdrift, chamberRMSVdrift,
+          smMeanVdrift, smRMSVdrift);
+    }
+
+    // process T0
+    AliTRDCalDet *chamberT0 = 0;
+    AliTRDCalPad *padT0 = 0;
+    Double_t runMeanT0=0.0, runRMST0=0.0;
+    TVectorD chamberMeanT0(AliTRDcalibDB::kNdet);
+    TVectorD chamberRMST0(AliTRDcalibDB::kNdet);
+    TVectorD smMeanT0(AliTRDcalibDB::kNsector);
+    TVectorD smRMST0(AliTRDcalibDB::kNsector);
+    parName = "T0";
+    if(getCalibrationInfo) {
+      if((entry = GetCDBentry("TRD/Calib/ChamberT0", 0))) chamberT0 = (AliTRDCalDet*)entry->GetObject();
+
+      if((entry = GetCDBentry("TRD/Calib/LocalT0", 0))) padT0 = (AliTRDCalPad*)entry->GetObject();
+
+      ProcessTRDCalibArray(chamberT0, padT0,
+          parName,
+          runMeanT0, runRMST0,
+          chamberMeanT0, chamberRMST0,
+          smMeanT0, smRMST0);
+    }
+
+    // process pad and chamber status
+    AliTRDCalChamberStatus* chamberStatus = 0;
+    AliTRDCalPadStatus *padStatus = 0;
+    Float_t runBadPadFraction=0.0;
+    TVectorD chamberBadPadFraction(AliTRDcalibDB::kNdet);
+    TVectorD chamberStatusValues(AliTRDcalibDB::kNdet);
+    if(getCalibrationInfo) {
+      if((entry = GetCDBentry("TRD/Calib/ChamberStatus", 0))) chamberStatus = (AliTRDCalChamberStatus*)entry->GetObject();
+
+      if((entry = GetCDBentry("TRD/Calib/PadStatus", 0))) padStatus = (AliTRDCalPadStatus*)entry->GetObject();
+
+      ProcessTRDstatus(chamberStatus, padStatus,
+            runBadPadFraction, chamberBadPadFraction,
+            chamberStatusValues);
+    }
+
+    // get Goofie information
+    AliTRDSensorArray *goofieGainSensors = 0x0;
+    AliTRDSensorArray *goofieHvSensors = 0x0;
+    AliTRDSensorArray *goofiePressureSensors = 0x0;
+    AliTRDSensorArray *goofieTempSensors = 0x0;
+    AliTRDSensorArray *goofieVelocitySensors = 0x0;
+    AliTRDSensorArray *goofieCO2Sensors = 0x0;
+    AliTRDSensorArray *goofieN2Sensors = 0x0;
+
+    if(getGoofieInfo) {
+      // goofie gain
+      if((entry = GetCDBentry("TRD/Calib/trd_goofieGain"))) goofieGainSensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // goofie HV
+      if((entry = GetCDBentry("TRD/Calib/trd_goofieHv"))) goofieHvSensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // goofie pressure
+      if((entry = GetCDBentry("TRD/Calib/trd_goofiePressure"))) goofiePressureSensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // goofie temperature
+      if((entry = GetCDBentry("TRD/Calib/trd_goofieTemp"))) goofieTempSensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // goofie drift velocity
+      if((entry = GetCDBentry("TRD/Calib/trd_goofieVelocity"))) goofieVelocitySensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // goofie CO2
+      if((entry = GetCDBentry("TRD/Calib/trd_goofieCO2"))) goofieCO2Sensors = (AliTRDSensorArray*)entry->GetObject();
+
+      // goofie N2
+      if((entry = GetCDBentry("TRD/Calib/trd_goofieN2"))) goofieN2Sensors = (AliTRDSensorArray*)entry->GetObject();
+    }   // end if getGoofieInfo
+
+    // process the DCS FEE arrays
+    Int_t nSB1 = 0; Int_t nSB2 = 0; Int_t nSB3 = 0; Int_t nSB4 = 0; Int_t nSB5 = 0;
+    Int_t nChanged = 0;
+    Bool_t sorAndEor = kFALSE;
+    TVectorD statusArraySOR(AliTRDcalibDB::kNdet);
+    TVectorD statusArrayEOR(AliTRDcalibDB::kNdet);
+    Int_t dcsFeeGlobalNTimeBins = -1;
+    Int_t dcsFeeGlobalConfigTag = -1;
+    Int_t dcsFeeGlobalSingleHitThres = -1;
+    Int_t dcsFeeGlobalThreePadClustThres = -1;
+    Int_t dcsFeeGlobalSelectiveNoSZ = -1;
+    Int_t dcsFeeGlobalTCFilterWeight = -1;
+    Int_t dcsFeeGlobalTCFilterShortDecPar = -1;
+    Int_t dcsFeeGlobalTCFilterLongDecPar = -1;
+    Int_t dcsFeeGlobalModeFastStatNoise = -1;
+    TObjString dcsFeeGlobalConfigVersion("");
+    TObjString dcsFeeGlobalConfigName("");
+    TObjString dcsFeeGlobalFilterType("");
+    TObjString dcsFeeGlobalReadoutParam("");
+    TObjString dcsFeeGlobalTestPattern("");
+    TObjString dcsFeeGlobalTrackletMode("");
+    TObjString dcsFeeGlobalTrackletDef("");
+    TObjString dcsFeeGlobalTriggerSetup("");
+    TObjString dcsFeeGlobalAddOptions("");
+    if(getDCSInfo) {
+      TObjArray *objArrayCDB = 0;
+      AliTRDCalDCSv2* calDCSsor = 0x0;
+      AliTRDCalDCSv2* calDCSeor = 0x0;
+      if((entry = GetCDBentry("TRD/Calib/DCSv2"))) objArrayCDB = (TObjArray*)entry->GetObject();
+      if(objArrayCDB) {
+        objArrayCDB->SetOwner(kTRUE);
+        calDCSsor = (AliTRDCalDCSv2*)objArrayCDB->At(0);
+        calDCSeor = (AliTRDCalDCSv2*)objArrayCDB->At(1);
+
+        ProcessTRDCalDCSFEE(calDCSsor, calDCSeor,
+          nSB1, nSB2, nSB3, nSB4, nSB5,
+          nChanged, sorAndEor, statusArraySOR, statusArrayEOR);
+      }
+      if(calDCSsor || calDCSeor) {
+        AliTRDCalDCSv2 *caldcs = 0;
+        if(calDCSsor) caldcs = calDCSsor;
+        else caldcs = calDCSeor;
+        dcsFeeGlobalNTimeBins = caldcs->GetGlobalNumberOfTimeBins();
+        dcsFeeGlobalConfigTag = caldcs->GetGlobalConfigTag();
+        dcsFeeGlobalSingleHitThres = caldcs->GetGlobalSingleHitThres();
+        dcsFeeGlobalThreePadClustThres = caldcs->GetGlobalThreePadClustThres();
+        dcsFeeGlobalSelectiveNoSZ = caldcs->GetGlobalSelectiveNoZS();
+        dcsFeeGlobalTCFilterWeight = caldcs->GetGlobalTCFilterWeight();
+        dcsFeeGlobalTCFilterShortDecPar = caldcs->GetGlobalTCFilterShortDecPar();
+        dcsFeeGlobalTCFilterLongDecPar = caldcs->GetGlobalTCFilterLongDecPar();
+        dcsFeeGlobalModeFastStatNoise = caldcs->GetGlobalModeFastStatNoise();
+        dcsFeeGlobalConfigVersion = caldcs->GetGlobalConfigVersion().Data();
+        dcsFeeGlobalConfigName = caldcs->GetGlobalConfigName().Data();
+        dcsFeeGlobalFilterType = caldcs->GetGlobalFilterType().Data();
+        dcsFeeGlobalReadoutParam = caldcs->GetGlobalReadoutParam().Data();
+        dcsFeeGlobalTestPattern = caldcs->GetGlobalTestPattern().Data();
+        dcsFeeGlobalTrackletMode = caldcs->GetGlobalTrackletMode().Data();
+        dcsFeeGlobalTrackletDef = caldcs->GetGlobalTrackletDef().Data();
+        dcsFeeGlobalTriggerSetup = caldcs->GetGlobalTriggerSetup().Data();
+        dcsFeeGlobalAddOptions = caldcs->GetGlobalAddOptions().Data();
+      }
+      if(objArrayCDB) objArrayCDB->RemoveAll();
+    }   // end if(getDCSInfo)
+
+
+    // loop over time steps
+    for(UInt_t iTime = (getGRPInfo ? startTime : 0); iTime<=(getGRPInfo ? endTime : 0); iTime += (getGRPInfo ? dTime : 1)) {
+      // time stamp
+      TTimeStamp iStamp(iTime);
+      cout << "time step  " << iStamp.GetDate()/10000 << "/"
+      << (iStamp.GetDate()/100)-(iStamp.GetDate()/10000)*100 << "/"
+      << iStamp.GetDate()%100 << "   "
+      << iStamp.GetTime()/10000 << ":"
+      << (iStamp.GetTime()/100)-(iStamp.GetTime()/10000)*100 << ":"
+      << iStamp.GetTime()%100 << endl;
+
+      // cavern pressure
+      Float_t pressure = -99.;
+      Bool_t inside=kFALSE;
+      if(cavern_pressure) pressure = cavern_pressure->Eval(iStamp,inside);
+
+      // surface pressure
+      Float_t surfacePressure = -99.;
+      if(surface_pressure) surfacePressure = surface_pressure->Eval(iStamp,inside);
+
+      // anode I sensors
+      TVectorD anodeIValues(AliTRDcalibDB::kNdet);
+      if(anodeISensors) ProcessTRDSensorArray(anodeISensors, iStamp, anodeIValues);
+
+      // anode U sensors
+      TVectorD anodeUValues(AliTRDcalibDB::kNdet);
+      if(anodeUSensors) ProcessTRDSensorArray(anodeUSensors, iStamp, anodeUValues);
+
+      // drift I sensors
+      TVectorD driftIValues(AliTRDcalibDB::kNdet);
+      if(driftISensors) ProcessTRDSensorArray(driftISensors, iStamp, driftIValues);
+
+      // drift U sensors
+      TVectorD driftUValues(AliTRDcalibDB::kNdet);
+      if(driftUSensors) ProcessTRDSensorArray(driftUSensors, iStamp, driftUValues);
+
+      // chamber temperatures
+      TVectorD envTempValues(AliTRDcalibDB::kNdet);
+      if(temperatureSensors) ProcessTRDSensorArray(temperatureSensors, iStamp, envTempValues);
+
+      // chamber status sensors
+      TVectorD statusValues(AliTRDcalibDB::kNdet);
+      if(chamberStatusSensors) ProcessTRDSensorArray(chamberStatusSensors, iStamp, statusValues);
+
+      // gas overpressure
+      TVectorD overpressureValues(overpressureSensors ? overpressureSensors->NumSensors() : 0);
+      if(overpressureSensors) ProcessTRDSensorArray(overpressureSensors, iStamp, overpressureValues);
+
+      // gas CO2
+      TVectorD gasCO2Values(gasCO2Sensors ? gasCO2Sensors->NumSensors() : 0);
+      if(gasCO2Sensors) ProcessTRDSensorArray(gasCO2Sensors, iStamp, gasCO2Values);
+
+      // gas H2O
+      TVectorD gasH2OValues(gasH2OSensors ? gasH2OSensors->NumSensors() : 0);
+      if(gasH2OSensors) ProcessTRDSensorArray(gasH2OSensors, iStamp, gasH2OValues);
+
+      // gas O2
+      TVectorD gasO2Values(gasO2Sensors ? gasO2Sensors->NumSensors() : 0);
+      if(gasO2Sensors) ProcessTRDSensorArray(gasO2Sensors, iStamp, gasO2Values);
+
+      // ADC Clk phase
+      //TVectorD adcClkPhaseValues(adcClkPhaseSensors ? adcClkPhaseSensors->NumSensors() : 0);
+      //if(adcClkPhaseSensors) ProcessTRDSensorArray(adcClkPhaseSensors, iStamp, adcClkPhaseValues);
+
+      // goofie gain
+      TVectorD goofieGainValues(goofieGainSensors ? goofieGainSensors->NumSensors() : 0);
+      if(goofieGainSensors) ProcessTRDSensorArray(goofieGainSensors, iStamp, goofieGainValues);
+
+      // goofie HV
+      TVectorD goofieHvValues(goofieHvSensors ? goofieHvSensors->NumSensors() : 0);
+      if(goofieHvSensors) ProcessTRDSensorArray(goofieHvSensors, iStamp, goofieHvValues);
+
+      // goofie pressure
+      TVectorD goofiePressureValues(goofiePressureSensors ? goofiePressureSensors->NumSensors() : 0);
+      if(goofiePressureSensors) ProcessTRDSensorArray(goofiePressureSensors, iStamp, goofiePressureValues);
+
+      // goofie temperature
+      TVectorD goofieTempValues(goofieTempSensors ? goofieTempSensors->NumSensors() : 0);
+      if(goofieTempSensors) ProcessTRDSensorArray(goofieTempSensors, iStamp, goofieTempValues);
+
+      // goofie drift velocity
+      TVectorD goofieVelocityValues(goofieVelocitySensors ? goofieVelocitySensors->NumSensors() : 0);
+      if(goofieVelocitySensors) ProcessTRDSensorArray(goofieVelocitySensors, iStamp, goofieVelocityValues);
+
+      // goofie CO2
+      TVectorD goofieCO2Values(goofieCO2Sensors ? goofieCO2Sensors->NumSensors() : 0);
+      if(goofieCO2Sensors) ProcessTRDSensorArray(goofieCO2Sensors, iStamp, goofieCO2Values);
+
+      // goofie N2
+      TVectorD goofieN2Values(goofieN2Sensors ? goofieN2Sensors->NumSensors() : 0);
+      if(goofieN2Sensors) ProcessTRDSensorArray(goofieN2Sensors, iStamp, goofieN2Values);
+
+      // fill the tree
+      (*treeStreamer)<< "trdTree"
+          << "run=" << currRun
+          << "time=" << iTime
+          << "runType.=" << &runType;
+      if(getGRPInfo) {
+        (*treeStreamer)<< "trdTree"
+            << "startTimeGRP=" << startTime
+            << "endTimeGRP=" << endTime
+            << "cavernPressure=" << pressure
+            << "surfacePressure=" << surfacePressure
+            << "detectorMask=" << detectorMask;
+      }
+      if(getHVInfo) {
+        (*treeStreamer)<< "trdTree"
+            << "hvAnodeI.=" << &anodeIValues
+            << "hvAnodeU.=" << &anodeUValues
+            << "hvDriftI.=" << &driftIValues
+            << "hvDriftU.=" << &driftUValues;
+      }
+      if(getStatusInfo) {
+        (*treeStreamer)<< "trdTree"
+            << "sensorStatusValues.=" << &statusValues;
+      }
+      if(getGasInfo) {
+        (*treeStreamer)<< "trdTree"
+            << "envTemp.=" << &envTempValues
+            << "gasOverPressure.=" << &overpressureValues
+            << "gasCO2.=" << &gasCO2Values
+            << "gasH2O.=" << &gasH2OValues
+            << "gasO2.=" << &gasO2Values;
+            //<< "adcClkPhase.=" << &adcClkPhaseValues;
+      }
+      if(getGoofieInfo) {
+  (*treeStreamer)<< "trdTree"
+            << "goofieGain.=" << &goofieGainValues
+            << "goofieHV.=" << &goofieHvValues
+            << "goofiePressure.=" << &goofiePressureValues
+            << "goofieTemp.=" << &goofieTempValues
+            << "goofieVelocity.=" << &goofieVelocityValues
+            << "goofieCO2.=" << &goofieCO2Values
+            << "goofieN2.=" << &goofieN2Values;
+      }
+      if(getCalibrationInfo) {
+        (*treeStreamer)<< "trdTree"
+            << "runMeanGain=" << runMeanGain
+            << "runRMSGain=" << runRMSGain
+            << "smMeanGain.=" << &smMeanGain
+            << "smRMSGain.=" << &smRMSGain
+            << "chamberMeanGain.=" << &chamberMeanGain
+            << "chamberRMSGain.=" << &chamberRMSGain
+            << "runMeanNoise=" << runMeanNoise
+            << "runRMSNoise=" << runRMSNoise
+            << "smMeanNoise.=" << &smMeanNoise
+            << "smRMSNoise.=" << &smRMSNoise
+            << "chamberMeanNoise.=" << &chamberMeanNoise
+            << "chamberRMSNoise.=" << &chamberRMSNoise
+            << "runMeanVdrift=" << runMeanVdrift
+            << "runRMSVdrift=" << runRMSVdrift
+            << "smMeanVdrift.=" << &smMeanVdrift
+            << "smRMSVdrift.=" << &smRMSVdrift
+            << "chamberMeanVdrift.=" << &chamberMeanVdrift
+            << "chamberRMSVdrift.=" << &chamberRMSVdrift
+            << "runMeanT0=" << runMeanT0
+            << "runRMST0=" << runRMST0
+            << "smMeanT0.=" << &smMeanT0
+            << "smRMST0.=" << &smRMST0
+            << "chamberMeanT0.=" << &chamberMeanT0
+            << "chamberRMST0.=" << &chamberRMST0
+            << "runBadPadFraction=" << runBadPadFraction
+            << "chamberBadPadFraction.=" << &chamberBadPadFraction
+            << "chamberStatusValues.=" << &chamberStatusValues;
+      }
+      if(getDCSInfo) {
+        (*treeStreamer)<< "trdTree"
+            << "dcsFeeGlobalNTimeBins=" << dcsFeeGlobalNTimeBins
+            << "dcsFeeGlobalConfigTag=" << dcsFeeGlobalConfigTag
+            << "dcsFeeGlobalSingleHitThres=" << dcsFeeGlobalSingleHitThres
+            << "dcsFeeGlobalThreePadClustThres=" << dcsFeeGlobalThreePadClustThres
+            << "dcsFeeGlobalSelectiveNoSZ=" << dcsFeeGlobalSelectiveNoSZ
+            << "dcsFeeGlobalTCFilterWeight=" << dcsFeeGlobalTCFilterWeight
+            << "dcsFeeGlobalTCFilterShortDecPar=" << dcsFeeGlobalTCFilterShortDecPar
+            << "dcsFeeGlobalTCFilterLongDecPar=" << dcsFeeGlobalTCFilterLongDecPar
+            << "dcsFeeGlobalModeFastStatNoise=" << dcsFeeGlobalModeFastStatNoise
+    //              << "dcsFeeGlobalConfigVersion.=" << &dcsFeeGlobalConfigVersion
+    //              << "dcsFeeGlobalConfigName.=" << &dcsFeeGlobalConfigName
+    //              << "dcsFeeGlobalFilterType.=" << &dcsFeeGlobalFilterType
+    //              << "dcsFeeGlobalReadoutParam.=" << &dcsFeeGlobalReadoutParam
+    //              << "dcsFeeGlobalTestPattern.=" << &dcsFeeGlobalTestPattern
+    //              << "dcsFeeGlobalTrackletMode.=" << &dcsFeeGlobalTrackletMode
+    //              << "dcsFeeGlobalTrackletDef.=" << &dcsFeeGlobalTrackletDef
+    //              << "dcsFeeGlobalTriggerSetup.=" << &dcsFeeGlobalTriggerSetup
+    //              << "dcsFeeGlobalAddOptions.=" << &dcsFeeGlobalAddOptions
+            << "statusDCSFEESOR.=" << &statusArraySOR
+            << "statusDCSFEEEOR.=" << &statusArrayEOR
+            << "SORandEOR=" << sorAndEor
+            << "nChanged=" << nChanged
+            << "nSB1=" << nSB1
+            << "nSB2=" << nSB2
+            << "nSB3=" << nSB3
+            << "nSB4=" << nSB4
+            << "nSB5=" << nSB5;
+      }
+      (*treeStreamer)<< "trdTree"
+          << "\n";
+    }  // end loop over time steps
+
+    // add the run number to the list of runs
+    runs.ResizeTo(runs.GetNoElements()+1);
+    runs[runs.GetNoElements()-1] = currRun;
+
+    // do some cleaning
+    if(grpObject) delete grpObject;
+    if(anodeISensors) anodeISensors->Clear();
+    if(anodeUSensors) anodeUSensors->Clear();
+    if(driftISensors) driftISensors->Clear();
+    if(driftUSensors) driftUSensors->Clear();
+    if(temperatureSensors) temperatureSensors->Clear();
+    if(overpressureSensors) overpressureSensors->Clear();
+    if(gasCO2Sensors) gasCO2Sensors->Clear();
+    if(gasH2OSensors) gasH2OSensors->Clear();
+    if(gasO2Sensors) gasO2Sensors->Clear();
+    //if(adcClkPhaseSensors) adcClkPhaseSensors->Clear();
+    if(goofieGainSensors) goofieGainSensors->Clear();
+    if(goofieHvSensors) goofieHvSensors->Clear();
+    if(goofiePressureSensors) goofiePressureSensors->Clear();
+    if(goofieTempSensors) goofieTempSensors->Clear();
+    if(goofieVelocitySensors) goofieVelocitySensors->Clear();
+    if(goofieCO2Sensors) goofieCO2Sensors->Clear();
+    if(goofieN2Sensors) goofieN2Sensors->Clear();
+    if(chamberGainFactor) delete chamberGainFactor;
+    if(padGainFactor) delete padGainFactor;
+    if(chamberNoise) delete chamberNoise;
+    if(padNoise) delete padNoise;
+    if(chamberVdrift) delete chamberVdrift;
+    if(padVdrift) delete padVdrift;
+    if(chamberT0) delete chamberT0;
+    if(padT0) delete padT0;
+    if(chamberStatus) delete chamberStatus;
+    if(padStatus) delete padStatus;
+  } // end while (loop over runs)
+  TTimeStamp loopEndTime;
+
+  treeStreamer->GetFile()->cd();
+  runs.Write("runs");
+  delete treeStreamer;
+
+  // output some job informations
+  TTimeStamp jobEndTime;
+  cout << "=============================================" << endl;
+  cout << "Job launched at          :  " << jobStartTime.AsString() << endl;
+  cout << "Loop over runs started at:  " << loopStartTime.AsString() << endl;
+  cout << "Loop over runs ended at  :  " << loopEndTime.AsString() << endl;
+  cout << "Job ended at             :  " << jobEndTime.AsString() << endl;
+  cout << "Initialization duration  :  "
+        << loopStartTime.GetSec() - jobStartTime.GetSec() << " seconds" << endl;
+  cout << "Loop over runs duration  :  "
+        << loopEndTime.GetSec() - loopStartTime.GetSec() << " seconds" << endl;
+  cout << "Post loop                :  "
+        << jobEndTime.GetSec() - loopEndTime.GetSec() << " seconds" << endl;
+  cout << "Running time per processed run:  "
+        << (loopEndTime.GetSec()-loopStartTime.GetSec())/(runs.GetNoElements()>0 ? Double_t(runs.GetNoElements()) : 1.0)
+        << " sec./run" << endl;
+  cout << "Running time per input run:  "
+        << (loopEndTime.GetSec()-loopStartTime.GetSec())/((rejectedRuns.GetNoElements()+runs.GetNoElements())>0 ? Double_t(runs.GetNoElements()+rejectedRuns.GetNoElements()) : 1.0)
+        << " sec./run" << endl;
+
+  // print the runs that had problems
+  cout << "number of rejected runs: " << rejectedRuns.GetNoElements() << endl;
+  cout << "rejected run numbers" << endl;
+  cout << "********************" << endl;
+  for(Int_t iRun=0; iRun<rejectedRuns.GetNoElements(); iRun++) {
+    cout << rejectedRuns[iRun] << "    ";
+    if(iRun%10==0) cout << endl;
+  }
+  cout << "=============================================" << endl;
+  return;
+  }
+
+  //__________________________________________________________________________________________
+  void ProcessTRDSensorArray(AliTRDSensorArray *sensorArray, TTimeStamp timeStamp, TVectorD &values) {
+  // Fill a vector with sensor values for a given time stamp
+  // The sensor->Eval() method makes interpolation inside the covered time interval
+  // and returns the value at the closest time limit (start or end) outside the covered time range
+  AliDCSSensor *sensor;
+  Bool_t inside=kFALSE;
+  for(Int_t i=0; i<sensorArray->NumSensors(); i++) {
+    sensor = sensorArray->GetSensorNum(i);
+    if(sensor && sensor->GetGraph())
+      values[i] = sensor->Eval(timeStamp,inside);
+    else
+      values[i] = -99.;
+  }
+  return;
+  }
+
+  //__________________________________________________________________________________________
+  void ProcessTRDCalibArray(AliTRDCalDet* chamberCalib, AliTRDCalPad *padCalib,
+        TString parName,
+        Double_t &runValue, Double_t &runRMS,
+        TVectorD &chamberValues, TVectorD &chamberValuesRMS,
+        TVectorD &superModuleValues, TVectorD &superModuleValuesRMS) {
+  // Process the calibrations for a given run.
+  // Calculates the run and chamber wise averages
+  //
+
+  // check if the calibration parameter is multiplicative or additive
+  Bool_t multiplicative = kTRUE;
+  if(!parName.CompareTo("T0")) multiplicative = kFALSE;
+
+  // first iteration (calculate all averages and RMS without discrimination on the SM average)
+  gRunWiseHisto->Reset();
+  for(Int_t iSM = 0; iSM<AliTRDcalibDB::kNsector; iSM++) {   // loop over supermodules
+    // reset the super module histogram
+    gSuperModuleWiseHisto->Reset();
+    // check if SM is installed
+    if(!gkSuperModuleStatus[iSM]) continue;
+    for(Int_t iChamber=iSM*AliTRDcalibDB::kNstack*AliTRDcalibDB::kNlayer;
+  iChamber < (iSM+1)*AliTRDcalibDB::kNstack*AliTRDcalibDB::kNlayer;
+  iChamber++) {  // loop over chambers in this supermodule
+      // get the chamber value
+      Float_t chamberValue = chamberCalib->GetValue(iChamber);
+      // get the ROC object
+      AliTRDCalROC *chamberROC = padCalib->GetCalROC(iChamber);
+      if(!chamberROC)
+  continue;
+      gChamberWiseHisto->Reset();
+      for(Int_t iChannel = 0; iChannel < chamberROC->GetNchannels(); iChannel++){ // loop over channels
+  // calculate the calibration parameter for this pad
+  Float_t padValue;
+  if(multiplicative)
+    padValue = chamberValue * chamberROC->GetValue(iChannel);
+  else
+    padValue = chamberValue + chamberROC->GetValue(iChannel);
+  // fill the run, SM and chamber wise histograms
+  gChamberWiseHisto->Fill(padValue);
+  // if the parameter is Noise then check if the pad value is not a default one
+  // Default value is now 1.2!!!! Check with Raphaelle for more informations
+  if(parName.Contains("Noise") &&
+      TMath::Abs(padValue-1.2)<0.00001) continue;
+  gSuperModuleWiseHisto->Fill(padValue);
+  gRunWiseHisto->Fill(padValue);
+      }  // end loop over channels
+      // get the chamber wise mean and RMS
+      chamberValues[iChamber] = gChamberWiseHisto->GetMean();
+      chamberValuesRMS[iChamber] = gChamberWiseHisto->GetRMS();
+    }  // end loop over chambers
+    // SM wise mean and RMS
+    superModuleValues[iSM] = gSuperModuleWiseHisto->GetMean();
+    superModuleValuesRMS[iSM] = gSuperModuleWiseHisto->GetRMS();
+  }  // end loop over supermodules
+  // run wise mean and RMS
+  runValue = gRunWiseHisto->GetMean();
+  runRMS = gRunWiseHisto->GetRMS();
+
+  // Noise and Gain are finished processing
+  if(parName.Contains("Noise") || parName.Contains("Gain"))
+    return;
+  // second iteration (calculate SM and run wise averages and RMS for Vdrift and T0)
+  // The pads with calib parameter equal to the SM average are discarded (default value)
+  gRunWiseHisto->Reset();
+  for(Int_t iSM = 0; iSM<AliTRDcalibDB::kNsector; iSM++) {   // loop over supermodules
+    gSuperModuleWiseHisto->Reset();
+    // eliminate the uninstalled super modules
+    if(!gkSuperModuleStatus[iSM]) continue;
+    for(Int_t iChamber=iSM*AliTRDcalibDB::kNstack*AliTRDcalibDB::kNlayer;
+  iChamber < (iSM+1)*AliTRDcalibDB::kNstack*AliTRDcalibDB::kNlayer;
+  iChamber++) {  // loop over chambers
+      // the chamber value
+      Float_t chamberValue = chamberCalib->GetValue(iChamber);
+      AliTRDCalROC *chamberROC = padCalib->GetCalROC(iChamber);
+      if(!chamberROC)
+  continue;
+
+      for(Int_t iChannel = 0; iChannel < chamberROC->GetNchannels(); iChannel++){ // loop over channels in a chamber
+  // get the pad value
+  Float_t padValue;
+  if(multiplicative)
+    padValue = chamberValue * chamberROC->GetValue(iChannel);
+  else
+    padValue = chamberValue + chamberROC->GetValue(iChannel);
+  // eliminate from the average and RMS calculation all pads which
+  // have the calib parameter equal with the SM average
+  if((parName.Contains("Vdrift") || parName.Contains("T0")) &&
+      TMath::Abs(padValue-superModuleValues[iSM])<0.00001) continue;
+  gSuperModuleWiseHisto->Fill(padValue);
+  gRunWiseHisto->Fill(padValue);
+      }   // end loop over channels
+    }   // end loop over chambers
+    superModuleValues[iSM] = gSuperModuleWiseHisto->GetMean();
+    superModuleValuesRMS[iSM] = gSuperModuleWiseHisto->GetRMS();
+  }   // end loop over super modules
+  runValue = gRunWiseHisto->GetMean();
+  runRMS = gRunWiseHisto->GetRMS();
+  return;
+  }
+
+  //__________________________________________________________________________________________
+  void ProcessTRDstatus(AliTRDCalChamberStatus* chamberStatus, AliTRDCalPadStatus* padStatus,
+          Float_t &runBadPadFraction, TVectorD &chamberBadPadFraction,
+          TVectorD &chamberStatusValues) {
+  // Process the pad status. Calculates the fraction of pads with non 0 status
+  // run and chamber wise
+  //
+  Int_t runPadStatusNot0 = 0;
+  Int_t runPadStatusAll = 0;
+
+  Int_t superModuleStatus[18] = {1, 1, 0, 0, 0, 0, 0, 1, 1,
+          1, 1, 0, 0, 0, 0, 0, 0, 1};
+
+  // loop over chambers
+  for(Int_t iChamber=0; iChamber < AliTRDcalibDB::kNdet; iChamber++) {
+    // check if the chamber is in an installed sector;
+    Int_t sm = AliTRDgeometry::GetSector(iChamber);
+    if(!superModuleStatus[sm]) continue;
+
+    chamberStatusValues[iChamber] = chamberStatus->GetStatus(iChamber);
+    AliTRDCalSingleChamberStatus *singleChamberStatus = padStatus->GetCalROC(iChamber);
+    if(!singleChamberStatus)
+      continue;
+    Int_t chamberPadStatusNot0 = 0;
+    Int_t chamberPadStatusAll = 0;
+    // loop over channels in a chamber
+    for(Int_t iChannel = 0; iChannel < singleChamberStatus->GetNchannels(); iChannel++) {
+      if(singleChamberStatus->GetStatus(iChannel) > 0) {
+  chamberPadStatusNot0++;
+  runPadStatusNot0++;
+      }
+      chamberPadStatusAll++;
+      runPadStatusAll++;
+    }
+    chamberBadPadFraction[iChamber] = (chamberPadStatusAll>0 ?
+                Float_t(chamberPadStatusNot0)/Float_t(chamberPadStatusAll) : -99.);
+  }
+  runBadPadFraction = (runPadStatusAll>0 ? Float_t(runPadStatusNot0)/Float_t(runPadStatusAll) : -99.);
+  return;
+  }
+
+  //__________________________________________________________________________________________
+  void ProcessTRDCalDCSFEE(AliTRDCalDCSv2 *caldcsSOR, AliTRDCalDCSv2 *caldcsEOR,
+        Int_t &nsb1, Int_t &nsb2, Int_t &nsb3, Int_t &nsb4, Int_t &nsb5,
+        Int_t &nChanged, Bool_t &sorAndEor,
+        TVectorD &statusArraySOR, TVectorD &statusArrayEOR) {
+  //
+  // Process the DCS information
+  //
+  sorAndEor = kTRUE;
+  if(!caldcsSOR && !caldcsEOR) {
+    sorAndEor = kFALSE;
+    return;
+  }
+  else if(caldcsSOR && !caldcsEOR) {
+    sorAndEor = kFALSE;
+  }
+  else if(!caldcsSOR && caldcsEOR) {
+    caldcsSOR = caldcsEOR;
+    sorAndEor = kFALSE;
+  }
+
+  nsb1 = 0; nsb2 = 0; nsb3 = 0; nsb4 = 0; nsb5 = 0; nChanged = 0;
+  for(Int_t iROC=0; iROC<AliTRDcalibDB::kNdet && iROC<caldcsSOR->GetFEEArr()->GetSize(); iROC++) {
+    AliTRDCalDCSFEEv2 *dcsSorFee = caldcsSOR->GetCalDCSFEEObj(iROC);
+    AliTRDCalDCSFEEv2 *dcsEorFee = caldcsEOR->GetCalDCSFEEObj(iROC);
+    if(dcsSorFee) {
+      statusArraySOR[iROC] = dcsSorFee->GetStatusBit();
+      if(statusArraySOR[iROC] == 1) nsb1++;
+      if(statusArraySOR[iROC] == 2) nsb2++;
+      if(statusArraySOR[iROC] == 3) nsb3++;
+      if(statusArraySOR[iROC] == 4) nsb4++;
+      if(statusArraySOR[iROC] == 5) nsb5++;
+    }
+    if(dcsEorFee) {
+      statusArrayEOR[iROC] = dcsEorFee->GetStatusBit();
+    }
+    if(sorAndEor) {
+      if((statusArraySOR[iROC]-statusArrayEOR[iROC]) != 0) nChanged++;
+    }
+  }
+  return;
+  }
+
+  //__________________________________________________________________________________________
+  void MakeRunListFromOCDB(const Char_t* directory, const Char_t* outfile, Bool_t fromAlien) {
+  //
+  // For a given OCDB path dump the list of available run numbers
+  //
+  if(fromAlien)
+    gSystem->Exec(Form("alien_ls %s > temp.txt", directory));
+  else
+    gSystem->Exec(Form("ls %s > temp.txt", directory));
+
+  ifstream inBuffer("temp.txt");
+  if(!inBuffer.is_open()) {
+    cout << "File temp.txt not opened! Exiting" << endl;
+    return;
+  }
+  ofstream outBuffer(outfile);
+  if(!outBuffer.is_open()) {
+    cout << "File runList.txt cannot be opened! Exiting" << endl;
+    return;
+  }
+
+  while(!inBuffer.eof()) {
+    char inputLine[128];
+    inBuffer.getline(inputLine, 128, '\n');
+    int runLow, runHigh;
+    const char* tempLine = inputLine;
+    sscanf(tempLine, "Run%d_%d_v1_s0.root", &runLow, &runHigh);
+    outBuffer << runLow << endl;
+  }
+
+  inBuffer.close();
+  outBuffer.close();
+  gSystem->Exec("rm temp.txt");
+  return;
+  }
+
+  //__________________________________________________________________________________________
+  AliCDBEntry* GetCDBentry(const Char_t *path, Bool_t owner)
+  {
+  ::Info("GetCDBentry", Form("QUERY RUN [%d] for \"%s\".", currRun, path));
+  AliCDBEntry *entry(NULL);
+  storage->QueryCDB(currRun, path);
+  if(!storage->GetQueryCDBList()->GetEntries()){
+    ::Error("GetCDBentry", Form("Missing \"%s\" in run %d.", path, currRun));
+    return NULL;
+  } else entry = manager->Get(path);
+  if(!entry) return NULL;
+
+  entry->SetOwner(owner);
+  ::Info("GetCDBentry", Form("FOUND ENTRY @ [%p].", (void*)entry));
+  return entry;
+  }
index bf58800..1e0b234 100644 (file)
@@ -43,6 +43,8 @@
 #pragma link C++ class  AliTRDCalDet+;
 #pragma link C++ class  AliTRDCalDCS+;
 #pragma link C++ class  AliTRDCalDCSFEE+;
+#pragma link C++ class  AliTRDCalDCSv2+;
+#pragma link C++ class  AliTRDCalDCSFEEv2+;
 #pragma link C++ class  AliTRDCalDCSPTR+;
 #pragma link C++ class  AliTRDCalDCSGTUBoardInfo+;
 #pragma link C++ class  AliTRDCalDCSGTUCtpOpc+;
index 515cc77..3087767 100644 (file)
@@ -22,6 +22,8 @@ SRCS= AliTRDarraySignal.cxx \
       Cal/AliTRDCalDet.cxx \
       Cal/AliTRDCalDCS.cxx \
       Cal/AliTRDCalDCSFEE.cxx \
+      Cal/AliTRDCalDCSv2.cxx \
+      Cal/AliTRDCalDCSFEEv2.cxx \
       Cal/AliTRDCalDCSPTR.cxx \
       Cal/AliTRDCalDCSGTUBoardInfo.cxx \
       Cal/AliTRDCalDCSGTUCtpOpc.cxx \