/*
$Log$
+Revision 1.2 2006/02/13 17:22:26 arcelli
+just Fixing Log info
+
Revision 1.1 2006/02/13 16:10:48 arcelli
Add classes for TOF Calibration (C.Zampolli)
#include "AliESDtrack.h"
#include "AliTOFChannel.h"
#include "AliTOFChSim.h"
-#include "AliTOFGeometry.h"
-#include "AliTOFdigit.h"
+#include "AliTOFGeometryV5.h"
#include "TClonesArray.h"
#include "AliTOFCal.h"
#include "TRandom.h"
ClassImp(AliTOFcalib)
const Int_t AliTOFcalib::fgkchannel = 5000;
-const Char_t* AliTOFcalib::ffile[6]={"$ALICE_ROOT/TOF/Spectra/spectrum0_1.root","$ALICE_ROOT/TOF/Spectra/spectrum0_2.root","$ALICE_ROOT/TOF/Spectra/spectrum1_1.root","$ALICE_ROOT/TOF/Spectra/spectrum1_2.root","$ALICE_ROOT/TOF/Spectra/spectrum2_1.root","$ALICE_ROOT/TOF/Spectra/spectrum2_2.root"};
//_______________________________________________________________________
AliTOFcalib::AliTOFcalib():TTask("AliTOFcalib",""){
- fNSector = 0;
- fNPlate = 0;
- fNStripA = 0;
- fNStripB = 0;
- fNStripC = 0;
- fNpadZ = 0;
- fNpadX = 0;
- fsize = 0;
+
fArrayToT = 0x0;
fArrayTime = 0x0;
- flistFunc = 0x0;
- fTOFCal = 0x0;
fESDsel = 0x0;
- for (Int_t i = 0;i<6;i++){
- fhToT[i]=0x0;
- }
- fGeom=0x0;
+ AliTOFGeometry *geom=new AliTOFGeometryV5();
+ AliInfo("V5 TOF Geometry is taken as the default");
+ fNSector = geom->NSectors();
+ fNPlate = geom->NPlates();
+ fNStripA = geom->NStripA();
+ fNStripB = geom->NStripB();
+ fNStripC = geom->NStripC();
+ fNpadZ = geom->NpadZ();
+ fNpadX = geom->NpadX();
+ fNChannels = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX; //generalized version
+ fTOFCal = new AliTOFCal(geom);
+ fTOFSimCal = new AliTOFCal(geom);
+ fTOFCal->CreateArray();
+ fTOFSimCal->CreateArray();
+ delete geom;
}
-//____________________________________________________________________________
-
-AliTOFcalib::AliTOFcalib(char* headerFile, Int_t nEvents):TTask("AliTOFcalib","")
-{
- AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
- rl->CdGAFile();
- TFile *in=(TFile*)gFile;
- in->cd();
- fGeom = (AliTOFGeometry*)in->Get("TOFgeometry");
- fNSector = fGeom->NSectors();
- fNPlate = fGeom->NPlates();
- fNStripA = fGeom->NStripA();
- fNStripB = fGeom->NStripB();
- fNStripC = fGeom->NStripC();
- fNpadZ = fGeom->NpadZ();
- fNpadX = fGeom->NpadX();
- fsize = 2*(fNStripC+fNStripB) + fNStripA;
- for (Int_t i = 0;i<6;i++){
- fhToT[i]=0x0;
- }
+//_______________________________________________________________________
+AliTOFcalib::AliTOFcalib(AliTOFGeometry *geom):TTask("AliTOFcalib",""){
fArrayToT = 0x0;
fArrayTime = 0x0;
- flistFunc = 0x0;
- fNevents=nEvents;
- fHeadersFile=headerFile;
- fTOFCal = 0x0;
fESDsel = 0x0;
- TFile* file = (TFile*) gROOT->GetFile(fHeadersFile.Data()) ;
- if(file == 0){
- if(fHeadersFile.Contains("rfio"))
- file = TFile::Open(fHeadersFile,"update") ;
- else
- file = new TFile(fHeadersFile.Data(),"update") ;
- gAlice = (AliRun*)file->Get("gAlice") ;
- }
-
- TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
- roottasks->Add(this) ;
+ fNSector = geom->NSectors();
+ fNPlate = geom->NPlates();
+ fNStripA = geom->NStripA();
+ fNStripB = geom->NStripB();
+ fNStripC = geom->NStripC();
+ fNpadZ = geom->NpadZ();
+ fNpadX = geom->NpadX();
+ fNChannels = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX; //generalized version
+ fTOFCal = new AliTOFCal(geom);
+ fTOFSimCal = new AliTOFCal(geom);
+ fTOFCal->CreateArray();
+ fTOFSimCal->CreateArray();
}
//____________________________________________________________________________
fNStripC = calib.fNStripC;
fNpadZ = calib.fNpadZ;
fNpadX = calib.fNpadX;
- fsize = calib.fsize;
+ fNChannels = calib.fNChannels;
fArrayToT = calib.fArrayToT;
fArrayTime = calib.fArrayTime;
- flistFunc = calib.flistFunc;
- for (Int_t i = 0;i<6;i++){
- fhToT[i]=calib.fhToT[i];
- }
fTOFCal=calib.fTOFCal;
- fESDsel = calib.fESDsel;
- fGeom = calib.fGeom;
+ fTOFSimCal = calib.fTOFSimCal;
}
//____________________________________________________________________________
{
delete fArrayToT;
delete fArrayTime;
- delete flistFunc;
- delete[] fhToT;
delete fTOFCal;
+ delete fTOFSimCal;
delete fESDsel;
}
-//____________________________________________________________________________
-
-void AliTOFcalib::Init(){
- SetHistos();
- SetFitFunctions();
- fTOFCal = new AliTOFCal();
- fTOFCal->CreateArray();
- fNSector = 18;
- fNPlate = 5;
- fNStripA = 15;
- fNStripB = 19;
- fNStripC = 20;
- fNpadZ = 2;
- fNpadX = 96;
- fsize = 1;
- //fsize = fNSector*(2*(fNStripC+fNStripB)+fNStripA())*fNpadZ*fNpadX; //generalized version
-}
-//____________________________________________________________________________
-
-void AliTOFcalib::SetHistos(){
- TFile * spFile;
- TH1F * hToT;
- for (Int_t i =0;i<6;i++){
- //for the time being, only one spectrum is used
- spFile = new TFile("$ALICE_ROOT/TOF/Spectra/spectrumtest0_1.root","read");
- //otherwise
- //spFile = new TFile(ffile[i],"read");
- spFile->GetObject("ToT",hToT);
- fhToT[i]=hToT;
- Int_t nbins = hToT->GetNbinsX();
- Float_t Delta = hToT->GetBinWidth(1);
- Float_t maxch = hToT->GetBinLowEdge(nbins)+Delta;
- Float_t minch = hToT->GetBinLowEdge(1);
- Float_t max=0,min=0; //maximum and minimum value of the distribution
- Int_t maxbin=0,minbin=0; //maximum and minimum bin of the distribution
- for (Int_t ii=nbins; ii>0; ii--){
- if (hToT->GetBinContent(ii)!= 0) {
- max = maxch - (nbins-ii-1)*Delta;
- maxbin = ii;
- break;}
- }
- for (Int_t j=1; j<nbins; j++){
- if (hToT->GetBinContent(j)!= 0) {
- min = minch + (j-1)*Delta;
- minbin = j;
- break;}
- }
- fMaxToT[i]=max;
- fMinToT[i]=min;
- fMaxToTDistr[i]=hToT->GetMaximum();
- }
-}
-//__________________________________________________________________________
-
-void AliTOFcalib::SetFitFunctions(){
- TFile * spFile;
- flistFunc = new TList();
- for (Int_t i =0;i<6;i++){
- //only one type of spectrum used for the time being
- spFile = new TFile("$ALICE_ROOT/TOF/Spectra/spectrumtest0_1.root","read");
- //otherwise
- //spFile = new TFile(ffile[i],"read");
- TH1F * h = (TH1F*)spFile->Get("TimeToTFit");
- TList * list = (TList*)h->GetListOfFunctions();
- TF1* f = (TF1*)list->At(0);
- Double_t par[6] = {0,0,0,0,0,0};
- Int_t npar=f->GetNpar();
- for (Int_t ipar=0;ipar<npar;ipar++){
- par[ipar]=f->GetParameter(ipar);
- }
- flistFunc->AddLast(f);
- }
- return;
-}
//__________________________________________________________________________
TF1* AliTOFcalib::SetFitFunctions(TH1F *histo){
}
//____________________________________________________________________________
-TClonesArray* AliTOFcalib::DecalibrateDigits(TClonesArray * digits){
-
- TObjArray ChArray(fsize);
- ChArray.SetOwner();
- for (Int_t kk = 0 ; kk < fsize; kk++){
- AliTOFChSim * channel = new AliTOFChSim();
- ChArray.Add(channel);
- }
- Int_t ndigits = digits->GetEntriesFast();
- for (Int_t i=0;i<ndigits;i++){
- Float_t trix = 0;
- Float_t triy = 0;
- Float_t SimToT = 0;
- AliTOFdigit * element = (AliTOFdigit*)digits->At(i);
- /*
- Int_t *detId[5];
- detId[0] = element->GetSector();
- detId[1] = element->GetPlate();
- detId[2] = element->GetStrip();
- detId[3] = element->GetPadz();
- detId[4] = element->GetPadx();
- Int_t index = GetIndex(detId);
- */
- //select the corresponding channel with its simulated ToT spectrum
- //summing up everything, index = 0 for all channels:
- Int_t index = 0;
- AliTOFChSim *ch = (AliTOFChSim*)ChArray.At(index);
- Int_t itype = -1;
- if (!ch->IsSlewed()){
- Double_t rand = gRandom->Uniform(0,6);
- itype = (Int_t)(6-rand);
- ch->SetSpectrum(itype);
- ch->SetSlewedStatus(kTRUE);
- }
- else itype = ch->GetSpectrum();
- TH1F * hToT = fhToT[itype];
- TF1 * f = (TF1*)flistFunc->At(itype);
- while (SimToT <= triy){
- trix = gRandom->Rndm(i);
- triy = gRandom->Rndm(i);
- trix = (fMaxToT[itype]-fMinToT[itype])*trix + fMinToT[itype];
- triy = fMaxToTDistr[itype]*triy;
- Int_t binx=hToT->FindBin(trix);
- SimToT=hToT->GetBinContent(binx);
- }
-
- Float_t par[6];
- for(Int_t kk=0;kk<6;kk++){
- par[kk]=0;
- }
- element->SetToT(trix);
- Int_t nfpar = f->GetNpar();
- for (Int_t kk = 0; kk< nfpar; kk++){
- par[kk]=f->GetParameter(kk);
- }
- Float_t ToT = element->GetToT();
- element->SetTdcND(element->GetTdc());
- Float_t tdc = ((element->GetTdc())*AliTOFGeometry::TdcBinWidth()+32)*1.E-3; //tof signal in ns
- Float_t timeoffset=par[0] + ToT*par[1] +ToT*ToT*par[2] +ToT*ToT*ToT*par[3] +ToT*ToT*ToT*ToT*par[4] +ToT*ToT*ToT*ToT*ToT*par[5];
- timeoffset=0;
- Float_t timeSlewed = tdc + timeoffset;
- element->SetTdc((timeSlewed*1E3-32)/AliTOFGeometry::TdcBinWidth());
- }
- TFile * file = new TFile("ToT.root", "recreate");
- file->cd();
- ChArray.Write("ToT",TObject::kSingleKey);
- file->Close();
- delete file;
- ChArray.Clear();
- return digits;
-}
-//____________________________________________________________________________
-
-void AliTOFcalib::SelectESD(AliESD *event, AliRunLoader *rl)
+void AliTOFcalib::SelectESD(AliESD *event)
{
- AliLoader *tofl = rl->GetLoader("TOFLoader");
- if (tofl == 0x0) {
- AliError("Can not get the TOF Loader");
- delete rl;
- }
- tofl->LoadRecPoints("read");
- TClonesArray *fClusters =new TClonesArray("AliTOFcluster", 1000);
- TTree *rTree=tofl->TreeR();
- if (rTree == 0) {
- cerr<<"Can't get the Rec Points tree !\n";
- delete rl;
- }
- TBranch *branch=rTree->GetBranch("TOF");
- if (!branch) {
- cerr<<"Cant' get the branch !\n";
- delete rl;
- }
- branch->SetAddress(&fClusters);
- rTree->GetEvent(0);
Float_t LowerMomBound=0.8; // [GeV/c] default value Pb-Pb
Float_t UpperMomBound=1.8 ; // [GeV/c] default value Pb-Pb
Int_t ntrk =0;
if(AssignedTOFcluster==0){ // not matched
continue;
}
- AliTOFcluster * tofcl = (AliTOFcluster *)fClusters->UncheckedAt(AssignedTOFcluster);
- Int_t isector = tofcl->GetDetInd(0);
- Int_t iplate = tofcl->GetDetInd(1);
- Int_t istrip = tofcl->GetDetInd(2);
- Int_t ipadz = tofcl->GetDetInd(3);
- Int_t ipadx = tofcl->GetDetInd(4);
- Float_t ToT = tofcl->GetToT();
AliTOFcalibESD *unc = new AliTOFcalibESD;
unc->CopyFromAliESD(t);
- unc->SetSector(isector);
- unc->SetPlate(iplate);
- unc->SetStrip(istrip);
- unc->SetPadz(ipadz);
- unc->SetPadx(ipadx);
- unc->SetToT(ToT);
Double_t c1[15];
unc->GetExternalCovariance(c1);
UCdatatemp.Add(unc);
void AliTOFcalib::CalibrateESD(){
Int_t nelements = fESDsel->GetEntries();
- Int_t *number=new Int_t[fsize];
- fArrayToT = new AliTOFArray(fsize);
- fArrayTime = new AliTOFArray(fsize);
- for (Int_t i=0; i<fsize; i++){
+ Int_t *number=new Int_t[fNChannels];
+ fArrayToT = new AliTOFArray(fNChannels);
+ fArrayTime = new AliTOFArray(fNChannels);
+ for (Int_t i=0; i<fNChannels; i++){
number[i]=0;
fArrayToT->AddArray(i, new TArrayF(fgkchannel));
TArrayF * parrToT = fArrayToT->GetArray(i);
else AliError("No pid from combinatorial algo for this track");
Double_t mtime = (Double_t)element->GetTOFsignal()*1E-3; //measured time
Double_t mToT = (Double_t) element->GetToT(); //measured ToT, ns
- /*
- Int_t *detId[5];
- detId[0] = element->GetSector();
- detId[1] = element->GetPlate();
- detId[2] = element->GetStrip();
- detId[3] = element->GetPadz();
- detId[4] = element->GetPadx();
- Int_t index = GetIndex(detId);
- */
//select the correspondent channel with its simulated ToT spectrum
//summing up everything, index = 0 for all channels:
- Int_t index = 0;
+ Int_t index = element->GetTOFCalChannel();
Int_t index2 = number[index];
TArrayF * parrToT = fArrayToT->GetArray(index);
TArrayF & refaToT = * parrToT;
Int_t nelements = fESDsel->GetEntries();
for (Int_t i=0; i< nelements; i++) {
AliTOFcalibESD *element=(AliTOFcalibESD*)fESDsel->At(i);
- /*
- Int_t *detId[5];
- detId[0] = element->GetSector();
- detId[1] = element->GetPlate();
- detId[2] = element->GetStrip();
- detId[3] = element->GetPadz();
- detId[4] = element->GetPadx();
- Int_t index = GetIndex(detId);
- */
+ Int_t index = element->GetTOFCalChannel();
+ Float_t ToT = element->GetToT();
//select the correspondent channel with its simulated ToT spectrum
//summing up everything, index = 0 for all channels:
- Int_t index = 0;
Int_t ipid = element->GetCombID();
Double_t etime = 0; //expected time
Double_t expTime[10];
for (Int_t j = 0; j<6; j++){
par[j]=CalChannel->GetSlewPar(j);
}
- //Float_t TimeCorr=par[0]+par[1]*ToT+par[2]*ToT*ToT+par[3]*ToT*ToT*ToT+par[4]*ToT*ToT*ToT*ToT+par[5]*ToT*ToT*ToT*ToT*ToT;
+ Float_t TimeCorr=0;
+ TimeCorr= par[0]+par[1]*ToT+par[2]*ToT*ToT+par[3]*ToT*ToT*ToT+par[4]*ToT*ToT*ToT*ToT+par[5]*ToT*ToT*ToT*ToT*ToT;
}
}
//_____________________________________________________________________________
-void AliTOFcalib::CorrectESDTime(AliESD *event, AliRunLoader *rl ){
- AliLoader *tofl = rl->GetLoader("TOFLoader");
- if (tofl == 0x0) {
- AliError("Can not get the TOF Loader");
- delete rl;
- }
- tofl->LoadRecPoints("read");
- TClonesArray *fClusters =new TClonesArray("AliTOFcluster", 1000);
- TTree *rTree=tofl->TreeR();
- if (rTree == 0) {
- cerr<<"Can't get the Rec Points tree !\n";
- delete rl;
- }
- TBranch *branch=rTree->GetBranch("TOF");
- if (!branch) {
- cerr<<"Cant' get the branch !\n";
- delete rl;
- }
- branch->SetAddress(&fClusters);
- rTree->GetEvent(0);
+void AliTOFcalib::CorrectESDTime(AliESD *event){
+
Int_t ntrk =0;
ntrk=event->GetNumberOfTracks();
for (Int_t itrk=0; itrk<ntrk; itrk++) {
if(AssignedTOFcluster==0){ // not matched
continue;
}
- AliTOFcluster * tofcl = (AliTOFcluster *)fClusters->UncheckedAt(AssignedTOFcluster);
- /*
- Int_t *detId[5];
- detId[0] = tofcl->GetSector();
- detId[1] = tofcl->GetPlate();
- detId[2] = tofcl->GetStrip();
- detId[3] = tofcl->GetPadz();
- detId[4] = tofcl->GetPadx();
- Int_t index = GetIndex(detId);
- */
- //select the correspondent channel with its simulated ToT spectrum
- //summing up everything, index = 0 for all channels:
- Int_t index = 0;
+ Int_t index = t->GetTOFCalChannel();
AliTOFChannel * CalChannel = fTOFCal->GetChannel(index);
Float_t par[6];
for (Int_t j = 0; j<6; j++){
par[j]=CalChannel->GetSlewPar(j);
}
- Float_t ToT = tofcl->GetToT();
+ Float_t ToT = t->GetTOFsignalToT();
Float_t TimeCorr =0;
TimeCorr=par[0]+par[1]*ToT+par[2]*ToT*ToT+par[3]*ToT*ToT*ToT+par[4]*ToT*ToT*ToT*ToT+par[5]*ToT*ToT*ToT*ToT*ToT;
}
}
//_____________________________________________________________________________
-void AliTOFcalib::WriteOnCDB(){
+void AliTOFcalib::WriteParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun){
AliCDBManager *man = AliCDBManager::Instance();
- AliCDBId id("TOF/Calib/Constants",1,100);
+ if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
+ Char_t *sel1 = "CalibPar" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBId id(out,minrun,maxrun);
AliCDBMetaData *md = new AliCDBMetaData();
- md->SetResponsible("Shimmize");
+ md->SetResponsible("Chiara Zampolli");
man->Put(fTOFCal,id,md);
}
//_____________________________________________________________________________
-void AliTOFcalib::ReadFromCDB(Char_t *sel, Int_t nrun){
+void AliTOFcalib::WriteParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun, AliTOFCal *cal){
AliCDBManager *man = AliCDBManager::Instance();
- AliCDBEntry *entry = man->Get(sel,nrun);
- if (!entry){
- AliError("Retrivial failed");
- AliCDBStorage *origSto =man->GetDefaultStorage();
- man->SetDefaultStorage("local://$ALICE_ROOT");
- entry = man->Get("TOF/Calib/Constants",nrun);
- man->SetDefaultStorage(origSto);
- }
+ if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
+ Char_t *sel1 = "CalibPar" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBId id(out,minrun,maxrun);
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ man->Put(cal,id,md);
+}
+//_____________________________________________________________________________
+
+void AliTOFcalib::ReadParFromCDB(Char_t *sel, Int_t nrun){
+ AliCDBManager *man = AliCDBManager::Instance();
+ if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
+ Char_t *sel1 = "CalibPar" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBEntry *entry = man->Get(out,nrun);
AliTOFCal *cal =(AliTOFCal*)entry->GetObject();
fTOFCal = cal;
}
//_____________________________________________________________________________
+void AliTOFcalib::WriteSimParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun){
+
+
+ //for the time being, only one spectrum is used
+ TFile *spFile = new TFile("$ALICE_ROOT/TOF/data/spectrum.root","read");
+ TH1F * hToT;
+ // Retrieve ToT Spectrum
+ spFile->GetObject("ToT",hToT);
+
+ fTOFSimToT=hToT;
+
+ // Retrieve Time over TOT dependence
+
+ TH1F * h = (TH1F*)spFile->Get("TimeToTFit");
+ TList * list = (TList*)h->GetListOfFunctions();
+ TF1* f = (TF1*)list->At(0);
+ Float_t par[6] = {0,0,0,0,0,0};
+ Int_t npar=f->GetNpar();
+ for (Int_t ipar=0;ipar<npar;ipar++){
+ par[ipar]=f->GetParameter(ipar);
+ }
+
+ for(Int_t iTOFch=0; iTOFch<fTOFSimCal->NPads();iTOFch++){
+ AliTOFChannel * CalChannel = fTOFSimCal->GetChannel(iTOFch);
+ CalChannel->SetSlewPar(par);
+ }
+
+ // Store them in the CDB
+
+ AliCDBManager *man = AliCDBManager::Instance();
+ if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ Char_t *sel1 = "CalibSimPar" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBId id1(out,minrun,maxrun);
+ man->Put(fTOFSimCal,id1,md);
+ Char_t *sel2 = "CalibSimHisto" ;
+ sprintf(out,"%s/%s",sel,sel2);
+ AliCDBId id2(out,minrun,maxrun);
+ man->Put(fTOFSimToT,id2,md);
+}
+
+//_____________________________________________________________________________
+void AliTOFcalib::WriteSimParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun, AliTOFCal *cal, TH1F * histo){
+
+ // Retrieve ToT Spectrum
+ fTOFSimToT=histo;
+ fTOFSimCal=cal;
+ AliCDBManager *man = AliCDBManager::Instance();
+ if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ Char_t *sel1 = "CalibSimPar" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBId id1(out,minrun,maxrun);
+ man->Put(fTOFSimCal,id1,md);
+ Char_t *sel2 = "CalibSimHisto" ;
+ sprintf(out,"%s/%s",sel,sel2);
+ AliCDBId id2(out,minrun,maxrun);
+ man->Put(fTOFSimToT,id2,md);
+}
+//_____________________________________________________________________________
+void AliTOFcalib::ReadSimParFromCDB(Char_t *sel, Int_t nrun){
+ AliCDBManager *man = AliCDBManager::Instance();
+ if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
+ AliCDBMetaData *md = new AliCDBMetaData();
+ md->SetResponsible("Chiara Zampolli");
+ Char_t *sel1 = "CalibSimPar" ;
+ Char_t out[100];
+ sprintf(out,"%s/%s",sel,sel1);
+ AliCDBEntry *entry1 = man->Get(out,nrun);
+ AliTOFCal *cal =(AliTOFCal*)entry1->GetObject();
+ fTOFSimCal=cal;
+ Char_t *sel2 = "CalibSimHisto" ;
+ sprintf(out,"%s/%s",sel,sel2);
+ AliCDBEntry *entry2 = man->Get(out,nrun);
+ TH1F *histo =(TH1F*)entry2->GetObject();
+ fTOFSimToT=histo;
+}
+//_____________________________________________________________________________
Int_t AliTOFcalib::GetIndex(Int_t *detId){
Int_t isector = detId[0];