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>
33 ClassImp(AliT0CalibData)
35 //________________________________________________________________
36 AliT0CalibData::AliT0CalibData(): TNamed(),
44 //________________________________________________________________
45 AliT0CalibData::AliT0CalibData(const char* name):TNamed(),
49 TString namst = "Calib_";
51 SetName(namst.Data());
52 SetTitle(namst.Data());
56 //________________________________________________________________
57 AliT0CalibData::AliT0CalibData(const AliT0CalibData& calibda) :
64 SetName(calibda.GetName());
65 SetTitle(calibda.GetName());
70 //________________________________________________________________
71 AliT0CalibData &AliT0CalibData::operator =(const AliT0CalibData& calibda)
73 // assignment operator
74 SetName(calibda.GetName());
75 SetTitle(calibda.GetName());
80 //________________________________________________________________
81 AliT0CalibData::~AliT0CalibData()
85 //________________________________________________________________
86 void AliT0CalibData::PrintLookup(Option_t*, Int_t iTRM, Int_t iTDC, Int_t iChannel) const
90 AliT0LookUpKey* lookkey= new AliT0LookUpKey();
91 AliT0LookUpValue* lookvalue= new AliT0LookUpValue();
92 printf("Number Of TRMs in setup %i\n",GetNumberOfTRMs());
94 iTRM=0; iTDC=0; Int_t chain=0; iChannel=0;
96 for (Int_t ik=0; ik<105; ik++){
97 lookvalue->SetTRM(iTRM);
98 lookvalue->SetTDC(iTDC);
99 lookvalue->SetChain(chain);
100 lookvalue->SetChannel(iChannel);
102 if (iChannel<6) iChannel +=2;
103 else {iChannel = 0; iTDC++;}
104 if(ik==57) { iTDC=0; iChannel=0; iTRM=1;}
106 printf(" AliT0CalibData::PrintLookup ::start GetValue %i %i %i %i\n",iTRM, iTDC,chain, iChannel);
107 lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
108 // TString name= lookkey->GetChannelName();
109 // cout<<name.Data()<<endl;
112 TString name= lookkey->GetChannelName();
113 /* cout<<" lookup KEY!!! "<<name.Data()<<" "<<lookkey->GetKey()<<" VALUE "<<lookvalue->GetTRM()<<" "
114 <<lookvalue->GetTDC()<<" "
115 << lookvalue->GetChain()<<" "
116 <<lookvalue->GetChannel()<<endl;*/
121 //________________________________________________________________
123 void AliT0CalibData::ReadAsciiLookup(const Char_t *filename)
125 // read lookup table from ascii file
127 Int_t key, trm, tdc, chain, channel;
130 AliError(Form("Please, specify file with database")) ;
136 lookup.open(filename);
139 AliError(Form("!!!!!!!!!!!!!!No look up table in CDB!" ));
147 // fNumberOfTRMs=ntrms;
148 SetNumberOfTRMs(ntrms);
151 AliT0LookUpKey * lookkey= new AliT0LookUpKey();
152 AliT0LookUpValue * lookvalue= new AliT0LookUpValue();
154 lookup>>varname>>key>>trm>>chain>>tdc>>channel;
155 lookvalue->SetTRM(trm);
156 lookvalue->SetTDC(tdc);
157 lookvalue->SetChain(chain);
158 lookvalue->SetChannel(channel);
159 lookkey->SetKey(key);
160 lookkey->SetChannelName(varname);
162 fLookup.Add((TObject*)lookvalue,(TObject*)lookkey);
170 //________________________________________________________________
172 Int_t AliT0CalibData::GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel)
174 // read number of channel according physical addres
177 AliT0LookUpKey * lookkey;//= new AliT0LookUpKey();
178 AliT0LookUpValue * lookvalue= new AliT0LookUpValue(trm,tdc,chain,channel);
180 lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
182 return lookkey->GetKey();