Updates
[u/mrichter/AliRoot.git] / TOF / CreateOnlineCalibPars.C
CommitLineData
be2ca2e7 1void CreateOnlineCalibPars(){
17149e6b 2
be2ca2e7 3 // Create TOF Online Calibration Object for reconstruction
3f2237b1 4 // and write it on CDB;
5 // NB: only delay set, status still ok
17149e6b 6 // Both old type objects (using TObjArrays) and new type objects (using AliTOFChannelOnlineArray/
7 // AliTOFChannelOnlineStatusArray are written
8
be2ca2e7 9 AliTOFcalib *tofcalib = new AliTOFcalib();
10 tofcalib->CreateCalArrays();
11 TObjArray *tofCalOnline = (TObjArray*) tofcalib->GetTOFCalArrayOnline();
3f2237b1 12 TObjArray *tofCalOnlinePulser = (TObjArray*) tofcalib->GetTOFCalArrayOnlinePulser();
13 TObjArray *tofCalOnlineNoise = (TObjArray*) tofcalib->GetTOFCalArrayOnlineNoise();
14 TObjArray *tofCalOnlineHW = (TObjArray*) tofcalib->GetTOFCalArrayOnlineHW();
17149e6b 15 AliTOFChannelOnlineArray *delayObj = (AliTOFChannelOnlineArray*) tofcalib->GetTOFOnlineDelay();
16 AliTOFChannelOnlineStatusArray *status = (AliTOFChannelOnlineStatusArray*) tofcalib->GetTOFOnlineStatus();
17 // Write the online calibration object on CDB
be2ca2e7 18
19 AliCDBManager *man = AliCDBManager::Instance();
162637e4 20 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
be2ca2e7 21 Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
22 Float_t delay=0.;
23 Float_t meanDelay=0.3;
24 Float_t sigmaDelay=0.08;
25 TRandom *rnd = new TRandom(4357);
26 for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
27 AliTOFChannelOnline *calChannelOnline = (AliTOFChannelOnline*)tofCalOnline->At(ipad);
3f2237b1 28 AliTOFChannelOnlineStatus *calChannelOnlinePulser = (AliTOFChannelOnlineStatus*)tofCalOnlinePulser->At(ipad);
29 AliTOFChannelOnlineStatus *calChannelOnlineNoise = (AliTOFChannelOnlineStatus*)tofCalOnlineNoise->At(ipad);
30 AliTOFChannelOnlineStatus *calChannelOnlineHW = (AliTOFChannelOnlineStatus*)tofCalOnlineHW->At(ipad);
be2ca2e7 31 delay = rnd->Gaus(meanDelay,sigmaDelay);
17149e6b 32 delayObj->SetDelay(ipad,delay);
be2ca2e7 33 calChannelOnline->SetDelay(delay);
3f2237b1 34 calChannelOnlinePulser->SetStatus(AliTOFChannelOnlineStatus::kTOFPulserOk);
35 calChannelOnlineNoise->SetStatus(AliTOFChannelOnlineStatus::kTOFNoiseOk);
36 calChannelOnlineHW->SetStatus(AliTOFChannelOnlineStatus::kTOFHWOk);
17149e6b 37 status->SetHWStatus(ipad,AliTOFChannelOnlineStatusArray::kTOFHWOk);
38 status->SetPulserStatus(ipad,AliTOFChannelOnlineStatusArray::kTOFPulserOk);
39 status->SetNoiseStatus(ipad,AliTOFChannelOnlineStatusArray::kTOFNoiseOk);
be2ca2e7 40 }
17149e6b 41 tofcalib->WriteParOnlineDelayOnCDB("TOF/Calib"); // new obj
42 tofcalib->WriteParOnlineStatusOnCDB("TOF/Calib"); // new obj
43 tofcalib->WriteParOnlineOnCDB("TOF/Calib"); // old object
44 tofcalib->WriteParOnlinePulserOnCDB("TOF/Calib"); // old obj
45 tofcalib->WriteParOnlineNoiseOnCDB("TOF/Calib"); // old obj
46 tofcalib->WriteParOnlineHWOnCDB("TOF/Calib"); // old obj
be2ca2e7 47 return;
48}