X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDPattern.cxx;h=22d2690de7bc382c46872286306f0c735b33d120;hb=cb9600c7a4fb7f7cc22bf89f6d1568d37f97c182;hp=d575a5ef114dd05e063b1cb6aac090f797cea561;hpb=ef8e862321a54d139b59b912a26975020e4dab67;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDPattern.cxx b/FMD/AliFMDPattern.cxx index d575a5ef114..22d2690de7b 100644 --- a/FMD/AliFMDPattern.cxx +++ b/FMD/AliFMDPattern.cxx @@ -29,7 +29,7 @@ // Latest changes by Christian Holm Christensen // -// #include +#include // #include // #include @@ -50,8 +50,12 @@ #include "AliFMDRing.h" // #include "AliFMDDetector.h" #include "AliFMDHit.h" +#include "AliMultiplicity.h" +#include "AliESDEvent.h" +#include "AliESDVertex.h" // #include #include "AliFMDDebug.h" // Better debug macros +// #include "AliPhysicsSelection.h" class AliFMDDetector; //____________________________________________________________________ @@ -65,7 +69,9 @@ AliFMDPattern::AliFMDPatternDetector::AliFMDPatternDetector(UShort_t id) : fId(id), fCounts(0), fGraphs(0), - fFrame(0) + fFrame(0), + fInners(10), + fOuters(id == 1 ? 0 : 20) { // CTOR // @@ -85,7 +91,7 @@ AliFMDPattern::AliFMDPatternDetector::~AliFMDPatternDetector() //____________________________________________________________________ void -AliFMDPattern::AliFMDPatternDetector::DrawShape(TObjArray& a) +AliFMDPattern::AliFMDPatternDetector::DrawShape(const TObjArray& a) { // Draw all shapes. // @@ -101,6 +107,54 @@ AliFMDPattern::AliFMDPatternDetector::DrawShape(TObjArray& a) } } +//____________________________________________________________________ +void +AliFMDPattern::AliFMDPatternDetector::CopyShapes(const TObjArray& src, + TObjArray& dest, + Double_t ang, + Double_t fx, + Double_t fy) +{ + // + // Copy shapes + // + // Parameters: + // input Source + // own Ours + // ang Angle + // fx Factor x + // fy Factor y + // + TIter next(&src); + TGraph* g = 0; + while ((g = static_cast(next()))) { + TGraph* gg = new TGraph(*g); + Double_t* x = gg->GetX(); + Double_t* y = gg->GetY(); + for (Int_t i = 0; i < gg->GetN(); i++) { + Float_t xx = x[i] * TMath::Cos(ang) - y[i] * TMath::Sin(ang); + Float_t yy = x[i] * TMath::Sin(ang) + y[i] * TMath::Cos(ang); + gg->SetPoint(i, fx * xx, fy * yy); + } + gg->SetFillStyle(g->GetFillStyle()); + gg->SetFillColor(g->GetFillColor()); + gg->SetLineStyle(g->GetLineStyle()); + gg->SetLineColor(g->GetLineColor()); + gg->SetLineWidth(g->GetLineWidth()); + gg->SetMarkerStyle(g->GetMarkerStyle()); + gg->SetMarkerColor(g->GetMarkerColor()); + gg->SetMarkerSize(g->GetMarkerSize()); + TString name(g->GetName()); + name.ReplaceAll("X", Form("%d",fId)); + gg->SetName(name.Data()); + TString title(g->GetTitle()); + title.ReplaceAll("X", Form("%d",fId)); + gg->SetTitle(title.Data()); + dest.Add(gg); + } + dest.SetOwner(); +} + //____________________________________________________________________ void AliFMDPattern::AliFMDPatternDetector::Begin(Int_t nlevel, @@ -122,16 +176,26 @@ AliFMDPattern::AliFMDPatternDetector::Begin(Int_t nlevel, TStyle* style = gStyle; if (nlevel < 1) nlevel = style->GetNumberOfColors(); fCounts.Set(nlevel); + Double_t rr = 1.05 * r; if (!fFrame) { // The code-checker thinks this is not using the declaration of // TH2F - what a morron! fFrame = new TH2F(Form("fmd%dFrame", fId), Form("FMD%d", fId), - 10, -r, r, 10, -r, r); + 100, -rr, rr, 100, -rr, rr); fFrame->SetStats(kFALSE); fFrame->Draw(); } - DrawShape(inners); - if (fId != 1) DrawShape(outers); + Double_t ang = (fId == 1 ? -TMath::Pi() / 2 : 0); + Double_t fx = (fId == 3 ? -1 : 1); // Flip around Y + Double_t fy = (fId == 1 ? 1 : 1); // Flip around X + + CopyShapes(inners, fInners, ang, fx, fy); + DrawShape(fInners); + if (fId != 1) { + CopyShapes(outers, fOuters, ang, fx, fy); + DrawShape(fOuters); + } + for (Int_t i = 0; i < nlevel; i++) { TGraph* g = new TGraph; Int_t idx = Int_t(Float_t(i) / nlevel * style->GetNumberOfColors()); @@ -142,6 +206,7 @@ AliFMDPattern::AliFMDPatternDetector::Begin(Int_t nlevel, g->SetFillColor(col); g->SetMarkerSize(i * .2 + .2); g->SetMarkerStyle(2); + g->SetEditable(kFALSE); g->Draw("same p"); fGraphs.AddAtAndExpand(g, i); } @@ -166,10 +231,23 @@ AliFMDPattern::AliFMDPatternDetector::End() // Simply resets number of points at each level to // the seen number of hits at that level. // Avoid deleting memory. + + TIter next(&fGraphs); TGraph* g = 0; Int_t i = 0; - while ((g = static_cast(next()))) g->Set(fCounts[i++]); + while ((g = static_cast(next()))) { + Int_t cnt = fCounts[i++]; + if (cnt > 0) { + g->Set(cnt); + g->SetMarkerSize(i * .2 + .2); + } + else { + g->SetPoint(0,0,0); + g->SetMarkerSize(0); + } + } + } //____________________________________________________________________ void @@ -186,10 +264,17 @@ AliFMDPattern::AliFMDPatternDetector::AddMarker(Double_t x, // X,Y,Z Coordiantes // MAX Maximum value. // - /** Sigh, for some odd reason, the code-checker does not recognise - this a usage of the TMath namespace declaration! Idiot */ + // Sigh, for some odd reason, the code-checker does not recognise + // this a usage of the TMath namespace declaration! Idiot + // Int_t i = TMath::Min(Int_t(fCounts.fN * s / max), Int_t(fGraphs.GetEntries()-1)); + if (i < 0 || i >= fCounts.fN) { + std::cerr << "Graph index " << i << " out of bounds [0," + << fCounts.fN << ") - " + << fCounts.fN << " * " << s << " / " << max << std::endl; + return; + } TGraph* g = static_cast(fGraphs.At(i)); if (!g) return; g->SetPoint(fCounts[i]++, x, y); @@ -215,7 +300,10 @@ AliFMDPattern::AliFMDPattern(const char* gAliceFile) fFMD2Sum(.2, .6, "# in FMD2: "), fFMD3Sum(.2, .5, "# in FMD3: "), fLine(.15, .47, .85, .47), - fTotal(.2, .35, "Total: ") + fTotal(.2, .35, "Total: "), + fFMD1Area(0), + fFMD2Area(0), + fFMD3Area(0)// ,fPhysicsSelection(0) { // Constructor. // @@ -226,7 +314,7 @@ AliFMDPattern::AliFMDPattern(const char* gAliceFile) SetName("AliFMDPattern"); SetName("2D display of FMD data"); - + // fPhysicsSelection = new AliPhysicsSelection(); // RemoveLoad(kGeometry); fEvent.SetBit(TLatex::kTextNDC); fFMD1Sum.SetBit(TLatex::kTextNDC); @@ -259,30 +347,53 @@ AliFMDPattern::Init() geom->Init(); geom->InitTransformations(); + fFMD1Area = 0; + fFMD2Area = 0; + fFMD3Area = 0; + + Double_t innerArea = 0; + Double_t outerArea = 0; + Char_t rs[] = { 'I' , 'O', '\0' }; Char_t *r = rs; do { AliFMDRing* ring = geom->GetRing(*r); if (!ring) continue; + + Double_t rl = ring->GetMinR(); + Double_t rh = ring->GetMaxR(); + Double_t area = rh * rh * TMath::Pi() - rl * rl * TMath::Pi(); + if (*r == 'I') innerArea = area; + else outerArea = area; + + const TObjArray& vs = ring->GetVerticies(); TObjArray& gs = (*r == 'I' ? fInners : fOuters); Float_t& mr = (*r == 'I' ? fInnerMax : fOuterMax); Int_t nm = ring->GetNModules(); - AliInfo(Form("Making %d modules for %c", nm, *r)); + AliFMDDebug(1, ("Making %d modules for %c", nm, *r)); for (Int_t m = 0; m < nm; m++) { - Int_t nv = vs.GetEntries(); + Int_t nv = 6; // vs.GetEntries(); Double_t a = TMath::Pi() / 180 * (m * 2 + 1) * ring->GetTheta(); TGraph* g = new TGraph(nv+1); Double_t x0 = 0, y0 = 0; gs.AddAtAndExpand(g, m); - for (Int_t c = 0; c < nv; c++) { + for (Int_t c = 1; c < 4; c++) { TVector2* v = static_cast(vs.At(c)); mr = TMath::Max(mr, Float_t(v->Mod())); TVector2 w(v->Rotate(a)); - if (c == 0) { x0 = w.X(); y0 = w.Y(); } - g->SetPoint(c, w.X(), w.Y()); + if (c == 1) { x0 = w.X(); y0 = w.Y(); } + g->SetPoint(c-1, w.X(), w.Y()); } - g->SetName(Form("FMDX%c_%02d", *r, m)); + for (Int_t c = 3; c > 0; c--) { + TVector2* v = static_cast(vs.At(c)); + TVector2 u(-v->X(), v->Y()); + mr = TMath::Max(mr, Float_t(u.Mod())); + TVector2 w(u.Rotate(a)); + g->SetPoint(3+(3-c), w.X(), w.Y()); + } + g->SetName(Form("FMDX%c_%02d%02d", *r, 2*m,2*m+1)); + g->SetTitle(Form("FMDX%c, sectors %d and %d", *r, 2*m,2*m+1)); g->SetPoint(nv, x0, y0); g->SetFillColor((*rs == 'I' ? (m % 2 == 0 ? 18 : 17) : @@ -293,7 +404,11 @@ AliFMDPattern::Init() g->SetLineStyle(2); } } while (*(++r)); - + + fFMD1Area = innerArea; + fFMD2Area = innerArea + outerArea; + fFMD3Area = innerArea + outerArea; + return kTRUE; } @@ -309,7 +424,7 @@ AliFMDPattern::Begin(Int_t event) // MakeAux(); if (!fCanvas) { - const char* which[] = { "Continue", "Redisplay", 0 }; + const char* which[] = { "Continue", "Start", "Pause", "Redisplay", 0 }; MakeCanvas(which); AliFMDGeometry* geom = AliFMDGeometry::Instance(); @@ -354,6 +469,17 @@ AliFMDPattern::Begin(Int_t event) fFMD1.Clear(); fFMD2.Clear(); fFMD3.Clear(); + +#if 0 + TString triggers = fESDEvent->GetFiredTriggerClasses(); + const AliESDVertex* vertex = fESDEvent->GetPrimaryVertexSPD(); + Double_t vertexXYZ[3]; + vertex->GetXYZ(vertexXYZ); + const AliMultiplicity* mult = fESDEvent->GetMultiplicity(); + Int_t nTrackLets = mult->GetNumberOfTracklets(); + std::cout<IsCollisionCandidate(fESDEvent)<<" "<Modified(); - fFMD1Sum.SetTitle(Form("# hits in FMD1: %5d", fFMD1.Total())); + fFMD1Sum.SetTitle(Form("# hits in FMD1: %5d (%4.2f /cm^{2})", + fFMD1.Total(), fFMD1.Total()/fFMD1Area)); total += fFMD1.Total(); fFMD2.End(); fFMD2Pad->Modified(); - fFMD2Sum.SetTitle(Form("# hits in FMD2: %5d", fFMD2.Total())); + fFMD2Sum.SetTitle(Form("# hits in FMD2: %5d (%4.2f /cm^{2})", + fFMD2.Total(), fFMD2.Total()/fFMD2Area)); total += fFMD2.Total(); fFMD3.End(); fFMD3Pad->Modified(); - fFMD3Sum.SetTitle(Form("# hits in FMD3: %5d", fFMD3.Total())); + fFMD3Sum.SetTitle(Form("# hits in FMD3: %5d (%4.2f /cm^{2})", + fFMD3.Total(), fFMD3.Total()/fFMD3Area)); total += fFMD3.Total(); fTotal.SetTitle(Form("Total: %5d/51200 (%3d%%)", @@ -459,7 +588,7 @@ AliFMDPattern::AddMarker(UShort_t det, Char_t rng, geom->Detector2XYZ(det, rng, sec, str, x, y, z); // Make code-checker shut the f**k up TRandom* rand = gRandom; - if (true) { + if (false) { AliFMDRing* r = geom->GetRing(rng); Double_t t = .9 * r->GetTheta() / 2; Double_t a = rand->Uniform(-t,t) * TMath::Pi() / 180;