CMake: Changing DA detector name to DA0 to match DAQ settings
[u/mrichter/AliRoot.git] / ZDC / MakeZDCPedestalCalib.C
CommitLineData
00420db1 1MakeZDCPedestalCalib(){
2 // Create OCDB object for ZDC pedestal
3 const char* macroname = "MakeZDCPedestalCalib.C";
4
5 const Int_t nch = 24;
6 Float_t MeanPed[2*nch], MeanPedWidth[2*nch],
7 MeanPedOOT[2*nch], MeanPedWidthOOT[2*nch],
8 CorrCoeff0[2*nch], CorrCoeff1[2*nch];
9 for(int j=0; j<2*nch; j++){
10 if(j<nch){
11 MeanPed[j] = MeanPedOOT[j] = 50.;
12 MeanPedWidth[j] = MeanPedWidthOOT[j] = 4.;
13 CorrCoeff0[j] = 0.;
14 CorrCoeff1[j] = 1.;
15 }
16 else{
17 MeanPed[j] = MeanPedOOT[j] = 8.*50.;
18 MeanPedWidth[j] = MeanPedWidthOOT[j] = 8.*4..;
19 CorrCoeff0[j] = 0.;
20 CorrCoeff1[j] = 1.;
21 }
22 }
23
24 AliZDCPedestals *calibPed = new AliZDCPedestals("ZDC");
25 calibPed->SetMeanPed(MeanPed);
26 calibPed->SetMeanPedWidth(MeanPedWidth);
27 calibPed->SetOOTPed(MeanPedOOT);
28 calibPed->SetOOTPedWidth(MeanPedWidthOOT);
29 calibPed->SetPedCorrCoeff(CorrCoeff0, CorrCoeff1);
30
31 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
32 // save in file
33 const char* filename = "ZDCPedestals.root";
34 TFile f(filename, "RECREATE");
35 if(!f){
36 Error(macroname,"cannot open file for output\n");
37 return;
38 }
39 Info(macroname,"Saving alignment objects to the file %s", filename);
40 f.cd();
41 f.WriteObject(calibPed,"ZDCPedestals","kSingleKey");
42 f.Close();
43 }
44 else{
45 // save in CDB storage
46 TString Storage = gSystem->Getenv("STORAGE");
47 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
48 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
49 return;
50 }
51 Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data());
52 AliCDBManager* cdb = AliCDBManager::Instance();
53 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
54 if(!storage){
55 Error(macroname,"Unable to open storage %s\n",Storage.Data());
56 return;
57 }
58 AliCDBMetaData* md = new AliCDBMetaData();
59 md->SetResponsible("Chiara Oppedisano");
60 md->SetComment("Calibration objects for ZDC pedestals");
61 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
62 md->SetObjectClassName("AliZDCPedestals");
63 AliCDBId id("ZDC/Calib/Pedestals",0,AliCDBRunRange::Infinity());
64 storage->Put(calibPed,id,md);
65 }
66
67 calibPed->Delete();
68
69}