]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/CreateCalibPars_Miscalibrated_Scaled.C
limit histo range for ToT to a sensible range
[u/mrichter/AliRoot.git] / TOF / CreateCalibPars_Miscalibrated_Scaled.C
CommitLineData
12ec3441 1void CreateCalibPars_Miscalibrated_Scaled(){
2 // Create TOF Calibration Object for miscalibrated detector
3 // and write it on CDB
4 AliTOFGeometry *geom = new AliTOFGeometryV5();
5 AliTOFcalib *tofcalib = new AliTOFcalib(geom);
6 AliTOFCal *tofCal= new AliTOFCal(geom);
7 tofCal->CreateArray();
8
9 // Input data for decalibration
10
11 TFile f("$ALICE_ROOT/TOF/data/spectrumScaled.root","READ");
12
13 TH1F *hTimeToTFit= (TH1F*)f.Get("hTimeToTScaled");
14 TF1 *fit=hTimeToTFit->GetFunction("pol5");
15
16 // Slewing parameters (same for all channels)
17
18 Float_t par[6] = {0.,0.,0.,0.,0.,0.};
19 for(Int_t i =0;i<6;i++){
20 par[i]=fit->GetParameter(i);
21 cout << " Slewing parameters=" << par[i] << endl;
22 }
23
24 // Global time offset 3 ns
25 Float_t delay=3.;
26
27 // ToT spectrum
28 TH1F *hToT= (TH1F*)f.Get("hToTScaled");
29
30 // Fill the Sim calibration object
31
32 // TRandom *rnd = new TRandom(4357);
33 for (Int_t ipad = 0 ; ipad<tofCal->NPads(); ipad++){
34 AliTOFChannel *calChannel = tofCal->GetChannel(ipad);
35 calChannel->SetSlewPar(par);
36 calChannel->SetDelay(delay);
37 }
38 tofcalib->WriteSimParOnCDB("TOF/Calib",0,0,tofCal,hToT);
39 f.Close();
40}
41
42