]>
Commit | Line | Data |
---|---|---|
12ec3441 | 1 | void CreateCalibPars_Miscalibrated_Scaled(){ |
2 | // Create TOF Calibration Object for miscalibrated detector | |
3 | // and write it on CDB | |
096b3668 | 4 | AliTOFcalib *tofcalib = new AliTOFcalib(); |
40212801 | 5 | tofcalib->CreateCalArrays(); |
6 | TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFCalArrayOffline(); | |
12ec3441 | 7 | // Input data for decalibration |
8 | ||
9 | TFile f("$ALICE_ROOT/TOF/data/spectrumScaled.root","READ"); | |
10 | ||
11 | TH1F *hTimeToTFit= (TH1F*)f.Get("hTimeToTScaled"); | |
12 | TF1 *fit=hTimeToTFit->GetFunction("pol5"); | |
13 | ||
14 | // Slewing parameters (same for all channels) | |
15 | ||
16 | Float_t par[6] = {0.,0.,0.,0.,0.,0.}; | |
40212801 | 17 | Float_t kpar=0; |
12ec3441 | 18 | for(Int_t i =0;i<6;i++){ |
19 | par[i]=fit->GetParameter(i); | |
40212801 | 20 | kpar=par[0]; |
0adec857 | 21 | cout << " Slewing parameter " <<i<<" =" << par[i] << endl; |
12ec3441 | 22 | } |
23 | ||
0adec857 | 24 | // Global time offset (randomly gen, gaussian with mean = 0.3, sig=0.08 ns) |
25 | ||
26 | Float_t delay=0.; | |
27 | Float_t meanDelay=0.3; | |
28 | Float_t sigmaDelay=0.08; | |
12ec3441 | 29 | |
30 | // ToT spectrum | |
0adec857 | 31 | |
12ec3441 | 32 | TH1F *hToT= (TH1F*)f.Get("hToTScaled"); |
33 | ||
34 | // Fill the Sim calibration object | |
35 | ||
6c757316 | 36 | AliCDBManager *man = AliCDBManager::Instance(); |
37 | man->SetDefaultStorage("local://$ALICE"); | |
0adec857 | 38 | TRandom *rnd = new TRandom(4357); |
096b3668 | 39 | Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX(); |
40 | for (Int_t ipad = 0 ; ipad<nChannels; ipad++){ | |
096b3668 | 41 | AliTOFChannelOffline *calChannelOffline = (AliTOFChannelOffline*)tofCalOffline->At(ipad); |
0adec857 | 42 | delay=rnd->Gaus(meanDelay,sigmaDelay); |
40212801 | 43 | par[0]=kpar+delay; |
096b3668 | 44 | calChannelOffline->SetSlewPar(par); |
12ec3441 | 45 | } |
40212801 | 46 | tofcalib->WriteParOfflineOnCDB("TOF/Calib","valid",0,AliCDBRunRange::Infinity()); |
47 | tofcalib->WriteSimHistoOnCDB("TOF/Calib",0,AliCDBRunRange::Infinity(),hToT); | |
12ec3441 | 48 | f.Close(); |
49 | } | |
50 | ||
51 |