updates to handle both types of calibration objects (online & offline)
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Oct 2007 13:50:09 +0000 (13:50 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Oct 2007 13:50:09 +0000 (13:50 +0000)
TOF/Calib/OnlineDelay/Run0_0_v0_s0.root [new file with mode: 0644]
TOF/Calib/ParOffline/Run0_0_v0_s0.root [new file with mode: 0644]
TOF/Calib/SimParOffline/Run0_0_v0_s0.root [new file with mode: 0644]
TOF/Calib/SimParOnline/Run0_0_v0_s0.root [new file with mode: 0644]
TOF/CreateCalibPars_Ideal.C
TOF/CreateCalibPars_Miscalibrated.C
TOF/CreateCalibPars_Miscalibrated_Scaled.C
TOF/CreateIdealOfflineCalibPars.C [new file with mode: 0644]
TOF/CreateIdealOnlineCalibPars.C [new file with mode: 0644]
TOF/CreateOfflineCalibPars.C [new file with mode: 0644]
TOF/CreateOnlineCalibPars.C [new file with mode: 0644]

diff --git a/TOF/Calib/OnlineDelay/Run0_0_v0_s0.root b/TOF/Calib/OnlineDelay/Run0_0_v0_s0.root
new file mode 100644 (file)
index 0000000..da9bcde
Binary files /dev/null and b/TOF/Calib/OnlineDelay/Run0_0_v0_s0.root differ
diff --git a/TOF/Calib/ParOffline/Run0_0_v0_s0.root b/TOF/Calib/ParOffline/Run0_0_v0_s0.root
new file mode 100644 (file)
index 0000000..7bb5b74
Binary files /dev/null and b/TOF/Calib/ParOffline/Run0_0_v0_s0.root differ
diff --git a/TOF/Calib/SimParOffline/Run0_0_v0_s0.root b/TOF/Calib/SimParOffline/Run0_0_v0_s0.root
new file mode 100644 (file)
index 0000000..c6269f0
Binary files /dev/null and b/TOF/Calib/SimParOffline/Run0_0_v0_s0.root differ
diff --git a/TOF/Calib/SimParOnline/Run0_0_v0_s0.root b/TOF/Calib/SimParOnline/Run0_0_v0_s0.root
new file mode 100644 (file)
index 0000000..1cbb644
Binary files /dev/null and b/TOF/Calib/SimParOnline/Run0_0_v0_s0.root differ
index cc10044..f62d3cb 100644 (file)
@@ -3,12 +3,13 @@ void CreateCalibPars_Ideal(){
   // write it on CDB
   AliCDBManager *man = AliCDBManager::Instance();
   man->SetDefaultStorage("local://$ALICE");
-  AliTOFGeometry *geom = new AliTOFGeometryV5(); 
-  AliTOFcalib *tofcalib = new AliTOFcalib(geom);
-  AliTOFCal *tofCal= new AliTOFCal(geom);
-  tofCal->CreateArray();//"empty" channels as a default for ideal (par,delay=0)
+  AliTOFcalib *tofcalib = new AliTOFcalib();
+  tofcalib->CreateSimCalArrays();
+  TObjArray *tofCalOnline = (TObjArray*) tofcalib->GetTOFSimCalArrayOnline(); 
+  TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFSimCalArrayOffline(); 
   TH1F *hToT= new TH1F(); //"empty" ToT histo as a default for ideal 
-  tofcalib->WriteSimParOnCDB("TOF/Calib",0,0,tofCal,hToT);
+  tofcalib->WriteSimParOnlineOnCDB("TOF/Calib",0,0,tofCalOnline);
+  tofcalib->WriteSimParOfflineOnCDB("TOF/Calib","valid",0,0,tofCalOffline,hToT);
 }
 
 
index 8ef568a..3a076c0 100644 (file)
@@ -1,11 +1,10 @@
 void CreateCalibPars_Miscalibrated(){
   // Create TOF Calibration Object for miscalibrated detector
   // and write it on CDB
-  AliTOFGeometry *geom = new AliTOFGeometryV5(); 
-  AliTOFcalib *tofcalib = new AliTOFcalib(geom);
-  AliTOFCal *tofCal= new AliTOFCal(geom);
-  tofCal->CreateArray();
-
+  AliTOFcalib *tofcalib = new AliTOFcalib();
+  tofcalib->CreateSimCalArrays();
+  TObjArray *tofCalOnline = (TObjArray*) tofcalib->GetTOFSimCalArrayOnline(); 
+  TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFSimCalArrayOffline(); 
   // Input data for decalibration
 
   TFile f("$ALICE_ROOT/TOF/data/spectrum.root","READ");  
@@ -36,13 +35,16 @@ void CreateCalibPars_Miscalibrated(){
   AliCDBManager *man = AliCDBManager::Instance();
   man->SetDefaultStorage("local://$ALICE");
   TRandom *rnd   = new TRandom(4357);
-  for (Int_t ipad = 0 ; ipad<tofCal->NPads(); ipad++){
-    AliTOFChannel *calChannel = tofCal->GetChannel(ipad);
-    calChannel->SetSlewPar(par);
+  Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
+  for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
+    AliTOFChannelOnline *calChannelOnline = (AliTOFChannelOnline*)tofCalOnline->At(ipad);
+    AliTOFChannelOffline *calChannelOffline = (AliTOFChannelOffline*)tofCalOffline->At(ipad);
     delay=rnd->Gaus(meanDelay,sigmaDelay);
-    calChannel->SetDelay(delay);
+    calChannelOnline->SetDelay(delay);
+    calChannelOffline->SetSlewPar(par);
   }
-  tofcalib->WriteSimParOnCDB("TOF/Calib",0,0,tofCal,hToT);
+  tofcalib->WriteSimParOnlineOnCDB("TOF/Calib",0,0,tofCalOnline);
+  tofcalib->WriteSimParOfflineOnCDB("TOF/Calib","valid",0,0,tofCalOffline,hToT);
   f.Close();
 }
 
index 9263666..37c14eb 100644 (file)
@@ -1,11 +1,10 @@
 void CreateCalibPars_Miscalibrated_Scaled(){
   // Create TOF Calibration Object for miscalibrated detector
   // and write it on CDB
-  AliTOFGeometry *geom = new AliTOFGeometryV5(); 
-  AliTOFcalib *tofcalib = new AliTOFcalib(geom);
-  AliTOFCal *tofCal= new AliTOFCal(geom);
-  tofCal->CreateArray();
-
+  AliTOFcalib *tofcalib = new AliTOFcalib();
+  tofcalib->CreateSimCalArrays();
+  TObjArray *tofCalOnline = (TObjArray*) tofcalib->GetTOFSimCalArrayOnline(); 
+  TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFSimCalArrayOffline(); 
   // Input data for decalibration
 
   TFile f("$ALICE_ROOT/TOF/data/spectrumScaled.root","READ");  
@@ -36,13 +35,16 @@ void CreateCalibPars_Miscalibrated_Scaled(){
   AliCDBManager *man = AliCDBManager::Instance();
   man->SetDefaultStorage("local://$ALICE");
   TRandom *rnd   = new TRandom(4357);
-  for (Int_t ipad = 0 ; ipad<tofCal->NPads(); ipad++){
-    AliTOFChannel *calChannel = tofCal->GetChannel(ipad);
-    calChannel->SetSlewPar(par);
+  Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
+  for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
+    AliTOFChannelOnline *calChannelOnline = (AliTOFChannelOnline*)tofCalOnline->At(ipad);
+    AliTOFChannelOffline *calChannelOffline = (AliTOFChannelOffline*)tofCalOffline->At(ipad);
     delay=rnd->Gaus(meanDelay,sigmaDelay);
-    calChannel->SetDelay(delay);
+    calChannelOnline->SetDelay(delay);
+    calChannelOffline->SetSlewPar(par);
   }
-  tofcalib->WriteSimParOnCDB("TOF/Calib",0,0,tofCal,hToT);
+  tofcalib->WriteSimParOnlineOnCDB("TOF/Calib",0,0,tofCalOnline);
+  tofcalib->WriteSimParOfflineOnCDB("TOF/Calib","valid",0,0,tofCalOffline,hToT);
   f.Close();
 }
 
diff --git a/TOF/CreateIdealOfflineCalibPars.C b/TOF/CreateIdealOfflineCalibPars.C
new file mode 100644 (file)
index 0000000..7540a20
--- /dev/null
@@ -0,0 +1,13 @@
+void CreateIdealOfflineCalibPars(){
+  // Create TOF Dummy Offline Calibration Object for reconstruction
+  // and write it on CDB
+  AliTOFcalib *tofcalib = new AliTOFcalib();
+  tofcalib->CreateCalArrays();
+  TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFCalArrayOffline(); 
+  // Write the dummy offline calibration object on CDB
+
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE");
+  tofcalib->WriteParOfflineOnCDB("TOF/Calib","ideal",0,0);
+  return;
+}
diff --git a/TOF/CreateIdealOnlineCalibPars.C b/TOF/CreateIdealOnlineCalibPars.C
new file mode 100644 (file)
index 0000000..ebc0c00
--- /dev/null
@@ -0,0 +1,19 @@
+void CreateIdealOnlineCalibPars(){
+  // Create TOF Dummy Offline Calibration Object for reconstruction
+  // and write it on CDB
+  AliTOFcalib *tofcalib = new AliTOFcalib();
+  tofcalib->CreateCalArrays();
+  TObjArray *tofCalOnline = (TObjArray*) tofcalib->GetTOFCalArrayOnline(); 
+  // Write the dummy offline calibration object on CDB
+
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE");
+  Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
+  for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
+    AliTOFChannelOnline *calChannelOnline = (AliTOFChannelOnline*)tofCalOnline->At(ipad);
+    Float_t delay = 0.;
+    calChannelOnline->SetDelay(delay);
+  }
+  tofcalib->WriteParOnlineOnCDB("TOF/Calib",0,0);
+  return;
+}
diff --git a/TOF/CreateOfflineCalibPars.C b/TOF/CreateOfflineCalibPars.C
new file mode 100644 (file)
index 0000000..186adc4
--- /dev/null
@@ -0,0 +1,43 @@
+void CreateOfflineCalibPars(){
+  // Create TOF Offline Calibration Object for reconstruction
+  // and write it on CDB
+  AliTOFcalib *tofcalib = new AliTOFcalib();
+  tofcalib->CreateCalArrays();
+  TObjArray *tofCalOffline = (TObjArray*) tofcalib->GetTOFCalArrayOffline(); 
+
+  TFile f("$ALICE_ROOT/TOF/data/spectrumScaled.root","READ");  
+
+  TH1F *hTimeToTFit=  (TH1F*)f.Get("hTimeToTScaled");
+  TF1  *fit=hTimeToTFit->GetFunction("pol5");
+  
+  // Slewing parameters (same for all channels)
+
+  Float_t delay=0.;
+  Float_t meanDelay=0.3;
+  Float_t sigmaDelay=0.08;
+  TRandom *rnd   = new TRandom(4357);
+
+  Float_t par[6] = {0.,0.,0.,0.,0.,0.};
+  for(Int_t i =0;i<6;i++){
+    par[i]=fit->GetParameter(i);
+    cout << " Slewing parameter " <<i<<" =" << par[i] << endl;
+  }
+
+
+  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]+=delay.; // adding time delay
+    calChannelOffline->SetSlewPar(par);
+  }
+  // Write the valid offline calibration object on CDB
+
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE");
+  tofcalib->WriteParOfflineOnCDB("TOF/Calib","valid",0,0);
+  f.Close();
+  return;
+
+}
diff --git a/TOF/CreateOnlineCalibPars.C b/TOF/CreateOnlineCalibPars.C
new file mode 100644 (file)
index 0000000..5c0ac87
--- /dev/null
@@ -0,0 +1,23 @@
+void CreateOnlineCalibPars(){
+  // Create TOF Offline Calibration Object for reconstruction
+  // and write it on CDB
+  AliTOFcalib *tofcalib = new AliTOFcalib();
+  tofcalib->CreateCalArrays();
+  TObjArray *tofCalOnline = (TObjArray*) tofcalib->GetTOFCalArrayOnline(); 
+  // Write the offline calibration object on CDB
+
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE");
+  Int_t nChannels = AliTOFGeometry::NSectors()*(2*(AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB())+AliTOFGeometry::NStripA())*AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX();
+  Float_t delay=0.;
+  Float_t meanDelay=0.3;
+  Float_t sigmaDelay=0.08;
+  TRandom *rnd   = new TRandom(4357);
+  for (Int_t ipad = 0 ; ipad<nChannels; ipad++){
+    AliTOFChannelOnline *calChannelOnline = (AliTOFChannelOnline*)tofCalOnline->At(ipad);
+    delay = rnd->Gaus(meanDelay,sigmaDelay);
+    calChannelOnline->SetDelay(delay);
+  }
+  tofcalib->WriteParOnlineOnCDB("TOF/Calib",0,0);
+  return;
+}