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