40 #include <TGraphErrors.h> 47 #if 0 // Do not delete - here to let Emacs indent properly 55 fEventsPerChannel(10),
58 fNumberOfStripsPerChip(128),
59 fSummaryGains(
"GainsSummary",
"Summary of gains",51200,0,51200),
60 fCurrentSummaryStrip(1),
125 if (!appendRun ||
fRunno == 0) {
132 Error(
"OpenFiles",
"Failed to open gains file");
145 Int_t nEventsRequired = 0;
152 if(nEvents>nEventsRequired)
163 for(UShort_t det=1;det<=3;det++) {
164 UShort_t sr = (det == 1 ? 1 : 0);
165 for (UShort_t ir = sr; ir < 2; ir++) {
166 Char_t ring = (ir == 0 ?
'O' :
'I');
167 UShort_t nsec = (ir == 0 ? 40 : 20);
168 UShort_t nva = (ir == 0 ? 2 : 4);
169 for(UShort_t sec =0; sec < nsec; sec++) {
172 cache->SetName(
"Cache");
174 Int_t n = sectorArray->GetEntriesFast();
175 sectorArray->AddAtAndExpand(cache, n);
176 for(UShort_t va = 0; va < nva; va++) {
177 TH1S* hChannel =
new TH1S(Form(
"FMD%d%c[%02d]_va%d",
179 Form(
"FMD%d%c[%02d] VA%d Cache",
182 hChannel->SetDirectory(0);
183 cache->AddAtAndExpand(hChannel,va);
210 Int_t nPulses = dPulse > 0 ?
fHighPulse / dPulse : 0;
212 TGraphErrors* gChannel =
new TGraphErrors(nPulses);
213 gChannel->SetName(Form(
"FMD%d%c[%02d,%03d]", det, ring, sec, strip));
214 gChannel->SetTitle(Form(
"FMD%d%c[%02d,%03d] ADC vs DAC",
215 det, ring, sec, strip));
216 stripArray->AddAtAndExpand(gChannel,0);
226 TH1F* summary =
new TH1F(
"Summary", Form(
"Summary of gains in FMD%d%c[%02d]",
229 summary->SetXTitle(
"Strip");
230 summary->SetYTitle(
"Gain [ADC/DAC]");
231 summary->SetDirectory(0);
233 Int_t n = sectorArray->GetEntriesFast();
234 sectorArray->AddAtAndExpand(summary, n);
246 Char_t ring = digit->
Ring();
247 UShort_t sec = digit->
Sector();
248 UShort_t strip = digit->
Strip();
258 hChannel->Fill(digit->
Counts());
313 TGraphErrors* grChannel =
GetChannel(det,ring,sec,strip);
314 if(!grChannel->GetN()) {
315 AliWarning(Form(
"No entries for FMD%d%c, sector %d, strip %d",
316 det, ring , sec, strip));
319 TF1* fitFunc =
new TF1(
"fitFunc",
"pol1",-10,280);
320 fitFunc->SetParameters(100,3);
322 if (grChannel->GetListOfFunctions())
323 grChannel->GetListOfFunctions()->Remove(fitFunc);
324 gROOT->GetListOfFunctions()->Remove(fitFunc);
329 Float_t chi2ndf = -1;
330 if((fitFunc->GetParameter(1)) == (fitFunc->GetParameter(1))) {
331 gain = fitFunc->GetParameter(1);
332 error = fitFunc->GetParError(1);
333 if(fitFunc->GetNDF())
334 chi2ndf = fitFunc->GetChisquare() / fitFunc->GetNDF();
370 if (hGain && hChi2) {
371 Int_t bin = hGain->FindBin(sec, strip);
372 hGain->SetBinContent(bin, gain);
373 hGain->SetBinError(bin, error);
374 hChi2->SetBinContent(bin, chi2ndf);
380 summary->SetBinContent(strip+1, fitFunc->GetParameter(1));
381 summary->SetBinError(strip+1, fitFunc->GetParError(1));
410 <<
" @ " << now.AsString() << std::endl;
434 Int_t n = secArray->GetEntriesFast();
435 Array* cache =
static_cast<Array*
>(secArray->At(n-1));
436 TH1S* hChannel =
static_cast<TH1S*
>(cache->At(va));
455 TGraphErrors* hChannel =
static_cast<TGraphErrors*
>(stripArray->At(0));
466 Int_t n = secArray->GetEntriesFast();
467 return static_cast<TH1F*
>(secArray->At(n-2));
492 if (((sec + 1) % 2) && (strip % fNumberOfStripsPerChip))
return;
500 if(!hChannel->GetEntries()) {
501 AliWarning(Form(
"No entries for FMD%d%c, sector %d, strip %d",
502 det, ring , sec, strip));
505 Double_t mean = hChannel->GetMean();
506 Double_t rms = hChannel->GetRMS();
509 Int_t firstBin = hChannel->GetXaxis()->GetFirst();
510 Int_t lastBin = hChannel->GetXaxis()->GetLast();
511 hChannel->GetXaxis()->SetRangeUser(mean-4*rms,mean+4*rms);
513 mean = hChannel->GetMean();
514 rms = hChannel->GetRMS();
516 hChannel->GetXaxis()->SetRange(firstBin,lastBin);
521 Int_t channelNo = (strip + ((sec % 2 == 1) ? -1 : 1) * channelOff);
522 TGraphErrors* channel =
GetChannel(det,ring,sec,channelNo);
529 static_cast<TH1S*
>(hChannel->Clone(Form(
"FMD%d%c[%02d,%03d]_0x%02x",
530 det, ring, sec, channelNo,
532 out->SetTitle(Form(
"FMD%d%c[%02d,%03d] DAC=0x%02x (%3d)",
533 det, ring, sec, channelNo,
int(pulse),
int(pulse)));
534 out->SetDirectory(0);
560 for(UShort_t det=1; det<=3;det++) {
561 UShort_t firstring = (det == 1 ? 1 : 0);
562 for(UShort_t iring = firstring; iring <=1;iring++) {
563 Char_t ring = (iring == 1 ?
'I' :
'O');
564 for(UShort_t board =0 ; board <=1; board++) {
Bool_t OpenFiles(Bool_t appendRun=false)
self initialized array, used for adding constraints
virtual void InitContainer(TDirectory *dir)
void Terminate(TFile *dummy)
void SetRequiredEvents(Int_t nEvents)
void FillChannels(AliFMDDigit *digit)
Int_t GetHalfringIndex(UShort_t, Char_t, UShort_t) const
Int_t GetCurrentEvent() const
virtual void AddSectorSummary(Array *secArray, UShort_t det, Char_t ring, UShort_t sector, UShort_t nStrip)
void Rotate(const char *base, int max) const
virtual void InitContainer(TDirectory *dir)
TArrayS fEventsPerChannel
std::ofstream fOutputFile
This class is a singleton that handles various parameters of the FMD detectors. This class reads from...
Manager of FMD parameters.
AliFMDAltroMapping * GetAltroMap() const
void MakeSummary(UShort_t det, Char_t ring)
void ResetPulseAndUpdateChannel()
void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip)
#define AliWarning(message)
void AddChannelContainer(Array *sectorArray, UShort_t det, Char_t ring, UShort_t sec, UShort_t strip)
Map HW address to detector coordinates and back again.
TGraphErrors * GetChannel(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip)
static const char * GetGainShuttleID()
TH1F * GetSectorSummary(UShort_t det, Char_t ring, UShort_t sec)
TH2 * MakeSummaryHistogram(const char *prefix, const char *title, UShort_t det, Char_t ring)
void UpdatePulseAndADC(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip)
Per strip gain calibration.
static AliFMDParameters * Instance()
TString fDiagnosticsFilename
Int_t fNumberOfStripsPerChip
Int_t fCurrentSummaryStrip
AliFMDBaseDA::Array Array
UShort_t Detector() const
virtual Bool_t OpenFiles(Bool_t appendRun=false)
Array * GetSectorArray(UShort_t det, Char_t ring, UShort_t sector)
Short_t Sector2Board(Char_t ring, UShort_t sec) const
TH1S * GetChannelHistogram(UShort_t det, Char_t ring, UShort_t sec, UShort_t va)
Array * GetStripArray(UShort_t det, Char_t ring, UShort_t sector, UShort_t strip)