AliT0LookUpValue* lookvalue= new AliT0LookUpValue();
cout<<" Number Of TRMs in setup "<<GetNumberOfTRMs()<<endl;
- lookvalue->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);
-
-
- if (lookkey)
- {
- cout<<" lookup KEY!!! "<<lookkey->GetKey()<<" VALUE "<<lookvalue->GetTRM()<<" "
- <<lookvalue->GetTDC()<<" "
- << lookvalue->GetChain()<<" "
+ iTRM=0; iTDC=0; Int_t chain=0; iChannel=0;
+
+ for (Int_t ik=0; ik<105; ik++){
+ lookvalue->SetTRM(iTRM);
+ lookvalue->SetTDC(iTDC);
+ lookvalue->SetChain(chain);
+ lookvalue->SetChannel(iChannel);
+
+ if (iChannel<6) iChannel +=2;
+ else {iChannel = 0; iTDC++;}
+ if(ik==57) { iTDC=0; iChannel=0; iTRM=1;}
+
+ printf(" AliT0CalibData::PrintLookup ::start GetValue %i %i %i %i\n",iTRM, iTDC,chain, iChannel);
+ lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
+ cout<<" lookkey "<< lookkey<<endl;
+ // TString name= lookkey->GetChannelName();
+ // cout<<name.Data()<<endl;
+ if (lookkey)
+ {
+ TString name= lookkey->GetChannelName();
+ cout<<" lookup KEY!!! "<<name.Data()<<" "<<lookkey->GetKey()<<" VALUE "<<lookvalue->GetTRM()<<" "
+ <<lookvalue->GetTDC()<<" "
+ << lookvalue->GetChain()<<" "
<<lookvalue->GetChannel()<<endl;
- }
-
+ }
+ }
}
lookvalue->SetChain(chain);
lookvalue->SetChannel(channel);
lookkey->SetKey(key);
+ lookkey->SetChannelName(varname);
cout<<"lookup "<<varname<<" "<<key<<" "<<trm<<" "<<chain<<" "<<tdc<<" "<<channel<<endl;
fLookup.Add((TObject*)lookvalue,(TObject*)lookkey);
* provided "as is" without express or implied warranty. *
**************************************************************************/
#include "AliT0LookUpValue.h"
+#include "iostream.h"
ClassImp(AliT0LookUpValue)
///
}
-
+//--------------------------------------------------------------------------------------
AliT0LookUpValue:: AliT0LookUpValue(Int_t trm, Int_t tdc, Int_t chain, Int_t channel) : TObject(),
fTRM(trm),
fTDC(tdc),
fChain(chain),
fChannel(channel)
{
+
+//--------------------------------------------------------------------------------------
}
Bool_t AliT0LookUpValue:: IsEqual(const TObject* obj) const
{
AliT0LookUpValue *b = ( AliT0LookUpValue*)obj;
-/*
-printf("IsEqual %i %i\n %i %i\n %i %i\n %i %i\n \n",b->GetTRM(), fTRM,
-b->GetTDC(), fTDC, b->GetChain(), fChain, b->GetChannel(), fChannel );
-*/
if ( b->GetTRM() == fTRM &&
b->GetTDC() == fTDC &&
b->GetChain() == fChain &&
b->GetChannel() == fChannel ) return kTRUE;
else return kFALSE;
}
-ULong_t AliT0LookUpValue:: Hash(void) const
+
+//------------------------------------------------------------------------------------
+void AliT0LookUpValue::Print(Option_t *) const
{
- ULong_t hash = 1000*fTRM+100*fTDC+10*fChain+1*fChannel;
- //printf("hash=%i\n",hash);
- return hash;
+ printf("AliT0LookUpValue TRM %i, TDC %i, chain %i channel %i\n",fTRM,fTDC,fChain,fChannel);
}
+//--------------------------------------------------------------------------------------
ClassImp(AliT0LookUpKey)
}
+//--------------------------------------------------------------------------------------
AliT0LookUpKey::AliT0LookUpKey(Int_t key):
TObject(),
fKey(key),
}
+//--------------------------------------------------------------------------------------
AliT0LookUpKey::AliT0LookUpKey(TString name):
TObject(),
fKey(),
{
}
+//--------------------------------------------------------------------------------------
Bool_t AliT0LookUpKey:: IsEqual(const TObject* obj) const
{
k=((AliT0LookUpKey*)obj)->GetKey();
if (k==fKey) return kTRUE; else return kFALSE;
}
+//--------------------------------------------------------------------------------------
+void AliT0LookUpKey::Print(Option_t *) const
+{
+ printf(" AliT0LookUpKey key %i name %s\n",fKey,fName.Data());
+
+}
AliT0LookUpValue();
AliT0LookUpValue(Int_t trm, Int_t tdc, Int_t chain, Int_t channel );
virtual Bool_t IsEqual(const TObject* obj) const ;
- virtual ULong_t Hash(void) const;
- // virtual ULong_t Hash(void) const {return TString::Hash(this, sizeof(*this));};
- Int_t GetTRM(void) const {return fTRM;};
- Int_t GetTDC(void) const {return fTDC;};
- Int_t GetChain(void) const {return fChain;};
- Int_t GetChannel(void) const {return fChannel;};
+ virtual ULong_t Hash() const {return (ULong_t) 1000000*fTRM+100000*fTDC+1000*fChannel;}
+ // virtual ULong_t Hash(void) const {return TString::Hash(this, sizeof(*this));};
+ Int_t GetTRM() const {return fTRM;};
+ Int_t GetTDC() const {return fTDC;};
+ Int_t GetChain() const {return fChain;};
+ Int_t GetChannel() const {return fChannel;};
void SetTRM(Int_t n) {fTRM=n;};
void SetTDC(Int_t n) {fTDC=n;};
void SetChain(Int_t n) {fChain=n;};
void SetChannel(Int_t n) {fChannel=n;};
- virtual void Clear (void) {fTRM = -1; fTDC=-1; fChain=-1; fChannel=-1;}
+ virtual void Clear () {fTRM = -1; fTDC=-1; fChain=-1; fChannel=-1;}
void Clear(const Option_t*) {};
+ void Print(Option_t* opt= "") const;
protected:
AliT0LookUpKey();
AliT0LookUpKey(Int_t key);
AliT0LookUpKey(TString name);
- Int_t GetKey(void) const {return fKey;};
+ Int_t GetKey() const {return fKey;};
void SetKey(Int_t n) {fKey=n;};
TString GetChannelName() {return fName;};
void SetChannelName(TString name) {fName = name;};
virtual Bool_t IsEqual(const TObject *obj) const;
- virtual ULong_t Hash(void) const {return TString::Hash(this, sizeof(*this));};
+ void Print(Option_t* opt= "") const;
+ virtual ULong_t Hash() const {return 10000*fKey;}
+ // virtual ULong_t Hash(void) const {return TString::Hash(this, sizeof(*this));};
// virtual void Clear(void) {fKey=0;}
protected:
Int_t fKey; //logical channel number
if (fIsInit) return;
AliCDBManager *stor =AliCDBManager::Instance();
-
//time equalizing
- fCalibentry = stor->Get("T0/Calib/TimeDelay");
- if (fCalibentry)
- fgCalibData = (AliT0CalibData*)fCalibentry->GetObject();
- else {
- AliFatal(" ALARM !!!! No time delays in CDB ");
- fIsInit = kFALSE;
- return;
- }
+ fCalibentry = stor->Get("T0/Calib/TimeDelay");
+ if (fCalibentry)
+ fgCalibData = (AliT0CalibData*)fCalibentry->GetObject();
+ else {
+ AliFatal(" ALARM !!!! No time delays in CDB ");
+ fIsInit = kFALSE;
+ return;
+ }
//slewing correction
fSlewCorr = stor->Get("T0/Calib/Slewing_Walk");
if (fSlewCorr){
fgSlewCorr = (AliT0CalibData*)fSlewCorr->GetObject();
}
else {
- AliFatal(" ALARM !!!! No slewing correction in CDB ");
+ AliFatal(" ALARM !!!! No slewing correction in CDB ");
fIsInit = kFALSE;
return;
}
fgLookUp = (AliT0CalibData*)fLookUpentry->GetObject();
}
else {
- AliFatal(" ALARM !!!! No Lookup table in CDB ");
+ AliFatal(" ALARM !!!! No Lookup table in CDB ");
fIsInit = kFALSE;
return;
}
AliT0Parameters::GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel)
{
-
- AliT0LookUpKey * lookkey; //= new AliT0LookUpKey();
- AliT0LookUpValue * lookvalue= new AliT0LookUpValue(trm,tdc,chain,channel);
+ AliT0LookUpKey * val; //= new AliT0LookUpKey();
+ AliT0LookUpValue * key= new AliT0LookUpValue(trm,tdc,chain,channel);
if (fgLookUp)
- lookkey = (AliT0LookUpKey*) fgLookUp->GetMapLookup()->GetValue((TObject*)lookvalue);
+ val = (AliT0LookUpKey*) fgLookUp->GetMapLookup()->GetValue((TObject*)key);
else
- lookkey = (AliT0LookUpKey*) fLookUp.GetValue((TObject*)lookvalue);
-
- if (!lookkey ) {
+ cout<<" !!!!!!!!! no look up table !!!"<<endl;
+ if (!val ) {
AliInfo(Form("No such address (%d %d %d %d)!",trm,tdc,chain,channel));
return -1;
}
- return lookkey->GetKey();
+ return val->GetKey();
}
}
return fgLookUp ->GetNumberOfTRMs();
}
+/*
//________________________________________________________________________________
Double_t AliT0Parameters::GetZPosition(const char* symname){
// Get the global z coordinate of the given T0 alignable volume
return tr[2];
}
+*/
+//________________________________________________________________________________
+Double_t AliT0Parameters::GetZPosition(const char* symname){
+// Get the global z coordinate of the given T0 alignable volume
+//
+ Double_t *tr;
+
+ cout<<symname<<endl;
+ TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname);
+ if (!pne) return 0;
+
+
+ TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
+ if(pnode){
+ TGeoHMatrix* hm = pnode->GetMatrix();
+ tr = hm->GetTranslation();
+ }else{
+ const char* path = pne->GetTitle();
+ if(!gGeoManager->cd(path)){
+ AliErrorClass(Form("Volume path %s not valid!",path));
+ return 0;
+ }
+ tr = gGeoManager->GetCurrentMatrix()->GetTranslation();
+ }
+ return tr[2];
+
+}
//________________________________________________________________________________
Double_t AliT0Parameters::GetZPositionShift(const char* symname)
// void SetMeanT0(Int_t mean=500) { fMeanT0 = mean; };
Int_t GetMeanT0 (); //{return fMeanT0;};
- TMap * GetMapLookup();
+ TMap * GetMapLookup();
Int_t GetChannel(Int_t trm, Int_t tdc, Int_t chain, Int_t channel);
Int_t GetNumberOfTRMs();
void SetNumberOfTRMs(Int_t ntrms=2) {fNumberOfTRMs = ntrms;}
for( Int_t iline=0; iline<106; iline++)
{
lookvalue = ( AliT0LookUpValue*) iter->Next();
- lookkey = (AliT0LookUpKey*) lookup->GetValue((TObject*)lookvalue);
- fLookUp.Add((TObject*)lookkey,(TObject*)lookvalue);
+ lookkey = (AliT0LookUpKey*) lookup->GetValue(lookvalue);
+ fLookUp.Add(lookkey, lookvalue);
lookkey= new AliT0LookUpKey();
lookvalue= new AliT0LookUpValue();
}
-
+
}
//_____________________________________________________________________________
Int_t channel=0;
Int_t trm1words=0;
Int_t itrm=0, oldtrm=0;
-
-
+ AliT0LookUpKey * lookkey = new AliT0LookUpKey();
+ AliT0LookUpValue * lookvalue ;//= new AliT0LookUpValue(trm,tdc,chain,channel);
for (Int_t det = 0; det < 105; det++) {
time = allData->At(det);
- if (time >0) {
-
- AliT0LookUpKey * lookkey = new AliT0LookUpKey();
- AliT0LookUpValue * lookvalue ;//= new AliT0LookUpValue(trm,tdc,chain,channel);
+ if (time >0) {
lookkey->SetKey(det);
lookvalue = (AliT0LookUpValue*) fLookUp.GetValue((TObject*)lookkey);
if (lookvalue )
chain = lookvalue->GetChain();
iTDC = lookvalue->GetTDC();
channel = lookvalue->GetChannel();
- // cout<<det<<" "<<itrm<<" "<<chain<<" "<<iTDC<<" "<<channel<<" time "<<time<<endl;
FillTime(channel, iTDC, time);
}
else
WriteTrailer(15,0,fEventNumber,5); // 1st TRM trailer
- trm1words = fIndex - startTRM;
+ trm1words = fIndex - startTRM;
//space for 2st TRM header
WriteTRMDataHeader(1, trm1words , positionOfTRMHeader);