Improved memory leaks in AliTOFtracker* classes: additional solution for bug #66136
[u/mrichter/AliRoot.git] / TOF / CreateCalibPars_CalibHisto.C
CommitLineData
0bce2dda 1void CreateCalibPars_CalibHisto(){
2 // Create TOF Calibration Object from AliTOFcalibHisto class
3 // and write it on CDB
4
5 AliTOFcalib *tofcalib = new AliTOFcalib();
6 tofcalib->CreateCalArrays();
7 TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFCalArrayOffline();
8
9 /* get calib histo andl and load params */
10 AliTOFcalibHisto calibHisto;
11 calibHisto.LoadCalibPar();
12
13 /* turn time-slewing correction off to only retrieve constants */
14 calibHisto.SetFullCorrectionFlag(AliTOFcalibHisto::kTimeSlewingCorr, kFALSE);
15
16 /* OCDB init */
104ba366 17 Float_t slewPar[6] = {0.,0.,0.,0.,0.,0.};
0bce2dda 18 Float_t par[6] = {0.,0.,0.,0.,0.,0.};
19 AliCDBManager *man = AliCDBManager::Instance();
20 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
21 Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
22
23 /* common time-slewing params */
104ba366 24 for (Int_t iSlew = 0; iSlew < 6; iSlew++)
25 slewPar[iSlew] = calibHisto.GetCalibPar(AliTOFcalibHisto::kTimeSlewingPar, iSlew);
0bce2dda 26
27 /* channel-related params */
28 for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
29 AliTOFChannelOffline *calChannelOffline = (AliTOFChannelOffline*)tofCalOffline->At(ipad);
104ba366 30 par[0] = slewPar[0] + calibHisto.GetFullCorrection(ipad);
31 par[1] = slewPar[1];
32 par[2] = slewPar[2];
33 par[3] = slewPar[3];
34 par[4] = slewPar[4];
35 par[5] = slewPar[5];
0bce2dda 36 calChannelOffline->SetSlewPar(par);
37 }
38
39 /* write */
40 tofcalib->WriteParOfflineOnCDB("TOF/Calib","valid",0,AliCDBRunRange::Infinity());
41}
42
43