Store DCS identification string for each sensor. Read Config entry from OCDB (Haavard)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Jun 2007 21:55:59 +0000 (21:55 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Jun 2007 21:55:59 +0000 (21:55 +0000)
STEER/AliDCSSensor.cxx
STEER/AliDCSSensor.h

index fe3c456..6638516 100644 (file)
@@ -47,6 +47,7 @@ const Double_t kSecInHour = 3600.; // seconds in one hour
 AliDCSSensor::AliDCSSensor():
   fId(),
   fIdDCS(0),
+  fStringID(),
   fStartTime(0),
   fEndTime(0),
   fGraph(0),
@@ -64,6 +65,7 @@ AliDCSSensor::AliDCSSensor(const AliDCSSensor& source) :
    TNamed(source),
    fId(source.fId),
    fIdDCS(source.fIdDCS),
+   fStringID(source.fStringID),
    fStartTime(source.fStartTime),
    fEndTime(source.fEndTime),
    fGraph(source.fGraph),
@@ -155,4 +157,46 @@ TGraph* AliDCSSensor::MakeGraph(Int_t nPoints) const
   return graph;
 }
 
+//_____________________________________________________________________________
+
+TClonesArray * AliDCSSensor::ReadTree(TTree* tree) {
+  //
+  // read values from ascii file
+  //
+  
+  Int_t nentries = tree->GetEntries();
+  
+  char stringId[100];
+  Int_t num=0;
+  Int_t idDCS=0;
+  Double_t x=0;
+  Double_t y=0;
+  Double_t z=0;
+
+  tree->SetBranchAddress("StringID",&stringId);
+  tree->SetBranchAddress("IdDCS",&idDCS);
+  tree->SetBranchAddress("Num",&num);
+  tree->SetBranchAddress("X",&x);
+  tree->SetBranchAddress("Y",&y);
+  tree->SetBranchAddress("Z",&z);
+
+  // firstSensor = (Int_t)tree->GetMinimum("ECha");
+  // lastSensor = (Int_t)tree->GetMaximum("ECha");
+
+  TClonesArray * array = new TClonesArray("AliDCSSensor",nentries);
+   printf ("nentries = %d\n",nentries);
+
+  for (Int_t isensor=0; isensor<nentries; isensor++){
+    AliDCSSensor * sens = new ((*array)[isensor])AliDCSSensor;
+    tree->GetEntry(isensor);
+    sens->SetId(isensor);
+    sens->SetIdDCS(idDCS);
+    sens->SetStringID(TString(stringId));
+    sens->SetX(x);
+    sens->SetY(y);
+    sens->SetZ(z);
+
+  }
+  return array;
+}
 
index 072e675..09b3a92 100644 (file)
@@ -38,6 +38,7 @@ public:
   
   Int_t       GetId()     const {return fId;     }
   Int_t       GetIdDCS()  const {return fIdDCS;     }
+  const TString& GetStringID() const {return fStringID; }
   
   Double_t    GetX()              const {return fX;      }
   Double_t    GetY()              const {return fY;      }
@@ -52,6 +53,7 @@ public:
 
   void SetId     (Int_t id)        {fId     = id;    }
   void SetIdDCS  (Int_t iddcs)     {fIdDCS  = iddcs;    }
+  void SetStringID (const TString& stringID)  {fStringID = stringID; }
   
   void SetX       (Double_t x)       {fX     = x;      }
   void SetY       (Double_t y)       {fY     = y;      }
@@ -67,15 +69,13 @@ public:
   Double_t GetValue(TTimeStamp time);
   Double_t Eval(const TTimeStamp& time) const;
   TGraph *MakeGraph (Int_t nPoints=100) const;
+  static TClonesArray *  ReadTree(TTree *tree);
   
-  
-//  static TClonesArray * ReadList(const char *fname);
-//  static TClonesArray * ReadListInd(const char *fname,
-//                                 Int_t& firstSensor, Int_t& lastSensor);
 
 protected:
-  Int_t fId;        // Internal number of sensor id  (array index)
-  Int_t fIdDCS;     // ID number in DCS
+  Int_t fId;         // Internal number of sensor id  (array index)
+  Int_t fIdDCS;      // ID number in DCS
+  TString  fStringID; // Amanda String ID
   UInt_t   fStartTime;  // start time for DCS map/fit
   UInt_t   fEndTime;    // end time for DCS map/fit
   TGraph * fGraph;      // graph with values
@@ -84,6 +84,7 @@ protected:
   Double_t fY;      //Y-position of the sensor
   Double_t fZ;      //Z-position of the sensor
 
-  ClassDef(AliDCSSensor,2);
+  ClassDef(AliDCSSensor,3);
 };
 #endif
+