char funcname[256];
sprintf(funcname,"CFD%i",ipmt+1);
TF1* gr = (TF1*)file->Get(funcname);
- gr->Print();
fWalk.AddAtAndExpand(gr,ipmt);
file->Close();
}
{
Float_t mv, ps;
Float_t x[100], y[100];
- cout<<"capacity "<<fSlewingLED.Capacity()<<endl;
string buffer;
ifstream inFile(filename);
inFile.close();
TGraph* gr = new TGraph(i,x,y);
fSlewingLED.AddAtAndExpand(gr,ipmt);
- cout<<"capacity end "<<fSlewingLED.Capacity()<<endl;
+
+}
+
+//________________________________________________________________
+void AliSTARTCalibData::SetSlewingRec(Int_t ipmt,const Char_t *filename)
+{
+ Float_t mv, ps;
+ Float_t x[100], y[100];
+ 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();
+ Float_t y1[100], x1[100];
+ for (Int_t ir=0; ir<i; ir++){
+ y1[ir]=y[i-ir]; x1[ir]=x[i-ir];}
+ TGraph* gr = new TGraph(i,y1,x1);
+ fSlewingRec.AddAtAndExpand(gr,ipmt);
}
+
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);}
+ TGraph * GetSlewRec(Int_t ipmt) const {return (TGraph*)fSlewingRec.At(ipmt);}
+ Float_t GetSlewingRec(Int_t ipmt, Float_t mv) const
+ {return((TGraph*)fSlewingRec.At(ipmt))->Eval(mv);}
void SetSlewingLED(Int_t ipmt, const Char_t *filename) ;
+ void SetSlewingRec(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);
+ void SetTimeDelayTVD(Int_t r=150) { fTimeDelayTVD = r; };
+ Float_t GetTimeDelayTVD() { return fTimeDelayTVD; }
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 )
+ Float_t fTimeDelayTVD; //time delay for TVD (vertex trigger channel)
TObjArray fWalk; //time - amp. walk
- TObjArray fSlewingLED; //time - amp. walk
+ TObjArray fSlewingLED; //time - amp.LED slew
+ TObjArray fSlewingRec; //time - amp. LED slew for reconstruction
//
ClassDef(AliSTARTCalibData,1) // START Sensor Calibration data
};
Int_t threshold =50; //photoelectrons
Float_t zdetA, zdetC;
TObjArray slewingLED;
+ TObjArray slewingRec;
AliSTARTParameters* param = AliSTARTParameters::Instance();
+ param->Init();
+
Int_t ph2Mip = param->GetPh2Mip();
Int_t channelWidth = param->GetChannelWidth() ;
+ Float_t delayVertex = param->GetTimeDelayTVD();
- param->Init();
for (Int_t i=0; i<24; i++){
timeDelayCFD[i] = param->GetTimeDelayCFD(i);
timeDelayLED[i] = param->GetTimeDelayLED(i);
gain[i] = param->GetGain(i);
TGraph* gr = param ->GetSlew(i);
slewingLED.AddAtAndExpand(gr,i);
+
+ TGraph* gr1 = param ->GetSlewRec(i);
+ slewingRec.AddAtAndExpand(gr1,i);
+
TGraph* grEff = param ->GetPMTeff(i);
fEffPMT.AddAtAndExpand(grEff,i);
}
Float_t besttimeleft=99999.;
Int_t pmtBestRight=9999;
Int_t pmtBestLeft=9999;
- Int_t timeDiff=99999, meanTime=0;
+ Int_t timeDiff=999, meanTime=0;
Int_t sumMult =0;
ftimeCFD -> Reset();
fADC -> Reset();
bestRightTDC=Int_t ((besttimeright+1000*timeDelayCFD[pmtBestLeft])
/channelWidth);
- timeDiff=Int_t (((besttimeleft-besttimeright)+1000*timeDelayCFD[pmtBestRight])
+ timeDiff=Int_t (((besttimeleft-besttimeright)+1000*delayVertex)
/channelWidth);
meanTime=Int_t (((besttimeright+1000*timeDelayCFD[pmtBestLeft]+
besttimeleft+1000*timeDelayCFD[pmtBestLeft])/2.)
fADC->AddAt(qtCh,i);
ftimeCFD->AddAt(Int_t (trCFD),i);
ftimeLED->AddAt(trLED,i);
- sumMult += Int_t ((al*gain[i]/ph2Mip)*50) ;
+ sumMult += Int_t ((al/ph2Mip)*50) ;
}
} //pmt loop
//____________________________________________________________________
AliSTARTParameters::AliSTARTParameters()
- : fIsInit(kFALSE)
{
// Default constructor
+
for (Int_t ipmt=0; ipmt<24; ipmt++)
{
SetTimeDelayCablesCFD(ipmt);
SetTimeDelayElectronicCFD(ipmt);
SetTimeDelayElectronicLED(ipmt);
SetTimeDelayPMT(ipmt);
- SetVariableDelayLine(ipmt);
+ SetVariableDelayLine(ipmt);
SetSlewingLED(ipmt);
+ SetSlewingRec(ipmt);
SetPh2Mip();
SetmV2Mip();
SetChannelWidth();
SetQTmax();
SetPMTeff(ipmt);
}
+ SetTimeDelayTVD();
SetZposition();
}
{
// Initialize the parameters manager. We need to get stuff from the
// CDB here.
- // if (fIsInit) return;
+ // if (fIsInit) return;
AliCDBManager* cdb = AliCDBManager::Instance();
- AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
- fCalibentry = stor->Get("START/Calib/Gain_TimeDelay_Slewing_Walk",1);
+ // AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
+ fCalibentry = cdb->Get("START/Calib/Gain_TimeDelay_Slewing_Walk");
if (fCalibentry){
fgCalibData = (AliSTARTCalibData*)fCalibentry->GetObject();
cout<<" got calibdata "<<endl;
}
- fAlignentry = stor-> Get("START/Align/Positions",1);
+ fAlignentry = cdb-> Get("START/Align/Positions");
if (fAlignentry){
fgAlignData = (AliSTARTAlignData*) fAlignentry->GetObject();
cout<<" got align data "<<endl;
AliSTARTParameters::SetSlewingLED(Int_t ipmt)
{
// Set Slweing Correction for LED channel
+ Float_t mv[23] = {25, 30,40,60, 80,100,150,200,250,300,
+ 400,500,600,800,1000,1500, 2000, 3000, 4000, 5500,
+ 6000, 7000,8000};
+ Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781,
+ 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234,
+ 156, 78, 0};
+
+ TGraph* gr = new TGraph(23,mv,y);
+ fSlewingLED.AddAtAndExpand(gr,ipmt);
+ }
+//__________________________________________________________________
+
+Float_t AliSTARTParameters::GetSlewingLED(Int_t ipmt, Float_t mv) const
+{
+ if (!fCalibentry) {
+ return ((TGraph*)fSlewingLED.At(ipmt))->Eval(mv);
+ }
+ return fgCalibData->GetSlewingLED(ipmt, mv) ;
+}
+
+
+//__________________________________________________________________
+
+TGraph *AliSTARTParameters::GetSlew(Int_t ipmt) const
+{
+ if (!fCalibentry) {
+ return (TGraph*)fSlewingLED.At(ipmt);
+ }
+ return fgCalibData -> GetSlew(ipmt) ;
+}
+
+//__________________________________________________________________
+
- Float_t mv[23] = {25, 30,40,60, 80,100,150,200,250,300,400,500,600,800,1000,1500, 2000, 3000, 4000, 5500, 6000, 7000,8000};
- Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 1937, 1781, 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234, 156, 78, 0};
+void
+AliSTARTParameters::SetSlewingRec(Int_t ipmt)
+{
+ // Set Slweing Correction for LED channel
+ Float_t mv[23] = {25, 30, 40,60, 80,100,150,200,250,300,
+ 400,500,600,800,1000,1500, 2000, 3000, 4000, 5500,
+ 6000, 7000,8000};
+ Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781,
+ 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234,
+ 156, 78, 0};
+ Float_t y1[23], mv1[23];
+ for (Int_t i=0; i<23; i++){
+ y1[i] = y[22-i]; mv1[i] = mv[22-i];}
+ cout<<endl;
+ TGraph* gr = new TGraph(23,y1,mv1);
+ fSlewingRec.AddAtAndExpand(gr,ipmt);
+
+}
+//__________________________________________________________________
+
+Float_t AliSTARTParameters::GetSlewingRec(Int_t ipmt, Float_t mv) const
+{
+ if (!fCalibentry) {
+ return ((TGraph*)fSlewingRec.At(ipmt))->Eval(mv);
+ }
+ return fgCalibData -> GetSlewingRec(ipmt, mv) ;
+}
+
+//__________________________________________________________________
+
+TGraph *AliSTARTParameters::GetSlewRec(Int_t ipmt) const
+{
+ if (!fCalibentry) {
+ return (TGraph*)fSlewingRec.At(ipmt);
+ }
+ return fgCalibData -> GetSlewRec(ipmt) ;
+}
- TGraph* gr = new TGraph(23,mv,y);
- fSlewingLED.AddAtAndExpand(gr,ipmt);
- }
//__________________________________________________________________
void
AliSTARTParameters::SetPMTeff(Int_t ipmt)
void SetmV2channel(Int_t size=320) { fmV2Channel = size; }
void SetQTmin(Int_t qt=13) {fQTmin = qt;}
void SetQTmax(Int_t qt=125) {fQTmax = qt;}
- void SetGain(Int_t size=50) { fFixedGain = size; }
+ void SetGain(Int_t size=1) { fFixedGain = size; }
void SetZposition( Float_t valueC=69.7, Float_t valueA=373) {
fSTARTzPosition[0]=valueC, fSTARTzPosition[1]=valueA;}
void SetPMTeff(Int_t ipmt);
+ void SetTimeDelayTVD(Float_t r=150) { fTimeDelayTVD = r; };
+ Float_t GetTimeDelayTVD() { return fTimeDelayTVD; }
+
// Set various variable parameter defaults
void SetTimeDelayCablesCFD(Int_t ipmt,Float_t r=150)
{ fTimeDelayCablesCFD[ipmt] = r;}
void SetVariableDelayLine(Int_t ipmt, Int_t v=0)
{ fVariableDelayLine[ipmt] = v;}
void SetSlewingLED(Int_t ipmt);
+ void SetSlewingRec(Int_t ipmt);
// Get `Fixed' various parameters
Int_t GetVariableDelayLine(Int_t ipmt) const
{return fVariableDelayLine[ipmt];}
- Float_t GetSlewingLED(Int_t ipmt, Float_t mv) const
- {return((TGraph*)fSlewingLED.At(ipmt))->Eval(mv);}
- 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);}
+ TGraph * GetSlew(Int_t ipmt) const ;
+ // {return (TGraph*)fSlewingLED.At(ipmt);}
+ TGraph * GetSlewRec(Int_t ipmt) const;
+ // {return (TGraph*)fSlewingRec.At(ipmt);}
+ Float_t GetSlewingRec(Int_t ipmt, Float_t mv) const;
+ // {return((TGraph*)fSlewingRec.At(ipmt))->Eval(mv);}
Float_t GetTimeDelayCFD(Int_t ipmt);
Float_t GetTimeDelayLED(Int_t ipmt);
virtual ~AliSTARTParameters() {}
static AliSTARTParameters* fgInstance; // Static singleton instance
- Bool_t fIsInit;
+ Bool_t fIsInit; // Whether we've been initialised
Float_t fSTARTzPosition[2] ; // z-position of the two STARTs
Int_t fPh2Mip; // # photoelectrons per MIP in radiator
Int_t fmV2Mip; // # mV per MIP in radiator
Float_t fTimeDelayPMT[24]; //! time delay in PMT
Int_t fVariableDelayLine[24]; //time delay in VDL for trigger equvalizing
TObjArray fSlewingLED; //array of slewing correction for each PMT
+ TObjArray fSlewingRec; //array of slewing correction for Reconstruction
TObjArray fPMTeff; //array PMT registration efficiency
Float_t fTimeDelayLED; // sum time delay for LED channel
Float_t fTimeDelayCFD; // sum time delay for CFD channel
+ Float_t fTimeDelayTVD; //time delay for TVD (vertex trigger channel)
static AliSTARTAlignData * fgAlignData; // singleton for Calibration data
static AliSTARTCalibData * fgCalibData; // singleton for Calibration data
--- /dev/null
+/* $Id$ */
+
+// Script to create calibration parameters and store them into CDB
+// Two sets of calibration parameters can be created:
+// 1) equal parameters
+// 2) randomly distributed parameters for decalibrated detector silumations
+
+#if !defined(__CINT__)
+#include "TControlBar.h"
+#include "TString.h"
+#include "TRandom.h"
+#include "TH1F.h"
+#include "TF1.h"
+#include "TCanvas.h"
+
+#include "AliRun.h"
+#include "AliSTARTCalibData.h"
+#include "AliSTARTAlignData.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBId.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#endif
+
+
+void AliSTARTSetCDB()
+{
+ TControlBar *menu = new TControlBar("vertical","START CDB");
+ menu->AddButton("Set Calib","SetCC()",
+ "Set calibration coefficients");
+ menu->AddButton("Set Align","SetAC()",
+ "Set alignment coefficients");
+ menu->AddButton("Read calibration CC","GetCC()",
+ "Read calibration coefficients");
+ menu->AddButton("Read alignment CC","GetAC()",
+ "Read face detector position ");
+ menu->Show();
+}
+
+
+//------------------------------------------------------------------------
+void SetAC()
+{
+ // Writing alignment coefficients into the Condition DB
+ // Arguments:
+
+ TString DBFolder;
+ Int_t firstRun = 0;
+ Int_t lastRun = 10;
+ Int_t beamPeriod = 1;
+ char* objFormat = "";
+
+ DBFolder ="local://Align";
+ firstRun = 0;
+ lastRun = 10;
+ objFormat = "START array Z positions";
+
+
+ AliSTARTAlignData *alignda=new AliSTARTAlignData("START");
+ alignda-> SetZposition (67.9,373);
+ alignda->Print();
+
+ //Store calibration data into database
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+ AliCDBManager::Instance()->SetSpecificStorage("START",DBFolder.Data());
+
+ AliCDBMetaData md;
+ md.SetComment(objFormat);
+ md.SetBeamPeriod(beamPeriod);
+ md.SetResponsible("Alla");
+ TString fPath="START/Align/Positions";
+
+
+ // AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("START");
+ AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
+ if(storage) {
+ AliCDBId id(fPath.Data(),firstRun,lastRun);
+
+ storage->Put(alignda, id, &md);
+ }
+}
+//------------------------------------------------------------------------
+void SetCC()
+{
+ // Writing calibration coefficients into the Calibration DB
+ // Arguments:
+
+ TString DBFolder;
+ Int_t firstRun = 0;
+ Int_t lastRun = 10;
+ Int_t beamPeriod = 1;
+ char* objFormat = "";
+
+ DBFolder ="local://Calib";
+ firstRun = 0;
+ lastRun = 10;
+ objFormat = "START initial gain factors, time delay, slewnig";
+
+ AliSTARTCalibData *calibda=new AliSTARTCalibData("START");
+
+ Float_t fGain = 1;
+ Float_t fTimeDelay = 200;
+
+ TRandom rn;
+
+ for(Int_t ipmt=0; ipmt<24; ipmt++) {
+ calibda->SetGain (fGain,ipmt);
+ calibda->SetTimeDelayCFD(fTimeDelay,ipmt);
+ calibda->SetTimeDelayLED(fTimeDelay,ipmt);
+ calibda->SetWalk(ipmt,"data/re.root");
+ calibda->SetSlewingLED(ipmt,"data/CFD-LED.txt");
+ calibda->SetSlewingRec(ipmt,"data/CFD-LED.txt");
+ Double_t value=calibda->GetSlewingLED(ipmt,300);
+ Double_t rec= calibda->GetSlewingRec(ipmt, value);
+ cout<<" in "<<value<<" out "<<rec<<endl;
+ }
+ calibda->Print();
+ //Store calibration data into database
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+
+ // AliCDBManager::Instance()->SetSpecificStorage("START",DBFolder.Data());
+
+ AliCDBMetaData md;
+ md.SetComment(objFormat);
+ md.SetBeamPeriod(beamPeriod);
+ md.SetResponsible("Alla");
+ TString fPath="START/Calib/Gain_TimeDelay_Slewing_Walk";
+
+
+ // AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("START");
+ AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
+ if(storage) {
+ AliCDBId id(fPath.Data(),firstRun,lastRun);
+ storage->Put(calibda, id, &md);
+ }
+}
+
+//------------------------------------------------------------------------
+void GetCC()
+{
+ // Read calibration coefficients into the Calibration DB
+ // Arguments:
+
+ TString DBFolder;
+
+ DBFolder ="local://Calib";
+ Int_t nRun=gAlice->GetRunNumber();
+
+ AliCDBManager *man = AliCDBManager::Instance();
+ AliCDBStorage *stor2 = man->GetStorage("local://Calib");
+ AliCDBEntry *entry;
+ entry = stor2->Get("START/Calib/Gain_TimeDelay_Slewing_Walk");
+
+ AliSTARTCalibData *clb = (AliSTARTCalibData*)entry->GetObject();
+ clb->Print();
+}
+//------------------------------------------------------------------------
+void GetAC()
+{
+ // Read align coefficients into the Calibration DB
+ // Arguments:
+
+ TString DBFolder;
+
+ DBFolder ="local://Align";
+ Int_t nRun=gAlice->GetRunNumber();
+
+ AliCDBManager *man = AliCDBManager::Instance();
+ AliCDBStorage *stor2 = man->GetStorage("local://Align");
+ AliCDBEntry *entry;
+ entry = stor2->Get("START/Align/Positions", nRun);
+
+ AliSTARTAlignData *aln = (AliSTARTAlignData*)entry->GetObject();
+ aln->Print();
+}