+//_____________________________________________________________________________
+AliDCSSensor* AliDCSSensorArray::GetSensorNum(Int_t ind)
+{
+ //
+ // Return sensor given by array index
+ //
+ return (AliDCSSensor*)fSensors->At(ind);
+}
+
+//_____________________________________________________________________________
+Int_t AliDCSSensorArray::SetSensor(const TString& stringID,
+ const AliDCSSensor& sensor)
+{
+ //
+ // Update sensor information for sensor specified by stringID
+ //
+ Int_t nsensors = fSensors->GetEntries();
+ for (Int_t isensor=0; isensor<nsensors; isensor++) {
+ AliDCSSensor *entry = (AliDCSSensor*)fSensors->At(isensor);
+ if (entry->GetStringID() == stringID)
+ {
+ new ((*fSensors)[isensor])AliDCSSensor(sensor);
+ return isensor;
+ }
+ }
+ return -1;
+}
+//_____________________________________________________________________________
+void AliDCSSensorArray::SetSensorNum(const Int_t ind, const AliDCSSensor& sensor)
+{
+ //
+ // Update sensor information for sensor at index ind
+ //
+ new ((*fSensors)[ind])AliDCSSensor(sensor);
+ return;
+}
+//_____________________________________________________________________________
+void AliDCSSensorArray::RemoveSensorNum(Int_t ind)
+{
+ //
+ // Return sensor given by array index
+ //
+
+ delete fSensors->RemoveAt(ind);
+ fSensors->Compress();
+}
+//_____________________________________________________________________________
+void AliDCSSensorArray::RemoveSensor(Int_t IdDCS)
+{
+ //
+ // Deletes Sensor by given IdDCS
+ //
+
+ Int_t nsensors = fSensors->GetEntries();
+ for (Int_t isensor=0; isensor<nsensors; isensor++) { // loop over sensors
+ AliDCSSensor *entry = (AliDCSSensor*)fSensors->At(isensor);
+ if (entry->GetIdDCS()==IdDCS) {
+ delete fSensors->RemoveAt(isensor);
+ break;
+ }
+ }
+ fSensors->Compress();
+}
+//_____________________________________________________________________________
+TArrayI AliDCSSensorArray::OutsideThreshold(Double_t threshold, UInt_t timeSec, Bool_t below) const
+{
+ //
+ // Return sensors with values outside threshold at time defined by second
+ // parameter
+ // By default sensors with values below threshold are listed, if third
+ // parameter is set to kFALSE sensors with values above threshold are listed
+ //
+ Int_t nsensors = fSensors->GetEntries();
+ TArrayI array(nsensors);
+ Int_t outside=0;
+ for (Int_t isensor=0; isensor<nsensors; isensor++) { // loop over sensors
+ AliDCSSensor *entry = (AliDCSSensor*)fSensors->At(isensor);
+ Double_t val=entry->GetValue(timeSec);
+ if (below) {
+ if (val<threshold) array[outside++] = entry->GetIdDCS();
+ } else {
+ if (val>threshold) array[outside++] = entry->GetIdDCS();
+ }
+ }
+ array.Set(outside);
+ return array;
+}
+
+//_____________________________________________________________________________
+Int_t AliDCSSensorArray::GetFirstIdDCS() const
+{
+ //
+ // Return DCS Id of first sensor
+ //
+ if ( fSensors != 0 ) {
+ return ((AliDCSSensor*)fSensors->At(0))->GetIdDCS();
+ } else {
+ return 0;
+ }
+}
+
+//_____________________________________________________________________________
+Int_t AliDCSSensorArray::GetLastIdDCS() const
+{
+ //
+ // Return DCS Id of last sensor
+ //
+ if ( fSensors != 0 ) {
+ Int_t last = fSensors->GetEntries();
+ return ((AliDCSSensor*)fSensors->At(last-1))->GetIdDCS();
+ } else {
+ return 0;
+ }
+}
+//_____________________________________________________________________________
+void AliDCSSensorArray::ClearGraph()
+{
+ //
+ // Delete DCS graphs from all sensors in array
+ //
+
+ Int_t nsensors = fSensors->GetEntries();
+ for ( Int_t isensor=0; isensor<nsensors; isensor++) {
+ AliDCSSensor *sensor = (AliDCSSensor*)fSensors->At(isensor);
+ TGraph *gr = sensor->GetGraph();
+ if ( gr != 0 ) {
+ delete gr;
+ gr = 0;
+ }
+ sensor->SetGraph(0);
+ }
+}
+//_____________________________________________________________________________
+void AliDCSSensorArray::ClearFit()
+{
+ //
+ // Delete spline fits from all sensors in array
+ //
+
+ Int_t nsensors = fSensors->GetEntries();
+ for ( Int_t isensor=0; isensor<nsensors; isensor++) {
+ AliDCSSensor *sensor = (AliDCSSensor*)fSensors->At(isensor);
+ AliSplineFit *fit = sensor->GetFit();
+ if ( fit != 0 ) {
+ delete fit;
+ fit = 0;
+ }
+ sensor->SetFit(0);
+ }
+}
+//_____________________________________________________________________________
+void AliDCSSensorArray::AddSensors(AliDCSSensorArray *newSensors)
+{
+ //
+ // add sensors from two sensor arrays
+ //
+
+ Int_t numNew = newSensors->NumSensors();
+ Int_t numOld = fSensors->GetEntries();
+ fSensors->Expand(numOld+numNew);
+ for (Int_t i=0;i<numNew;i++) {
+ AliDCSSensor *sens = newSensors->GetSensorNum(i);
+ new ((*fSensors)[numOld+i]) AliDCSSensor(*sens);
+ }
+}
+