]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/PHOSTasks/PHOSCalib/mkOCDB.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOSCalib / mkOCDB.C
1 void mkOCDB(const Bool_t toGRID=kFALSE, const Bool_t debug=kFALSE)
2 {
3   // This script reads PHOS-EMC calibration object from OCDB raw://,
4   // then reads corrections to gains O(1) from local://OCDB_corr
5   // and create the new OCDB object with the new gains as a product of old gains
6   // and gain corrections.
7   // The new calibration object is written either to local://OCDB_new
8   // --
9   // Gain corrections were found by equalizing the mean cell energy
10   // from the reconstructed data LHC10h by B.Polishchuk
11   // --
12   // Yuri Kharlov. 7-Feb-2011
13   gROOT->cd() ;
14
15   AliCDBManager::Instance()->SetDefaultStorage("raw://");
16
17   AliCDBManager::Instance()->SetRun(182724); //LHC12c
18   AliPHOSCalibData db1(182724);
19
20   TFile fgains("Calibration_pass1.root") ;
21   char key[55] ;
22   Int_t module=3;
23   sprintf(key,"Mass_mod%d",module) ;
24   TH2D * h=(TH2D*)fgains.Get(key) ;
25  
26   
27   char key[55] ;
28   for(Int_t module=3; module<4; module++) {
29
30     for(Int_t ix=48; ix<64; ix++) {
31       for(Int_t iz=28; iz<56; iz++) {
32
33         Float_t cc_i = db1.GetADCchannelEmc(module+1,iz+1,ix+1);
34         Float_t corr = h->GetBinContent(ix+1,iz+1) ;
35         printf("ix=%d, iz=%d, corr=%f \n",ix,iz,corr) ;
36           printf("    old=%f \n",db1.GetADCchannelEmc(module+1,iz+1,ix+1));
37         if(corr>0){
38           db1.SetADCchannelEmc(module+1,iz+1,ix+1,cc_i*corr);
39           printf("    new=%f \n",db1.GetADCchannelEmc(module+1,iz+1,ix+1));
40         }
41       }
42     }
43   }
44   
45   //Writing new calibration coefficients (CCs) to OCDB
46
47   AliCDBManager* cdb = AliCDBManager::Instance();
48   cdb->SetDefaultStorage("local://OCDB");
49
50   AliCDBMetaData *md= new AliCDBMetaData();
51   md->SetResponsible("Dmitri Peressounko");
52   md->SetComment("PHOS gains calculated from pi0 peak position (LHC12c). Corrected for HV adjustment. Widht 3.8-4.8 MeV");
53   AliCDBId id("PHOS/Calib/EmcGainPedestals",177295,AliCDBRunRange::Infinity());
54 //   cdb->Put(&db1,id, md);
55   db1.WriteEmc(177295,AliCDBRunRange::Infinity(),md);
56
57
58   
59 }