forked from alisw/AliRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateCalibPars_Miscalibrated.C
51 lines (39 loc) · 1.68 KB
/
CreateCalibPars_Miscalibrated.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
void CreateCalibPars_Miscalibrated(){
// Create TOF Calibration Object for miscalibrated detector
// and write it on CDB
AliTOFcalib *tofcalib = new AliTOFcalib();
tofcalib->CreateCalArrays();
TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFCalArrayOffline();
// Input data for decalibration
TFile f("$ALICE_ROOT/TOF/data/spectrum.root","READ");
TH1F *hTimeToTFit= (TH1F*)f.Get("hTimeToTLim");
TF1 *fit=hTimeToTFit->GetFunction("pol5");
// Slewing parameters (same for all channels)
Float_t par[6] = {0.,0.,0.,0.,0.,0.};
Float_t kpar=0;
for(Int_t i =0;i<6;i++){
par[i]=fit->GetParameter(i);
kpar=par[0];
cout << " Slewing parameters=" << par[i] << endl;
}
// Global time offset (randomly gen, gaussian with mean = 0.3, sig=0.08 ns)
Float_t delay=0.;
Float_t meanDelay=0.3;
Float_t sigmaDelay=0.08;
// ToT spectrum
TH1F *hToT= (TH1F*)f.Get("hToTLim");
// Fill the Sim calibration object
AliCDBManager *man = AliCDBManager::Instance();
man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
TRandom *rnd = new TRandom(4357);
Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
AliTOFChannelOffline *calChannelOffline = (AliTOFChannelOffline*)tofCalOffline->At(ipad);
delay=rnd->Gaus(meanDelay,sigmaDelay);
par[0]=kpar+delay;
calChannelOffline->SetSlewPar(par);
}
tofcalib->WriteParOfflineOnCDB("TOF/Calib","valid",0,AliCDBRunRange::Infinity());
tofcalib->WriteSimHistoOnCDB("TOF/Calib",0,AliCDBRunRange::Infinity(),hToT);
f.Close();
}