forked from alisw/AliRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakeZDCTDCCalib.C
50 lines (45 loc) · 1.68 KB
/
MakeZDCTDCCalib.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
MakeZDCTDCCalib(){
// Create OCDB object for ZDC TDC calibration
const char* macroname = "MakeZDCTDCCalib.C";
AliZDCTDCCalib *tdcCalib = new AliZDCTDCCalib();
for(Int_t j=0; j<6; j++){
tdcCalib->SetMeanTDC(j, 0.);
tdcCalib->SetWidthTDC(j, 2.5);
}
if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
// save in file
const char* filename = "ZDCTDCCalib.root";
TFile f(filename, "RECREATE");
if(!f){
Error(macroname,"cannot open file for output\n");
return;
}
Info(macroname,"Saving alignment objects to the file %s", filename);
f.cd();
f.WriteObject(tdcCalib,"ZDCTDCCalib","kSingleKey");
f.Close();
}
else{
// save in CDB storage
TString Storage = gSystem->Getenv("STORAGE");
if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
return;
}
Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data());
AliCDBManager* cdb = AliCDBManager::Instance();
AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
if(!storage){
Error(macroname,"Unable to open storage %s\n",Storage.Data());
return;
}
AliCDBMetaData* md = new AliCDBMetaData();
md->SetResponsible("Chiara Oppedisano");
md->SetComment("Calibration objects for ZDC saturation calibration");
md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
md->SetObjectClassName("AliZDCTDCCalib");
AliCDBId id("ZDC/Calib/TDCCalib",0,AliCDBRunRange::Infinity());
storage->Put(tdcCalib,id,md);
}
tdcCalib->Delete();
}