Various hacks to fix up DAs:
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROCalibEntryPbPbNew.C
CommitLineData
81da540f 1#include "VZERO/AliVZEROConst.h"
2
3void MakeVZEROCalibEntryPbPbNew(Int_t run, Int_t outputRun, const char *inputCDB = "raw://", const char *outputCDB = "local://$ALICE_ROOT/OCDB/VZERO/PbPb", Float_t mipperadc = 1./3.){
4
5 AliCDBManager *man = AliCDBManager::Instance();
6
7 man->SetDefaultStorage(inputCDB);
8 man->SetRun(run);
9
10 AliCDBEntry *entry = man->Get("VZERO/Calib/Data");
11 AliVZEROCalibData *calibdaorg = (AliVZEROCalibData*)entry->GetObject();
12 calibdaorg->GetMIPperADC(0);
13 AliVZEROCalibData *calibda = new AliVZEROCalibData(*calibdaorg);
14
15 Float_t *a = calibdaorg->GetPMGainsA();
16 Float_t *b = calibdaorg->GetPMGainsB();
17
18 for (Int_t i = 0; i < 64; ++i) {
19 Float_t nPhPerMIP = (i < 32) ? 6950 : 33690;
20 Float_t hv = TMath::Exp((TMath::Log(kChargePerADC/(mipperadc*nPhPerMIP*calibdaorg->GetLightYields(i)*0.18*TMath::Qe()))-a[i])/b[i]);
21 calibda->SetMeanHV(hv,i);
22 }
23
24 for (Int_t i = 0; i < 64; ++i) {
25 Float_t mip = (i < 32) ? 6950 : 33690;
26 printf("%d %.1f %.1f %.1f %.1f %.1f %.1f %.1f %f\n",
27 i,
28 calibdaorg->GetMeanHV(i),
29 1./calibdaorg->GetMIPperADC(i),
30 mip*calibdaorg->GetLightYields(i)*0.18*TMath::Qe()*calibdaorg->GetGain(i)/0.6e-12,
31 calibda->GetMeanHV(i),
32 1./calibda->GetMIPperADC(i),
33 mip*calibda->GetLightYields(i)*0.18*TMath::Qe()*calibda->GetGain(i)/0.6e-12,
34 calibda->GetMIPperADC(i)/calibdaorg->GetMIPperADC(i),
35 calibda->GetDiscriThr(i));
36 }
37 for (Int_t i = 0; i < 64; ++i) {
38 printf("Channel = %d %d V\n",
39 i,TMath::Nint(calibda->GetMeanHV(i)));
40 }
41
42 // Creation of the object VZERO Calibration as a MetaData
43 AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
44 md->SetResponsible("Brigitte Cheynis");
45 md->SetBeamPeriod(0);
46 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
47 md->SetComment("Pb-Pb VZERO Calibration from RAW OCDB");
48 AliCDBId id("VZERO/Calib/Data",outputRun,outputRun);
49
50 man->SetDefaultStorage(outputCDB);
51 AliCDBStorage *storLoc = man->GetDefaultStorage();
52 storLoc->Put(calibda, id, md);
53
54}