1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 //_________________________________________________________________________
19 // Calibration coefficients
21 //*-- Author: Aleksei Pavlinov (WSU, Detroit, USA)
23 #include "AliEMCALCalibCoefs.h"
26 #include "AliEMCALCalibData.h"
27 #include "AliCDBMetaData.h"
29 #include "AliCDBEntry.h"
30 #include "AliCDBManager.h"
31 #include "AliCDBStorage.h"
32 #include "AliEMCALGeometry.h"
36 TableClassImpl(AliEMCALCalibCoefs,calibCoef)
38 // Get initial Calib Data from DB
39 AliEMCALCalibCoefs* AliEMCALCalibCoefs::GetCalibTableFromDb(const char *tn)
41 // Initial cc with decalibration
42 char* dbString = "local:///data/r22b/ALICE/PROD/CALIBRATION_May_2007/PI0/PDSF/10GEV/DECALIB/DeCalibDB";
43 AliEMCALCalibData* caldata = (AliEMCALCalibData*)
44 (AliCDBManager::Instance()->GetStorage(dbString)
45 ->Get("EMCAL/Calib/Data",gAlice->GetRunNumber())->GetObject());
46 if(caldata == 0) return 0;
48 AliEMCALCalibCoefs *tab = new AliEMCALCalibCoefs(tn);
49 tab->SetCalibMethod(AliEMCALCalibCoefs::kMC);
51 AliEMCALGeometry *g = AliEMCALGeometry::GetInstance();
52 for(Int_t id=0; id<g->GetNCells(); id++){
53 Int_t nSupMod=0, nModule=0, nIphi=0, nIeta=0, iphiCell=0, ietaCell=0;
54 g->GetCellIndex(id, nSupMod, nModule, nIphi, nIeta);
55 g->GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta, iphiCell, ietaCell);
59 r.cc = caldata->GetADCchannel(nSupMod, ietaCell, iphiCell);
65 tab->SetCalibMethod(AliEMCALCalibCoefs::kPI0);
70 TH1F* AliEMCALCalibCoefs::GetHistOfCalibTableFromDb(const char *tn)
73 AliEMCALGeometry *g = AliEMCALGeometry::GetInstance("");
75 AliEMCALCalibCoefs* tab = GetCalibTableFromDb(tn);
78 TH1F *h = new TH1F("hCCfirst", " cc first (in MeV)", 70, 12., 19.);
80 for(Int_t i=0; i<tab->GetNRows(); i++){
89 calibCoef *AliEMCALCalibCoefs::GetRow(const int absId)
92 for(int id=0; id<GetNRows(); id++){
94 if(r->absId == absId) return r;
99 void AliEMCALCalibCoefs::PrintTable()
101 printf(" Table : %s : nrows %i \n", GetName(), int(GetNRows()));
102 for(int i=0; i<GetNRows(); i++) PrintTable(i);
105 void AliEMCALCalibCoefs::PrintTable(const Int_t i)
107 if(i>=GetNRows()) return;
108 printf("row %i \n", i);
109 PrintRec(GetTable(i));
112 void AliEMCALCalibCoefs::PrintRec(calibCoef* r)
115 printf(" abs Id %5.5i cc %7.6f eCc %7.6f \n", r->absId, r->cc, r->eCc);