1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for T0 calibration TM--AM_6-02-2006 //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliT0CalibData.h"
25 #include "AliT0LookUpValue.h"
26 #include "AliT0LookUpKey.h"
29 #include <Riostream.h>
34 ClassImp(AliT0CalibData)
36 //________________________________________________________________
37 AliT0CalibData::AliT0CalibData(): TNamed(),
45 //________________________________________________________________
46 AliT0CalibData::AliT0CalibData(const char* name):TNamed(),
50 TString namst = "Calib_";
52 SetName(namst.Data());
53 SetTitle(namst.Data());
57 //________________________________________________________________
58 AliT0CalibData::AliT0CalibData(const AliT0CalibData& calibda) :
65 SetName(calibda.GetName());
66 SetTitle(calibda.GetName());
71 //________________________________________________________________
72 AliT0CalibData &AliT0CalibData::operator =(const AliT0CalibData& calibda)
74 // assignment operator
75 SetName(calibda.GetName());
76 SetTitle(calibda.GetName());
81 //________________________________________________________________
82 AliT0CalibData::~AliT0CalibData()
86 //________________________________________________________________
87 void AliT0CalibData::PrintLookup(Option_t*, Int_t iTRM, Int_t iTDC, Int_t iChannel) const
91 AliT0LookUpKey* lookkey; //= new AliT0LookUpKey();
92 AliT0LookUpValue* lookvalue= new AliT0LookUpValue();
93 printf("Number Of TRMs in setup %i\n",GetNumberOfTRMs());
95 iTRM=0; iTDC=0; Int_t chain=0; iChannel=0;
97 for (Int_t ik=0; ik<105; ik++){
98 lookvalue->SetTRM(iTRM);
99 lookvalue->SetTDC(iTDC);
100 lookvalue->SetChain(chain);
101 lookvalue->SetChannel(iChannel);
103 if (iChannel<6) iChannel +=2;
104 else {iChannel = 0; iTDC++;}
105 if(ik==57) { iTDC=0; iChannel=0; iTRM=1;}
107 printf(" AliT0CalibData::PrintLookup ::start GetValue %i %i %i %i\n",iTRM, iTDC,chain, iChannel);
108 lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
109 // TString name= lookkey->GetChannelName();
110 // cout<<name.Data()<<endl;
113 TString name= lookkey->GetChannelName();
114 /* cout<<" lookup KEY!!! "<<name.Data()<<" "<<lookkey->GetKey()<<" VALUE "<<lookvalue->GetTRM()<<" "
115 <<lookvalue->GetTDC()<<" "
116 << lookvalue->GetChain()<<" "
117 <<lookvalue->GetChannel()<<endl;*/
122 //________________________________________________________________
124 void AliT0CalibData::ReadAsciiLookup(const Char_t *filename)
126 // read lookup table from ascii file
128 Int_t key, trm, tdc, chain, channel;
131 AliError(Form("Please, specify file with database")) ;
134 cout<<" read file "<<filename<<endl;
137 lookup.open(filename);
140 AliError(Form("!!!!!!!!!!!!!!No look up table in CDB!" ));
148 // fNumberOfTRMs=ntrms;
149 SetNumberOfTRMs(ntrms);
150 cout<<" N TRMS "<<ntrms<<endl;
153 AliT0LookUpKey * lookkey= new AliT0LookUpKey();
154 AliT0LookUpValue * lookvalue= new AliT0LookUpValue();
156 lookup>>varname>>key>>trm>>chain>>tdc>>channel;
157 lookvalue->SetTRM(trm);
158 lookvalue->SetTDC(tdc);
159 lookvalue->SetChain(chain);
160 lookvalue->SetChannel(channel);
161 lookkey->SetKey(key);
162 lookkey->SetChannelName(varname);
163 cout<<trm<<" "<<chain<<" "<<tdc<<" "<<channel<<" "<<key<<" "<<varname<<endl;
164 fLookup.Add((TObject*)lookvalue,(TObject*)lookkey);
172 //________________________________________________________________
174 Int_t AliT0CalibData::GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel)
176 // read number of channel according physical addres
179 AliT0LookUpKey * lookkey;//= new AliT0LookUpKey();
180 AliT0LookUpValue * lookvalue= new AliT0LookUpValue(trm,tdc,chain,channel);
182 lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
184 return lookkey->GetKey();