/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // // class for T0 calibration TM-AC-AM_6-02-2006 // // // /////////////////////////////////////////////////////////////////////////////// #include "AliT0CalibData.h" #include "AliT0LookUpValue.h" #include "AliLog.h" #include #include #include #include #include #include #include #include #include #include #include ClassImp(AliT0CalibData) //________________________________________________________________ AliT0CalibData::AliT0CalibData(): TNamed() { // } //________________________________________________________________ AliT0CalibData::AliT0CalibData(const char* name):TNamed(),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec() { TString namst = "Calib_"; namst += name; SetName(namst.Data()); SetTitle(namst.Data()); } //________________________________________________________________ AliT0CalibData::AliT0CalibData(const AliT0CalibData& calibda) : TNamed(calibda),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec() { // copy constructor SetName(calibda.GetName()); SetTitle(calibda.GetName()); } //________________________________________________________________ AliT0CalibData &AliT0CalibData::operator =(const AliT0CalibData& calibda) { // assignment operator SetName(calibda.GetName()); SetTitle(calibda.GetName()); return *this; } //________________________________________________________________ AliT0CalibData::~AliT0CalibData() { // } //________________________________________________________________ void AliT0CalibData::Reset() { memset(fTimeDelayCFD,1,24*sizeof(Float_t)); memset(fTimeDelayLED,1,24*sizeof(Float_t)); } //________________________________________________________________ void AliT0CalibData::Print(Option_t*) const { printf("\n ---- PM Arrays ----\n\n"); printf(" Time delay CFD & LED\n"); for (Int_t i=0; i<24; i++) printf(" CFD %f LED %f ",fTimeDelayCFD[i], fTimeDelayLED[i]); } //________________________________________________________________ void AliT0CalibData::PrintLookup(Option_t*, Int_t iTRM, Int_t iTDC, Int_t iChannel) const { AliT0LookUpKey* lookkey= new AliT0LookUpKey(); AliT0LookUpValue* lookvalue= new AliT0LookUpValue(); cout<<" Number Of TRMs in setup "<SetTRM(iTRM); lookvalue->SetTDC(iTDC); lookvalue->SetChain(0); lookvalue->SetChannel(iChannel); printf(" AliT0CalibData::PrintLookup ::start GetValue %i %i %i \n",iTRM, iTDC, iChannel); lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue); cout<<" AliT0CalibData::PrintLookup :: lookkey "<< lookkey<GetKey()<<" VALUE "<GetTRM()<<" " <GetTDC()<<" " << lookvalue->GetChain()<<" " <GetChannel()<ExpandPathName("$ALICE_ROOT/T0/data/CFD-Amp.txt"); ifstream inFile(filename); if(!inFile) AliError(Form("Cannot open file %s !",filename)); Int_t i=0; while(getline(inFile,buffer)){ inFile >> ps >> mv; x[i]=ps; y[i]=mv; i++; } inFile.close(); cout<<" number of data "<0) time[isum] = Float_t (sum/(iin)); else time[isum] =Float_t (x[ind]); amplitude[isum] = Float_t (amp); amp=y[ind]; // cout<ExpandPathName("$ALICE_ROOT/T0/data/CFD-LED.txt"); ifstream inFile(filename); if(!inFile) {AliError(Form("Cannot open file %s !",filename));} inFile >> mv>>ps; Int_t i=0; while(getline(inFile,buffer)){ x[i]=mv; y[i]=ps; inFile >> mv >> ps; i++; } inFile.close(); TGraph* gr = new TGraph(i,x,y); fSlewingLED.AddAtAndExpand(gr,ipmt); } //________________________________________________________________ void AliT0CalibData::SetSlewingRec(Int_t ipmt) { Float_t mv, ps; Float_t x[100], y[100]; string buffer; const char * filename = gSystem->ExpandPathName("$ALICE_ROOT/T0/data/CFD-LED.root"); ifstream inFile(filename); if(!inFile) {AliError(Form("Cannot open file %s !",filename));} inFile >> mv>>ps; Int_t i=0; while(getline(inFile,buffer)){ x[i]=mv; y[i]=ps; inFile >> mv >> ps; i++; } inFile.close(); Float_t y1[100], x1[100]; for (Int_t ir=0; irSetTRM(trm); lookvalue->SetTDC(tdc); lookvalue->SetChain(chain); lookvalue->SetChannel(channel); lookkey->SetKey(ik); if(ik>53) { trm=1; tdc=0; channel=0;} if (channel<7) channel +=2; else {channel = 0; tdc++;} } } Char_t varname[11]; Int_t ntrms; if(lookup) { lookup>>ntrms; cout<<" !!!!!!! ntrms "<>varname>>key>>trm>>chain>>tdc>>channel; lookvalue->SetTRM(trm); lookvalue->SetTDC(tdc); lookvalue->SetChain(chain); lookvalue->SetChannel(channel); lookkey->SetKey(key); cout<<"lookup "<GetKey(); }