1 /**************************************************************************
2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 * @file AliFMDDisplay.cxx
18 * @author Christian Holm Christensen <cholm@nbi.dk>
19 * @date Mon Mar 27 12:39:09 2006
20 * @brief FMD Event display
22 //___________________________________________________________________
24 // The classes defined here, are utility classes for reading in data
25 // for the FMD. They are put in a seperate library to not polute the
26 // normal libraries. The classes are intended to be used as base
27 // classes for customized class that do some sort of analysis on the
28 // various types of data produced by the FMD.
30 // Latest changes by Christian Holm Christensen
34 #include <TApplication.h>
37 #include <TGeoManager.h>
39 #include <TMarker3DBox.h>
42 #include <TSliderBox.h>
45 #include <TVirtualX.h>
46 #include <TVirtualViewer3D.h>
48 // #include <TArrayF.h>
49 // #include <TParticle.h>
51 #include "AliFMDDisplay.h" // ALIFMDDISPLAY_H
52 #include "AliFMDHit.h" // ALIFMDHIT_H
53 #include "AliFMDDigit.h" // ALIFMDDIGIT_H
54 #include "AliFMDSDigit.h" // ALIFMDSDIGIT_H
55 #include "AliFMDRecPoint.h" // ALIFMDRECPOINT_H
56 #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H
57 #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H
58 #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H
59 #include <AliESDFMD.h> // ALIESDFMD_H
60 // #include <AliLog.h>
61 #include "AliFMDDebug.h" // Better debug macros
63 //____________________________________________________________________
64 ClassImp(AliFMDDisplay)
66 ; // This is here to keep Emacs for indenting the next line
69 //____________________________________________________________________
70 AliFMDDisplay* AliFMDDisplay::fgInstance = 0;
72 //____________________________________________________________________
73 const AliFMDDisplay::Range_t AliFMDDisplay::fgkEdepRange = { 100, 0., 2. };
74 const AliFMDDisplay::Range_t AliFMDDisplay::fgkAdcRange = { 1024, 0., 1023. };
75 const AliFMDDisplay::Range_t AliFMDDisplay::fgkMultRange = { 500, 0., 20. };
78 //____________________________________________________________________
80 AliFMDDisplay::Instance()
82 // Return static instance
83 // If the instance does not exist
88 //____________________________________________________________________
89 AliFMDDisplay::~AliFMDDisplay()
102 if (fPad) delete fPad;
104 if (fSlider) delete fSlider;
105 if (fCanvas) delete fCanvas;
108 //____________________________________________________________________
109 AliFMDDisplay::AliFMDDisplay(Bool_t onlyFMD, const char* gAliceFile)
110 : AliFMDInput(gAliceFile),
135 fTimeout("gApplication->StopIdleing()", 10),
138 fInitialFactor(3/10.)
140 // Constructor of an FMD display object.
143 SetName("AliFMDDisplay");
144 SetTitle("3D Display of various kinds of FMD data");
146 if (fgInstance) delete fgInstance;
150 //____________________________________________________________________
152 AliFMDDisplay::MakeCanvas(const char** which)
156 // which Which button to put up.
157 gStyle->SetPalette(1);
158 // gStyle->SetCanvasPreferGL(kTRUE);
161 fCanvas = new TCanvas(Form("gl%s", GetName()),
162 Form("%s - Display", GetTitle()),
163 w, Int_t(w / (1-y1)));
164 fCanvas->SetFillColor(1);
165 fCanvas->ToggleEventStatus();
167 fPad = new TPad("glview", "3DView", 0.0, y1, 1.0, 1.0, 1, 0, 0);
170 const char** p = which;
175 AliFMDDebug(1, ("Got %d buttons", n));
181 if (TESTBIT(fTreeMask, kDigits) ||
182 TESTBIT(fTreeMask, kRawCalib) ||
183 TESTBIT(fTreeMask, kRaw)) {
186 fFactor = new TSlider("pedFactor", "Pedestal Factor", xb+.01, 0, 1, yb);
187 fFactor->SetMethod("AliFMDDisplay::Instance()->ChangeFactor()");
188 fFactor->SetRange(fInitialFactor, 1);
190 fFactor->SetMinimum(fInitialFactor);
192 static_cast<TSliderBox*>(fFactor->GetListOfPrimitives()->
193 FindObject("TSliderBox"));
195 sbox->SetToolTipText("Adjust the noise suppression factor by moving "
199 if (TESTBIT(fTreeMask, kHits) ||
200 TESTBIT(fTreeMask, kESD) ||
201 TESTBIT(fTreeMask, kDigits) ||
202 TESTBIT(fTreeMask, kSDigits) ||
203 TESTBIT(fTreeMask, kRaw) ||
204 TESTBIT(fTreeMask, kRawCalib)) {
206 fSlider = new TSlider("genCut", "Multiplicity cut", 0, 0, xb, yb);
207 fSlider->SetMethod("AliFMDDisplay::Instance()->ChangeCut()");
208 fSlider->SetRange(fInitialMin,fInitialMax);
211 static_cast<TSliderBox*>(fSlider->GetListOfPrimitives()->
212 FindObject("TSliderBox"));
214 sbox->SetToolTipText("Adjust lower and upper limit on data signal");
217 // fCanvas->Modified();
218 // fCanvas->Update();
223 while ((m = *(p++))) {
225 AliFMDDebug(1, ("Adding button %s", m));
226 TButton* b = new TButton(m, Form("AliFMDDisplay::Instance()->%s()", m),
227 x0, yb, TMath::Min(x0 + dx,.999F), y1);
235 //____________________________________________________________________
237 AliFMDDisplay::ShowOnlyFMD()
242 if (!fGeoManager) return;
243 static bool once = false;
246 AliInfo("Will only show the FMD");
247 TGeoVolume* top = gGeoManager->GetTopVolume();
248 top->InvisibleAll(kTRUE);
249 TGeoIterator next(top);
252 // Bool_t hasFMD1 = kFALSE;
253 // Bool_t hasFMD2 = kFALSE;
254 // Bool_t hasFMD3 = kFALSE;
255 AliFMDDebug(1, ("Getting material FMD_Si$"));
256 TGeoMaterial* si = gGeoManager->GetMaterial("FMD_Si$"); // kRed
257 AliFMDDebug(1, ("Getting material FMD_Carbon$"));
258 TGeoMaterial* c = gGeoManager->GetMaterial("FMD_Carbon$"); // kGray
259 AliFMDDebug(1, ("Getting material FMD_Aluminum$"));
260 TGeoMaterial* al = gGeoManager->GetMaterial("FMD_Aluminum$");// kGray-2
261 AliFMDDebug(1, ("Getting material FMD_Copper$"));
262 TGeoMaterial* cu = gGeoManager->GetMaterial("FMD_Copper$"); // kGreen-2
263 AliFMDDebug(1, ("Getting material FMD_PCB$"));
264 TGeoMaterial* pcb = gGeoManager->GetMaterial("FMD_PCB$"); // kGreen+2
265 AliFMDDebug(1, ("Getting material FMD_PCB$"));
266 TGeoMaterial* chip = gGeoManager->GetMaterial("FMD_Si Chip$");// kGreen+2
268 while ((node = static_cast<TGeoNode*>(next()))) {
269 const char* name = node->GetName();
271 if (!(v = node->GetVolume())) continue;
273 if (name[0] == 'F') {
274 TGeoMaterial* m = (v->IsAssembly() ? 0 : v->GetMaterial());
276 if (m == si) col = kRed;
277 else if (m == c) col = kGray;
278 else if (m == al) col = kYellow+4;
279 else if (m == cu) col = kRed+6;
280 else if (m == pcb) col = kGreen+2;
281 else if (m == chip) col = kGreen+4;
283 v->SetLineColor(col);
284 v->SetFillColor(col);
286 if (name[2] == 'M' && (name[3] == 'T' || name[3] == 'B')) {
287 // Virtual Master half-ring volume - top-level
288 // Int_t det = node->GetNumber();
290 case 1: hasFMD1 = true; break;
291 case 2: hasFMD2 = true; break;
292 case 3: hasFMD3 = true; break;
297 else if (name[3] == 'V' && (name[2] == 'T' || name[2] == 'B'))
298 toshow.Add(v); // Virtual Half-ring, bare detectors
299 else if (name[3] == 'H' && (name[2] == 'F' || name[2] == 'B'))
300 toshow.Add(v); // Virtual Hybrid container
301 else if (name[2] == 'S' && name[3] == 'U')
302 toshow.Add(v); // Virtual support structre
303 // else if (name[3] == 'H' && (name[2] == 'F' || name[2] == 'B'))
304 // toshow.Add(v); // Virtual Hybrid container
306 v->SetVisibility(kFALSE);
307 v->SetVisDaughters(kFALSE);
308 v->InvisibleAll(kTRUE);
311 while ((v = static_cast<TGeoVolume*>(i()))) {
312 if (!v->IsAssembly())
313 v->SetVisibility(kTRUE);
314 v->InvisibleAll(kFALSE);
315 v->SetVisDaughters(kTRUE);
321 //____________________________________________________________________
323 AliFMDDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
325 // Execute an event on canvas
327 // event What happened
328 // px, py Pixel coordinates
329 if (px == 0 && py == 0) return;
330 if (!fZoomMode && fPad->GetView()) {
331 fPad->GetView()->ExecuteRotateView(event, px, py);
334 fPad->SetCursor(kCross);
337 fPad->TAttLine::Modify();
338 fX0 = fPad->AbsPixeltoX(px);
339 fY0 = fPad->AbsPixeltoY(py);
340 fXPixel = fOldXPixel = px;
341 fYPixel = fOldYPixel = py;
346 gVirtualX->DrawBox(fXPixel, fYPixel, fOldXPixel, fOldYPixel,
351 gVirtualX->DrawBox(fXPixel, fYPixel, fOldXPixel, fOldYPixel,
355 fPad->GetCanvas()->FeedbackMode(kFALSE);
356 if (px == fXPixel || py == fYPixel) return;
357 fX1 = fPad->AbsPixeltoX(px);
358 fY1 = fPad->AbsPixeltoY(py);
359 if (fX1 < fX0) std::swap(fX0, fX1);
360 if (fY1 < fY0) std::swap(fY0, fY1);
361 fPad->Range(fX0, fY0, fX1, fY1);
367 //____________________________________________________________________
369 AliFMDDisplay::Init()
371 // Initialize. GEt transforms and such,
372 // so that we can draw thins properly
373 // Returns true on success
374 if (!AliFMDInput::Init()) return kFALSE;
375 AliFMDGeometry* geom = AliFMDGeometry::Instance();
377 geom->InitTransformations();
378 if (TESTBIT(fTreeMask, kDigits) || TESTBIT(fTreeMask, kRaw))
379 AliFMDParameters::Instance()->Init();
381 fMarkers = new TObjArray;
382 fHits = new TObjArray;
383 fMarkers->SetOwner(kTRUE);
384 fHits->SetOwner(kFALSE);
388 //____________________________________________________________________
390 AliFMDDisplay::MakeAux()
392 // MAke the aux canvas
393 // This is used to display spectra
395 const Range_t* range = 0;
396 if (TESTBIT(fTreeMask, kESD)) range = &fgkMultRange;
397 else if (TESTBIT(fTreeMask, kRawCalib)) range = &fgkMultRange;
398 else if (TESTBIT(fTreeMask, kDigits)) range = &fgkAdcRange;
399 else if (TESTBIT(fTreeMask, kSDigits)) range = &fgkAdcRange;
400 else if (TESTBIT(fTreeMask, kRaw)) range = &fgkAdcRange;
401 else if (TESTBIT(fTreeMask, kHits)) range = &fgkEdepRange;
405 fAux = new TCanvas(Form("aux_%s", GetName()),
406 Form("Aux - %s", GetTitle()));
408 fAux->SetFillColor(kWhite);
409 fAux->SetBorderMode(0);
410 fAux->SetBorderSize(0);
411 Float_t dBin = (range->fHigh - range->fLow) / range->fNbins;
412 fSpec = new TH1D("spec", "Spectra", range->fNbins,
413 range->fLow-dBin/2, range->fHigh+dBin/2);
414 fSpecCut = static_cast<TH1*>(fSpec->Clone("specCut"));
415 TString xTitle((TESTBIT(fTreeMask, kRawCalib) ||
416 TESTBIT(fTreeMask, kESD)) ? "#Delta E/#Delta E_{mip}" :
417 (TESTBIT(fTreeMask, kDigits) ||
418 TESTBIT(fTreeMask, kSDigits) ||
419 TESTBIT(fTreeMask, kRaw)) ? "ADC [counts]" :
420 TESTBIT(fTreeMask, kHits) ? "Hits" : "signal");
421 fSpec->SetXTitle(xTitle.Data());
422 fSpec->SetYTitle("events");
423 fSpec->SetFillColor(2);
424 fSpec->SetFillStyle(3001);
425 fSpecCut->SetXTitle(xTitle.Data());
426 fSpecCut->SetYTitle("events");
427 fSpecCut->SetFillColor(4);
428 fSpecCut->SetFillStyle(3001);
436 //____________________________________________________________________
438 AliFMDDisplay::DrawAux()
440 // Draw in the Aux the canvas
441 // For example draw the spectra
446 fAux->SetLogy(fSpec->GetMaximum() > 10);
448 fSpecCut->Draw("same");
454 //____________________________________________________________________
456 AliFMDDisplay::Begin(Int_t event)
458 // Begin of event. Make canvas is not already done
460 // event The event number
462 const char* m[] = { "Continue",
474 // AliInfo("Clearing canvas");
477 Warning("End", "No geometry manager");
480 AliFMDDebug(1, ("Drawing geometry"));
482 fGeoManager->GetTopVolume()->Draw();
483 if (fOnlyFMD) ShowOnlyFMD();
484 AliFMDDebug(1, ("Adjusting view"));
486 if (fPad->GetView()) {
487 fPad->GetView()->SetView(-200, -40, 80, irep);
488 fPad->GetView()->Zoom();
492 return AliFMDInput::Begin(event);
495 //____________________________________________________________________
497 AliFMDDisplay::AtEnd()
499 // Called at of the event.
510 //____________________________________________________________________
512 AliFMDDisplay::Idle()
515 // Sends the ROOT loop into the idle loop,
516 // so that we can go on.
518 if (fContinous) fTimeout.Start(10, kTRUE);
520 gApplication->StartIdleing();
521 gSystem->InnerLoop();
522 gApplication->StopIdleing();
523 if (fContinous) break;
525 AliFMDDebug(3, ("After idle loop"));
526 if (fMarkers) fMarkers->Delete();
527 if (fHits) fHits->Clear();
528 AliFMDDebug(3, ("After clearing caches"));
531 //____________________________________________________________________
535 // End of event. Draw everything
538 if (fReturn) return kFALSE;
539 return AliFMDInput::End();
542 //____________________________________________________________________
544 AliFMDDisplay::LookupColor(Float_t x, Float_t min, Float_t max) const
547 // Get a colour from the current palette depending
548 // on the ratio x/max
549 Float_t range = (max-min);
550 Float_t l = fSlider->GetMinimum();
551 Float_t h = fSlider->GetMaximum();
552 if (l == h) { l = 0; h = 1; }
553 Float_t cmin = range * l;
554 Float_t cmax = range * h;
555 Float_t crange = (cmax-cmin);
556 Int_t idx = Int_t((x-cmin) / crange * gStyle->GetNumberOfColors());
557 return gStyle->GetColorPalette(idx);
560 //____________________________________________________________________
562 AliFMDDisplay::SetCut(Float_t l, Float_t h)
564 // Change the cut on the slider.
567 if (!fSlider) return;
568 fSlider->SetMinimum(fInitialMin);
569 fSlider->SetMaximum(fInitialMax);
573 //____________________________________________________________________
575 AliFMDDisplay::SetFactor(Float_t f)
577 // Change the cut on the slider.
578 fInitialFactor = f / 10;
579 if (!fFactor) return;
580 fFactor->SetMinimum(fInitialFactor);
584 //____________________________________________________________________
586 AliFMDDisplay::ChangeCut()
588 // Change the cut on the slider.
589 // The factor depends on what is
590 // drawn in the AUX canvas
591 AliInfo(Form("Range is now %7.5f - %7.5f", fSlider->GetMinimum(),
592 fSlider->GetMaximum()));
593 if ((TESTBIT(fTreeMask, kESD) ||
594 TESTBIT(fTreeMask, kDigits) ||
595 TESTBIT(fTreeMask, kSDigits) ||
596 TESTBIT(fTreeMask, kRaw) ||
597 TESTBIT(fTreeMask, kRawCalib))) {
598 Float_t l = fSlider->GetMinimum();
599 Float_t h = fSlider->GetMaximum();
602 AliInfo(Form("ADC range is now %4d - %4d", int(l), int(h)));
606 //____________________________________________________________________
608 AliFMDDisplay::ChangeFactor()
610 // Change the cut on the slider.
611 // The factor depends on what is
612 // drawn in the AUX canvas
613 AliInfo(Form("Noise factor is now %4.1f", 10 * fFactor->GetMinimum()));
617 //____________________________________________________________________
619 AliFMDDisplay::Redisplay()
622 // Redraw markers, hits,
624 if (fMarkers) fMarkers->Delete();
625 if (fHits) fHits->Clear();
626 if (fSpec) fSpec->Reset();
627 if (fSpecCut) fSpecCut->Reset();
631 //____________________________________________________________________
633 AliFMDDisplay::Break()
636 // Redraw markers, hits,
638 if (fMarkers) fMarkers->Delete();
639 if (fHits) fHits->Clear();
640 if (fSpec) fSpec->Reset();
641 if (fSpecCut) fSpecCut->Reset();
645 //____________________________________________________________________
647 AliFMDDisplay::Render()
650 TVirtualViewer3D* viewer = fPad->GetViewer3D("ogl");
654 //____________________________________________________________________
656 AliFMDDisplay::AddMarker(Float_t x, Float_t y, Float_t z,
657 TObject* o, Float_t s, Float_t min, Float_t max)
659 // Add a marker to the display
665 // o Object to refer to
667 // max Maximum of signal
670 Float_t zsize = (s - min) / (max-min) * 10;
671 Float_t r = TMath::Sqrt(x * x + y * y);
672 Float_t theta = TMath::ATan2(r, z);
673 Float_t phi = TMath::ATan2(y, x);
674 Float_t rz = z + (z < 0 ? 1 : -1) * zsize;
675 TMarker3DBox* marker = new TMarker3DBox(x,y,rz,size,size,zsize,theta,phi);
676 if (o) marker->SetRefObject(o);
677 marker->SetLineColor(LookupColor(s, min, max));
678 fMarkers->Add(marker);
680 //____________________________________________________________________
682 AliFMDDisplay::AddMarker(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
683 TObject* o, Float_t s, Float_t min, Float_t max)
685 // Add a marker to the display
691 // o Object to refer to
693 // max Maximum of signal
695 AliFMDGeometry* geom = AliFMDGeometry::Instance();
697 geom->Detector2XYZ(det, rng, sec, str, x, y, z);
698 AddMarker(x,y,z,o,s,min,max);
701 //____________________________________________________________________
703 AliFMDDisplay::InsideCut(Float_t val, const Float_t& min,
704 const Float_t& max) const
707 // Whether a point is inside
715 // true if @a v is inside cut
717 Float_t r = max - min;
718 Float_t l = fSlider->GetMinimum();
719 Float_t h = fSlider->GetMaximum();
720 if (l == h) { l = 0; h = 1; }
721 if (val < r * l + min || val > r * h + min) {
722 AliFMDDebug(2, ("Value %f is outside cut %f - %f (range %f - %f)",
723 val, min+r*l, min+r*h, min, max));
730 //____________________________________________________________________
732 AliFMDDisplay::ProcessHit(AliFMDHit* hit, TParticle* /* p */)
737 static const Float_t rMin = fgkEdepRange.fLow;
738 static const Float_t rMax = fgkEdepRange.fHigh;
740 if (!hit) { AliError("No hit"); return kFALSE; }
741 // if (!p) { AliError("No track"); return kFALSE; }
742 Float_t edep = hit->Edep();
744 if (fHits) fHits->Add(hit);
745 if (fSpec) fSpec->Fill(edep);
746 if (!InsideCut(edep, rMin, rMax)) return kTRUE;
747 if (fSpecCut) fSpecCut->Fill(edep);
749 AddMarker(hit->X(), hit->Y(), hit->Z(), hit, edep, rMin, rMax);
753 //____________________________________________________________________
755 AliFMDDisplay::ProcessDigit(AliFMDDigit* digit)
759 // digit Digit information
760 static const Float_t rMin = fgkAdcRange.fLow;
761 static const Float_t rMax = fgkAdcRange.fHigh;
763 if (!digit) { AliError("No digit"); return kFALSE; }
765 UShort_t det = digit->Detector();
766 Char_t ring = digit->Ring();
767 UShort_t sec = digit->Sector();
768 UShort_t str = digit->Strip();
769 Double_t threshold = GetADCThreshold(det, ring, sec, str);
770 Float_t counts = digit->Counts();
771 if (threshold < 0) { counts += -threshold; threshold = 0; }
773 AliFMDDebug(10, ("FMD%d%c[%02d,%03d] counts %4d threshold %4d",
774 det, ring, sec, str, Int_t(counts), Int_t(threshold)));
775 if (fHits) fHits->Add(digit);
776 if (fSpec) fSpec->Fill(counts);
777 if (!InsideCut(counts-threshold, rMin, rMax)) return kTRUE;
778 if (fSpecCut) fSpecCut->Fill(counts);
781 AddMarker(det, ring, sec, str, digit, counts, rMin, rMax);
785 //____________________________________________________________________
787 AliFMDDisplay::ProcessSDigit(AliFMDSDigit* sdigit)
791 // sdigit Digit information
792 static const Float_t rMin = fgkAdcRange.fLow;
793 static const Float_t rMax = fgkAdcRange.fHigh;
795 if (!sdigit) { AliError("No sdigit"); return kFALSE; }
797 UShort_t det = sdigit->Detector();
798 Char_t ring = sdigit->Ring();
799 UShort_t sec = sdigit->Sector();
800 UShort_t str = sdigit->Strip();
801 Float_t counts = sdigit->Counts();
803 if (fHits) fHits->Add(sdigit);
804 if (fSpec) fSpec->Fill(counts);
805 if (!InsideCut(counts, rMin, rMax)) return kTRUE;
806 if (fSpecCut) fSpecCut->Fill(counts);
808 AddMarker(det, ring, sec, str, sdigit, counts, rMin, rMax);
812 //____________________________________________________________________
814 AliFMDDisplay::ProcessRawDigit(AliFMDDigit* digit)
818 // digit Digit information
819 AliFMDDebug(50, ("Forwarding call of ProcessRaw to ProcessDigit "
820 "for FMD%d%c[%02d,%03d] %d",
821 digit->Detector(), digit->Ring(), digit->Sector(),
822 digit->Strip(), digit->Counts()));
823 return ProcessDigit(digit);
826 //____________________________________________________________________
828 AliFMDDisplay::ProcessRawCalibDigit(AliFMDDigit* digit)
832 // digit Digit information
833 static const Float_t rMin = fgkMultRange.fLow;
834 static const Float_t rMax = fgkMultRange.fHigh;
835 static const Float_t aMin = fgkAdcRange.fLow;
836 static const Float_t aMax = fgkAdcRange.fHigh;
838 if (!digit) { AliError("No digit"); return kFALSE; }
840 AliFMDParameters* parm = AliFMDParameters::Instance();
841 UShort_t det = digit->Detector();
842 Char_t ring = digit->Ring();
843 UShort_t sec = digit->Sector();
844 UShort_t str = digit->Strip();
845 Double_t gain = parm->GetPulseGain(det, ring, sec, str);
846 Double_t ped = parm->GetPedestal(det, ring, sec, str);
847 Double_t threshold = GetADCThreshold(det, ring, sec, str);
848 Float_t counts = digit->Counts();
849 if (threshold < 0) { counts += -threshold; threshold = 0; ped = 0; }
851 // Double_t edep = ((counts * parm->GetEdepMip() /
852 // (gain * parm->GetDACPerMIP()));
853 Double_t mult = (counts-ped) / (gain * parm->GetDACPerMIP());
854 if (gain < 0.1 || gain > 10) mult = 0;
857 AliFMDDebug(10, ("FMD%d%c[%02d,%03d] adc %4d "
858 "(threshold %4d, gain %6.3f) -> mult %7.4f",
859 det, ring, sec, str, int(counts), int(threshold),
861 if (fHits) fHits->Add(digit);
862 if (fSpec) fSpec->Fill(mult);
863 if (!InsideCut(counts-threshold, aMin, aMax)) return kTRUE;
864 if (fSpecCut) fSpecCut->Fill(mult);
867 AddMarker(det, ring, sec, str, digit, mult, rMin, rMax);
871 //____________________________________________________________________
873 AliFMDDisplay::ProcessRecPoint(AliFMDRecPoint* recpoint)
875 // Process reconstructed point
877 // recpoint Reconstructed multiplicity/energy
878 static const Float_t rMin = fgkMultRange.fLow;
879 static const Float_t rMax = fgkMultRange.fHigh;
882 if (!recpoint) { AliError("No recpoint"); return kFALSE; }
884 if (!InsideCut(recpoint->Particles(), rMin, rMax)) return kTRUE;
886 if (fHits) fHits->Add(recpoint);
887 AddMarker(recpoint->Detector(), recpoint->Ring(), recpoint->Sector(),
888 recpoint->Strip(), recpoint, recpoint->Particles(), rMin, rMax);
892 //____________________________________________________________________
894 AliFMDDisplay::ProcessESD(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
895 Float_t, Float_t mult)
897 // Process data from ESD
899 // det,rng,sec,str Detector coordinates.
900 // mult Multiplicity.
901 static const Float_t rMin = fgkMultRange.fLow;
902 static const Float_t rMax = fgkMultRange.fHigh;
904 Double_t cmult = mult;
905 if (fSpec) fSpec->Fill(cmult);
906 if (!InsideCut(cmult, rMin, rMax) || cmult == AliESDFMD::kInvalidMult)
909 AddMarker(det,rng,sec,str, 0, cmult, rMin, rMax);
911 if (fSpecCut) fSpecCut->Fill(cmult);
916 //____________________________________________________________________
918 AliFMDDisplay::GetADCThreshold(UShort_t d, Char_t r,
919 UShort_t s, UShort_t t) const
922 // Get the ADC threshold
933 AliFMDParameters* parm = AliFMDParameters::Instance();
934 Double_t ped = parm->GetPedestal(d,r, s, t);
935 Double_t pedW = parm->GetPedestalWidth(d,r, s, t);
936 Double_t threshold = 0;
937 if (fFMDReader && fFMDReader->IsZeroSuppressed(d-1))
938 threshold = - fFMDReader->NoiseFactor(d-1) * pedW;
940 threshold = ped + pedW * 10 * fFactor->GetMinimum();
941 AliFMDDebug(10, ("FMD%d%c[%2d,%3d] ped: %f +/- %f [factor: %f-%f]",
942 d, r, s, t, ped, pedW,
943 fFactor->GetMinimum(), fFactor->GetMaximum()));
944 if (threshold > fgkAdcRange.fHigh) threshold = fgkAdcRange.fHigh;
948 //____________________________________________________________________