DA_GAIN: modification of the conditions (second order parameter) to validate gain values
And relevant documentation update.
(Jean-Luc Charvet)
}
//______________________________________________________________________________
-void AliMUONErrorCounter::Print_uncal(const Option_t* option) const
+void AliMUONErrorCounter::PrintUncal(const Option_t* option) const
{
TNamed::Print(option);
cout<<"bp = "<<fBusPatch<< " manu = " << fManuId << " uncal = "<< fEvents <<endl;
public :
AliMUONErrorCounter(Int_t bp = 0, Int_t manu = 0, Int_t ev = 1);
- ///
+ /// Increment nb of erroneous event
void Increment() {fEvents++;}
- ///
+ /// return Buspatch value
Int_t BusPatch() const {return fBusPatch;}
- ///
+ /// return ManuId value
Int_t ManuId() const {return fManuId;}
- ///
+ /// return nb of erroneous events
Int_t Events() const {return fEvents;}
Int_t Compare(const TObject* obj) const;
+ /// Print Buspatch , Nb of erroneous events
void Print(const Option_t* option="") const;
- void Print_uncal(const Option_t* option="") const;
+ /// Print Buspatch, ManuId , Nb of erroneous events
+ void PrintUncal(const Option_t* option="") const;
private :
Int_t fBusPatch; ///< Buspath ID
Int_t fManuId; ///< Manu ID
- Int_t fEvents; ///< Events with error in this buspatch
+ Int_t fEvents; ///< counter of erroneous events
ClassDef(AliMUONErrorCounter,1) //
};
// functions
-
-//______________________________________________________________________________
-Double_t funcLin (const Double_t *x, const Double_t *par)
-{
- /// Linear function
- return par[0] + par[1]*x[0];
-}
-
-//______________________________________________________________________________
-Double_t funcParabolic (const Double_t *x, const Double_t *par)
-{
- /// Parabolic function
- return par[0]*x[0]*x[0];
-}
-
-//______________________________________________________________________________
-Double_t funcCalib (const Double_t *x, const Double_t *par)
-{
- /// Calibration function
- Double_t xLim= par[3];
-
- if(x[0] <= xLim) return par[0] + par[1]*x[0];
-
- Double_t yLim = par[0]+ par[1]*xLim;
- return yLim + par[1]*(x[0] - xLim) + par[2]*(x[0] - xLim)*(x[0] - xLim);
+namespace {
+
+ //______________________________________________________________________________
+ Double_t funcLin (const Double_t *x, const Double_t *par)
+ {
+ /// Linear function
+ return par[0] + par[1]*x[0];
+ }
+
+ //______________________________________________________________________________
+ Double_t funcParabolic (const Double_t *x, const Double_t *par)
+ {
+ /// Parabolic function
+ return par[0]*x[0]*x[0];
+ }
+
+ //______________________________________________________________________________
+ Double_t funcCalib (const Double_t *x, const Double_t *par)
+ {
+ /// Calibration function
+ Double_t xLim= par[3];
+
+ if(x[0] <= xLim) return par[0] + par[1]*x[0];
+
+ Double_t yLim = par[0]+ par[1]*xLim;
+ return yLim + par[1]*(x[0] - xLim) + par[2]*(x[0] - xLim)*(x[0] - xLim);
+ }
+
}
-
/// \cond CLASSIMP
ClassImp(AliMUONGain)
/// \endcond
AliMUONGain::AliMUONGain()
: AliMUONPedestal(),
fInjCharge(0),
+fRootDataFileName(),
fnInit(1),
fnEntries(11),
fnbpf1(6),
{
/// Default constructor
- sprintf(fRootDataFileName," "); //Gain
}
-// AliMUONPedestal& operator=(const AliMUONPedestal& other); Copy ctor
//______________________________________________________________________________
AliMUONGain::~AliMUONGain()
ostringstream stream;
stream<<"//DUMMY FILE (to prevent Shuttle failure)"<< endl;
stream<<"//================================================" << endl;
- stream<<"// MUONTRKda: Calibration run " << endl;
+ stream<<"// MUONTRKGAINda: Calibration run " << endl;
stream<<"//================================================" << endl;
stream<<"// * Run : " << fRunNumber << endl;
stream<<"// * Date : " << fDate->AsString("l") <<endl;
//______________________________________________________________________________
void AliMUONGain::MakePedStoreForGain(TString shuttleFile)
{
-///
+/// Store Pedmean and sigma to pedestal-like ascii file
ofstream fileout;
TString tempstring;
- Char_t flatFile[256]="";
+ TString flatFile;
TString outputFile;
// Store pedestal map in root file
// write dummy ascii file -> Shuttle
if(fIndex<fnEntries)
{
- // fileout.open(shuttleFile.Data());
- // tempstring = WriteDummyHeader();
- // fileout << tempstring;
FILE *pfilew=0;
pfilew = fopen (shuttleFile,"w");
fprintf(pfilew,"//DUMMY FILE (to prevent Shuttle failure)\n");
fprintf(pfilew,"//================================================\n");
- fprintf(pfilew,"// MUONTRKda: Calibration run \n");
+ fprintf(pfilew,"// MUONTRKGAINda: Calibration run \n");
fprintf(pfilew,"//=================================================\n");
fprintf(pfilew,"// * Run : %d \n",fRunNumber);
fprintf(pfilew,"// * Date : %s \n",fDate->AsString("l"));
if(fPrintLevel>0)
{
// compute and store mean DAC values (like pedestals)
- sprintf(flatFile,"%s.ped",fprefixDA);
+ flatFile = Form("%s.ped",fPrefixDA.Data());
outputFile=flatFile;
- cout << "\n" << fprefixDA << " : Flat file generated : " << flatFile << "\n";
+ cout << "\n" << fPrefixDA.Data() << " : Flat file generated : " << flatFile.Data() << "\n";
if (!outputFile.IsNull())
{
ofstream out(outputFile.Data());
if (fIndex==1) {
mode = "RECREATE";
}
- TFile* histoFile = new TFile(fRootDataFileName, mode.Data(), "MUON Tracking Gains");
+ TFile* histoFile = new TFile(fRootDataFileName.Data(), mode.Data(), "MUON Tracking Gains");
// second argument should be the injected charge, taken from config crocus file
// put also info about run number could be usefull
stream<<"//=======================================================" << endl;
- stream<<"// Calibration file calculated by " << fprefixDA <<endl;
+ stream<<"// Calibration file calculated by " << fPrefixDA.Data() <<endl;
stream<<"//=======================================================" << endl;
stream<<"// * Run : " << fRunNumber << endl;
stream<<"// * Date : " << fDate->AsString("l") <<endl;
stream<<"// * Statictics : " << fNEvents << endl;
if(fConfig)
- stream<<"// * # of MANUS : " << fNManu_config << " read in the Det. config. " << endl;
+ stream<<"// * # of MANUS : " << fNManuConfig << " read in the Det. config. " << endl;
stream<<"// * # of MANUS : " << fNManu << " read in raw data " << endl;
stream<<"// * # of MANUS : " << fNChannel/64 << " written in calibration file " << endl;
stream<<"// * # of channels : " << fNChannel << endl;
stream<<"// "<< nEntries <<" DAC values fit: "<< fnbpf1 << " pts (1st order) " << nbpf2 << " pts (2nd order)" << endl;
if(nInit==1)
stream<<"// "<< nEntries <<" DAC values fit: "<< fnbpf1 << " pts (1st order) " << nbpf2 << " pts (2nd order) DAC=0 excluded" << endl;
+ stream<<"// * nInit = " << nInit << " * f1nbp = " << fnbpf1 << " * f2nbp = " << nbpf2 << endl;
+ stream<<"//" << endl;
stream<<"// RUN DAC " << endl;
stream<<"//-----------------" << endl;
ofstream fileout;
ofstream filcouc;
TString tempstring;
- Char_t filename[256];
+ TString filename;
Double_t goodA1Min = 0.5;
Double_t goodA1Max = 2.;
- // Double_t goodA1Min = 0.7;
- // Double_t goodA1Max = 1.7;
- Double_t goodA2Min = -0.5E-03;
- Double_t goodA2Max = 1.E-03;
+// Double_t goodA2Min = -0.5E-03;
+// Double_t goodA2Max = 1.E-03;
+ Double_t goodA2Min = -0.5E-01; // changed 28/10/2009 (JLC) <=> no condition on a2
+ Double_t goodA2Max = 1.E-01;
// Table for uncalibrated buspatches and manus
THashList* uncalBuspatchManuTable = new THashList(1000,2);
// Fit with a polynomial fct
// store the result in a flat file.
- if(fIndex==0)cout << " Root data file = " << fRootDataFileName << endl;
- TFile* histoFile = new TFile(fRootDataFileName);
+ if(fIndex==0)cout << " Root data file = " << fRootDataFileName.Data() << endl;
+ TFile* histoFile = new TFile(fRootDataFileName.Data());
AliMUON2DMap* map[11];
AliMUONVCalibParam* ped[11];
for ( Int_t i=0 ; i<11 ; i++) {injCharge[i]=0.;injChargeErr[i]=1.;};
// some print
- cout<<"\n ******** MUONTRKda for Gain computing (Last Run = " << fRunNumber << ") ********\n" << endl;
+ cout<<"\n ******** MUONTRKGAINda for Gain computing (Last Run = " << fRunNumber << ") ********\n" << endl;
cout<<" * Date : " << fDate->AsString("l") << "\n" << endl;
cout << " Entries = " << nEntries << " DAC values \n" << endl;
for (Int_t i = 0; i < nEntries; ++i) {
// print out in .log file
(*fFilcout)<<"\n\n//=================================================" << endl;
- (*fFilcout)<<"// MUONTRKda: Gain Computing Run = " << fRunNumber << endl;
- (*fFilcout)<<"// RootDataFile = "<< fRootDataFileName << endl;
+ (*fFilcout)<<"// MUONTRKGAINda: Gain Computing Run = " << fRunNumber << endl;
+ (*fFilcout)<<"// RootDataFile = "<< fRootDataFileName.Data() << endl;
(*fFilcout)<<"//=================================================" << endl;
(*fFilcout)<<"//* Date : " << fDate->AsString("l") << "\n" << endl;
FILE *pfilen = 0;
if(fPrintLevel>1)
{
- sprintf(filename,"%s.param",fprefixDA);
- cout << " Second fit parameter file = " << filename << "\n";
- pfilen = fopen (filename,"w");
+ filename=Form("%s.param",fPrefixDA.Data());
+ cout << " Second fit parameter file = " << filename.Data() << "\n";
+ pfilen = fopen (filename.Data(),"w");
fprintf(pfilen,"//===================================================================\n");
fprintf(pfilen,"// BP MANU CH. par[0] [1] [2] [3] xlim P(chi2) p1 P(chi2)2 p2\n");
FILE *pfilep = 0;
if(fPrintLevel>1)
{
- sprintf(filename,"%s.peak",fprefixDA);
+ filename=Form("%s.peak",fPrefixDA.Data());
cout << " File containing Peak mean values = " << filename << "\n";
pfilep = fopen (filename,"w");
Int_t q = 0;
Int_t p1 =0;
Int_t p2 =0;
- Double_t gain=0;
+ Double_t gain=10.; // max value (= bad value)
Double_t capa=0.2; // internal capacitor (pF)
// plot out
TTree* tg = 0x0;
if(fPlotLevel>0)
{
- sprintf(fHistoFileName,"%s.root",fprefixDA);
- gainFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking gains");
+ fHistoFileName=Form("%s.root",fPrefixDA.Data());
+ gainFile = new TFile(fHistoFileName.Data(),"RECREATE","MUON Tracking gains");
tg = new TTree("tg","TTree avec class Manu_DiMu");
tg->Branch("bp",&busPatchId, "busPatchId/I");
// 1. - linear fit over gAlinbpf1 points
- Double_t par[4] = {0.,0.5,0.,kADCMax};
+ Double_t par[4] = {0.,0.5,0.,ADCMax()};
Int_t nbs = nEntries - fnInit;
if(nbs < fnbpf1)fnbpf1=nbs;
Int_t fitproceed=1;
+ Int_t nbpf2Dynamic=nbpf2;
for (Int_t j = 0; j < nbs; ++j)
{
Int_t k = j + fnInit;
x[j] = pedMean[k];
- if(x[j]<=0. || x[j]== kADCMax)fitproceed=0;
+ if(x[j]<=0.){fitproceed=0; break;}
+ if(x[j]== ADCMax())
+ {
+ if(j < nbs-1){fitproceed=0; break;}
+ else nbpf2Dynamic=nbpf2-1;
+ }
xErr[j] = pedSigma[k];
y[j] = injCharge[k];
yErr[j] = injChargeErr[k];
if(fitproceed)
{
- TF1 *f1 = new TF1("f1",funcLin,0.,kADCMax,2);
+ TF1 *f1 = new TF1("f1",funcLin,0.,ADCMax(),2);
graphErr = new TGraphErrors(fnbpf1, x, y, xErr, yErr);
f1->SetParameters(0,0);
// 2. - Translation : new origin (xLim, yLim) + parabolic fit over nbf2 points
- if(nbpf2 > 1)
+ if(nbpf2Dynamic > 1)
{
- for (Int_t j = 0; j < nbpf2; j++)
+ for (Int_t j = 0; j < nbpf2Dynamic; j++)
{
Int_t k = j + (fnInit + fnbpf1) - 1;
xp[j] = pedMean[k] - xLim;
ypErr[j] = injChargeErr[k];
}
- TF1 *f2 = new TF1("f2",funcParabolic,0.,kADCMax,1);
- graphErr = new TGraphErrors(nbpf2, xp, yp, xpErr, ypErr);
+ TF1 *f2 = new TF1("f2",funcParabolic,0.,ADCMax(),1);
+ graphErr = new TGraphErrors(nbpf2Dynamic, xp, yp, xpErr, ypErr);
graphErr->Fit(f2,"RQ");
chi2P2 = f2->GetChisquare();
graphErr=0;
delete f2;
- prChi2P2 = TMath::Prob(chi2P2, nbpf2-1);
+ prChi2P2 = TMath::Prob(chi2P2, nbpf2Dynamic-1);
a2 = par[0];
}
q=0;
par[1]=0.5; a1=0.5; p1=0;
par[2]=0.; a2=0.; p2=0;
- threshold=kADCMax;
+ threshold=ADCMax();
// bad calibration counter
char bpmanuname[256];
{
// if(q==0 and nplot < 100)
// if(p1>1 && p2==0 and nplot < 100)
- if(p1>10 && p2>10 and nplot < 100)
+ // if(p1>10 && p2>10 and nplot < 100)
// if(p1>=1 and p1<=2 and nplot < 100)
// if((p1==1 || p2==1) and nplot < 100)
+ if(nbpf2Dynamic<nbpf2 and nplot < 100)
{
nplot++;
// cout << " nplot = " << nplot << endl;
- TF1 *f2Calib = new TF1("f2Calib",funcCalib,0.,kADCMax,NFITPARAMS);
+ TF1 *f2Calib = new TF1("f2Calib",funcCalib,0.,ADCMax(),NFITPARAMS);
graphErr = new TGraphErrors(nEntries,pedMean,injCharge,pedSigma,injChargeErr);
-#ifndef ALIMUONGain_H
-#define ALIMUONGain_H
+#ifndef ALIMUONGAIN_H
+#define ALIMUONGAIN_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
#include "AliMUONPedestal.h"
-/* // global variables */
-/* const Int_t kNChannels = AliMpConstants::ManuNofChannels(); */
-/* const Int_t kADCMax = 4095; */
-
class AliMUONGain : public AliMUONPedestal
{
public:
TString WriteGainData(Int_t bp, Int_t manu, Int_t ch, Double_t p1, Double_t p2, Int_t threshold, Int_t q);
TString WriteGainHeader(Int_t nInit, Int_t nEntries, Int_t nbpf2, Int_t *numrun, Double_t *injCharge);
+ /// Store Pedmean and sigma in pedestal-like ascii file
void MakePedStoreForGain(TString flatfile);
+ /// Computes gain parameters and store in an ascii file
void MakeGainStore(TString flatfile);
- ///
- void SetAliRootDataFileName() {sprintf(fRootDataFileName,"MUONTRKGAINda_data.root");}
- ///
- Char_t* GetRootDataFileName() {return fRootDataFileName;}
+ /// Set filename of root file containing pedmean and sigma values for each DAC value
+ void SetAliRootDataFileName(const char* name="MUONTRKGAINda_data.root") { fRootDataFileName=name; }
+ /// Get filename of root file containing pedmean and sigma values
+ const char* GetRootDataFileName() const {return fRootDataFileName.Data();}
+ /// Write Header in Dummy ascii file
TString WriteDummyHeader();
- ///
+ /// Set InjCharge = DAC value
void SetAliInjCharge(Int_t charge) {fInjCharge = charge;}
- ///
+ /// Set PrintLevel
void SetAliPrintLevel(Int_t pri) {fPrintLevel = pri;}
- ///
+ /// Set fnInit (=1: first DAC=0 removed to compute the fit)
void SetAliInit(Int_t ini) {fnInit = ini;}
- ///
+ /// Set nEntries = Nb of DAC values
void SetAliEntries(Int_t ent) {fnEntries = ent;}
- ///
+ /// Set Nbpf1 = nb of DAC values for the linear fit
void SetAliNbpf1(Int_t nf1) {fnbpf1 = nf1;}
- ///
+ /// Set PlotLevel
void SetAliPlotLevel(Int_t plo) {fPlotLevel = plo;}
private:
- Int_t fInjCharge; ///<
- Char_t fRootDataFileName[256]; ///<
- Int_t fnInit; ///<
- Int_t fnEntries; ///<
- Int_t fnbpf1; ///<
- Int_t fPrintLevel; ///<
- Int_t fPlotLevel; ///<
+ Int_t fInjCharge; ///< DAC value
+ TString fRootDataFileName; ///< Root data file name
+ Int_t fnInit; ///< fnInit (for expert)
+ Int_t fnEntries; ///< Nb of DAC values
+ Int_t fnbpf1; ///< nb of DAC values for linear fit (for expert)
+ Int_t fPrintLevel; ///< Print level
+ Int_t fPlotLevel; ///< Plot level
- ClassDef(AliMUONGain,1) //
+ ClassDef(AliMUONGain,2) //
};
#endif
#include "AliMUONVStore.h"
#include "AliMUON2DMap.h"
#include "AliMUONCalibParamND.h"
-
+#include "AliMpConstants.h"
#include <TString.h>
#include <TTimeStamp.h>
#include <TMath.h>
//______________________________________________________________________________
AliMUONPedestal::AliMUONPedestal()
: TObject(),
-fN(0),
+//fN(0),
fNEvents(0),
fRunNumber(0),
fNChannel(0),
fNManu(0),
-fNManu_config(0),
+fNManuConfig(0),
fConfig(1),
fErrorBuspatchTable(new AliMUON2DMap(kFALSE)),
fManuBuspatchTable(new AliMUON2DMap(kFALSE)),
fManuBPoutofconfigTable(new AliMUON2DMap(kFALSE)),
fDate(new TTimeStamp()),
fFilcout(0),
+fHistoFileName(),
fPedestalStore(new AliMUON2DMap(kTRUE)),
-fIndex(-1)
+fIndex(-1),
+fPrefixDA()
{
/// Default constructor
- sprintf(fHistoFileName," ");
- sprintf(fprefixDA," ");
}
-// AliMUONPedestal& operator=(const AliMUONPedestal& other); Copy ctor
//______________________________________________________________________________
AliMUONPedestal::~AliMUONPedestal()
}
//______________________________________________________________________________
-void AliMUONPedestal::Load_config(char* dbfile)
+const char*
+AliMUONPedestal::GetHistoFileName() const
+{
+ /// Return the name of file we use to store histograms
+ return fHistoFileName.Data();
+}
+
+//______________________________________________________________________________
+void AliMUONPedestal::LoadConfig(const char* dbfile)
{
/// Load MUONTRK configuration from ascii file "dbfile" (in DetDB)
Int_t manuId;
Int_t busPatchId;
- ifstream fileinit(dbfile,ios::in);
- while (!fileinit.eof())
+ ifstream filein(dbfile,ios::in);
+
+ // check if the 1st caracter of the 1st line is # (Config read from the OCDB => OffLine)
+ string line;
+ getline(filein, line, '\n');
+ cout << " line 1: " << line ;
+ if ( int(line[0]) == 35 ) // ascii code of # character
+ {
+ cout << " ==> 1st caracter = " << line[0] << " (ascii code =" << int(line[0]) << ")" << endl;
+ }
+ else
+ { filein.clear(); filein.seekg(0); // rewind
+ cout << " ==> rewind configuration file: "<< dbfile << endl;
+ }
+
+ while (!filein.eof())
{
- fileinit >> busPatchId >> manuId;
+ filein >> busPatchId >> manuId;
AliMUONErrorCounter* manuCounter;
AliMUONVCalibParam* ped =
static_cast<AliMUONVCalibParam*>(fPedestalStore ->FindObject(busPatchId, manuId));
if (!ped) {
- fNManu_config++;
+ fNManuConfig++;
fNChannel+=64;
- ped = new AliMUONCalibParamND(2, kNChannels,busPatchId, manuId, -1.); // put default wise -1, not connected channel
+ ped = new AliMUONCalibParamND(2, AliMpConstants::ManuNofChannels(),busPatchId, manuId, -1.); // put default wise -1, not connected channel
fPedestalStore ->Add(ped);
if (!(manuCounter = static_cast<AliMUONErrorCounter*>(fManuBuspatchTable->FindObject(busPatchId,manuId))))
else {fNManu++;}
fNChannel+=64;
// put default wise -1, not connected channel
- ped = new AliMUONCalibParamND(2, kNChannels,busPatchId, manuId, -1.);
+ ped = new AliMUONCalibParamND(2, AliMpConstants::ManuNofChannels(),busPatchId, manuId, -1.);
fPedestalStore ->Add(ped);
}
//______________________________________________________________________________
void AliMUONPedestal::Finalize()
{
+ /// final polishing of the store
+
Double_t pedMean;
Double_t pedSigma;
Int_t busPatchId;
ped->SetValueAsDouble(channelId, 1, TMath::Sqrt(TMath::Abs(pedSigma/(Double_t)eventCounter - pedMean*pedMean)));
if(manuId == 0)
{
- ped->SetValueAsDouble(channelId, 0, kADCMax);
- ped->SetValueAsDouble(channelId, 1, kADCMax);
+ ped->SetValueAsDouble(channelId, 0, ADCMax());
+ ped->SetValueAsDouble(channelId, 1, ADCMax());
}
if(occupancy>1)
{
- ped->SetValueAsDouble(channelId, 0, kADCMax);
- ped->SetValueAsDouble(channelId, 1, kADCMax);
- if(channelId==0)ped->SetValueAsDouble(channelId, 0, kADCMax+occupancy);
+ ped->SetValueAsDouble(channelId, 0, ADCMax());
+ ped->SetValueAsDouble(channelId, 1, ADCMax());
+ if(channelId==0)ped->SetValueAsDouble(channelId, 0, ADCMax()+occupancy);
}
}
else
{
- ped->SetValueAsDouble(channelId, 0, kADCMax);
- ped->SetValueAsDouble(channelId, 1, kADCMax);
+ ped->SetValueAsDouble(channelId, 0, ADCMax());
+ ped->SetValueAsDouble(channelId, 1, ADCMax());
}
}
}
/// put pedestal store in the output stream
out<<"//===========================================================================" << endl;
- out<<"// Pedestal file calculated by "<< fprefixDA << endl;
+ out<<"// Pedestal file calculated by "<< fPrefixDA.Data() << endl;
out<<"//===========================================================================" << endl;
out<<"// * Run : " << fRunNumber << endl;
out<<"// * Date : " << fDate->AsString("l") <<endl;
out<<"// * Statictics : " << fNEvents << endl;
if(fConfig)
- out<<"// * # of MANUS : " << fNManu_config << " read in the Det. config. " << endl;
+ out<<"// * # of MANUS : " << fNManuConfig << " read in the Det. config. " << endl;
out<<"// * # of MANUS : " << fNManu << " read in raw data " << endl;
out<<"// * # of MANUS : " << fNChannel/64 << " written in pedestal file " << endl;
out<<"// * # of channels : " << fNChannel << endl;
}
}
- out<<"//"<<endl;
- out<<"// * Puzzling (Buspatch,Manu) read in raw data ?"<<endl;
- Int_t occupancy=1;
- if(occupancy){
- TIter next(fPedestalStore ->CreateIterator());
- AliMUONVCalibParam* ped;
- while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
+// out<<"//"<<endl;
+// out<<"// * Puzzling (Buspatch,Manu) read in raw data ?"<<endl;
+ Int_t writitle=0;
+ Int_t occupancy=1;
+ if(occupancy)
{
- Int_t busPatchId = ped->ID0();
- Int_t manuId = ped->ID1();
- Double_t pedMean = ped->ValueAsDouble(0, 0); // check pedestal value for channelId=0
-
- if(pedMean>kADCMax)
+ TIter next(fPedestalStore ->CreateIterator());
+ AliMUONVCalibParam* ped;
+ while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
{
- occupancy=pedMean-kADCMax;
- ped->SetValueAsDouble(0, 0, kADCMax);
- out<<"// BusPatch = "<< busPatchId <<"\t ManuId = "<< manuId << "\t occupancy = " << occupancy <<endl;
- }
+ Int_t busPatchId = ped->ID0();
+ Int_t manuId = ped->ID1();
+ Double_t pedMean = ped->ValueAsDouble(0, 0); // check pedestal value for channelId=0
- if (manuId==0 || (fConfig && static_cast<AliMUONErrorCounter*>(fManuBPoutofconfigTable->FindObject(busPatchId,manuId))))
- {
- out<<"// BusPatch = "<< busPatchId <<"\t ManuId = "<< manuId << "\t missing in the mapping" << endl;
+ if(pedMean>ADCMax())
+ {
+ writitle++;
+ if(writitle==1){
+ out<<"//"<<endl;
+ out<<"// * Puzzling (Buspatch,Manu) read in raw data ?"<<endl;}
+ occupancy=pedMean-ADCMax();
+ ped->SetValueAsDouble(0, 0, ADCMax());
+ out<<"// BusPatch = "<< busPatchId <<"\t ManuId = "<< manuId << "\t occupancy = " << occupancy <<endl;
+ }
+
+ if (manuId==0 || (fConfig && static_cast<AliMUONErrorCounter*>(fManuBPoutofconfigTable->FindObject(busPatchId,manuId))))
+ {
+ writitle++;
+ if(writitle==1){
+ out<<"//"<<endl;
+ out<<"// * Puzzling (Buspatch,Manu) read in raw data ?"<<endl;}
+ out<<"// BusPatch = "<< busPatchId <<"\t ManuId = "<< manuId << "\t missing in the mapping" << endl;
+ }
}
}
-}
out<<"//"<<endl;
//______________________________________________________________________________
void AliMUONPedestal::MakeControlHistos()
{
-
+ /// Create control histograms
if (fIndex>=0) return; // Pedestal run (fIndex=-1)
Double_t pedMean;
TH1F* pedMeanHisto = 0;
TH1F* pedSigmaHisto = 0;
- sprintf(fHistoFileName,"%s.root",fprefixDA);
+ fHistoFileName=Form("%s.root",fPrefixDA.Data());
histoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals");
Char_t name[255];
Char_t title[255];
sprintf(name,"pedmean_allch");
sprintf(title,"Pedestal mean all channels");
- Int_t nx = kADCMax+1;
+ Int_t nx = ADCMax()+1;
Int_t xmin = 0;
- Int_t xmax = kADCMax;
+ Int_t xmax = ADCMax();
pedMeanHisto = new TH1F(name,title,nx,xmin,xmax);
pedMeanHisto->SetDirectory(histoFile);
///
// Author Alberto Baldisseri, JL Charvet
-#include <TObject.h>
-
-#include "AliMpConstants.h"
+#ifndef ROOT_TObject
+# include <TObject.h>
+#endif
+#ifndef ROOT_TString
+# include <TString.h>
+#endif
class AliMUONVStore;
class TTimeStamp;
-// global variables
-const Int_t kNChannels = AliMpConstants::ManuNofChannels();
-const Int_t kADCMax = 4095;
-
class AliMUONPedestal : public TObject
{
public:
/// output .log file of DAs
void SetAlifilcout(ofstream* stream) {fFilcout = stream;}
/// return date and time
- TTimeStamp* GetDate() {return fDate;}
+ TTimeStamp* GetDate() const {return fDate;}
/// Count parity errors per Buspatch
- AliMUONVStore* GetErrorBuspatchTable() {return fErrorBuspatchTable;}
+ AliMUONVStore* GetErrorBuspatchTable() const {return fErrorBuspatchTable;}
/// return the name of DAPedestal .root file
- Char_t* GetHistoFileName() {return fHistoFileName;}
+ const char* GetHistoFileName() const;
/// load MuonTrk configuration from ascii dbfile
- void Load_config(char* dbfile);
+ void LoadConfig(const char* dbfile);
/// sum pedestal values for mean and sigma determination
void MakePed(Int_t bp,Int_t manu,Int_t ch,Int_t charge);
/// set config flag
void SetconfigDA(Int_t ind) {fConfig = ind;}
/// set specific DA prefixname
- void SetprefixDA(char* folder) {sprintf(fprefixDA,"%s",folder);}
+ void SetprefixDA(const char* folder) { fPrefixDA=folder;}
/// set the index of calibration runs
void SetAliIndex(Int_t ind) {fIndex = ind;}
/// Compute the pedestal data (mean, sigma)
/// Fill Histograms
void MakeControlHistos();
- protected:
- Int_t fN; ///<
+ Int_t ADCMax() const { return 4095; }
+
+protected:
+ // Int_t fN; ///<
Int_t fNEvents; ///< Number of events
Int_t fRunNumber; ///< run number
Int_t fNChannel; ///< Nb of channels (pads)
Int_t fNManu; ///< Nb of Manu
- Int_t fNManu_config; ///< Nb of Manu in the current detector configuration
+ Int_t fNManuConfig; ///< Nb of Manu in the current detector configuration
Int_t fConfig; ///< flag 1(0) for reading(or not) configuration ascii file
AliMUONVStore* fErrorBuspatchTable; ///< Table for buspatches with parity errors
AliMUONVStore* fManuBuspatchTable; ///< Occupancy rate for each (buspatch, manu)
TTimeStamp* fDate; ///< date
ofstream* fFilcout; ///< .log output file
- Char_t fHistoFileName[256]; ///< .root histo file
- AliMUONVStore* fPedestalStore; ///<
+ TString fHistoFileName; ///< .root histo file
+ AliMUONVStore* fPedestalStore; ///< data container: (Pedmean,sigma) values for each (BP,manuId)
Int_t fIndex; ///< calibration run index
- Char_t fprefixDA[256]; ///< specific DA prefixname
+ TString fPrefixDA; ///< specific DA prefixname
+ static const Int_t fgkADCMax; ///< max channel count
+
private:
/// Not implemented
AliMUONPedestal(const AliMUONPedestal& rhs);
/// Not implemented
AliMUONPedestal& operator = (const AliMUONPedestal& rhs);
- ClassDef(AliMUONPedestal,3) //
+ ClassDef(AliMUONPedestal,4) // Pedestal computing for DA
};
#endif
/*
- Contact: Jean-Luc Charvet <jean-luc.charvet@cea.fr>
- Link: http://aliceinfo.cern.ch/static/Offline/dimuon/muon_html/README_Mchda
+ Contact: Jean-Luc Charvet <jean-luc.charvet@cern.ch>
+ Link: http://aliceinfo.cern.ch/static/Offline/dimuon/muon_html/README_mchda.html
+ Reference Runs: 92796-92798-92800-92801-92803-92804-92807-92807-92809-92810-92811
Run Type: CALIBRATION
DA Type: LDC
- Number of events needed: 400 events for each calibration run
- Input Files: Rawdata file (DATE format)
- Output Files: local dir (not persistent) -> MUONTRKGAINda_<run#>.par
- FXS -> run<#>_MCH_<ldc>_GAINS
+ Number of events needed: 400 events for each calibration run (11)
+ Input Files: mutrkcalibvalues and config_ldc-MTRK-S3-0
+ Output Files: local dir (not persistent) -> MUONTRKGAINda.par FXS -> run<#>_MCH_<ldc>_GAINS
Trigger types used:
-*/
+ */
/**************************************************************************
-* 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. *
-**************************************************************************/
+ * 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$ */
/*
-------------------------------------------------------------------------
- 2009-10-06 New version: MUONTRKGAINda.cxx,v 1.3
+ 2009-11-05 New version: MUONTRKGAINda.cxx,v 1.4
-------------------------------------------------------------------------
-
+
Version for MUONTRKGAINda MUON tracking
(A. Baldisseri, J.-L. Charvet)
-
-
+
+
Rem: AliMUON2DMap stores all channels, even those which are not connected
if pedMean == -1, channel not connected to a pad
-
-
-*/
+
+
+ */
extern "C" {
#include <daqDA.h>
}
#include "AliMUONErrorCounter.h"
// main routine
-int main(Int_t argc, Char_t **argv)
+int main(Int_t argc, const char** argv)
{
-
- Int_t status=0;
- TStopwatch timers;
- timers.Start(kTRUE);
-
- // needed for streamer application
- gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
- "*",
- "TStreamerInfo",
- "RIO",
- "TStreamerInfo()");
-
- // needed for Minuit plugin
- gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer",
- "Minuit",
- "TMinuitMinimizer",
- "Minuit",
- "TMinuitMinimizer(const char*)");
-
- Char_t prefixDA[256]="MUONTRKGAINda"; // program prefix
-
- Int_t skipEvents = 0;
- Int_t maxEvents = 1000000;
- Int_t maxDateEvents = 1000000;
- Char_t inputFile[256]="";
-
- Int_t nDateEvents = 0;
- Int_t nGlitchErrors= 0;
- Int_t nParityErrors= 0;
- Int_t nPaddingErrors= 0;
-
- TString logOutputFile;
-
- Char_t flatFile[256]="";
- TString shuttleFile;
-
- Int_t nEventsRecovered = 0;
- Int_t nEvents = 0;
- UInt_t runNumber = 0;
- ofstream filcout;
- Int_t nIndex = -1;
-
- // For DA Gain
- Int_t printLevel = 0; // printout (default=0, =1 =>.ped , => .peak & .param)
- Int_t plotLevel = 1; // plotout (default=1 => tree , =2 tree+Tgraph+fit)
- Int_t injCharge;
-
- Int_t nEntries = daqDA_ECS_getTotalIteration(); // usually = 11 = Nb of calibration runs
- Int_t nInit=1; // = 0 all DAC values ; = 1 DAC=0 excluded (default=1)
- Int_t nbpf1=6; // nb of points for linear fit (default=6)
-
-
- // decode the input line
- for (Int_t i = 1; i < argc; i++) // argument 0 is the executable name
- {
- Char_t* arg;
-
- arg = argv[i];
- if (arg[0] != '-')
- {
- // If only one argument and no "-" => DA calling from ECS
- if (argc == 2)
- {
- sprintf(inputFile,argv[i]);
- }
- continue;
- }
- switch (arg[1])
- {
- case 'f' :
- i++;
- sprintf(inputFile,argv[i]);
- break;
- case 'a' :
- i++;
- shuttleFile = argv[i];
- break;
- case 's' :
- i++;
- skipEvents=atoi(argv[i]);
- break;
- case 'm' :
- i++;
- sscanf(argv[i],"%d",&maxDateEvents);
- break;
- case 'n' :
- i++;
- sscanf(argv[i],"%d",&maxEvents);
- break;
- case 'h' :
- i++;
- printf("\n******************* %s usage **********************",argv[0]);
- printf("\nOnline (called from ECS) : %s <raw data file> (no inline options)\n",argv[0]);
- printf("\n%s -options, the available options are :",argv[0]);
- printf("\n-h help (this screen)");
- printf("\n");
- printf("\n Input");
- printf("\n-f <raw data file> (default = %s)",inputFile);
- printf("\n");
- printf("\n Output");
- printf("\n-a <Flat ASCII file> (default = %s)",shuttleFile.Data());
- printf("\n");
- printf("\n Options");
- printf("\n-m <max date events> (default = %d)",maxDateEvents);
- printf("\n-s <skip events> (default = %d)",skipEvents);
- printf("\n-n <max events> (default = %d)",maxEvents);
-
- printf("\n\n");
- exit(-1);
- default :
- printf("%s : bad argument %s (please check %s -h)\n",argv[0],argv[i],argv[0]);
- argc = 2; exit(-1); // exit if error
- } // end of switch
- } // end of for i
-
-
- //Gain object
- AliMUONGain* muonGain = new AliMUONGain();
- muonGain->SetprefixDA(prefixDA);
- muonGain->SetAliRootDataFileName(); // MUONTRKGAINda_data.root
- // Char_t* RootDataFileName=muonGain->GetRootDataFileName();// MUONTRKGAINda_data.root
- // cout << " Root data file = " << RootDataFileName << endl;
-
- // Reading current iteration
- nIndex = daqDA_ECS_getCurrentIteration();
- if(nIndex<0)nIndex=0; // compute gain directly from existing root data file (OFFLINE only)
-
- if(nIndex==0) // compute gain from existing root data file: MUONTRKGAINda_data.root (OFFLINE only)
- {
- sprintf(flatFile,"%s_data.log",prefixDA);
- logOutputFile=flatFile;
- filcout.open(logOutputFile.Data());
- muonGain->SetAlifilcout(&filcout);
-
- sprintf(flatFile,"%s_data.par",prefixDA);
- if(shuttleFile.IsNull())shuttleFile=flatFile;
-
- muonGain->SetAliPrintLevel(printLevel);
- muonGain->SetAliPlotLevel(plotLevel);
- muonGain->SetAliIndex(nIndex); // fIndex
- muonGain->SetAliInit(nInit); // fnInit
- muonGain->SetAliNbpf1(nbpf1); // fnbpf1
- muonGain->MakeGainStore(shuttleFile);
- // ALI_AMORE instructions below are commented (not used OFFLINE) JLC 30/09/09
- // #ifdef ALI_AMORE
- // std::ifstream in(shuttleFile.Data());
- // ostringstream stringout;
- // char line[1024];
- // while ( in.getline(line,1024) )
- // stringout << line << "\n";
- // in.close();
-
- // amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
- // TObjString gaindata(stringout.str().c_str());
- // status = amoreDA.Send("Gains",&gaindata);
- // if ( status )
- // cout << "Warning: Failed to write Pedestals in the AMORE database : " << status << endl;
- // else
- // cout << "amoreDA.Send(Gains) ok" << endl;
- // #else
- // cout << "Warning: MCH DA not compiled with AMORE support" << endl;
- // #endif
- }
-
- if(nIndex>0) // normal case: reading calibration runs before computing gains (ONLINE or OFFLINE)
- {
- UShort_t manuId;
- UChar_t channelId;
- UShort_t charge;
-
- // DAC values stored in array vDAC (reading dbfile in DETDB)
- // Int_t vDAC[11] = {0,200,400,800,1200,1600,2000,2500,3000,3500,4000}
- Int_t nConfig = 1; // flag to read or not configuration ascii file in detDB
- Int_t vDAC[11]; // DAC values
- Char_t *dbfile;
- dbfile="mutrkcalibvalues";
- cout << "\n *** Copy: " << dbfile << " from DetDB to working directory *** \n" << endl;
- status=daqDA_DB_getFile(dbfile,dbfile);
- ifstream filein(dbfile,ios::in); Int_t k=0, kk;
- while (k<nEntries ) { filein >> kk >> vDAC[k] ; k++; }
- injCharge=vDAC[nIndex-1];
-
-
- filein >> nInit; // = 0 all DAC values fitted ; = 1 DAC=0 excluded (default=1)
- filein >> nbpf1; // nb of points for linear fit (default=6)
- filein >> printLevel; // printout (default=0, =1 =>.ped /run, =2 => .peak & .param)
- filein >> plotLevel; // plotout (default=1 => tree , =2 tree+Tgraph+fit)
- filein >> nConfig; //nConfig (default=1 => read config in DetDB, otherwise =0)
-
- cout << "nInit=" << nInit << " Nb linear pts=" << nbpf1 << " Print level=" << printLevel << " Plot Level=" << plotLevel << " Config= " << nConfig << endl;
-
- muonGain->SetAliPrintLevel(printLevel);
- muonGain->SetAliPlotLevel(plotLevel);
- muonGain->SetconfigDA(nConfig);
-
- if(nConfig)
- {
- // Laod configuration ascii file from DetDB
- Char_t dbfil[256]="";
- sprintf(dbfil,"config_%s",getenv("DATE_ROLE_NAME"));
- cout << "\n *** Copy ascii config file: " << dbfil << " from DetDB to working directory and reading ...*** \n" << endl;
- status=daqDA_DB_getFile(dbfil,dbfil);
- muonGain->Load_config(dbfil);
- }
-
-
- // Rawdeader, RawStreamHP
- AliRawReader* rawReader = AliRawReader::Create(inputFile);
- AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader);
- rawStream->DisableWarnings();
- rawStream->EnabbleErrorLogger();
-
- cout << "\n" << prefixDA << " : Reading data from file " << inputFile << endl;
-
- while (rawReader->NextEvent())
- {
- if (nDateEvents >= maxDateEvents) break;
- if (nEvents >= maxEvents) break;
- if (nDateEvents>0 && nDateEvents % 100 == 0)
- cout<<"Cumulated: DATE events = " << nDateEvents << " Used events = " << nEvents << endl;
-
- // check shutdown condition
- if (daqDA_checkShutdown())
- break;
-
- //Skip events
- while (skipEvents)
+ Int_t status=0;
+ TStopwatch timers;
+ timers.Start(kTRUE);
+
+ const char* prefixDA = "MUONTRKGAINda"; // program prefix
+ printf(" ######## Begin execution : %s ######## \n\n",prefixDA);
+
+ TString inputFile;
+ // decode the input line
+ if (argc!=2) { printf("Wrong number of arguments\n"); return -1; }
+
+ inputFile = argv[1];
+
+ // needed for streamer application
+ gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+ "*",
+ "TStreamerInfo",
+ "RIO",
+ "TStreamerInfo()");
+ // needed for Minuit plugin
+ gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer",
+ "Minuit",
+ "TMinuitMinimizer",
+ "Minuit",
+ "TMinuitMinimizer(const char*)");
+ Int_t skipEvents = 0;
+ Int_t maxEvents = 1000000;
+ Int_t maxDateEvents = 1000000;
+
+ Int_t nDateEvents = 0;
+ Int_t nGlitchErrors= 0;
+ Int_t nParityErrors= 0;
+ Int_t nPaddingErrors= 0;
+ Int_t nEventsRecovered = 0;
+ Int_t nEvents = 0;
+
+ TString logOutputFile;
+ Char_t flatFile[256]="";
+ TString shuttleFile;
+
+ UInt_t runNumber = 0;
+ ofstream filcout;
+ Int_t nIndex = -1;
+
+ // For DA Gain
+ Int_t nEntries = daqDA_ECS_getTotalIteration(); // usually = 11 = Nb of calibration runs
+ Int_t nInit=1; // = 0 all DAC values ; = 1 DAC=0 excluded (default=1)
+ Int_t nbpf1=6; // nb of points for linear fit (default=6)
+ Int_t printLevel = 0; // printout (default=0, =1 =>.ped , => .peak & .param)
+ Int_t plotLevel = 1; // plotout (default=1 => tree , =2 tree+Tgraph+fit)
+ Int_t nbev=0;
+ Int_t injCharge;
+
+ // Reading current iteration
+ nIndex = daqDA_ECS_getCurrentIteration();
+ if(nIndex<0 || nIndex>nEntries) {printf("\n Failed: nIndex = %d\n",nIndex); return -1 ;}
+
+ //Gain object
+ AliMUONGain* muonGain = new AliMUONGain();
+ muonGain->SetprefixDA(prefixDA);
+ muonGain->SetAliRootDataFileName(); // MUONTRKGAINda_data.root
+
+ UShort_t manuId;
+ UChar_t channelId;
+ UShort_t charge;
+
+ // DAC values stored in array vDAC (reading dbfile in DETDB)
+ // Int_t vDAC[11] = {0,200,400,800,1200,1600,2000,2500,3000,3500,4000}
+ Int_t nConfig = 1; // flag to read or not configuration ascii file in detDB
+ Int_t vDAC[11]; // DAC values
+ Char_t dbfile[256]="";
+ sprintf(dbfile,"mutrkcalibvalues");
+ status=daqDA_DB_getFile(dbfile,dbfile);
+ if(status) {printf(" Failed : input file %s is missing, status = %d\n",dbfile,status); return -1; }
+
+ ifstream filein(dbfile,ios::in); Int_t k=0, kk;
+ while (k<nEntries ) { filein >> kk >> vDAC[k] ; k++; }
+ injCharge=vDAC[nIndex-1];
+
+ filein >> nInit; // = 0 all DAC values fitted ; = 1 DAC=0 excluded (default=1)
+ filein >> nbpf1; // nb of points for linear fit (default=6)
+ filein >> printLevel; // printout (default=0, =1 =>.ped /run, =2 => .peak & .param)
+ filein >> plotLevel; // plotout (default=1 => tree , =2 tree+Tgraph+fit)
+ filein >> nConfig; //nConfig (default=1 => read config in DetDB, otherwise =0)
+ filein >> nbev; // Nb of events to read (default = 0 => reading all events)
+ if(nbev>0)maxEvents=nbev;
+
+ printf(" *** Copy: %s from DetDB to working directory *** Config= %d\n",dbfile,nConfig);
+ printf(" Input parameters: nInit= %d Nb linear pts= %d Print level= %d Plot Level= %d",nInit,nbpf1,printLevel,plotLevel);
+ if(nbev==0)printf("\n");
+ else printf(" Nb_max evt = %d\n",maxEvents);
+
+ muonGain->SetAliPrintLevel(printLevel);
+ muonGain->SetAliPlotLevel(plotLevel);
+ muonGain->SetconfigDA(nConfig);
+
+ if(nConfig)
+ {
+ // Laod configuration ascii file from DetDB
+ sprintf(dbfile,"config_%s",getenv("DATE_ROLE_NAME"));
+ status=daqDA_DB_getFile(dbfile,dbfile);
+ if(status) {printf(" Failed : Configuration file %s is missing, status = %d\n",dbfile,status); return -1; }
+ else printf(" *** Copy ascii config file: %s from DetDB to working directory and reading ...*** \n",dbfile);
+ muonGain->LoadConfig(dbfile);
+ }
+
+ // Rawdeader, RawStreamHP
+ AliRawReader* rawReader = AliRawReader::Create(inputFile.Data());
+ AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader);
+ rawStream->DisableWarnings();
+ rawStream->EnabbleErrorLogger();
+
+ cout << "\n" << prefixDA << " : Reading data from file " << inputFile.Data() << endl;
+
+ while (rawReader->NextEvent())
+ {
+ if (nDateEvents >= maxDateEvents) break;
+ if (nEvents >= maxEvents) break;
+ if (nDateEvents>0 && nDateEvents % 100 == 0)
+ cout<<"Cumulated: DATE events = " << nDateEvents << " Used events = " << nEvents << endl;
+
+ // check shutdown condition
+ if (daqDA_checkShutdown())
+ break;
+ //Skip events
+ while (skipEvents)
+ {
+ rawReader->NextEvent();
+ skipEvents--;
+ }
+
+ Int_t eventType = rawReader->GetType();
+ runNumber = rawReader->GetRunNumber();
+
+ // Output log file initialisations
+ if(nDateEvents==0)
+ {
+ sprintf(flatFile,"%s.log",prefixDA);
+ logOutputFile=flatFile;
+
+ filcout.open(logOutputFile.Data());
+ filcout<<"//=================================================" << endl;
+ filcout<<"// " << prefixDA << " for run = " << runNumber << " (DAC=" << injCharge << ")" << endl;
+ filcout<<"//=================================================" << endl;
+ filcout<<"// * Date : " << muonGain->GetDate()->AsString("l") << "\n" << endl;
+
+ cout<<"\n ******** " << prefixDA << " for run = " << runNumber << " (Index= " << nIndex << "/" << nEntries << " DAC=" << injCharge << ") ********\n" << endl;
+ cout<<" * Date : " << muonGain->GetDate()->AsString("l") << "\n" << endl;
+ }
+
+ muonGain->SetAlifilcout(&filcout);
+
+ nDateEvents++;
+ if (eventType != PHYSICS_EVENT)
+ continue; // for the moment
+
+ // First lopp over DDL's to find good events
+ // Error counters per event (counters in the decoding lib are for each DDL)
+ Bool_t eventIsErrorMessage = kFALSE;
+ int eventGlitchErrors = 0;
+ int eventParityErrors = 0;
+ int eventPaddingErrors = 0;
+ rawStream->First();
+ do
+ {
+ if (rawStream->IsErrorMessage()) eventIsErrorMessage = kTRUE;
+ eventGlitchErrors += rawStream->GetGlitchErrors();
+ eventParityErrors += rawStream->GetParityErrors();
+ eventPaddingErrors += rawStream->GetPaddingErrors();
+ } while(rawStream->NextDDL());
+
+ AliMUONRawStreamTrackerHP::AliBusPatch* busPatch;
+ if (!eventIsErrorMessage)
+ {
+ // Good events (no error) -> compute pedestal for all channels
+ rawStream->First();
+ while( (busPatch = (AliMUONRawStreamTrackerHP::AliBusPatch*) rawStream->Next()))
{
- rawReader->NextEvent();
- skipEvents--;
+ for(int i = 0; i < busPatch->GetLength(); ++i)
+ {
+ busPatch->GetData(i, manuId, channelId, charge);
+ muonGain->MakePed(busPatch->GetBusPatchId(), (Int_t)manuId, (Int_t)channelId, (Int_t)charge);
+ }
}
-
- Int_t eventType = rawReader->GetType();
- runNumber = rawReader->GetRunNumber();
-
- // Output log file initialisations
- if(nDateEvents==0)
- {
- sprintf(flatFile,"%s.log",prefixDA);
- logOutputFile=flatFile;
-
- filcout.open(logOutputFile.Data());
- filcout<<"//=================================================" << endl;
- filcout<<"// " << prefixDA << " for run = " << runNumber << " (DAC=" << injCharge << ")" << endl;
- filcout<<"//=================================================" << endl;
- filcout<<"// * Date : " << muonGain->GetDate()->AsString("l") << "\n" << endl;
-
- cout<<"\n ******** " << prefixDA << " for run = " << runNumber << " (Index= " << nIndex << "/" << nEntries << " DAC=" << injCharge << ") ********\n" << endl;
- cout<<" * Date : " << muonGain->GetDate()->AsString("l") << "\n" << endl;
- }
-
- muonGain->SetAlifilcout(&filcout);
-
- nDateEvents++;
- if (eventType != PHYSICS_EVENT)
- continue; // for the moment
-
- // First lopp over DDL's to find good events
- // Error counters per event (counters in the decoding lib are for each DDL)
- Bool_t eventIsErrorMessage = kFALSE;
- int eventGlitchErrors = 0;
- int eventParityErrors = 0;
- int eventPaddingErrors = 0;
- rawStream->First();
- do
- {
- if (rawStream->IsErrorMessage()) eventIsErrorMessage = kTRUE;
- eventGlitchErrors += rawStream->GetGlitchErrors();
- eventParityErrors += rawStream->GetParityErrors();
- eventPaddingErrors += rawStream->GetPaddingErrors();
- } while(rawStream->NextDDL());
-
- AliMUONRawStreamTrackerHP::AliBusPatch* busPatch;
- if (!eventIsErrorMessage)
+ nEvents++;
+ }
+ else
+ {
+ // Events with errors
+ if (eventParityErrors && !eventGlitchErrors&& !eventPaddingErrors)
{
- // Good events (no error) -> compute pedestal for all channels
- rawStream->First();
+ // Recover parity errors -> compute pedestal for all good buspatches
+ if ( TEST_SYSTEM_ATTRIBUTE( rawReader->GetAttributes(),
+ ATTR_ORBIT_BC ))
+ {
+ filcout <<"Event recovered -> Period:"<<EVENT_ID_GET_PERIOD( rawReader->GetEventId() )
+ <<" Orbit:"<<EVENT_ID_GET_ORBIT( rawReader->GetEventId() )
+ <<" BunchCrossing:"<<EVENT_ID_GET_BUNCH_CROSSING( rawReader->GetEventId() )<<endl;
+ }
+ else
+ {
+ filcout <<"Event recovered -> nbInRun:"<<EVENT_ID_GET_NB_IN_RUN( rawReader->GetEventId() )
+ <<" burstNb:"<<EVENT_ID_GET_BURST_NB( rawReader->GetEventId() )
+ <<" nbInBurst:"<<EVENT_ID_GET_NB_IN_BURST( rawReader->GetEventId() )<<endl;
+ }
+ rawStream->First();
while( (busPatch = (AliMUONRawStreamTrackerHP::AliBusPatch*) rawStream->Next()))
- {
- for(int i = 0; i < busPatch->GetLength(); ++i)
- {
- busPatch->GetData(i, manuId, channelId, charge);
- muonGain->MakePed(busPatch->GetBusPatchId(), (Int_t)manuId, (Int_t)channelId, (Int_t)charge);
- }
- }
+ {
+ // Check the buspatch -> if error not use it in the pedestal calculation
+ int errorCount = 0;
+ for(int i = 0; i < busPatch->GetLength(); ++i)
+ {
+ if (!busPatch->IsParityOk(i)) errorCount++;
+ }
+ if (!errorCount)
+ {
+ // Good buspatch
+ for(int i = 0; i < busPatch->GetLength(); ++i)
+ {
+ busPatch->GetData(i, manuId, channelId, charge);
+ muonGain->MakePed(busPatch->GetBusPatchId(), (Int_t)manuId, (Int_t)channelId, (Int_t)charge);
+ }
+ }
+ else
+ {
+ char bpname[256];
+ AliMUONErrorCounter* errorCounter;
+ // Bad buspatch -> not used (just print)
+ filcout<<"bpId "<<busPatch->GetBusPatchId()<<" words "<<busPatch->GetLength()
+ <<" parity errors "<<errorCount<<endl;
+ // Number of events where this buspatch is missing
+ sprintf(bpname,"bp%d",busPatch->GetBusPatchId());
+ if (!(errorCounter = (AliMUONErrorCounter*) (muonGain->GetErrorBuspatchTable()->FindObject(bpname))))
+ {
+ // New buspatch
+ errorCounter = new AliMUONErrorCounter(busPatch->GetBusPatchId());
+ errorCounter->SetName(bpname);
+ muonGain->GetErrorBuspatchTable()->Add(errorCounter);
+ }
+ else
+ {
+ // Existing buspatch
+ errorCounter->Increment();
+ }
+ // errorCounter->Print();
+ } // end of if (!errorCount)
+ } // end of while( (busPatch = (AliMUONRawStreamTrackerHP ...
nEvents++;
- }
- else
+ nEventsRecovered++;
+ } //end of if (eventParityErrors && !eventGlitchErrors&& !eventPaddingErrors)
+ else
{
- // Events with errors
- if (eventParityErrors && !eventGlitchErrors&& !eventPaddingErrors)
- {
- // Recover parity errors -> compute pedestal for all good buspatches
- if ( TEST_SYSTEM_ATTRIBUTE( rawReader->GetAttributes(),
- ATTR_ORBIT_BC ))
- {
- filcout <<"Event recovered -> Period:"<<EVENT_ID_GET_PERIOD( rawReader->GetEventId() )
- <<" Orbit:"<<EVENT_ID_GET_ORBIT( rawReader->GetEventId() )
- <<" BunchCrossing:"<<EVENT_ID_GET_BUNCH_CROSSING( rawReader->GetEventId() )<<endl;
- }
- else
- {
- filcout <<"Event recovered -> nbInRun:"<<EVENT_ID_GET_NB_IN_RUN( rawReader->GetEventId() )
- <<" burstNb:"<<EVENT_ID_GET_BURST_NB( rawReader->GetEventId() )
- <<" nbInBurst:"<<EVENT_ID_GET_NB_IN_BURST( rawReader->GetEventId() )<<endl;
- }
- rawStream->First();
- while( (busPatch = (AliMUONRawStreamTrackerHP::AliBusPatch*) rawStream->Next()))
- {
- // Check the buspatch -> if error not use it in the pedestal calculation
- int errorCount = 0;
- for(int i = 0; i < busPatch->GetLength(); ++i)
- {
- if (!busPatch->IsParityOk(i)) errorCount++;
- }
- if (!errorCount)
- {
- // Good buspatch
- for(int i = 0; i < busPatch->GetLength(); ++i)
- {
- busPatch->GetData(i, manuId, channelId, charge);
- muonGain->MakePed(busPatch->GetBusPatchId(), (Int_t)manuId, (Int_t)channelId, (Int_t)charge);
- }
- }
- else
- {
- char bpname[256];
- AliMUONErrorCounter* errorCounter;
- // Bad buspatch -> not used (just print)
- filcout<<"bpId "<<busPatch->GetBusPatchId()<<" words "<<busPatch->GetLength()
- <<" parity errors "<<errorCount<<endl;
- // Number of events where this buspatch is missing
- sprintf(bpname,"bp%d",busPatch->GetBusPatchId());
- if (!(errorCounter = (AliMUONErrorCounter*) (muonGain->GetErrorBuspatchTable()->FindObject(bpname))))
- {
- // New buspatch
- errorCounter = new AliMUONErrorCounter(busPatch->GetBusPatchId());
- errorCounter->SetName(bpname);
- muonGain->GetErrorBuspatchTable()->Add(errorCounter);
- }
- else
- {
- // Existing buspatch
- errorCounter->Increment();
- }
- // errorCounter->Print();
- } // end of if (!errorCount)
- } // end of while( (busPatch = (AliMUONRawStreamTrackerHP ...
- nEvents++;
- nEventsRecovered++;
- } //end of if (eventParityErrors && !eventGlitchErrors&& !eventPaddingErrors)
- else
- {
- // Fatal errors reject the event
- if ( TEST_SYSTEM_ATTRIBUTE( rawReader->GetAttributes(),
- ATTR_ORBIT_BC ))
- {
- filcout <<"Event rejected -> Period:"<<EVENT_ID_GET_PERIOD( rawReader->GetEventId() )
- <<" Orbit:"<<EVENT_ID_GET_ORBIT( rawReader->GetEventId() )
- <<" BunchCrossing:"<<EVENT_ID_GET_BUNCH_CROSSING( rawReader->GetEventId() )<<endl;
- }
- else
- {
- filcout <<"Event rejected -> nbInRun:"<<EVENT_ID_GET_NB_IN_RUN( rawReader->GetEventId() )
- <<" burstNb:"<<EVENT_ID_GET_BURST_NB( rawReader->GetEventId() )
- <<" nbInBurst:"<<EVENT_ID_GET_NB_IN_BURST( rawReader->GetEventId() )<<endl;
-
- }
- } // end of if (!rawStream->GetGlitchErrors() && !rawStream->GetPaddingErrors() ...
- filcout<<"Number of errors : Glitch "<<eventGlitchErrors
- <<" Parity "<<eventParityErrors
- <<" Padding "<<eventPaddingErrors<<endl;
- filcout<<endl;
- } // end of if (!rawStream->IsErrorMessage())
-
- if (eventGlitchErrors) nGlitchErrors++;
- if (eventParityErrors) nParityErrors++;
- if (eventPaddingErrors) nPaddingErrors++;
-
- } // while (rawReader->NextEvent())
- delete rawReader;
- delete rawStream;
-
- // process and store mean peak values in .root file
- sprintf(flatFile,"%s.par",prefixDA);
- if(shuttleFile.IsNull())shuttleFile=flatFile;
- injCharge=vDAC[nIndex-1];
- muonGain->SetAliIndex(nIndex); // fIndex
- muonGain->SetAliInjCharge(injCharge);
- muonGain->SetAliNEvents(nEvents);
- muonGain->SetAliRunNumber(runNumber);
- muonGain->MakePedStoreForGain(shuttleFile);
-
-
- // writing some counters
- cout << endl;
- cout << prefixDA << " : Nb of DATE events = " << nDateEvents << endl;
- cout << prefixDA << " : Nb of Glitch errors = " << nGlitchErrors << endl;
- cout << prefixDA << " : Nb of Parity errors = " << nParityErrors << endl;
- cout << prefixDA << " : Nb of Padding errors = " << nPaddingErrors << endl;
- cout << prefixDA << " : Nb of events recovered = " << nEventsRecovered<< endl;
- cout << prefixDA << " : Nb of events without errors = " << nEvents-nEventsRecovered<< endl;
- cout << prefixDA << " : Nb of events used = " << nEvents << endl;
-
- filcout << endl;
- filcout << prefixDA << " : Nb of DATE events = " << nDateEvents << endl;
- filcout << prefixDA << " : Nb of Glitch errors = " << nGlitchErrors << endl;
- filcout << prefixDA << " : Nb of Parity errors = " << nParityErrors << endl;
- filcout << prefixDA << " : Nb of Padding errors = " << nPaddingErrors << endl;
- filcout << prefixDA << " : Nb of events recovered = " << nEventsRecovered<< endl;
- filcout << prefixDA << " : Nb of events without errors = " << nEvents-nEventsRecovered<< endl;
- filcout << prefixDA << " : Nb of events used = " << nEvents << endl;
-
- // Computing gain
- if(nIndex==nEntries)
- {
- muonGain->SetAliInit(nInit); // fnInit
- muonGain->SetAliEntries(nEntries); // fnEntries
- muonGain->SetAliNbpf1(nbpf1); // fnbpf1
- muonGain->MakeGainStore(shuttleFile);
+ // Fatal errors reject the event
+ if ( TEST_SYSTEM_ATTRIBUTE( rawReader->GetAttributes(),
+ ATTR_ORBIT_BC ))
+ {
+ filcout <<"Event rejected -> Period:"<<EVENT_ID_GET_PERIOD( rawReader->GetEventId() )
+ <<" Orbit:"<<EVENT_ID_GET_ORBIT( rawReader->GetEventId() )
+ <<" BunchCrossing:"<<EVENT_ID_GET_BUNCH_CROSSING( rawReader->GetEventId() )<<endl;
+ }
+ else
+ {
+ filcout <<"Event rejected -> nbInRun:"<<EVENT_ID_GET_NB_IN_RUN( rawReader->GetEventId() )
+ <<" burstNb:"<<EVENT_ID_GET_BURST_NB( rawReader->GetEventId() )
+ <<" nbInBurst:"<<EVENT_ID_GET_NB_IN_BURST( rawReader->GetEventId() )<<endl;
+
+ }
+ } // end of if (!rawStream->GetGlitchErrors() && !rawStream->GetPaddingErrors() ...
+ filcout<<"Number of errors : Glitch "<<eventGlitchErrors
+ <<" Parity "<<eventParityErrors
+ <<" Padding "<<eventPaddingErrors<<endl;
+ filcout<<endl;
+ } // end of if (!rawStream->IsErrorMessage())
+
+ if (eventGlitchErrors) nGlitchErrors++;
+ if (eventParityErrors) nParityErrors++;
+ if (eventPaddingErrors) nPaddingErrors++;
+
+ } // while (rawReader->NextEvent())
+ delete rawReader;
+ delete rawStream;
+
+ // process and store mean peak values in .root file
+ sprintf(flatFile,"%s.par",prefixDA);
+ if(shuttleFile.IsNull())shuttleFile=flatFile;
+ injCharge=vDAC[nIndex-1];
+ muonGain->SetAliIndex(nIndex); // fIndex
+ muonGain->SetAliInjCharge(injCharge);
+ muonGain->SetAliNEvents(nEvents);
+ muonGain->SetAliRunNumber(runNumber);
+ muonGain->MakePedStoreForGain(shuttleFile);
+
+
+ // writing some counters
+ cout << endl;
+ cout << prefixDA << " : Nb of DATE events = " << nDateEvents << endl;
+ cout << prefixDA << " : Nb of Glitch errors = " << nGlitchErrors << endl;
+ cout << prefixDA << " : Nb of Parity errors = " << nParityErrors << endl;
+ cout << prefixDA << " : Nb of Padding errors = " << nPaddingErrors << endl;
+ cout << prefixDA << " : Nb of events recovered = " << nEventsRecovered<< endl;
+ cout << prefixDA << " : Nb of events without errors = " << nEvents-nEventsRecovered<< endl;
+ cout << prefixDA << " : Nb of events used = " << nEvents << endl;
+
+ filcout << endl;
+ filcout << prefixDA << " : Nb of DATE events = " << nDateEvents << endl;
+ filcout << prefixDA << " : Nb of Glitch errors = " << nGlitchErrors << endl;
+ filcout << prefixDA << " : Nb of Parity errors = " << nParityErrors << endl;
+ filcout << prefixDA << " : Nb of Padding errors = " << nPaddingErrors << endl;
+ filcout << prefixDA << " : Nb of events recovered = " << nEventsRecovered<< endl;
+ filcout << prefixDA << " : Nb of events without errors = " << nEvents-nEventsRecovered<< endl;
+ filcout << prefixDA << " : Nb of events used = " << nEvents << endl;
+
+ // Computing gain
+ if(nIndex==nEntries)
+ {
+ muonGain->SetAliInit(nInit); // fnInit
+ muonGain->SetAliEntries(nEntries); // fnEntries
+ muonGain->SetAliNbpf1(nbpf1); // fnbpf1
+ muonGain->MakeGainStore(shuttleFile);
#ifdef ALI_AMORE
- std::ifstream in(shuttleFile.Data());
- ostringstream stringout;
- char line[1024];
- while ( in.getline(line,1024) )
- stringout << line << "\n";
- in.close();
+ std::ifstream in(shuttleFile.Data());
+ ostringstream stringout;
+ char line[1024];
+ while ( in.getline(line,1024) )
+ stringout << line << "\n";
+ in.close();
- amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
- TObjString gaindata(stringout.str().c_str());
- status = amoreDA.Send("Gains",&gaindata);
- if ( status )
- cout << "Warning: Failed to write Pedestals in the AMORE database : " << status << endl;
- else
- cout << "amoreDA.Send(Gains) ok" << endl;
+ amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+ TObjString gaindata(stringout.str().c_str());
+ status = amoreDA.Send("Gains",&gaindata);
+ if ( status )
+ cout << "Warning: Failed to write Pedestals in the AMORE database : " << status << endl;
+ else
+ cout << "amoreDA.Send(Gains) ok" << endl;
#else
- cout << "Warning: MCH DA not compiled with AMORE support" << endl;
+ cout << "Warning: MCH DA not compiled with AMORE support" << endl;
#endif
- }
-
-// ouput files
- filcout << endl;
- filcout << prefixDA << " : Root data file : " << muonGain->GetRootDataFileName() << endl;
- filcout << prefixDA << " : Output logfile : " << logOutputFile << endl;
- filcout << prefixDA << " : Gain Histo file : " << muonGain->GetHistoFileName() << endl;
- filcout << prefixDA << " : Gain file (to SHUTTLE) : " << shuttleFile << endl;
-
-// Copying files to local DB folder defined by DAQ_DETDB_LOCAL
- Char_t *dir;
- dir= getenv("DAQ_DETDB_LOCAL");
- unsigned int nLastVersions = 90;
- cout << "\n *** Local DataBase: " << dir << " (Max= " << nLastVersions << ") ***" << endl;
- status = daqDA_localDB_storeFile(logOutputFile.Data(),nLastVersions);
- printf(" Store file : %s status = %d\n",logOutputFile.Data(),status);
- if(nIndex==nEntries)
- {
- status = daqDA_localDB_storeFile(muonGain->GetRootDataFileName(),nLastVersions);
- printf(" Store file : %s status = %d\n",muonGain->GetRootDataFileName(),status);
- status = daqDA_localDB_storeFile(muonGain->GetHistoFileName(),nLastVersions);
- printf(" Store file : %s status = %d\n",muonGain->GetHistoFileName(),status);
- status = daqDA_localDB_storeFile(shuttleFile.Data(),nLastVersions);
- printf(" Store file : %s status = %d\n",shuttleFile.Data(),status);
- }
-
- } // end (nIndex>0)
-
-// ouput files
+ }
+
+ // ouput files
+ filcout << endl;
+ filcout << prefixDA << " : Root data file : " << muonGain->GetRootDataFileName() << endl;
+ filcout << prefixDA << " : Output logfile : " << logOutputFile << endl;
+ filcout << prefixDA << " : Gain Histo file : " << muonGain->GetHistoFileName() << endl;
+ filcout << prefixDA << " : Gain file (to SHUTTLE) : " << shuttleFile << endl;
+
+ // Copying files to local DB folder defined by DAQ_DETDB_LOCAL
+ Char_t *dir;
+ dir= getenv("DAQ_DETDB_LOCAL");
+ unsigned int nLastVersions = 90;
+ printf("\n *** Local DataBase: %s (Max= %d) ***\n",dir,nLastVersions);
+ status = daqDA_localDB_storeFile(logOutputFile.Data(),nLastVersions);
+ if(status)printf(" Store file : %s status = %d\n",logOutputFile.Data(),status);
+ if(nIndex==nEntries)
+ {
+ status = daqDA_localDB_storeFile(muonGain->GetRootDataFileName(),nLastVersions);
+ if(status)printf(" Store file : %s status = %d\n",muonGain->GetRootDataFileName(),status);
+ status = daqDA_localDB_storeFile(muonGain->GetHistoFileName(),nLastVersions);
+ if(status)printf(" Store file : %s status = %d\n",muonGain->GetHistoFileName(),status);
+ status = daqDA_localDB_storeFile(shuttleFile.Data(),nLastVersions);
+ if(status)printf(" Store file : %s status = %d\n",shuttleFile.Data(),status);
+ }
+
+
+ // ouput files
cout << endl;
cout << prefixDA << " : Root data file : " << muonGain->GetRootDataFileName() << endl;
cout << prefixDA << " : Output logfile : " << logOutputFile << endl;
cout << prefixDA << " : Gain Histo file : " << muonGain->GetHistoFileName() << endl;
cout << prefixDA << " : Gain file (to SHUTTLE) : " << shuttleFile << endl;
-
-
+
+ filcout.close();
+
// Transferring to OCDB via the SHUTTLE
- printf("\n ***** STORE FILE in FES ****** \n");
-
// be sure that env variable DAQDALIB_PATH is set in script file
// gSystem->Setenv("DAQDALIB_PATH", "$DATE_SITE/infoLogger");
-
+ printf("\n ***** STORE FILE in FES ****** \n");
status = daqDA_FES_storeFile(shuttleFile.Data(),"GAINS");
- if (status)
- {
- printf(" Failed to export file : %d\n",status);
- }
+ if (status) { printf(" Failed to export file : %s , status = %d\n",shuttleFile.Data(),status); return -1; }
else printf(" %s successfully exported to FES \n",shuttleFile.Data());
-
-
- filcout.close();
+
+ printf("\n ######## End execution : %s ######## \n",prefixDA);
timers.Stop();
printf("\nExecution time : R:%7.2fs C:%7.2fs\n", timers.RealTime(), timers.CpuTime());
return status;
/*
-Contact: Jean-Luc Charvet <jean-luc.charvet@cea.fr>
-Link: http://aliceinfo.cern.ch/static/Offline/dimuon/muon_html/README_Mchda
-Run Type: PEDESTAL
- DA Type: LDC
- Number of events needed: 400 events for pedestal run
- Input Files: Rawdata file (DATE format)
- Output Files: local dir (not persistent) -> MUONTRKPEDda_<run#>.ped
- FXS -> run<#>_MCH_<ldc>_PEDESTALS
- Trigger types used:
+ Contact: Jean-Luc Charvet <jean-luc.charvet@cern.ch>
+ Link: http://aliceinfo.cern.ch/static/Offline/dimuon/muon_html/README_mchda.html
+ Reference Run:
+ Run Type: PEDESTAL
+ DA Type: LDC
+ Number of events needed: 400 events for pedestal run
+ Input Files: mutrkpedvalues and config_ldc-MTRK-S3-0
+ Output Files: local dir (not persistent) -> MUONTRKPEDda.ped FXS -> run<#>_MCH_<ldc>_PEDESTALS
+ Trigger types used:
*/
/**************************************************************************
/*
-------------------------------------------------------------------------
- 2009-10-06 New version: MUONTRKPEDda.cxx,v 1.3
+ 2009-11-05 New version: MUONTRKPEDda.cxx,v 1.4
-------------------------------------------------------------------------
Version for MUONTRKPEDda MUON tracking
// main routine
-int main(Int_t argc, Char_t **argv)
+int main(Int_t argc, const char **argv)
{
-
Int_t status=0;
TStopwatch timers;
timers.Start(kTRUE);
+ const char* prefixDA = "MUONTRKPEDda"; // program prefix
+ printf(" ######## Begin execution : %s ######## \n\n",prefixDA);
+
// needed for streamer application
gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
"*",
"TStreamerInfo",
"RIO",
"TStreamerInfo()");
-
// needed for Minuit plugin
gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer",
"Minuit",
"TMinuitMinimizer",
"Minuit",
"TMinuitMinimizer(const char*)");
-
- Char_t prefixDA[256]="MUONTRKPEDda"; // program prefix
// cout << argv[0];
Int_t skipEvents = 0;
Int_t maxEvents = 1000000;
Int_t maxDateEvents = 1000000;
- Char_t inputFile[256]="";
+ TString inputFile;
Int_t nDateEvents = 0;
Int_t nGlitchErrors= 0;
Int_t nEventsRecovered = 0;
Int_t nEvents = 0;
UInt_t runNumber = 0;
+ Int_t nConfig = 1;
ofstream filcout;
// decode the input line
for (Int_t i = 1; i < argc; i++) // argument 0 is the executable name
{
- Char_t* arg;
+ const char* arg = argv[i];
arg = argv[i];
if (arg[0] != '-')
// If only one argument and no "-" => DA calling from ECS
if (argc == 2)
{
- sprintf(inputFile,argv[i]);
+ inputFile=argv[i];
}
continue;
}
{
case 'f' :
i++;
- sprintf(inputFile,argv[i]);
+ inputFile=argv[i];
+ nConfig=0;
break;
case 'a' :
i++;
i++;
printf("\n******************* %s usage **********************",argv[0]);
printf("\nOnline (called from ECS) : %s <raw data file> (no inline options)\n",argv[0]);
+ printf("\n%s can be used locally only with options (without DiMuon configuration file)",argv[0]);
printf("\n%s -options, the available options are :",argv[0]);
printf("\n-h help (this screen)");
printf("\n");
printf("\n Input");
- printf("\n-f <raw data file> (default = %s)",inputFile);
+ printf("\n-f <raw data file> (default = %s)",inputFile.Data());
printf("\n");
printf("\n Output");
printf("\n-a <Flat ASCII file> (default = %s)",shuttleFile.Data());
AliMUONPedestal* muonPedestal = new AliMUONPedestal();
muonPedestal->SetprefixDA(prefixDA);
- // Reading configuration status via "mutrkpedvalues" file located in DetDB
- // config=1: config ascii file read from DetDB, otherwise: config=0
- Int_t nConfig = 1;
- Char_t *dbfile;
- dbfile="mutrkpedvalues";
- cout << "\n *** Copy: " << dbfile << " from DetDB to working directory *** \n" << endl;
+ Char_t dbfile[256]="";
+ // nConfig=1 : Reading configuration (or not) status via "mutrkpedvalues" file located in DetDB
+ if(nConfig)
+ {
+ sprintf(dbfile,"mutrkpedvalues");
status=daqDA_DB_getFile(dbfile,dbfile);
+ if(status) {printf(" Failed : input file %s is missing, status = %d\n",dbfile,status); return -1; }
ifstream filein(dbfile,ios::in);
filein >> nConfig;
- cout << " Config= " << nConfig << endl;
+ printf(" *** Copy: %s from DetDB to working directory *** Config= %d\n",dbfile,nConfig);
+ }
+ else
+ {
+ printf(" *** Config= %d: no configuration ascii file is used \n",nConfig);
+ }
muonPedestal->SetconfigDA(nConfig);
+ // nConfig=1: configuration ascii file read from DetDB
if(nConfig)
{
- // MuonTrk Configuration ascii file (initCROCUS.dat -> ascii file = mutrkconfig)
- Char_t dbfil[256]="";
- sprintf(dbfil,"config_%s",getenv("DATE_ROLE_NAME"));
- cout << "\n *** Copy ascii config file: " << dbfil << " from DetDB to working directory and reading ...*** \n" << endl;
- status=daqDA_DB_getFile(dbfil,dbfil);
- muonPedestal->Load_config(dbfil);
+ // MuonTrk Configuration ascii file (initCROCUS.dat -> ascii file = config_$DATE_ROLE_NAME)
+ sprintf(dbfile,"config_%s",getenv("DATE_ROLE_NAME"));
+ status=daqDA_DB_getFile(dbfile,dbfile);
+ if(status) {printf(" Failed : Configuration file %s is missing, status = %d\n",dbfile,status); return -1; }
+ else printf(" *** Copy ascii config file: %s from DetDB to working directory and reading ...*** \n",dbfile);
+ muonPedestal->Load_config(dbfile);
}
// Rawdeader, RawStreamHP
rawStream->DisableWarnings();
rawStream->EnabbleErrorLogger();
- cout << "\n" << prefixDA << " : Reading data from file " << inputFile << endl;
+ printf("\n %s : Reading data from file %s\n",prefixDA,inputFile.Data());
while (rawReader->NextEvent())
{
unsigned int nLastVersions=90;
cout << "\n *** Local DataBase: " << dir << " (Max= " << nLastVersions << ") ***" << endl;
status = daqDA_localDB_storeFile(muonPedestal->GetHistoFileName(),nLastVersions);
- printf(" Store file : %s status = %d\n",muonPedestal->GetHistoFileName(),status);
+ if(status)printf(" Store file : %s status = %d\n",muonPedestal->GetHistoFileName(),status);
status = daqDA_localDB_storeFile(shuttleFile.Data(),nLastVersions);
- printf(" Store file : %s status = %d\n",shuttleFile.Data(),status);
+ if(status)printf(" Store file : %s status = %d\n",shuttleFile.Data(),status);
status = daqDA_localDB_storeFile(logOutputFile.Data(),nLastVersions);
- printf(" Store file : %s status = %d\n",logOutputFile.Data(),status);
+ if(status)printf(" Store file : %s status = %d\n",logOutputFile.Data(),status);
- // Transferring to OCDB via the SHUTTLE
- printf("\n ***** STORE FILE in FES ****** \n");
-
- // be sure that env variable DAQDALIB_PATH is set in script file
- // gSystem->Setenv("DAQDALIB_PATH", "$DATE_SITE/infoLogger");
+ filcout.close();
+ // Transferring to OCDB via the SHUTTLE (be sure that env variable DAQDALIB_PATH is set)
+ printf("\n ***** STORE FILE in FES ****** \n");
status = daqDA_FES_storeFile(shuttleFile.Data(),"PEDESTALS");
- if (status)
- {
- printf(" Failed to export file : %d\n",status);
- }
+ if (status) { printf(" Failed to export file : %s , status = %d\n",shuttleFile.Data(),status); return -1; }
else printf(" %s successfully exported to FES \n",shuttleFile.Data());
- filcout.close();
+ printf("\n ######## End execution : %s ######## \n",prefixDA);
timers.Stop();
printf("\nExecution time : R:%7.2fs C:%7.2fs\n", timers.RealTime(), timers.CpuTime());
return status;
The front-end electronics performs an online zero suppression using a threshold level.
Those threshold levels for all channels (~ 1 million) have to be computed in a dedicated
-PEDESTALS runs. During this runs the zero suppression is OFF and the pedestal level and the noise is obtained for each channel. The threshold for the FEE is obtained adding the pedestal
-level to 3 sigmas of the noise.
+PEDESTALS runs. During this runs the zero suppression is OFF and the pedestal level and the noise is obtained for each channel. The threshold for the FEE is obtained adding the pedestal level to 3 sigmas of the noise.
The typical ECS sequence for pedestals is :
- Switch ON the electronics LV
- Boot the CROCUS
- Configuration
+- Saving Configuration in an ascii file then transferring in the File eXchange Server (FXS)
- Zero suppression OFF
- Data taking (typically 400 events)
- The DA computes the mean and sigma (it runs in each LDC)
- The DA writes one ASCII file per LDC with the results in the File Exchange Server
-Then the SHUTTLE process the ASCII files and store the result on the OCDB
+Then the SHUTTLE process the ASCII files and store the result on the OCDB (Keyword=PEDESTALS)
+Only configuration files corresponding to a change of the Muon Tracker configuration are written in the FXS (Keyword=CONFIG).
+
\subsection da_ss2 Electronics gain
In order to perform the required spatial resolution or the tracking chambers (~ 100 microns),
we need to calibrate the gain of each channel. The gain is computed using dedicated runs where
-a signal is send to the chambers FEE.
+a signal (DAC) is send to the chambers FEE.
The typical ECS sequence for calibration is :
- Boot the CROCUS
- Configuration
- Zero suppression OFF
-- Loop of 10 data taking (typically 400 events) each with a different signal
+- Loop of 11 data taking (typically 400 events) each with a different signal (DAC=0-200- 400-800-1200-1600-2000-2500-3000-3500-4000)
- The DA computes the mean and sigma (it runs in each LDC) for each run
-- The DA write one ASCII file per LDC with the results in the File Exchange Server at the
-end of the 10 runs sequence
+- At the end of the last run, the DA computes, by using a fitting procedure, linear and parabolic gain parameters, and writes results in one ASCII file per LDC. Every ascii files are transferred in the FXS.
-Then the SHUTTLE process the ASCII files and store the result on the OCDB
+Then the SHUTTLE process the ASCII files and store the result on the OCDB (KEYWORD=GAINS)
\subsection da_ss3 Occupancy
\section da_s2 Using the DA Online
+\subsection da_ss1 Pedestals
+
+The syntax is: MUONTRKPEDda.exe "raw data file"
+
+Two input files located in the DAQ Detector database (DetDB) are needed:
+
+- muontrkpedvalues containing only one parameter "config"
+ config = 1 if configuration file has to be used (OnLine case)
+ config - 0 if not (OffLine case for the time being)
+
+- config_ldc-MTRK-S3-0 : typical configuration file corresponding to MuonTracker Station 3 if (for example) DA is running on ldc-MTRK-S3-0
+
+\subsection da_ss2 Electonics gain
+
+The syntax is: MUONTRKGAINda.exe "raw data file"
+
+Two input files located in the DAQ Detector database (DetDB) are needed:
+
+- muontrkcalibvalues: which attributes to each the run index (1->11) its corrresponding DAC value. The other parameters are used to tune the fit procedure (for expert). The last parameter indicates the number of events to be read: if "0" all events in the run are read, if not the parameter indicates the maximum number of events to be read.
+Default values are listed below
+
+\verbatim
+1 0
+2 200
+3 400
+4 800
+5 1200
+6 1600
+7 2000
+8 2500
+9 3000
+10 3500
+11 4000
+1
+6
+0
+1
+1
+0
+\verbatim
+
+ - config_ldc-MTRK-S3-0 : configuration file corresponding to MuonTracker station 3 if (for example) DA is running on ldc-MTRK-S3-0
+
+
+\section da_s3 Using the DA Offline
+
+The DAs normally runs with a RAW data DATE format as input
+The development of an Offline version is under way.
+
+Nevertheless, Pedestal runs can be analysed locally, but without detector configuration file. If you get a file in root format (e.g. from alien), you can de-rootify it using the
+ "deroot" program which is part of aliroot.
+Note that PED and GAIN DAs work with ROOT input files as well.
+
You have a line command help. To have it just type :
\verbatim
> MUONTRKPEDda.exe -h
******************* ./MUONTRKPEDda.exe usage **********************
+Online (called from ECS) : ./MUONTRKPEDda.exe <raw data file> (no inline options)
+
+./MUONTRKPEDda.exe can be used locally only with options (without DiMuon configuration file)
./MUONTRKPEDda.exe -options, the available options are :
--h help (this screen)
+-h help (this screen)
Input
--f <raw data file> (default = )
+-f <raw data file> (default = )
Output
--a <Flat ASCII file> (default = )
+-a <Flat ASCII file> (default = MUONTRKPEDda.ped)
Options
--b <output directory> (default = .)
--c <FES switch> (default = 1)
--d <print level> (default = 1)
--g <plot level> (default = 0)
--i <nb linear points> (default = 6)
--l <DAC level> (default = 0)
--m <max date events> (default = 1000000)
--s <skip events> (default = 0)
--n <max events> (default = 1000000)
--r root file data for gain(default = MUONTRKda_gain.data)
--e <execute ped/gain> (default = ped)
--e <gain create> make gain & create a new root file
--e <gain> make gain & update root file
--e <gain compute> make gain & compute gains
+-m <max date events> (default = 1000000)
+-s <skip events> (default = 0)
+-n <max events> (default = 1000000)
+
\endverbatim
-
-\section da_s3 Using the DA Offline
-
-The DAs normally runs with a RAW data DATE format as input
- If you get a file in root format (e.g. from alien), you can de-rootify it using the
- "deroot" program which is part of aliroot. Note that PED and GAIN DAs work with ROOT input files as well.
\section da_s4 In case of trouble
Please contact :
-Jean-Luc Charvet : jean-luc.charvet@cea.fr
+Jean-Luc Charvet : jean-luc.charvet@cern.ch
or
Alberto Baldisseri : a.baldisseri@cea.fr
or
Laurent Aphecetche : laurent.aphecetche@subatech.in2p3.fr (for OCC DA)
-This chapter is defined in the READMEMchda.txt file.
+This chapter is defined in the READMEmchda.txt file.
*/