calibration classes and DB
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 24 Mar 2006 14:27:12 +0000 (14:27 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 24 Mar 2006 14:27:12 +0000 (14:27 +0000)
START/AliSTARTAlignData.cxx [new file with mode: 0644]
START/AliSTARTAlignData.h [new file with mode: 0644]
START/AliSTARTCalibData.cxx [new file with mode: 0644]
START/AliSTARTCalibData.h [new file with mode: 0644]

diff --git a/START/AliSTARTAlignData.cxx b/START/AliSTARTAlignData.cxx
new file mode 100644 (file)
index 0000000..1f0825c
--- /dev/null
@@ -0,0 +1,93 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// class for START calibrationalignment                                      //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliSTARTAlignData.h"
+
+ClassImp(AliSTARTAlignData)
+
+//________________________________________________________________
+AliSTARTAlignData::AliSTARTAlignData()
+{
+  // Default constructor
+  Reset();
+}
+
+//________________________________________________________________
+AliSTARTAlignData::AliSTARTAlignData(const char* name)
+{
+  // Constructor
+  TString namst = "Align_";
+  namst += name;
+  SetName(namst.Data());
+  SetTitle(namst.Data());
+  Reset();
+}
+
+//________________________________________________________________
+AliSTARTAlignData::AliSTARTAlignData(const AliSTARTAlignData& alignda) :
+  TNamed(alignda)
+{
+  // copy constructor
+  SetName(alignda.GetName());
+  SetTitle(alignda.GetName());
+  Reset();
+  fSTARTzPosition[0] = alignda.GetZposition(0);
+  fSTARTzPosition[1] = alignda.GetZposition(1);
+}
+
+//________________________________________________________________
+AliSTARTAlignData &AliSTARTAlignData::operator =(const AliSTARTAlignData& alignda)
+{
+  // assignment operator
+  SetName(alignda.GetName());
+  SetTitle(alignda.GetName());
+  Reset();
+  fSTARTzPosition[0] = alignda.GetZposition(0);
+  fSTARTzPosition[1] = alignda.GetZposition(1);
+  return *this;
+}
+
+//________________________________________________________________
+AliSTARTAlignData::~AliSTARTAlignData()
+{
+  // Destructor
+}
+
+//________________________________________________________________
+void AliSTARTAlignData::Reset()
+{
+  // Set all pedestals to 0 and all ADC channels to 1
+  memset(fSTARTzPosition,0,2*sizeof(Float_t));
+
+}
+
+//________________________________________________________________
+void  AliSTARTAlignData::Print(Option_t *option) const
+{
+  // Print tables of pedestals and ADC channels
+
+  printf("START aignment data:\n");
+  printf("Z(A) = %f.2 cm, Z(C) = %f.2 cm\n",
+        fSTARTzPosition[0],fSTARTzPosition[1]);
+
+}
diff --git a/START/AliSTARTAlignData.h b/START/AliSTARTAlignData.h
new file mode 100644 (file)
index 0000000..d92be5b
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef ALISTARTALIGNDATA_H
+#define ALISTARTALIGNDATA_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+////////////////////////////////////////////////
+//  class for START algnment                  //
+////////////////////////////////////////////////
+
+#include "TNamed.h"
+#include "AliSTART.h"
+
+class AliSTARTAlignData: public TNamed {
+
+ public:
+  AliSTARTAlignData();
+  AliSTARTAlignData(const char* name);
+  AliSTARTAlignData(const AliSTARTAlignData &alignda);
+  AliSTARTAlignData& operator= (const AliSTARTAlignData &alignda);
+  virtual ~AliSTARTAlignData();
+  void Reset();
+  virtual void Print(Option_t *option = "") const; 
+  //
+  Float_t GetZposition(Int_t i) const {return fSTARTzPosition[i];}
+  //
+  void SetZposition( Float_t valueC, Float_t valueA) {
+    fSTARTzPosition[0]=valueC, fSTARTzPosition[1]=valueA;}
+
+ protected:
+  Float_t  fSTARTzPosition[2] ;  // z-position of the two STARTs
+  //
+  ClassDef(AliSTARTAlignData,1)    // START Alignment data
+};
+
+#endif
diff --git a/START/AliSTARTCalibData.cxx b/START/AliSTARTCalibData.cxx
new file mode 100644 (file)
index 0000000..dd61a46
--- /dev/null
@@ -0,0 +1,174 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// class for T0 calibration                       TM-AC-AM_6-02-2006         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+#include <TCanvas.h>
+
+#include "AliSTARTCalibData.h"
+#include "TObjArray.h"
+#include "TGraph.h"
+#include "TFile.h"
+#include "AliLog.h"
+#include "TObjString.h"
+
+#include "TAxis.h"
+#include "TH2F.h"
+
+
+
+ClassImp(AliSTARTCalibData)
+
+//________________________________________________________________
+  AliSTARTCalibData::AliSTARTCalibData():   TNamed()
+
+{
+  //
+}
+
+//________________________________________________________________
+AliSTARTCalibData::AliSTARTCalibData(const char* name):TNamed()
+{
+  TString namst = "Calib_";
+  namst += name;
+  SetName(namst.Data());
+  SetTitle(namst.Data());
+
+}
+
+//________________________________________________________________
+AliSTARTCalibData::AliSTARTCalibData(const AliSTARTCalibData& calibda) :
+  TNamed(calibda)
+{
+// copy constructor
+  SetName(calibda.GetName());
+  SetTitle(calibda.GetName());
+
+
+}
+
+//________________________________________________________________
+AliSTARTCalibData &AliSTARTCalibData::operator =(const AliSTARTCalibData& calibda)
+{
+// assignment operator
+  SetName(calibda.GetName());
+  SetTitle(calibda.GetName());
+  return *this;
+}
+
+//________________________________________________________________
+AliSTARTCalibData::~AliSTARTCalibData()
+{
+
+}
+//________________________________________________________________
+void AliSTARTCalibData::Reset()
+{
+    memset(fTimeDelayCFD,1,24*sizeof(Float_t));
+    memset(fTimeDelayLED,1,24*sizeof(Float_t));
+    memset(fGain,1,24*sizeof(Float_t));
+}
+
+
+//________________________________________________________________
+void  AliSTARTCalibData::Print(Option_t*) const
+{
+
+  printf("\n   ----    PM Arrays       ----\n\n");
+  printf(" Time delay CFD \n");
+  for (Int_t i=0; i<24; i++) printf("  %f",fTimeDelayCFD[i]);
+  printf(" \n LED \n");
+  for (Int_t i=0; i<24; i++) printf("  %f",fTimeDelayLED[i]);
+  printf(" \n Gain \n");
+  for (Int_t i=0; i<24; i++) printf("  %f",fGain[i]);
+  printf(" \n");
+} 
+
+
+
+//________________________________________________________________
+void AliSTARTCalibData::SetTimeDelayCFD(Float_t* TimeDelay)
+{
+  if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayCFD[t] = TimeDelay[t];
+  //  else for(int t=0; t<24; t++) fTimeDelay[t] = 0.;
+}
+//________________________________________________________________
+void AliSTARTCalibData::SetTimeDelayLED(Float_t* TimeDelay)
+{
+  if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayLED[t] = TimeDelay[t];
+  //  else for(int t=0; t<24; t++) fTimeDelay[t] = 0.;
+}
+
+//________________________________________________________________
+void AliSTARTCalibData::SetGain(Float_t* Gain)
+{
+  if(Gain) for(int t=0; t<24; t++) fGain[t] = Gain[t];
+  // else for(int t=0; t<24; t++) fGain[t] = 0.;
+}
+
+
+//________________________________________________________________
+void AliSTARTCalibData::SetWalk(Int_t ipmt, const Char_t *filename)
+{
+
+  TFile *file = new TFile(filename);
+  char funcname[256];
+  sprintf(funcname,"CFD%i",ipmt+1);
+  TF1* gr = (TF1*)file->Get(funcname);
+  gr->Print();
+  fWalk.AddAtAndExpand(gr,ipmt);
+  file->Close();
+}
+
+
+//________________________________________________________________
+
+void AliSTARTCalibData::SetSlewingLED(Int_t ipmt,const Char_t *filename)
+{
+  Float_t mv, ps; 
+  Float_t x[100], y[100];
+  cout<<"capacity  "<<fSlewingLED.Capacity()<<endl;
+  string buffer;
+  
+  ifstream inFile(filename);
+  if(!inFile) {AliError(Form("Cannot open file %s !",filename));}
+  
+  inFile >> mv>>ps;
+  Int_t i=0;
+  
+  while(getline(inFile,buffer)){
+    x[i]=mv; y[i]=ps;  
+    inFile >> mv >> ps;
+    i++;
+  }
+  inFile.close();
+  TGraph* gr = new TGraph(i,x,y);
+  fSlewingLED.AddAtAndExpand(gr,ipmt);
+  cout<<"capacity end "<<fSlewingLED.Capacity()<<endl;
+
+  
+}
+
diff --git a/START/AliSTARTCalibData.h b/START/AliSTARTCalibData.h
new file mode 100644 (file)
index 0000000..d87bd42
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef AliSTARTCalibData_H
+#define AliSTARTCalibData_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////
+//  class for START calibration                 //
+////////////////////////////////////////////////
+
+#include "TNamed.h"
+#include "TF1.h"
+#include "AliSTARTCalibData.h"
+#include "TMap.h"
+#include "TGraph.h"
+#include "TString.h"
+#include "TObjArray.h"
+#include "AliSTART.h"
+
+class AliSTARTCalibData: public TNamed {
+
+ public:
+  AliSTARTCalibData();
+  AliSTARTCalibData(const char* name);
+  AliSTARTCalibData(const AliSTARTCalibData &calibda);
+  AliSTARTCalibData& operator= (const AliSTARTCalibData &calibda);
+  virtual ~AliSTARTCalibData();
+  void Reset();
+  
+  virtual void  Print(Option_t* option= "") const; 
+  Float_t  GetTimeDelayCFD(Int_t channel) const {return fTimeDelayCFD[channel];}
+  Float_t* GetTimeDelayCFD()  const  {return(float*) fTimeDelayCFD;}
+  Float_t  GetTimeDelayLED(Int_t channel) const {return fTimeDelayLED[channel];}
+  Float_t* GetTimeDelayLED()  const  {return(float*) fTimeDelayLED;}
+
+  Float_t   GetGain(Int_t channel) const {return fGain[channel];}
+  Float_t*  GetGain()  const {return (float*)fGain;}
+  void     SetGain(Float_t val, Int_t channel)  {fGain[channel]=val;}
+  void     SetGain(Float_t* Gain);
+  
+  Float_t  GetWalk(Int_t ipmt, Float_t mv )  const {return ((TF1*)fWalk.At(ipmt))->Eval(mv);}
+  void SetWalk(Int_t ipmt, const Char_t *filename="calibr/re.root") ;
+
+   TGraph *  GetSlew(Int_t ipmt) const   {return (TGraph*)fSlewingLED.At(ipmt);}
+  Float_t  GetSlewingLED(Int_t ipmt, Float_t mv)  const 
+      {return((TGraph*)fSlewingLED.At(ipmt))->Eval(mv);}
+
+  void SetSlewingLED(Int_t ipmt, const Char_t *filename) ;
+
+  void     SetTimeDelayCFD(Float_t val, Int_t channel) {fTimeDelayCFD[channel]=val;}
+  void     SetTimeDelayCFD(Float_t* TimeDelay);
+  void     SetTimeDelayLED(Float_t val, Int_t channel) {fTimeDelayLED[channel]=val;}
+  void     SetTimeDelayLED(Float_t* TimeDelay);
+
+
+ protected:
+
+  Float_t  fTimeDelayCFD[24]; // Coeff. for time delay (24 different cables & CFD )
+  Float_t  fTimeDelayLED[24]; // Coeff. for time delay (24 different cables & CFD )
+  Float_t  fGain[24]; // Coeff. for gain (24 different cables & CFD )
+  TObjArray fWalk;  //time - amp. walk
+  TObjArray fSlewingLED;  //time - amp. walk
+  //
+  ClassDef(AliSTARTCalibData,1)    // START Sensor Calibration data
+};
+
+#endif
+