X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCSensorTempArray.cxx;h=b1dda2c40cb8946f05dd1bcefbbbabbc65fa103a;hb=73ce6137cfeffee5a66c4f0bb6480c8969f91431;hp=b661daedb3f25a662c4e168a207c2ad365d54316;hpb=24938b4c192051224fc7c8ac1a0fad71ac659c03;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCSensorTempArray.cxx b/TPC/AliTPCSensorTempArray.cxx index b661daedb3f..b1dda2c40cb 100644 --- a/TPC/AliTPCSensorTempArray.cxx +++ b/TPC/AliTPCSensorTempArray.cxx @@ -22,6 +22,11 @@ /////////////////////////////////////////////////////////////////////////////// #include "AliTPCSensorTempArray.h" +#include "TLinearFitter.h" +#include "TVectorD.h" +#include "AliLog.h" + + ClassImp(AliTPCSensorTempArray) @@ -51,27 +56,28 @@ AliTPCSensorTempArray::AliTPCSensorTempArray(Int_t run) : AliDCSSensorArray() } //_____________________________________________________________________________ AliTPCSensorTempArray::AliTPCSensorTempArray(UInt_t startTime, UInt_t endTime, - TTree* confTree) + TTree* confTree, const TString& amandaString) :AliDCSSensorArray() { // // AliTPCSensorTempArray constructor for Shuttle preprocessor // (confTree read from OCDB) // - fSensors = AliTPCSensorTemp::ReadTree(confTree); + fSensors = AliTPCSensorTemp::ReadTree(confTree,amandaString); fSensors->BypassStreamer(kFALSE); - fStartTime = TTimeStamp(startTime); - fEndTime = TTimeStamp(endTime); + fStartTime = TTimeStamp((time_t)startTime,0); + fEndTime = TTimeStamp((time_t)endTime,0); } //_____________________________________________________________________________ -AliTPCSensorTempArray::AliTPCSensorTempArray(const char *fname) : +AliTPCSensorTempArray::AliTPCSensorTempArray(const char *fname, + const TString& amandaString) : AliDCSSensorArray() { // // AliTPCSensorTempArray constructor // - fSensors = AliTPCSensorTemp::ReadList(fname); + fSensors = AliTPCSensorTemp::ReadList(fname,amandaString); fSensors->BypassStreamer(kFALSE); } @@ -100,28 +106,22 @@ AliTPCSensorTempArray &AliTPCSensorTempArray::operator=(const AliTPCSensorTempAr // // Assignment operator // - - if (this != &c) ((AliTPCSensorTempArray &) c).Copy(*this); + if (this != &c) { + fSensors->Delete(); + new (this) AliTPCSensorTempArray(c); + fSensors = (TClonesArray*)c.fSensors->Clone(); + } return *this; - } -//_____________________________________________________________________________ -void AliTPCSensorTempArray::Copy(TObject &c) const -{ - // - // Copy function - // - TObject::Copy(c); -} //_____________________________________________________________________________ -void AliTPCSensorTempArray::ReadSensors(const char *dbEntry) +void AliTPCSensorTempArray::ReadSensors(const char *dbEntry) { // // Read list of temperature sensors from text file // - AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry); + AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry); TTree *tree = (TTree*) entry->GetObject(); fSensors = AliTPCSensorTemp::ReadTree(tree); @@ -153,3 +153,41 @@ AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t IdDCS){ AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){ return dynamic_cast(AliDCSSensorArray::GetSensor(x,y,z)); } +//_____________________________________________________________________________ + +Double_t AliTPCSensorTempArray::GetTempGradientY(UInt_t timeSec, Int_t side){ + // + // Extract Linear Vertical Temperature Gradient [K/cm] within the TPC on + // Shaft Side(A): 0 + // Muon Side(C): 1 + // Values based on TemperatureSensors within the TPC (type: 3(TPC)) + // + // FIXME: Also return residual-distribution, covariance Matrix + // or simply chi2 for validity check? + // + + TLinearFitter fitter(3,"x0++x1++x2"); + TVectorD param(3); + Int_t i = 0; + + Int_t nsensors = fSensors->GetEntries(); + for (Int_t isensor=0; isensorAt(isensor); + + if (entry->GetType()==3 && entry->GetSide()==side) { // take SensorType:TPC + Double_t x[3]; + x[0]=1; + x[1]=entry->GetX(); + x[2]=entry->GetY(); + Double_t y = entry->GetValue(timeSec); // get temperature value + fitter.AddPoint(x,y,1); // add values to LinearFitter + i++; + } + + } + fitter.Eval(); + fitter.GetParameters(param); + + return param[2]; // return vertical (Y) tempGradient + + }