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-AC-AM_6-02-2006 //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliT0CalibData.h"
25 #include "AliT0LookUpValue.h"
28 #include <Riostream.h>
32 ClassImp(AliT0CalibData)
34 //________________________________________________________________
35 AliT0CalibData::AliT0CalibData(): TNamed(),
43 //________________________________________________________________
44 AliT0CalibData::AliT0CalibData(const char* name):TNamed(),
48 TString namst = "Calib_";
50 SetName(namst.Data());
51 SetTitle(namst.Data());
55 //________________________________________________________________
56 AliT0CalibData::AliT0CalibData(const AliT0CalibData& calibda) :
63 SetName(calibda.GetName());
64 SetTitle(calibda.GetName());
69 //________________________________________________________________
70 AliT0CalibData &AliT0CalibData::operator =(const AliT0CalibData& calibda)
72 // assignment operator
73 SetName(calibda.GetName());
74 SetTitle(calibda.GetName());
79 //________________________________________________________________
80 AliT0CalibData::~AliT0CalibData()
84 //________________________________________________________________
85 void AliT0CalibData::PrintLookup(Option_t*, Int_t iTRM, Int_t iTDC, Int_t iChannel) const
88 AliT0LookUpKey* lookkey= new AliT0LookUpKey();
89 AliT0LookUpValue* lookvalue= new AliT0LookUpValue();
91 cout<<" Number Of TRMs in setup "<<GetNumberOfTRMs()<<endl;
92 iTRM=0; iTDC=0; Int_t chain=0; iChannel=0;
94 for (Int_t ik=0; ik<105; ik++){
95 lookvalue->SetTRM(iTRM);
96 lookvalue->SetTDC(iTDC);
97 lookvalue->SetChain(chain);
98 lookvalue->SetChannel(iChannel);
100 if (iChannel<6) iChannel +=2;
101 else {iChannel = 0; iTDC++;}
102 if(ik==57) { iTDC=0; iChannel=0; iTRM=1;}
104 printf(" AliT0CalibData::PrintLookup ::start GetValue %i %i %i %i\n",iTRM, iTDC,chain, iChannel);
105 lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
106 cout<<" lookkey "<< lookkey<<endl;
107 // TString name= lookkey->GetChannelName();
108 // cout<<name.Data()<<endl;
111 TString name= lookkey->GetChannelName();
112 cout<<" lookup KEY!!! "<<name.Data()<<" "<<lookkey->GetKey()<<" VALUE "<<lookvalue->GetTRM()<<" "
113 <<lookvalue->GetTDC()<<" "
114 << lookvalue->GetChain()<<" "
115 <<lookvalue->GetChannel()<<endl;
120 //________________________________________________________________
122 void AliT0CalibData::ReadAsciiLookup(const Char_t *filename)
124 Int_t key, trm, tdc, chain, channel;
127 AliError(Form("Please, specify file with database")) ;
133 lookup.open(filename);
136 AliError(Form("!!!!!!!!!!!!!!No look up table in CDB!" ));
144 cout<<" !!!!!!! ntrms "<<ntrms<<endl;
145 // fNumberOfTRMs=ntrms;
146 SetNumberOfTRMs(ntrms);
149 AliT0LookUpKey * lookkey= new AliT0LookUpKey();
150 AliT0LookUpValue * lookvalue= new AliT0LookUpValue();
152 lookup>>varname>>key>>trm>>chain>>tdc>>channel;
153 lookvalue->SetTRM(trm);
154 lookvalue->SetTDC(tdc);
155 lookvalue->SetChain(chain);
156 lookvalue->SetChannel(channel);
157 lookkey->SetKey(key);
158 lookkey->SetChannelName(varname);
159 cout<<"lookup "<<varname<<" "<<key<<" "<<trm<<" "<<chain<<" "<<tdc<<" "<<channel<<endl;
161 fLookup.Add((TObject*)lookvalue,(TObject*)lookkey);
169 //________________________________________________________________
171 Int_t AliT0CalibData::GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel)
174 AliT0LookUpKey * lookkey;//= new AliT0LookUpKey();
175 AliT0LookUpValue * lookvalue= new AliT0LookUpValue(trm,tdc,chain,channel);
177 lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
179 return lookkey->GetKey();