From: alla Date: Fri, 23 Nov 2007 19:28:52 +0000 (+0000) Subject: bug fixed X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=8bfd9a3e4b45c6a5c625efaf974ad803930506b6;hp=2962b5f7855ddff293644216c44010c102cd408e bug fixed --- diff --git a/T0/AliT0CalibTimeEq.cxx b/T0/AliT0CalibTimeEq.cxx index ab785610107..128af62bd2e 100644 --- a/T0/AliT0CalibTimeEq.cxx +++ b/T0/AliT0CalibTimeEq.cxx @@ -107,19 +107,22 @@ void AliT0CalibTimeEq::Print(Option_t*) const //________________________________________________________________ -void AliT0CalibTimeEq::ComputeOnlineParams(char* name1, char* name2, char* canv, Int_t npeaks, Double_t sigma) +void AliT0CalibTimeEq::ComputeOnlineParams(char* name1, char* name2, char* canv, Int_t npeaks, Double_t sigma, const char* filePhys) { - TFile *gFile = TFile::Open("daq1Phys.root"); + TFile *gFile = TFile::Open(filePhys); gSystem->Load("libSpectrum"); npeaks = 20; sigma=3.; Bool_t down=false; Int_t index[20]; + TCanvas *c1 = new TCanvas(canv, canv,0,48,1280,951); + c1->Divide(4,3); Char_t buf1[15]; Char_t temp[10]; Float_t p[12][3]={0.,0.,0.}; for (Int_t i=12; i<24; i++) { + c1->cd(i+1); sprintf(buf1,name1); sprintf(temp,"%i",i+1); strcat (buf1,temp); @@ -136,18 +139,27 @@ void AliT0CalibTimeEq::ComputeOnlineParams(char* name1, char* name2, char* canv, cfd->GetXaxis()->SetRange((Int_t)hmin-20,(Int_t)hmax+20); TF1 *g1 = new TF1("g1", "gaus", hmin, hmax); cfd->Fit("g1","IR"); - - for(Int_t j =0; j<3; j++){ + + for(Int_t j =0; j<3; j++){ p[i][j] = g1->GetParameter(j); SetCFDvalue(i, j, p[i][j]); - } - SetCFDvalue(i, 3, hmin); - SetCFDvalue(i, 4, hmax); - SetTimeEq(i,p[i][2]); - } + } + SetCFDvalue(i, 3, hmin); + SetCFDvalue(i, 4, hmax); + SetTimeEq(i,p[i][2]); + // if(p[i][0]==0) + // cfd->Draw(); + + // cfd->Draw(); + } // else + // cfd->Draw(); } - gFile->Close(); + // TFile *onl = new TFile("onl.root","RECREATE"); + // this->Write("Values"); + // onl->Close(); + // delete onl; + gFile->Close(); delete gFile; } - + diff --git a/T0/AliT0CalibTimeEq.h b/T0/AliT0CalibTimeEq.h index d5a2a2b15d3..51fea499d19 100644 --- a/T0/AliT0CalibTimeEq.h +++ b/T0/AliT0CalibTimeEq.h @@ -26,14 +26,14 @@ class AliT0CalibTimeEq: public TNamed { void SetTimeDelayTVD(Int_t r=150) { fTimeDelayTVD = r; }; Float_t GetTimeDelayTVD() { return fTimeDelayTVD; } - void ComputeOnlineParams(char* name1, char* name2, char* canv, Int_t npeaks, Double_t sigma); + void ComputeOnlineParams(char* name1, char* name2, char* canv, Int_t npeaks, Double_t sigma, const char* filePhys); Float_t GetCFDvalue(Int_t channel,Int_t number) const {return fCFDvalue[channel][number];} Float_t* GetCFDvalue() const {return (float*)fCFDvalue;} Float_t GetTimeEq(Int_t channel) const {return fTimeEq[channel];} Float_t* GetTimeEq() const {return (float*)fTimeEq;} void SetCFDvalue(Int_t channel, Int_t number, Float_t val) {fCFDvalue[channel][number]=val;} void SetTimeEq(Int_t channel, Float_t val) {fTimeEq[channel]=val;} - + protected: diff --git a/T0/AliT0Preprocessor.cxx b/T0/AliT0Preprocessor.cxx index ace6b789b57..c9ed6672851 100644 --- a/T0/AliT0Preprocessor.cxx +++ b/T0/AliT0Preprocessor.cxx @@ -45,8 +45,7 @@ Preliminary test version (T.Malkiewicz) ClassImp(AliT0Preprocessor) //____________________________________________________ -AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle), -fData(0) +AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle), fData(0) { //constructor } @@ -83,20 +82,18 @@ UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap ) Bool_t resultDCSStore=kFALSE; Bool_t resultLaser=kFALSE; Bool_t resultOnline=kFALSE; - - // processing DCS - - if(!dcsAliasMap) - { - Log("No DCS input data"); - return 1; - } - else - { - resultDCSMap=fData->ProcessData(*dcsAliasMap); - if(!resultDCSMap) - { - Log("Error when processing DCS data"); + + if(!dcsAliasMap) + { + Log("No DCS input data"); + return 1; + } + else + { + resultDCSMap=fData->ProcessData(*dcsAliasMap); + if(!resultDCSMap) + { + Log("Error when processing DCS data"); return 2;// return error Code for processed DCS data not stored } else @@ -108,121 +105,90 @@ UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap ) AliInfo("Storing DCS Data"); resultDCSStore = Store("Calib","DCSData",fData, &metaDataDCS); if (!resultDCSStore) - { + { Log("Some problems occurred while storing DCS data results in ReferenceDB"); return 2;// return error Code for processed DCS data not stored } - - } - } - // processing DAQ + } + } + + // processing DAQ - TString runType = GetRunType(); + TString runType = GetRunType(); - if(runType == "T0_STANDALONE_LASER") - { - TList* list = GetFileSources(kDAQ, "LASER"); + if(runType == "T0_STANDALONE_LASER") + { + TList* list = GetFileSources(kDAQ, "LASER"); if (list) { TIter iter(list); TObjString *source; - while ((source = dynamic_cast (iter.Next()))) + while ((source = dynamic_cast (iter.Next()))) { const char *laserFile = GetFile(kDAQ, "LASER", source->GetName()); if (laserFile) { Log(Form("File with Id TIME found in source %s!", source->GetName())); - AliT0CalibWalk *laser = new AliT0CalibWalk(); - // laser->Reset(); - laser->MakeWalkCorrGraph(laserFile); - AliCDBMetaData metaData; + AliT0CalibWalk *laser = new AliT0CalibWalk(); + // laser->Reset(); + laser->MakeWalkCorrGraph(laserFile); + AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("Tomek&Michal"); metaData.SetComment("Walk correction from laser runs."); resultLaser = Store("Calib","Data", laser, &metaData); delete laser; - } + } else { - Log(Form("Could not find file with Id TIME in source %s!", source->GetName())); + Log(Form("Could not find file with Id LASER in source %s!", source->GetName())); return 1; } } if (!resultLaser) - { + { Log("No Laser Data stored"); return 3;//return error code for failure in storing Laser Data } - } - } - else if(runType == "PHYSICS") - { - AliT0CalibTimeEq *online = new AliT0CalibTimeEq(); - online->Reset(); - online->ComputeOnlineParams("CFD13-CFD","", "c1", 20, 1.); - AliCDBMetaData metaData; - metaData.SetBeamPeriod(0); - metaData.SetResponsible("Tomek&Michal"); - metaData.SetComment("Time equalizing result."); - - resultOnline = Store("Calib","Data", online, &metaData); - delete online; - if (!resultOnline) + } + } + else if(runType == "PHYSICS") + { + TList* listPhys = GetFileSources(kDAQ, "LASER"); + if (listPhys) + { + TIter iter(listPhys); + TObjString *sourcePhys; + while ((sourcePhys = dynamic_cast (iter.Next()))) + { + const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName()); + if (filePhys) + { + AliT0CalibTimeEq *online = new AliT0CalibTimeEq(); + online->Reset(); + online->ComputeOnlineParams("CFD13-CFD","", "c1", 20, 1., filePhys); + AliCDBMetaData metaData; + metaData.SetBeamPeriod(0); + metaData.SetResponsible("Tomek&Michal"); + metaData.SetComment("Time equalizing result."); + resultOnline = Store("Calib","Data", online, &metaData); + delete online; + } + else + { + Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName())); + return 1; + } + } + if (!resultOnline) { Log("No Laser Data stored"); return 4;//return error code for failure in storing OCDB Data } - - } - - -/* commented for testing, TM 22.11.2007 - - while ((source = dynamic_cast (iter.Next()))) - { - const char* TimefileName = GetFile(kDAQ, "TIME", source->GetName()); - if (TimefileName) - { - Log(Form("File with Id TIME found in source %s!", source->GetName())); - TFile *file = TFile::Open(TimefileName); - if(!file || !file->IsOpen()) - { - Log(Form("Error opening file with Id TIME from source %s!", source->GetName())); - return 1; - } - AliT0Dqclass *tempdata = dynamic_cast (file->Get("Time")); - if (!tempdata) - { - Log("Could not find key \"Time\" in DAQ file!"); - return 1; - } - for(Int_t i=0;i<24;i++) - { - numbers[i] = tempdata->GetTime(i); - // printf("\nnumbers: %f\n",numbers[i]); - } - file->Close(); - delete tempdata; - } - else - { - Log(Form("Could not find file with Id TIME in source %s!", source->GetName())); - return 1; - } - // calibdata->SetTime(numbers, hv); - // calibdata->Print(); - // calibdata->FitGauss(); - } - } - else - { - Log("No sources for Id TIME found!"); - } - -*/ + } + } return 0; } - diff --git a/T0/AliT0Preprocessor.h b/T0/AliT0Preprocessor.h index a2f599eb26d..d0e028bc29c 100644 --- a/T0/AliT0Preprocessor.h +++ b/T0/AliT0Preprocessor.h @@ -22,6 +22,7 @@ class AliT0Preprocessor: public AliPreprocessor virtual UInt_t Process(TMap* dcsAliasMap); private: + //AliT0Calc *fData; AliT0DataDCS *fData; ClassDef(AliT0Preprocessor, 1) };